:root {
  --bg: #fff5e8;
  --bg-2: #ffe9d2;
  --surface: #ffffff;
  --surface-2: #fff1de;
  --ink: #2b1d3a;
  --ink-2: #4a3954;
  --muted: #8b7d96;
  --line: #f3d9b8;
  --line-strong: #e6c4a0;
  --coral: #ff6b4a;
  --coral-2: #ff8a6e;
  --pink: #ff4b8a;
  --yellow: #ffc94d;
  --gold: #ffb627;
  --green: #2ee59d;
  --red: #ff5169;
  --lavender: #b89fff;
  --shadow-sm: 0 1px 2px rgba(43, 29, 58, 0.06), 0 1px 1px rgba(43, 29, 58, 0.04);
  --shadow-md: 0 12px 32px -10px rgba(255, 107, 74, 0.20), 0 2px 6px rgba(43, 29, 58, 0.06);
  --shadow-lg: 0 30px 60px -20px rgba(255, 107, 74, 0.30), 0 8px 16px rgba(43, 29, 58, 0.06);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 32px;
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Fraunces", "Bowlby One", ui-serif, system-ui, sans-serif;
  --font-bowlby: "Bowlby One", "Inter", sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

body {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.45;
  background-image:
    radial-gradient(900px 500px at 100% 0%, rgba(255, 107, 74, 0.16), transparent 60%),
    radial-gradient(700px 500px at 0% 100%, rgba(255, 201, 77, 0.20), transparent 60%),
    radial-gradient(600px 400px at 50% 50%, rgba(184, 159, 255, 0.08), transparent 70%);
  background-attachment: fixed;
  overflow-x: hidden;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

.screen {
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  padding-bottom: var(--safe-bottom);
}

/* ====================================================== */
/* TOP CONTROLS (fullscreen + mute)                         */
/* ====================================================== */
.top-ctrls {
  position: fixed;
  top: calc(10px + var(--safe-top));
  right: calc(10px + var(--safe-right));
  z-index: 100;
  display: flex;
  gap: 8px;
}

.icon-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font-weight: 600;
  font-size: 12px;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s ease, transform 0.1s ease;
}

.icon-pill:hover { background: #fff; }
.icon-pill:active { transform: scale(0.96); }

.icon-pill .ic-off { display: none; }
.icon-pill[aria-pressed="true"] .ic-on { display: none; }
.icon-pill[aria-pressed="true"] .ic-off { display: block; }

.icon-pill.mute[aria-pressed="true"] {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

/* ====================================================== */
/* SPLASH SCREEN                                           */
/* ====================================================== */
.splash-screen {
  padding: 0;
  background: #1a1a1a;
  position: relative;
  overflow: hidden;
}

.splash-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.splash-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 50%;
  /* Slight scale for cinematic feel */
  transform: scale(1.05);
}

.splash-vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center, transparent 30%, rgba(0,0,0,0.55) 100%),
    linear-gradient(to bottom, rgba(0,0,0,0.15) 0%, transparent 25%, transparent 75%, rgba(0,0,0,0.5) 100%);
  pointer-events: none;
}

.splash-content {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 24px 24px 48px;
  text-align: center;
  color: #fff;
}

.splash-title {
  font-family: var(--font-bowlby);
  font-size: clamp(48px, 8vw, 96px);
  letter-spacing: -0.02em;
  line-height: 0.95;
  margin: 0 0 8px;
  text-shadow: 0 4px 24px rgba(0,0,0,0.45);
  color: #fff;
}
.splash-title span {
  color: var(--coral);
  font-style: italic;
}

.splash-tag {
  font-family: var(--font-display);
  font-size: clamp(16px, 2.5vw, 22px);
  font-weight: 500;
  margin: 0 0 24px;
  opacity: 0.95;
  text-shadow: 0 2px 12px rgba(0,0,0,0.45);
}

.splash-hint {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 12px 24px;
  border-radius: 999px;
  animation: splash-pulse 2s ease-in-out infinite;
  text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

@keyframes splash-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.04); opacity: 0.85; }
}

/* ====================================================== */
/* SETUP SCREEN (full-screen redesign)                     */
/* ====================================================== */
.setup-screen {
  padding: 0;
  justify-content: flex-start;
  background: #faf5ec;
  position: relative;
  overflow: hidden;
}

.setup-screen > .setup-bg,
.setup-bg {
  position: absolute !important;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  background-image: url('./media/brand/splash-v2.jpg');
  background-size: cover;
  background-position: center 35%;
  background-repeat: no-repeat;
  filter: saturate(1.1) brightness(1.0);
  pointer-events: none;
}

