:root {
  --ink: #f4f7fb;
  --dim: #c5d0df;
  --panel: rgba(12, 18, 32, 0.82);
  --line: rgba(255, 255, 255, 0.16);
  --green: #1faf86;
  --amber: #f0b429;
  --red: #e23d4a;
  --paper: #f7f1e4;
  --paper-ink: #1c2430;
  --ui: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic", sans-serif;
  --display: "Dela Gothic One", "Zen Kaku Gothic New", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: #121826; color: var(--ink); font-family: var(--ui); }
body { overflow: hidden; }
button, a { font-family: inherit; }
canvas#view {
  position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none;
}
.frame {
  pointer-events: none; position: fixed; inset: 0; z-index: 3;
  box-shadow: inset 0 0 0 7px #0e1218, inset 0 0 80px rgba(0, 0, 0, 0.38);
}
.top {
  position: fixed; z-index: 6; top: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 10px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  background: linear-gradient(to bottom, rgba(8, 10, 16, 0.72), transparent);
}
.home { color: var(--dim); text-decoration: none; font-size: 13px; }
.home:hover { color: white; }
.brand { margin: 0 auto; font-size: 13px; letter-spacing: 0.12em; color: #d5fff3; }
.brand span { margin-left: 8px; color: var(--amber); letter-spacing: 0.18em; }
.pill, .ghost, .go, .act, .door {
  border: 0; cursor: pointer; color: inherit;
}
.pill {
  background: rgba(255, 255, 255, 0.12); color: white; border-radius: 999px;
  padding: 6px 10px; font-size: 12px;
}
.hud {
  position: fixed; z-index: 5; top: calc(46px + env(safe-area-inset-top)); left: 12px; right: 12px;
  display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: flex-end;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
}
.hud__station { font-size: 13px; }
.hud__station b { font-family: var(--display); font-size: 28px; font-weight: 400; letter-spacing: 0.04em; }
.hud__clock, .hud__score, .hud__pinch { margin: 0; font-size: 14px; }
.hud__score b { font-size: 20px; }
.hud__pinch i {
  display: inline-block; width: 10px; height: 10px; margin-left: 4px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.28); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}
.hud__pinch i.on { background: var(--red); }
.banner, .toast {
  position: fixed; z-index: 7; left: 50%; transform: translateX(-50%);
  margin: 0; padding: 8px 16px; border-radius: 999px; font-weight: 700;
}
.banner { top: calc(96px + env(safe-area-inset-top)); background: var(--amber); color: #241a04; font-size: 18px; }
.banner.is-pinch { background: var(--red); color: white; }
.toast { bottom: calc(128px + env(safe-area-inset-bottom)); background: rgba(10, 14, 22, 0.88); font-size: 14px; }
.screen {
  position: fixed; inset: 0; z-index: 8; display: grid; align-items: end; justify-items: start;
  padding: calc(58px + env(safe-area-inset-top)) 14px calc(18px + env(safe-area-inset-bottom)) 14px;
  pointer-events: none; overflow: auto;
}
#card.screen { align-items: center; justify-items: center; background: rgba(8, 10, 16, 0.28); }
.panel {
  pointer-events: auto; width: min(420px, 100%);
  max-height: min(78svh, 640px); overflow: auto;
  background: var(--paper); color: var(--paper-ink);
  border-radius: 18px; padding: 22px 20px 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}
.kicker { margin: 0 0 6px; font-size: 12px; letter-spacing: 0.16em; color: #0d7a62; }
h1, h2 { font-family: var(--display); font-weight: 400; letter-spacing: 0.03em; margin: 0 0 8px; line-height: 1.25; }
h1 { font-size: clamp(36px, 8vw, 52px); }
h2 { font-size: clamp(32px, 7vw, 44px); }
.lead, ol, .keys, .best, .result-note, .result-total, .result-delay { font-size: 14.5px; line-height: 1.7; }
.lead { margin: 0 0 8px; }
ol { margin: 0 0 14px; padding-left: 1.2em; }
ol li { margin: 4px 0; }
.go, .ghost, .act {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 16px; border-radius: 12px; text-decoration: none; font-weight: 700;
}
.go { width: 100%; background: #0e8f72; color: white; font-size: 18px; }
.go:hover { background: #0b745d; }
.ghost { background: transparent; color: var(--paper-ink); border: 1.5px solid rgba(28, 36, 48, 0.35); }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.row .go { width: auto; flex: 1; }
.best, .keys, .result-note { color: #5c6774; }
.keys kbd {
  display: inline-block; min-width: 1.4em; padding: 0 4px; border-radius: 4px;
  border: 1px solid #c8c0b2; background: white; font-family: inherit; font-size: 12px;
}
.result-delay { margin: 0; font-size: 18px; }
.result-score { margin: 6px 0; font-size: 16px; }
.result-score b { font-size: 28px; }
.dock {
  position: fixed; z-index: 6; left: 0; right: 0;
  bottom: calc(54px + env(safe-area-inset-bottom));
  padding: 8px 10px 6px;
  background: linear-gradient(to top, rgba(8, 10, 16, 0.88), rgba(8, 10, 16, 0.55));
}
.doors { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.doors::-webkit-scrollbar { display: none; }
.door {
  flex: none; min-width: 58px; min-height: 52px; border-radius: 10px;
  background: rgba(255, 255, 255, 0.12); color: white;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
}
.door b { font-size: 16px; line-height: 1; }
.door small { font-size: 10px; letter-spacing: 0.06em; }
.door.is-wait { background: #a86b12; }
.door.is-gap { background: var(--red); }
.door.is-closing { background: #c49214; }
.door.is-sealed { background: #0e8f72; }
.door.is-rush { background: #c43b78; }
.actions { display: flex; gap: 8px; }
.act { flex: 1; background: rgba(255, 255, 255, 0.14); color: white; }
.act--go { background: #d7dde6; color: #1c2430; }
.act--go.ready { background: var(--amber); color: #241a04; }
.act:disabled { opacity: 0.55; }
.dock-hint { margin: 4px 0 0; font-size: 11px; color: var(--dim); text-align: center; }
.nogl { display: none; position: fixed; inset: auto 16px 80px; z-index: 9; padding: 12px 14px; background: white; color: #1c2430; border-radius: 12px; }
body.nogl .nogl { display: block; }
@media (max-width: 720px) {
  .brand span { display: none; }
  .hud__station b { font-size: 22px; }
  .panel { padding: 16px 14px 14px; }
  h1 { font-size: 34px; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto; }
}
