:root {
    --primary: #ff6b9d;
    --secondary: #c44569;
    --accent: #ffa502;
    --success: #26de81;
    --warning: #fed330;
    --error: #fc5c65;
    --purple: #a55eea;
    --blue: #45aaf2;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: #1a1a2e;
    min-height: 100vh;
    padding: 0;
    position: relative;
    transition: background 1.5s ease;
}

/* 动态背景 - 根据时间段 */
body.morning {
    background: #1a1a2e;
}

body.noon {
    background: #1a1a2e;
}

body.afternoon {
    background: #1a1a2e;
}

body.evening {
    background: #1a1a2e;
}

body.night-mode {
    background: #0c0c1e;
}

.sakura {
    position: fixed;
    width: 12px;
    height: 12px;
    background: radial-gradient(circle, #ffc0cb, #ff69b4);
    border-radius: 50% 0 50% 0;
    opacity: 0.5;
    animation: fall linear infinite;
    pointer-events: none;
    z-index: 1;
}

@keyframes fall {
    to { transform: translateY(100vh) rotate(360deg); }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    min-height: 100vh;
    box-shadow: 0 0 50px rgba(0,0,0,0.3);
    transition: background 1.5s ease;
}

/* 容器动态背景 */
body.morning .container {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 50%, #fab1a0 100%);
}

body.noon .container {
    background: linear-gradient(135deg, #74b9ff 0%, #a29bfe 50%, #fd79a8 100%);
}

body.afternoon .container {
    background: linear-gradient(135deg, #fdcb6e 0%, #e17055 50%, #d63031 100%);
}

body.evening .container {
    background: linear-gradient(135deg, #fd79a8 0%, #6c5ce7 50%, #2d3436 100%);
}

body.night-mode .container {
    background: linear-gradient(135deg, #0c0c1e 0%, #1a1a2e 50%, #16213e 100%);
}

/* 夜间模式文字颜色调整 */
body.night-mode .stat-label,
body.night-mode .toast-title,
body.night-mode .toast-message {
    color: white;
}

body.night-mode .stat-item {
    background: rgba(255, 255, 255, 0.1);
}

/* 头部区域 - 紧凑设计 */
.header-wrapper {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2, #f093fb, #ffa502, #26de81, #45aaf2, #667eea);
    background-size: 200% 100%;
    animation: rainbow-move 3s linear infinite;
    border-radius: 23px;
}

.header {
    background: white !important;
    color: #333;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    border-radius: 20px;
}

.header-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.header-subtitle {
    font-size: 12px;
    opacity: 0.9;
}

/* 统计栏 - 横向紧凑布局 */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: transparent;
    padding: 15px;
    gap: 15px;
}

.stat-item-wrapper {
    padding: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2, #f093fb, #ffa502, #26de81, #45aaf2, #667eea);
    background-size: 200% 100%;
    animation: rainbow-move 3s linear infinite;
    border-radius: 13px;
    height: 130px;
}

.stat-item {
    text-align: center;
    padding: 15px;
    background: white !important;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: relative;
    z-index: 1;
    height: 124px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

body.night-mode .stat-item {
    background: rgba(255, 255, 255, 0.1);
}

.stat-icon {
    font-size: 32px;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 2px;
}

.time-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0;
}

.date-value {
    font-size: 14px;
    color: #666;
    margin-top: 12px;
    font-weight: 500;
}

.stat-label {
    font-size: 14px !important;
    color: #333 !important;
    margin-top: 2px !important;
    font-weight: 600 !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* 操作按钮栏 */
.action-bar {
    padding: 15px;
    background: white;
    border-bottom: 2px solid #f0f0f0;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* 合并容器 - 按钮栏+列表 */
.combined-wrapper {
    position: relative;
    border-radius: 15px;
    padding: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2, #f093fb, #ffa502, #26de81, #45aaf2, #667eea);
    background-size: 200% 100%;
    animation: rainbow-move 3s linear infinite;
}

.combined-content {
    background: white;
    border-radius: 12px;
    overflow: hidden;
}

.btn-wrapper {
    flex: 1;
    min-width: 120px;
}

.btn {
    width: 100%;
    padding: 12px 20px;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary)) !important;
    color: white;
}

.btn-primary:active {
    transform: scale(0.95);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--purple), var(--blue)) !important;
    color: white;
}

.btn-secondary:active {
    transform: scale(0.95);
}

/* 列表容器 - 固定高度可滚动 */
.routes-list {
    background: white;
    max-height: 500px;
    overflow-y: auto;
    overflow-x: hidden;
}

@keyframes rainbow-move {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

/* 同步所有彩虹动画 */
.stat-item-wrapper,
.header-wrapper,
.btn-wrapper,
.combined-wrapper {
    animation: rainbow-move 3s linear infinite;
    animation-delay: 0s;
}

/* 自定义滚动条 - 炫彩渐变 */
.routes-list::-webkit-scrollbar {
    width: 10px;
}

.routes-list::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 10px;
    margin: 5px;
}

.routes-list::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #667eea, #764ba2, #f093fb, #ffa502, #26de81, #45aaf2);
    border-radius: 10px;
    background-size: 100% 200%;
    animation: rainbow-scroll 3s linear infinite;
}

.routes-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #45aaf2, #26de81, #ffa502, #f093fb, #764ba2, #667eea);
}

@keyframes rainbow-scroll {
    0% { background-position: 0% 0%; }
    100% { background-position: 0% 200%; }
}

/* 列表项 - 紧凑横向布局 */
.route-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 2px solid #f0f0f0;
    transition: all 0.3s;
    position: relative;
    gap: 12px;
    background: white;
}

