:root {
  --bg: #0f1419;
  --panel: #87ceeb;
  --grid: #1c2230;
  --accent: #f5a623;
  --accent-dim: #d4881a;
  --text: #e6edf3;
  --muted: #7d8590;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  width: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  -webkit-font-smoothing: antialiased;
  /* Kill pull-to-refresh and scroll-chaining so a downward tap flaps the
     character instead of refreshing the page. */
  overscroll-behavior: none;
  overflow: hidden;
}

.wrap {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
  background: var(--bg);
}

/* When fullscreened, fill the screen so the canvas can take the new space. */
.wrap:fullscreen { width: 100vw; height: 100vh; }
.wrap:-webkit-full-screen { width: 100vw; height: 100vh; }

.bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
}

.bar h1 { font-size: 18px; font-weight: 700; letter-spacing: 0.5px; }

.scores { display: flex; align-items: center; gap: 14px; }
.score { font-size: 13px; color: var(--muted); }
.score strong { color: var(--text); margin-left: 4px; }

.mute {
  background: transparent;
  border: 1px solid var(--grid);
  border-radius: 6px;
  color: var(--text);
  font-size: 15px;
  line-height: 1;
  padding: 4px 7px;
  cursor: pointer;
}
.mute:hover { border-color: var(--accent); }

.stage { font-size: 12px; color: var(--muted); padding: 0 12px 6px; flex: 0 0 auto; }
.stage strong { color: var(--accent); }

.board {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--panel);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  /* The game handles all touch gestures on the canvas; tell the browser not to
     pan/zoom/refresh so taps register as flaps. */
  touch-action: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(15, 20, 25, 0.85);
  text-align: center;
  padding: 16px;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.overlay.hidden { opacity: 0; pointer-events: none; }

#select-title, #overlay-title { font-size: 24px; font-weight: 700; }
#select-sub, #overlay-sub { font-size: 14px; color: var(--muted); }

.chars {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

.char {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 8px;
  width: 130px;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid var(--grid);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.char:hover { border-color: var(--accent-dim); }
.char.selected {
  border-color: var(--accent);
  background: rgba(245, 166, 35, 0.12);
}

.char-canvas {
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
}

.char-name { font-size: 15px; font-weight: 700; }
.char-blurb { font-size: 10px; color: var(--muted); line-height: 1.3; }

.play {
  margin-top: 6px;
  padding: 10px 28px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: #0f1419;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.play:hover { background: var(--accent-dim); }

.hint {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  max-width: 400px;
  margin: 0 auto;
  padding: 6px 12px 0;
  flex: 0 0 auto;
}

.foot { font-size: 11px; text-align: center; padding: 4px 0 8px; flex: 0 0 auto; }
.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--accent); }

/* Return to games list */
.mute.home { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; line-height: 1; }
