@import url('https://fonts.googleapis.com/css2?family=Monoton&family=Orbitron:wght@400;500;600;700&family=Rajdhani:wght@400;500;600&display=swap');

:root {
  /* -----------------------------------------------------------------------
     Quizzington Design Tokens — "Light Retro Arcade"

     Note (future): theme switching is a UI-only placeholder. If/when you add a
     toggle, set :root[data-theme="dark"] and override token values there.
     ----------------------------------------------------------------------- */

  --theme: light;

  /* Color system */
  --color-bg: #f7f6ff;
  --color-bg-2: #fff6f0;
  --color-bg-3: #eefbff;
  --color-text: #1b1a24;
  --color-text-muted: rgba(27, 26, 36, 0.72);
  --color-accent: #00bcd4; /* retro-cyan */
  --color-accent-2: #ff4fd8; /* neon-pink */
  --color-accent-3: #ffd166; /* arcade-yellow */
  --color-danger: #ff3b5c;
  --color-success: #22c55e;
  --color-info: #3b82f6;

  /* Surfaces */
  --surface-1: rgba(255, 255, 255, 0.72); /* app container */
  --surface-2: rgba(255, 255, 255, 0.88); /* card */
  --surface-3: rgba(255, 255, 255, 0.96); /* modal */

  /* Borders & shadows */
  --border-subtle: rgba(27, 26, 36, 0.16);
  --border-strong: rgba(27, 26, 36, 0.24);
  --shadow-sm: 0 6px 14px rgba(12, 10, 24, 0.1);
  --shadow-md: 0 14px 30px rgba(12, 10, 24, 0.14);
  --shadow-lg: 0 28px 60px rgba(12, 10, 24, 0.16);
  --glow-cyan: rgba(0, 188, 212, 0.22);
  --glow-pink: rgba(255, 79, 216, 0.2);
  --glow-yellow: rgba(255, 209, 102, 0.18);

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-7: 2rem;

  /* Radii */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --radius-pill: 999px;

  /* Typography */
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", Arial, sans-serif;
  --font-display: 'Orbitron', var(--font-body);
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.5rem;

  /* Motion */
  --dur-fast: 120ms;
  --dur-med: 200ms;
  --dur-slow: 320ms;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);

  --app-bg: linear-gradient(180deg, #fffdf7 0%, #f1fbff 35%, #f7f6ff 100%);
  --texture-dot: rgba(27, 26, 36, 0.06);
  --texture-line: rgba(27, 26, 36, 0.04);

  --transition: all var(--dur-med) var(--ease-out);
  --nav-height: 78px;
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);

  /* Backwards-compatible aliases (existing styles rely on these names) */
  --bg: var(--color-bg);
  --fg: var(--color-text);
  --accent: var(--color-accent);
  --accent-secondary: var(--color-accent-2);
  --accent-yellow: var(--color-accent-3);
  --danger: var(--color-danger);
  --panel: var(--surface-1);
  --panel-border: var(--border-strong);
  --panel-glow: var(--glow-pink);
  --grid-line: var(--texture-line);
  --border: var(--border-subtle);
}

/* Placeholder only — do NOT rely on this until a real toggle is wired. */
/* :root[data-theme="dark"] {} */

html {
  color-scheme: light;
}

* {
  box-sizing: border-box;
  font-family: var(--font-body);
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Utility text helpers */
.text-muted {
  color: var(--color-text-muted);
}

.text-center {
  text-align: center;
}

.form-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

/* Step indicator (Single Player setup) */
.step-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.step-indicator__text {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.step-indicator__bar {
  width: min(340px, 100%);
  height: 10px;
  border-radius: 999px;
  background: rgba(27, 26, 36, 0.12);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.75) inset;
  overflow: hidden;
}

.step-indicator__fill {
  display: block;
  height: 100%;
  width: var(--step-progress, 0%);
  background: linear-gradient(90deg, rgba(0, 188, 212, 0.9), rgba(255, 79, 216, 0.75));
  border-radius: inherit;
  transition: width var(--dur-med) var(--ease-out);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  background: var(--app-bg);
  color: var(--fg);
  overflow-x: hidden;
  padding-top: clamp(1.25rem, 5vh, 3rem);
  padding-bottom: calc(var(--nav-height) + var(--safe-area-bottom));
  position: relative;
  font-weight: 500;
  letter-spacing: 0.01em;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 14% 12%, rgba(255, 79, 216, 0.22), transparent 55%),
    radial-gradient(circle at 86% 18%, rgba(0, 188, 212, 0.2), transparent 55%),
    radial-gradient(circle at 50% 96%, rgba(255, 209, 102, 0.22), transparent 60%);
  opacity: 1;
  transform: translateY(0);
  animation: bgFloat 18s ease-in-out infinite alternate;
  z-index: -2;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(var(--texture-dot) 1px, transparent 1px),
    repeating-linear-gradient(0deg, transparent 0 24px, var(--texture-line) 24px 25px),
    repeating-linear-gradient(90deg, transparent 0 24px, var(--texture-line) 24px 25px);
  background-size: 18px 18px, 120px 120px, 120px 120px;
  background-position: 0 0, 0 0, 0 0;
  opacity: 0.55;
  animation: textureDrift 26s linear infinite;
  z-index: -1;
  pointer-events: none;
}

@keyframes bgFloat {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-14px);
  }
}

@keyframes textureDrift {
  to {
    background-position: 36px 28px, 0 60px, 60px 0;
  }
}

@keyframes auroraVertical {
  0% {
    background-position: 50% 0%, 45% 10%, 55% 70%, 50% 100%;
  }
  50% {
    background-position: 50% 60%, 45% 45%, 55% 40%, 50% 60%;
  }
  100% {
    background-position: 50% 120%, 45% 85%, 55% 15%, 50% 10%;
  }
}

@keyframes auroraGlow {
  0%, 100% {
    opacity: 0.9;
  }
  40% {
    opacity: 1;
  }
  70% {
    opacity: 0.96;
  }
}

@keyframes gridDrift {
  0% {
    background-position: 0 0, 0 0, 0 0;
  }
  50% {
    background-position: 0 24px, 24px 0, 0 0;
  }
  100% {
    background-position: 0 48px, 48px 0, 0 0;
  }
}

@keyframes gridPulse {
  0%, 100% {
    opacity: 0.38;
  }
  50% {
    opacity: 0.55;
  }
}

body.has-bottom-nav {
  padding-bottom: calc(var(--nav-height) + var(--safe-area-bottom) + 1.5rem);
}

/* Center only auth/landing screens when nav is absent. */
body[data-page='login'],
body[data-page='verify'],
body[data-page='home']:not(.has-bottom-nav) {
  justify-content: center;
  padding-top: 0;
}

main {
  width: min(960px, 94vw);
  background: var(--panel);
  border: 2px solid var(--panel-border);
  border-radius: var(--radius-xl);
  padding: clamp(1.75rem, 4.5vw, 2.6rem) clamp(1.1rem, 3.6vw, 2.4rem);
  backdrop-filter: blur(14px) saturate(115%);
  box-shadow:
    var(--shadow-lg),
    0 0 0 2px rgba(255, 255, 255, 0.6) inset,
    0 0 22px var(--glow-cyan),
    0 0 18px var(--glow-pink);
  animation: fadeIn var(--dur-slow) var(--ease-out);
  margin: 0 auto 3rem;
  position: relative;
  overflow: hidden;
}

body[data-page='login'] main,
body[data-page='verify'] main,
body[data-page='home']:not(.has-bottom-nav) main {
  margin-bottom: 0;
}

h1, h2, h3 {
  margin-top: 0;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--font-display);
}

h1 {
  margin-bottom: 1.75rem;
}

h2 {
  margin-bottom: 1.2rem;
}

h3 {
  margin-bottom: 0.95rem;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.92em;
  padding: 0.12rem 0.35rem;
  border-radius: 10px;
  border: 1px solid rgba(27, 26, 36, 0.12);
  background: rgba(27, 26, 36, 0.06);
  color: rgba(27, 26, 36, 0.92);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

p {
  margin: 0 0 0.65rem 0;
  line-height: 1.55;
  letter-spacing: 0.01em;
}

p:last-child {
  margin-bottom: 0;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(27, 26, 36, 0.16);
  background: rgba(255, 255, 255, 0.7);
  color: rgba(27, 26, 36, 0.82);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(255, 255, 255, 0.7) inset;
}

.badge--outline {
  background: rgba(255, 255, 255, 0.35);
  border-color: rgba(0, 188, 212, 0.35);
}

/* Settings profile badge (verification state) */
.settings-profile__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(27, 26, 36, 0.16);
  background: rgba(255, 255, 255, 0.7);
  color: rgba(27, 26, 36, 0.82);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.settings-profile__badge.is-verified {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.14);
  color: rgba(20, 83, 45, 0.95);
}

