/* Space Galaxy. Light blue page, deep-blue sky. No inline styles: the site CSP
   drops them. */
:root {
  color-scheme: light;
  --page: #d5e4f5;
  --page2: #bcd2ec;
  --panel: #f5f9fe;
  --ink: #12294a;
  --soft: #3c5477;
  --line: #a9c3e2;
  --blue: #1d5fb4;
  --blue-d: #154a90;
  --sky: #10265a;
  --focus: #0b57d0;
  --r: 14px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  font: 16px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, var(--page), var(--page2)) fixed;
}
h1, h2, h3, p, dl, dd, ul { margin: 0; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.topbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px;
  padding: 10px 20px;
  background: rgba(245, 249, 254, .86);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { font: 800 1.4rem/1.1 Syne, Inter, sans-serif; letter-spacing: -.01em; }
.sub { color: var(--soft); font-size: .88rem; line-height: 1.3; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.btn {
  font-family: inherit; font-weight: 600; font-size: .94rem; line-height: 1.2;
  min-height: 40px; padding: 8px 16px;
  color: var(--ink); background: #fff;
  border: 1px solid #7d9cc4; border-radius: 10px;
  cursor: pointer; touch-action: manipulation;
}
.btn:hover:not(:disabled) { background: #e6f0fc; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { color: #5b6f8c; background: #e4ecf6; border-color: #b9c9de; cursor: default; }
.btn--go { color: #fff; background: linear-gradient(180deg, #2a75d6, var(--blue-d)); border-color: #123f7b; min-height: 46px; padding: 10px 26px; font-size: 1.04rem; font-weight: 700; }
.btn--go:hover:not(:disabled) { background: linear-gradient(180deg, #2268c4, #103d79); }

.layout { display: flex; justify-content: center; padding: 12px 20px 8px; }

/* the instructions, sliding in from the right */
.help {
  position: fixed; inset: 0 0 0 auto; margin: 0; padding: 0;
  width: min(440px, 100vw); height: 100dvh; max-width: none; max-height: none;
  border: 0; border-left: 1px solid var(--line);
  color: var(--ink); background: var(--panel);
  box-shadow: -18px 0 50px rgba(8, 24, 64, .35);
  overflow-y: auto; overscroll-behavior: contain;
}
.help::backdrop { background: rgba(10, 28, 72, .45); }
.help[open] { animation: slide-in .26s cubic-bezier(.2, .8, .3, 1); }
@keyframes slide-in { from { transform: translateX(100%); } }
.help-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.help-head h2 { font: 800 1.3rem/1.15 Syne, Inter, sans-serif; }
.help-body { padding: 4px 20px 28px; }
.help h3 { font-size: 1.04rem; font-weight: 700; margin: 18px 0 6px; }
.help p { font-size: .95rem; color: #24405f; }
.help p + p { margin-top: 8px; }
.keys div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px solid #dbe7f5; font-size: .9rem; }
.keys dd { text-align: right; color: #24405f; }
.keys + p { margin-top: 10px; }
kbd { font: 600 .8rem/1 "JetBrains Mono", ui-monospace, monospace; display: inline-block; padding: 3px 6px; background: #e4eefb; border: 1px solid #a9c3e2; border-radius: 5px; color: var(--ink); }
.check { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; min-height: 28px; font-size: .93rem; font-weight: 600; }
.check input { width: 20px; height: 20px; accent-color: var(--blue); }

.guide { list-style: none; padding: 0; display: grid; gap: 8px; }
.guide li { display: grid; grid-template-columns: 72px 1fr; gap: 12px; align-items: center; }
.guide canvas { width: 72px; height: 72px; border-radius: 12px; background: radial-gradient(circle at 50% 35%, #2b4f9c, #122a5f); }
.guide h4 { margin: 0; font-size: .97rem; font-weight: 700; line-height: 1.25; }
.guide p { font-size: .88rem; line-height: 1.35; }
.pts { font: 600 .8rem/1 "JetBrains Mono", ui-monospace, monospace; color: var(--blue-d); margin-left: 2px; }

/* app.ts sets the exact width and shape (fit); this is close, so little moves. */
.stage { display: flex; flex-direction: column; gap: 8px; width: min(100%, calc((100dvh - 168px) * 1.5)); max-width: 100%; }
.hud { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 14px; padding: 8px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
.cell { display: flex; flex-direction: column; min-width: 44px; }
.k { font-size: .75rem; line-height: 1.3; color: var(--soft); font-weight: 600; }
.v { font: 700 1.02rem/1.25 "JetBrains Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pips { display: flex; gap: 4px; min-height: 20px; align-items: center; }
.pip { width: 12px; height: 14px; border-radius: 3px 3px 7px 7px; border: 1.5px solid #5d7ba6; background: #fff; }
.pip.is-on { background: #1f74d8; border-color: #134f9c; }
.pips--pulse .pip { border-radius: 50%; height: 12px; }
.pips--pulse .pip.is-on { background: #7a45d6; border-color: #55269f; }
progress { width: 48px; height: 6px; appearance: none; border: 0; background: #cfdcee; border-radius: 3px; overflow: hidden; }
progress::-webkit-progress-bar { background: #cfdcee; border-radius: 3px; }
progress::-webkit-progress-value { background: #7a45d6; }
progress::-moz-progress-bar { background: #7a45d6; }

.screen { position: relative; aspect-ratio: 3 / 2; border-radius: 18px; overflow: hidden; background: var(--sky); border: 3px solid #f5f9fe; box-shadow: 0 0 0 1px #7d9cc4, 0 14px 34px rgba(20, 50, 100, .28); container-type: inline-size; }
.screen canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; user-select: none; -webkit-user-select: none; }
.screen canvas:focus-visible { outline: 2px solid #9fd2ff; outline-offset: -2px; border-radius: 15px; }

.banner { position: absolute; inset: 24% 0 auto; display: grid; justify-items: center; gap: 2px; padding: 0 12px; text-align: center; color: #fff; pointer-events: none; opacity: 0; transition: opacity .35s; text-shadow: 0 2px 10px #071536, 0 0 3px #071536; }
.banner.is-on { opacity: 1; }
#bannerTitle { font: 800 clamp(1.5rem, 8cqi, 2.7rem)/1.1 Syne, Inter, sans-serif; }
#bannerSub { font-weight: 600; font-size: clamp(.9rem, 3.4cqi, 1.1rem); color: #dcebff; }

.pulse-btn { display: none; position: absolute; right: 12px; bottom: 12px; width: 76px; height: 76px; border-radius: 50%; border: 2px solid #e4d8ff; background: rgba(84, 46, 168, .82); color: #fff; font-family: inherit; font-weight: 700; font-size: .95rem; touch-action: manipulation; }
@media (pointer: coarse) { body[data-mode="play"] .pulse-btn { display: block; } }

.veil { position: absolute; inset: 0; display: grid; place-items: center; padding: 14px; overflow: auto; background: rgba(12, 30, 76, .38); }
.card { width: min(100%, 420px); max-height: 100%; overflow: auto; display: grid; gap: 12px; justify-items: center; text-align: center; padding: 20px; border-radius: 16px; background: rgba(245, 249, 254, .97); color: var(--ink); box-shadow: 0 14px 40px rgba(6, 18, 52, .45); }
.card h2 { font: 800 1.5rem/1.15 Syne, Inter, sans-serif; }
.card p { color: #24405f; }
.veil:has(#title:not([hidden])) { background: linear-gradient(180deg, rgba(10, 24, 66, .1), rgba(10, 24, 66, .2)); place-items: start center; }
.card--title { background: none; box-shadow: none; padding: min(8cqi, 40px) 8px 8px; color: #fff; gap: 14px; min-height: 100%; width: min(100%, 560px); grid-template-rows: auto auto 1fr; }
.logo { font: 800 clamp(2.4rem, 14cqi, 4.4rem)/.95 Syne, Inter, sans-serif; letter-spacing: -.03em; text-shadow: 0 4px 22px rgba(4, 14, 50, .9); }
.card--title .logo { color: #fff; }
.logo b { color: #8feaff; font-weight: 800; }
.card--title .btn:focus-visible { outline-color: #fff; }
.row--title { align-self: end; margin-bottom: min(6cqi, 34px); }
.card--title .btn--go { min-width: 150px; }
.btn--big { min-height: 46px; padding: 10px 20px; font-size: 1.04rem; font-weight: 700; }
fieldset { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; min-width: 0; width: 100%; }
legend { padding: 0 0 8px; margin: 0 auto; text-align: center; font-weight: 700; color: #fff; text-shadow: 0 1px 8px #071536; }
fieldset label { position: relative; cursor: pointer; }
fieldset input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
fieldset span { display: grid; align-content: start; height: 100%; padding: 8px 6px; border-radius: 12px; border: 2px solid #86a8d8; background: rgba(245, 249, 254, .94); color: var(--ink); font-weight: 700; line-height: 1.25; }
fieldset small { font-weight: 500; font-size: .78rem; color: #35507a; }
fieldset input:checked + span { border-color: #ffd66b; background: #fff7dc; box-shadow: 0 0 0 2px #ffd66b; }
fieldset input:focus-visible + span { outline: 3px solid #fff; outline-offset: 3px; }
.row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.opts { display: grid; gap: 10px; width: 100%; }
.opt { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 14px; text-align: left; padding: 12px 14px; min-height: 64px; font: inherit; color: var(--ink); background: #fff; border: 2px solid #86a8d8; border-radius: 12px; cursor: pointer; touch-action: manipulation; }
.opt:hover { border-color: var(--blue-d); background: #eaf2fd; }
.opt b { display: block; font-size: 1rem; }
.opt small { display: block; font-size: .88rem; line-height: 1.35; color: #24405f; }
.stats { width: 100%; }
.stats div { display: flex; justify-content: space-between; padding: 4px 2px; border-bottom: 1px solid #dbe7f5; }
.stats dt { color: #24405f; }
.stats dd { font: 700 1rem/1.5 "JetBrains Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }

.foot { padding: 10px 20px 24px; text-align: center; font-size: .88rem; color: #24405f; }

@media (max-width: 680px) {
  .layout { padding: 8px 12px; }
  .topbar { padding: 8px 12px; }
  .sub { display: none; }
  .brand img { display: none; }
  .brand h1 { font-size: 1.02rem; }
  .btn { padding: 8px 12px; }
  .screen { aspect-ratio: 3 / 4; }
  .hud { padding: 6px 10px; gap: 2px 8px; flex-wrap: nowrap; }
  .hud .cell:nth-child(2) { display: none; }
  .cell { min-width: 0; }
  .k { font-size: .72rem; }
  .v { font-size: .88rem; }
  .pips { gap: 2px; }
  .pip { width: 9px; height: 11px; }
  .pips--pulse .pip { height: 9px; }
  progress { width: 34px; }
  .topbar { gap: 8px; }
  .actions { display: contents; }
  .actions .site-back { order: 1; }
  .actions .btn { order: 2; flex: 1 1 0; padding: 8px 6px; white-space: nowrap; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .topbar { padding: 4px 12px; }
  .sub { display: none; }
  .brand img { width: 28px; height: 28px; }
  .brand h1 { font-size: 1.05rem; }
  .btn { min-height: 34px; padding: 4px 12px; }
  .layout { padding: 6px 12px; }
  .hud { padding: 3px 10px; flex-wrap: nowrap; gap: 8px; }
  .hud .cell:nth-child(2) { display: none; }
  .cell { min-width: 0; }
  .pip { width: 9px; height: 11px; }
  .pips { gap: 2px; min-height: 16px; }
  .pips--pulse .pip { height: 9px; }
  progress { width: 34px; }
  .row--title { margin-bottom: 8px; }
  .card--title .btn--go, .btn--big { min-height: 38px; padding: 6px 16px; }
  .logo { font-size: 1.9rem; }
  .card--title { gap: 8px; padding-top: 8px; }
  fieldset small { display: none; }
}
@media (prefers-reduced-motion: reduce) { .help[open] { animation: none; } .banner { transition: none; } .btn:active { transform: none; } }
