:root {
    /* Chrome 深色主題色 */
    --chrome-dark-bg: #202124;
    --chrome-dark-surface: #2d2e30;
    --chrome-dark-surface2: #3c3d3f;
    --chrome-dark-border: #5f6368;
    --chrome-dark-text: #e8eaed;
    --chrome-dark-text-secondary: #9aa0a6;
    --chrome-accent: #8ab4f8;
    --chrome-accent-hover: #a8c7fa;
    --chrome-red: #f28b82;
    --chrome-shadow: 0 0.0625rem 0.1875rem rgba(0,0,0,0.3);
    
    /* ETA 時間顏色 */
    --eta-time-color: #FFD700;
    
    /* 基础字体大小 */
    --base-font-size: 1rem;
}

/* 白天模式 */
[data-theme="light"] {
    --chrome-dark-bg: #ffffff;
    --chrome-dark-surface: #f8f9fa;
    --chrome-dark-surface2: #e9ecef;
    --chrome-dark-border: #dee2e6;
    --chrome-dark-text: #212529;
    --chrome-dark-text-secondary: #6c757d;
    --chrome-accent: #0d6efd;
    --chrome-accent-hover: #0b5ed7;
    --chrome-red: #dc3545;
    --chrome-shadow: 0 0.0625rem 0.1875rem rgba(0,0,0,0.1);
    
    /* 白天模式 ETA 時間改為深藍色 */
    --eta-time-color: #1a365d;
}

/* 基础重置 - 防止缩放 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--chrome-dark-bg);
    color: var(--chrome-dark-text);
    line-height: 1.5;
    transition: all 0.3s ease;
    touch-action: manipulation;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    font-size: var(--base-font-size);
    height: 100%;
    overflow: hidden;
}

/* 应用容器 - 全屏高度 */
.app {
    width: 100%;
    height: 100vh;
    background: var(--chrome-dark-bg);
    position: relative;
    display: flex;
    flex-direction: column;
}

/* 搜索页面 - 全屏高度 */
.search-page {
    background: var(--chrome-dark-bg);
    height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom);
}

/* 搜索头部 - 占屏幕高度10% */
.search-header {
    position: sticky;
    top: 0;
    background: var(--chrome-dark-bg);
    padding: 0;
    z-index: 100;
    border-bottom: 1px solid var(--chrome-dark-border);
    width: 100%;
    backdrop-filter: blur(0.625rem);
    height: 10vh; /* 屏幕高度的10% */
    min-height: 60px; /* 最小高度保证可用性 */
    max-height: 80px; /* 最大高度防止过大 */
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-container {
    max-width: 100%;
    margin: 0 auto;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 1rem;
}

.search-header-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    height: 100%;
}

/* 首页按钮 - 更大 */
.home-button {
    background: var(--chrome-dark-surface);
    border: 1px solid var(--chrome-dark-border);
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 0.75rem;
    color: var(--chrome-dark-text);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    touch-action: manipulation;
}

.home-button:hover {
    background: var(--chrome-dark-surface2);
    border-color: var(--chrome-dark-text-secondary);
}

/* 搜索输入框 - 更大 */
.search-input-container {
    flex: 1;
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    padding: 1.25rem 1.5rem;
    border: 0.125rem solid var(--chrome-dark-border);
    border-radius: 1rem;
    background: var(--chrome-dark-surface);
    font-size: 1.25rem; /* 更大字体 */
    color: var(--chrome-dark-text);
    font-weight: 500;
    transition: all 0.2s ease;
    height: 3.5rem;
    -webkit-appearance: none;
    appearance: none;
}

.search-input:focus {
    outline: none;
    border-color: var(--chrome-accent);
    background: var(--chrome-dark-surface2);
}

.search-input::placeholder {
    color: var(--chrome-dark-text-secondary);
    font-weight: 400;
    font-size: 1.125rem;
}

/* 主题切换按钮 - 更大 */
.theme-toggle {
    background: var(--chrome-dark-surface);
    border: 1px solid var(--chrome-dark-border);
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 0.75rem;
    color: var(--chrome-dark-text);
    cursor: pointer;
    font-size: 1.5rem;
    font-weight: 600;
    transition: all 0.2s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}

