/* Design tokens, layout and shared components for the score-table guide. */
:root {
  --bg: #f5f2ec;
  --bg-alt: #ece7dd;
  --surface: #ffffff;
  --surface-2: #f8f6f1;
  --ink: #161a22;
  --ink-2: #3a4252;
  --muted: #687184;
  --line: #e0d9cc;
  --accent: #e8590c;
  --accent-ink: #ffffff;
  --accent-soft: #fde8d9;
  --navy: #14213d;
  --navy-2: #1f3158;
  --good: #1d8a4e;
  --good-soft: #dcf3e5;
  --bad: #c92a2a;
  --bad-soft: #fde2e2;
  --warn: #b7791f;
  --warn-soft: #fdf1d8;
  --team-a: #2b62e3;
  --team-b: #e03a3a;
  --radius: 18px;
  --radius-s: 12px;
  --shadow: 0 1px 2px rgba(20, 26, 34, .06), 0 8px 28px rgba(20, 26, 34, .07);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1117; --bg-alt: #131823; --surface: #171c26; --surface-2: #1d2330;
    --ink: #eef1f5; --ink-2: #c9d0dc; --muted: #9099aa; --line: #2a3242;
    --accent: #ff7a2e; --accent-soft: #3a2416; --navy: #0b1222; --navy-2: #16223d;
    --good: #4cc483; --good-soft: #15301f; --bad: #ff6b6b; --bad-soft: #3a1717;
    --warn: #f0b44c; --warn-soft: #33270f; --team-a: #5b8cff; --team-b: #ff6b6b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 28px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1117; --bg-alt: #131823; --surface: #171c26; --surface-2: #1d2330;
  --ink: #eef1f5; --ink-2: #c9d0dc; --muted: #9099aa; --line: #2a3242;
  --accent: #ff7a2e; --accent-soft: #3a2416; --navy: #0b1222; --navy-2: #16223d;
  --good: #4cc483; --good-soft: #15301f; --bad: #ff6b6b; --bad-soft: #3a1717;
  --warn: #f0b44c; --warn-soft: #33270f; --team-a: #5b8cff; --team-b: #ff6b6b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 28px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

/* Language switching: each mode shows one language only. */
[data-lang="zh"] .en, [data-lang="en"] .zh { display: none !important; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation: none !important; transition: none !important; } }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.65 var(--font); -webkit-font-smoothing: antialiased; }
img, svg { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 3px; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h2 { font-size: clamp(1.7rem, 3.2vw, 2.4rem); font-weight: 800; }
h3 { font-size: 1.2rem; font-weight: 750; }
p { margin: 0 0 1em; }
.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; gap: 12px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand svg { width: 30px; height: 30px; flex: none; }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; mask-image: linear-gradient(90deg, #000 92%, transparent); }
.nav::-webkit-scrollbar { display: none; }
.nav a { padding: 6px 11px; border-radius: 999px; color: var(--ink-2); text-decoration: none; font-size: .9rem; white-space: nowrap; }
.nav a:hover, .nav a.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.toggles { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.seg[hidden] { display: none; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--surface); }
.seg button { border: 0; background: none; color: var(--ink-2); font: 600 .85rem var(--font); padding: 5px 11px; border-radius: 999px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; display: grid; place-items: center; }
@media (max-width: 760px) { .nav { display: none; } .brand span { font-size: .95rem; } }

/* Hero */
.hero { background: radial-gradient(1200px 500px at 85% -10%, #2c4a8a 0%, transparent 60%), linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 100%); color: #f3f5fa; position: relative; overflow: hidden; }
.hero .court-lines { position: absolute; inset: 0; opacity: .14; pointer-events: none; }
.hero .wrap { position: relative; padding: 64px 0 56px; }
.eyebrow { display: inline-flex; gap: 8px; align-items: center; font: 700 .8rem var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.hero .eyebrow { color: #ffb185; }
.hero h1 { font-size: clamp(2.1rem, 5.5vw, 3.9rem); font-weight: 850; letter-spacing: -.025em; margin: 10px 0 14px; max-width: 16ch; }
.hero .lede { font-size: clamp(1.05rem, 2vw, 1.25rem); color: #cfd7e8; max-width: 60ch; }
.roles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 34px; }
.role { background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .14); border-radius: var(--radius); padding: 18px; text-decoration: none; color: inherit; transition: transform .2s, background .2s; }
.role:hover { transform: translateY(-3px); background: rgba(255, 255, 255, .11); }
.role .tag { display: inline-block; font: 700 .72rem var(--font); letter-spacing: .06em; padding: 3px 8px; border-radius: 999px; background: rgba(255, 255, 255, .14); margin-bottom: 10px; }
.role h3 { color: #fff; margin-bottom: 4px; }
.role p { color: #c4cde0; margin: 0; font-size: .95rem; }
.role .ico { width: 40px; height: 40px; margin-bottom: 8px; }
@media (max-width: 860px) { .roles { grid-template-columns: 1fr; } }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; }
.pill { display: inline-flex; gap: 8px; align-items: center; padding: 8px 14px; border-radius: 999px; background: rgba(255, 255, 255, .1); color: #e7ecf6; font-size: .92rem; }

/* Sections */
.section { padding: 72px 0; }
.section:nth-of-type(even) { background: var(--bg-alt); }
.section-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: end; margin-bottom: 30px; }
.section-head p { color: var(--ink-2); font-size: 1.05rem; margin: 0; }
@media (max-width: 860px) { .section-head { grid-template-columns: 1fr; gap: 10px; } }
.num { font: 800 .85rem var(--mono); color: var(--accent); }

.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 960px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.card h3 { display: flex; gap: 10px; align-items: center; }
.card p:last-child, .card ul:last-child { margin-bottom: 0; }
.card ul { padding-left: 1.2em; margin: 0 0 1em; }
.card li { margin: .3em 0; }
.kicker { font: 700 .75rem var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }

.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius-s); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.callout.good { background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 30%, transparent); }
.callout.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.callout.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.callout p { margin: 0; }
.callout .ci { flex: none; font-size: 1.2rem; line-height: 1.4; color: var(--accent); }
.callout.good .ci { color: var(--good); }
.callout.warn .ci { color: var(--warn); }
.callout.bad .ci { color: var(--bad); }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 1em; height: 1em; flex: none; vertical-align: -.15em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon.flip { transform: scaleX(-1); }
.pill .icon { color: #ffb185; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 650 .95rem var(--font); padding: 10px 16px; border-radius: 12px; cursor: pointer; min-height: 44px; }
.btn:hover { border-color: var(--ink-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 12px; min-height: 36px; font-size: .88rem; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font: 650 .8rem var(--font); background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.chip.a { color: var(--team-a); border-color: color-mix(in srgb, var(--team-a) 40%, transparent); }
.chip.b { color: var(--team-b); border-color: color-mix(in srgb, var(--team-b) 40%, transparent); }

table.data { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.data th, table.data td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
table.data tr.hl td { background: var(--accent-soft); }
.table-scroll { overflow-x: auto; border-radius: var(--radius-s); }

.label { display: block; font: 650 .85rem var(--font); color: var(--ink-2); margin-bottom: 6px; }
select, input[type="text"], input[type="number"] { font: 600 1rem var(--font); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px; width: 100%; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; opacity: 0; pointer-events: none; transition: .25s; z-index: 80; max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Rule citations (refs.js): each article number opens the official PDF at its page in a new tab. */
.ref-link { color: inherit; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; }
.ref-link:hover { color: var(--accent); text-decoration-style: solid; }
.ref-link::after { content: '\2197'; font-size: .8em; margin-left: 1px; font-variant-emoji: text; }

/* Back-to-top button (to-top.js). */
.to-top { position: fixed; right: 18px; bottom: 22px; z-index: 70; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--accent); font-size: 1.4rem; box-shadow: var(--shadow); cursor: pointer; opacity: 0; visibility: hidden; transform: translateY(10px); transition: opacity .2s, transform .2s, visibility .2s; }
.to-top.on { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { border-color: var(--accent); }
@media (max-width: 640px) { .to-top { right: 14px; bottom: 16px; width: 44px; height: 44px; } }

/* Video */
.video-card { background: #0d1016; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.video-card video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #0d1016; }
.video-meta { padding: 14px 18px; color: #d7dde8; display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; }
.video-meta strong { color: #fff; }
.video-meta details { width: 100%; }
.video-meta summary { cursor: pointer; color: #ffb185; font-weight: 650; }
.video-lite { margin: 0; padding: 16px 18px 0; color: #ffb185; font-weight: 650; }
.transcript { white-space: pre-line; font-size: .92rem; color: #c3cad8; margin-top: 10px; max-height: 260px; overflow: auto; padding-right: 8px; }

footer { padding: 40px 0 60px; color: var(--muted); font-size: .9rem; }