/* Soft overlay for readability */
.setup-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg,
      rgba(255, 250, 240, 0.65) 0%,
      rgba(255, 250, 240, 0.55) 30%,
      rgba(255, 250, 240, 0.65) 70%,
      rgba(255, 250, 240, 0.80) 100%
    );
  pointer-events: none;
}

/* Decorative soft blobs */
.setup-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 40% at 10% 0%, rgba(255, 107, 74, 0.10), transparent 60%),
    radial-gradient(ellipse 50% 40% at 100% 100%, rgba(76, 175, 120, 0.10), transparent 60%);
  pointer-events: none;
  z-index: 1;
}

.setup-full {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1280px;
  height: 100%;
  margin: 0 auto;
  padding: clamp(20px, 4vh, 40px) clamp(20px, 4vw, 48px);
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1.5vh, 16px);
  overflow: hidden;
  justify-content: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 36px;
  border: none;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  background: var(--coral);
  color: #fff;
  box-shadow:
    0 6px 20px rgba(255, 107, 74, 0.35),
    inset 0 -2px 0 rgba(0, 0, 0, 0.08);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow:
    0 8px 24px rgba(255, 107, 74, 0.45),
    inset 0 -2px 0 rgba(0, 0, 0, 0.08);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-ghost {
  background: #fff;
  color: var(--ink);
  border: 2px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
/* ====================================================== */
/* COUNTDOWN                                                */
/* ====================================================== */
.countdown-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.countdown-inner {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.countdown-num {
  font-family: var(--font-bowlby);
  font-size: clamp(180px, 32vh, 320px);
  line-height: 1;
  color: var(--coral);
  text-shadow: 0 8px 40px rgba(255, 107, 74, 0.35);
  animation: count-pulse 1s ease-out infinite;
}

@keyframes count-pulse {
  0%, 100% { transform: scale(1); }
  20% { transform: scale(1.10); }
}

.countdown-foot {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.4;
  max-width: 36ch;
}

/* ====================================================== */
/* ====================================================== */
/* GAME SCREEN (minimal — image only, no sidebar)           */
/* ====================================================== */
.game-screen {
  padding: 0;
  background: linear-gradient(135deg, #fff5e8 0%, #ffe9d2 100%);
  position: relative;
}

.word-display-full {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
  gap: 0;
  padding: 0;
  text-align: center;
}

/* Top-left: small "End" button */
.end-btn {
  position: fixed;
  top: calc(10px + var(--safe-top));
  left: calc(10px + var(--safe-left));
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font-weight: 600;
  font-size: 12px;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.end-btn:hover { background: #fff; }
.end-btn:active { transform: scale(0.95); }

/* Top-center: progress pill (1/10) */
.progress-pill {
  position: fixed;
  top: calc(10px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font-family: var(--font-bowlby);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  box-shadow: var(--shadow-sm);
}

.progress-pill .progress-sep { color: var(--muted); font-size: 12px; }
.progress-pill .progress-total { color: var(--muted); font-size: 12px; }

/* Bottom-right: score pill (★ count) */
.score-pill {
  position: fixed;
  bottom: calc(16px + var(--safe-bottom));
  right: calc(16px + var(--safe-right));
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 227, 77, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 200, 50, 0.5);
  color: #6a4a00;
  font-weight: 700;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 4px 12px rgba(255, 200, 50, 0.3);
}

.score-pill.is-warning {
  background: rgba(255, 81, 105, 0.85);
  border-color: rgba(255, 81, 105, 0.9);
  color: #fff;
  animation: time-pulse 0.7s ease-in-out infinite;
}

/* ====================================================== */
/* WORD DISPLAY (FULL-SCREEN image + label)                 */
/* ====================================================== */
.word-art {
  position: absolute;
  inset: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #1a1a1a;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-image 0.3s ease;
}

/* When has-bg, the word-art is the blurred background */
.word-art.has-bg {
  background-color: #1a1a1a;
}

/* Blurred overlay sits behind the image */
.word-art.has-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--bg-blur, none);
  background-size: cover;
  background-position: center;
  filter: blur(40px) brightness(0.55) saturate(1.1);
  transform: scale(1.15);
  z-index: 0;
}

.word-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.4s ease;
  display: block;
  position: relative;
  z-index: 2;
}

.word-img.is-loaded {
  opacity: 1;
}

.word-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(180px, 45vmin, 360px);
  line-height: 1;
  background: linear-gradient(135deg, #fff5e8 0%, #ffe9d2 100%);
  z-index: 0;
}

.word-art.is-empty .word-fallback { z-index: 1; }
.word-art.is-empty .word-img { display: none; }
.word-art:not(.is-empty) .word-fallback { display: none; }

.word-label {
  position: absolute !important;
  bottom: max(40px, 8vh);
  left: 50% !important;
  transform: translateX(-50%) translateY(20px) !important;
  z-index: 4;
  font-family: var(--font-bowlby);
  font-size: clamp(40px, 8vmin, 80px);
  color: #fff;
  letter-spacing: -0.02em;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.35);
  padding: 10px 28px;
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;
}

.word-label.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0) !important;
  pointer-events: auto;
}

