:root {
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #05060f;
  color: #eef1ff;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  overflow: hidden;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#scene {
  background: #05060f;
  border-radius: 6px;
  box-shadow: 0 0 0 1px rgba(140, 170, 255, 0.15), 0 20px 60px rgba(0, 0, 0, 0.6);
  cursor: pointer;
}

/* --------------------------------------------------------------------- HUD */

#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

.hud-corner {
  position: absolute;
  padding: 14px 18px;
  pointer-events: auto;
}

.hud-tl { top: 0; left: 0; text-align: left; }
.hud-tr { top: 0; right: 0; text-align: right; }
.hud-bl { bottom: 0; left: 0; text-align: left; }
.hud-br { bottom: 0; right: 0; text-align: right; }

.hud-label {
  font-size: 12px;
  letter-spacing: 0.14em;
  color: #9fb0e0;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

.hud-value {
  font-size: 28px;
  font-weight: 800;
  color: #fff3c4;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.85);
}

.hud-sub {
  font-size: 13px;
  color: #b9c6f0;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

.life-pips {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.life-pip {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #ff6b81;
  background: transparent;
}

.life-pip.full {
  background: #ff6b81;
  box-shadow: 0 0 8px rgba(255, 107, 129, 0.8);
}

/* ------------------------------------------------------------------ Screens */

#screens { position: absolute; inset: 0; pointer-events: none; }

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 4, 12, 0.72);
  pointer-events: auto;
}

/* An author `display` declaration always beats the UA stylesheet's `[hidden] { display:
   none }`, regardless of specificity (author normal > user-agent normal in the cascade) —
   so `.screen { display: flex }` above silently defeated the `hidden` attribute entirely.
   Every screen sat fullscreen with pointer-events:auto at all times, stacked in DOM order,
   intercepting clicks meant for the canvas/HUD underneath. Restore it explicitly. */
.screen[hidden] {
  display: none;
}

.panel {
  max-width: 440px;
  width: min(88vw, 440px);
  padding: 28px 30px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(20, 24, 46, 0.95), rgba(10, 12, 26, 0.95));
  border: 1px solid rgba(140, 170, 255, 0.25);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  text-align: center;
}

.title {
  font-size: 32px;
  margin: 0 0 6px;
  letter-spacing: 0.06em;
  background: linear-gradient(90deg, #ffd166, #ff8a5b);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.heading { font-size: 24px; margin: 0 0 14px; }
.heading-dead { color: #ff6b81; }

.tagline { color: #cfd8ff; font-style: italic; margin: 0 0 10px; }
.objective { color: #b9c6f0; font-size: 14px; line-height: 1.5; margin: 0 0 16px; }

.keylist {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
  text-align: left;
  font-size: 14px;
  color: #dfe4ff;
}

.keylist li { display: flex; justify-content: space-between; padding: 4px 0; }

kbd {
  background: #1b2140;
  border: 1px solid #3b4478;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 12px;
  color: #dfe4ff;
}

.btn {
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 10px 22px;
  border-radius: 8px;
  border: 1px solid rgba(140, 170, 255, 0.35);
  background: rgba(30, 36, 66, 0.9);
  color: #eef1ff;
  cursor: pointer;
}

.btn:hover { background: rgba(48, 56, 96, 0.95); }

.btn-primary {
  background: linear-gradient(90deg, #ffb14a, #ff7a5b);
  color: #201200;
  border: none;
}

.btn-primary:hover { filter: brightness(1.08); }

.btn-quiet {
  background: rgba(10, 12, 26, 0.5);
  font-size: 12px;
  padding: 6px 12px;
}

.hint { margin-top: 14px; font-size: 13px; color: #93a0d0; }

.result { margin-bottom: 18px; }
.result-score { font-size: 15px; color: #b9c6f0; }
.result-score strong { display: block; font-size: 40px; color: #fff3c4; }

.record-list {
  display: flex;
  justify-content: space-around;
  margin: 14px 0 0;
  font-size: 13px;
  color: #b9c6f0;
}

.record-list dt { font-size: 11px; letter-spacing: 0.08em; }
.record-list dd { margin: 2px 0 0; font-size: 18px; color: #eef1ff; font-weight: 700; }

.loading-note {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  color: #93a0d0;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
