/* Gameweek Lab — single stylesheet, no framework */
:root {
  --bg: #0b1220;
  --surface: #121b2e;
  --surface-2: #18233a;
  --border: #24314d;
  --text: #e8edf7;
  --muted: #9aa7c0;
  --accent: #3ddc97;      /* brand teal-green */
  --accent-2: #5aa9ff;    /* links / info */
  --warn: #f5b942;
  --bad: #ff6b6b;
  --radius: 12px;
  --shadow: 0 6px 24px rgba(0, 0, 0, .25);
  /* fixture difficulty: diverging, gray midpoint */
  --fdr-1: #1f8f5f; --fdr-2: #3ddc97; --fdr-3: #4a5670; --fdr-4: #e07a5f; --fdr-5: #b3261e;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); line-height: 1.5; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent-2); }
main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 24px 20px 48px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(1.6rem, 3vw, 2.3rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* header */
.site-header { background: rgba(11, 18, 32, .9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.nav { max-width: 1180px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.brand { font-weight: 800; font-size: 1.15rem; color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); display: grid; place-items: center; color: #08111f; font-size: .85rem; font-weight: 900; }
.nav-links { display: flex; gap: 4px; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
.nav-links a { color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: 8px; font-weight: 500; }
.nav-links a:hover { color: var(--text); background: var(--surface-2); }
.nav-links a[aria-current="page"] { color: var(--text); background: var(--surface-2); box-shadow: inset 0 -2px 0 var(--accent); }

/* footer */
.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: .85rem; }
.site-footer .inner { max-width: 1180px; margin: 0 auto; padding: 20px; display: flex; gap: 16px; justify-content: space-between; flex-wrap: wrap; }
.site-footer a { color: var(--muted); }

/* layout */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.card h2 { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.section { margin-top: 28px; }

.hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; align-items: stretch; }
@media (max-width: 820px) { .hero { grid-template-columns: 1fr; } }
.hero-copy p { color: var(--muted); font-size: 1.05rem; max-width: 56ch; }
.countdown { display: flex; gap: 10px; margin-top: 8px; }
.countdown div { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; text-align: center; min-width: 64px; }
.countdown b { display: block; font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.countdown span { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.stat .value { font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .sub { color: var(--muted); font-size: .85rem; }

/* lists & tables */
.rank-list { list-style: none; margin: 0; padding: 0; }
.rank-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.rank-list li:last-child { border-bottom: 0; }
.rank-list .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-list .metric { font-weight: 700; font-variant-numeric: tabular-nums; }
.pill { display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.pill.up { color: var(--accent); }
.pill.down { color: var(--bad); }
.pill.warn { color: var(--warn); }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: var(--surface-2); color: var(--muted); font-weight: 600; position: sticky; top: 0; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th[aria-sort="descending"]::after { content: " ▼"; font-size: .7em; }
th[aria-sort="ascending"]::after { content: " ▲"; font-size: .7em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: var(--surface-2); }
tbody tr.clickable { cursor: pointer; }

/* forms */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 14px; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; color: var(--muted); }
input, select, button { font: inherit; }
input, select { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; min-width: 120px; }
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 1px; }
.btn { background: var(--accent); color: #07131f; border: 0; border-radius: 8px; padding: 9px 16px; font-weight: 700; cursor: pointer; }
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }

/* fixture ticker */
.fdr { display: inline-block; min-width: 62px; text-align: center; padding: 5px 6px; border-radius: 6px; font-size: .78rem; font-weight: 700; color: #fff; }
.fdr + .fdr { margin-top: 2px; }
.fdr-1 { background: var(--fdr-1); }
.fdr-2 { background: var(--fdr-2); color: #07131f; }
.fdr-3 { background: var(--fdr-3); }
.fdr-4 { background: var(--fdr-4); color: #1a0d08; }
.fdr-5 { background: var(--fdr-5); }
.fdr-blank { background: transparent; color: var(--muted); border: 1px dashed var(--border); }
.ticker td { vertical-align: top; }
.legend { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }

/* team pitch */
.pitch { display: flex; flex-direction: column; gap: 12px; padding: 18px; border-radius: var(--radius); background: linear-gradient(180deg, #13402f, #0f3326); border: 1px solid #1e5a43; }
.pitch-row { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.shirt { width: 108px; background: rgba(8, 17, 31, .85); border-radius: 10px; padding: 8px 6px; text-align: center; font-size: .8rem; position: relative; }
.shirt .pn { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shirt .pt { color: var(--muted); }
.shirt .cap { position: absolute; top: -8px; right: -6px; background: var(--accent); color: #07131f; border-radius: 999px; width: 22px; height: 22px; display: grid; place-items: center; font-weight: 900; font-size: .72rem; }
.shirt .cap.vc { background: var(--muted); }
.bench { margin-top: 12px; opacity: .8; }

/* chart */
.chart { position: relative; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .gridline { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart .crosshair { stroke: var(--muted); stroke-dasharray: 3 3; }
.tooltip { position: absolute; pointer-events: none; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: .8rem; box-shadow: var(--shadow); white-space: nowrap; transform: translate(-50%, -110%); }

/* ads: reserve space to avoid layout shift (CLS) */
.ad-slot { margin: 28px auto; min-height: 120px; display: grid; place-items: center; border: 1px dashed var(--border); border-radius: var(--radius); color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; }
.ad-slot.has-ad { border: 0; }

/* states */
.loading { color: var(--muted); padding: 16px 0; }
.error { color: var(--bad); background: rgba(255, 107, 107, .08); border: 1px solid rgba(255, 107, 107, .3); border-radius: 8px; padding: 10px 14px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 6px; height: 14px; margin: 8px 0; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* modal / drawer */
dialog { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); max-width: 640px; width: calc(100% - 32px); padding: 22px; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0, 0, 0, .6); }
.dialog-close { float: right; }

/* architecture page */
.diagram svg { width: 100%; height: auto; }
.diagram .node rect { fill: var(--surface-2); stroke: var(--border); }
.diagram .node.hl rect { stroke: var(--accent); }
.diagram text { fill: var(--text); font-size: 13px; }
.diagram .sub { fill: var(--muted); font-size: 11px; }
.diagram .edge { stroke: var(--muted); stroke-width: 1.5; fill: none; marker-end: url(#arrow); }
.diagram .edge-label { fill: var(--accent); font-size: 11px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; word-break: break-all; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; font-size: .88em; }
pre { background: var(--surface-2); padding: 14px; border-radius: 8px; overflow-x: auto; font-size: .82rem; }
.prose { max-width: 75ch; }
.prose li { margin-bottom: .4em; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
