/* FPL 生存赛展示站 — 统一样式 */
/* 品牌色: #37003c (紫) #00ff87 (绿) */

:root {
    --brand-purple: #37003c;
    --brand-green: #00ff87;
    --bg-dark-1: #1a1a2e;
    --bg-dark-2: #16213e;
    --bg-dark-3: #0f3460;
    --alive-color: #28a745;
    --eliminated-color: #dc3545;
    --prev-elim-color: #6c757d;
    --tiebreak-color: #fd7e14;
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f0f0f0;
    --text-secondary: #aaa;
    --text-muted: #777;
}

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

body {
    font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: linear-gradient(135deg, var(--bg-dark-1) 0%, var(--bg-dark-2) 50%, var(--bg-dark-3) 100%);
    min-height: 100vh;
    color: var(--text-primary);
    padding: 0;
}

a { color: var(--brand-green); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Layout ===== */
.site-header {
    background: linear-gradient(135deg, var(--brand-purple) 0%, #5a1e5c 100%);
    padding: 20px 16px 16px;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.site-header h1 {
    color: var(--brand-green);
    font-size: 22px;
    letter-spacing: 2px;
    margin-bottom: 4px;
}

.site-header .subtitle {
    color: #ccc;
    font-size: 13px;
}

.container {
    max-width: 700px;
    margin: 0 auto;
    padding: 16px;
}

/* ===== Navigation ===== */
.nav-bar {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.3);
    flex-wrap: wrap;
}

.nav-bar a {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    color: #ccc;
    background: rgba(255, 255, 255, 0.08);
    transition: all 0.2s;
}

.nav-bar a:hover, .nav-bar a.active {
    background: var(--brand-green);
    color: var(--brand-purple);
    text-decoration: none;
    font-weight: bold;
}

/* ===== GW Page Navigation ===== */
.gw-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--card-border);
}

.gw-nav a {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.08);
    color: #ccc;
    transition: all 0.2s;
}

.gw-nav a:hover {
    background: var(--brand-green);
    color: var(--brand-purple);
    text-decoration: none;
}

.gw-nav .current {
    color: var(--brand-green);
    font-weight: bold;
    font-size: 15px;
}

/* ===== Cards ===== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    backdrop-filter: blur(10px);
}

.card h2 {
    color: var(--brand-green);
    font-size: 16px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--card-border);
}

.card h3 {
    color: var(--text-primary);
    font-size: 14px;
    margin-bottom: 8px;
}

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.stat-item {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 14px;
    text-align: center;
}

.stat-value {
    font-size: 28px;
    font-weight: bold;
    color: var(--brand-green);
}

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

/* ===== Group Cards (Dashboard) ===== */
.groups-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.group-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    overflow: hidden;
}

.group-card .header {
    background: linear-gradient(135deg, var(--brand-purple) 0%, #5a1e5c 100%);
    color: var(--brand-green);
    padding: 10px;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    letter-spacing: 2px;
}

.group-card .body {
    padding: 10px;
}

.group-card .stat-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.group-card .stat-row .val {
    color: var(--text-primary);
    font-weight: bold;
}

/* ===== GW Entry List ===== */
.gw-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.gw-link {
    display: block;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 14px 10px;
    text-align: center;
    color: var(--text-primary);
    transition: all 0.2s;
}

.gw-link:hover {
    background: var(--brand-green);
    color: var(--brand-purple);
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 255, 135, 0.2);
}

.gw-link .gw-num {
    font-size: 20px;
    font-weight: bold;
    display: block;
}

.gw-link .gw-desc {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.gw-link:hover .gw-desc { color: var(--brand-purple); }

/* ===== Elimination Timeline ===== */
.timeline {
    position: relative;
    padding-left: 24px;
    margin: 12px 0;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--card-border);
}

.timeline-item {
    position: relative;
    margin-bottom: 14px;
    padding-left: 16px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--eliminated-color);
    border: 2px solid var(--bg-dark-2);
}

.timeline-item .gw-label {
    font-size: 13px;
    font-weight: bold;
    color: var(--brand-green);
    margin-bottom: 4px;
}

