:root {
  --ink: #e8e6e0;
  --muted: #9a94a8;
  --night: #0a0a18;
  --night2: #141230;
  --accent: #f2c14e;
  --accent-dim: #a8763a;
  --panel-border: #3a3552;
  --font-ui: 'Courier New', ui-monospace, monospace;
  /* the Various Icons sheet's panel colours (5.7) */
  --sheet-panel: #a8a8d0;
  --sheet-hi: #f8f8f8;
  --sheet-lo: #505078;
  --sheet-edge: #404048;
  --sheet-ink: #000098;
  --sheet-on: #f8d070;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--night);
  color: var(--ink);
  font-family: var(--font-ui);
  overflow: hidden;
}

/* The hidden attribute must win over the display rules below: the title card
 * is display:flex and the play note is a fixed block, both of which would
 * otherwise override the UA's display:none and leave the title visible
 * behind the modal. */
[hidden] {
  display: none !important;
}

#scene {
  position: fixed;
  inset: 0;
}

#scene canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.title-card {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -58%);
  text-align: center;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 1.2rem 2rem;
}

.wordmark {
  font-size: clamp(2.6rem, 10vw, 6.5rem);
  margin: 0;
  letter-spacing: 0.16em;
  text-indent: 0.16em;
  color: var(--ink);
  text-shadow:
    0 0 12px rgba(242, 193, 78, 0.55),
    0 0 2px var(--accent),
    0 4px 0 var(--accent-dim);
  font-weight: 900;
  line-height: 1;
}

.tagline {
  color: var(--muted);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  font-size: 0.72rem;
  margin: 0;
}

.hint {
  color: var(--muted);
  font-size: 0.66rem;
  margin: 0;
  opacity: 0.8;
}

/* Difficulty picker (Epic 3.5): plain radios in the SNES panel colours. */
.level-pick {
  pointer-events: auto;
  display: flex;
  gap: 0.6rem;
  margin: 0 0 0.9rem;
  padding: 0.4rem 0.7rem 0.5rem;
  border: 2px solid var(--panel-border);
  background: var(--night2);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--ink);
}

.level-pick legend {
  padding: 0 0.3rem;
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.level-pick label {
  cursor: var(--hand, pointer);
  white-space: nowrap;
}

.level-pick input {
  accent-color: var(--accent);
}

/* Map number (2.6.1): three digits and two small buttons in the same panel. */
.map-pick {
  align-items: center;
}

.map-pick input {
  width: 3.2em;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  text-align: center;
  color: var(--ink);
  background: var(--night);
  border: 2px solid var(--panel-border);
  padding: 0.15rem 0.2rem;
}

.map-btn {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  color: var(--ink);
  background: var(--night2);
  border: 2px solid var(--panel-border);
  padding: 0.15rem 0.45rem;
  cursor: var(--hand, pointer);
}

.map-btn:hover {
  background: #1b1840;
}

.map-pick input:focus-visible,
.map-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.level-funds {
  opacity: 0.7;
}

#start-btn,
#back-btn {
  pointer-events: auto;
  font-family: var(--font-ui);
  font-size: 1rem;
  white-space: nowrap;
  letter-spacing: 0.08em;
  color: var(--ink);
  background: var(--night2);
  border: 2px solid var(--panel-border);
  border-top-color: var(--accent);
  border-left-color: var(--accent);
  padding: 0.7rem 1.6rem;
  cursor: var(--hand, pointer);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.5);
  transition: transform 80ms ease, box-shadow 80ms ease, background 120ms ease;
}

#start-btn:hover,
#back-btn:hover {
  background: #1b1840;
}

#start-btn:active,
#back-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.5);
}

#start-btn:focus-visible,
#back-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.play-note {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  text-align: center;
  background: rgba(10, 10, 24, 0.82);
  border: 2px solid var(--panel-border);
  padding: 1.6rem 2.2rem;
  max-width: min(92vw, 34rem);
}

.play-note h2 {
  margin: 0 0 0.6rem;
  color: var(--accent);
  letter-spacing: 0.08em;
  font-size: 1.1rem;
}

.play-note p {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

#back-btn {
  margin-top: 0.8rem;
}

@media (max-width: 480px) {
  .title-card {
    gap: 0.5rem;
    padding: 1rem;
  }
  .tagline {
    font-size: 0.6rem;
    background: rgba(10, 10, 24, 0.55);
    padding: 0.12rem 0.4rem;
  }
  #start-btn,
  #back-btn {
    padding: 0.65rem 1.1rem;
    font-size: 0.92rem;
  }
  .play-note {
    padding: 1.2rem 1.2rem;
  }
}
