@font-face {
  font-family: "N1SmileySans";
  src: url("/fonts/SmileySans-Oblique.v201-731f2297.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --font-display: "N1SmileySans", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-body: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --blue: #075cff;
  --blue-deep: #003ca6;
  --cyan: #00cfe8;
  --cyan-deep: #007f9b;
  --orange: #ff5b2e;
  --orange-deep: #d92b16;
  --navy: #042a73;
  --ink: #061c45;
  --muted: #45638f;
  --line: #a9c8ff;
  --white: #ffffff;
  --soft-blue: #dcebff;
  --soft-cyan: #d6fbff;
  --soft-orange: #ffe2d8;
  --success: #00a983;
  --danger: #d91f45;
  --shadow: 0 16px 34px rgba(0, 60, 166, .16);
  --max: 1240px;
  --radius: 18px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #ffffff;
  --muted: #bcd8ff;
  --line: #3576d7;
  --white: #082f73;
  --soft-blue: #0d438f;
  --soft-cyan: #075f78;
  --soft-orange: #753a35;
  --blue: #62a3ff;
  --blue-deep: #dcecff;
  --cyan: #35e8f7;
  --cyan-deep: #8ef5ff;
  --orange: #ff7957;
  --orange-deep: #ffb19d;
  --navy: #021a49;
  --shadow: 0 18px 38px rgba(0, 7, 31, .38);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 82px; }
body {
  position: relative;
  min-width: 280px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background: #eef7ff;
  font-family: var(--font-body);
  line-height: 1.48;
}
html[data-theme="dark"] body { background: #02133a; }
body:not([data-page="scratch"]):not([data-page="chat"])::before {
  content: "";
  position: fixed;
  z-index: -2;
  inset: 60px 0 auto;
  width: 100%;
  height: min(74vw, 760px);
  min-height: 510px;
  background: url("/assets/xingji-electric-orbit-bg.3f9481e7.png") center top / cover no-repeat;
  pointer-events: none;
}
body:not([data-page="scratch"]):not([data-page="chat"])::after {
  content: "";
  position: fixed;
  z-index: -1;
  inset: 60px 0 0;
  background: linear-gradient(180deg, transparent 0 520px, #eef7ff 760px 100%);
  pointer-events: none;
}
html[data-theme="dark"] body:not([data-page="scratch"]):not([data-page="chat"])::before {
  filter: brightness(.43) saturate(1.35) contrast(1.08);
}
html[data-theme="dark"] body:not([data-page="scratch"]):not([data-page="chat"])::after {
  background: linear-gradient(180deg, rgba(0, 15, 55, .14) 0 460px, #02133a 760px 100%);
}

button, input, select, textarea { color: inherit; font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
  min-height: 64px;
  padding: 7px max(16px, calc((100vw - var(--max)) / 2));
  color: #fff;
  background: linear-gradient(102deg, #00399e 0%, #075cff 48%, #00a9c8 100%);
  border-bottom: 4px solid #ff5b2e;
  box-shadow: 0 7px 24px rgba(0, 52, 150, .24);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.brand img { flex: 0 0 auto; }
.site-header > .brand img {
  width: 40px;
  height: 40px;
  padding: 4px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 5px 14px rgba(0, 25, 88, .28);
}
.brand span { display: grid; min-width: 0; }
.brand strong, h1, h2, .equation, .countdown-box strong, .issue-label strong, .nav-label, .primary-button, .ghost-button {
  font-family: var(--font-display);
}
.brand strong { font-size: 20px; line-height: 1; letter-spacing: .04em; }
.brand small { margin-top: 3px; color: #d7f6ff; font-size: 10px; white-space: nowrap; }
.site-nav {
  justify-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.site-nav a {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, .38);
  border-radius: 12px;
  color: #fff;
  background: rgba(0, 34, 119, .24);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
}
.site-nav a:hover, .site-nav a[aria-current="page"] {
  color: #003b9f;
  background: #fff;
  border-color: #fff;
}
.nav-glyph { display: grid; place-items: center; width: 20px; height: 20px; }
.nav-glyph svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 2px solid #fff;
  border-radius: 50%;
  color: #0049c9;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 5px 14px rgba(0, 25, 88, .25);
  font-size: 18px;
}

main { width: min(var(--max), calc(100% - 28px)); margin: 16px auto 60px; }
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
}
.top-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(390px, .82fr);
  align-items: start;
  gap: 14px;
}
.top-grid > *, .cursor-grid > *, .analysis-grid > * { min-width: 0; }
.recent-panel { min-height: 264px; }
.live-panel {
  position: relative;
  overflow: hidden;
  padding: 18px 20px 14px;
  border: 2px solid #075cff;
  border-top-width: 7px;
  background: #fff;
}
html[data-theme="dark"] .live-panel { background: #082f73; }
.live-panel::after {
  content: "";
  position: absolute;
  right: -72px;
  bottom: -94px;
  width: 210px;
  height: 210px;
  border: 26px solid rgba(0, 207, 232, .18);
  border-radius: 50%;
  pointer-events: none;
}
.panel-kicker { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.panel-kicker b { color: var(--ink); font-family: var(--font-display); font-size: 15px; letter-spacing: .05em; }
.panel-kicker span:last-child { margin-left: auto; }
.pulse { width: 8px; height: 8px; margin-left: 0 !important; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 5px rgba(0, 207, 232, .2); animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.76); box-shadow: 0 0 0 8px rgba(0, 207, 232, .06); } }
.live-main { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 8px; }
.live-main > div:first-child { min-width: 0; }
.issue-label { color: var(--muted); font-size: 13px; }
.issue-label strong { color: #004ed8; font-size: 19px; }
html[data-theme="dark"] .issue-label strong { color: #fff; }
.equation { display: flex; align-items: center; gap: 7px; margin-top: 8px; white-space: nowrap; }
.equation b, .equation em {
  display: grid;
  place-items: center;
  width: 60px;
  height: 62px;
  border: 2px solid #fff;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(145deg, #00cfe8, #075cff 70%);
  box-shadow: 0 7px 15px rgba(0, 75, 206, .27), inset 0 3px 6px rgba(255, 255, 255, .42);
  font-size: 34px;
  font-style: normal;
  line-height: 1;
}
.equation b:nth-of-type(2) { background: linear-gradient(145deg, #35e8f7, #0099bc 74%); }
.equation b:nth-of-type(3) { background: linear-gradient(145deg, #ff9472, #ff3c20 72%); }
.equation em {
  width: 74px;
  border-radius: 17px;
  background: linear-gradient(145deg, #ff7f55, #d92416 72%);
}
.equation i { color: #0a4caf; font-family: var(--font-body); font-size: 16px; font-style: normal; font-weight: 900; }
html[data-theme="dark"] .equation i { color: #9fefff; }
.classification-row { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.classification-row > b { padding: 3px 8px; border-radius: 999px; color: #fff; background: #004ed8; font-size: 10px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 5px; min-height: 24px; }
.tag-row span { padding: 3px 8px; border-radius: 999px; color: #003da9; background: #d6fbff; font-size: 11px; font-weight: 850; }
.tag-row span:nth-child(3n) { color: #ae230e; background: #ffe2d8; }
html[data-theme="dark"] .tag-row span { color: #fff; background: #075f78; }
html[data-theme="dark"] .tag-row span:nth-child(3n) { background: #753a35; }
.countdown-box {
  position: relative;
  z-index: 2;
  flex: 0 0 150px;
  display: grid;
  padding: 13px 12px;
  border: 2px solid #00cfe8;
  border-radius: 15px;
  color: #073d90;
  background: #fff;
  text-align: center;
  box-shadow: 7px 7px 0 #d6fbff;
}
.countdown-box small, .countdown-box span { color: #3b628e; font-size: 10px; }
.countdown-box strong { color: #005fff; font-size: 32px; letter-spacing: -.035em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.live-meta { margin: 10px 0 0; color: var(--muted); font-size: 11px; }

.recent-panel { overflow: hidden; border: 2px solid #003da9; background: #042a73; }
.recent-panel > .section-title { min-height: 47px; padding: 8px 14px; color: #fff; background: linear-gradient(100deg, #003fae, #007eaa); }
.recent-panel > .section-title span, .recent-panel > .section-title small { color: #a9f4ff; }
.recent-panel > .section-title h2 { color: #fff; }
.section-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.section-title span, .eyebrow { display: block; color: var(--blue); font-family: var(--font-display); font-size: 9px; font-weight: 900; letter-spacing: .16em; }
.section-title h2 { margin: 1px 0 0; font-size: 19px; line-height: 1.05; }
.section-title small { color: var(--muted); font-size: 10px; }
.recent-list { display: grid; gap: 4px; padding: 7px; }
.recent-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  padding: 4px 9px;
  border-radius: 9px;
  color: #082858;
  background: #fff;
}
.recent-row > div:first-child { min-width: 0; }
.recent-row time { display: block; color: #51709c; font-size: 8px; }
.recent-row .mini-equation { display: flex; align-items: center; gap: 3px; }
.recent-row .mini-equation b { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; color: #fff; background: #075cff; font-family: var(--font-display); font-size: 11px; }
.recent-row .mini-equation b:nth-child(2) { background: #009eb9; }
.recent-row .mini-equation b:nth-child(3) { background: #ff5b2e; }
.recent-row > strong { color: #d92b16; font-family: var(--font-display); font-size: 19px; }
.empty { color: var(--muted); text-align: center; }
.recent-panel .empty { color: #fff; }

.replay-shell { margin-top: 14px; }
.replay-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  margin-bottom: 8px;
  padding: 5px 12px;
  border-left: 6px solid #ff5b2e;
  color: #fff;
  background: linear-gradient(95deg, #003da9, #075cff 72%, #00a9c8);
  border-radius: 11px;
  box-shadow: 0 8px 18px rgba(0, 55, 164, .18);
}
.replay-heading > div { display: flex; align-items: baseline; gap: 10px; }
.replay-heading .eyebrow { color: #a9f4ff; }
.replay-heading h1 { margin: 0; font-size: 25px; line-height: 1; }
.replay-heading p { display: none; }
.history-badge { flex: 0 0 auto; padding: 4px 9px; border-radius: 999px; color: #8e1d0a; background: #fff; font-size: 10px; font-weight: 850; }
.replay-controls {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr .75fr auto auto;
  gap: 8px;
  padding: 11px;
  border-top: 5px solid #00cfe8;
  box-shadow: 0 10px 24px rgba(0, 60, 166, .1);
}
.replay-controls label { display: grid; gap: 3px; color: var(--muted); font-size: 10px; font-weight: 750; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 9px; background: var(--white); padding: 8px 10px; }
input, select { min-height: 38px; }
button, .primary-button, .ghost-button { min-height: 38px; border-radius: 10px; cursor: pointer; font-weight: 850; }
.primary-button {
  display: inline-grid;
  place-items: center;
  padding: 8px 15px;
  border: 1px solid transparent;
  color: #fff;
  background: linear-gradient(125deg, #075cff, #00a9c8);
  text-decoration: none;
  box-shadow: 0 7px 14px rgba(0, 84, 220, .2);
}
.ghost-button { padding: 8px 13px; border: 1px solid #075cff; color: var(--blue-deep); background: var(--white); }
button:disabled { opacity: .48; cursor: not-allowed; }
.control-status { min-height: 18px; margin: 5px 8px; color: var(--muted); font-size: 10px; }
.timeline-panel { padding: 12px; overflow: hidden; border: 0; color: #fff; background: linear-gradient(120deg, #032962, #004bbf 70%, #007d9c); }
.transport { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.transport button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 78px; padding: 6px 10px; border: 1px solid #9ec5ff; color: #003789; background: #fff; }
.transport .play-button { color: #002b68; border-color: #35e8f7; background: #35e8f7; }
.transport .copy-link { min-width: 130px; margin-left: auto; color: #fff; border-color: #61eafb; background: transparent; }
.film-track { display: flex; align-items: stretch; gap: 6px; margin: 10px -12px 0; padding: 6px 12px 10px; overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-color: #35e8f7 transparent; }
.film-frame { position: relative; flex: 0 0 88px; min-height: 60px; padding: 9px 7px; border: 1px solid rgba(255,255,255,.34); border-radius: 9px; color: #fff; background: rgba(255,255,255,.1); text-align: left; cursor: pointer; }
.film-frame::before, .film-frame::after { content: ""; position: absolute; left: 7px; right: 7px; height: 2px; background: repeating-linear-gradient(90deg, rgba(255,255,255,.5) 0 6px, transparent 6px 11px); }
.film-frame::before { top: 4px; }
.film-frame::after { bottom: 4px; }
.film-frame b { display: block; margin-top: 4px; font-family: var(--font-display); font-size: 12px; }
.film-frame small { color: #bbdfff; font-size: 9px; }
.film-frame[aria-current="true"] { color: #00337f; border-color: #fff; background: #fff; transform: translateY(-2px); box-shadow: 0 6px 14px rgba(0, 18, 70, .28); }
.film-frame[aria-current="true"] small { color: #1d6691; }
.gap-marker { flex: 0 0 80px; display: grid; place-items: center; border: 1px dashed #ff9b84; border-radius: 9px; color: #fff; background: rgba(255, 91, 46, .24); font-size: 10px; text-align: center; white-space: pre-line; }
.timeline-note { margin: 4px 2px 0; color: #c5e5ff; font-size: 10px; }

.cursor-grid { display: grid; grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr); gap: 12px; margin-top: 12px; }
.cursor-result, .trend-panel, .omission-panel, .streak-panel { padding: 16px; }
.cursor-result { border-top: 6px solid #ff5b2e; }
.trend-panel { border-top: 6px solid #00cfe8; }
.omission-panel { border-top: 6px solid #075cff; }
.streak-panel { border-top: 6px solid #ff5b2e; }
.cursor-time { margin: 12px 0 1px; color: var(--muted); font-size: 10px; }
.cursor-result h2 { margin: 0; font-size: 19px; }
.replay-equation b, .replay-equation em { width: 44px; height: 46px; font-size: 23px; }
.replay-equation em { width: 55px; }
.sample-boundary { display: grid; gap: 1px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.sample-boundary span, .sample-boundary small { color: var(--muted); font-size: 10px; }
.mini-trend { display: flex; align-items: flex-end; gap: 5px; min-height: 170px; margin-top: 12px; padding: 12px 4px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.trend-point { flex: 1 0 27px; display: grid; align-content: end; justify-items: center; height: 145px; gap: 4px; }
.trend-point i { width: 72%; min-height: 4px; border-radius: 6px 6px 1px 1px; background: linear-gradient(#00cfe8, #075cff); }
.trend-point b { font-family: var(--font-display); font-size: 10px; }
.trend-point small { color: var(--muted); font-size: 8px; transform: rotate(-35deg); }
.trend-point i.trend-sum-0, .trend-point i.trend-sum-1 { height: 4px; }
.trend-point i.trend-sum-2 { height: 9px; }.trend-point i.trend-sum-3 { height: 13px; }.trend-point i.trend-sum-4 { height: 17px; }.trend-point i.trend-sum-5 { height: 22px; }.trend-point i.trend-sum-6 { height: 26px; }.trend-point i.trend-sum-7 { height: 31px; }.trend-point i.trend-sum-8 { height: 35px; }.trend-point i.trend-sum-9 { height: 39px; }.trend-point i.trend-sum-10 { height: 44px; }.trend-point i.trend-sum-11 { height: 48px; }.trend-point i.trend-sum-12 { height: 52px; }.trend-point i.trend-sum-13 { height: 57px; }.trend-point i.trend-sum-14 { height: 61px; }.trend-point i.trend-sum-15 { height: 66px; }.trend-point i.trend-sum-16 { height: 70px; }.trend-point i.trend-sum-17 { height: 74px; }.trend-point i.trend-sum-18 { height: 79px; }.trend-point i.trend-sum-19 { height: 83px; }.trend-point i.trend-sum-20 { height: 87px; }.trend-point i.trend-sum-21 { height: 92px; }.trend-point i.trend-sum-22 { height: 96px; }.trend-point i.trend-sum-23 { height: 101px; }.trend-point i.trend-sum-24 { height: 105px; }.trend-point i.trend-sum-25 { height: 109px; }.trend-point i.trend-sum-26 { height: 114px; }.trend-point i.trend-sum-27 { height: 118px; }
.analysis-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr); gap: 12px; margin-top: 12px; }
.omission-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 12px; }
.omission-cell { display: grid; place-items: center; min-height: 54px; border-radius: 10px; color: #053177; background: #dcebff; }
.omission-cell:nth-child(3n+2) { color: #006a80; background: #d6fbff; }
.omission-cell:nth-child(3n) { color: #a32110; background: #ffe2d8; }
.omission-cell b { font-family: var(--font-display); font-size: 12px; }
.omission-cell strong { font-size: 15px; }
.omission-cell[data-hit="true"] { color: #fff; background: #075cff; }
.boundary-copy { margin: 10px 0 0; color: var(--muted); font-size: 10px; }
.streak-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; margin-top: 12px; }
.streak-card { padding: 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--soft-blue); }
.streak-card:nth-child(even) { background: var(--soft-orange); }
.streak-card span { display: block; color: var(--muted); font-size: 9px; }
.streak-card strong { color: var(--blue-deep); font-family: var(--font-display); font-size: 19px; }
.streak-card small { color: var(--muted); font-size: 10px; }
.summary-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-top: 11px; }
.summary-strip div { padding: 8px; border-radius: 9px; color: #063982; background: var(--soft-cyan); text-align: center; }
.summary-strip b { display: block; font-family: var(--font-display); font-size: 16px; }
.summary-strip small { color: inherit; font-size: 8px; }

.site-footer { display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 18px max(16px, calc((100vw - var(--max)) / 2)); border-top: 5px solid #00cfe8; color: #fff; background: #003b9f; font-size: 11px; }
.site-footer p { margin: 0; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 14px; }
.site-footer nav a { color: #fff; text-decoration: none; font-weight: 750; }
.footer-brand strong { color: #fff; font-size: 15px; }
.footer-brand small { color: #b9edff; }

.narrow-main { width: min(860px, calc(100% - 28px)); }
.page-intro { margin: 24px 0 12px; padding: 18px 20px; border-left: 7px solid #ff5b2e; border-radius: 16px; color: #fff; background: linear-gradient(105deg, #003da9, #075cff 70%, #00a9c8); box-shadow: var(--shadow); }
.page-intro .eyebrow { color: #a9f4ff; }
.page-intro h1 { margin: 2px 0; font-size: clamp(28px, 5vw, 42px); }
.page-intro p { margin: 4px 0 0; color: #e5f6ff; }
.scratch-card { padding: 18px; border-top: 7px solid #00cfe8; }
.scratch-board { position: relative; min-height: 330px; margin-top: 14px; overflow: hidden; border: 3px solid #075cff; border-radius: 19px; background: #fff url('/assets/scratch-orbits.png') center / cover no-repeat; touch-action: none; box-shadow: 0 14px 28px rgba(0, 70, 190, .18); }
.scratch-result { position: absolute; inset: 0; z-index: 0; display: grid; place-content: center; justify-items: center; padding: 26px; text-align: center; }
.scratch-result > span { color: #355b8e; font-size: 13px; }
.scratch-result > span b { color: #004ed8; }
.scratch-equation b, .scratch-equation em { width: 60px; height: 64px; font-size: 31px; }
.scratch-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 14px; }
.scratch-board canvas { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; cursor: crosshair; }
.scratch-card[data-state="locked"] .scratch-board { filter: grayscale(.76); }

.chat-main { width: min(980px, calc(100% - 24px)); margin: 14px auto; }
.chat-main::before { content: ""; position: fixed; z-index: -1; inset: 0; background: linear-gradient(135deg, #d8eaff, #d6fbff 54%, #ffe2d8); }
html[data-theme="dark"] .chat-main::before { background: linear-gradient(135deg, #021a49, #043b66 54%, #4d2b3e); }
.chat-shell { min-height: calc(100vh - 28px); overflow: hidden; border: 2px solid #075cff; }
.chat-header { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; padding: 13px 16px; color: #fff; background: linear-gradient(100deg, #00399e, #075cff 58%, #00a9c8); }
.return-button { padding: 8px 11px; border: 1px solid #fff; border-radius: 9px; color: #003b9f; background: #fff; text-decoration: none; font-size: 12px; font-weight: 850; }
.chat-brand { justify-self: center; }
.chat-brand strong { color: #fff; }
.connection-pill { display: flex; align-items: center; gap: 6px; color: #e5f6ff; font-size: 10px; }
.connection-pill > span { width: 8px; height: 8px; border-radius: 50%; background: #ff9b31; }
.connection-pill[data-state="connected"] > span { background: #42f2bf; }
.connection-pill[data-state="offline"] > span { background: #ff6d7c; }
.connection-pill button { min-height: 28px; border: 0; color: #8ef5ff; background: transparent; }
.chat-body { display: grid; grid-template-columns: 190px 1fr; min-height: calc(100vh - 226px); }
.chat-profile { display: grid; align-content: start; justify-items: center; gap: 10px; padding: 22px 14px; border-right: 1px solid var(--line); background: var(--soft-cyan); }
.profile-avatar { display: grid; place-items: center; width: 82px; height: 82px; overflow: hidden; border: 4px solid #fff; border-radius: 50%; box-shadow: var(--shadow); }
.profile-avatar img, .chat-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-profile label { width: 100%; color: var(--muted); font-size: 10px; }
.chat-profile small { color: var(--muted); text-align: center; }
.chat-messages { max-height: calc(100vh - 226px); padding: 16px; overflow-y: auto; }
.chat-message { display: grid; grid-template-columns: 40px 1fr; gap: 9px; margin-bottom: 13px; }
.chat-avatar { width: 40px; height: 40px; overflow: hidden; border-radius: 50%; background: var(--soft-blue); }
.chat-message header { display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.chat-message header b { font-family: var(--font-display); font-size: 12px; }
.chat-message header b[data-admin="true"]::after { content: "大厅管理"; margin-left: 5px; padding: 2px 5px; border-radius: 999px; color: #fff; background: #ff5b2e; font-family: var(--font-body); font-size: 8px; }
.chat-message header time { color: var(--muted); font-size: 9px; }
.chat-message p { display: inline-block; max-width: min(620px, 100%); margin: 3px 0 0; padding: 8px 11px; border-radius: 4px 13px 13px; background: var(--soft-blue); white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-message:nth-child(3n+2) p { background: var(--soft-cyan); }
.chat-message:nth-child(3n+3) p { background: var(--soft-orange); }
.chat-compose { display: grid; grid-template-columns: 1fr auto; gap: 9px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--soft-blue); }
.chat-compose textarea { resize: none; }
.chat-error { min-height: 18px; margin: 0; padding: 0 16px 8px; color: var(--danger); font-size: 10px; }

.content-main { width: min(1040px, calc(100% - 28px)); }
.content-hero { margin: 24px 0 12px; padding: 22px 26px; border-left: 8px solid #ff5b2e; border-radius: 17px; color: #fff; background: linear-gradient(105deg, #00399e, #075cff 65%, #00a9c8); box-shadow: var(--shadow); }
.content-hero .eyebrow, .content-hero p { color: #c8f7ff; }
.content-hero h1 { margin: 3px 0 6px; font-size: clamp(28px, 4vw, 42px); line-height: 1.08; }
.content-hero p { max-width: 760px; margin: 0; }
.prose-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.info-card { padding: 19px; border-top: 5px solid #075cff; }
.info-card:nth-child(3n+2) { border-top-color: #00cfe8; }
.info-card:nth-child(3n) { border-top-color: #ff5b2e; }
.info-card h2 { margin: 0 0 6px; color: var(--blue-deep); font-size: 20px; }
.info-card h3 { color: var(--blue-deep); }
.info-card p, .info-card li { color: var(--muted); }
.info-card a { color: var(--blue); font-weight: 800; }
.info-card ul, .info-card ol { padding-left: 20px; }
.notice-card { grid-column: 1 / -1; color: #fff; border: 0; background: linear-gradient(100deg, #00399e, #007fa4); }
.notice-card h2, .notice-card p, .notice-card li { color: #fff; }
.route-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.route-links a { padding: 10px; border-radius: 10px; color: #003b9f; background: #d6fbff; text-decoration: none; }
.not-found { width: min(590px, calc(100% - 28px)); margin: 12vh auto; padding: 48px 26px; border: 3px solid #075cff; text-align: center; }
.not-found h1 { margin: 7px 0; font-size: clamp(29px, 6vw, 46px); }
.not-found p { color: var(--muted); }
.not-found .primary-button { display: inline-grid; margin-top: 14px; }

@media (max-width: 940px) {
  .site-header { grid-template-columns: 1fr auto; gap: 7px 12px; }
  .site-nav { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; }
  .top-grid, .cursor-grid, .analysis-grid { grid-template-columns: 1fr; }
  .top-grid { min-height: 0; }
  .replay-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .replay-controls button { align-self: end; }
  .site-footer { flex-wrap: wrap; }
  .chat-header { grid-template-columns: auto 1fr; }
  .connection-pill { grid-column: 1 / -1; }
  .chat-body { grid-template-columns: 150px 1fr; }
}

@media (max-width: 600px) {
  html { scroll-padding-top: 112px; }
  body:not([data-page="scratch"]):not([data-page="chat"])::before { top: 100px; height: 560px; background-position: 61% top; }
  body:not([data-page="scratch"]):not([data-page="chat"])::after { top: 100px; background: linear-gradient(180deg, transparent 0 400px, #eef7ff 610px 100%); }
  .site-header { gap: 6px 8px; padding: 6px 9px 7px; border-bottom-width: 3px; }
  .site-header > .brand img { width: 35px; height: 35px; }
  .brand strong { font-size: 18px; }
  .brand small { max-width: 142px; overflow: hidden; text-overflow: ellipsis; }
  .theme-toggle { width: 35px; height: 35px; }
  .site-nav { gap: 4px; }
  .site-nav a { flex: 1 1 0; justify-content: center; gap: 4px; min-width: 0; min-height: 36px; padding: 5px 4px; font-size: 11px; }
  .nav-glyph { width: 17px; height: 17px; }
  .nav-glyph svg { width: 16px; height: 16px; }
  main { width: min(100% - 16px, var(--max)); margin-top: 8px; }
  .top-grid { gap: 8px; }
  .live-panel, .recent-panel { min-height: auto; }
  .live-panel { padding: 12px 12px 10px; border-top-width: 5px; }
  .live-main { display: grid; grid-template-columns: minmax(0, 1fr) 87px; align-items: start; gap: 7px; margin-top: 8px; }
  .equation { gap: 2px; }
  .equation b, .equation em { width: clamp(31px, 9.3vw, 38px); height: clamp(38px, 11vw, 44px); border-width: 1px; font-size: 22px; }
  .equation em { width: clamp(39px, 11vw, 46px); border-radius: 13px; }
  .equation i { font-size: 12px; }
  .countdown-box { width: 100%; min-width: 0; padding: 10px 4px; box-shadow: 4px 4px 0 #d6fbff; }
  .countdown-box strong { font-size: 24px; }
  .classification-row { margin-top: 8px; }
  .classification-row > b { padding: 2px 6px; font-size: 8px; }
  .tag-row { min-height: 0; }
  .tag-row span { padding: 2px 6px; font-size: 9px; }
  .live-meta { margin-top: 7px; }
  .recent-panel > .section-title { min-height: 42px; padding: 7px 11px; }
  .recent-list { gap: 3px; padding: 5px; }
  .recent-row { min-height: 33px; padding: 3px 7px; }
  .recent-row .mini-equation b { width: 18px; height: 18px; font-size: 10px; }
  .recent-row > strong { font-size: 17px; }
  .recent-list .recent-row:nth-child(n+5) { display: none; }
  .replay-shell { margin-top: 8px; }
  .replay-heading { min-height: 39px; padding: 5px 9px; }
  .replay-heading > div { gap: 6px; }
  .replay-heading .eyebrow { display: none; }
  .replay-heading h1 { font-size: 21px; }
  .history-badge { font-size: 9px; }
  .replay-controls { grid-template-columns: 1fr 1fr; gap: 7px; padding: 9px; }
  .replay-controls label:first-child { grid-column: 1 / -1; }
  .replay-controls button { padding-inline: 6px; font-size: 11px; }
  .timeline-panel { padding: 9px; }
  .transport { display: grid; grid-template-columns: repeat(4, 1fr); }
  .transport button { min-width: 0; padding: 5px 3px; font-size: 11px; }
  .transport button span { display: none; }
  .transport .copy-link { grid-column: 1 / -1; width: 100%; margin: 0; }
  .film-track { margin-inline: -9px; padding-inline: 9px; }
  .cursor-result, .trend-panel, .omission-panel, .streak-panel { padding: 13px; }
  .omission-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .streak-list { grid-template-columns: 1fr 1fr; }
  .site-footer { padding: 15px 10px; }
  .site-footer p { order: 3; width: 100%; }
  .footer-brand small { display: none; }
  .content-main { width: min(100% - 16px, 1040px); }
  .content-hero { margin-top: 10px; padding: 19px 16px; }
  .content-hero h1 { font-size: 28px; }
  .prose-grid { grid-template-columns: 1fr; gap: 8px; }
  .info-card { padding: 16px; }
  .notice-card { grid-column: auto; }
  .route-links { grid-template-columns: 1fr; }
  .scratch-card { padding: 10px; }
  .scratch-board { min-height: 292px; }
  .scratch-equation b, .scratch-equation em { width: 43px; height: 49px; font-size: 23px; }
  .chat-main { width: 100%; margin: 0; }
  .chat-shell { min-height: 100vh; border: 0; border-radius: 0; }
  .chat-header { grid-template-columns: 1fr auto; padding: 9px; }
  .return-button { grid-column: 1 / -1; grid-row: 1; justify-self: start; }
  .chat-brand { grid-row: 2; justify-self: start; }
  .chat-brand small { display: none; }
  .connection-pill { grid-column: 2; grid-row: 2; }
  .chat-body { display: block; }
  .chat-profile { display: grid; grid-template-columns: 56px 1fr; align-items: center; justify-items: stretch; gap: 8px; padding: 9px; border-right: 0; border-bottom: 1px solid var(--line); }
  .profile-avatar { grid-row: 1 / 3; width: 56px; height: 56px; }
  .chat-profile small { text-align: left; }
  .chat-messages { max-height: calc(100vh - 290px); min-height: 310px; padding: 10px; }
  .chat-compose { padding: 9px; }
}

@media (max-width: 340px) {
  .brand small { max-width: 118px; }
  .site-nav a { font-size: 10px; }
  .nav-glyph { display: none; }
  .live-main { grid-template-columns: 1fr; }
  .countdown-box { grid-template-columns: 1fr auto 1fr; align-items: center; text-align: left; }
  .countdown-box strong { text-align: center; }
  .countdown-box span { text-align: right; }
  .replay-controls { grid-template-columns: 1fr; }
  .replay-controls label:first-child { grid-column: auto; }
  .summary-strip { grid-template-columns: 1fr; }
}

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