/* ========================================
   彩票智能预测系统 — 设计系统
   ======================================== */

/* === 字体 === */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Noto+Sans+SC:wght@300;400;500;700;900&display=swap');

/* === CSS 变量 === */
:root {
    /* 颜色 */
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.04);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);

    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;

    --accent-gold: #f59e0b;
    --accent-gold-light: #fbbf24;
    --accent-red: #ef4444;
    --accent-red-light: #f87171;
    --accent-blue: #3b82f6;
    --accent-blue-light: #60a5fa;
    --accent-green: #10b981;
    --accent-purple: #8b5cf6;
    --accent-cyan: #06b6d4;

    --gradient-gold: linear-gradient(135deg, #f59e0b, #d97706);
    --gradient-red: linear-gradient(135deg, #ef4444, #dc2626);
    --gradient-blue: linear-gradient(135deg, #3b82f6, #2563eb);
    --gradient-green: linear-gradient(135deg, #10b981, #059669);
    --gradient-purple: linear-gradient(135deg, #8b5cf6, #7c3aed);
    --gradient-hero: linear-gradient(135deg, #0a0e1a 0%, #1e1b4b 50%, #0a0e1a 100%);

    /* 阴影 */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow-gold: 0 0 20px rgba(245, 158, 11, 0.3);
    --shadow-glow-red: 0 0 20px rgba(239, 68, 68, 0.3);
    --shadow-glow-blue: 0 0 20px rgba(59, 130, 246, 0.3);

    /* 圆角 */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 50%;

    /* 过渡 */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* === 重置 === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* === 背景动画 === */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse 600px 600px at 20% 20%, rgba(139, 92, 246, 0.08), transparent),
        radial-gradient(ellipse 500px 500px at 80% 80%, rgba(245, 158, 11, 0.06), transparent),
        radial-gradient(ellipse 400px 400px at 50% 50%, rgba(59, 130, 246, 0.05), transparent);
    pointer-events: none;
    z-index: 0;
    animation: bgPulse 8s ease-in-out infinite;
}

@keyframes bgPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* === 容器 === */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
    z-index: 1;
}

/* === 导航 === */
.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 14, 26, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-glass);
    padding: 0 24px;
}

.nav-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
    text-decoration: none;
}

.nav-brand .icon {
    font-size: 28px;
    animation: spin 3s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.nav-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-glass);
    border-radius: var(--radius-lg);
    padding: 4px;
    border: 1px solid var(--border-glass);
}

.nav-tab {
    padding: 8px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    background: none;
    white-space: nowrap;
}

.nav-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-tab.active {
    color: var(--bg-primary);
    background: var(--gradient-gold);
    font-weight: 600;
    box-shadow: var(--shadow-glow-gold);
}

.tab-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 2px;
    opacity: 0.9;
    flex-shrink: 0;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* 更新数据小红点 */
.update-dot {
    display: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-red);
    box-shadow: 0 0 6px var(--accent-red);
    position: absolute;
    top: 6px;
    right: 6px;
    animation: dotPulse 2s ease-in-out infinite;
}

.update-dot.show {
    display: block;
}

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

/* === Hero 区域 === */
.hero {
    padding: 48px 0 32px;
    text-align: center;
    position: relative;
}

.hero-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 8px;
}

.hero-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    margin-top: 10px;
    font-weight: 400;
}

/* === 最新开奖 === */
.latest-draw {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    padding: 32px;
    margin: 0 0 32px;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.latest-draw::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-gold);
}

.latest-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.latest-label {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.latest-issue {
    font-size: 14px;
    color: var(--text-muted);
    background: var(--bg-glass);
    padding: 4px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-glass);
}

.ball-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.ball {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: white;
    position: relative;
    animation: ballAppear 0.5s ease-out backwards;
    cursor: default;
    transition: transform var(--transition-fast);
    box-shadow: var(--shadow-md);
}

.ball:hover {
    transform: scale(1.15) translateY(-4px);
}

.ball-red {
    background: var(--gradient-red);
    box-shadow: var(--shadow-glow-red);
}

.ball-blue {
    background: var(--gradient-blue);
    box-shadow: var(--shadow-glow-blue);
}

.ball-gold {
    background: var(--gradient-gold);
    box-shadow: var(--shadow-glow-gold);
}

.ball-separator {
    width: 2px;
    height: 40px;
    background: var(--border-glass);
    margin: 0 8px;
}

@keyframes ballAppear {
    from {
        opacity: 0;
        transform: scale(0) rotate(180deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.ball:nth-child(1) { animation-delay: 0.1s; }
.ball:nth-child(2) { animation-delay: 0.2s; }
.ball:nth-child(3) { animation-delay: 0.3s; }
.ball:nth-child(4) { animation-delay: 0.4s; }
.ball:nth-child(5) { animation-delay: 0.5s; }
.ball:nth-child(6) { animation-delay: 0.6s; }
.ball:nth-child(7) { animation-delay: 0.7s; }
.ball:nth-child(8) { animation-delay: 0.8s; }
.ball:nth-child(9) { animation-delay: 0.9s; }

/* === 仪表盘卡片 === */
.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 20px;
    backdrop-filter: blur(10px);
    transition: all var(--transition-normal);
}

.stat-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* === 区块容器 === */
.section {
    margin-bottom: 32px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title .dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--accent-gold);
    box-shadow: 0 0 8px var(--accent-gold);
}

/* === 分析面板 === */
.analysis-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

@media (max-width: 768px) {
    .analysis-grid {
        grid-template-columns: 1fr;
    }
}

.chart-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 24px;
    backdrop-filter: blur(10px);
    min-height: 320px;
}

.chart-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-container {
    width: 100%;
    height: 260px;
}

/* === 冷热号 === */
.hotcold-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