.theme-toggle:hover {
    background: var(--chrome-dark-surface2);
    border-color: var(--chrome-dark-text-secondary);
}

/* 搜索结果区域 - 剩余90%高度 */
.search-results {
    width: 100%;
    margin: 0 auto;
    padding: 1rem;
    background: var(--chrome-dark-bg);
    flex: 1;
    overflow-y: auto;
    height: 90vh; /* 剩余90%高度 */
}

.results-section {
    margin-bottom: 1.5rem;
}

.section-title {
    padding: 1rem 0 0.75rem 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--chrome-dark-text);
    border-bottom: 1px solid var(--chrome-dark-border);
    margin-bottom: 0.75rem;
}

/* 搜索结果项 - 更大，占更多空间 */
.result-item {
    padding: 1.5rem 1.25rem;
    background: var(--chrome-dark-surface);
    border: 1px solid var(--chrome-dark-border);
    border-radius: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 0.75rem;
    min-height: 6rem; /* 更大高度 */
    touch-action: manipulation;
}

.result-item:hover {
    background: var(--chrome-dark-surface2);
    border-color: var(--chrome-accent);
    transform: translateY(-0.125rem);
}

/* 路线信息布局 - 更大 */
.result-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 7rem;
}

.route-number {
    font-size: 2rem; /* 更大的路线号码 */
    font-weight: 700;
    color: var(--chrome-dark-text);
}

.company-badge {
    padding: 0.5rem 0.75rem;
    border-radius: 1.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.03125rem;
    text-align: center;
    width: fit-content;
    min-width: 3.5rem;
}

/* 巴士公司颜色 */
.company-badge.ctb {
    background: #e9d600;
    color: #000000;
}

.company-badge.kmb {
    background: #e41f31;
    color: #ffffff;
}

.company-badge.gmb {
    background: #24be90;
    color: #ffffff;
}

.company-badge.mtr {
    background: #ac2e44;
    color: #ffffff;
}

/* 右边布局 - 更大 */
.result-right {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
    text-align: left;
    min-height: 4rem;
}

.destination-info {
    margin-bottom: 0.5rem;
}

.to-text {
    font-size: 0.875rem;
    color: var(--chrome-dark-text-secondary);
    font-weight: 500;
    margin-bottom: 0.375rem;
}

.destination {
    font-size: 1.375rem; /* 更大的目的地字体 */
    font-weight: 700;
    color: var(--chrome-dark-text);
    line-height: 1.2;
}

.origin {
    font-size: 1rem;
    color: var(--chrome-dark-text-secondary);
    font-weight: 500;
}

/* 车站结果样式 - 更大 */
.stop-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 1.25rem;
    background: var(--chrome-dark-surface);
    border: 1px solid var(--chrome-dark-border);
    border-radius: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 0.75rem;
    min-height: 5.5rem; /* 更大高度 */
    touch-action: manipulation;
}

.stop-result:hover {
    background: var(--chrome-dark-surface2);
    border-color: var(--chrome-accent);
    transform: translateY(-0.125rem);
}

.stop-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.stop-name {
    font-size: 1.375rem; /* 更大的车站名称 */
    font-weight: 600;
    color: var(--chrome-dark-text);
}

.stop-company {
    padding: 0.5rem 0.75rem;
    border-radius: 1.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.03125rem;
    text-align: center;
    width: fit-content;
    min-width: 3.5rem;
}

/* 车站公司颜色 */
.stop-company.ctb {
    background: #e9d600;
    color: #000000;
}

.stop-company.kmb {
    background: #e41f31;
    color: #ffffff;
}

.stop-company.gmb {
    background: #24be90;
    color: #ffffff;
}

.stop-company.mtr {
    background: #ac2e44;
    color: #ffffff;
}

/* 详情页面 - 同样的大尺寸设计 */
.detail-page {
    background: var(--chrome-dark-bg);
    height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom);
}

/* 路线详情头部 - 同样占10%高度 */
.route-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
    padding: 0 1rem;
    background: var(--chrome-dark-surface);
    border-bottom: 1px solid var(--chrome-dark-border);
    height: 10vh;
    min-height: 60px;
    max-height: 80px;
    flex-wrap: wrap;
    overflow: hidden;
}

