:root {
  --bg-top: #1d2748;
  --bg-bot: #101729;
  --ink: #f4f7ff;
  --card: #232f56;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg-bot);
}

body {
  display: flex;
  flex-direction: column;
  background: linear-gradient(170deg, var(--bg-top), var(--bg-bot) 70%);
  color: var(--ink);
  font-family: "Baloo 2", "Avenir Next Rounded", "SF Pro Rounded", ui-rounded,
               "Trebuchet MS", system-ui, sans-serif;
  /* Nothing in this app scrolls, drags, selects or long-press-menus. */
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ---------- heads-up display ---------- */

#hud {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px clamp(12px, 3vw, 28px);
  flex: 0 0 auto;
}

.spacer { flex: 1; }

#score {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 18px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.10);
  font-size: clamp(24px, 5vw, 40px);
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  transition: transform 140ms ease-out;
}

#score.bump { transform: scale(1.18); }

.star { color: #ffd23f; }

.iconBtn {
  width: clamp(48px, 9vw, 64px);
  height: clamp(48px, 9vw, 64px);
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.10);
  color: var(--ink);
  font-size: clamp(22px, 4.5vw, 30px);
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 120ms ease-out, background 120ms ease-out;
}

.iconBtn:active { transform: scale(0.9); background: rgba(255, 255, 255, 0.2); }
.iconBtn.off { opacity: 0.45; }

/* ---------- board ---------- */

#game {
  flex: 1 1 auto;
  display: block;
  width: 100%;
  min-height: 0;
  touch-action: none;
}

/* ---------- overlays ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8, 12, 24, 0.82);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.overlay.hidden { display: none; }

.card {
  width: min(520px, 100%);
  padding: clamp(24px, 5vw, 44px);
  border-radius: 32px;
  background: var(--card);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
  text-align: center;
}

.card h1 {
  margin: 6px 0 10px;
  font-size: clamp(38px, 9vw, 64px);
  letter-spacing: 0.5px;
}

.card h2 {
  margin: 0 0 10px;
  font-size: clamp(26px, 6vw, 40px);
}

.card p {
  margin: 0 0 26px;
  font-size: clamp(17px, 3.6vw, 24px);
  line-height: 1.45;
  opacity: 0.85;
}

.logo {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: clamp(120px, 30vw, 170px);
  margin: 0 auto 6px;
}

.lb {
  aspect-ratio: 1;
  border-radius: 22%;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.22),
              inset 0 5px 0 rgba(255, 255, 255, 0.28);
}

.c1 { background: #ff5d5d; }
.c3 { background: #ffd23f; }
.c4 { background: #4ecb71; }
.c5 { background: #3da5d9; }
.c6 { background: #a06cd5; }
.c7 { background: #ff87ab; }

.row {
  display: flex;
  gap: 14px;
  justify-content: center;
}

.bigBtn {
  flex: 1 1 auto;
  min-height: 76px;
  padding: 0 34px;
  border: 0;
  border-radius: 22px;
  font: inherit;
  font-size: clamp(24px, 5vw, 34px);
  font-weight: 800;
  color: #12203a;
  background: #ffd23f;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.28);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 90ms ease-out, box-shadow 90ms ease-out;
}

.bigBtn:active {
  transform: translateY(5px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.28);
}

.bigBtn.play { max-width: 320px; background: #4ecb71; color: #0d2416; }
.bigBtn.yes { background: #4ecb71; color: #0d2416; }
.bigBtn.no { background: rgba(255, 255, 255, 0.16); color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 1ms !important; }
}