.word-speak {
  position: absolute;
  top: 60px;
  right: 16px;
  z-index: 5;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 2px solid var(--line-strong);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, background 0.12s ease;
}

.word-speak:hover { background: #fff; }
.word-speak:active { transform: scale(0.92); }

.word-speak.is-speaking {
  background: var(--coral);
  color: #fff;
  border-color: var(--coral);
  animation: speak-pulse 0.6s ease-in-out infinite;
}

.word-flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 0;
  opacity: 0;
  z-index: 3;
}

.word-flash.is-correct {
  background: radial-gradient(circle, rgba(82, 196, 26, 0.55) 0%, transparent 70%);
  opacity: 1;
  animation: flash-correct 0.7s ease-out forwards;
}

.word-flash.is-skip {
  background: radial-gradient(circle, rgba(184, 159, 255, 0.4) 0%, transparent 70%);
  opacity: 1;
  animation: flash-skip 0.7s ease-out forwards;
}

@keyframes word-pop {
  0% { opacity: 0; transform: scale(0.6) translateY(20px); }
  60% { opacity: 1; transform: scale(1.08) translateY(-4px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes speak-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

@keyframes flash-correct {
  0% { opacity: 0; transform: scale(0.85); }
  20% { opacity: 1; transform: scale(1.05); }
  100% { opacity: 0; transform: scale(1.15); }
}

@keyframes flash-skip {
  0% { opacity: 0; }
  20% { opacity: 1; }
  100% { opacity: 0; }
}

/* Tilt feedback: green pulse on body when tilt triggers correct */
body.is-tilt {
  animation: tilt-flash 0.35s ease-out;
}

@keyframes tilt-flash {
  0% { background: rgba(82, 196, 26, 0); }
  50% { background: rgba(82, 196, 26, 0.18); }
  100% { background: rgba(82, 196, 26, 0); }
}

/* ====================================================== */
/* END SCREEN                                               */
/* ====================================================== */
.end-screen {
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.end-inner {
  width: 100%;
  max-width: 460px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: stretch;
}

.end-badge {
  display: inline-block;
  align-self: center;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 800;
  color: var(--coral);
  background: rgba(255, 107, 74, 0.12);
  padding: 6px 14px;
  border-radius: 999px;
}

.end-score {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  margin: 4px 0 0;
}

.end-num {
  font-family: var(--font-bowlby);
  font-size: clamp(96px, 22vw, 140px);
  line-height: 1;
  color: var(--coral);
  letter-spacing: -0.04em;
  text-shadow: 0 6px 30px rgba(255, 107, 74, 0.3);
}

.end-of {
  font-size: 22px;
  color: var(--muted);
  font-weight: 700;
}

.end-sub {
  margin: 0;
  color: var(--ink-2);
  font-size: 16px;
}

.end-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.end-best {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid rgba(255, 107, 74, 0.30);
  border-radius: 999px;
  color: var(--coral);
  font-weight: 700;
  font-size: 14px;
  align-self: center;
  margin-top: 4px;
}

.end-best .dot { background: var(--coral); }

/* ====================================================== */
/* NOW-SPEAKING                                             */
/* ====================================================== */
[data-speak], [data-speak-format] {
  position: relative;
}

.speak-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-left: 6px;
  border-radius: 50%;
  background: rgba(255, 107, 74, 0.10);
  border: 1px solid rgba(255, 107, 74, 0.20);
  color: var(--coral);
  vertical-align: middle;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.speak-chip:hover { background: rgba(255, 107, 74, 0.20); }
.speak-chip.is-speaking {
  background: var(--yellow);
  color: var(--ink);
  border-color: var(--yellow);
  animation: speak-pulse 0.8s ease-in-out infinite;
}

.is-speaking-element {
  color: var(--coral) !important;
  transition: color 0.2s ease;
}

/* ====================================================== */
/* RESPONSIVE — portrait fallback                            */
/* ====================================================== */
/* CATEGORY PICKER — full background image cards            */
/* ====================================================== */
.cat-picker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(10px, 1.2vw, 18px);
  width: 100%;
  max-height: 100%;
}

@media (max-width: 800px) {
  .cat-picker {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 520px) {
  .cat-picker {
    grid-template-columns: repeat(2, 1fr);
  }
}

.cat-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end;
  padding: 0;
  background: #1a1a1a;
  border: 3px solid transparent;
  border-radius: clamp(18px, 1.6vw, 28px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.10);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  font-family: var(--font-display);
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  min-height: 120px;
}

.cat-card:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
}

.cat-card:active {
  transform: translateY(0) scale(0.99);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.10);
}

.cat-card[aria-checked="true"] {
  border-color: var(--coral);
  box-shadow: 0 8px 28px rgba(255, 107, 74, 0.35), 0 0 0 3px rgba(255, 107, 74, 0.15);
}

.cat-card[aria-checked="true"]::after {
  content: "";
  position: absolute;
  top: 12px;
  right: 12px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.4);
  z-index: 4;
}

