/* =========================================================================
   Hindsight · WC 2026 — Design System
   纸感浅底 / 墨字 / 语义胜负色 / 深色签名 ribbon
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@500;600;700;800&family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@400;500;600&family=Noto+Sans+SC:wght@400;500;700&display=swap');

:root {
  /* ---- surfaces (light) ---- */
  --paper:      #F2F3EE;
  --surface:    #FFFFFF;
  --surface-2:  #FAFAF7;
  --ink:        #16201A;
  --muted:      #586259;
  --faint:      #8A938B;
  --line:       #E2E4DC;
  --line-strong:#CDD0C6;

  /* ---- semantic (outcome) ---- */
  --home:    #1E7A52;  --home-bg:  #E6F2EB;  --home-ink: #145C3C;
  --away:    #B14367;  --away-bg:  #F7E8ED;  --away-ink: #8C3151;
  --draw:    #7C837C;  --draw-bg:  #ECEEE9;  --draw-ink: #565C56;
  --warn:    #8A6200;  --warn-bg:  #FBF1D9;  --warn-ink: #6E4E00;
  --accent:  #1E7A52;

  /* ---- ribbon (dark signature, constant in both themes) ---- */
  --ribbon-bg:   #12181A;
  --ribbon-bg-2: #1A2226;
  --ribbon-ink:  #EAF0EC;
  --ribbon-muted:#7E8C84;
  --ribbon-line: #283238;
  --ribbon-live: #46D08A;

  /* ---- heat ramp anchors ---- */
  --heat-home: 30,122,82;
  --heat-away: 177,67,103;
  --heat-draw: 124,131,124;

  /* ---- geometry ---- */
  --r-sm: 6px; --r: 9px; --r-lg: 13px; --r-xl: 18px;
  --shadow-sm: 0 1px 2px rgba(22,32,26,.04), 0 1px 3px rgba(22,32,26,.05);
  --shadow:    0 2px 6px rgba(22,32,26,.05), 0 6px 18px rgba(22,32,26,.06);
  --shadow-lg: 0 12px 40px rgba(22,32,26,.16);

  --maxw: 1320px;

  --font-head: 'Archivo', 'Noto Sans SC', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans', 'Noto Sans SC', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
}

[data-theme="dark"] {
  --paper:      #0E1416;
  --surface:    #161D20;
  --surface-2:  #1B2327;
  --ink:        #E7ECE7;
  --muted:      #94A099;
  --faint:      #6B7670;
  --line:       #283034;
  --line-strong:#36403F;

  --home:    #45B584;  --home-bg:  #16312A;  --home-ink: #7FD3AC;
  --away:    #D87A99;  --away-bg:  #3A2230;  --away-ink: #EBA4BC;
  --draw:    #8A938C;  --draw-bg:  #232A2A;  --draw-ink: #AAB2AB;
  --warn:    #D9A23A;  --warn-bg:  #322914;  --warn-ink: #ECC579;
  --accent:  #45B584;

  --heat-home: 69,181,132;
  --heat-away: 216,122,153;
  --heat-draw: 138,147,140;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow:    0 2px 8px rgba(0,0,0,.35), 0 8px 24px rgba(0,0,0,.3);
  --shadow-lg: 0 16px 48px rgba(0,0,0,.55);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .35s ease, color .35s ease;
}

.tnum { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

h1,h2,h3,h4 { font-family: var(--font-head); margin: 0; font-weight: 700; letter-spacing: -.01em; }

a { color: inherit; }
button { font-family: inherit; cursor: pointer; }
[x-cloak] { display: none !important; }

::selection { background: color-mix(in oklab, var(--accent) 28%, transparent); }

/* ---- scrollbar ---- */
*::-webkit-scrollbar { height: 9px; width: 9px; }
*::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 6px; }
*::-webkit-scrollbar-track { background: transparent; }

/* =========================================================================
   HEADER
   ========================================================================= */
.app-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in oklab, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; gap: 22px;
  padding: 13px 24px;
}
.brand { display: flex; align-items: baseline; gap: 9px; flex-shrink: 0; }
.brand-mark {
  font-family: var(--font-head); font-weight: 800; font-size: 19px;
  letter-spacing: -.02em; color: var(--ink);
}
.brand-mark .dot { color: var(--accent); }
.brand-sub {
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--faint); font-weight: 600;
}

