:root {
  color-scheme: dark;
  --bg: #14161a;
  --panel: #1d2026;
  --border: #33373f;
  --text: #e6e6e6;
  --muted: #8b90a0;
  --accent: #e0a84b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}

header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.controls { display: flex; align-items: center; gap: 0.5rem; }

.nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.35rem 0.6rem;
}
.nav-link:hover { color: var(--text); background: #262a32; }

select, button {
  background: #262a32;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.35rem 0.5rem;
  font-size: 0.9rem;
}

button { cursor: pointer; }
button:hover { background: #31363f; }

.scale-label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; color: var(--muted); margin-left: 1rem; }

main {
  display: flex;
  gap: 1.25rem;
  padding: 1.25rem;
  align-items: flex-start;
  justify-content: center;
}

.canvas-wrap { position: relative; flex: 0 0 auto; }

#levelCanvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border: 1px solid var(--border);
  background: #000;
  display: block;
}

.banner {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: 0.6rem;
  text-align: center;
  font-size: 1.1rem;
  font-weight: bold;
  letter-spacing: 0.05em;
}
.hidden { display: none; }
.banner.hidden { display: none; }
.banner.won { background: rgba(90, 220, 120, 0.9); color: #0a2010; }
.banner.lost { background: rgba(220, 90, 90, 0.9); color: #2a0a0a; }
.banner.slow { background: rgba(230, 190, 60, 0.95); color: #2a1f05; }

/* quitModal/attemptEndModal colors below are sampled directly from live
   DOSBox-captured raw 320x200 frames (2026-08-07) of the real mid-level
   Esc "YOU QUIT ?" prompt -- confirmed to share the exact same panel
   style as the end-of-attempt TOKEN/REPLAY/QUIT menu and the in-canvas
   P/F1 pause/help overlay (see main.js's drawModalPanel for that side of
   the same palette). Unlike the real screen, which leaves the level
   fully visible (un-dimmed) behind the panel, this keeps a light dim so
   the modal reads clearly over busy level art at small canvas scales --
   a deliberate, flagged deviation, not an oversight. */
.modal {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.25);
}
.modal.hidden { display: none; }
.modal-box {
  background: #aa7951;
  border-radius: 14px;
  padding: 1.5rem 2.5rem;
  text-align: center;
  box-shadow:
    0 0 0 5px #ffe133,
    0 0 0 8px #1e0000;
}
.modal-title { font-size: 1.3rem; font-weight: bold; letter-spacing: 0.05em; margin: 0 0 1rem; color: #ffdc6a; }
/* Real layout is a vertical stack (REPLAY PUZZLE above QUIT/USE TOKEN),
   not side-by-side buttons. */
.modal-buttons { display: flex; flex-direction: column; gap: 0.5rem; align-items: center; }
.modal-buttons button {
  background: none;
  border: none;
  padding: 0.2rem 0.5rem;
  font-weight: bold;
  font-size: 1.05rem;
  letter-spacing: 0.05em;
  color: #ffedd5; /* unselected */
  cursor: pointer;
}
.modal-buttons button:hover { background: none; color: #fff; }
/* Keyboard-driven selection highlight -- the real screen recolors the
   currently-selected option instead of drawing a box/outline around it. */
.modal-buttons button.selected { color: #ff5a3a; }

.muted { color: var(--muted); font-size: 0.85rem; }
.muted.small { font-size: 0.75rem; line-height: 1.4; }
