/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f1923; color: #e0e0e0; min-height: 100vh;
}
a { color: #58a6ff; text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: 1000px; margin: 0 auto; padding: 0 20px; }

/* === Header === */
.header {
    background: linear-gradient(135deg, #1a2332 0%, #0d1a2e 100%);
    padding: 30px 0; border-bottom: 2px solid #2d4d6a; text-align: center;
}
.header h1 { font-size: 2em; color: #4fc3f7; margin-bottom: 8px; }
.header .subtitle { color: #8899aa; font-size: 0.95em; }

/* === Nav Tabs === */
.nav-tabs {
    display: flex; gap: 4px; padding: 20px 0 0; overflow-x: auto;
}
.tab {
    padding: 10px 20px; border: none; cursor: pointer;
    background: #1a2a3a; color: #8899aa; border-radius: 8px 8px 0 0;
    font-size: 0.9em; white-space: nowrap; transition: all 0.2s;
}
.tab:hover { background: #2a3a4a; color: #fff; }
.tab.active { background: #2d4d6a; color: #fff; font-weight: 600; }

/* === Tab Content === */
.tab-content { display: none; padding: 20px 0; }
.tab-content.active { display: block; }

.section-header {
    display: flex; align-items: center; gap: 15px; margin-bottom: 20px; flex-wrap: wrap;
}
.section-header h2 { font-size: 1.3em; color: #4fc3f7; }
.update-time { color: #667; font-size: 0.85em; }
.btn-refresh {
    padding: 6px 14px; background: #2d4d6a; color: #fff; border: none;
    border-radius: 4px; cursor: pointer; font-size: 0.85em; margin-left: auto;
}
.btn-refresh:hover { background: #3a6a8a; }

/* === Loading === */
.loading { text-align: center; padding: 60px 20px; color: #667; font-size: 1.1em; }

/* === Summary Cards === */
.summary-cards {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px; margin-bottom: 24px; width: 100%;
}
.card {
    background: #1a2a3a; border-radius: 10px; padding: 16px; text-align: center;
    border: 1px solid #2a3a4a;
}
.card-label { font-size: 0.8em; color: #8899aa; margin-bottom: 6px; }
.card-value { font-size: 1.6em; font-weight: 700; color: #fff; }
.card.correct .card-value { color: #4caf50; }
.card.wrong .card-value { color: #f44336; }
.card.success-rate .card-value { color: #ff9800; }
.card.score-acc .card-value { color: #9c27b0; }
.card.score-rate .card-value { color: #ce93d8; }
.card.period-90 .card-value { color: #4fc3f7; }
.card.period-et .card-value { color: #ff7043; }
.card-sub { font-size: 0.75em; color: #8899aa; margin-top: 2px; }

/* === Type Breakdown Cards === */
.type-breakdown {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px;
}
.type-card {
    background: #1a2a3a; border-radius: 10px; padding: 14px; text-align: center;
    border: 1px solid #2a3a4a;
}
.type-stat-name { font-size: 0.9em; font-weight: 600; margin-bottom: 4px; }
.type-stat-num { font-size: 1.3em; font-weight: 700; color: #fff; margin-bottom: 6px; }
.type-stat-bar { height: 4px; background: #2a3a4a; border-radius: 2px; margin-bottom: 4px; }
.type-stat-fill { height: 100%; border-radius: 2px; background: #4fc3f7; transition: width 0.5s; }
.type-stat-acc { font-size: 0.85em; color: #8899aa; }
#type-H .type-stat-name { color: #4caf50; }
#type-D .type-stat-name { color: #ff9800; }
#type-A .type-stat-name { color: #f44336; }
#type-H .type-stat-fill { background: #4caf50; }
#type-D .type-stat-fill { background: #ff9800; }
#type-A .type-stat-fill { background: #f44336; }

/* === Confidence Breakdown === */
.confidence-section { margin-bottom: 20px; }
.confidence-section h3 { color: #4fc3f7; font-size: 1em; margin-bottom: 10px; }
.conf-row {
    display: flex; align-items: center; gap: 10px; padding: 5px 0;
    font-size: 0.85em; border-bottom: 1px solid #1a2a3a;
}
.conf-label { width: 50px; color: #8899aa; }
.conf-bar { flex: 1; height: 6px; background: #2a3a4a; border-radius: 3px; }
.conf-bar-fill { height: 100%; border-radius: 3px; background: #4fc3f7; transition: width 0.5s; }
.conf-num { width: 50px; text-align: right; color: #e0e0e0; }
.conf-acc { width: 50px; text-align: right; color: #fff; font-weight: 600; }

/* === Enhanced History Table === */
.section-divider {
    text-align: center; padding: 12px; color: #8899aa; font-size: 0.9em;
    background: #1a2a3a; border-radius: 8px; margin-bottom: 12px;
}
.history-table td.td-date { white-space: nowrap; font-size: 0.85em; color: #8899aa; }
.history-table td.td-teams { white-space: nowrap; }
.history-table td.td-teams .team-h { color: #4caf50; }
.history-table td.td-teams .team-a { color: #f44336; }
.history-table td.td-score { white-space: nowrap; }
.history-table .pred-score { color: #667; font-size: 0.85em; }
.history-table .actual-score { color: #fff; font-weight: 600; }
.history-table .vs-score { color: #444; margin: 0 4px; }
.history-table td.td-score-hit { text-align: center; font-size: 1.1em; }
.history-table tr.tr-correct td { background: rgba(76, 175, 80, 0.05); }
.history-table tr.tr-wrong td { background: rgba(244, 67, 54, 0.05); }
.history-table tr.tr-pending td { color: #667; }

.badge-H, .badge-主胜 { display: inline-block; padding: 2px 8px; border-radius: 4px; background: #1a4a2a; color: #4caf50; font-weight: 600; font-size: 0.85em; }
.badge-D, .badge-平局 { display: inline-block; padding: 2px 8px; border-radius: 4px; background: #4a3a1a; color: #ff9800; font-weight: 600; font-size: 0.85em; }
.badge-A, .badge-客胜 { display: inline-block; padding: 2px 8px; border-radius: 4px; background: #4a1a1a; color: #f44336; font-weight: 600; font-size: 0.85em; }
.badge-pending { display: inline-block; padding: 2px 8px; border-radius: 4px; background: #2a3a4a; color: #667; font-weight: 600; font-size: 0.85em; }

/* === Streak Display === */
.streak-display {
    display: flex; gap: 3px; flex-wrap: wrap; justify-content: center;
    padding: 10px; font-size: 1.2em; letter-spacing: 2px;
}

/* === Match Card === */
.match-card {
    background: #1a2a3a; border-radius: 10px; padding: 16px 20px; margin-bottom: 12px;
    border: 1px solid #2a3a4a; transition: all 0.2s;
}
.match-card:hover { border-color: #3a6a8a; }
.match-header {
    display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap;
}
.match-num { font-weight: 600; color: #4fc3f7; font-size: 0.9em; }
.match-date { color: #8899aa; font-size: 0.82em; }
.match-time { color: #667; font-size: 0.85em; }
.match-status {
    font-size: 0.75em; padding: 2px 8px; border-radius: 4px; background: #2a3a4a;
}
.match-status.upcoming { background: #1a4a6a; color: #4fc3f7; }
.match-status.finished { background: #2a5a3a; color: #4caf50; }
.match-status.live { background: #5a4a2a; color: #ff9800; }

.match-teams {
    display: flex; align-items: center; justify-content: center;
    gap: 12px; margin-bottom: 12px; font-size: 1.15em;
}
.team { font-weight: 600; color: #fff; text-align: center; }
.vs { color: #667; font-weight: 700; }
.score { color: #4fc3f7; font-weight: 700; font-size: 1.2em; }

.match-details {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px 20px;
    background: #0f1923; border-radius: 8px; padding: 12px 16px; margin-top: 10px;
}
.detail-item { display: flex; justify-content: space-between; font-size: 0.9em; }
.detail-label { color: #667; }
.detail-value { color: #e0e0e0; font-weight: 500; }
.detail-value.pred-win { color: #4caf50; }
.detail-value.pred-draw { color: #ff9800; }
.detail-value.pred-lose { color: #f44336; }
.detail-value.correct { color: #4caf50; font-weight: 700; }
.detail-value.wrong { color: #f44336; font-weight: 700; }
.detail-value.pending { color: #667; }

.odds-bar {
    display: flex; height: 24px; border-radius: 4px; overflow: hidden; margin-top: 8px;
}
.odds-bar-segment {
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75em; font-weight: 600; color: #fff; transition: width 0.3s;
}
.odds-bar-H { background: #4caf50; }
.odds-bar-D { background: #ff9800; }
.odds-bar-A { background: #f44336; }

/* === History Table === */
.history-table-wrap { overflow-x: auto; }
.history-table {
    width: 100%; border-collapse: collapse; font-size: 0.9em;
}
.history-table th {
    text-align: left; padding: 10px 12px; background: #1a2a3a;
    color: #4fc3f7; border-bottom: 2px solid #2d4d6a; white-space: nowrap;
}
.history-table td { padding: 10px 12px; border-bottom: 1px solid #1a2a3a; }
.history-table tr:hover td { background: rgba(45, 77, 106, 0.3); }

.result-badge, .predict-badge {
    display: inline-block; padding: 2px 8px; border-radius: 4px;
    font-size: 0.85em; font-weight: 600;
}
.result-badge.H, .predict-badge.H { background: #1a4a2a; color: #4caf50; }
.result-badge.D, .predict-badge.D { background: #4a3a1a; color: #ff9800; }
.result-badge.A, .predict-badge.A { background: #4a1a1a; color: #f44336; }
.result-badge.pending, .predict-badge.pending { background: #2a3a4a; color: #667; }

.accuracy-bar {
    display: inline-block; height: 6px; border-radius: 3px; width: 60px; background: #2a3a4a; vertical-align: middle; margin-right: 6px;
}
.accuracy-bar-fill {
    height: 100%; border-radius: 3px; transition: width 0.5s;
}
.accuracy-bar-fill.good { background: #4caf50; }
.accuracy-bar-fill.ok { background: #ff9800; }
.accuracy-bar-fill.bad { background: #f44336; }

/* === Score Prediction Badge === */
.match-score-pred {
    text-align: center; padding: 8px 0; margin-bottom: 8px;
}
.score-badge {
    background: linear-gradient(135deg, #1a3a5a, #2d4d6a);
    padding: 6px 16px; border-radius: 20px; font-size: 1em;
    color: #4fc3f7; display: inline-block;
}
.score-badge strong { font-size: 1.2em; color: #fff; margin: 0 4px; }
.score-prob { color: #667; font-size: 0.85em; margin-left: 8px; }
.score-alt { text-align: center; font-size: 0.78em; color: #667; margin: 2px 0 6px; padding: 2px 8px; }

/* === Stats Charts === */
.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px;
}
.stats-card {
    background: #1a2a3a; border-radius: 10px; padding: 20px;
    border: 1px solid #2a3a4a;
}
.stats-card h3 { color: #4fc3f7; margin-bottom: 14px; font-size: 1em; }
.stats-row {
    display: flex; justify-content: space-between; padding: 6px 0;
    border-bottom: 1px solid #0f1923; font-size: 0.9em;
}

/* === Model Info === */
.model-info { line-height: 1.8; }
.model-info h3 { color: #4fc3f7; margin: 20px 0 10px; }
.model-info ul { padding-left: 20px; }
.model-info li { margin-bottom: 4px; }
.model-section {
    background: #1a2a3a; border-radius: 10px; padding: 20px; margin-bottom: 16px;
    border: 1px solid #2a3a4a;
}

/* === Footer === */
.footer {
    text-align: center; padding: 30px 0; margin-top: 40px;
    border-top: 1px solid #1a2a3a; color: #667; font-size: 0.85em;
}
.footer p { margin-bottom: 4px; }

/* === Responsive === */
@media (max-width: 768px) {
    .header h1 { font-size: 1.5em; }
    .match-teams { font-size: 1em; flex-wrap: wrap; }
    .match-details { grid-template-columns: 1fr; }
    .summary-cards { grid-template-columns: repeat(3, 1fr); }
}

/* Error state */
.error-msg { text-align: center; padding: 40px; color: #f44336; }

/* Tab navigation */
.tab { cursor: pointer; user-select: none; }
