/* Galleon World Cup — Statistics (TeamHub visual language) */
:root {
    --text: #E8EAF2;
    --muted: rgba(200, 208, 224, 0.7);
    --dim: rgba(200, 208, 224, 0.45);
    --gold: #f4a323;
    --win: #81c784;
    --loss: #ff8a80;
    --draw: #c9b27a;
    --glass: rgba(255, 255, 255, 0.07);
    --glass-border: rgba(255, 255, 255, 0.06);
    --glass-strong: rgba(255, 255, 255, 0.1);
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
    --font: 'Goldman', system-ui, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
    min-height: 100vh;
    font-family: var(--font);
    color: var(--text);
    background: url('../../main_bg.png') no-repeat center center fixed;
    background-size: cover;
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
img { display: block; max-width: 100%; }

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

.wrap {
    width: 100%;
    max-width: none;
    padding: 18px 20px 48px;
    margin-top: 56px;
    animation: fadeIn 0.55s ease-out;
}

/* Hero / title */
.hero {
    display: grid;
    gap: 10px;
    margin: 8px 0 18px;
}
.hero__eyebrow {
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--gold);
}
.hero__title {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #fff;
    line-height: 1.15;
}
.hero__title span { color: var(--gold); }
.hero__sub {
    max-width: 70ch;
    color: var(--muted);
    font-size: 13px;
    letter-spacing: 0.03em;
    line-height: 1.55;
    font-weight: 400;
}
.hero__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.22);
    font-size: 11px;
    letter-spacing: 0.06em;
    color: var(--muted);
}
.chip b { color: #fff; font-weight: 700; }
.chip--gold {
    border-color: rgba(244, 163, 35, 0.35);
    color: var(--gold);
    background: rgba(244, 163, 35, 0.08);
}

.stage-switch {
    display: inline-flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}
.stage-btn {
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: rgba(0, 0, 0, 0.2);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    transition: color 0.15s, background 0.15s, border-color 0.15s, transform 0.15s;
}
.stage-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.12);
}
.stage-btn.is-active {
    color: #fff;
    border-color: rgba(244, 163, 35, 0.35);
    background: rgba(244, 163, 35, 0.08);
}
.stage-summary {
    margin-top: 6px;
    font-size: 12px;
    letter-spacing: 0.06em;
    color: var(--dim);
}

/* Sticky section tabs — like hub-hud */
.tabs {
    position: sticky;
    top: 56px;
    z-index: 50;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0 -20px 18px;
    padding: 8px 20px;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.tab {
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.tab:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}
.tab.is-active {
    color: #fff;
    border-color: rgba(244, 163, 35, 0.35);
    background: rgba(244, 163, 35, 0.08);
}

.panel { display: none; animation: fadeIn 0.4s ease-out; }
.panel.is-active { display: block; }

/* KPI */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}
.kpi-grid.is-playoff { grid-template-columns: repeat(2, 1fr); }
.kpi {
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    background: var(--glass);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: var(--shadow);
    padding: 16px;
}
.kpi__label {
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--dim);
    margin-bottom: 10px;
}
.kpi__value {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1;
    color: #fff;
}
.kpi__hint {
    margin-top: 8px;
    font-size: 11px;
    letter-spacing: 0.04em;
    color: var(--muted);
}
.kpi--gold .kpi__value { color: var(--gold); }
.kpi--win .kpi__value { color: var(--win); }

/* Cards */
.grid-2 {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 12px;
    margin-bottom: 12px;
}
.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}
.card {
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    background: var(--glass);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: var(--shadow);
    padding: 18px;
    min-width: 0;
}
.card__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.card__title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #fff;
}
.card__note {
    font-size: 11px;
    letter-spacing: 0.06em;
    color: var(--dim);
    text-transform: uppercase;
}
.chart-box { position: relative; height: 260px; }
.chart-box--sm { height: 210px; }
.chart-box--tall { height: 320px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
table.data th {
    text-align: left;
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--dim);
    font-weight: 700;
    padding: 0 10px 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    white-space: nowrap;
}
table.data td {
    padding: 12px 10px 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
}
table.data tr:hover td { background: rgba(255, 255, 255, 0.03); }
table.data tr.is-clickable { cursor: pointer; }
.num { font-variant-numeric: tabular-nums; }
.center { text-align: center; }

.team-cell {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.team-cell img,
.logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
    flex-shrink: 0;
    filter: drop-shadow(0 0 8px rgba(244, 163, 35, 0.2));
    border-radius: 0;
    border: none;
    background: transparent;
}
.logo--lg {
    width: 44px;
    height: 44px;
}
.rank {
    color: var(--gold);
    width: 28px;
    font-weight: 700;
}
.form {
    display: inline-flex;
    gap: 4px;
}
.form i {
    width: 18px;
    height: 18px;
    display: grid;
    place-items: center;
    font-style: normal;
    font-size: 10px;
    font-weight: 700;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.2);
}
.form i.W { color: var(--win); border-color: rgba(129, 199, 132, 0.35); }
.form i.L { color: var(--loss); border-color: rgba(255, 138, 128, 0.35); }
.form i.D { color: var(--draw); border-color: rgba(201, 178, 122, 0.35); }

.pill {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 8px;
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.2);
}
.pill--w { color: var(--win); border-color: rgba(129, 199, 132, 0.35); }
.pill--l { color: var(--loss); border-color: rgba(255, 138, 128, 0.35); }
.pill--d { color: var(--draw); border-color: rgba(201, 178, 122, 0.35); }
.pill--p { color: var(--muted); }

.bar {
    height: 4px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
    margin-top: 6px;
}
.bar > span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #e08e1a, #f4a323);
}