.timeline-item .elim-names {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ===== Tables (GW page) ===== */
.group-section { margin-bottom: 20px; }

.group-table-header {
    background: linear-gradient(135deg, var(--brand-purple) 0%, #5a1e5c 100%);
    color: var(--brand-green);
    padding: 10px 16px;
    border-radius: 12px 12px 0 0;
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    letter-spacing: 2px;
}

.group-table-header .desc {
    font-size: 12px;
    color: #ccc;
    font-weight: normal;
    letter-spacing: 0;
}

table.survival-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 0 0 12px 12px;
    overflow: hidden;
}

table.survival-table th {
    background: var(--brand-purple);
    color: var(--brand-green);
    padding: 8px 6px;
    font-size: 11px;
    font-weight: bold;
    text-align: center;
    border-bottom: 2px solid #5a1e5c;
}

table.survival-table th.team-col { text-align: left; padding-left: 12px; }

table.survival-table td {
    padding: 8px 6px;
    text-align: center;
    border-bottom: 1px solid #eee;
    font-size: 12px;
}

table.survival-table td.team-col { text-align: left; padding-left: 12px; }

/* Row status styles */
tr.alive { background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%); }
tr.alive .team-name { color: #155724; font-weight: bold; }
tr.alive .manager-name { color: #28a745; }
tr.alive .rank-badge { background: linear-gradient(135deg, #28a745, #20c997); color: white; }

tr.eliminated-now { background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%); }
tr.eliminated-now .team-name { color: #721c24; font-weight: bold; }
tr.eliminated-now .manager-name { color: #dc3545; }
tr.eliminated-now .rank-badge { background: linear-gradient(135deg, #dc3545, #c82333); color: white; }

tr.eliminated-prev { background: #f0f0f0; }
tr.eliminated-prev .team-name { color: #999; text-decoration: line-through; }
tr.eliminated-prev .manager-name { color: #bbb; }
tr.eliminated-prev td { color: #bbb; }
tr.eliminated-prev .rank-badge { background: #999; color: white; }

tr.tiebreak { background: linear-gradient(135deg, #fff3cd 0%, #ffeeba 100%); }
tr.tiebreak .team-name { color: #856404; font-weight: bold; }
tr.tiebreak .manager-name { color: #fd7e14; }
tr.tiebreak .rank-badge { background: linear-gradient(135deg, #fd7e14, #e8590c); color: white; }

.rank-badge {
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: bold;
    line-height: 24px;
    text-align: center;
}

.team-name {
    font-size: 13px;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.team-name.long { font-size: 11px; }
.team-name.very-long { font-size: 9px; }

.manager-name {
    font-size: 11px;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
    color: #7f8c8d;
}

.score-cell { font-weight: bold; color: var(--brand-purple); }

.status-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: bold;
    color: white;
}

.status-tag.alive { background: var(--alive-color); }
.status-tag.eliminated { background: var(--eliminated-color); }
.status-tag.tiebreak { background: var(--tiebreak-color); }
.status-tag.prev-elim { background: var(--prev-elim-color); }

/* ===== Report Text Block ===== */
.report-block {
    background: rgba(0, 255, 135, 0.05);
    border: 1px solid rgba(0, 255, 135, 0.15);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-primary);
    white-space: pre-wrap;
}

/* ===== Legend ===== */
.legend {
    text-align: center;
    margin-bottom: 16px;
    font-size: 11px;
}

.legend span {
    display: inline-block;
    padding: 3px 10px;
    margin: 0 4px;
    border-radius: 4px;
    color: white;
}

.legend .alive { background: var(--alive-color); }
.legend .eliminated { background: var(--eliminated-color); }
.legend .prev-elim { background: var(--prev-elim-color); }
.legend .tiebreak { background: var(--tiebreak-color); }

/* ===== Team Journey Page ===== */
.team-header {
    text-align: center;
    padding: 20px 0;
}

.team-header h2 {
    color: var(--brand-green);
    font-size: 22px;
    margin-bottom: 4px;
}

.team-header .manager {
    color: var(--text-secondary);
    font-size: 14px;
}

.team-meta {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.team-meta .meta-item {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 8px 14px;
    text-align: center;
}

.team-meta .meta-label {
    font-size: 11px;
    color: var(--text-muted);
}

.team-meta .meta-value {
    font-size: 16px;
    font-weight: bold;
    color: var(--text-primary);
}

.journey-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
}

.journey-table th {
    background: var(--brand-purple);
    color: var(--brand-green);
    padding: 8px;
    font-size: 12px;
    text-align: center;
}

.journey-table td {
    padding: 8px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 13px;
}

.journey-table tr.highlight-best td {
    background: rgba(0, 255, 135, 0.1);
}

.journey-table tr.highlight-elim td {
    background: rgba(220, 53, 69, 0.15);
}

.result-badge {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    margin-top: 12px;
}

.result-badge.alive { background: var(--alive-color); color: white; }
.result-badge.eliminated { background: var(--eliminated-color); color: white; }

/* ===== Chart Container ===== */
.chart-container {
    position: relative;
    margin: 12px 0;
    padding: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
}

.chart-container canvas {
    max-height: 250px;
}

/* ===== Footer ===== */
.site-footer {
    text-align: center;
    padding: 20px;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 30px;
    border-top: 1px solid var(--card-border);
}

/* ===== Responsive ===== */
@media (max-width: 500px) {
    .container { padding: 10px; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .groups-grid { grid-template-columns: 1fr; }
    .stat-value { font-size: 24px; }
    .gw-list { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
    .team-name { max-width: 140px; }
    .nav-bar { gap: 4px; }
    .nav-bar a { padding: 5px 10px; font-size: 12px; }
}
