/* ============ Fable World Cup — design tokens ============ */
:root {
  --ink: #09090B;
  --surface: #101014;
  --surface-2: #17171d;
  --surface-3: #1f1f27;
  --border: #2a2a33;
  --text: #f4f4f5;
  --text-dim: #a1a1aa;
  /* official WC26 host tri-color: red / federation blue / green */
  --accent: #E0212F;
  --accent-soft: rgba(224, 33, 47, .14);
  --blue: #2C50DD;
  --sky: #8FB3F5;
  --gold: #fbbf24;
  --green: #19B562;
  --red: #f87171;
  --radius: 14px;
  --font-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --font-body: "Barlow", system-ui, sans-serif;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ============ background art ============ */
.bg-art { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.grid-lines { position: absolute; inset: 0; color: rgba(255,255,255,.035); }
.orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .35; }
.orb-1 { width: 520px; height: 520px; background: #B30E1F; top: -180px; left: -120px; animation: drift 26s ease-in-out infinite alternate; }
.orb-2 { width: 460px; height: 460px; background: var(--blue); top: 30%; right: -160px; animation: drift 32s ease-in-out infinite alternate-reverse; }
.orb-3 { width: 380px; height: 380px; background: #067A41; bottom: -140px; left: 28%; animation: drift 38s ease-in-out infinite alternate; }
@keyframes drift {
  from { transform: translate3d(0,0,0) scale(1); }
  to   { transform: translate3d(60px, 40px, 0) scale(1.15); }
}

/* ============ top bar ============ */
.topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 14px clamp(16px, 4vw, 48px);
  background: rgba(9,9,11,.72);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-size: 22px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
  color: var(--text); text-decoration: none;
}
.brand em { font-style: normal; color: var(--accent); }
.brand-mark { animation: spin 24s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.topnav { display: flex; gap: clamp(10px, 2.5vw, 28px); }
.topnav a {
  color: var(--text-dim); text-decoration: none; font-weight: 500; font-size: 14px;
  text-transform: uppercase; letter-spacing: .08em;
  padding: 8px 2px; transition: color .2s;
}
.topnav a:hover, .topnav a:focus-visible { color: var(--accent); }

main { max-width: 1160px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 48px); }

/* ============ hero ============ */
.hero { padding: clamp(48px, 9vh, 110px) 0 56px; }
.hero-kicker {
  font-size: 13px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 14px;
}
.hero-title {
  font-family: var(--font-display); font-weight: 800; text-transform: uppercase;
  font-size: clamp(44px, 8.5vw, 104px); line-height: .95; letter-spacing: .01em;
  margin: 0 0 44px;
}
.hero-title .line { display: block; }
.hero-title strong { color: var(--accent); }
.accent-line {
  background: linear-gradient(92deg, #FF4B57 0%, #5B7BFF 50%, #2BD680 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* reveal animation */
.reveal { opacity: 0; transform: translateY(26px); animation: rise .8s var(--ease-out) forwards; }
.d1 { animation-delay: .12s; } .d2 { animation-delay: .24s; } .d3 { animation-delay: .4s; }
@keyframes rise { to { opacity: 1; transform: none; } }
.reveal-scroll { opacity: 0; transform: translateY(28px); transition: opacity .7s var(--ease-out), transform .7s var(--ease-out); }
.reveal-scroll.is-in { opacity: 1; transform: none; }

/* ============ record board ============ */
.record-board {
  display: grid; grid-template-columns: minmax(260px, 1fr) 1.4fr; gap: clamp(24px, 4vw, 56px);
  background: linear-gradient(160deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border); border-radius: 22px;
  padding: clamp(24px, 4vw, 44px);
  position: relative; overflow: hidden;
}
.record-board::before {
  content: ""; position: absolute; inset: -1px;
  background: conic-gradient(from var(--sweep, 0deg), transparent 0 84%, rgba(91,123,255,.55) 92%, transparent 100%);
  border-radius: inherit; pointer-events: none;
  animation: sweep 7s linear infinite;
  mask: linear-gradient(#000, #000) content-box, linear-gradient(#000, #000);
  mask-composite: exclude; padding: 1px;
}
@property --sweep { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
@keyframes sweep { to { --sweep: 360deg; } }

.record-main { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 18px; }
.dial-wrap { position: relative; width: min(240px, 60vw); }
.dial { width: 100%; transform: rotate(-90deg); }
.dial-track, .dial-fill { fill: none; stroke-width: 11; stroke-linecap: round; }
.dial-track { stroke: var(--surface-3); }
.dial-fill {
  stroke: var(--green);
  stroke-dasharray: 540.35; stroke-dashoffset: 540.35;
  transition: stroke-dashoffset 1.4s var(--ease-out);
  filter: drop-shadow(0 0 8px rgba(25,181,98,.55));
}
.dial-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
}
.dial-value { font-family: var(--font-display); font-size: clamp(40px, 6vw, 58px); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.dial-label { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-dim); }
.record-status { font-size: 14px; color: var(--text-dim); max-width: 30ch; margin: 0; }

.record-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-content: center; }
.stat {
  background: rgba(255,255,255,.03); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 16px; display: flex; flex-direction: column; gap: 4px;
  transition: transform .25s var(--ease-out), border-color .25s;
}
.stat:hover { transform: translateY(-3px); border-color: var(--accent); }
.stat-value { font-family: var(--font-display); font-size: clamp(26px, 3vw, 36px); font-weight: 700; line-height: 1.05; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-dim); }

/* ============ sections ============ */
.section { padding: clamp(48px, 8vh, 96px) 0; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 28px; }
.section-head h2 {
  font-family: var(--font-display); font-weight: 800; text-transform: uppercase;
  font-size: clamp(30px, 4.5vw, 48px); margin: 0; letter-spacing: .02em;
}
.section-head h2::after {
  content: ""; display: block; width: 72px; height: 4px; margin-top: 8px;
  background: linear-gradient(90deg, var(--accent) 0 33%, var(--blue) 33% 66%, var(--green) 66%); border-radius: 2px;
}
.tz-note { color: var(--text-dim); font-size: 14px; margin: 0; }
.tz-note span { color: var(--sky); font-weight: 600; }

/* ============ filters ============ */
.filters {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
  margin-bottom: 26px; position: sticky; top: 70px; z-index: 50;
  background: linear-gradient(160deg, rgba(23,23,29,.78), rgba(16,16,20,.78));
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border); border-radius: 18px;
  padding: 12px 14px; box-shadow: 0 12px 36px rgba(0,0,0,.35);
}
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: 600 13px/1 var(--font-body); letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-dim); background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 10px 16px; cursor: pointer;
  transition: all .2s var(--ease-out); min-height: 38px;
}
.chip:hover { color: var(--text); border-color: var(--accent); }
.chip.is-active { background: var(--blue); border-color: var(--blue); color: #fff; }
.search-wrap {
  display: flex; align-items: center; gap: 8px; color: var(--text-dim);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 0 16px;
}
.search-wrap:focus-within { border-color: var(--accent); }
.search-wrap input {
  background: none; border: 0; outline: 0; color: var(--text);
  font: 400 15px var(--font-body); padding: 11px 0; width: 160px;
}

/* ============ match list ============ */
.day-head {
  font-family: var(--font-display); font-size: 22px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--sky); margin: 34px 0 12px;
  display: flex; align-items: center; gap: 14px;
}
.day-head::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.day-head:first-child { margin-top: 0; }