.settings-profile__badge.is-pending {
  border-color: rgba(255, 209, 102, 0.35);
  background: rgba(255, 209, 102, 0.14);
  color: rgba(146, 64, 14, 0.95);
}

/* Status / toast-like alerts (used by script.js setStatus) */
.status {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border: 2px solid rgba(27, 26, 36, 0.14);
  background: rgba(255, 255, 255, 0.78);
  color: rgba(27, 26, 36, 0.9);
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(255, 255, 255, 0.72) inset;
  line-height: 1.4;
}

.status.success {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.12);
  color: rgba(20, 83, 45, 0.95);
}

.status.error {
  border-color: rgba(255, 59, 92, 0.35);
  background: rgba(255, 59, 92, 0.12);
  color: rgba(127, 29, 29, 0.95);
}

.status.info {
  border-color: rgba(59, 130, 246, 0.32);
  background: rgba(59, 130, 246, 0.12);
  color: rgba(30, 64, 175, 0.95);
}

/* Lists (used in lobby / scoreboard) */
.list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.6rem;
}

button, .btn {
  appearance: none;
  border: 2px solid var(--border-subtle);
  background: var(--surface-2);
  color: var(--fg);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.2rem;
  min-height: 44px;
  font-size: 0.92rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition:
    transform var(--dur-fast) var(--ease-out),
    background var(--dur-med) var(--ease-out),
    box-shadow var(--dur-med) var(--ease-out),
    color var(--dur-med) var(--ease-out),
    border-color var(--dur-med) var(--ease-out);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  text-align: center;
  text-transform: uppercase;
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(255, 255, 255, 0.7) inset;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

button:hover,
.btn:hover {
  background: rgba(0, 188, 212, 0.12);
  border-color: rgba(0, 188, 212, 0.55);
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(255, 255, 255, 0.72) inset, 0 0 16px var(--glow-cyan);
}

button:focus-visible,
.btn:focus-visible {
  outline: 3px solid var(--accent-yellow);
  outline-offset: 2px;
}

button:active,
.btn:active {
  transform: translateY(1px) scale(0.99);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

button.is-active,
.btn.is-active {
  border-color: rgba(0, 188, 212, 0.7);
  background: rgba(0, 188, 212, 0.16);
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(255, 255, 255, 0.7) inset, 0 0 18px var(--glow-cyan);
}

/* Button variants */
.btn--primary {
  border-color: rgba(0, 188, 212, 0.6);
  background: linear-gradient(90deg, rgba(0, 188, 212, 0.95), rgba(255, 79, 216, 0.9));
  color: #ffffff;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
  box-shadow: var(--shadow-md), 0 0 18px var(--glow-cyan), 0 0 18px var(--glow-pink);
  overflow: hidden;
}

.btn--primary::after {
  content: '';
  position: absolute;
  inset: -40%;
  background: linear-gradient(120deg, transparent 35%, rgba(255, 255, 255, 0.55) 50%, transparent 65%);
  transform: translateX(-120%) rotate(10deg);
  animation: ctaShine 3.4s ease-in-out infinite;
  pointer-events: none;
}

.btn--primary:hover {
  border-color: rgba(255, 79, 216, 0.6);
  box-shadow: var(--shadow-lg), 0 0 20px var(--glow-cyan), 0 0 22px var(--glow-pink);
}

.btn--secondary {
  border-color: rgba(255, 79, 216, 0.45);
  background: rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(255, 255, 255, 0.78) inset;
}

/* Segmented control (e.g., Create / Join lobby) */
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-radius: var(--radius-md);
  border: 2px solid rgba(27, 26, 36, 0.14);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(255, 255, 255, 0.7) inset;
  overflow: hidden;
}

.segmented > .segmented__btn {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  min-height: 48px;
}

.segmented > .segmented__btn + .segmented__btn {
  border-left: 2px solid rgba(27, 26, 36, 0.12);
}

.segmented > .segmented__btn.is-active,
.segmented > .segmented__btn[aria-pressed='true'] {
  background: rgba(0, 188, 212, 0.14);
  color: rgba(27, 26, 36, 0.95);
}

.segmented > .segmented__btn:focus-visible {
  outline: 3px solid var(--accent-yellow);
  outline-offset: 2px;
}

@keyframes ctaShine {
  0%,
  55% {
    transform: translateX(-120%) rotate(10deg);
    opacity: 0;
  }
  60% {
    opacity: 1;
  }
  100% {
    transform: translateX(120%) rotate(10deg);
    opacity: 0;
  }
}

.answers {
  display: grid;
  grid-template-columns: 1fr;
  grid-auto-rows: minmax(92px, auto);
  gap: 0.95rem;
  align-content: stretch;
}

.answers button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.85rem;
  min-height: clamp(92px, 18vh, 140px);
  padding: 1.15rem 1.2rem;
  font-size: clamp(0.95rem, 2.1vw, 1.05rem);
  line-height: 1.3;
  text-align: left;
  text-transform: none;
  letter-spacing: 0.02em;
  opacity: 0;
  transform: translateY(12px);
  animation: answerReveal 0.45s ease forwards;
}

.answers button:nth-child(2) {
  animation-delay: 0.05s;
}

.answers button:nth-child(3) {
  animation-delay: 0.1s;
}

.answers button:nth-child(4) {
  animation-delay: 0.15s;
}

@keyframes answerReveal {
  0% {
    opacity: 0;
    transform: translateY(14px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.btn--ghost {
  background: rgba(255, 255, 255, 0.55);
  border-color: rgba(27, 26, 36, 0.18);
  color: rgba(27, 26, 36, 0.85);
}

.btn--ghost:hover,
.btn--ghost:focus-visible {
  background: rgba(255, 79, 216, 0.1);
  border-color: rgba(255, 79, 216, 0.45);
  box-shadow: var(--shadow-md), 0 0 14px var(--glow-pink);
}

.btn--danger {
  background: linear-gradient(90deg, rgba(255, 59, 92, 0.92), rgba(255, 79, 216, 0.75));
  border-color: rgba(255, 59, 92, 0.65);
  color: #ffffff;
  box-shadow: var(--shadow-md), 0 0 16px rgba(255, 59, 92, 0.22);
}

.btn--danger:hover,
.btn--danger:focus-visible {
  border-color: rgba(255, 59, 92, 0.8);
  box-shadow: var(--shadow-lg), 0 0 22px rgba(255, 59, 92, 0.28);
}

.btn--block {
  width: 100%;
  justify-content: center;
}

body[data-page='game'] main {
  width: min(900px, 96vw);
  padding: clamp(1.25rem, 4.5vw, 2.6rem) clamp(1rem, 4vw, 2.4rem);
  gap: clamp(1rem, 2.5vw, 1.7rem);
  min-height: calc(100vh - clamp(1.25rem, 5vh, 3rem) - var(--nav-height) - var(--safe-area-bottom));
  display: flex;
  flex-direction: column;
}

body[data-page='game'] .game-question {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: clamp(1rem, 2.6vw, 1.6rem);
  min-height: 0;
  padding: clamp(1rem, 3vw, 1.85rem);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(255, 255, 255, 0.82));
  border-color: rgba(27, 26, 36, 0.12);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, 0.8) inset;
}

body[data-page='game'] #question-text {
  word-break: break-word;
  text-align: center;
  font-size: clamp(1.25rem, 4.8vw, 2rem);
  line-height: 1.4;
  text-wrap: balance;
  hyphens: auto;
  padding: clamp(0.95rem, 3vw, 1.4rem);
  background: rgba(255, 255, 255, 0.98);
  border-radius: var(--radius-xl);
  border: 2px solid rgba(27, 26, 36, 0.12);
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(255, 255, 255, 0.9) inset;
}

body[data-page='game'] .game-question__controls {
  gap: clamp(0.65rem, 2.2vw, 1.1rem);
  margin-bottom: 0;
}

body[data-page='game'] .game-question__meta {
  padding: clamp(0.5rem, 1.8vw, 0.85rem);
  background: rgba(255, 255, 255, 0.86);
  border-color: rgba(27, 26, 36, 0.12);
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(255, 255, 255, 0.8) inset;
}

body[data-page='game'] .game-question__meta-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(0.45rem, 1.4vw, 0.75rem);
}

body[data-page='game'] .game-question__timer-container {
  margin: 0;
  align-items: flex-end;
  max-width: 160px;
}

