:root {
    --primary: #60A5FA;       /* 天空蓝 */
    --primary-dark: #2563EB;
    --secondary: #34D399;     /* 薄荷绿 */
    --accent: #F472B6;        /* 糖果粉 */
    --glass-bg: rgba(255, 255, 255, 0.9); 
    --glass-border: rgba(255, 255, 255, 0.8);
    --text-main: #1F2937;
    --text-sub: #6B7280;
    --radius-lg: 16px;
    --shadow-jelly: 0 8px 20px -5px rgba(96, 165, 250, 0.2), 0 4px 10px -3px rgba(96, 165, 250, 0.1);
    
    /* 排名颜色 */
    --rank-gold: #F59E0B;
    --rank-silver: #9CA3AF;
    --rank-bronze: #D97706;
    --rank-black: #374151;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-main);
    min-height: 100vh;
    padding-bottom: 100px;
    background-color: #F0F9FF;
    position: relative;
    overflow-x: hidden;
}

/* 极光背景 */
body::before, body::after {
    content: ''; position: fixed; width: 300px; height: 300px; border-radius: 50%;
    filter: blur(90px); z-index: -1; opacity: 0.5; animation: float 10s infinite ease-in-out;
}
body::before { background: #BAE6FD; top: -50px; left: -50px; }
body::after { background: #DDD6FE; bottom: 100px; right: -50px; animation-delay: -5s; }
@keyframes float { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(30px, 50px); } }

/* 顶部海报 */
.banner-area { width: 100%; margin-bottom: 10px; box-shadow: 0 4px 20px rgba(0,0,0,0.03); }
.banner-wrapper img { width: 100%; height: auto; display: block; }

/* 提示条 (跑马灯效果) */
.notice-bar {
    margin: 0 0px 0px; max-width: 600px; 
    background: rgba(255, 255, 255, 0.7); backdrop-filter: blur(5px);
    padding: 10px 16px; border-radius: 12px;
    font-size: 13px; color: var(--text-sub);
    border: 1px solid white; box-shadow: 0 2px 10px rgba(0,0,0,0.03);
    display: flex; align-items: center; gap: 10px;
    margin-left: auto; margin-right: auto;
    overflow: hidden; /* 隐藏溢出内容 */
}
.notice-content {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    position: relative;
}
.notice-content span {
    display: inline-block;
    padding-left: 100%;
    animation: marquee 10s linear infinite;
}
@keyframes marquee { 0% { transform: translate(0, 0); } 100% { transform: translate(-100%, 0); } }

/* --- 导航胶囊 (吸顶) --- */
.nav-container {
    display: flex; justify-content: center; 
    padding: 10px 0; margin-bottom: 5px;
    position: sticky; top: 0; z-index: 50;
    pointer-events: none;
}
.nav-glass-box {
    width: 85%; max-width: 500px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    padding: 5px; border-radius: 50px;
    border: 1px solid white;
    box-shadow: 0 10px 25px -5px rgba(96, 165, 250, 0.25);
    display: flex; justify-content: space-between;
    position: relative;
    pointer-events: auto;
}
.nav-item {
    flex: 1; background: transparent; border: none; padding: 10px 0;
    font-size: 14px; font-weight: bold; color: var(--text-sub);
    border-radius: 40px; cursor: pointer; transition: all 0.3s;
    text-align: center; white-space: nowrap;
    position: relative; z-index: 2;
}
/* 导航激活态的流光特效 */
.nav-item.active {
    background: white; color: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(96, 165, 250, 0.2);
    transform: scale(1.05);
}

/* 模块提醒气泡 */
.nav-reminder {
    position: absolute; top: -45px; right: 10%;
    background: var(--accent); color: white;
    padding: 6px 12px; border-radius: 12px;
    font-size: 12px; font-weight: bold;
    box-shadow: 0 4px 15px rgba(244, 114, 182, 0.4);
    animation: bounce 2s infinite; pointer-events: none;
    z-index: 60; opacity: 0; transition: opacity 0.5s;
}
.nav-reminder.show { opacity: 1; }
.nav-reminder::after {
    content: ''; position: absolute; bottom: -6px; right: 20px;
    border-width: 6px 6px 0; border-style: solid;
    border-color: var(--accent) transparent transparent transparent;
}
@keyframes bounce { 0%, 20%, 50%, 80%, 100% {transform: translateY(0);} 40% {transform: translateY(-6px);} 60% {transform: translateY(-3px);} }

/* 搜索框 (吸顶 + 流光特效) */
.search-wrapper { 
    padding: 0 20px; margin: 0 auto 20px; max-width: 600px;
    position: sticky; top: 70px; z-index: 49; pointer-events: none;
}
.search-box {
    background: white; border-radius: 20px;
    box-shadow: var(--shadow-jelly);
    display: flex; align-items: center; padding: 10px 15px;
    transition: all 0.3s; position: relative; pointer-events: auto;
}
.search-box:focus-within {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(96, 165, 250, 0.25);
}
.search-icon { color: var(--primary); margin-right: 10px; font-size: 16px; }
.search-box input {
    flex: 1; border: none; outline: none; font-size: 15px; 
    color: var(--text-main); background: transparent;
    padding-right: 30px;
}
.search-clear {
    position: absolute; right: 15px; color: #9CA3AF;
    font-size: 16px; cursor: pointer; padding: 5px;
    transition: color 0.2s;
}
.search-clear:hover { color: var(--text-main); }

/* --- 跑马灯流光边框特效 --- */
@keyframes borderFlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
/* 应用于搜索框和激活的Tab */
.nav-item.active, .search-box {
    position: relative;
    background-clip: padding-box; /* 让背景只在内部显示 */
    border: 2px solid transparent; /* 透明边框用于显示下层伪元素 */
}
.nav-item.active::before, .search-box::before {
    content: ''; position: absolute;
    top: -2px; right: -2px; bottom: -2px; left: -2px;
    z-index: -1; border-radius: inherit;
    background: linear-gradient(90deg, #60A5FA, #34D399, #F472B6, #60A5FA);
    background-size: 300% 300%;
    animation: borderFlow 3s linear infinite;
}
/* 必须加这个遮盖层，否则内部变透明 */
.nav-item.active::after, .search-box::after {
    content: ''; position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    z-index: -1; border-radius: inherit;
    background: white;
}

/* 内容区域 */
.content-area { padding: 0 15px; max-width: 600px; margin: 0 auto; }
.game-list-view { display: flex; flex-direction: column; gap: 4px; }

/* 搜索分隔符 */
.search-divider {
    text-align: center; margin: 30px 0 15px;
    color: var(--text-sub); font-size: 12px; font-weight: bold;
    display: flex; align-items: center; gap: 10px; opacity: 0.6;
}
.search-divider::before, .search-divider::after { content: ''; flex: 1; height: 1px; background: #CBD5E1; }

/* 卡片样式 */
.game-item {
    background: var(--glass-bg);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border: 1px solid white;
    border-radius: var(--radius-lg);
    padding: 12px;
    display: flex; align-items: center; gap: 14px;
    box-shadow: var(--shadow-jelly);
    position: relative;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    opacity: 0; animation: slideUp 0.5s ease forwards;
}
.game-item:active { transform: scale(0.97); background: #F8FAFC; }
@keyframes slideUp { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }

.game-thumb-wrapper { position: relative; width: 50px; height: 50px; flex-shrink: 0; }
.game-thumb {
    width: 100%; height: 100%; border-radius: 12px;
    object-fit: cover; box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border: 2px solid white;
}

/* 徽章优化 */
.badge-mark {
    position: absolute; top: -6px; left: -6px;
    font-size: 11px; font-weight: 900; padding: 2px 7px;
    border-radius: 6px; color: white; 
    box-shadow: 0 2px 6px rgba(0,0,0,0.15); z-index: 2;
    text-shadow: 0 1px 1px rgba(0,0,0,0.1);
}
.badge-mark.new { background: linear-gradient(135deg, #34D399, #10B981); }
.badge-mark.rank-1 { background: linear-gradient(135deg, #FCD34D, #F59E0B); }
.badge-mark.rank-2 { background: linear-gradient(135deg, #E5E7EB, #9CA3AF); color: #4B5563; text-shadow: none; }
.badge-mark.rank-3 { background: linear-gradient(135deg, #FDBA74, #D97706); }
.badge-mark.rank-common { background: var(--rank-black); color: white; padding: 1px 6px; font-size: 10px; }

/* 字体优化 */
.game-info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.game-title { 
    font-size: 14px; font-weight: bold; color: var(--text-main); 
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    letter-spacing: 0.3px;
}
.game-code-line { font-size: 13px; font-weight: 600; display: flex; align-items: center; }
/* Code Highlight 字体更改 */
.code-highlight { 
    color: #DC2626; 
    background: #FEF2F2; 
    padding: 3px 8px; border-radius: 6px; 
    font-family: 'Consolas', 'Monaco', 'Andale Mono', 'Ubuntu Mono', monospace; /* 更改为等宽编程字体 */
    font-size: 13px; /* 字体加大 */
    font-weight: 700;
    border: 1px solid #FECACA;
}

/* 按钮 */
.game-action { flex-shrink: 0; }
.btn-start {
    background: linear-gradient(135deg, #60A5FA 0%, #2563EB 100%);
    color: white; border: none;
    padding: 5px 16px; border-radius: 20px;
    font-size: 10px; font-weight: bold;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
}
@keyframes heartbeat {
    0% { transform: scale(1); }
    15% { transform: scale(1.08); }
    30% { transform: scale(1); }
    45% { transform: scale(1.08); }
    100% { transform: scale(1); }
}
.heartbeat-btn { animation: heartbeat 2.5s infinite ease-in-out; }

/* 日期头 */
.update-date-header {
    background: white; padding: 5px 50px; border-radius: 20px;
    font-size: 13px; color: var(--primary); font-weight: bold;
    margin: 5px auto 5px; width: fit-content;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03); border: 1px solid #E2E8F0;
}

/* 底部状态 */
.load-more { text-align: center; margin-top: 30px; color: var(--text-sub); font-size: 13px; opacity: 0.8; }

/* 悬浮按钮组 */
.float-btn-group {
    position: fixed; bottom: 30px; right: 20px;
    display: flex; flex-direction: column; gap: 15px;
    z-index: 90;
}
.float-btn {
    width: 46px; height: 46px; 
    background: white; color: var(--primary);
    border-radius: 50%; 
    box-shadow: 0 8px 20px rgba(96, 165, 250, 0.25);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid white; padding: 0; overflow: hidden;
}
.float-btn:active { transform: scale(0.9); }
.float-btn.copy-all { color: var(--accent); background: #FFF; }
.float-btn-icon { width: 60%; height: 60%; object-fit: cover; display: block; }
#back-to-top { opacity: 0; visibility: hidden; transform: translateY(20px); }
#back-to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }

/* 清空按钮样式 */
.clear-history-wrapper {
    text-align: center;
    margin-top: 20px;
    margin-bottom: 10px;
}
.btn-clear-history {
    background: transparent;
    border: 1px solid #EF4444;
    color: #EF4444;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-clear-history:hover {
    background: #FEF2F2;
}

/* 弹窗通用样式 */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(30, 41, 59, 0.5); backdrop-filter: blur(4px);
    z-index: 100; display: none; align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal-card {
    background: white; width: 85%; max-width: 320px;
    border-radius: 24px; padding: 25px 20px; text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: scale(0.95); transition: transform 0.2s;
    position: relative;
}
.modal-overlay.active .modal-card { transform: scale(1); }
.modal-close {
    position: absolute; top: 10px; right: 15px;
    background: transparent; border: none; font-size: 20px; color: #9CA3AF;
    cursor: pointer; padding: 5px;
}
.success-icon { font-size: 50px; color: var(--secondary); margin-bottom: 15px; }
.video-preview { 
    margin: 15px 0; border-radius: 12px; overflow: hidden; background: #000; 
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}
.video-preview video { width: 100%; display: block; max-height: 280px; }
.btn-modal {
    background: linear-gradient(90deg, #34D399, #10B981); color: white; width: 100%; padding: 12px;
    border-radius: 50px; font-size: 15px; font-weight: bold; border: none;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.hidden { display: none !important; }