.route-header-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.route-info-container {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    width: 100%;
    overflow: hidden;
}

.route-title-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: nowrap;
    width: 100%;
    min-width: 0;
}

.route-number {
    font-size: 1.5rem; /* 移动端减小字体 */
    font-weight: 700;
    color: var(--chrome-dark-text);
    flex-shrink: 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.route-subtitle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem; /* 移动端减小字体 */
    color: var(--chrome-dark-text-secondary);
    flex-wrap: nowrap;
    width: 100%;
    min-width: 0;
    overflow: hidden;
}

.route-origin, .route-destination {
    font-weight: 600;
    color: var(--chrome-dark-text);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.route-arrow {
    color: var(--chrome-dark-text-secondary);
    font-weight: 500;
    flex-shrink: 0;
}

/* 方向切换按钮移动端适配 */
.direction-toggle {
    background: var(--chrome-dark-surface2);
    border: 1px solid var(--chrome-dark-border);
    border-radius: 0.5rem;
    color: var(--chrome-dark-text);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem;
    min-width: 3.5rem;
    min-height: 3rem;
    touch-action: manipulation;
    flex-shrink: 0;
}

.direction-arrow {
    font-size: 1rem; /* 移动端减小箭头 */
    font-weight: bold;
}

.direction-text {
    font-size: 0.7rem; /* 移动端减小文字 */
    font-weight: 600;
    white-space: nowrap;
}

/* 服务类型选择器 - 更大 */
.service-type-selector {
    display: flex;
    align-items: center;
    padding: 1.25rem 1rem;
    gap: 1rem;
    background: var(--chrome-dark-surface);
    border-bottom: 1px solid var(--chrome-dark-border);
    flex-wrap: wrap;
    min-height: 5rem;
}

.selector-label {
    font-size: 1.125rem;
    color: var(--chrome-dark-text-secondary);
    font-weight: 600;
    white-space: nowrap;
}

.service-type-btn {
    padding: 1rem 1.5rem;
    background: var(--chrome-dark-surface2);
    border: 1px solid var(--chrome-dark-border);
    color: var(--chrome-dark-text);
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 3.5rem;
    touch-action: manipulation;
}

.service-type-btn.active {
    background: var(--chrome-accent);
    color: #1a1a1a;
    border-color: var(--chrome-accent);
}

.service-type-btn:hover:not(.active) {
    background: var(--chrome-dark-surface);
}

/* 车站列表 - 剩余高度 */
.stops-list {
    padding: 1rem;
    background: var(--chrome-dark-bg);
    flex: 1;
    overflow-y: auto;
    height: 80vh;
}

/* 车站项 - 更大 */
.stop-container {
    margin-bottom: 0.75rem;
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid var(--chrome-dark-border);
}

.stop-result-item {
    display: flex;
    align-items: flex-start;
    padding: 1.5rem 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--chrome-dark-surface);
    gap: 1rem;
    min-height: 5.5rem;
    touch-action: manipulation;
}

.stop-result-item:hover {
    background: var(--chrome-dark-surface2);
}

.stop-result-item.selected {
    background: var(--chrome-dark-surface2);
    border-left: 0.375rem solid var(--chrome-accent);
}

.stop-sequence {
    width: 2.5rem;
    height: 2.5rem;
    background: var(--chrome-dark-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 600;
    color: var(--chrome-dark-text-secondary);
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.stop-info {
    flex: 1;
}

.stop-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--chrome-dark-text);
    line-height: 1.4;
}

/* ETA 展开面板 - 更大 */
.eta-expand-panel {
    background: var(--chrome-dark-surface2);
    border-top: 1px solid var(--chrome-dark-border);
    padding: 1.5rem 1.25rem;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        padding: 0 1.25rem;
    }
    to {
        opacity: 1;
        max-height: 15rem;
        padding: 1.5rem 1.25rem;
    }
}

.eta-expand-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.eta-expand-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--chrome-dark-text);
}