.game-question > h2 {
  margin: 0;
  font-size: clamp(1.15rem, 3.8vw, 1.6rem);
  line-height: 1.45;
  text-align: center;
  padding: clamp(0.4rem, 1vw, 0.75rem);
  background: rgba(255, 255, 255, 0.85);
  border-radius: var(--radius-lg);
  border: 2px solid rgba(27, 26, 36, 0.12);
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(255, 255, 255, 0.78) inset;
}

body[data-page='game'] .answers {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 1fr;
  grid-auto-rows: minmax(72px, auto);
  gap: clamp(0.75rem, 2.2vw, 1.1rem);
  min-height: 0;
}

body[data-page='game'] .question-error {
  display: grid;
  gap: 0.85rem;
  padding: clamp(0.9rem, 2.4vw, 1.2rem);
  border-radius: var(--radius-lg);
  border: 2px dashed rgba(255, 77, 109, 0.28);
  background: rgba(255, 255, 255, 0.85);
}

body[data-page='game'] .question-error__title {
  margin: 0 0 0.35rem 0;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.question-error__details {
  display: grid;
  gap: 0.35rem;
}

.question-error__path {
  margin: 0;
  font-size: 0.9rem;
}

.question-error__example-label {
  margin: 0;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.question-error__example {
  display: block;
  word-break: break-all;
}

.question-error__actions {
  display: grid;
  gap: 0.6rem;
}

.question-diagnostics {
  display: grid;
  gap: 0.6rem;
  padding: clamp(0.8rem, 2vw, 1.1rem);
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 188, 212, 0.25);
  background: rgba(0, 188, 212, 0.06);
}

.question-diagnostics__header {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.question-diagnostics__header h3 {
  margin: 0;
}

.question-diagnostics__list {
  margin: 0;
  display: grid;
  gap: 0.4rem;
}

.question-diagnostics__row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0.4rem;
  align-items: start;
}

@media (max-width: 600px) {
  .question-diagnostics__row {
    grid-template-columns: 1fr;
  }
}

.question-diagnostics__row dt {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(27, 26, 36, 0.62);
  margin: 0;
}

.question-diagnostics__row dd {
  margin: 0;
  word-break: break-word;
}

.question-diagnostics__row code {
  word-break: break-all;
}

.question-diagnostics[hidden] {
  display: none !important;
}

body[data-page='game'] .answers button,
body[data-page='game'] .answer-option {
  min-height: clamp(68px, 12vh, 110px);
  padding: clamp(0.85rem, 3vw, 1.2rem) clamp(1rem, 3.5vw, 1.4rem);
  font-size: clamp(0.95rem, 3.4vw, 1.1rem);
  line-height: 1.35;
  border-radius: 16px;
  align-items: center;
}

body[data-page='game'] .answer-option {
  background: rgba(255, 255, 255, 0.94);
  border: 2px solid rgba(27, 26, 36, 0.14);
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(255, 255, 255, 0.8) inset;
}

body[data-page='game'] .answer-option:hover,
body[data-page='game'] .answer-option:focus-visible {
  border-color: rgba(0, 188, 212, 0.65);
  box-shadow: 0 0 18px rgba(0, 188, 212, 0.28);
}

body[data-page='game'] .answer-option:disabled {
  opacity: 0.6;
}

.game-results-screen {
  display: none;
  width: 100%;
}

.game-results-screen:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: clamp(1.2rem, 2vw, 1.6rem);
  padding: clamp(1.6rem, 4vw, 2.4rem);
  border-radius: var(--radius-xl);
  border: 2px solid rgba(27, 26, 36, 0.14);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.76));
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, 0.78) inset;
}

body[data-page='game'].game-postgame main {
  height: auto;
  max-height: none;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: clamp(1rem, 2vw, 1.6rem);
}

body[data-page='game'].game-postgame .game-results-screen {
  flex: 1 1 auto;
}

.game-results-screen__header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  text-align: center;
}

.game-results-screen__header h2 {
  margin: 0;
  font-size: clamp(1.25rem, 3vw, 1.6rem);
}

.game-results-screen__headline {
  margin: 0;
  font-size: clamp(0.95rem, 2.2vw, 1.1rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(0, 255, 255, 0.9);
}

.game-results-screen__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(1rem, 2.5vw, 1.6rem);
}

@media (min-width: 768px) {
  .game-results-screen__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.game-results-screen__panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: clamp(1rem, 2.6vw, 1.5rem);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.8);
  border: 2px solid rgba(27, 26, 36, 0.12);
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(255, 255, 255, 0.78) inset;
}

.game-results-screen__panel h3 {
  margin: 0;
  font-size: 0.92rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: rgba(27, 26, 36, 0.78);
}

.game-results-screen__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

#final-score-list .final-score-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.8rem;
  border-radius: 12px;
  border: 1px solid rgba(27, 26, 36, 0.12);
  background: rgba(255, 255, 255, 0.75);
}

#final-score-list .final-score-rank {
  font-size: 0.72rem;
  font-weight: 700;
  min-width: 1.6rem;
  text-align: right;
  color: rgba(27, 26, 36, 0.62);
}

#final-score-list .final-score-name {
  font-size: 0.84rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(27, 26, 36, 0.9);
}

#question-summary-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

#question-summary-list li {
  display: grid;
  grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr));
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 0.8rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(27, 26, 36, 0.12);
}

#question-summary-list li span {
  font-size: 0.76rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(27, 26, 36, 0.72);
  display: block;
  word-break: break-word;
}

#question-summary-list li .question-summary__question {
  font-size: 0.82rem;
  color: rgba(27, 26, 36, 0.9);
  text-transform: none;
}

#question-summary-list li .question-summary__answer {
  color: rgba(0, 255, 255, 0.8);
}

#question-summary-list li .question-summary__result {
  font-weight: 700;
}

#final-score-list .final-score-points {
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: rgba(0, 255, 255, 0.9);
}

#question-summary-list li.is-correct {
  border-color: rgba(60, 255, 155, 0.35);
  background: rgba(60, 255, 155, 0.08);
}

#question-summary-list li.is-wrong {
  border-color: rgba(255, 77, 109, 0.28);
  background: rgba(255, 77, 109, 0.06);
}

#question-summary-list li.is-timeout {
  border-color: rgba(255, 221, 87, 0.28);
  background: rgba(255, 221, 87, 0.05);
}

#question-summary-list li.question-summary__empty {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.8rem;
  color: rgba(27, 26, 36, 0.65);
  border-style: dashed;
}

.game-header {
  display: flex;
  flex-direction: column;
  gap: clamp(0.75rem, 2vw, 1.25rem);
  align-items: stretch;
}

.game-header__primary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: clamp(1rem, 4vw, 1.75rem);
  text-align: center;
}

.game-header .mode-title {
  margin: 0;
  font-size: clamp(1.05rem, 3vw, 1.25rem);
  font-weight: 700;
  letter-spacing: 0.12em;
}

.header-meta {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  align-items: center;
}

.game-header-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
}

.game-header__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.game-header__actions .badge:empty {
  display: none;
}

.game-logo-tap {
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.game-score-display {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 188, 212, 0.35);
  background: rgba(255, 255, 255, 0.75);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.7rem;
  color: rgba(0, 188, 212, 0.95);
  box-shadow: var(--shadow-sm), 0 0 14px var(--glow-cyan);
}

.game-score-display__label {
  color: rgba(27, 26, 36, 0.72);
}

.game-score-display__value {
  font-weight: 700;
}

.game-question__controls {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: clamp(0.65rem, 2vw, 1.2rem);
  width: 100%;
  margin-bottom: 0.5rem;
}

.game-hud-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.game-hud-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(27, 26, 36, 0.14);
  background: rgba(255, 255, 255, 0.78);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(27, 26, 36, 0.78);
}

.game-question__meta {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: clamp(0.45rem, 1.2vw, 0.75rem);
  width: 100%;
  flex: 1 1 auto;
  padding: 0.45rem clamp(0.55rem, 1.4vw, 0.85rem);
  border-radius: var(--radius-lg);
  border: 2px solid rgba(27, 26, 36, 0.12);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(255, 255, 255, 0.78) inset;
}

.game-question__meta-top {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: clamp(0.35rem, 1vw, 0.6rem);
  row-gap: 0.4rem;
}

.game-question__meta .game-forfeit-btn {
  margin-left: auto;
  align-self: center;
  padding: 0.28rem 0.75rem;
}

.game-forfeit-btn {
  background: rgba(255, 59, 92, 0.1);
  border: 1px solid rgba(255, 59, 92, 0.55);
  color: rgba(255, 59, 92, 0.95);
  padding: 0.3rem 0.85rem;
  font-size: 0.68rem;
  border-radius: 18px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.game-forfeit-btn:hover,
.game-forfeit-btn:focus-visible {
  background: rgba(255, 59, 92, 0.16);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md), 0 0 18px rgba(255, 59, 92, 0.22);
}