.cat-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.cat-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.cat-card:hover .cat-bg img {
  transform: scale(1.05);
}

.cat-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(180deg,
      rgba(0, 0, 0, 0) 30%,
      rgba(0, 0, 0, 0.25) 55%,
      rgba(0, 0, 0, 0.70) 100%
    );
  pointer-events: none;
}

.cat-card[aria-checked="true"] .cat-overlay {
  background:
    linear-gradient(180deg,
      rgba(255, 107, 74, 0) 30%,
      rgba(255, 107, 74, 0.20) 55%,
      rgba(255, 107, 74, 0.65) 100%
    );
}

.cat-content {
  position: relative;
  z-index: 2;
  padding: clamp(10px, 1.5vw, 18px) clamp(12px, 1.5vw, 20px);
  display: flex;
  align-items: flex-end;
}

.cat-name {
  font-size: clamp(14px, 1.6vw, 20px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.01em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  color: #fff;
}

/* ====================================================== */
@media (max-width: 800px) {
  .game-screen { padding: 10px 12px; }
  .word-emoji { font-size: 130px; }
  .word-label { font-size: 36px; }
  .top-ctrls { top: 8px; right: 8px; }
  .icon-pill { padding: 6px 10px; font-size: 11px; }
  .setup-full { padding: 16px; gap: 10px; }
  .setup-title { font-size: clamp(28px, 7vw, 48px); }
  .cat-emoji { font-size: clamp(24px, 5vw, 36px); }
}

@media (max-width: 480px) {
  .icon-pill span { display: none; }
  .icon-pill { padding: 8px; }
}

/* ====================================================== */
/* FULLSCREEN / PWA STATE                                   */
/* ====================================================== */
:fullscreen .top-ctrls { top: 6px; right: 6px; }
:-webkit-full-screen .top-ctrls { top: 6px; right: 6px; }

@media (display-mode: fullscreen) {
  /* When running as fullscreen PWA, hide the fullscreen button */
  #fullscreen-btn { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Landscape: word-art is already full-screen via the base .word-art rule */

/* ====================================================== */
/* MASCOT FULL-SCREEN BACKGROUND (setup + end screens)     */
/* ====================================================== */
.setup-screen,
.end-screen {
  position: relative;
  overflow: hidden;
}

.setup-screen::before,
.end-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("./mascot-bg.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 0;
  animation: bg-zoom 30s ease-in-out infinite alternate;
}

@keyframes bg-zoom {
  0% { transform: scale(1); }
  100% { transform: scale(1.08); }
}

.setup-screen::after,
.end-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 245, 232, 0.45) 0%, rgba(255, 233, 210, 0.55) 100%);
  z-index: 0;
  pointer-events: none;
}

.setup-screen > *,
.end-screen > * {
  position: relative;
  z-index: 1;
}

/* Glassmorphism card for the setup content */
.setup-grid {
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 28px;
  padding: 32px 28px;
  box-shadow: 0 20px 50px -15px rgba(43, 29, 58, 0.25);
}

.setup-grid .setup-right {
  display: none;
}

@media (min-width: 800px) {
  .setup-grid .setup-right {
    display: none;
  }
}

/* End screen mascot bg */
.end-inner {
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 28px;
  padding: 32px 28px;
  box-shadow: 0 20px 50px -15px rgba(43, 29, 58, 0.25);
}

/* ====================================================== */
/* TILT FEEDBACK (when user tilts the phone down)           */
/* ====================================================== */
body.is-tilt {
  animation: tilt-flash 0.35s ease;
}

@keyframes tilt-flash {
  0% { background-color: rgba(46, 229, 157, 0); }
  20% { background-color: rgba(46, 229, 157, 0.18); }
  100% { background-color: rgba(46, 229, 157, 0); }
}

.ctrl-correct {
  position: relative;
}

body.is-tilt .ctrl-correct::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: var(--green);
  background: rgba(46, 229, 157, 0.25);
  border-radius: inherit;
  animation: tilt-mark 0.35s ease forwards;
}

@keyframes tilt-mark {
  0% { opacity: 0; transform: scale(0.5); }
  30% { opacity: 1; transform: scale(1.2); }
  100% { opacity: 0; transform: scale(1); }
}