.tabs { display: flex; gap: 2px; margin-left: 6px; flex-wrap: wrap; }
.tab {
  position: relative; border: none; background: transparent;
  color: var(--muted); font-size: 14px; font-weight: 600;
  padding: 8px 14px; border-radius: var(--r); transition: .18s;
  display: inline-flex; align-items: center; gap: 7px;
}
.tab:hover { color: var(--ink); background: color-mix(in oklab, var(--ink) 5%, transparent); }
.tab.active { color: var(--ink); background: var(--surface); box-shadow: var(--shadow-sm); }
.tab .tab-tag {
  font-size: 9.5px; font-weight: 700; letter-spacing: .04em;
  padding: 2px 6px; border-radius: 20px;
  background: var(--accent); color: #fff;
}
[data-theme="dark"] .tab .tab-tag { color: #07120D; }

.header-right { margin-left: auto; display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.updated {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--muted);
}
.live-pulse {
  width: 8px; height: 8px; border-radius: 50%; background: var(--home);
  position: relative; flex-shrink: 0;
}
.live-pulse::after {
  content:""; position: absolute; inset: -4px; border-radius: 50%;
  border: 1.5px solid var(--home); opacity: 0; animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse { 0%{transform:scale(.6);opacity:.7} 100%{transform:scale(1.7);opacity:0} }
.updated .when { font-family: var(--font-mono); font-weight: 500; color: var(--ink); }

.icon-btn {
  width: 34px; height: 34px; border-radius: var(--r); border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); display: grid; place-items: center;
  transition: .18s;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.icon-btn svg { width: 16px; height: 16px; }

/* =========================================================================
   MODEL-HEALTH RIBBON (signature)
   ========================================================================= */
.ribbon {
  background: linear-gradient(100deg, var(--ribbon-bg), var(--ribbon-bg-2));
  color: var(--ribbon-ink);
  border-bottom: 1px solid #000;
  position: sticky; top: 57px; z-index: 49;
}
.ribbon-inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: stretch; gap: 0;
  padding: 0 24px; overflow-x: auto; scrollbar-width: none;
}
.ribbon-inner::-webkit-scrollbar { display: none; }
.rb {
  display: flex; flex-direction: column; gap: 2px;
  padding: 11px 22px 11px 0; margin-right: 22px;
  border-right: 1px solid var(--ribbon-line);
  flex-shrink: 0;
}
.rb:last-of-type { border-right: none; }
.rb-label { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ribbon-muted); font-weight: 600; }
.rb-val { font-family: var(--font-mono); font-weight: 600; font-size: 16px; letter-spacing: -.01em; display: flex; align-items: baseline; gap: 4px; }
.rb-val .unit { font-size: 11px; color: var(--ribbon-muted); font-family: var(--font-body); }
.rb-val .live { color: var(--ribbon-live); }
.rb-dot { display:inline-block; width:6px;height:6px;border-radius:50%;background:var(--ribbon-live);margin-right:5px; box-shadow:0 0 8px var(--ribbon-live); }
.rb-spacer { flex: 1; min-width: 12px; border: none; }
.rb-warn {
  align-self: center; margin-left: auto; flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(217,162,58,.16); color: #F0C36B;
  border: 1px solid rgba(217,162,58,.34);
  padding: 6px 13px; border-radius: 20px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}

/* =========================================================================
   LAYOUT
   ========================================================================= */
.main { max-width: var(--maxw); margin: 0 auto; padding: 28px 24px 80px; }
.view-head { margin-bottom: 22px; }
.view-head h2 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.view-head .lede { color: var(--muted); font-size: 14.5px; margin-top: 6px; max-width: 760px; text-wrap: pretty; }

.section { margin-top: 40px; }
.section:first-child { margin-top: 0; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.section-head h3 { font-size: 16.5px; font-weight: 700; }
.section-head .kicker {
  font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); font-weight: 700;
}
.section-head .note { font-size: 12.5px; color: var(--faint); margin-left: auto; text-align: right; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
}
.card-pad { padding: 18px 20px; }

/* chips & pills */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px;
  border: 1px solid var(--line); color: var(--muted); background: var(--surface);
}
.chip.home { color: var(--home-ink); background: var(--home-bg); border-color: transparent; }
.chip.away { color: var(--away-ink); background: var(--away-bg); border-color: transparent; }
.chip.draw { color: var(--draw-ink); background: var(--draw-bg); border-color: transparent; }
.chip.warn { color: var(--warn-ink); background: var(--warn-bg); border-color: transparent; }
.chip.market { color: var(--ink); background: var(--surface-2); border-color: var(--line-strong); }
.chip svg { width: 12px; height: 12px; }

/* flags */
.flag {
  width: 22px; height: 16px; border-radius: 2px; object-fit: cover;
  box-shadow: 0 0 0 1px rgba(0,0,0,.08); background: var(--line); flex-shrink: 0;
}
.flag.lg { width: 30px; height: 22px; border-radius: 3px; }
.flag.sm { width: 18px; height: 13px; }
.team-cell { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.team-cell .tname { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flag-emoji { display: inline-grid; place-items: center; line-height: 1; font-size: 15px; }
.flag-emoji.lg { font-size: 21px; } .flag-emoji.sm { font-size: 12px; }
.mc-team .flag-emoji { font-size: 30px; }
.mt-side .flag-emoji { font-size: 34px; }

/* generic table */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: right; font-weight: 600; color: var(--faint); font-size: 11px;
  letter-spacing: .05em; text-transform: uppercase; padding: 9px 12px;
  border-bottom: 1px solid var(--line-strong); white-space: nowrap;
}
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr.best td { background: var(--home-bg); }
.tbl tr.best td:first-child { box-shadow: inset 3px 0 0 var(--home); }
.tbl tr.dim td { color: var(--faint); }
.tbl .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.tbl .bar-cell { width: 120px; }

.btn {
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  padding: 7px 13px; border-radius: var(--r); font-size: 13px; font-weight: 600;
  transition: .15s; display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.solid { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.solid:hover { opacity: .9; color: var(--paper); }

/* =========================================================================
   ANIMATION
   ========================================================================= */
@media (prefers-reduced-motion: no-preference) {
  .fade-up { animation: fadeUp .5s cubic-bezier(.2,.7,.3,1) both; }
  @keyframes fadeUp { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:none} }
  .grow { transition: width .9s cubic-bezier(.2,.8,.25,1), height .9s cubic-bezier(.2,.8,.25,1); }
}
