:root {
  color-scheme: light;
  --red: #e60012;
  --red-deep: #a8000d;
  --green: #009b4d;
  --green-deep: #006d37;
  --gold: #ffd000;
  --ink: #151917;
  --ink-soft: #26302b;
  --paper: #f4f5ed;
  --surface: #fbfced;
  --surface-strong: #ffffff;
  --line: #ccd2c8;
  --muted: #56635c;
  --shadow: 0 18px 46px rgb(22 49 36 / 14%);
  --radius: 18px;
  --radius-sm: 10px;
  --header-height: 72px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --red: #ff3040;
  --red-deep: #d70a1a;
  --green: #18c772;
  --green-deep: #008f49;
  --gold: #ffda2f;
  --ink: #eef6f0;
  --ink-soft: #d7e2da;
  --paper: #0f1512;
  --surface: #17201b;
  --surface-strong: #1d2922;
  --line: #35483c;
  --muted: #aebdb3;
  --shadow: 0 20px 54px rgb(0 0 0 / 35%);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--paper); }
body { margin: 0; min-width: 320px; background: var(--paper); color: var(--ink); font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; line-height: 1.5; }
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: repeating-linear-gradient(118deg, transparent 0 56px, rgb(0 155 77 / 4%) 56px 57px, transparent 57px 112px); }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
img, svg { display: block; }
svg { width: 1.2em; height: 1.2em; }
.skip-link { position: fixed; left: 16px; top: -60px; z-index: 100; padding: 10px 16px; border-radius: var(--radius-sm); background: var(--gold); color: #171500; font-weight: 800; }
.skip-link:focus { top: 10px; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.page-width { width: min(1180px, calc(100% - 40px)); margin-inline: auto; }

.site-header { position: sticky; top: 0; z-index: 50; min-height: var(--header-height); display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 28px; padding: 0 max(20px, calc((100vw - 1180px) / 2)); border-bottom: 1px solid rgb(255 255 255 / 10%); background: color-mix(in srgb, #151917 94%, transparent); color: #f8fff9; box-shadow: 0 12px 30px rgb(0 0 0 / 18%); backdrop-filter: blur(14px); }
.brand { display: flex; align-items: center; gap: 10px; min-width: max-content; }
.brand img { width: 42px; height: 42px; }
.brand span { display: grid; line-height: 1.05; }
.brand strong { font-size: 18px; letter-spacing: .03em; }
.brand small { margin-top: 5px; color: #b6c4ba; font-size: 10px; white-space: nowrap; }
.primary-nav { display: flex; align-items: stretch; justify-content: center; height: var(--header-height); min-width: 0; }
.primary-nav a { position: relative; display: grid; place-items: center; padding: 0 14px; color: #cbd5ce; font-size: 14px; font-weight: 700; white-space: nowrap; }
.primary-nav a::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 0; height: 3px; background: transparent; }
.primary-nav a:hover, .primary-nav a.active { color: #ffffff; }
.primary-nav a.active::after { background: linear-gradient(90deg, var(--red) 0 48%, var(--gold) 48% 58%, var(--green) 58%); }
.header-actions { display: flex; gap: 8px; }
.icon-button { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid #3b4940; border-radius: var(--radius-sm); background: #202923; color: #ffffff; }
.icon-button:hover { border-color: var(--gold); color: var(--gold); }
.menu-button { display: none; }

.race-hero { position: relative; isolation: isolate; min-height: calc(100dvh - var(--header-height)); overflow: hidden; background: #141816; color: #ffffff; }
.hero-art, .hero-art img, .hero-shade { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-art img { object-fit: cover; object-position: center; }
.hero-shade { background: linear-gradient(90deg, rgb(11 15 13 / 90%) 0%, rgb(11 15 13 / 78%) 43%, rgb(11 15 13 / 24%) 72%, rgb(11 15 13 / 8%) 100%), linear-gradient(0deg, rgb(11 15 13 / 72%) 0%, transparent 54%); }
.hero-grid { position: relative; z-index: 2; width: min(1180px, calc(100% - 40px)); min-height: calc(100dvh - var(--header-height)); margin: auto; display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(300px, .82fr); gap: clamp(30px, 5vw, 80px); align-items: center; padding-block: 42px; }
.live-board { max-width: 700px; }
.live-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 26px; margin-bottom: 12px; }
.live-state { display: inline-flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid rgb(255 255 255 / 22%); border-radius: var(--radius-sm); background: rgb(20 28 24 / 72%); font-size: 12px; }
.live-state i { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgb(0 155 77 / 18%); }
.issue-line { color: #d9e4dc; font-size: 14px; }
.issue-line strong { color: var(--gold); font: 900 22px/1 ui-monospace, "SFMono-Regular", Menlo, monospace; }
.live-board h1 { max-width: 10ch; margin: 0; font-size: clamp(44px, 6vw, 82px); line-height: .98; letter-spacing: -.055em; }
.hero-timing { display: grid; grid-template-columns: auto 1fr; align-items: end; width: min(520px, 100%); margin-top: 24px; padding: 12px 16px; border-left: 5px solid var(--green); background: rgb(11 19 15 / 78%); }
.hero-timing > span { grid-column: 1; display: flex; align-items: center; gap: 7px; color: #bdd0c2; font-size: 12px; }
.hero-timing > strong { grid-row: 1 / 3; grid-column: 2; justify-self: end; color: var(--gold); font: 900 clamp(32px, 5vw, 58px)/1 ui-monospace, "SFMono-Regular", Menlo, monospace; letter-spacing: -.06em; }
.hero-timing > small { grid-column: 1; margin-top: 5px; color: #f4faf6; }
.hero-timing b { color: #ffffff; }
.draw-equation { display: flex; align-items: center; gap: clamp(7px, 1.3vw, 16px); font-weight: 900; }
.hero-equation { margin-top: 20px; }
.draw-equation b, .draw-equation em { display: grid; place-items: center; width: clamp(56px, 7vw, 82px); aspect-ratio: 1; border-radius: 50%; font-style: normal; font: 900 clamp(30px, 4.6vw, 54px)/1 ui-monospace, "SFMono-Regular", Menlo, monospace; }
.draw-equation b:nth-of-type(odd) { background: var(--red); box-shadow: inset 0 -7px 0 rgb(120 0 10 / 30%); }
.draw-equation b:nth-of-type(even) { background: var(--green); box-shadow: inset 0 -7px 0 rgb(0 70 34 / 30%); }
.draw-equation em { width: clamp(68px, 8.2vw, 96px); border: 4px solid var(--gold); background: #f5fbf7; color: #161c18; }
.draw-equation i { color: #ffffff; font-size: clamp(22px, 3vw, 36px); font-style: normal; }
.row-equation { display: inline-flex; align-items: baseline; gap: 5px; font-weight: 900; font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; }
.row-equation b { color: var(--ink); }
.row-equation i { color: var(--muted); font-style: normal; }
.row-equation em { color: var(--red); font-style: normal; }
.result-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.result-tag, .result-tags > span { min-width: 54px; padding: 7px 12px; border-radius: var(--radius-sm); background: #ffffff; color: #151917; font-size: 13px; font-weight: 900; text-align: center; }
.result-tag.red, .result-tags > span.red { background: var(--red); color: #ffffff; }
.result-tag.green, .result-tags > span.green { background: var(--green); color: #ffffff; }
.result-tag.gold, .result-tags > span.gold { background: var(--gold); color: #191600; }
.result-tag.dark, .result-tags > span.dark { background: #222b26; color: #f7fff9; border: 1px solid #536159; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.primary-button, .secondary-button { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 18px; border: 0; border-radius: var(--radius-sm); font-weight: 900; white-space: nowrap; transition: transform .18s ease, background .18s ease; }
.primary-button { background: var(--gold); color: #181500; }
.secondary-button { border: 1px solid rgb(255 255 255 / 28%); background: rgb(18 25 21 / 74%); color: #ffffff; }
.primary-button:hover, .secondary-button:hover { transform: translateY(-2px); }
.primary-button:active, .secondary-button:active { transform: translateY(1px); }
.streak-console { align-self: end; margin-bottom: 32px; border: 1px solid rgb(255 255 255 / 20%); border-radius: var(--radius); background: rgb(15 22 18 / 88%); box-shadow: var(--shadow); overflow: hidden; }
.streak-console header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; border-bottom: 1px solid rgb(255 255 255 / 14%); color: #cedbd2; font-size: 12px; }
.streak-console header a { display: flex; align-items: center; gap: 4px; color: var(--gold); font-weight: 800; }
.streak-lanes { display: grid; }
.streak-lanes > span, .streak-lanes > p { display: grid; grid-template-columns: 84px 1fr; gap: 12px; padding: 15px 16px; margin: 0; border-bottom: 1px solid rgb(255 255 255 / 10%); }
.streak-lanes > span:last-child { border-bottom: 0; }
.streak-lanes small { color: #99aaa0; }
.streak-lanes b { font: 900 20px/1.2 ui-monospace, "SFMono-Regular", Menlo, monospace; }

.module-deck { display: grid; grid-template-columns: 1.25fr .75fr; gap: 18px; margin-top: 42px; }
.module-panel { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.dragon-panel { grid-row: span 2; background: var(--ink-soft); color: #ffffff; }
.missing-panel { background: var(--green); color: #ffffff; }
.today-panel { background: var(--red); color: #ffffff; }
.panel-heading { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 18px 20px; }
.panel-heading > svg { width: 32px; height: 32px; color: var(--gold); }
.panel-heading h2 { margin: 0; font-size: 22px; }
.panel-heading p { margin: 3px 0 0; color: rgb(255 255 255 / 72%); font-size: 12px; }
.panel-heading a { display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 8px 10px; border: 1px solid rgb(255 255 255 / 32%); border-radius: var(--radius-sm); font-size: 12px; font-weight: 800; white-space: nowrap; }
.mini-streaks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: rgb(255 255 255 / 12%); border-top: 1px solid rgb(255 255 255 / 12%); }
.mini-streaks article, .mini-streaks > p { min-height: 108px; margin: 0; padding: 18px; background: color-mix(in srgb, var(--ink-soft) 92%, #ffffff); }
.mini-streaks article { display: grid; align-content: center; gap: 4px; border-left: 4px solid var(--green); }
.mini-streaks article.triggered { border-left-color: var(--red); }
.mini-streaks article svg { display: none; }
.mini-streaks article span, .mini-streaks article small { color: #b9c8be; font-size: 12px; }
.mini-streaks article b { font: 900 20px/1.2 ui-monospace, "SFMono-Regular", Menlo, monospace; }
.mini-missing { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; padding: 0 18px 18px; }
.mini-missing article { min-height: 64px; display: grid; place-content: center; border-radius: var(--radius-sm); background: rgb(0 82 41 / 40%); text-align: center; }
.mini-missing b { font: 900 18px/1 ui-monospace, "SFMono-Regular", Menlo, monospace; }
.mini-missing span { margin-top: 5px; font-size: 10px; }
.today-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: rgb(255 255 255 / 18%); border-top: 1px solid rgb(255 255 255 / 16%); }
.today-strip > span { display: grid; place-content: center; min-height: 74px; background: rgb(143 0 11 / 24%); text-align: center; }
.today-strip small { font-size: 10px; color: rgb(255 255 255 / 72%); }
.today-strip b { margin-top: 4px; font: 900 17px/1 ui-monospace, "SFMono-Regular", Menlo, monospace; }

.history-zone { margin-top: 52px; scroll-margin-top: calc(var(--header-height) + 20px); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.section-heading h2 { margin: 0; font-size: clamp(28px, 4vw, 42px); letter-spacing: -.035em; }
.section-heading p { margin: 7px 0 0; color: var(--muted); }
.section-heading > a { display: inline-flex; align-items: center; gap: 6px; color: var(--red); font-weight: 900; white-space: nowrap; }
.history-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.data-surface, .trend-panel, .content-surface, .settings-surface { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-strong); box-shadow: var(--shadow); overflow: hidden; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { position: sticky; top: var(--header-height); z-index: 2; padding: 12px 14px; background: var(--ink-soft); color: #ffffff; font-size: 12px; text-align: left; white-space: nowrap; }
td { height: 45px; padding: 9px 14px; border-bottom: 1px solid var(--line); color: var(--ink); font-size: 13px; white-space: nowrap; }
tbody tr:nth-child(even) { background: color-mix(in srgb, var(--green) 7%, var(--surface-strong)); }
tbody tr:hover { background: color-mix(in srgb, var(--gold) 20%, var(--surface-strong)); }
td:first-child { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-weight: 800; }
.table-tags { display: flex; gap: 4px; }
.table-tags span { min-width: 30px; padding: 3px 6px; border-radius: 6px; color: #ffffff; font-size: 10px; font-weight: 900; text-align: center; }
.table-tags .red { background: var(--red); }
.table-tags .green { background: var(--green); }
.pager { min-height: 58px; display: flex; align-items: center; justify-content: center; gap: 14px; padding: 10px; background: var(--surface); }
.pager button { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-strong); color: var(--ink); font-weight: 800; }
.pager button:not(:disabled):hover { border-color: var(--red); color: var(--red); }
.pager button:disabled { opacity: .42; cursor: not-allowed; }
.pager span { min-width: 80px; text-align: center; font-size: 13px; font-weight: 800; }
.trend-panel { position: sticky; top: calc(var(--header-height) + 18px); padding: 18px; background: var(--ink-soft); color: #ffffff; }
.trend-panel > div:first-child { display: flex; justify-content: space-between; gap: 12px; }
.trend-panel h3 { margin: 0; }
.trend-panel span { color: #b8c8bd; font-size: 11px; }
.trend-panel > svg { width: 100%; height: auto; margin-top: 18px; overflow: visible; }
.trend-grid { fill: none; stroke: rgb(255 255 255 / 14%); stroke-width: 1; }
[data-trend-line] { fill: none; stroke: var(--gold); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
[data-trend-dots] circle { stroke: #ffffff; stroke-width: 2; }
.trend-legend { display: flex; gap: 18px; margin-top: 10px; }
.trend-legend span { display: inline-flex; align-items: center; gap: 6px; }
.trend-legend i { width: 10px; height: 10px; border-radius: 50%; }
.legend-red { background: var(--red); }.legend-green { background: var(--green); }
.play-lane { margin-top: 26px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 24px; border-radius: var(--radius); background: linear-gradient(110deg, var(--green-deep), var(--green)); color: #ffffff; box-shadow: var(--shadow); }
.play-lane > div { display: grid; grid-template-columns: auto 1fr; column-gap: 14px; }
.play-lane svg { grid-row: span 2; align-self: center; width: 42px; height: 42px; color: var(--gold); }
.play-lane h2 { margin: 0; font-size: 22px; }.play-lane p { margin: 4px 0 0; color: rgb(255 255 255 / 76%); }

.floating-tools { position: fixed; z-index: 45; right: 20px; bottom: 22px; display: grid; gap: 10px; }
.floating-tools a { display: flex; align-items: center; justify-content: flex-start; gap: 9px; min-width: 116px; min-height: 46px; padding: 0 14px; border: 2px solid #ffffff; border-radius: var(--radius-sm); background: var(--green); color: #ffffff; box-shadow: 0 12px 28px rgb(0 0 0 / 24%); font-size: 13px; font-weight: 900; }
.floating-tools .chat-fab { background: var(--red); }
.floating-tools a:hover { transform: translateX(-3px); }
body[data-page="scratch"], body[data-page="games"] { --safe-tool-rail: 156px; }
body[data-page="scratch"] .scratch-page { padding-right: var(--safe-tool-rail); }
body[data-page="games"] .game-shell { width: min(900px, calc(100% - var(--safe-tool-rail) - 40px)); margin-right: calc(var(--safe-tool-rail) + 20px); }
body[data-page="scratch"] .site-footer, body[data-page="games"] .site-footer { width: min(1180px, calc(100% - var(--safe-tool-rail) - 40px)); margin-right: calc(var(--safe-tool-rail) + 20px); }
.site-footer { width: min(1180px, calc(100% - 40px)); margin: 50px auto 0; padding: 28px 0 34px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-top: 4px solid; border-image: linear-gradient(90deg, var(--red), var(--gold), var(--green)) 1; }
.footer-brand { display: flex; align-items: center; gap: 10px; }.footer-brand span { display: grid; }.footer-brand small { color: var(--muted); }
.site-footer nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px 18px; font-size: 13px; font-weight: 800; }.site-footer nav a { display: inline-flex; align-items: center; gap: 5px; }.site-footer nav a:hover { color: var(--red); }

.page-hero { position: relative; overflow: hidden; background: var(--ink-soft); color: #ffffff; }
.page-hero::before, .page-hero::after { content: ""; position: absolute; pointer-events: none; transform: skewX(-24deg); }
.page-hero::before { width: 46%; height: 100%; right: -8%; top: 0; background: var(--red); }
.page-hero::after { width: 9%; height: 100%; right: 28%; top: 0; background: var(--green); }
.page-hero.green::before { background: var(--green); }.page-hero.green::after { background: var(--gold); }
.page-hero.gold::before { background: var(--gold); }.page-hero.gold::after { background: var(--red); }
.page-hero-inner { position: relative; z-index: 1; width: min(1180px, calc(100% - 40px)); min-height: 260px; margin: auto; display: grid; align-content: center; padding: 42px 0; }
.page-hero h1 { max-width: 14ch; margin: 6px 0 10px; font-size: clamp(38px, 6vw, 66px); line-height: 1; letter-spacing: -.045em; }
.page-hero p { max-width: 55ch; margin: 0; color: #cdd9d1; }
.page-kicker { color: var(--gold); font-size: 12px; font-weight: 900; letter-spacing: .08em; }
.content-stack { width: min(1180px, calc(100% - 40px)); margin: 32px auto 0; display: grid; gap: 20px; }
.status-line { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 0 14px; border-left: 5px solid var(--green); background: color-mix(in srgb, var(--green) 10%, var(--surface)); color: var(--ink); font-size: 13px; font-weight: 800; }
.status-line[data-state="error"] { border-left-color: var(--red); }
.surface-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.surface-heading h2 { margin: 0; font-size: 22px; }.surface-heading p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.surface-heading button { min-height: 38px; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-strong); color: var(--ink); font-weight: 800; }

.dragon-settings { padding: 20px; }
.setting-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.setting-grid label, .setting-grid fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.setting-grid legend, .setting-grid > label > span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 12px; font-weight: 800; }
.setting-grid select { width: 100%; min-height: 44px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); }
.choice-row { display: flex; flex-wrap: wrap; gap: 7px; }
.choice-row label { min-height: 40px; display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.choice-row input { accent-color: var(--red); }
.dimension-row { grid-column: 1 / -1; }
.dragon-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.action-button { min-height: 42px; display: inline-flex; align-items: center; gap: 7px; padding: 0 14px; border: 0; border-radius: var(--radius-sm); background: var(--red); color: #ffffff; font-weight: 900; }
.action-button.green { background: var(--green); }
.alerts { padding: 0 20px 20px; }.alerts p { margin: 0; color: var(--muted); }
.alerts article { display: grid; grid-template-columns: 140px 1fr auto; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.streak-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.streak-grid article { min-height: 124px; display: grid; align-content: center; gap: 5px; padding: 18px; border: 1px solid var(--line); border-left: 6px solid var(--green); border-radius: var(--radius); background: var(--surface-strong); }
.streak-grid article.triggered { border-left-color: var(--red); }
.streak-grid article span, .streak-grid article small { color: var(--muted); font-size: 12px; }.streak-grid article b { font: 900 20px/1.2 ui-monospace, "SFMono-Regular", Menlo, monospace; }
.detail-list { margin: 0; padding: 0 20px 20px; list-style: none; }
.detail-list li { display: grid; grid-template-columns: 120px 150px 1fr; gap: 18px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.detail-list b, .detail-list span { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; }.detail-list em { justify-self: end; color: var(--red); font-style: normal; }

.missing-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px; }
.missing-toolbar span { color: var(--muted); font-size: 12px; }.missing-toolbar strong { display: block; margin-top: 3px; }
.exact-missing-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.missing-card { position: relative; min-height: 112px; display: grid; align-content: center; text-align: center; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-strong); }
.missing-card > span { color: var(--muted); font: 800 13px/1 ui-monospace, "SFMono-Regular", Menlo, monospace; }.missing-card > b { margin-top: 8px; color: var(--red); font: 900 34px/1 ui-monospace, "SFMono-Regular", Menlo, monospace; }.missing-card small { color: var(--muted); font-size: 10px; }
.missing-card i { position: absolute; left: 0; bottom: 0; width: var(--missing-pressure); height: 5px; background: var(--green); }
.missing-card.high i { background: var(--red); }.missing-card.medium i { background: var(--gold); }

.today-metrics { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.today-metrics article { min-height: 130px; display: grid; align-content: center; padding: 18px; border-radius: var(--radius); background: var(--ink-soft); color: #ffffff; }
.today-metrics article:nth-child(2) { background: var(--red); }.today-metrics article:nth-child(3) { background: var(--green); }.today-metrics article:nth-child(4) { background: var(--red-deep); }.today-metrics article:nth-child(5) { background: var(--green-deep); }
.today-metrics span { color: rgb(255 255 255 / 72%); font-size: 12px; }.today-metrics strong { margin-top: 8px; color: var(--gold); font: 900 28px/1.1 ui-monospace, "SFMono-Regular", Menlo, monospace; }

.scratch-page { min-height: calc(100dvh - var(--header-height)); padding: 36px 0 80px; background: var(--surface) image-set(url('/assets/fenglu-scratch-track-v1-1672.avif') type('image/avif'), url('/assets/fenglu-scratch-track-v1-1672.webp') type('image/webp'), url('/assets/fenglu-scratch-track-v1.png') type('image/png')) center / cover fixed; }
.scratch-layout { width: min(720px, calc(100% - 40px)); margin: auto; display: grid; grid-template-columns: minmax(0, 1fr); }
.scratch-ticket { border: 1px solid var(--line); border-radius: var(--radius); background: color-mix(in srgb, var(--surface-strong) 94%, transparent); box-shadow: var(--shadow); overflow: hidden; backdrop-filter: blur(10px); }
.scratch-ticket > header { display: flex; align-items: center; gap: 12px; padding: 16px 18px; background: var(--ink-soft); color: #ffffff; }.scratch-ticket > header div { display: grid; }.scratch-ticket > header h1 { margin: 0; color: inherit; font-size: 16px; line-height: 1.25; }.scratch-ticket > header span { color: #b7c7bd; font-size: 12px; }
.scratch-board { position: relative; min-height: 360px; display: grid; place-items: center; background: rgb(244 247 239 / 78%); color: #151917; overflow: hidden; }
.scratch-result { text-align: center; }.scratch-result p { margin: 0 0 18px; font-weight: 900; }.scratch-result .draw-equation b { width: 66px; color: #ffffff; }.scratch-result .draw-equation em { width: 76px; }
.scratch-labels { display: flex; justify-content: center; gap: 8px; margin-top: 18px; }.scratch-labels span { min-width: 58px; padding: 7px 10px; border-radius: var(--radius-sm); background: var(--ink-soft); color: #ffffff; font-weight: 900; }
.scratch-lock { display: none; text-align: center; }.scratch-lock svg { width: 38px; height: 38px; margin: 0 auto 10px; color: var(--red); }.scratch-lock strong, .scratch-lock span { display: block; }
[data-scratch-root][data-state="locked"] .scratch-result { display: none; }[data-scratch-root][data-state="locked"] .scratch-lock { display: block; }
.scratch-board canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.scratch-ticket > footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; background: var(--ink-soft); color: #ffffff; }.scratch-ticket > footer p { margin: 0; font-size: 13px; }
.scratch-actions { display: flex; gap: 8px; }.scratch-actions button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 12px; border: 0; border-radius: var(--radius-sm); background: var(--green); color: #ffffff; font-weight: 900; }.scratch-actions button:last-child { background: var(--red); }.scratch-actions button:disabled { opacity: .48; }

.chat-shell { width: min(1000px, calc(100% - 40px)); margin: 32px auto 0; display: grid; grid-template-columns: 280px 1fr; gap: 18px; }
.chat-side, .chat-room { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-strong); box-shadow: var(--shadow); overflow: hidden; }
.chat-side { padding: 20px; align-self: start; }.chat-side label { display: block; font-weight: 900; }.chat-side input { width: 100%; min-height: 44px; margin-top: 7px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); }.chat-side small { display: block; margin-top: 6px; color: var(--muted); }.chat-rules { margin-top: 24px; }.chat-rules h2 { font-size: 16px; }.chat-rules ul { padding-left: 20px; color: var(--muted); font-size: 13px; }
.chat-room { display: grid; grid-template-rows: auto minmax(340px, 58vh) auto auto; }.chat-announcement { padding: 12px 16px; background: var(--green); color: #ffffff; font-size: 13px; font-weight: 800; }.messages { overflow-y: auto; padding: 14px 18px; }.messages article { display: grid; grid-template-columns: 38px 1fr; gap: 10px; padding: 10px 0; }.chat-avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--chat-avatar-background, var(--red)); color: var(--chat-avatar-color, #ffffff); font-weight: 900; }.messages header { display: flex; justify-content: space-between; align-items: start; gap: 10px; }.messages b[data-admin="true"]::after { content: "管理员"; margin-left: 6px; padding: 1px 5px; border-radius: 999px; background: #f6c453; color: #4b3300; font-size: 10px; }.chat-message-actions { display: inline-flex; align-items: center; gap: 8px; }.messages time { color: var(--muted); font-size: 11px; }.chat-delete { border: 1px solid color-mix(in srgb, var(--red) 45%, var(--line)); border-radius: 999px; padding: 2px 7px; background: transparent; color: var(--red); font-size: 11px; font-weight: 800; cursor: pointer; }.chat-delete:disabled { opacity: .5; cursor: wait; }.messages p { margin: 3px 0 0; overflow-wrap: anywhere; }.chat-empty { color: var(--muted); text-align: center; }.chat-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); }.chat-form label { grid-column: 1 / -1; font-size: 12px; font-weight: 800; }.chat-form textarea { min-height: 74px; resize: vertical; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); }.chat-form button, [data-chat-retry] { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }.chat-form button { min-width: 94px; border: 0; border-radius: var(--radius-sm); background: var(--red); color: #ffffff; font-weight: 900; }.form-help, .form-error { margin: 0; padding: 0 16px 12px; color: var(--muted); font-size: 11px; }.form-error { color: var(--red); font-weight: 800; }

.game-shell { width: min(900px, calc(100% - 40px)); margin: 32px auto 0; }.game-intro { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 24px; padding: 24px; border-radius: var(--radius); background: var(--green); color: #ffffff; }.game-intro h1 { margin: 0; font-size: clamp(34px, 6vw, 56px); }.game-intro p { margin: 6px 0 0; color: rgb(255 255 255 / 78%); }.game-intro svg { width: 84px; height: 84px; color: var(--gold); }
.game-stage { position: relative; min-height: 520px; display: grid; place-items: center; margin-top: 18px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--ink-soft); color: #ffffff; box-shadow: var(--shadow); overflow: hidden; }.game-stage::before { content: ""; position: absolute; inset: -20%; background: repeating-conic-gradient(from 18deg, transparent 0 12deg, rgb(230 0 18 / 18%) 12deg 18deg, transparent 18deg 32deg, rgb(0 155 77 / 16%) 32deg 38deg); opacity: .35; }.game-start { position: relative; z-index: 1; max-width: 460px; text-align: center; }.game-start h2 { font-size: 30px; }.game-start p { color: #c7d3cb; }.game-start button { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 22px; border: 0; border-radius: var(--radius-sm); background: var(--gold); color: #151300; font-weight: 900; }.reaction-game { position: relative; z-index: 1; width: min(560px, 100%); }.reaction-score { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 12px; font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; }.reaction-track { position: relative; height: 340px; overflow: hidden; border: 2px solid #5a685f; border-radius: var(--radius); background: repeating-linear-gradient(90deg, #19241e 0 58px, #233028 58px 60px); touch-action: manipulation; }.reaction-target { position: absolute; width: 68px; height: 68px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--red); color: #ffffff; box-shadow: 0 0 0 8px rgb(255 255 255 / 16%); }.reaction-controls { display: flex; justify-content: space-between; gap: 12px; margin-top: 14px; }.reaction-controls button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 14px; border: 0; border-radius: var(--radius-sm); background: var(--green); color: #ffffff; font-weight: 900; }

.about-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }.about-grid article { padding: 24px; border-radius: var(--radius); background: var(--surface-strong); box-shadow: var(--shadow); }.about-grid h2 { margin-top: 0; }.about-grid p, .about-grid li { color: var(--muted); }

@media (max-width: 1050px) {
  .site-header { gap: 16px; padding-inline: 20px; }
  .primary-nav a { padding-inline: 9px; font-size: 12px; }
  .history-layout { grid-template-columns: 1fr; }.trend-panel { position: static; }
  .exact-missing-grid { grid-template-columns: repeat(5, 1fr); }
}

@media (max-width: 900px) {
  :root { --header-height: 64px; }
  body[data-page="scratch"], body[data-page="games"] { --safe-tool-rail: 156px; }
  .site-header { grid-template-columns: 1fr auto; min-height: var(--header-height); }
  .brand img { width: 36px; height: 36px; }.brand small { display: none; }
  .menu-button { display: grid; }
  .primary-nav { position: absolute; top: 64px; left: 0; right: 0; height: auto; display: none; grid-template-columns: repeat(2, 1fr); padding: 10px 20px 18px; background: #151917; box-shadow: 0 16px 30px rgb(0 0 0 / 30%); }
  .primary-nav[data-open="true"] { display: grid; }
  .primary-nav a { min-height: 46px; justify-content: start; padding: 0 12px; border-bottom: 1px solid #344039; }.primary-nav a::after { display: none; }.primary-nav a.active { background: var(--red); border-radius: var(--radius-sm); }
  .hero-grid { grid-template-columns: 1fr; min-height: auto; padding-block: 38px; }.live-board h1 { max-width: 12ch; }.streak-console { align-self: auto; margin: 0; }
  .module-deck { grid-template-columns: 1fr; }.dragon-panel { grid-row: auto; }
  .setting-grid { grid-template-columns: 1fr 1fr; }.dimension-row { grid-column: 1 / -1; }
  .streak-grid { grid-template-columns: repeat(2, 1fr); }
  .today-metrics { grid-template-columns: repeat(3, 1fr); }.today-metrics article:nth-child(4), .today-metrics article:nth-child(5) { grid-column: span 1; }
  .scratch-layout { grid-template-columns: 1fr; }
  .chat-shell { grid-template-columns: 1fr; }.chat-side { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }.chat-rules { margin: 0; }
}

@media (max-width: 680px) {
  body[data-page="scratch"], body[data-page="games"] { --safe-tool-rail: 64px; }
  .page-width, .page-hero-inner, .content-stack, .site-footer, .scratch-layout, .chat-shell, .game-shell { width: min(100% - 24px, 1180px); }
  .site-header { padding-inline: 12px; }.brand strong { font-size: 16px; }.icon-button { width: 40px; height: 40px; }
  .race-hero { min-height: calc(100dvh - var(--header-height)); }.hero-art img { object-position: 62% center; }.hero-shade { background: linear-gradient(0deg, rgb(10 15 12 / 94%) 0%, rgb(10 15 12 / 75%) 68%, rgb(10 15 12 / 35%) 100%); }
  .hero-grid { width: calc(100% - 24px); min-height: calc(100dvh - var(--header-height)); gap: 18px; align-content: center; padding-block: 26px; }.live-meta { margin: 0 0 8px; }.live-board h1 { font-size: 42px; }.hero-timing { margin-top: 14px; }.hero-timing > strong { font-size: 38px; }.hero-equation { margin-top: 14px; gap: 7px; }.draw-equation b { width: 52px; }.draw-equation em { width: 62px; }.draw-equation i { font-size: 20px; }.result-tags { margin-top: 12px; gap: 5px; }.result-tags > span { min-width: 44px; padding: 6px 8px; font-size: 11px; }.hero-actions { margin-top: 15px; }.streak-console { display: none; }
  .module-deck { margin-top: 24px; gap: 12px; }.panel-heading { grid-template-columns: auto 1fr; }.panel-heading a { grid-column: 2; justify-self: start; }.mini-streaks { grid-template-columns: 1fr; }.mini-streaks article { min-height: 88px; }.mini-missing { grid-template-columns: repeat(4, 1fr); padding-inline: 12px; }.today-strip { grid-template-columns: repeat(2, 1fr); }
  .history-zone { margin-top: 34px; }.section-heading { align-items: start; flex-direction: column; gap: 9px; }.section-heading h2 { font-size: 32px; }.table-scroll table { min-width: 680px; }th { top: 64px; }.pager { position: sticky; bottom: 0; }
  .play-lane { align-items: stretch; flex-direction: column; padding: 20px; }.play-lane > div { grid-template-columns: auto 1fr; }.play-lane .primary-button { align-self: stretch; }
  .floating-tools { right: 12px; bottom: 12px; gap: 8px; }.floating-tools a { min-width: 48px; width: 48px; height: 48px; padding: 0; justify-content: center; border-width: 1px; }.floating-tools span { display: none; }
  body[data-page="games"] .game-shell, body[data-page="scratch"] .site-footer, body[data-page="games"] .site-footer { width: calc(100% - var(--safe-tool-rail) - 24px); margin-right: calc(var(--safe-tool-rail) + 12px); }
  .site-footer { align-items: flex-start; flex-direction: column; padding-bottom: 96px; }.site-footer nav { justify-content: flex-start; }
  .page-hero-inner { min-height: 220px; }.page-hero h1 { font-size: 40px; }.page-hero::before { width: 56%; right: -24%; }.page-hero::after { right: 24%; }
  .surface-heading { align-items: flex-start; }.setting-grid { grid-template-columns: 1fr; }.dimension-row { grid-column: auto; }.choice-row { gap: 6px; }.streak-grid { grid-template-columns: 1fr; }.alerts article { grid-template-columns: 1fr; gap: 3px; }.detail-list li { grid-template-columns: 1fr auto; }.detail-list em { grid-column: 1 / -1; justify-self: start; }
  .exact-missing-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }.missing-card { min-height: 98px; }.missing-card > b { font-size: 28px; }
  .today-metrics { grid-template-columns: repeat(2, 1fr); }.today-metrics article:first-child { grid-column: 1 / -1; }
  .scratch-page { background-image: image-set(url('/assets/fenglu-scratch-track-v1-840.avif') type('image/avif'), url('/assets/fenglu-scratch-track-v1-840.webp') type('image/webp'), url('/assets/fenglu-scratch-track-v1.png') type('image/png')); background-attachment: scroll; }.scratch-board { min-height: 300px; }.scratch-result .draw-equation b { width: 48px; }.scratch-result .draw-equation em { width: 58px; }.scratch-ticket > footer { align-items: stretch; flex-direction: column; }.scratch-actions button { min-width: 0; flex: 1; padding-inline: 8px; font-size: 13px; white-space: nowrap; }
  .chat-side { grid-template-columns: 1fr; }.chat-rules { display: none; }.chat-room { grid-template-rows: auto minmax(360px, 54vh) auto auto; }.chat-form { grid-template-columns: 1fr; }.chat-form button { min-height: 44px; }
  .game-intro { grid-template-columns: 1fr; }.game-intro svg { display: none; }.game-stage { min-height: 500px; padding: 14px; }.reaction-track { height: 320px; }
  .about-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

/* Phase B benchmark-derived homepage shell: geometry only, original S02 identity and data contracts remain. */
:root {
  --paper: #f7f7f5;
  --surface: #f9f9f9;
  --surface-strong: #ffffff;
  --ink: #353535;
  --ink-soft: #303632;
  --line: #dddddd;
  --muted: #6b706d;
  --gold: #9a7900;
  --shadow: 0 7px 22px rgb(22 31 26 / 8%);
  --radius: 6px;
  --radius-sm: 4px;
  --header-height: 60px;
}

:root[data-theme="dark"] {
  --red: #ff6672;
  --red-deep: #e34855;
  --green: #43c982;
  --green-deep: #2baa6a;
  --gold: #d2aa3d;
  --ink: #e8eee9;
  --ink-soft: #202823;
  --paper: #111513;
  --surface: #202823;
  --surface-strong: #171c19;
  --line: #344039;
  --muted: #aab5ae;
  --shadow: 0 9px 26px rgb(0 0 0 / 24%);
}

body::before { background: none; }
:focus-visible { outline-color: #1261a0; }
:root[data-theme="dark"] :focus-visible { outline-color: #7fb8e8; }

.site-header {
  min-height: var(--header-height);
  gap: 18px;
  padding-inline: max(15px, calc((100vw - 800px) / 2));
  border-bottom-color: var(--line);
  background: color-mix(in srgb, var(--surface-strong) 96%, transparent);
  color: var(--ink);
  box-shadow: 0 2px 12px rgb(22 31 26 / 8%);
  backdrop-filter: blur(12px);
}
.brand img { width: 38px; height: 38px; }
.brand small { color: var(--muted); }
.primary-nav { height: var(--header-height); }
.primary-nav a { padding-inline: 10px; color: var(--muted); font-size: 13px; }
.primary-nav a:hover, .primary-nav a.active { color: var(--ink); background: var(--surface); }
.primary-nav a.active::after { left: 10px; right: 10px; height: 2px; background: var(--red); }
.icon-button { width: 40px; height: 40px; border-color: var(--line); background: var(--surface); color: var(--ink); }
.icon-button:hover { border-color: var(--green); color: var(--green-deep); }

body[data-page="home"] .page-width { width: min(800px, calc(100% - 30px)); }
.route-board { margin-top: 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-strong); overflow: hidden; }
.route-band { display: grid; min-height: 44px; }
.route-band + .route-band { border-top: 1px solid var(--line); }
.route-band-primary { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.route-band-tools { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.route-band a { min-width: 0; min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 8px; border-right: 1px solid var(--line); color: var(--ink); font-size: 13px; font-weight: 700; text-align: center; transition: background .18s cubic-bezier(.2,.8,.2,1), color .18s cubic-bezier(.2,.8,.2,1); }
.route-band a svg { width: 16px; height: 16px; flex: 0 0 auto; }
.route-band a:last-child { border-right: 0; }
.route-band a:hover, .route-band a:focus-visible { background: var(--surface); color: var(--green-deep); }
.route-band a.active { box-shadow: inset 0 -3px var(--red); color: var(--ink); }

body[data-page="home"] .race-hero {
  width: min(800px, calc(100% - 30px));
  height: 170px;
  min-height: 170px;
  margin: 8px auto 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--ink);
  box-shadow: var(--shadow);
}
body[data-page="home"] .hero-art { opacity: 0; pointer-events: none; }
body[data-page="home"] .hero-shade { display: none; }
body[data-page="home"] .hero-grid {
  width: 100%;
  min-height: 0;
  height: 100%;
  display: block;
  padding: 14px 16px;
}
body[data-page="home"] .live-board {
  max-width: none;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 16px;
  align-items: center;
}
.draw-main { min-width: 0; }
body[data-page="home"] .live-meta { gap: 8px 18px; margin: 0 0 5px; }
body[data-page="home"] .live-state { padding: 3px 7px; border-color: var(--line); background: var(--surface); color: var(--muted); font-size: 11px; }
body[data-page="home"] .live-state i { width: 7px; height: 7px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 18%, transparent); }
body[data-page="home"] .issue-line { color: var(--muted); font-size: 12px; }
body[data-page="home"] .issue-line strong { color: var(--ink); font-size: 17px; }
body[data-page="home"] .live-board h1 { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.3; letter-spacing: 0; }
body[data-page="home"] .hero-equation { margin-top: 6px; gap: 6px; }
body[data-page="home"] .draw-equation b,
body[data-page="home"] .draw-equation em { width: 34px; height: 34px; aspect-ratio: auto; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); box-shadow: none; color: var(--ink); font-size: 20px; }
body[data-page="home"] .draw-equation b:nth-of-type(odd) { border-color: color-mix(in srgb, var(--red) 55%, var(--line)); }
body[data-page="home"] .draw-equation b:nth-of-type(even) { border-color: color-mix(in srgb, var(--green) 62%, var(--line)); }
body[data-page="home"] .draw-equation em { width: 42px; border: 2px solid var(--red); color: var(--red-deep); }
body[data-page="home"] .draw-equation i { color: var(--muted); font-size: 16px; }
body[data-page="home"] .result-tags { gap: 5px; margin-top: 7px; }
body[data-page="home"] .result-tag,
body[data-page="home"] .result-tags > span { min-width: 38px; padding: 3px 7px; border: 1px solid var(--line); border-radius: 3px; background: var(--surface); color: var(--ink); font-size: 11px; }
body[data-page="home"] .result-tag.red,
body[data-page="home"] .result-tags > span.red { border-color: color-mix(in srgb, var(--red) 60%, var(--line)); background: color-mix(in srgb, var(--red) 9%, var(--surface)); color: var(--red-deep); }
body[data-page="home"] .result-tag.green,
body[data-page="home"] .result-tags > span.green { border-color: color-mix(in srgb, var(--green) 62%, var(--line)); background: color-mix(in srgb, var(--green) 9%, var(--surface)); color: var(--green-deep); }
body[data-page="home"] .result-tag.gold,
body[data-page="home"] .result-tags > span.gold { background: color-mix(in srgb, var(--gold) 10%, var(--surface)); color: var(--ink); }
body[data-page="home"] .result-tag.dark,
body[data-page="home"] .result-tags > span.dark { background: var(--surface); color: var(--ink); border-color: var(--line); }
.draw-tools { display: grid; gap: 9px; }
body[data-page="home"] .hero-timing { width: 100%; margin: 0; padding: 7px 9px; border: 1px solid var(--line); border-left: 3px solid var(--green); background: var(--surface); }
body[data-page="home"] .hero-timing > span { color: var(--muted); font-size: 11px; }
body[data-page="home"] .hero-timing > strong { color: var(--ink); font-size: 27px; letter-spacing: -.04em; }
body[data-page="home"] .hero-timing > small { color: var(--muted); font-size: 10px; }
body[data-page="home"] .hero-timing b { color: var(--ink); }
body[data-page="home"] .hero-actions { display: grid; grid-template-columns: 1fr 72px; gap: 7px; margin: 0; }
body[data-page="home"] .primary-button,
body[data-page="home"] .secondary-button { min-height: 40px; padding-inline: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font-size: 12px; }
body[data-page="home"] .primary-button { border-color: var(--green); color: var(--green-deep); }
body[data-page="home"] .secondary-button { border-color: var(--red); color: var(--red-deep); }

body[data-page="home"] .module-deck { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 8px; }
body[data-page="home"] .module-panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-strong); color: var(--ink); box-shadow: none; }
body[data-page="home"] .dragon-panel { grid-row: auto; border-left: 4px solid var(--green); }
body[data-page="home"] .missing-panel { border-left: 4px solid var(--red); }
body[data-page="home"] .today-panel { border-left: 4px solid var(--green); }
body[data-page="home"] .panel-heading { grid-template-columns: auto 1fr auto; gap: 9px; min-height: 44px; padding: 7px 10px; border-bottom: 1px solid var(--line); }
body[data-page="home"] .panel-heading > svg { width: 21px; height: 21px; color: var(--muted); }
body[data-page="home"] .panel-heading h2 { font-size: 15px; }
body[data-page="home"] .panel-heading p { margin-top: 1px; color: var(--muted); font-size: 10px; }
body[data-page="home"] .panel-heading a { min-height: 32px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 0 8px; border-color: var(--line); color: var(--ink); font-size: 11px; }
body[data-page="home"] .mini-streaks { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border-top: 0; background: transparent; }
body[data-page="home"] .mini-streaks article,
body[data-page="home"] .mini-streaks > p { min-height: 58px; padding: 8px 10px; border-left: 0; border-right: 1px solid var(--line); background: var(--surface-strong); color: var(--ink); }
body[data-page="home"] .mini-streaks article:last-child { border-right: 0; }
body[data-page="home"] .mini-streaks article.triggered { box-shadow: inset 0 -3px var(--red); }
body[data-page="home"] .mini-streaks article span,
body[data-page="home"] .mini-streaks article small { color: var(--muted); font-size: 10px; }
body[data-page="home"] .mini-streaks article b { color: var(--ink); font-size: 14px; }
body[data-page="home"] .mini-missing { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0; padding: 0; }
body[data-page="home"] .mini-missing article { min-height: 43px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); border-radius: 0; background: var(--surface-strong); color: var(--ink); }
body[data-page="home"] .mini-missing article:nth-child(7n) { border-right: 0; }
body[data-page="home"] .mini-missing article:nth-last-child(-n+7) { border-bottom: 0; }
body[data-page="home"] .mini-missing b { color: var(--ink); font-size: 13px; }
body[data-page="home"] .mini-missing span { margin-top: 2px; color: var(--muted); font-size: 9px; }
body[data-page="home"] .today-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border-top: 0; background: transparent; }
body[data-page="home"] .today-strip > span { min-height: 54px; border-right: 1px solid var(--line); background: var(--surface-strong); color: var(--ink); }
body[data-page="home"] .today-strip > span:last-child { border-right: 0; }
body[data-page="home"] .today-strip small { color: var(--muted); }
body[data-page="home"] .today-strip b { color: var(--ink); font-size: 14px; }

body[data-page="home"] .history-zone { margin-top: 10px; scroll-margin-top: calc(var(--header-height) + 8px); }
body[data-page="home"] .section-heading { align-items: center; min-height: 46px; margin: 0; padding: 7px 10px; border: 1px solid var(--line); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; background: var(--surface-strong); }
body[data-page="home"] .section-heading h2 { font-size: 17px; letter-spacing: 0; }
body[data-page="home"] .section-heading p { margin-top: 1px; font-size: 10px; }
body[data-page="home"] .section-heading > a { color: var(--red-deep); font-size: 11px; }
body[data-page="home"] .history-layout { grid-template-columns: 1fr; gap: 8px; }
body[data-page="home"] .data-surface,
body[data-page="home"] .trend-panel { border-radius: 0 0 var(--radius) var(--radius); box-shadow: none; }
body[data-page="home"] th { top: var(--header-height); padding: 7px 8px; background: var(--surface); color: var(--ink); font-size: 11px; }
body[data-page="home"] td { height: 36px; padding: 5px 8px; font-size: 12px; }
body[data-page="home"] tbody tr:nth-child(even) { background: var(--surface); }
body[data-page="home"] tbody tr:hover { background: #ebf2f9; }
:root[data-theme="dark"] body[data-page="home"] tbody tr:hover { background: #26312b; }
body[data-page="home"] .pager { min-height: 48px; padding: 6px; }
body[data-page="home"] .pager button { min-height: 36px; }
body[data-page="home"] .trend-panel { position: static; padding: 12px; background: var(--ink-soft); }
body[data-page="home"] .trend-panel > svg { height: 116px; margin-top: 8px; }
body[data-page="home"] .trend-legend { margin-top: 4px; }
body[data-page="home"] .play-lane { margin-top: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-strong); color: var(--ink); box-shadow: none; }
body[data-page="home"] .play-lane svg { width: 28px; height: 28px; color: var(--muted); }
body[data-page="home"] .play-lane h2 { font-size: 15px; }
body[data-page="home"] .play-lane p { color: var(--muted); font-size: 11px; }
body[data-page="home"] .play-lane .primary-button { min-height: 40px; }
body[data-page="home"] .floating-tools { right: 16px; bottom: 16px; }
body[data-page="home"] .site-footer { width: min(800px, calc(100% - 30px)); margin-top: 16px; padding-block: 18px 28px; border-top-width: 2px; }

@media (max-width: 900px) {
  .site-header { min-height: var(--header-height); padding-inline: 15px; }
  .primary-nav { top: var(--header-height); background: var(--surface-strong); box-shadow: 0 12px 24px rgb(0 0 0 / 18%); }
  .primary-nav a { color: var(--muted); border-bottom-color: var(--line); }
  .primary-nav a.active { border-radius: var(--radius-sm); background: var(--surface); color: var(--red-deep); box-shadow: inset 3px 0 var(--red); }
  body[data-page="home"] .race-hero { height: 180px; min-height: 180px; }
  body[data-page="home"] .floating-tools { right: 12px; bottom: 12px; gap: 8px; }
  body[data-page="home"] .floating-tools a { min-width: 48px; width: 48px; height: 48px; padding: 0; justify-content: center; border-width: 1px; }
  body[data-page="home"] .floating-tools span { display: none; }
  body[data-page="home"] .module-deck,
  body[data-page="home"] .history-zone,
  body[data-page="home"] .play-lane,
  body[data-page="home"] .site-footer { width: calc(100% - 87px); margin-left: 15px; margin-right: auto; }
}

@media (max-width: 680px) {
  body[data-page="home"] .page-width,
  body[data-page="home"] .race-hero,
  body[data-page="home"] .site-footer { width: calc(100% - 24px); }
  body[data-page="home"] .module-deck,
  body[data-page="home"] .history-zone,
  body[data-page="home"] .play-lane,
  body[data-page="home"] .site-footer { width: calc(100% - 84px); margin-left: 12px; margin-right: auto; }
  .route-band-primary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .route-band-tools { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .route-band a { min-height: 44px; border-bottom: 1px solid var(--line); }
  .route-band-primary a:nth-last-child(-n+2),
  .route-band-tools a:nth-last-child(-n+2) { border-bottom: 0; }
  .route-band-primary a:nth-child(3n),
  .route-band-tools a:nth-child(2n) { border-right: 0; }
  body[data-page="home"] .race-hero { height: 164px; min-height: 164px; }
  body[data-page="home"] .hero-grid { padding: 10px; }
  body[data-page="home"] .live-board { grid-template-columns: minmax(0, 1fr) 102px; gap: 8px; }
  body[data-page="home"] .live-meta { display: grid; gap: 3px; margin-bottom: 3px; }
  body[data-page="home"] .live-board h1 { font-size: 11px; }
  body[data-page="home"] .hero-equation { gap: 3px; }
  body[data-page="home"] .draw-equation b,
  body[data-page="home"] .draw-equation em { width: 30px; height: 30px; font-size: 17px; }
  body[data-page="home"] .draw-equation em { width: 36px; }
  body[data-page="home"] .draw-equation i { font-size: 13px; }
  body[data-page="home"] .result-tags { gap: 3px; margin-top: 5px; }
  body[data-page="home"] .result-tag,
  body[data-page="home"] .result-tags > span { min-width: 31px; padding: 2px 4px; font-size: 9px; }
  body[data-page="home"] .draw-tools { gap: 5px; }
  body[data-page="home"] .hero-timing { grid-template-columns: 1fr; padding: 5px; }
  body[data-page="home"] .hero-timing > span { grid-column: 1; }
  body[data-page="home"] .hero-timing > strong { grid-row: auto; grid-column: 1; justify-self: start; font-size: 22px; }
  body[data-page="home"] .hero-timing > small { grid-column: 1; margin-top: 1px; }
  body[data-page="home"] .hero-actions { grid-template-columns: 1fr 1fr; }
  body[data-page="home"] .hero-actions .primary-button,
  body[data-page="home"] .hero-actions .secondary-button { min-height: 42px; padding: 0; }
  body[data-page="home"] .hero-actions span { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
  body[data-page="home"] .mini-streaks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body[data-page="home"] .mini-streaks article:nth-child(2) { border-right: 0; }
  body[data-page="home"] .mini-streaks article:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  body[data-page="home"] .mini-missing { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  body[data-page="home"] .mini-missing article:nth-child(7n) { border-right: 1px solid var(--line); }
  body[data-page="home"] .mini-missing article:nth-child(4n) { border-right: 0; }
  body[data-page="home"] .mini-missing article:nth-last-child(-n+7) { border-bottom: 1px solid var(--line); }
  body[data-page="home"] .mini-missing article:nth-last-child(-n+4) { border-bottom: 0; }
  body[data-page="home"] .today-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body[data-page="home"] .today-strip > span:nth-child(2) { border-right: 0; }
  body[data-page="home"] .today-strip > span:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  body[data-page="home"] .section-heading { align-items: center; flex-direction: row; gap: 8px; }
  body[data-page="home"] .section-heading h2 { font-size: 16px; }
  body[data-page="home"] .section-heading p { display: none; }
  body[data-page="home"] .table-scroll table { min-width: 650px; }
  body[data-page="home"] .play-lane { padding-right: 64px; }
  body[data-page="home"] .site-footer { padding-right: 64px; }
}