.game-question__timer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  width: 100%;
  max-width: 180px;
  min-width: 0;
  margin: 0 auto;
  align-self: center;
}

.game-question__timer {
  font-size: clamp(0.98rem, 3vw, 1.25rem);
  width: 100%;
  padding: 0.22rem 0.5rem;
  line-height: 1.2;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.game-question__timer-bar {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: rgba(27, 26, 36, 0.12);
  overflow: hidden;
  position: relative;
}

/* visible, glowing fill that smoothly transitions width set by JS */
.game-question__timer-fill {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, rgba(43,255,156,0.95), rgba(255,221,87,0.95), rgba(255,77,109,0.95));
  transition: width 0.12s linear, background 0.25s ease;
  border-radius: inherit;
  will-change: width, background;
  box-shadow: 0 0 12px rgba(43, 255, 156, 0.35);
  transform-origin: left center;
}

/* Larger, more tappable answer buttons */
.answer-option {
  min-height: clamp(92px, 18vh, 140px);
  padding: 1.15rem 1.2rem;
  font-size: clamp(0.95rem, 2.1vw, 1.05rem);
  line-height: 1.3;
}

/* Keep small-screen adjustments sensible */
@media (max-width: 640px) {
  .game-question__timer-bar {
    height: 5px;
  }
  .game-question__timer-fill {
    transition: width 0.14s linear, background 0.2s ease;
    box-shadow: 0 0 10px rgba(43, 255, 156, 0.28);
  }

  body[data-page='game'] .game-question__meta-top {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  body[data-page='game'] .game-question__timer-container {
    align-items: center;
  }

  body[data-page='game'] .answers button,
  body[data-page='game'] .answer-option {
    min-height: 64px;
    padding: 0.85rem 1rem;
    font-size: clamp(0.92rem, 4vw, 1rem);
  }
}

@keyframes correctPulse {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.01);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes wrongShake {
  0% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
  100% { transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
  .answer-option.correct,
  .answer-option.wrong {
    animation: none !important;
  }
}

.game-question__round {
  display: flex;
  flex-direction: row;
  align-items: center;
  text-align: center;
  gap: 0.45rem;
  min-width: 0;
}

.game-question__round-label {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(27, 26, 36, 0.55);
}

.game-question__round-value {
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: rgba(27, 26, 36, 0.85);
}

.game-status-chip {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  letter-spacing: 0.12em;
  font-size: 0.68rem;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(27, 26, 36, 0.16);
  color: rgba(27, 26, 36, 0.85);
  gap: 0.35rem;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  align-self: flex-end;
}

.game-status-chip.is-success {
  border-color: rgba(0, 255, 170, 0.6);
  background: rgba(0, 255, 170, 0.15);
  color: rgba(0, 255, 170, 0.9);
  box-shadow: 0 0 18px rgba(0, 255, 170, 0.28);
}

.game-status-chip.is-error {
  border-color: rgba(255, 77, 109, 0.6);
  background: rgba(255, 77, 109, 0.15);
  color: rgba(255, 77, 109, 0.9);
  box-shadow: 0 0 18px rgba(255, 77, 109, 0.3);
}

.game-status-chip.is-info {
  border-color: rgba(0, 255, 255, 0.5);
  background: rgba(0, 255, 255, 0.15);
  color: rgba(0, 255, 255, 0.9);
  box-shadow: 0 0 18px rgba(0, 255, 255, 0.28);
}

.game-question > h2 {
  margin: 0;
  font-size: clamp(1.15rem, 3.8vw, 1.6rem);
  line-height: 1.45;
  text-align: center;
  padding: clamp(0.4rem, 1vw, 0.75rem);
  background: rgba(255, 255, 255, 0.85);
  border-radius: var(--radius-lg);
  border: 2px solid rgba(27, 26, 36, 0.12);
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(255, 255, 255, 0.78) inset;
}

.game-versus {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
  gap: clamp(0.35rem, 1vw, 0.55rem);
  margin-bottom: 0;
}

.game-versus__player {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(0.35rem, 1vw, 0.6rem);
  padding: 0.45rem clamp(0.55rem, 1.8vw, 0.85rem);
  border-radius: 14px;
  border: 1px solid rgba(0, 188, 212, 0.22);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(255, 255, 255, 0.78) inset;
  min-width: 0;
}

.game-versus__identity {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.game-versus__player--opponent .game-versus__identity {
  justify-content: flex-end;
}

.game-versus__avatar {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid rgba(0, 255, 255, 0.35);
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.75);
}

.game-versus__name {
  font-size: clamp(0.7rem, 1.9vw, 0.86rem);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(27, 26, 36, 0.82);
  max-width: min(150px, 42vw);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-versus__player--opponent .game-versus__name {
  text-align: right;
}

.game-versus__score {
  font-size: clamp(0.95rem, 2.6vw, 1.18rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: rgba(0, 255, 255, 0.92);
  min-width: 2.75rem;
  text-align: right;
}

.game-versus__player[hidden] {
  display: none !important;
}

.answer-option {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(27, 26, 36, 0.14);
  background: rgba(255, 255, 255, 0.86);
  color: rgba(27, 26, 36, 0.92);
  text-align: left;
  padding: clamp(0.68rem, 2vw, 0.9rem) clamp(0.8rem, 2.4vw, 1.2rem);
  font-size: clamp(0.82rem, 2.5vw, 0.95rem);
  line-height: 1.35;
  letter-spacing: 0.02em;
  text-transform: none;
  transition:
    transform var(--dur-fast) var(--ease-out),
    border-color var(--dur-med) var(--ease-out),
    box-shadow var(--dur-med) var(--ease-out),
    background var(--dur-med) var(--ease-out),
    opacity var(--dur-med) var(--ease-out);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.answer-option::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(0, 255, 255, 0.1), transparent 60%);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.answer-option:hover,
.answer-option:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(0, 188, 212, 0.7);
  box-shadow: 0 0 16px rgba(0, 188, 212, 0.35);
}

.answer-option:hover::before,
.answer-option:focus-visible::before {
  opacity: 1;
}

.answer-option.correct {
  border-color: rgba(60, 255, 155, 0.85);
  box-shadow: 0 0 22px rgba(60, 255, 155, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.9) inset;
  background: rgba(60, 255, 155, 0.16);
  animation: correctPulse 520ms var(--ease-out);
}

.answer-option.wrong {
  border-color: rgba(255, 77, 109, 0.7);
  box-shadow: 0 0 18px rgba(255, 77, 109, 0.3);
  background: rgba(255, 77, 109, 0.08);
  opacity: 0.9;
  animation: wrongShake 420ms ease;
}

.answer-option.is-selected,
.answer-option.is-pressed {
  transform: scale(0.985);
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.35);
}

.answer-option:disabled {
  opacity: 0.5;
  pointer-events: none;
  cursor: not-allowed;
}

.answer-option:disabled {
  opacity: 0.5;
  pointer-events: none;
  cursor: not-allowed;
}

.round-summary {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.round-summary p {
  margin: 0;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

.game-post-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.game-proposal-actions {
  display: flex;
  gap: 0.5rem;
}

.modal-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.round-option-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.game-entry-overlay,
#countdown-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 18%, rgba(0, 188, 212, 0.18), transparent 70%),
    rgba(15, 23, 42, 0.38);
  backdrop-filter: blur(14px) saturate(130%);
  z-index: 80;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.game-entry-overlay.is-visible,
#countdown-overlay.is-visible {
  opacity: 1;
  pointer-events: all;
}

.game-entry-card,
.countdown-panel {
  width: min(420px, calc(100vw - 2rem));
  padding: clamp(1.6rem, 4vw, 2rem);
  border-radius: var(--radius-xl);
  border: 2px solid rgba(27, 26, 36, 0.14);
  background: var(--surface-3);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, 0.78) inset;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  text-align: center;
}

.game-entry-card > p {
  margin: 0;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(27, 26, 36, 0.72);
}

.loading-spinner {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 3px solid rgba(0, 255, 255, 0.18);
  border-top-color: rgba(0, 255, 255, 0.8);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.countdown-panel {
  width: 100%;
  max-width: min(720px, calc(100vw - 3rem));
  padding: clamp(1.2rem, 3.5vw, 1.8rem);
  gap: 0.6rem;
  animation: pulseOverlay 1.6s ease-in-out infinite;
}

.countdown-number {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(2.6rem, 10vw, 4.8rem);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  text-shadow: 0 0 20px rgba(0, 255, 255, 0.48);
}

#countdown-label {
  font-size: 0.85rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(27, 26, 36, 0.78);
}

.countdown-progress {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(27, 26, 36, 0.12);
  overflow: hidden;
  position: relative;
}

.countdown-progress__fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, rgba(0, 188, 212, 0.9), rgba(255, 79, 216, 0.75));
  transition: width 0.2s linear;
}

