:root {
  --bg: #0d0e12;
  --panel: rgba(22, 24, 30, 0.94);
  --border: rgba(255, 255, 255, 0.14);
  --text: #e8eaef;
  --muted: #9aa0ab;
  --accent: #ffd65c;
  --error: #ff8a7a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
  /* no rubber-band scroll, text selection or long-press callouts over the game */
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

/* every window gets the game laid out to fill it (Fit.Layout, app.js): no phone frame on a wide one (2026-10-21) */
#game {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: block;
  touch-action: none; /* the game gets every touch: no pinch-zoom, no double-tap zoom */
  outline: none;
}

/* loading / error message: the title, Lars's loading animation (app.js) under it, and the message, which only shows
   for an error (screen readers still get "Loading Smashabout…") */
#status {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 6px;
  padding: 24px;
  text-align: center;
  background: var(--bg);
  z-index: 3;
  transition: opacity 0.3s;
}
#status[hidden] { display: none; }
#status.leaving { opacity: 0; pointer-events: none; }
#status .title { display: block; width: min(80vw, 360px); height: auto; }
#status .message { margin: 0; color: var(--muted); max-width: 28em; }
#status:not(.error) .message {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
#status.error .message { color: var(--error); margin-top: 10px; }
/* the space is kept from the start, so the title doesn't move when the animation appears */
#loader {
  display: block;
  width: min(92vw, 440px);
  aspect-ratio: 400 / 150;
  opacity: 0;
  transition: opacity 0.25s;
}
#loader.on { opacity: 1; }
#status.error #loader { display: none; }

/* the small save menu: a faint button tucked into the bottom-left corner
   (shown on the title and map screens only, see app.js) */
#menu-button {
  position: fixed;
  left: max(4px, env(safe-area-inset-left));
  bottom: 4px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  opacity: 0.45;
  cursor: pointer;
  z-index: 2;
  transition: opacity 0.15s;
}
#menu-button[hidden] { display: none; }
#menu-button:hover, #menu-button:focus-visible, #menu-button[aria-expanded="true"] { opacity: 1; }
#menu-button span {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #fff;
}

#menu {
  position: fixed;
  left: max(4px, env(safe-area-inset-left));
  bottom: 40px;
  min-width: 190px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  z-index: 2;
}
#menu[hidden] { display: none; }
#menu button {
  display: block;
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
#menu button:hover, #menu button:focus-visible { background: rgba(255, 255, 255, 0.08); outline: none; }
#menu .note { margin: 4px 12px 6px; font-size: 13px; color: var(--muted); }
#menu .note:empty { display: none; }

dialog {
  width: min(92vw, 460px);
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  -webkit-user-select: text;
  user-select: text;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
dialog h2 { margin: 0 0 6px; font-size: 18px; }
dialog p { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
dialog textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  resize: vertical;
  -webkit-user-select: text;
  user-select: text;
}
dialog .error { margin: 8px 0 0; color: var(--error); min-height: 1.2em; }
dialog .buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
dialog .buttons button {
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
dialog .buttons button[value="ok"] { background: var(--accent); border-color: var(--accent); color: #1a1a1a; font-weight: 600; }

/* a phone held sideways: the game is portrait only (Jeff 2026-10-21), so a card over it asks to turn it back.
   Landscape and short means a phone; a touch screen with no hover keeps a short desktop window out of it */
#rotate {
  position: fixed;
  inset: 0;
  display: none;
  place-content: center;
  justify-items: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  background: var(--bg);
  z-index: 5;
}
#rotate svg { width: 56px; height: 56px; color: var(--accent); animation: tilt 2.4s ease-in-out infinite; }
#rotate p { margin: 0; font-size: 18px; font-weight: 600; }
@keyframes tilt { 0%, 30% { transform: rotate(-90deg); } 60%, 100% { transform: rotate(0deg); } }
@media (orientation: landscape) and (max-height: 500px) and (hover: none) and (pointer: coarse) {
  #rotate { display: grid; }
}
@media (prefers-reduced-motion: reduce) {
  #rotate svg { animation: none; }
}

/* The reload watch (?debug=1): a small readout in the bottom-left corner, over the game, ignoring taps. */
#diag {
  position: fixed; left: max(6px, env(safe-area-inset-left, 0px)); bottom: calc(6px + env(safe-area-inset-bottom, 0px));
  z-index: 50; pointer-events: none; white-space: pre; font: 600 10px/1.35 ui-monospace, Menlo, monospace;
  color: #fff; background: rgba(20, 24, 50, 0.72); border-radius: 6px; padding: 4px 7px;
}