.match-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px clamp(14px, 2.5vw, 24px); margin-bottom: 10px;
  display: grid; grid-template-columns: 150px 1fr 230px; gap: 18px; align-items: center;
  transition: transform .25s var(--ease-out), border-color .25s, box-shadow .25s;
}
.match-card:hover { transform: translateY(-2px) scale(1.004); border-color: rgba(91,123,255,.55); box-shadow: 0 10px 32px rgba(0,0,0,.4); }
.match-card.is-live { border-color: var(--accent); box-shadow: 0 0 24px rgba(224,33,47,.25); }
.match-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.match-stage { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.match-venue { font-size: 12px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.match-teams { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; min-width: 0; }
.team { display: flex; align-items: center; gap: 10px; min-width: 0; }
.team-home { justify-content: flex-end; text-align: right; }
.team-away { justify-content: flex-start; }
.team-home .team-badge { order: 2; }
.team-name { font-weight: 600; font-size: clamp(14px, 1.6vw, 17px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-badge {
  flex: 0 0 38px; width: 38px; height: 28px; border-radius: 5px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 13px; color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.5); border: 1px solid rgba(255,255,255,.18);
  object-fit: cover; box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.team-tbd .team-badge { background: var(--surface-3) !important; color: var(--text-dim); }
.team-tbd .team-name { color: var(--text-dim); font-weight: 400; }

.match-mid { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 86px; }
.match-score { font-family: var(--font-display); font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .06em; }
.match-score.is-vs { color: var(--text-dim); font-size: 15px; font-weight: 500; }
.match-time { font-size: 13px; color: var(--sky); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.live-badge[hidden] { display: none; }
.live-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font: 700 10px/1 var(--font-body); letter-spacing: .16em;
  color: #fff; background: var(--accent);
  padding: 4px 10px 4px 8px; border-radius: 999px;
  animation: livePulse 1.8s ease-in-out infinite;
}
.live-badge::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: #fff;
  animation: liveBlink 1.2s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224,33,47,.55); }
  50% { box-shadow: 0 0 0 7px rgba(224,33,47,0); }
}
@keyframes liveBlink { 50% { opacity: .25; } }

.match-call {
  display: flex; flex-direction: column; gap: 4px; align-items: flex-start;
  border-left: 1px dashed var(--border); padding-left: 18px; min-width: 0;
}
.call-tag { font-size: 10px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--text-dim); }
.call-body { font-size: 14px; font-weight: 600; color: var(--text-dim); }
.call-body.has-call { color: var(--text); }
.call-confidence { color: var(--sky); font-weight: 500; }
.call-verdict { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; padding: 3px 10px; border-radius: 999px; }
.call-verdict.v-exact { background: rgba(251,191,36,.15); color: var(--gold); }
.call-verdict.v-correct { background: rgba(52,211,153,.14); color: var(--green); }
.call-verdict.v-wrong { background: rgba(248,113,113,.13); color: var(--red); }

