:root {
  color-scheme: light;
  --ink: #5b2a40;
  --muted: #884962;
  --pink: #ffefec;
  --primary: #893459;
  --edge: #e8bec8;
  font-family: "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; touch-action: none; }
body {
  display: grid;
  grid-template-rows: 68px minmax(0, 1fr) 42px;
  height: 100vh;
  height: 100dvh;
  background: var(--pink) radial-gradient(#d69da9aa .75px, transparent .8px) 0 0 / 19px 19px;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}
button { color: inherit; font: inherit; cursor: pointer; touch-action: none; }
button svg, button img { pointer-events: none; }
button:focus-visible { outline: 3px solid #2d737b; outline-offset: 3px; }
.masthead, .footer { width: min(100% - 64px, 1150px); margin-inline: auto; display: flex; align-items: center; justify-content: space-between; }
.masthead { border-bottom: 1px solid var(--edge); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; line-height: 1.35; }
.brand small { color: var(--muted); font: 700 9px/1.5 system-ui, sans-serif; }
.edition { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; font-weight: 700; }
.edition span, .field-tag i { width: 7px; height: 7px; background: #41908e; transform: rotate(45deg); flex: 0 0 auto; }
.edition b { color: var(--primary); border-left: 1px solid var(--edge); padding-left: 9px; }
.deck { display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); align-items: center; column-gap: clamp(20px, 5vw, 76px); padding: 10px 24px; min-height: 0; }
.stage {
  --max-h: min(850px, calc(100vh - 130px));
  --max-h: min(850px, calc(100dvh - 130px));
  width: min(calc(var(--max-h) * 9 / 16), calc(100vw - 48px));
  aspect-ratio: 9 / 16;
  grid-column: 2;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: #ffc9cb;
  border-radius: 8px;
  box-shadow: 0 0 0 1px #d48ca1, 0 6px 0 #e9b9c2, 0 17px 45px #9b446332;
  container-type: inline-size;
}
#sky, .bezel, .screen { position: absolute; inset: 0; width: 100%; height: 100%; }
#sky { display: block; touch-action: none; }
.bezel { pointer-events: none; z-index: 1; border: 1px solid #fff3ed88; border-radius: inherit; }
.topbar { position: absolute; top: 0; left: 0; right: 0; z-index: 4; display: flex; gap: 5px; align-items: start; justify-content: space-between; padding: 12px; padding: clamp(6px, 3.05cqw, 14px); pointer-events: none; }
.tools { display: flex; gap: 4px; pointer-events: auto; flex-shrink: 0; }
.icon { width: clamp(32px, 10.2cqw, 44px); height: clamp(32px, 10.2cqw, 44px); padding: 0; border: 1px solid #bd789080; border-radius: 8px; background: #fff8f2ef; display: grid; place-items: center; box-shadow: 0 2px 0 #98476030; }
.icon svg { width: clamp(16px, 4.8cqw, 21px); height: auto; }
.icon:hover { background: #fff; }
.icon:active { transform: translateY(1px); }
.sound-off, .resume-icon, #sound[aria-pressed="true"] .sound-on, #pause[aria-pressed="true"] .pause-icon { display: none; }
#sound[aria-pressed="true"] .sound-off, #pause[aria-pressed="true"] .resume-icon { display: inline; }
.field-tag { display: flex; align-items: center; gap: 8px; padding: 5px 9px; min-height: 34px; background: #fff7f0c9; border: 1px solid #fff7f0e6; border-radius: 5px; font-size: 11px; font-weight: 800; line-height: 1.15; }
.field-tag small { display: block; font: 700 8px/1.4 system-ui, sans-serif; color: var(--muted); }
.hud { flex: 1; align-self: stretch; display: grid; grid-template-columns: 1.15fr 1fr .65fr; align-items: center; padding: 3px clamp(3px, 1.75cqw, 8px); background: #fff8f2f2; border: 1px solid #bd789080; border-radius: 8px; box-shadow: 0 2px 0 #98476030; }
.hud > div { min-width: 0; display: grid; justify-items: center; gap: 1px; }
.hud > div + div { border-left: 1px solid #e7c4cd; }
.hud span { color: var(--muted); font-size: clamp(8px, 2.5cqw, 11px); font-weight: 800; line-height: 1.15; }
.hud strong { font: 850 clamp(10px, 4.5cqw, 19px)/1 ui-monospace, "Cascadia Mono", monospace; }
.hearts { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(1px, .5cqw, 2px); line-height: 1; }
.hearts svg { width: clamp(9px, 3.95cqw, 16px); height: auto; fill: #e56285; stroke: #a63d60; stroke-width: 1.5px; }
.hearts .empty { fill: #f2d6dc; stroke: #c793a2; }
.title { z-index: 2; pointer-events: none; text-align: center; }
.title-lockup { position: absolute; top: 18%; left: 4%; right: 4%; }
.eyebrow { display: flex; align-items: center; justify-content: center; gap: 8px; color: #7e3354; font: 850 clamp(9px, 3.1cqw, 14px)/1.2 system-ui, sans-serif; }
.title .eyebrow span { width: 7%; height: 1px; background: #a24f6c; }
h1 { margin: 4px 0 6px; color: #75304e; font-size: clamp(22px, 12.1cqw, 61px); font-weight: 950; line-height: 1.12; text-shadow: 1px 2px #fff5e9, 0 3px #fff5e9, 0 5px #e69bac88; white-space: nowrap; }
.title-sub { color: #7e3354; font: 800 clamp(8px, 2.7cqw, 12px)/1.2 system-ui, sans-serif; }
.launch { position: absolute; top: 77.4%; left: 0; right: 0; display: grid; justify-items: center; gap: 9px; }
.primary { pointer-events: auto; width: 55%; min-width: 105px; max-width: 236px; min-height: clamp(34px, 12.5cqw, 54px); display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--primary); color: #fffaf5; border: 1px solid #682640; box-shadow: 0 3px 0 #632743, inset 0 1px 0 #ffffff40; border-radius: 7px; padding: 5px 10px; font-size: clamp(13px, 4.65cqw, 20px); font-weight: 900; white-space: nowrap; }
.primary svg { width: 1em; height: 1em; }
.primary:hover { background: #9d3c63; }
.primary:active { transform: translateY(2px); box-shadow: 0 1px 0 #632743; }
.mobile-best { color: #74324e; font-size: clamp(9px, 2.7cqw, 12px); font-weight: 800; text-shadow: 0 1px #fff7f0; }
.mobile-best strong { margin-left: 2px; font-family: ui-monospace, monospace; }
.serial { position: absolute; bottom: 2.55%; left: 6%; right: 6%; display: flex; justify-content: space-between; color: #76324f; font: 800 clamp(7px, 2.5cqw, 10px)/1 system-ui, sans-serif; }
.shade { z-index: 3; display: grid; place-items: center; background: #5c234a57; }
.result { width: 78%; text-align: center; background: #fff6f0; border: 1px solid #c18095; border-radius: 8px; box-shadow: 0 5px 0 #a85b78, 0 12px 32px #511b3c50; padding: clamp(8px, 4.7cqw, 20px) clamp(8px, 5.6cqw, 24px); animation: settle .23s ease-out both; }
@keyframes settle { from { opacity: 0; transform: translateY(8px) scale(.96); } to { opacity: 1; transform: none; } }
.result-mark { display: inline-grid; width: clamp(25px, 11cqw, 48px); aspect-ratio: 1; place-items: center; margin-bottom: 6px; color: var(--primary); }
.result-mark svg, .result-mark img { width: 100%; height: auto; }
.result h2 { margin: 2px 0 10px; font-size: clamp(19px, 7.8cqw, 37px); line-height: 1.15; }
.result .primary { width: 100%; max-width: none; min-width: 0; }
.secondary { background: none; border: 0; padding: 5px 10px; min-height: 32px; color: #793550; font-weight: 800; font-size: clamp(10px, 3.5cqw, 14px); margin-top: 6px; }
.secondary:hover { text-decoration: underline; }
.totals { display: grid; grid-template-columns: 1.3fr 1fr; padding: 5px 0 9px; margin-bottom: 11px; background: #f9e3e5; border: 1px solid #ecc1ca; border-radius: 5px; }
.totals div { min-width: 0; display: grid; gap: 2px; }
.totals div + div { border-left: 1px solid #e4b6c0; }
.totals span { font-size: clamp(9px, 3cqw, 13px); font-weight: 800; color: var(--muted); }
.totals strong { font: 900 clamp(14px, 6.1cqw, 26px)/1.05 ui-monospace, monospace; overflow-wrap: anywhere; }
.rail { width: min(100%, 155px); color: var(--muted); padding: 10px 0; border-block: 1px solid var(--edge); }
.log { justify-self: end; }
.route { justify-self: start; }
.rail-cap, .route-caption { display: flex; justify-content: space-between; align-items: center; gap: 3px; white-space: nowrap; font: 800 10px/1.35 system-ui, sans-serif; }
.log-title { display: flex; align-items: center; gap: 4px; color: var(--ink); font-size: 12px; font-weight: 850; margin-top: 17px; }
.log-title svg { width: 17px; height: 17px; }
.record { font: 900 32px/1.3 ui-monospace, monospace; color: var(--ink); overflow-wrap: anywhere; }
.barcode { height: 8px; width: 44px; margin-top: 9px; background: repeating-linear-gradient(90deg, #b97b8c 0 1px, transparent 1px 3px, #b97b8c 3px 6px, transparent 6px 8px, #b97b8c 8px 9px, transparent 9px 12px); }
.map { display: block; width: 100%; height: auto; margin: 6px 0; }
.route-caption strong { font-size: 12px; color: var(--ink); }
.footer { justify-content: center; gap: 11px; color: var(--muted); font: 800 9px/1 system-ui,sans-serif; }
.footer-line { width: 24px; height: 1px; background: #c68fa1; }
.sr-only { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
@media (max-width: 800px), (max-height: 540px) {
  body { grid-template-rows: minmax(0, 1fr); padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
  .masthead, .footer, .rail { display: none; }
  .deck { grid-template-columns: minmax(0, 1fr); padding: 0; justify-items: center; }
  .stage { --max-h: calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom)); --max-h: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom)); width: min(100%, calc(var(--max-h) * 9 / 16)); grid-column: 1; box-shadow: 0 0 0 1px #d48ca1; border-radius: 4px; }
}
@media (max-height: 350px) and (orientation: landscape) {
  .topbar { padding: 3px; gap: 2px; }
  .icon { width: 25px; height: 25px; border-radius: 4px; }
  .tools { gap: 2px; }
  .launch { gap: 4px; }
}
@media (prefers-reduced-motion: reduce) { .result { animation: none; } }