.route-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, #667eea, #764ba2, #f093fb, #ffa502, #26de81, #45aaf2);
    transform: scaleY(0);
    transition: transform 0.3s;
}

.route-item:hover {
    background: linear-gradient(90deg, rgba(255, 107, 157, 0.05), rgba(165, 94, 234, 0.05));
}

.route-item:hover::before {
    transform: scaleY(1);
}

.route-item.checking {
    background: rgba(254, 211, 48, 0.1);
    border-left: 4px solid var(--warning);
}

.route-item.online {
    background: rgba(38, 222, 129, 0.1);
    border-left: 4px solid var(--success);
}

.route-item.offline {
    background: rgba(252, 92, 101, 0.1);
    border-left: 4px solid var(--error);
}

.route-item.unknown {
    background: rgba(149, 165, 166, 0.1);
    border-left: 4px solid #95a5a6;
}

/* 序号徽章 */
.route-number {
    width: 40px;
    height: 40px;
    min-width: 40px;
    background: linear-gradient(135deg, #667eea, #764ba2, #f093fb);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* 路由信息区 */
.route-info {
    flex: 1;
    min-width: 0;
}

.route-name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.route-url {
    font-size: 11px;
    color: #636e72;
    font-family: 'Microsoft YaHei', sans-serif;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

/* 状态指标区 */
.route-metrics {
    display: flex;
    gap: 15px;
    align-items: center;
}

.metric {
    text-align: center;
}

.metric-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
}

.metric-label {
    font-size: 10px;
    color: #999;
}

/* 状态指示器 */
.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

.status-indicator.pending {
    background: #999;
}

.status-indicator.checking {
    background: var(--warning);
}

.status-indicator.online {
    background: var(--success);
}

.status-indicator.offline {
    background: var(--error);
}

.status-indicator.unknown {
    background: #95a5a6;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.6; }
}

/* 操作按钮 */
.route-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* 收藏按钮 */
.favorite-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 107, 157, 0.1);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.favorite-btn:hover {
    background: rgba(255, 107, 157, 0.2);
    transform: scale(1.1);
}

.favorite-btn.favorited {
    background: linear-gradient(135deg, #ffd700, #ffa502);
    animation: heartbeat 0.6s ease;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.route-item.favorited {
    order: -1;
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.1), rgba(255, 165, 2, 0.1));
}

.route-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.route-btn-visit {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.route-btn-visit:active {
    transform: scale(0.9);
}

.route-btn-copy {
    background: linear-gradient(135deg, var(--purple), var(--blue));
    color: white;
}

.route-btn-copy:active {
    transform: scale(0.9);
}

.route-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Toast通知 - 放在列表框正下方 */
.toast {
    background: white;
    padding: 12px 20px;
    border-radius: 50px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 3px solid transparent;
    background-clip: padding-box;
    position: relative;
    font-size: 14px;
    font-weight: 600;
    color: #2d3436;
    margin: 20px auto 0;
    max-width: 600px;
}

.toast::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    background: linear-gradient(90deg, #667eea, #764ba2, #f093fb, #ffa502, #26de81, #45aaf2, #667eea);
    border-radius: 50px;
    z-index: -1;
    background-size: 200% 100%;
    animation: rainbow-move 3s linear infinite;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-icon {
    font-size: 20px;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 5px;
}

.toast-title {
    font-weight: 700;
    color: #2d3436;
    font-size: 14px;
}

.toast-message {
    font-size: 14px;
    color: #636e72;
}

/* 加载遮罩 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.active {
    display: flex;
}

/* 高端加载卡片 */
.loading-card {
    padding: 3px;
    border-radius: 20px;
    background: linear-gradient(135deg, #667eea, #764ba2, #f093fb, #ffa502, #26de81, #45aaf2, #667eea);
    background-size: 300% 300%;
    animation: gradient-flow 3s ease infinite;
    box-shadow: 0 20px 60px rgba(102, 126, 234, 0.4);
}

@keyframes gradient-flow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.loading-card-inner {
    background: rgba(20, 20, 35, 0.95);
    border-radius: 17px;
    padding: 40px 60px;
    text-align: center;
    backdrop-filter: blur(10px);
}

.loading-card-inner h3 {
    color: white;
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 20px;
    letter-spacing: 2px;
}

.loading-progress {
    font-size: 36px;
    font-weight: 700;
    background: linear-gradient(135deg, #26de81, #45aaf2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
}

.loading-time {
    font-size: 14px;
    color: #a0a0a0;
    letter-spacing: 1px;
}

/* 移动端优化 */
@media (max-width: 768px) {
    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .routes-list {
        max-height: 400px;
    }
    
    /* 手机端只显示状态指示器，隐藏响应时间等指标 */
    .route-metrics {
        display: flex;
        gap: 8px;
        align-items: center;
    }
    
    .route-metrics .metric {
        display: none;
    }
    
    .route-metrics .status-indicator {
        display: block !important;
        width: 16px !important;
        height: 16px !important;
        min-width: 16px;
        border-radius: 50%;
    }
    
    .route-item {
        padding: 12px;
        gap: 10px;
    }
    
    .route-number {
        width: 35px;
        height: 35px;
        min-width: 35px;
        font-size: 14px;
    }
    
    .route-name {
        font-size: 14px;
    }
    
    .route-url {
        font-size: 10px;
    }
    
    .route-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .action-bar {
        padding: 10px;
    }
    
    .btn-wrapper {
        min-width: 100px;
    }
    
    .btn {
        padding: 10px 15px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .routes-list {
        max-height: 350px;
    }
    
    .route-actions {
        flex-direction: row;
        gap: 8px;
        align-items: center;
    }
    
    .route-btn {
        flex: 1;
        padding: 14px 16px;
        font-size: 15px;
        min-height: 48px;
    }
}