.list-rows { display: flex; flex-direction: column; gap: 8px; }
.list-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.2);
    font-size: 13px;
    letter-spacing: 0.03em;
}
.list-row__meta { color: var(--dim); font-size: 11px; letter-spacing: 0.05em; }
.list-row__val { color: var(--gold); font-weight: 700; font-size: 13px; }

/* Seed / award cards */
.seed-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}
.seed-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.2);
    min-width: 0;
}
.seed-card__place {
    color: var(--gold);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    min-width: 28px;
}
.seed-card__name {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.seed-card__meta {
    font-size: 10px;
    letter-spacing: 0.06em;
    color: var(--dim);
    text-transform: uppercase;
    margin-top: 2px;
}

/* Filters */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
    align-items: center;
}
.toolbar input,
.toolbar select {
    appearance: none;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: #fff;
    padding: 9px 12px;
    font: inherit;
    font-size: 12px;
    letter-spacing: 0.04em;
    min-width: 140px;
}
.toolbar input { flex: 1; min-width: 180px; }
.toolbar input:focus,
.toolbar select:focus {
    outline: none;
    border-color: #f4a323;
    background: rgba(0, 0, 0, 0.35);
}
.toolbar option { background: #121820; color: #fff; }

/* Match cards */
.match-feed { display: flex; flex-direction: column; gap: 10px; }
.match-card {
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.22);
    padding: 14px 16px;
}
.match-card.is-clickable {
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.match-card.is-clickable:hover {
    border-color: rgba(244, 163, 35, 0.35);
    background: rgba(244, 163, 35, 0.08);
}
.match-card__top {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    align-items: center;
    margin-bottom: 12px;
    font-size: 11px;
    color: var(--dim);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.match-card__body {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 12px;
    align-items: center;
}
.match-side {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.match-side--right { flex-direction: row-reverse; text-align: right; }
.match-side.is-winner .match-side__name { color: var(--gold); }
.match-side__name {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.04em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.match-score {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-align: center;
    min-width: 72px;
}
.match-score small {
    display: block;
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--dim);
    margin-top: 4px;
    font-weight: 400;
}
.match-card__lineups {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    font-size: 12px;
    color: var(--muted);
}
.match-card__lineups b { color: #fff; font-weight: 700; }

/* H2H — full names + logos */
.h2h-wrap { overflow-x: auto; padding-bottom: 6px; }
.h2h {
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
    min-width: 100%;
}
.h2h th,
.h2h td {
    border: 1px solid rgba(255, 255, 255, 0.06);
    text-align: center;
    padding: 8px;
    vertical-align: middle;
}
.h2h th {
    background: rgba(0, 0, 0, 0.28);
    color: var(--muted);
    font-weight: 700;
}
.h2h th.corner {
    min-width: 150px;
    text-align: left;
    position: sticky;
    left: 0;
    z-index: 2;
    background: rgba(12, 16, 24, 0.95);
}
.h2h th.h2h-col {
    min-width: 118px;
    max-width: 140px;
    padding: 10px 8px;
}
.h2h-team {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.h2h-team img,
.h2h-team .logo {
    width: 28px;
    height: 28px;
}
.h2h-team span {
    display: block;
    font-size: 11px;
    letter-spacing: 0.04em;
    color: #fff;
    line-height: 1.2;
    white-space: normal;
    word-break: break-word;
}
.h2h td {
    min-width: 56px;
    background: rgba(0, 0, 0, 0.12);
}
.h2h td.self { background: rgba(244, 163, 35, 0.08); color: var(--dim); }
.h2h td.empty { color: var(--dim); }
.h2h td.edge-w { background: rgba(129, 199, 132, 0.12); color: var(--win); font-weight: 700; }
.h2h td.edge-l { background: rgba(255, 138, 128, 0.1); color: var(--loss); font-weight: 700; }
.h2h td.edge-d { background: rgba(201, 178, 122, 0.1); color: var(--draw); font-weight: 700; }
.h2h tbody th.corner {
    background: rgba(12, 16, 24, 0.95);
}

/* Drawer */
.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 10050;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.drawer-backdrop.is-open { opacity: 1; pointer-events: auto; }
.drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: min(460px, 100%);
    height: 100%;
    z-index: 10060;
    background: rgba(12, 16, 24, 0.96);
    backdrop-filter: blur(18px);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    transform: translateX(105%);
    transition: transform 0.28s ease;
    overflow-y: auto;
    padding: 22px 20px 40px;
}
.drawer.is-open { transform: none; }
.drawer__close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--muted);
}
.drawer__close:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
.drawer__team {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 18px;
    padding-right: 40px;
}
.drawer__name {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.drawer__record {
    color: var(--muted);
    font-size: 12px;
    margin-top: 4px;
    letter-spacing: 0.04em;
}
.drawer section { margin-top: 18px; }
.drawer h3 {
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #fff;
    margin-bottom: 10px;
}

.empty {
    padding: 24px;
    text-align: center;
    color: var(--dim);
    border-radius: 12px;
    border: 1px dashed rgba(255, 255, 255, 0.1);
    letter-spacing: 0.04em;
    font-size: 12px;
}

.footer-note {
    margin-top: 28px;
    font-size: 11px;
    color: var(--dim);
    letter-spacing: 0.05em;
}

@media (max-width: 1100px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .kpi-grid, .kpi-grid.is-playoff { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
    .wrap { padding: 14px 12px 40px; }
    .tabs { margin: 0 -12px 14px; padding: 8px 12px; }
    .kpi-grid, .kpi-grid.is-playoff { grid-template-columns: 1fr; }
    .match-card__body { grid-template-columns: 1fr; gap: 8px; }
    .match-side--right { flex-direction: row; text-align: left; }
    .match-card__lineups { grid-template-columns: 1fr; }
    .h2h th.h2h-col { min-width: 96px; }
}