.close-eta-btn {
    background: transparent;
    border: none;
    color: var(--chrome-dark-text-secondary);
    font-size: 1.75rem;
    cursor: pointer;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.close-eta-btn:hover {
    background: var(--chrome-dark-border);
    color: var(--chrome-dark-text);
}

/* ETA 列表样式 - 更大 */
.eta-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.eta-item {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 1.25rem 0;
    background: transparent;
    border-radius: 0;
    border-left: none;
    min-height: auto;
    border-bottom: 1px solid var(--chrome-dark-border);
    min-height: 4rem;
}

.eta-item:last-child {
    border-bottom: none;
}

.eta-item.scheduled {
    opacity: 0.7;
}

.eta-time {
    font-size: 1.375rem;
    font-weight: 600;
    color: var(--eta-time-color);
    text-align: left;
    line-height: 1.4;
}

/* 加载状态 */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3.75rem 1.25rem;
    background: var(--chrome-dark-bg);
    height: 100%;
}

.loading-spinner {
    width: 3rem;
    height: 3rem;
    border: 0.25rem solid var(--chrome-dark-surface);
    border-top: 0.25rem solid var(--chrome-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1.25rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: var(--chrome-dark-text-secondary);
    font-size: 1.125rem;
    font-weight: 500;
}

/* ETA 加载状态 */
.eta-loading {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 2.5rem 0;
    justify-content: center;
}

.eta-loading .loading-spinner {
    width: 2rem;
    height: 2rem;
    margin-bottom: 0;
    border-width: 0.1875rem;
}

.eta-loading .loading-text {
    font-size: 1.125rem;
}

/* 无结果状态 */
.no-results {
    padding: 3.75rem 1.25rem;
    text-align: center;
    color: var(--chrome-dark-text-secondary);
    background: var(--chrome-dark-bg);
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.no-results-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.no-results-text {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.no-results-subtext {
    font-size: 1.125rem;
    opacity: 0.8;
}

/* 无 ETA 信息 */
.no-eta {
    text-align: center;
    padding: 2.5rem 0;
    color: var(--chrome-dark-text-secondary);
}

.no-eta-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-eta-text {
    font-size: 1.125rem;
    font-weight: 500;
}

/* 无车站信息 */
.no-stops {
    padding: 3.75rem 1.25rem;
    text-align: center;
    color: var(--chrome-dark-text-secondary);
    font-weight: 500;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* 错误状态 */
.error {
    padding: 3.75rem 1.25rem;
    text-align: center;
    color: var(--chrome-dark-text-secondary);
    background: var(--chrome-dark-bg);
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.error-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

/* 动画增强 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(0.625rem); }
    to { opacity: 1; transform: translateY(0); }
}

.result-item, .stop-result, .stop-result-item {
    animation: fadeIn 0.3s ease;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 0.5rem;
}

::-webkit-scrollbar-track {
    background: var(--chrome-dark-surface);
}

::-webkit-scrollbar-thumb {
    background: var(--chrome-dark-border);
    border-radius: 0.25rem;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--chrome-dark-text-secondary);
}

/* 响应式设计 */
@media (max-width: 48rem) {
    .search-header {
        height: 12vh; /* 移动端头部稍微高一点 */
        min-height: 70px;
    }
    
    .search-results {
        height: 88vh;
    }
    
.route-detail-header {
        height: 12vh;
        min-height: 70px;
        padding: 0 0.75rem;
        gap: 0.5rem;
    }
    
    .route-title-container {
        gap: 0.5rem;
    }
    
    .route-number {
        font-size: 1.25rem; /* 更小的字体 */
    }
    
    .route-subtitle {
        font-size: 0.8rem; /* 更小的副标题 */
        gap: 0.25rem;
    }
    
    .route-origin, .route-destination {
        font-size: 0.75rem; /* 确保起点终点字体合适 */
    }
    
    .direction-toggle {
        min-width: 3rem;
        min-height: 2.5rem;
        padding: 0.375rem;
    }
    
    .direction-arrow {
        font-size: 0.875rem;
    }
    
    .direction-text {
        font-size: 0.6rem;
    }
    
    .stops-list {
        height: 78vh;
    }
}

/* 防止iOS Safari缩放 */
@supports (-webkit-touch-callout: none) {
    .search-input,
    .service-type-btn,
    .direction-toggle {
        font-size: 1rem;
    }
    
    /* iOS 安全区域支持 */
    .search-header {
        padding-top: env(safe-area-inset-top);
        height: calc(10vh + env(safe-area-inset-top));
    }
}