@keyframes pulseOverlay {
  0%, 100% {
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 24px 60px rgba(0, 255, 255, 0.25);
    transform: scale(1.01);
  }
}

@media (min-width: 641px) {
  .game-question__controls {
    flex-wrap: nowrap;
  }
}

input[type='text'],
input[type='email'],
input[type='password'],
input[type='url'],
input[type='number'],
input[type='search'],
input[type='tel'],
select,
textarea {
  width: 100%;
  min-height: 44px;
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  border: 2px solid rgba(27, 26, 36, 0.14);
  background: rgba(255, 255, 255, 0.92);
  color: var(--fg);
  margin-bottom: 1rem;
  transition: border-color var(--dur-med) var(--ease-out), box-shadow var(--dur-med) var(--ease-out),
    background var(--dur-med) var(--ease-out);
}

input[type='file'] {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-md);
  border: 2px dashed rgba(27, 26, 36, 0.18);
  background: rgba(255, 255, 255, 0.7);
  color: var(--fg);
  margin-bottom: 1rem;
}

input::placeholder,
textarea::placeholder {
  color: rgba(27, 26, 36, 0.45);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(0, 188, 212, 0.75);
  outline: none;
  box-shadow: 0 0 0 4px rgba(0, 188, 212, 0.18), 0 0 0 1px rgba(255, 255, 255, 0.8) inset;
}

input[type='checkbox'],
input[type='radio'] {
  width: 22px;
  height: 22px;
  min-height: 0;
  margin: 0;
  accent-color: var(--color-accent);
}

input[type='checkbox']:focus-visible,
input[type='radio']:focus-visible {
  outline: 3px solid var(--accent-yellow);
  outline-offset: 3px;
}

.grid {
  display: grid;
  gap: 1.5rem;
}

.flex {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.card {
  padding: 1.5rem;
  background: var(--surface-2);
  border-radius: var(--radius-lg);
  border: 2px solid rgba(27, 26, 36, 0.14);
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(255, 255, 255, 0.75) inset;
  transition: transform var(--dur-fast) var(--ease-out), border-color var(--dur-med) var(--ease-out),
    box-shadow var(--dur-med) var(--ease-out);
  position: relative;
}

.card::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: linear-gradient(
    135deg,
    rgba(0, 188, 212, 0.22),
    rgba(255, 79, 216, 0.18),
    rgba(255, 209, 102, 0.18)
  );
  z-index: -1;
  opacity: 0.55;
}

.card:focus-within {
  border-color: rgba(0, 188, 212, 0.55);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, 0.78) inset, 0 0 18px var(--glow-cyan);
}

@media (hover: hover) {
  .card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 79, 216, 0.35);
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, 0.78) inset, 0 0 20px var(--glow-pink);
  }
}

.home-main {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.home-hero {
  position: relative;
  width: 100%;
  padding: clamp(1.25rem, 4vw, 1.8rem);
  border-radius: var(--radius-xl);
  border: 2px solid rgba(27, 26, 36, 0.12);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.76));
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, 0.78) inset, 0 0 18px var(--glow-cyan);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-4);
}

.site-logo {
  width: clamp(140px, 28vw, 220px);
  display: block;
  margin: 0 auto;
  image-rendering: pixelated;
  filter: drop-shadow(0 10px 18px rgba(12, 10, 24, 0.14)) drop-shadow(0 0 16px var(--glow-pink));
}

.home-hero__content {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  position: relative;
  z-index: 1;
}

.home-hero__titles {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  align-items: center;
}

.home-hero__subtitle {
  margin: 0;
  max-width: 60ch;
}

.home-cta {
  width: 100%;
  display: grid;
  gap: var(--space-3);
}

@media (min-width: 520px) {
  .home-cta {
    grid-template-columns: 1fr 1fr;
  }
}

.home-secondary {
  width: 100%;
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  justify-content: center;
}

.home-secondary .btn {
  flex: 1 1 160px;
}

.home-hero__logo {
  animation: homeLogoFloat 5.8s ease-in-out infinite;
  transform-origin: center;
}

@keyframes homeLogoFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

.home-hero__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 7vw, 3.25rem);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  position: relative;
}

.home-hero__title::after {
  content: '';
  position: absolute;
  inset: -10px -30px;
  background: linear-gradient(120deg, transparent 35%, rgba(255, 255, 255, 0.7) 50%, transparent 65%);
  transform: translateX(-140%) rotate(8deg);
  opacity: 0.55;
  animation: homeTitleShimmer 4.8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes homeTitleShimmer {
  0%,
  60% {
    transform: translateX(-140%) rotate(8deg);
    opacity: 0;
  }
  65% {
    opacity: 0.6;
  }
  100% {
    transform: translateX(140%) rotate(8deg);
    opacity: 0;
  }
}

/* Decorative layer + lightweight parallax for the Home hero */
.home-hero--animated {
  --parallax-x: 0px;
  --parallax-y: 0px;
}

.home-hero__decor {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transform: translate3d(var(--parallax-x), var(--parallax-y), 0);
  transition: transform var(--dur-med) var(--ease-out);
  z-index: 0;
}

.home-shape,
.home-star {
  position: absolute;
  pointer-events: none;
}

.home-shape {
  opacity: 0.9;
  filter: drop-shadow(0 12px 24px rgba(12, 10, 24, 0.14));
}

.home-shape--pixel {
  width: 96px;
  height: 96px;
  border-radius: 20px;
  background: conic-gradient(from 210deg, rgba(0, 188, 212, 0.5), rgba(255, 79, 216, 0.45), rgba(255, 209, 102, 0.5));
  border: 2px solid rgba(27, 26, 36, 0.12);
  box-shadow: 0 0 26px var(--glow-cyan);
}

.home-shape--ring {
  width: 118px;
  height: 118px;
  border-radius: 999px;
  background: radial-gradient(closest-side, transparent 62%, rgba(255, 79, 216, 0.5) 64% 100%);
  border: 2px solid rgba(27, 26, 36, 0.1);
  box-shadow: 0 0 26px var(--glow-pink);
}

.home-shape--pill {
  width: 160px;
  height: 64px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 209, 102, 0.55), rgba(0, 188, 212, 0.35));
  border: 2px solid rgba(27, 26, 36, 0.1);
  box-shadow: 0 0 22px var(--glow-yellow);
}

.home-shape--1 {
  top: -26px;
  left: -26px;
  animation: homeFloatA 9s ease-in-out infinite;
}

.home-shape--2 {
  top: 18%;
  right: -44px;
  animation: homeFloatB 11s ease-in-out infinite;
}

.home-shape--3 {
  bottom: -22px;
  left: 22%;
  animation: homeFloatC 10s ease-in-out infinite;
}

@keyframes homeFloatA {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(-6deg);
  }
  50% {
    transform: translate3d(10px, 10px, 0) rotate(6deg);
  }
}

@keyframes homeFloatB {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(10deg);
  }
  50% {
    transform: translate3d(-10px, 12px, 0) rotate(-8deg);
  }
}

@keyframes homeFloatC {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  50% {
    transform: translate3d(12px, -8px, 0) rotate(6deg);
  }
}

.home-star {
  width: 3px;
  height: 3px;
  border-radius: 999px;
  background: rgba(27, 26, 36, 0.22);
  box-shadow: 0 0 10px rgba(0, 188, 212, 0.22);
  opacity: 0.7;
  animation: homeTwinkle 2.8s ease-in-out infinite;
}

.home-star--1 { top: 18px; right: 24px; animation-delay: 0s; }
.home-star--2 { top: 42%; left: 10px; animation-delay: 0.6s; }
.home-star--3 { bottom: 18px; right: 38%; animation-delay: 1.1s; }
.home-star--4 { top: 64%; right: 12%; animation-delay: 1.6s; }

@keyframes homeTwinkle {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(1);
  }
  50% {
    opacity: 0.9;
    transform: scale(1.35);
  }
}

/* Mode preview strip */
.home-modes {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.home-modes__strip {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}

@media (min-width: 720px) {
  .home-modes__strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.home-mode-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1.1rem 1.1rem;
  border-radius: var(--radius-lg);
  border: 2px solid rgba(27, 26, 36, 0.14);
  background: rgba(255, 255, 255, 0.86);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(255, 255, 255, 0.78) inset;
  position: relative;
  overflow: hidden;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-med) var(--ease-out),
    border-color var(--dur-med) var(--ease-out);
}