.conf-chip {
  font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  padding: 3px 10px; border-radius: 999px; border: 1px solid transparent;
}
.conf-high { background: rgba(25,181,98,.13); color: var(--green); }
.conf-medium { background: rgba(143,179,245,.12); color: var(--sky); }
.conf-low { background: rgba(251,191,36,.12); color: var(--gold); }

.call-toggle {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 2px;
  font: 600 12px/1 var(--font-body); letter-spacing: .06em; text-transform: uppercase;
  color: var(--sky); background: none; border: 0; padding: 6px 0; cursor: pointer;
  transition: color .2s;
}
.call-toggle:hover { color: var(--text); }
.call-toggle svg { transition: transform .25s var(--ease-out); }
.call-toggle.is-open svg { transform: rotate(180deg); }

.call-details[hidden] { display: none; }
.call-details {
  grid-column: 1 / -1;
  border-top: 1px dashed var(--border);
  padding-top: 16px; margin-top: 4px;
  display: flex; flex-direction: column; gap: 12px;
  animation: rise .35s var(--ease-out);
}
.prob-bar {
  display: flex; height: 10px; border-radius: 999px; overflow: hidden;
  background: var(--surface-3);
}
.prob-bar .seg { height: 100%; }
.seg-home, .dot-home { background: var(--blue); }
.seg-draw, .dot-draw { background: #52525e; }
.seg-away, .dot-away { background: var(--accent); }
.prob-labels { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--text-dim); font-weight: 600; }
.prob-labels .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.det-cols { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; }
.det-cols h4 {
  font-family: var(--font-display); font-size: 15px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em; color: var(--sky); margin: 0 0 8px;
}
.det-cols ul { margin: 0; padding-left: 18px; color: var(--text-dim); font-size: 14px; display: flex; flex-direction: column; gap: 6px; }
.det-cols li::marker { color: var(--accent); }
.watch-row { margin: 0 0 8px; font-size: 14px; color: var(--text-dim); }
.watch-row strong { display: block; color: var(--text); font-size: 13px; letter-spacing: .04em; }

.empty-note { text-align: center; color: var(--text-dim); padding: 48px 0; }

/* ============ groups ============ */
.groups-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.group-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; transition: transform .25s var(--ease-out), border-color .25s;
}
.group-card:hover { transform: translateY(-4px); border-color: var(--accent); }
.group-card h3 {
  font-family: var(--font-display); font-size: 26px; font-weight: 800; margin: 0 0 12px;
  text-transform: uppercase; letter-spacing: .04em;
}
.group-card h3 span { color: var(--accent); }
.group-card ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.group-card li { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 500; }
.group-card .team-badge { flex-basis: 32px; width: 32px; height: 24px; font-size: 11px; }

/* ============ method ============ */
.method-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.method-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px; position: relative; overflow: hidden;
  transition: transform .25s var(--ease-out), border-color .25s;
}
.method-card:hover { transform: translateY(-4px); border-color: var(--accent); }
.method-num {
  font-family: var(--font-display); font-size: 64px; font-weight: 800; line-height: 1;
  color: transparent; -webkit-text-stroke: 1px var(--border); position: absolute; top: 14px; right: 18px;
}
.method-card h3 { font-family: var(--font-display); text-transform: uppercase; font-size: 22px; margin: 0 0 8px; letter-spacing: .03em; }
.method-card p { margin: 0; color: var(--text-dim); font-size: 15px; }
.method-card strong { color: var(--gold); }

/* ============ footer ============ */
.footer { border-top: 1px solid var(--border); margin-top: 40px; padding: 32px clamp(16px, 4vw, 48px); text-align: center; color: var(--text-dim); font-size: 13px; }
.footer p { margin: 4px 0; max-width: 70ch; margin-inline: auto; }
.footer strong { color: var(--text); }

/* ============ responsive ============ */
@media (max-width: 900px) {
  .record-board { grid-template-columns: 1fr; }
  .record-stats { grid-template-columns: repeat(3, 1fr); }
  .match-card { grid-template-columns: 1fr; gap: 10px; }
  .match-call { border-left: 0; border-top: 1px dashed var(--border); padding: 10px 0 0; }
  .match-meta { flex-direction: row; justify-content: space-between; align-items: center; }
  .det-cols { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .topnav a { font-size: 12px; padding: 8px 0; }
  .record-stats { grid-template-columns: repeat(2, 1fr); }
  .search-wrap { flex: 1; }
  .search-wrap input { width: 100%; }
  .filters { position: static; }
}

/* ============ accessibility ============ */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
  .reveal, .reveal-scroll { opacity: 1; transform: none; }
}