@media (max-width: 768px) {
    .hotcold-grid {
        grid-template-columns: 1fr;
    }
}

.hc-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.hc-card-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hc-hot .hc-card-title { color: var(--accent-red); }
.hc-warm .hc-card-title { color: var(--accent-gold); }
.hc-cold .hc-card-title { color: var(--accent-blue); }

.hc-balls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.hc-ball {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: white;
    transition: transform var(--transition-fast);
}

.hc-ball:hover {
    transform: scale(1.2);
}

.hc-ball-hot {
    background: var(--gradient-red);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
}

.hc-ball-warm {
    background: var(--gradient-gold);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.3);
}

.hc-ball-cold {
    background: var(--gradient-blue);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.3);
}

/* === AI 预测区 === */
.predict-section {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    padding: 32px;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.predict-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-purple), var(--accent-cyan), var(--accent-gold));
    animation: gradientSlide 3s linear infinite;
}

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

.predict-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 24px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
    position: relative;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--gradient-gold);
    color: var(--bg-primary);
    box-shadow: var(--shadow-glow-gold);
}

.btn-primary:hover {
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.4);
}

.btn-secondary {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
}

.btn-secondary:hover {
    border-color: var(--border-hover);
    background: rgba(255, 255, 255, 0.08);
}

.btn-danger {
    background: var(--gradient-red);
    color: white;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-no-key {
    border-style: dashed !important;
    opacity: 0.85;
}

.btn-no-key:hover::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(17, 24, 39, 0.95);
    color: var(--text-secondary);
    font-size: 12px;
    white-space: nowrap;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-glass);
    pointer-events: none;
    z-index: 99;
}

/* === 预测结果 === */
.predict-result {
    margin-top: 24px;
    display: none;
}

.predict-result.show {
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.predict-numbers {
    margin-bottom: 20px;
}

.predict-reasoning {
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: var(--radius-md);
    padding: 20px;
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-secondary);
    white-space: pre-wrap;
    max-height: 400px;
    overflow-y: auto;
}

.predict-reasoning::-webkit-scrollbar {
    width: 6px;
}

.predict-reasoning::-webkit-scrollbar-track {
    background: transparent;
}

.predict-reasoning::-webkit-scrollbar-thumb {
    background: var(--border-glass);
    border-radius: 3px;
}

/* === 加载动画 === */
.loading-spinner {
    display: none;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.loading-spinner.show {
    display: flex;
}

.spinner {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    border: 3px solid var(--border-glass);
    border-top-color: var(--accent-gold);
    animation: spinLoader 0.8s linear infinite;
}

@keyframes spinLoader {
    to { transform: rotate(360deg); }
}

.loading-text {
    margin-left: 16px;
    font-size: 14px;
    color: var(--text-secondary);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* === Toast 通知 === */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    color: white;
    backdrop-filter: blur(10px);
    animation: toastIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 380px;
}

.toast-success {
    background: rgba(16, 185, 129, 0.9);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.toast-error {
    background: rgba(239, 68, 68, 0.9);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.toast-info {
    background: rgba(59, 130, 246, 0.9);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100px); }
}

/* === 历史表格 === */
.history-table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-glass);
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.history-table th {
    background: rgba(255, 255, 255, 0.03);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-glass);
    white-space: nowrap;
}

.history-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    white-space: nowrap;
}

.history-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.mini-ball {
    display: inline-flex;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: white;
    margin: 0 2px;
}

/* === 分页 === */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.page-btn {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-glass);
    background: var(--bg-glass);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.page-btn:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.page-btn.active {
    background: var(--gradient-gold);
    color: var(--bg-primary);
    border-color: transparent;
    font-weight: 600;
}

/* === 期数选择器 === */
.period-selector {
    display: flex;
    gap: 4px;
    background: var(--bg-glass);
    border-radius: var(--radius-sm);
    padding: 3px;
    border: 1px solid var(--border-glass);
}

.period-btn {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    background: none;
    font-family: inherit;
}

.period-btn:hover {
    color: var(--text-primary);
}

.period-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* === 响应式 === */
@media (max-width: 768px) {
    .nav-inner {
        flex-wrap: wrap;
        height: auto;
        padding: 12px 0;
        gap: 12px;
    }

    .nav-tabs {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    .hero { padding: 32px 0 20px; }

    .ball {
        width: 44px;
        height: 44px;
        font-size: 16px;
    }

    .analysis-grid {
        grid-template-columns: 1fr;
    }

    .hotcold-grid {
        grid-template-columns: 1fr;
    }

    .predict-actions {
        flex-direction: column;
    }

    .btn {
        justify-content: center;
    }
}

/* === 空状态 === */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 14px;
    margin-bottom: 20px;
}

/* === 滚动条 === */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* === 遗漏值表格增强 === */
.missing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 6px;
}

.missing-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 4px;
    border-radius: var(--radius-sm);
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    transition: all var(--transition-fast);
}

.missing-cell:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.missing-num {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
}

.missing-val {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
    font-weight: 500;
}

.missing-cell.high-missing {
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.08);
}

.missing-cell.high-missing .missing-val {
    color: var(--accent-red-light);
}

.missing-cell.low-missing {
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.08);
}

.missing-cell.low-missing .missing-val {
    color: var(--accent-green);
}

/* === 预测方法标签 === */
.method-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.method-tag-lstm {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-purple);
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.method-tag-llm {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-cyan);
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.method-tag-stats {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-gold);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* === 页脚 === */
.footer {
    text-align: center;
    padding: 40px 0;
    color: var(--text-muted);
    font-size: 12px;
    border-top: 1px solid var(--border-glass);
    margin-top: 48px;
}

.footer a {
    color: var(--accent-gold);
    text-decoration: none;
}