.home-mode-card::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(0, 188, 212, 0.22), rgba(255, 79, 216, 0.18), rgba(255, 209, 102, 0.18));
  opacity: 0.55;
  z-index: -1;
}

.home-mode-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.home-mode-card__emoji {
  font-size: 1.6rem;
  line-height: 1;
}

.home-mode-card__title {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: 0.08em;
}

.home-mode-card__desc {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.4;
}

.home-mode-card__cta {
  margin-top: 0.35rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(0, 188, 212, 0.95);
}

@media (hover: hover) {
  .home-mode-card:hover {
    transform: translateY(-2px);
    border-color: rgba(0, 188, 212, 0.35);
    box-shadow: var(--shadow-lg), 0 0 18px var(--glow-cyan);
  }
}

/* Play screen: mode cards */
.play-modes {
  display: grid;
  gap: var(--space-4);
}

.play-mode-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}

.play-mode-card__actions {
  margin-top: var(--space-4);
  display: grid;
  gap: var(--space-3);
}

.play-mode-card__info {
  width: 44px;
  height: 44px;
  min-height: 44px;
  border-radius: var(--radius-pill);
  padding: 0;
  font-weight: 900;
  font-size: 1rem;
  letter-spacing: 0;
  text-transform: none;
  flex: 0 0 44px;
}

.home-join-form {
  margin-top: 1.5rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: center;
}

.home-join-form input[type='text'] {
  border: 2px solid rgba(0, 188, 212, 0.35);
  background: rgba(255, 255, 255, 0.92);
  color: var(--fg);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.home-join-form input[type='text']::placeholder {
  color: rgba(27, 26, 36, 0.45);
}

#lobby-code-input {
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.35em;
  font-weight: 700;
}

#lobby-code-input::placeholder {
  text-align: center;
  letter-spacing: 0.25em;
}

.home-hero__badge {
  margin-bottom: 0.25rem;
}

.home-hero__title {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3rem);
  letter-spacing: 0.08em;
}

/* ------- Global fade transitions for foreground cards ------- */
.fade-container {
  position: relative;
  transition: opacity 280ms ease, transform 280ms ease;
  will-change: opacity, transform;
}

.fade-container.fade-out {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

.fade-container.fade-in {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .fade-container {
    transition: opacity 1ms ease;
    transform: none !important;
  }
  .fade-container.fade-out,
  .fade-container.fade-in {
    transform: none !important;
  }
}

.lobby-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.lobby-header__meta {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.lobby-header__meta h1 {
  margin: 0;
}

.lobby-header__meta p {
  margin: 0;
  max-width: 720px;
}

.lobby-back-btn {
  padding: 0.4rem 0.9rem;
  min-height: 0;
  border-radius: 10px;
  align-self: flex-start;
  font-weight: 700;
  letter-spacing: 0.08em;
}

@media (min-width: 768px) {
  .lobby-header {
    flex-direction: row;
    align-items: center;
  }
}

.panel-subtitle {
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}

.lobby-grid {
  display: grid;
  gap: clamp(1rem, 3vw, 1.6rem);
}

@media (min-width: 960px) {
  .lobby-grid {
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
    align-items: start;
  }
}

.lobby-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.lobby-panel__header {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.lobby-panel__header h2 {
  margin: 0;
}

.lobby-panel__header p {
  margin: 0;
}

.lobby-panel--versus {
  grid-column: 1 / -1;
}

.lobby-segmented {
  width: 100%;
}

.lobby-status-area {
  display: grid;
  gap: 0.6rem;
}

.lobby-status-area .loading-spinner {
  justify-self: center;
}

.lobby-form {
  display: grid;
  gap: 0.75rem;
  padding: 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(27, 26, 36, 0.12);
  background: rgba(255, 255, 255, 0.72);
}

.lobby-actions {
  display: grid;
  gap: 0.75rem;
}

.lobby-room {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.lobby-room__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
}

.lobby-room__meta {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.lobby-room__meta h2 {
  margin: 0;
}

.lobby-room__code {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.lobby-room__label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(27, 26, 36, 0.62);
}

.lobby-code-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.lobby-link-hint {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  text-align: left;
  margin: 0;
}

.lobby-code-badge {
  font-size: 1.05rem;
  letter-spacing: 0.2em;
  padding: 0.45rem 0.8rem;
}

.lobby-room__status {
  width: 100%;
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(27, 26, 36, 0.12);
  background: rgba(255, 255, 255, 0.7);
  text-align: center;
}

.lobby-room__status p {
  margin: 0;
}

.lobby-room__grid {
  display: grid;
  gap: 0.9rem;
}

@media (min-width: 720px) {
  .lobby-room__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.lobby-summary-card {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.lobby-summary-card h2 {
  margin: 0;
}

.lobby-players-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.lobby-player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.lobby-player-header h2 {
  margin: 0;
}

.lobby-player-list {
  gap: 0.6rem;
}

.lobby-player-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  border-radius: 12px;
  border: 1px solid rgba(27, 26, 36, 0.12);
  background: rgba(255, 255, 255, 0.78);
  text-align: left;
}

.lobby-player-list li span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.lobby-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem 1rem;
  margin: 0;
}

.lobby-details__row {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  align-items: flex-start;
}

.lobby-details__row dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(27, 26, 36, 0.62);
}

.lobby-details__row dd {
  margin: 0;
  font-size: clamp(0.9rem, 2.4vw, 1rem);
  font-weight: 600;
  letter-spacing: 0.06em;
}

.lobby-versus-grid {
  display: grid;
  gap: 0.75rem;
}

.lobby-versus-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.5rem;
}

.lobby-versus-targets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 0.5rem;
}

.popular-panel {
  width: 100%;
}

.popular-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.popular-list {
  display: grid;
  gap: 0.75rem;
}

.popular-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(27, 26, 36, 0.12);
}

.popular-item__name {
  font-weight: 600;
  letter-spacing: 0.04em;
}

.popular-item__stats {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(10px) saturate(120%);
  z-index: 300;
  padding: clamp(1rem, 6vw, 3rem);
}

.modal-panel {
  width: min(560px, 100%);
  max-height: min(80vh, 540px);
  overflow-y: auto;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--surface-3);
  border: 2px solid rgba(27, 26, 36, 0.14);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, 0.78) inset;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.modal-close {
  padding: 0.4rem 0.8rem;
  font-size: 1.5rem;
  line-height: 1;
}

.category-list {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.category-list .btn {
  width: 100%;
  padding: clamp(0.9rem, 2.2vw, 1.25rem) clamp(0.75rem, 2vw, 1.1rem);
}

.category-select-btn {
  padding: clamp(0.9rem, 2.2vw, 1.25rem) clamp(0.75rem, 2vw, 1.1rem);
}

.category-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.category-option__emoji {
  font-size: clamp(1.8rem, 4.5vw, 2.4rem);
  line-height: 1;
}

.category-option__title {
  font-size: clamp(0.75rem, 2vw, 0.9rem);
  line-height: 1.1;
}

.category-option--inline {
  display: inline-flex;
  flex-direction: column;
}

.forfeit-modal {
  background: rgba(6, 10, 18, 0.92);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.forfeit-modal.is-visible {
  opacity: 1;
}

.forfeit-modal__panel {
  padding: clamp(1.6rem, 4vw, 2.3rem);
  gap: 1.4rem;
  align-items: center;
  text-align: center;
}

.forfeit-modal__header h2 {
  margin: 0;
  font-size: clamp(1.25rem, 3.4vw, 1.5rem);
}

.forfeit-modal__message {
  margin: 0;
  font-size: clamp(0.95rem, 2.8vw, 1.05rem);
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.82);
}

.forfeit-modal__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.85rem;
}

.forfeit-modal__confirm {
  min-width: 160px;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  transform: none;
  width: 100%;
  --nav-padding-y: clamp(0.35rem, 1.6vw, 0.6rem);
  --nav-padding-x: clamp(0.75rem, 2.6vw, 1.2rem);
  padding: var(--nav-padding-y) var(--nav-padding-x);
  padding-bottom: calc(var(--nav-padding-y) + var(--safe-area-bottom));
  border-radius: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.74));
  border-top: 2px solid rgba(27, 26, 36, 0.12);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  justify-content: center;
  gap: clamp(0.6rem, 2vw, 1.2rem);
  box-shadow:
    0 -12px 30px rgba(12, 10, 24, 0.1),
    0 0 0 1px rgba(255, 255, 255, 0.75) inset;
  backdrop-filter: blur(18px) saturate(130%);
  z-index: 100;
  min-height: auto;
}

