:root {
  color-scheme: light;
  --red: #2556a8;
  --red-deep: #2556a8;
  --green: #604d9b;
  --green-deep: #604d9b;
  --gold: #ffd000;
  --ink: #151917;
  --ink-soft: #26302b;
  --paper: #f4f5ed;
  --surface: #fbfced;
  --surface-strong: #ffffff;
  --line: #ccd2c8;
  --muted: #56635c;
  --shadow: 0 18px 46px rgb(96 77 155 / 14%);
  --radius: 18px;
  --radius-sm: 10px;
  --header-height: 72px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --red: #2556a8;
  --red-deep: #2556a8;
  --green: #604d9b;
  --green-deep: #604d9b;
  --gold: #ffda2f;
  --ink: #604d9b;
  --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(96 77 155 / 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: #604d9b; 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(96 77 155 / 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: #604d9b; }
.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(37 86 168 / 30%); }
.draw-equation b:nth-of-type(even) { background: var(--green); box-shadow: inset 0 -7px 0 rgb(96 77 155 / 30%); }
.draw-equation em { width: clamp(68px, 8.2vw, 96px); border: 4px solid var(--gold); background: #604d9b; 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: #604d9b; 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(96 77 155 / 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(37 86 168 / 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('/static/e509bc42dc975d38/assets/fenglu-scratch-track-v1-1672.avif') type('image/avif'), url('/static/e509bc42dc975d38/assets/fenglu-scratch-track-v1-1672.webp') type('image/webp'), url('/static/e509bc42dc975d38/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(96 77 155 / 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-page { padding: 28px 0 0; }
.chat-page-heading { width: min(1000px, calc(100% - 40px)); margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.chat-page-heading h1 { margin: 0; font-size: clamp(28px, 5vw, 46px); letter-spacing: -.04em; }
.chat-back { display: inline-flex; min-height: 42px; align-items: center; padding: 0 15px; border-radius: 12px; background: var(--red); color: #fff; font-weight: 900; text-decoration: none; box-shadow: var(--shadow); }
.chat-shell { width: min(1000px, calc(100% - 40px)); margin: 18px auto 0; display: grid; gap: 12px; }
.chat-profile-bar, .chat-room { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-strong); box-shadow: var(--shadow); overflow: hidden; }
.chat-profile-bar { display: grid; grid-template-columns: 46px minmax(220px, 1fr) auto; align-items: center; gap: 14px; padding: 14px 18px; }
.chat-self-avatar { width: 48px; height: 48px; display: grid; place-items: center; overflow: hidden; border: 2px solid color-mix(in srgb, var(--surface-strong) 82%, transparent); border-radius: 50%; background: var(--surface-strong); box-shadow: 0 0 0 1px color-mix(in srgb, var(--line) 82%, transparent), 0 6px 16px rgb(25 42 72 / 14%); }
.chat-self-avatar img, .chat-avatar img { width: 100%; height: 100%; display: block; object-fit: cover; object-position: center; }
.chat-nickname-control { display: grid; grid-template-columns: auto minmax(150px, 260px) 1fr; align-items: center; gap: 9px; }
.chat-nickname-control label { font-weight: 900; }.chat-nickname-control input { min-height: 42px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); }.chat-nickname-control small { color: var(--muted); }
.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; overflow: hidden; border-radius: 50%; background: var(--surface-strong); }.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 { display: inline-flex; align-items: center; gap: 3px; 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 svg { width: 12px; height: 12px; }.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; }
[data-chat-retry][hidden] { display: none !important; }
.chat-form button:disabled { cursor: not-allowed; opacity: .46; filter: saturate(.35); }

.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(37 86 168 / 18%) 12deg 18deg, transparent 18deg 32deg, rgb(96 77 155 / 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-profile-bar { grid-template-columns: 46px minmax(0, 1fr); }.status-line { grid-column: 1 / -1; 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('/static/e509bc42dc975d38/assets/fenglu-scratch-track-v1-840.avif') type('image/avif'), url('/static/e509bc42dc975d38/assets/fenglu-scratch-track-v1-840.webp') type('image/webp'), url('/static/e509bc42dc975d38/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-page { padding-top: 16px; }.chat-page-heading { align-items: flex-start; flex-direction: column; }.chat-back { min-height: 40px; }.chat-profile-bar { grid-template-columns: 40px minmax(0, 1fr); padding: 12px; }.chat-self-avatar { width: 40px; height: 40px; }.chat-nickname-control { grid-template-columns: 1fr; }.chat-nickname-control label { font-size: 12px; }.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: #2556a8;
  --red-deep: #2556a8;
  --green: #604d9b;
  --green-deep: #604d9b;
  --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); }
.primary-nav .mobile-nav-extra { display: none; }

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 { max-width: none; 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"] .geo-brief { margin: 6px 0 0; max-width: 78ch; color: rgb(255 255 255 / 88%); font-size: 11px; line-height: 1.55; }
body[data-page="home"] .geo-faq { margin-top: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-strong); overflow: hidden; }
body[data-page="home"] .geo-faq > header { padding: 14px 16px; border-bottom: 1px solid var(--line); }
body[data-page="home"] .geo-faq > header span { color: var(--red-deep); font-size: 11px; font-weight: 900; }
body[data-page="home"] .geo-faq > header h2 { margin: 3px 0; font-size: 19px; }
body[data-page="home"] .geo-faq > header p { margin: 0; color: var(--muted); font-size: 12px; }
body[data-page="home"] .geo-faq-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
body[data-page="home"] .geo-faq-grid article { padding: 14px 16px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
body[data-page="home"] .geo-faq-grid article:nth-child(2n) { border-right: 0; }
body[data-page="home"] .geo-faq-grid article:nth-last-child(-n+2) { border-bottom: 0; }
body[data-page="home"] .geo-faq-grid h3 { margin: 0; font-size: 14px; }
body[data-page="home"] .geo-faq-grid p { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
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"] .geo-faq,
  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"] .geo-faq,
  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"] .geo-faq-grid { grid-template-columns: 1fr; }
  body[data-page="home"] .geo-faq-grid article { border-right: 0; }
  body[data-page="home"] .geo-faq-grid article:nth-last-child(2) { border-bottom: 1px solid var(--line); }
  body[data-page="home"] .site-footer { padding-right: 64px; }
}

/* Shared reading scale and touch targets for the compact result dashboard. */
:root { --text-note: 12px; --text-body: 14px; --text-heading: 17px; }
.icon-button { width: 44px; height: 44px; }
.brand { min-height: 44px; }
body[data-page="home"] :is(.primary-button, .secondary-button, .pager button, .panel-heading a, .section-heading > a, .site-footer nav a) { min-height: 44px; min-width: 44px; }
body[data-page="home"] .play-lane .primary-button { min-height: 44px; }
body[data-page="home"] :is(.panel-heading h2, .section-heading h2, .play-lane h2) { font-size: var(--text-heading); }
body[data-page="home"] :is(.panel-heading p, .mini-streaks article span, .mini-streaks article small, .mini-missing span, .today-strip small, .section-heading p, .hero-timing > span, .hero-timing > small, .result-tags > span, .play-lane p) { font-size: var(--text-note); }
body[data-page="home"] :is(.panel-heading a, .section-heading > a, .primary-button, .secondary-button, .live-board h1, .issue-line, .mini-missing b, .mini-streaks article b, .today-strip b) { font-size: var(--text-body); }
.module-status { margin: 0; padding: 6px 10px; color: var(--muted); font-size: var(--text-note); line-height: 1.5; }
.mini-missing > p, .mini-streaks > p { grid-column: 1 / -1; }
body[data-page="home"] .section-heading > a { display: inline-flex; align-items: center; gap: 5px; }
body[data-page="home"][data-draw-state="locked"] .live-state i,
body[data-page="home"][data-draw-state="unavailable"] .live-state i { background: var(--red); box-shadow: none; }
body[data-page="home"][data-missing-state="retained"] [data-missing-status] { color: var(--red-deep); }

@media (max-width: 900px) {
  body[data-page="home"] .route-board { display: none; }
  .primary-nav .mobile-nav-extra { display: grid; }
  body[data-page="home"] .race-hero { height: auto; min-height: 190px; }
  body[data-page="home"] .hero-grid { height: auto; min-height: 190px; }
  body[data-page="home"] .hero-actions :is(.primary-button, .secondary-button) { min-height: 44px; }
}

@media (max-width: 680px) {
  body[data-page="home"] .race-hero { height: auto; min-height: 300px; }
  body[data-page="home"] .hero-grid { height: auto; min-height: 300px; }
}

body :is(a[href], button, label, select, textarea, input:not([type="radio"]):not([type="checkbox"])) { min-width: 44px; min-height: 44px; }
body:not([data-page="home"]) a[href] { display: inline-flex; align-items: center; }
body .choice-row label { display: inline-flex; align-items: center; }

/* Data pages reserve the same separate tool lane as the interactive pages. */
body:is([data-page="today"], [data-page="history"], [data-page="dragon"], [data-page="missing"]) { --safe-tool-rail: 156px; }
body:is([data-page="today"], [data-page="history"], [data-page="dragon"], [data-page="missing"]) :is(.content-stack, .site-footer) { width: min(1180px, calc(100% - var(--safe-tool-rail) - 40px)); margin-right: calc(var(--safe-tool-rail) + 20px); }

@media (max-width: 900px) {
  body:is([data-page="today"], [data-page="history"], [data-page="dragon"], [data-page="missing"]) { --safe-tool-rail: 64px; }
  body:is([data-page="today"], [data-page="history"], [data-page="dragon"], [data-page="missing"]) .floating-tools { right: 12px; bottom: 12px; gap: 8px; }
  body:is([data-page="today"], [data-page="history"], [data-page="dragon"], [data-page="missing"]) .floating-tools a { min-width: 48px; width: 48px; height: 48px; padding: 0; justify-content: center; border-width: 1px; }
  body:is([data-page="today"], [data-page="history"], [data-page="dragon"], [data-page="missing"]) .floating-tools span { position: absolute; display: block; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
}

@media (max-width: 680px) {
  body:is([data-page="today"], [data-page="history"], [data-page="dragon"], [data-page="missing"]) :is(.content-stack, .site-footer) { width: calc(100% - var(--safe-tool-rail) - 24px); margin-right: calc(var(--safe-tool-rail) + 12px); }
}

/* One blue / indigo / amber system; legacy token names remain compatibility aliases. */
:root { --red: #2556a8; --red-deep: #173e80; --green: #604d9b; --green-deep: #443375; --gold: #9a6700; --ink: #202a3a; --ink-soft: #24334c; --paper: #f4f6fa; --surface: #f8f9fc; --surface-strong: #ffffff; --line: #d4dbe7; --muted: #536176; }
:root[data-theme="dark"] { --red: #91b8ff; --red-deep: #b2ccff; --green: #b9a6ef; --green-deep: #d2c3ff; --gold: #e8bf75; --ink: #e8eef9; --ink-soft: #233049; --paper: #101725; --surface: #1b2538; --surface-strong: #151f31; --line: #3c4b65; --muted: #b0bfd5; }
.scratch-page { background-image: none; background-color: var(--paper); }
.dragon-current { display: grid; grid-template-columns: 1fr 160px 1fr; gap: 12px; align-items: center; min-height: 80px; padding: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 13px; }
.dragon-current > :last-child { text-align: right; }
.dragon-current b, .dragon-current strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.dragon-current [data-dragon-equation] { font: 800 16px/1.5 ui-monospace, monospace; }
.module-status { height: 48px; min-height: 48px; overflow: auto; }
.window-statistics h3 { margin: 0; padding: 8px 10px; font-size: 15px; }
.window-statistics .today-strip { color: var(--ink); background: var(--line); }
.window-statistics .today-strip > span { background: var(--surface); }
.window-statistics .today-strip small { color: var(--muted); }
.history-window-controls { display: flex; align-items: center; gap: 8px; min-height: 60px; padding: 8px 10px; }
.history-window-controls button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 104px; min-height: 44px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-strong); color: var(--ink); }
.history-window-controls button[aria-pressed="true"] { border-color: var(--red); background: color-mix(in srgb, var(--red) 10%, var(--surface)); }
.table-scroll { height: min(62dvh, 640px); min-height: 360px; overflow: auto; scrollbar-gutter: stable; overscroll-behavior: contain; }
body .table-scroll th { top: 0; }
.floating-tools a:hover { transform: none; }
.surface-heading > div { min-width: 0; }
.surface-heading > div > p { min-height: 36px; }
.surface-heading button { flex-shrink: 0; min-width: 84px; white-space: nowrap; }
.detail-list { height: 620px; overflow: auto; overscroll-behavior: contain; }
.streak-grid { min-height: 260px; align-content: start; }
.exact-missing-grid { min-height: 478px; align-content: start; }
body[data-page="home"] .mini-streaks { min-height: 96px; grid-auto-rows: 96px; }
body[data-page="home"] .mini-missing { min-height: 224px; grid-auto-rows: 56px; }
.live-meta { min-height: 24px; }
body[data-page="home"] .live-state { min-width: 154px; }
.result-tags { height: 28px; min-height: 28px; }
[data-dragon-countdown], [data-countdown] { font-variant-numeric: tabular-nums; }
.scratch-ticket > footer { min-height: 100px; }
body[data-page="chat"] [data-chat-status] { min-height: 96px; }
@media (max-width: 1050px) { .exact-missing-grid { min-height: 722px; } }
@media (max-width: 900px) { .streak-grid { min-height: 396px; } }
@media (max-width: 680px) {
  .dragon-current { grid-template-columns: 1fr; gap: 4px; min-height: 100px; }
  .dragon-current > :last-child { text-align: left; }
  .streak-grid { min-height: 804px; }
  .exact-missing-grid { min-height: 1052px; }
  body[data-page="home"] .mini-streaks { min-height: 224px; grid-auto-rows: 112px; }
  body[data-page="home"] .mini-missing { min-height: 392px; }
  .scratch-ticket > footer { min-height: 128px; }
  body[data-page="home"] .hero-timing > small { min-height: 36px; }
  body[data-page="home"] .hero-timing > small b { display: block; }
  .missing-toolbar { display: grid; grid-template-columns: minmax(0, 1fr); align-items: stretch; }
  .missing-toolbar > div { min-height: 66px; }
  .missing-toolbar .action-button { width: 100%; min-height: 48px; justify-content: center; }
}

/* User-facing semantic palette: size, parity, combinations, shapes and dragon/tiger stay distinguishable. */
:root {
  --tag-big: #a33ab5;
  --tag-small: #1677c8;
  --tag-odd: #c86f00;
  --tag-even: #6f4fc2;
  --tag-big-odd: #b23d85;
  --tag-big-even: #7f45b5;
  --tag-small-odd: #087f9c;
  --tag-small-even: #315fc4;
  --tag-shape: #9a6700;
  --tag-neutral: #52627a;
}
:root[data-theme="dark"] {
  --tag-big: #e4a0ef;
  --tag-small: #78bfff;
  --tag-odd: #f3b65d;
  --tag-even: #c1a7ff;
  --tag-big-odd: #f09bce;
  --tag-big-even: #d7a2ff;
  --tag-small-odd: #7ad9ef;
  --tag-small-even: #9ab8ff;
  --tag-shape: #e8bf75;
  --tag-neutral: #b4c1d6;
}
.result-tag[class*="tag-"],
.table-tags span[class*="tag-"] { background: var(--tag-color, var(--tag-neutral)); color: #ffffff; border-color: transparent; }
.result-tag.tag-big, .table-tags .tag-big { --tag-color: var(--tag-big); }
.result-tag.tag-small, .table-tags .tag-small { --tag-color: var(--tag-small); }
.result-tag.tag-odd, .table-tags .tag-odd { --tag-color: var(--tag-odd); }
.result-tag.tag-even, .table-tags .tag-even { --tag-color: var(--tag-even); }
.result-tag.tag-big-odd, .table-tags .tag-big-odd, .result-tag.tag-dragon { --tag-color: var(--tag-big-odd); }
.result-tag.tag-big-even, .table-tags .tag-big-even { --tag-color: var(--tag-big-even); }
.result-tag.tag-small-odd, .table-tags .tag-small-odd, .result-tag.tag-tiger { --tag-color: var(--tag-small-odd); }
.result-tag.tag-small-even, .table-tags .tag-small-even { --tag-color: var(--tag-small-even); }
.result-tag:is(.tag-sequence, .tag-triple, .tag-pair, .tag-half-sequence) { --tag-color: var(--tag-shape); color: #ffffff; }
.result-tag:is(.tag-mixed, .tag-tie, .tag-neutral) { --tag-color: var(--tag-neutral); }
body[data-page="home"] .result-tag[class*="tag-"] {
  border-color: color-mix(in srgb, var(--tag-color) 55%, var(--line));
  background: color-mix(in srgb, var(--tag-color) 14%, var(--surface));
  color: var(--tag-color);
}

/* The tracked sum is primary; the omission count is secondary and uses a separate pressure color. */
.auto-refresh-note { display: block; margin-top: 5px; color: #087f72; font-size: 11px; font-weight: 800; }
.auto-refresh-note::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #12a594; box-shadow: 0 0 0 3px rgb(18 165 148 / 14%); }
.missing-card > .missing-value { color: var(--red-deep); font: 900 38px/1 ui-monospace, "SFMono-Regular", Menlo, monospace; letter-spacing: -.04em; }
.missing-card > .missing-count { margin-top: 8px; color: var(--green-deep); font: 900 21px/1 ui-monospace, "SFMono-Regular", Menlo, monospace; }
.missing-card.under-10 > .missing-count { color: #087f72; }
.missing-card[class~="10-plus"] > .missing-count { color: #315fc4; }
.missing-card[class~="50-plus"] > .missing-count { color: #6f4fc2; }
.missing-card[class~="100-plus"] > .missing-count { color: #c86f00; }
.missing-card[class~="500-plus"] > .missing-count,
.missing-card[class~="1000-plus"] > .missing-count { color: #b23d85; }
.missing-card.under-10 i { background: #12a594; }
.missing-card[class~="10-plus"] i { background: #4b7bec; }
.missing-card[class~="50-plus"] i { background: #7f62d3; }
.missing-card[class~="100-plus"] i { background: #e49a25; }
.missing-card[class~="500-plus"] i,
.missing-card[class~="1000-plus"] i { background: #c654a0; }

/* Visible participants receive stable, collision-free portraits from the self-hosted avatar pack. */
.messages article { grid-template-columns: 44px 1fr; gap: 12px; }
.chat-avatar { width: 42px; height: 42px; border: 2px solid color-mix(in srgb, var(--surface-strong) 76%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--line) 82%, transparent), 0 4px 12px rgb(25 42 72 / 12%); }

.game-load-error { margin: 12px 0; padding: 9px 12px; border: 1px solid #f3bd62; border-radius: var(--radius-sm); background: rgb(113 72 8 / 62%); color: #ffffff; font-weight: 800; }

/* Position colors make the three draw digits and the sum scannable at a glance. */
:root {
  --digit-one: #255fba;
  --digit-one-soft: #e7f0ff;
  --digit-two: #7550b8;
  --digit-two-soft: #f0ebff;
  --digit-three: #c66a10;
  --digit-three-soft: #fff0df;
  --digit-sum: #087f72;
  --digit-sum-soft: #e2f8f3;
}
:root[data-theme="dark"] {
  --digit-one: #9cc2ff;
  --digit-one-soft: #22395d;
  --digit-two: #cfb8ff;
  --digit-two-soft: #392e59;
  --digit-three: #ffc178;
  --digit-three-soft: #4b351f;
  --digit-sum: #83e0d2;
  --digit-sum-soft: #1e4844;
}
body .draw-equation .digit-ball.digit-1 { border-color: color-mix(in srgb, var(--digit-one) 64%, var(--line)); background: var(--digit-one-soft); color: var(--digit-one); box-shadow: inset 0 -4px color-mix(in srgb, var(--digit-one) 22%, transparent); }
body .draw-equation .digit-ball.digit-2 { border-color: color-mix(in srgb, var(--digit-two) 64%, var(--line)); background: var(--digit-two-soft); color: var(--digit-two); box-shadow: inset 0 -4px color-mix(in srgb, var(--digit-two) 22%, transparent); }
body .draw-equation .digit-ball.digit-3 { border-color: color-mix(in srgb, var(--digit-three) 64%, var(--line)); background: var(--digit-three-soft); color: var(--digit-three); box-shadow: inset 0 -4px color-mix(in srgb, var(--digit-three) 22%, transparent); }
body .draw-equation .digit-sum { border-color: var(--digit-sum); background: var(--digit-sum-soft); color: var(--digit-sum); box-shadow: inset 0 -4px color-mix(in srgb, var(--digit-sum) 20%, transparent); }
.row-equation b:nth-of-type(1) { color: var(--digit-one); }
.row-equation b:nth-of-type(2) { color: var(--digit-two); }
.row-equation b:nth-of-type(3) { color: var(--digit-three); }
.row-equation em { color: var(--digit-sum); }

/* Home keeps its compact layout but gains tinted hierarchy instead of white-on-white rows. */
body[data-page="home"] .dragon-panel { border-left-color: var(--digit-two); }
body[data-page="home"] .missing-panel { border-left-color: var(--digit-one); }
body[data-page="home"] .today-panel { border-left-color: var(--digit-three); }
body[data-page="home"] .dragon-panel .panel-heading { background: color-mix(in srgb, var(--digit-two) 9%, var(--surface-strong)); }
body[data-page="home"] .missing-panel .panel-heading { background: color-mix(in srgb, var(--digit-one) 9%, var(--surface-strong)); }
body[data-page="home"] .today-panel .panel-heading { background: color-mix(in srgb, var(--digit-three) 10%, var(--surface-strong)); }
body[data-page="home"] .mini-streaks article:nth-child(4n+1) { background: color-mix(in srgb, var(--digit-one) 7%, var(--surface-strong)); box-shadow: inset 0 -3px var(--digit-one); }
body[data-page="home"] .mini-streaks article:nth-child(4n+2) { background: color-mix(in srgb, var(--digit-two) 7%, var(--surface-strong)); box-shadow: inset 0 -3px var(--digit-two); }
body[data-page="home"] .mini-streaks article:nth-child(4n+3) { background: color-mix(in srgb, var(--digit-three) 8%, var(--surface-strong)); box-shadow: inset 0 -3px var(--digit-three); }
body[data-page="home"] .mini-streaks article:nth-child(4n) { background: color-mix(in srgb, var(--digit-sum) 7%, var(--surface-strong)); box-shadow: inset 0 -3px var(--digit-sum); }
body[data-page="home"] .mini-missing article:nth-child(4n+1) b { color: var(--digit-one); }
body[data-page="home"] .mini-missing article:nth-child(4n+2) b { color: var(--digit-two); }
body[data-page="home"] .mini-missing article:nth-child(4n+3) b { color: var(--digit-three); }
body[data-page="home"] .mini-missing article:nth-child(4n) b { color: var(--digit-sum); }
body[data-page="home"] .today-strip > span:nth-child(1) { background: color-mix(in srgb, var(--digit-one) 8%, var(--surface-strong)); }
body[data-page="home"] .today-strip > span:nth-child(2) { background: color-mix(in srgb, var(--digit-two) 8%, var(--surface-strong)); }
body[data-page="home"] .today-strip > span:nth-child(3) { background: color-mix(in srgb, var(--digit-three) 9%, var(--surface-strong)); }
body[data-page="home"] .today-strip > span:nth-child(4) { background: color-mix(in srgb, var(--digit-sum) 8%, var(--surface-strong)); }
body[data-page="home"] .today-strip > span:nth-child(1) b { color: var(--digit-one); }
body[data-page="home"] .today-strip > span:nth-child(2) b { color: var(--digit-two); }
body[data-page="home"] .today-strip > span:nth-child(3) b { color: var(--digit-three); }
body[data-page="home"] .today-strip > span:nth-child(4) b { color: var(--digit-sum); }
.missing-card:nth-child(4n+1) > .missing-value { color: var(--digit-one); }
.missing-card:nth-child(4n+2) > .missing-value { color: var(--digit-two); }
.missing-card:nth-child(4n+3) > .missing-value { color: var(--digit-three); }
.missing-card:nth-child(4n) > .missing-value { color: var(--digit-sum); }

/* The game connects on page entry, then waits for the player to start the timed round. */
.game-intro { background: linear-gradient(118deg, #255fba 0%, #604d9b 58%, #7d4398 100%); }
.game-stage { background: linear-gradient(155deg, #1d3150 0%, #253a5a 52%, #302c55 100%); }
.reaction-game { width: min(620px, 100%); }
.reaction-score { gap: 14px; }
.reaction-score strong { min-width: 144px; padding: 10px 16px; border: 1px solid rgb(255 255 255 / 16%); border-radius: var(--radius-sm); background: rgb(255 255 255 / 8%); font-size: 20px; text-align: center; }
.reaction-score strong:first-child { color: #9cc2ff; box-shadow: inset 0 -3px #4b87e5; }
.reaction-score strong:last-child { color: #ffc178; box-shadow: inset 0 -3px #dc842d; }
.reaction-track { border-color: rgb(156 194 255 / 42%); background: repeating-linear-gradient(90deg, rgb(20 37 64 / 88%) 0 58px, rgb(36 58 92 / 88%) 58px 60px); }
.reaction-target { z-index: 0; isolation: isolate; border-radius: 0; background: transparent; color: #23190a; box-shadow: none; transition: transform .12s cubic-bezier(.2,.8,.2,1), opacity .18s ease; }
.reaction-target::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: 50%; background: linear-gradient(145deg, #ffb84d, #e56b37); box-shadow: 0 0 0 8px rgb(255 255 255 / 12%), 0 12px 24px rgb(0 0 0 / 28%); }
.reaction-target[aria-disabled="true"] { opacity: .46; cursor: default; }
.reaction-controls { align-items: center; }
.reaction-controls > span { color: #d7e6ff; font-weight: 800; }
.reaction-controls button { background: linear-gradient(110deg, #2574ce, #6d52b8); box-shadow: 0 8px 18px rgb(11 23 48 / 30%); }
.reaction-controls button:active { transform: translateY(1px); }
@media (prefers-reduced-motion: reduce) {
  .reaction-target,
  .reaction-controls button { transition: none; }
}
@media (max-width: 680px) {
  .reaction-score strong { min-width: 0; flex: 1; padding-inline: 8px; font-size: 17px; }
  .reaction-controls { align-items: stretch; flex-direction: column; }
  .reaction-controls button { width: 100%; min-height: 48px; }
}

/* Module F: the complete ten-game catalog. Games load only after a player opens one. */
body[data-page="games"] { --safe-tool-rail: 156px; }
.games-shell { width: min(1180px, calc(100% - var(--safe-tool-rail) - 40px)); margin: 30px calc(var(--safe-tool-rail) + 20px) 0 auto; }
.games-intro { min-height: 210px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 28px; padding: 34px 40px; overflow: hidden; border-radius: 18px; background: linear-gradient(118deg, #255fba 0%, #604d9b 56%, #884497 100%); color: #ffffff; box-shadow: 0 18px 44px rgb(27 45 86 / 18%); }
.games-intro > div > span { color: #ffd07d; font-size: 12px; font-weight: 900; letter-spacing: .12em; }
.games-intro h1 { margin: 6px 0 10px; font-size: clamp(38px, 6vw, 64px); line-height: 1; letter-spacing: -.045em; }
.games-intro p { max-width: 44ch; margin: 0; color: rgb(255 255 255 / 80%); }
.games-intro > svg { width: 94px; height: 94px; color: #ffc05b; filter: drop-shadow(0 12px 24px rgb(28 15 56 / 28%)); }
.games-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.game-card { --game-tone: #255fba; position: relative; min-width: 0; padding: 16px; display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; align-items: center; gap: 17px; overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: var(--surface-strong); box-shadow: var(--shadow); }
.game-card::before { position: absolute; inset: 0 auto 0 0; width: 4px; content: ""; background: var(--game-tone); }
.game-card-art { position: relative; height: 80px; display: grid; place-items: center; overflow: hidden; border-radius: 12px; color: var(--game-tone); background: color-mix(in srgb, var(--game-tone) 13%, var(--surface)); }
.game-card-art::after { position: absolute; width: 62px; height: 62px; border: 1px solid currentColor; border-radius: 50%; opacity: .18; content: ""; }
.game-card-art span { z-index: 1; font: 900 25px/1 ui-monospace, "SFMono-Regular", Menlo, monospace; letter-spacing: -.08em; }
.game-card-art i { position: absolute; right: 8px; bottom: 6px; color: var(--game-tone); font: normal 800 10px/1 ui-monospace, monospace; opacity: .62; }
.game-card-copy { min-width: 0; }
.game-card-copy h2 { margin: 0; color: var(--ink); font-size: 17px; }
.game-card-copy p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.game-card-copy small { display: block; margin-top: 7px; color: color-mix(in srgb, var(--game-tone) 74%, var(--muted)); font-size: 11px; font-weight: 800; }
[data-game-open] { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 13px; border: 1px solid color-mix(in srgb, var(--game-tone) 40%, var(--line)); border-radius: 9px; color: var(--game-tone); background: color-mix(in srgb, var(--game-tone) 8%, var(--surface-strong)); font: inherit; font-size: 12px; font-weight: 900; cursor: pointer; }
[data-game-open] svg { width: 16px; height: 16px; flex: 0 0 auto; }
[data-game-open]:hover { color: #ffffff; background: var(--game-tone); transform: translateY(-1px); }
[data-game-open]:focus-visible { outline: 3px solid color-mix(in srgb, var(--game-tone) 36%, transparent); outline-offset: 2px; }
.games-footnote { margin: 20px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.tone-orange { --game-tone: #dc6f20; }.tone-green { --game-tone: #14829f; }.tone-purple { --game-tone: #7b55d1; }.tone-blue { --game-tone: #246fc5; }.tone-yellow { --game-tone: #a97400; }.tone-pink { --game-tone: #c3457e; }.tone-red { --game-tone: #ce7628; }.tone-cyan { --game-tone: #07869c; }.tone-indigo { --game-tone: #4b5fd0; }.tone-teal { --game-tone: #1d7894; }

.game-window:not([open]) { display: none; }
.game-window { position: fixed; z-index: 120; inset: auto 16px 16px auto; width: 33.333vw; max-width: none; height: 33.333dvh; max-height: none; margin: 0; padding: 0; overflow: hidden; border: 1px solid #4c607a; border-radius: 14px; background: #0f1720; box-shadow: 0 18px 56px rgb(4 14 29 / 42%); }
.game-window.is-maximized { inset: 9px; width: auto; height: auto; }
.game-window-shell { height: 100%; display: grid; grid-template-rows: 48px minmax(0, 1fr); }
.game-window-bar { padding: 0 8px 0 15px; display: grid; grid-template-columns: 90px 1fr 90px; align-items: center; border-bottom: 1px solid rgb(255 255 255 / 10%); color: #eaf2ff; background: #172332; user-select: none; }
.game-window-bar strong { overflow: hidden; font-size: 14px; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.window-lights { display: flex; gap: 7px; }
.window-lights i { width: 10px; height: 10px; border-radius: 50%; background: #f16a62; }.window-lights i:nth-child(2) { background: #f0b74b; }.window-lights i:nth-child(3) { background: #5bc77c; }
.game-window-actions { display: flex; justify-content: flex-end; gap: 4px; }
.game-window-actions button { min-width: 38px; width: 38px; min-height: 38px; height: 38px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 7px; color: #dce8f6; background: transparent; cursor: pointer; }
.game-window-actions button svg { width: 19px; height: 19px; }
.game-window-actions button:hover { background: rgb(255 255 255 / 10%); }.game-window-actions [data-game-close]:hover { background: #c94850; }
.game-window-stage { position: relative; min-height: 0; background: #101a26; }
.game-window-stage iframe { position: relative; z-index: 1; width: 100%; height: 100%; display: block; border: 0; background: #101a26; }
.game-loading { position: absolute; z-index: 2; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; color: #c6d4e7; font-size: 13px; background: #101a26; }
.game-loading[hidden] { display: none; }
.game-loading span { width: 24px; height: 24px; border: 2px solid rgb(255 255 255 / 17%); border-top-color: #66adff; border-radius: 50%; animation: game-spin .8s linear infinite; }
@keyframes game-spin { to { transform: rotate(360deg); } }
.game-joystick { position: absolute; z-index: 3; left: 9px; bottom: 9px; width: 120px; height: 120px; border: 1px solid rgb(151 190 235 / 34%); border-radius: 50%; background: rgb(9 23 39 / 68%); box-shadow: 0 8px 24px rgb(0 0 0 / 32%), inset 0 0 24px rgb(75 142 215 / 13%); backdrop-filter: blur(8px); touch-action: none; }
.game-joystick[hidden] { display: none; }
.game-joystick button { position: absolute; z-index: 2; width: 44px; min-width: 44px; height: 44px; min-height: 44px; display: grid; place-items: center; padding: 0; border: 1px solid rgb(148 194 244 / 42%); border-radius: 50%; color: #f0f6ff; background: linear-gradient(145deg, rgb(60 103 151 / 94%), rgb(24 52 82 / 96%)); box-shadow: 0 4px 10px rgb(0 0 0 / 28%); font: 900 14px/1 ui-monospace, monospace; cursor: pointer; touch-action: none; user-select: none; }
.game-joystick button svg { width: 20px; height: 20px; }
.game-joystick button:active, .game-joystick button.is-active { color: #142033; background: #ffd36d; transform: scale(.94); }
.game-joystick button[hidden] { display: none; }
.joystick-up { top: 0; left: 38px; }.joystick-left { top: 38px; left: 0; }.joystick-right { top: 38px; right: 0; }.joystick-down { bottom: 0; left: 38px; }
.joystick-up svg { transform: rotate(-90deg); }.joystick-down svg { transform: rotate(90deg); }
.joystick-knob { position: absolute; z-index: 1; top: 39px; left: 39px; width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid rgb(255 255 255 / 13%); border-radius: 50%; color: #9eb5cf; background: rgb(8 20 34 / 92%); font-size: 9px; font-weight: 900; letter-spacing: .04em; }

/* A player-readable 0-27 sum chart: scale, period labels, point values, and size regions. */
.trend-panel { --trend-big: #b762d1; --trend-small: #3f8fe8; }
.trend-explainer { margin: 7px 0 0; color: #c8d5e7 !important; font-size: 12px !important; }
.trend-zone-big { fill: rgb(183 98 209 / 12%); }
.trend-zone-small { fill: rgb(63 143 232 / 11%); }
.trend-grid-line { stroke: rgb(255 255 255 / 18%); stroke-width: 1; }
[data-trend-line] { stroke: #f1b53f; stroke-width: 3; }
[data-trend-dots] circle { stroke-width: 2.2; }
[data-trend-y-axis] text, [data-trend-x-axis] text, [data-trend-values] text { fill: #d7e2f2; font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; }
[data-trend-y-axis] text { font-size: 10px; }
[data-trend-x-axis] text { font-size: 9px; }
[data-trend-values] text { fill: #ffffff; font-size: 10px; font-weight: 900; paint-order: stroke; stroke: #24334c; stroke-width: 3px; stroke-linejoin: round; }
.trend-legend { flex-wrap: wrap; }
.trend-legend span { color: #d7e2f2; font-size: 12px; font-weight: 800; }
.trend-legend .legend-red { background: var(--trend-big); }.trend-legend .legend-green { background: var(--trend-small); }
.trend-latest { margin: 10px 0 0; padding: 9px 11px; border-left: 4px solid #f1b53f; background: rgb(255 255 255 / 8%); color: #ffffff !important; font: 900 13px/1.4 ui-monospace, "SFMono-Regular", Menlo, monospace !important; }
body[data-page="home"] .trend-panel > svg { width: 100%; height: 250px; margin-top: 8px; }
body[data-page="home"] .trend-legend { margin-top: 6px; }

@media (max-width: 900px) {
  body[data-page="games"] { --safe-tool-rail: 64px; }
  .games-shell { width: calc(100% - var(--safe-tool-rail) - 24px); margin-right: calc(var(--safe-tool-rail) + 12px); }
  .games-grid { grid-template-columns: 1fr; }
  body[data-page="games"] .floating-tools { right: 12px; bottom: 12px; gap: 8px; }
  body[data-page="games"] .floating-tools a { min-width: 48px; width: 48px; height: 48px; padding: 0; justify-content: center; border-width: 1px; }
  body[data-page="games"] .floating-tools span { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
}
@media (max-width: 680px) {
  .games-shell { margin-top: 16px; }
  .games-intro { min-height: 160px; grid-template-columns: 1fr; padding: 24px 20px; }
  .games-intro h1 { font-size: 38px; }
  .games-intro > svg { display: none; }
  .games-grid { gap: 10px; margin-top: 12px; }
  .game-card { padding: 11px; grid-template-columns: 68px minmax(0, 1fr) 46px; gap: 10px; border-radius: 12px; }
  .game-card-art { height: 66px; }
  .game-card-art span { font-size: 21px; }
  .game-card-copy h2 { font-size: 15px; }
  .game-card-copy p { max-width: 155px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
  .game-card-copy small { display: none; }
  [data-game-open] { width: 46px; padding: 0; overflow: hidden; }
  [data-game-open] > span { display: none; }
  [data-game-open] svg { width: 19px; height: 19px; color: var(--game-tone); }
  .game-window, .game-window.is-maximized { inset: auto 6px 6px auto; width: calc(100vw - 12px); height: min(72dvh, 620px); border-radius: 12px; }
  .game-window-shell { grid-template-rows: 44px minmax(0, 1fr); }
  .game-window-bar { grid-template-columns: 64px 1fr 64px; padding-inline: 8px 4px; }
  .game-window-actions [data-game-maximize] { display: none; }
  body[data-page="home"] .trend-panel > svg { height: 230px; }
  [data-trend-x-axis] text { font-size: 8px; }
}
@media (prefers-reduced-motion: reduce) { .game-loading span { animation-duration: 1.6s; } }
