/* Audiowide, stored locally so the game works offline. Licence: fonts/OFL.txt */
@font-face {
  font-family: 'Audiowide';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/audiowide.woff2) format('woff2');
}

:root {
  --bg: #0a0d1d;
  --board: #10142a;
  --text: #e8ebff;
  --muted: #8a90b8;
  --button: #1d2345;
  --button-hover: #283063;
  --accent: #fff3d6;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Audiowide, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.label { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; }
.value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
/* The round is the score, so it's shown on its own, bigger. */
.big-round { font-size: 32px; line-height: 1; }
/* Read out by screen readers, not shown. */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

#stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 0 8px;
}

#board {
  display: block;
  touch-action: none;
  border-radius: 10px;
  background: var(--board);
}

/* The bottom row: the round at the far left, the buttons in the middle, the
   top round at the far right. */
#controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 14px;
}
#buttons { display: flex; gap: 8px; }
#score { justify-self: start; }
#top { justify-self: end; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
#top .label { font-size: 10px; }
#top .value { font-size: 18px; }

button {
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--button);
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  min-width: 56px;
  cursor: pointer;
}
button:hover { background: var(--button-hover); }
button[hidden] { display: none; }
#warp { background: var(--accent); color: #10142a; font-weight: 600; }
#warp:disabled { background: var(--button); color: var(--muted); opacity: 0.5; cursor: default; }

#ask, #paused {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(5, 7, 18, 0.75);
  z-index: 5;
  padding: 16px;
}
#ask[hidden], #paused[hidden] { display: none; }
#ask { z-index: 6; } /* above the pause dialog: Exit asks from there */
#paused .sheet { width: min(340px, 100%); }
#ask .sheet { width: min(340px, 100%); }
#ask p { margin: 0 0 18px; font-family: system-ui, sans-serif; font-size: 15px; line-height: 1.4; color: var(--muted); }
.ask-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ask-buttons button { border-radius: 3px; border: 2px solid #262c52; background: transparent; padding: 12px 8px; }
.sheet .ask-buttons button.primary { margin-top: 0; border-color: var(--accent); }
.sheet {
  background: var(--board);
  border: 2px solid #262c52;
  width: min(420px, 100%);
  max-height: 100%;
  overflow-y: auto;
  padding: 20px 18px 18px;
}
.sheet h2 { margin: 0 0 16px; font-size: 20px; font-weight: 400; color: var(--accent); }
.sheet button.primary {
  width: 100%;
  border-radius: 3px;
  background: var(--accent);
  color: #10142a;
  padding: 12px;
  margin-top: 4px;
}
/* Icon buttons. Pause and Mute show one icon or the other by aria-pressed. */
button.icon { display: inline-grid; place-items: center; min-width: 48px; }
button.icon svg { grid-area: 1 / 1; }
button.icon .on, button.icon[aria-pressed="true"] .off { display: none; }
button.icon[aria-pressed="true"] .on { display: block; }
#mute[aria-pressed="true"] { color: var(--muted); }

/* Paused: a dim layer over the board. Tap it to carry on. */

#over {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(5, 7, 18, 0.7);
  backdrop-filter: blur(4px);
}
#over[hidden] { display: none; }
.card {
  background: var(--board);
  padding: 28px 32px;
  border-radius: 16px;
  text-align: center;
}
.card p { margin: 0 0 8px; }
.big { font-size: 32px; font-weight: 800; margin-bottom: 20px !important; }
/* The play button, as on the title screen: a neon rectangle with the triangle. */
.play-btn {
  display: inline-grid;
  place-items: center;
  width: 140px;
  height: 56px;
  padding: 0;
  border: 3px solid #ffe6cf;
  border-radius: 3px;
  background: transparent;
  color: #ffe6cf;
  box-shadow: 0 0 6px #ff8f3f, 0 0 18px rgba(255, 143, 63, 0.7), inset 0 0 6px #ff8f3f, inset 0 0 18px rgba(255, 143, 63, 0.35);
}
.play-btn:hover { background: transparent; box-shadow: 0 0 8px #ff8f3f, 0 0 28px rgba(255, 143, 63, 0.9), inset 0 0 8px #ff8f3f, inset 0 0 24px rgba(255, 143, 63, 0.5); }
.play-btn svg { width: 30px; height: 30px; filter: drop-shadow(0 0 4px #ff8f3f) drop-shadow(0 0 10px rgba(255, 143, 63, 0.8)); }

#error {
  position: fixed;
  left: 8px; right: 8px; top: calc(env(safe-area-inset-top) + 8px);
  background: #3a1020;
  color: #ffd0d8;
  font: 12px/1.4 ui-monospace, monospace;
  padding: 8px 10px;
  border-radius: 8px;
  z-index: 10;
  word-break: break-word;
}

/* Phones: the board is limited by screen width, so run it edge to edge and
   keep the score bar and buttons slim. */
@media (max-width: 600px) {
  #stage { padding: 0; }
  #board { border-radius: 0; }
  #controls { padding: 6px 12px 8px; gap: 6px; }
  #buttons { gap: 6px; }
  button { padding: 8px 12px; font-size: 14px; }
}

/* The narrowest phones (320 px): tighten the row so the numbers and all four
   buttons fit. */
@media (max-width: 360px) {
  #controls { gap: 5px; padding: 10px 6px 14px; }
  #buttons { gap: 4px; }
  .big-round { font-size: 26px; }
  #controls button { padding: 10px 9px; min-width: 44px; }
}