.bottom-nav__group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.5rem, 2vw, 1rem);
  flex: 1 1 0%;
  min-width: 0;
}

.bottom-nav__group--left {
  justify-content: flex-start;
}

.bottom-nav__group--right {
  justify-content: flex-end;
}

.bottom-nav__center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.65rem, 2.4vw, 1.1rem);
  flex: 0 0 auto;
  min-width: 0;
}

.bottom-nav__center > .nav-btn {
  margin: 0 auto;
}

.nav-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(48px, 14vw, 62px);
  height: clamp(48px, 14vw, 62px);
  border-radius: 18px;
  padding: 0;
  border: 1px solid rgba(27, 26, 36, 0.14);
  background: rgba(255, 255, 255, 0.65);
  color: rgba(27, 26, 36, 0.9);
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  line-height: 1;
  appearance: none;
  transition:
    transform var(--dur-fast) var(--ease-out),
    background var(--dur-med) var(--ease-out),
    border-color var(--dur-med) var(--ease-out),
    box-shadow var(--dur-med) var(--ease-out),
    color var(--dur-med) var(--ease-out);
  flex-shrink: 0;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.78) inset,
    var(--shadow-sm);
  -webkit-tap-highlight-color: transparent;
}

.nav-btn:hover,
.nav-btn:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(0, 188, 212, 0.45);
  background: rgba(0, 188, 212, 0.1);
  box-shadow: var(--shadow-md), 0 0 14px var(--glow-cyan);
}

.nav-btn::before {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  margin-right: 0.6rem;
  vertical-align: middle;
  flex: 0 0 20px;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
}

/* Home */
.bottom-nav .nav-btn[data-nav="home"]::before {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23fff' d='M3 9.75L12 3l9 6.75V21a1.5 1.5 0 0 1-1.5 1.5H4.5A1.5 1.5 0 0 1 3 21V9.75z'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23fff' d='M3 9.75L12 3l9 6.75V21a1.5 1.5 0 0 1-1.5 1.5H4.5A1.5 1.5 0 0 1 3 21V9.75z'/></svg>");
}

/* Play / Start (use a play triangle) */
.bottom-nav .nav-btn[data-nav="play"]::before {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23fff' d='M4 2v20l18-10L4 2z'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23fff' d='M4 2v20l18-10L4 2z'/></svg>");
}

/* Scoreboard / Leaderboard (trophy) */
.bottom-nav .nav-btn[data-nav="scoreboard"]::before {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23fff' d='M17 3H7v3a4 4 0 004 4h2a4 4 0 004-4V3zM7 11v2a5 5 0 005 5v3H9v2h6v-2h-3v-3a5 5 0 005-5v-2H7z'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23fff' d='M17 3H7v3a4 4 0 004 4h2a4 4 0 004-4V3zM7 11v2a5 5 0 005 5v3H9v2h6v-2h-3v-3a5 5 0 005-5v-2H7z'/></svg>");
}

/* Settings (gear) */
.bottom-nav .nav-btn[data-nav="settings"]::before {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23fff' d='M19.14 12.94a7.94 7.94 0 000-1.88l2.03-1.58a.5.5 0 00.12-.64l-1.92-3.32a.5.5 0 00-.6-.22l-2.39.96a7.86 7.86 0 00-1.62-.94L14.9 2.5a.5.5 0 00-.5-.5h-3.8a.5.5 0 00-.5.5l-.38 2.02c-.57.22-1.1.5-1.62.84L5.59 5.44a.5.5 0 00-.6.22L3.07 9a.5.5 0 00.12.64L5.22 11.2a8.03 8.03 0 000 1.6L3.19 14.38a.5.5 0 00-.12.64l1.92 3.32c.13.22.4.33.6.22l2.39-.96c.5.34 1.05.62 1.62.84l.38 2.02a.5.5 0 00.5.5h3.8a.5.5 0 00.5-.5l.38-2.02c.57-.22 1.1-.5 1.62-.84l2.39.96c.22.11.48 0 .6-.22l1.92-3.32a.5.5 0 00-.12-.64l-2.03-1.58zM12 15.5A3.5 3.5 0 1112 8.5a3.5 3.5 0 010 7z'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23fff' d='M19.14 12.94a7.94 7.94 0 000-1.88l2.03-1.58a.5.5 0 00.12-.64l-1.92-3.32a.5.5 0 00-.6-.22l-2.39.96a7.86 7.86 0 00-1.62-.94L14.9 2.5a.5.5 0 00-.5-.5h-3.8a.5.5 0 00-.5.5l-.38 2.02c-.57.22-1.1.5-1.62.84L5.59 5.44a.5.5 0 00-.6.22L3.07 9a.5.5 0 00.12.64L5.22 11.2a8.03 8.03 0 000 1.6L3.19 14.38a.5.5 0 00-.12.64l1.92 3.32c.13.22.4.33.6.22l2.39-.96c.5.34 1.05.62 1.62.84l.38 2.02a.5.5 0 00.5.5h3.8a.5.5 0 00.5-.5l.38-2.02c.57-.22 1.1-.5 1.62-.84l2.39.96c.22.11.48 0 .6-.22l1.92-3.32a.5.5 0 00-.12-.64l-2.03-1.58zM12 15.5A3.5 3.5 0 1112 8.5a3.5 3.5 0 010 7z'/></svg>");
}

/* Account - show user icon if no avatar; otherwise avatar image should display */
.bottom-nav .nav-btn[data-nav="account"]::before {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23fff' d='M12 12a4 4 0 100-8 4 4 0 000 8zm0 2c-3.3 0-6 2-6 4v1h12v-1c0-2-2.7-4-6-4z'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23fff' d='M12 12a4 4 0 100-8 4 4 0 000 8zm0 2c-3.3 0-6 2-6 4v1h12v-1c0-2-2.7-4-6-4z'/></svg>");
}

/* When account has avatar, hide the pseudo-icon and show avatar */
.bottom-nav .nav-btn--account.has-avatar::before,
.bottom-nav .nav-btn--account[data-has-avatar="1"]::before {
  display: none !important;
}
.bottom-nav .nav-btn--account .nav-account-avatar {
  display: inline-block;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 9px;
  object-fit: cover;
  margin-right: 0.5rem;
}

/* Active / hover visual consistency */
.bottom-nav .nav-btn:hover::before,
.bottom-nav .nav-btn.is-active::before {
  opacity: 1;
  filter: none;
}

/* Mobile sizing */
@media (max-width: 640px) {
  .bottom-nav .nav-btn::before {
    width: 18px;
    height: 18px;
    margin-right: 0.35rem;
  }
  .bottom-nav .nav-btn--account .nav-account-avatar {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    margin-right: 0.35rem;
  }
}

/* ------------------------- 2026 UI skeleton additions ------------------------- */

/* Bottom nav visibility is driven by script.js (adds/removes .is-visible). */
.bottom-nav {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease;
}

.bottom-nav.is-visible {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.bottom-nav .nav-btn:focus-visible {
  outline: 3px solid var(--accent-yellow);
  outline-offset: 2px;
}

.bottom-nav .nav-btn.is-active {
  border-color: rgba(0, 188, 212, 0.55);
  background: linear-gradient(180deg, rgba(0, 188, 212, 0.14), rgba(255, 79, 216, 0.1));
  box-shadow: var(--shadow-md), 0 0 16px var(--glow-cyan);
}

/* 4-tab app nav (Home / Play / Settings / Help) */
.bottom-nav.bottom-nav--tabs {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.bottom-nav.bottom-nav--tabs .nav-btn {
  width: 100%;
  height: auto;
  min-height: 56px; /* ~44px+ touch target + padding */
  border-radius: 16px;
  padding: 0.55rem 0.35rem;
  flex-direction: column;
  gap: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.62rem;
}

.bottom-nav.bottom-nav--tabs .nav-btn::before {
  width: 22px;
  height: 22px;
  margin: 0;
}

.bottom-nav .nav-btn__label {
  display: block;
  line-height: 1.05;
  font-weight: 700;
}

/* Help / About (info) */
.bottom-nav .nav-btn[data-nav="help"]::before {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23fff' d='M12 2a10 10 0 1 0 0 20a10 10 0 0 0 0-20zm0 17a1.25 1.25 0 1 1 0-2.5A1.25 1.25 0 0 1 12 19zm2.1-7.8c-.55.5-.85.8-.85 1.8v.5h-2v-.6c0-1.5.6-2.2 1.35-2.9c.55-.5.9-.85.9-1.5c0-.85-.65-1.4-1.65-1.4c-.95 0-1.75.5-2.05 1.45l-1.9-.8C8.55 5.65 10.05 4.5 12 4.5c2.25 0 3.75 1.25 3.75 3.05c0 1.35-.75 2.05-1.65 2.85z'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23fff' d='M12 2a10 10 0 1 0 0 20a10 10 0 0 0 0-20zm0 17a1.25 1.25 0 1 1 0-2.5A1.25 1.25 0 0 1 12 19zm2.1-7.8c-.55.5-.85.8-.85 1.8v.5h-2v-.6c0-1.5.6-2.2 1.35-2.9c.55-.5.9-.85.9-1.5c0-.85-.65-1.4-1.65-1.4c-.95 0-1.75.5-2.05 1.45l-1.9-.8C8.55 5.65 10.05 4.5 12 4.5c2.25 0 3.75 1.25 3.75 3.05c0 1.35-.75 2.05-1.65 2.85z'/></svg>");
}

/* Mode tiles (used on Play screen) */
.btn--small {
  padding: 0.55rem 0.9rem;
  min-height: 88px;
  font-size: 0.78rem;
  border-radius: 14px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  line-height: 1.25;
  user-select: none;
  border: 2px solid rgba(27, 26, 36, 0.14);
  background: rgba(255, 255, 255, 0.84);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(255, 255, 255, 0.78) inset;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.btn--small:hover {
  background: rgba(0, 188, 212, 0.12);
  border-color: rgba(0, 188, 212, 0.55);
  box-shadow: var(--shadow-md), 0 0 14px var(--glow-cyan);
  transform: translateY(-1px);
}

.btn--small.selected,
.btn--small.is-active {
  border-color: rgba(255, 79, 216, 0.5);
  box-shadow: var(--shadow-md), 0 0 14px var(--glow-pink);
  background: rgba(255, 79, 216, 0.14);
}

.btn--small .mode-label {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
}

/* Setup flow header (used across setup step screens) */
.setup-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  text-align: center;
  position: relative;
}

.setup-back-btn {
  align-self: flex-start;
  margin-left: 0;
  font-size: 0.75rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  letter-spacing: 0.1em;
}

.setup-header-meta {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: center;
}

.setup-header-meta h1 {
  margin: 0;
  font-size: clamp(1.2rem, 4vw, 1.6rem);
}

/* Reduced-motion: disable large ambient animations */
@media (prefers-reduced-motion: reduce) {
  body::before,
  body::after {
    animation: none !important;
  }

  .btn--primary::after {
    animation: none !important;
  }

  .home-hero__logo,
  .home-hero__title::after,
  .home-shape,
  .home-star {
    animation: none !important;
  }

  .home-hero__decor {
    transform: none !important;
  }

  .answers button {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  button,
  .btn,
  .card {
    transition-duration: 1ms !important;
  }

  .bottom-nav {
    transition: opacity 1ms ease;
    transform: none !important;
  }
}

/* Hide any inline/icon elements so they don't duplicate the CSS icon */
.bottom-nav .nav-btn > svg,
.bottom-nav .nav-btn > img.icon,
.bottom-nav .nav-btn > .icon,
.bottom-nav .nav-btn > i.icon {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  opacity: 0 !important;
  overflow: hidden !important;
}

/* Base pseudo-icon for nav buttons */
.bottom-nav:not(.bottom-nav--tabs) .nav-btn {
  position: relative;
  padding-left: 0.75rem; /* leave room for icon */
  padding-right: 0.75rem;
  align-items: center;
  display: inline-flex;
}

.bottom-nav:not(.bottom-nav--tabs) .nav-btn::before {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  margin-right: 0.6rem;
  vertical-align: middle;
  flex: 0 0 20px;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
}

/* Home */
.bottom-nav .nav-btn[data-nav="home"]::before {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23fff' d='M3 9.75L12 3l9 6.75V21a1.5 1.5 0 0 1-1.5 1.5H4.5A1.5 1.5 0 0 1 3 21V9.75z'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23fff' d='M3 9.75L12 3l9 6.75V21a1.5 1.5 0 0 1-1.5 1.5H4.5A1.5 1.5 0 0 1 3 21V9.75z'/></svg>");
}

/* Play / Start (use a play triangle) */
.bottom-nav .nav-btn[data-nav="play"]::before {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23fff' d='M4 2v20l18-10L4 2z'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23fff' d='M4 2v20l18-10L4 2z'/></svg>");
}

/* Scoreboard / Leaderboard (trophy) */
.bottom-nav .nav-btn[data-nav="scoreboard"]::before {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23fff' d='M17 3H7v3a4 4 0 004 4h2a4 4 0 004-4V3zM7 11v2a5 5 0 005 5v3H9v2h6v-2h-3v-3a5 5 0 005-5v-2H7z'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23fff' d='M17 3H7v3a4 4 0 004 4h2a4 4 0 004-4V3zM7 11v2a5 5 0 005 5v3H9v2h6v-2h-3v-3a5 5 0 005-5v-2H7z'/></svg>");
}

/* Settings (gear) */
.bottom-nav .nav-btn[data-nav="settings"]::before {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23fff' d='M19.14 12.94a7.94 7.94 0 000-1.88l2.03-1.58a.5.5 0 00.12-.64l-1.92-3.32a.5.5 0 00-.6-.22l-2.39.96a7.86 7.86 0 00-1.62-.94L14.9 2.5a.5.5 0 00-.5-.5h-3.8a.5.5 0 00-.5.5l-.38 2.02c-.57.22-1.1.5-1.62.84L5.59 5.44a.5.5 0 00-.6.22L3.07 9a.5.5 0 00.12.64L5.22 11.2a8.03 8.03 0 000 1.6L3.19 14.38a.5.5 0 00-.12.64l1.92 3.32c.13.22.4.33.6.22l2.39-.96c.5.34 1.05.62 1.62.84l.38 2.02a.5.5 0 00.5.5h3.8a.5.5 0 00.5-.5l.38-2.02c.57-.22 1.1-.5 1.62-.84l2.39.96c.22.11.48 0 .6-.22l1.92-3.32a.5.5 0 00-.12-.64l-2.03-1.58zM12 15.5A3.5 3.5 0 1112 8.5a3.5 3.5 0 010 7z'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23fff' d='M19.14 12.94a7.94 7.94 0 000-1.88l2.03-1.58a.5.5 0 00.12-.64l-1.92-3.32a.5.5 0 00-.6-.22l-2.39.96a7.86 7.86 0 00-1.62-.94L14.9 2.5a.5.5 0 00-.5-.5h-3.8a.5.5 0 00-.5.5l-.38 2.02c-.57.22-1.1.5-1.62.84L5.59 5.44a.5.5 0 00-.6.22L3.07 9a.5.5 0 00.12.64L5.22 11.2a8.03 8.03 0 000 1.6L3.19 14.38a.5.5 0 00-.12.64l1.92 3.32c.13.22.4.33.6.22l2.39-.96c.5.34 1.05.62 1.62.84l.38 2.02a.5.5 0 00.5.5h3.8a.5.5 0 00.5-.5l.38-2.02c.57-.22 1.1-.5 1.62-.84l2.39.96c.22.11.48 0 .6-.22l1.92-3.32a.5.5 0 00-.12-.64l-2.03-1.58zM12 15.5A3.5 3.5 0 1112 8.5a3.5 3.5 0 010 7z'/></svg>");
}

/* Account - show user icon if no avatar; otherwise avatar image should display */
.bottom-nav .nav-btn[data-nav="account"]::before {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23fff' d='M12 12a4 4 0 100-8 4 4 0 000 8zm0 2c-3.3 0-6 2-6 4v1h12v-1c0-2-2.7-4-6-4z'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23fff' d='M12 12a4 4 0 100-8 4 4 0 000 8zm0 2c-3.3 0-6 2-6 4v1h12v-1c0-2-2.7-4-6-4z'/></svg>");
}

/* When account has avatar, hide the pseudo-icon and show avatar */
.bottom-nav .nav-btn--account.has-avatar::before,
.bottom-nav .nav-btn--account[data-has-avatar="1"]::before {
  display: none !important;
}
.bottom-nav .nav-btn--account .nav-account-avatar {
  display: inline-block;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 9px;
  object-fit: cover;
  margin-right: 0.5rem;
}

/* Active / hover visual consistency */
.bottom-nav .nav-btn:hover::before,
.bottom-nav .nav-btn.is-active::before {
  opacity: 1;
  filter: none;
}

/* Mobile sizing */
@media (max-width: 640px) {
  .bottom-nav .nav-btn::before {
    width: 18px;
    height: 18px;
    margin-right: 0.35rem;
  }
  .bottom-nav .nav-btn--account .nav-account-avatar {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    margin-right: 0.35rem;
  }
}
