:root {
  color-scheme: light;
  --bg: #fcfcfc;
  --panel: rgba(255, 255, 255, 0.85);
  --card-bg: #ffffff;
  --card-border: rgba(0, 0, 0, 0.08);
  --text: #1f2937;
  --muted: #6b7280;
  --theme-button-start: #6b7280;
  --theme-button-end: #1f2937;
  --theme-button-fg: #ffffff;
  --particle-one: #6b7280;
  --particle-two: #1f2937;
  --line: rgba(0, 0, 0, 0.08);
  --de: #10b981;
  --het: #3b82f6;
  --wrong: #ef4444;
  --gold: #f59e0b;
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.06);
}

html {
  overflow-x: clip;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 18%, rgba(16, 185, 129, 0.06), transparent 24rem),
    radial-gradient(circle at 85% 70%, rgba(59, 130, 246, 0.05), transparent 26rem),
    var(--bg);
  overflow-x: clip;
}

button {
  border: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.app-shell {
  width: min(760px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 0;
  gap: 20px;
}

.game-panel {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.game-panel {
  min-height: auto;
  border-radius: 30px;
  padding: clamp(20px, 3.5vw, 36px);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.topbar,
.stats-grid,
.actions,
.level-row,
.card-zone {
  position: relative;
  z-index: 2;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  z-index: 40;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-logo {
  height: 48px;
  width: auto;
  object-fit: contain;
}

.eyebrow,
.card-level,
.stat span {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 4px 0 0;
  font-size: clamp(2.2rem, 5vw, 4.8rem);
  line-height: 0.9;
  letter-spacing: 0;
}

.sound-toggle,
.level-chip {
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.03);
}

.sound-toggle {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
}

.sound-toggle[aria-pressed='false'] {
  color: var(--muted);
}

.sound-icon {
  color: var(--gold);
}

.level-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin: 26px 0 18px;
  z-index: 12;
}

.level-picker {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}

.level-picker-trigger {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: 100%;
  min-height: 48px;
  padding: 8px 44px 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: color-mix(in srgb, var(--card-bg) 88%, var(--theme-button-start));
  box-shadow: 0 5px 14px color-mix(in srgb, var(--text) 9%, transparent);
  text-align: left;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.level-picker-fill {
  position: absolute;
  z-index: 0;
  inset: 0 auto 0 0;
  width: var(--level-picker-progress, 0%);
  pointer-events: none;
  background: color-mix(in srgb, var(--theme-button-start) 34%, var(--card-bg));
  transition: width 380ms ease;
}

.level-picker-heading,
.level-picker-value {
  position: relative;
  z-index: 1;
}

.level-picker-trigger:hover,
.level-picker-trigger[aria-expanded='true'] {
  transform: translateY(-1px);
  border-color: var(--theme-button-start);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--theme-button-start) 24%, transparent);
}

.level-picker-trigger:focus-visible {
  outline: 3px solid var(--theme-button-start);
  outline-offset: 3px;
}

.level-picker-heading,
.level-picker-value {
  display: inline-block;
  font-weight: 900;
}

.level-picker-heading {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.level-picker-value {
  margin-left: 9px;
  font-size: 0.96rem;
}

.level-picker-chevron {
  position: absolute;
  z-index: 1;
  top: 50%;
  right: 17px;
  width: 9px;
  height: 9px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-70%) rotate(45deg);
  transition: transform 180ms ease;
}

.level-picker-trigger.progress-glow .level-picker-fill {
  animation: levelPickerProgressGlow 640ms ease-out;
}

.level-picker-trigger[aria-expanded='true'] .level-picker-chevron {
  transform: translateY(-28%) rotate(225deg);
}

.level-picker-popover {
  position: absolute;
  z-index: 30;
  top: calc(100% + 10px);
  left: 0;
  width: min(620px, calc(100vw - 64px));
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card-bg);
  box-shadow: 0 18px 44px color-mix(in srgb, var(--text) 22%, transparent);
}

.level-progress-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.level-chip {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-width: 112px;
  min-height: 48px;
  padding: 7px 13px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 800;
  text-align: left;
  transition: transform 180ms ease, color 180ms ease, background 180ms ease, opacity 180ms ease;
}

.level-chip-label,
.level-chip-score {
  position: relative;
  z-index: 1;
  display: block;
}

.level-chip-label {
  font-size: 0.92rem;
  line-height: 1;
}

.level-chip-score {
  margin-top: 4px;
  font-size: 0.68rem;
  line-height: 1;
  opacity: 0.78;
}

.level-chip-fill {
  position: absolute;
  z-index: -1;
  inset: 0 auto 0 0;
  width: var(--level-progress, 0%);
  background: color-mix(in srgb, var(--theme-button-start) 50%, transparent);
  transition: width 380ms ease;
}

.level-chip[data-locked='true'] {
  cursor: pointer;
  opacity: 0.68;
}

.level-chip[data-locked='true'] .level-chip-label::after {
  content: 'Locked';
  margin-left: 6px;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.level-chip[data-unlocking='true'] .level-chip-label::after {
  content: 'Unlocking';
  color: var(--gold);
}

.level-chip.unlock-reveal {
  animation: levelUnlockReveal 900ms cubic-bezier(0.17, 0.84, 0.44, 1) both;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--gold) 55%, transparent), 0 0 28px color-mix(in srgb, var(--particle-one) 48%, transparent);
}

.level-chip[data-premium='true'] .level-chip-label::before {
  content: '✦';
  margin-right: 5px;
  color: var(--gold);
}

.level-select {
  display: none;
  min-height: 44px;
  padding: 0 15px;
  border-radius: 12px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  font-weight: 800;
  font-size: 1rem;
  width: 100%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.level-chip:hover {
  transform: translateY(-1px);
}

.level-chip.active {
  color: var(--bg);
  background: var(--text);
  border-color: var(--text);
}

.level-chip.active .level-chip-fill {
  background: color-mix(in srgb, var(--theme-button-start) 75%, transparent);
}

.theme-launch-btn {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--theme-button-start), var(--theme-button-end));
  color: var(--theme-button-fg);
  font-weight: 800;
  letter-spacing: 0.01em;
  box-shadow: 0 7px 16px rgba(0, 0, 0, 0.2);
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.theme-launch-btn::after {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 1px;
  border-radius: inherit;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.22), transparent 42%);
}

.theme-launch-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.26);
  filter: saturate(1.12);
}

.theme-launch-btn:focus-visible {
  outline: 3px solid var(--muted);
  outline-offset: 3px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.game-panel.frenzy-active::after {
  content: '';
  position: absolute;
  z-index: 1;
  inset: -30%;
  pointer-events: none;
  background: conic-gradient(from 90deg, transparent, color-mix(in srgb, var(--particle-one) 15%, transparent), transparent, color-mix(in srgb, var(--particle-two) 16%, transparent), transparent);
  mix-blend-mode: screen;
  animation: frenzyFlare 3s ease-out forwards;
}

.stat {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 82px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card-bg, rgba(0, 0, 0, 0.02));
}

.stat::after {
  content: '';
  position: absolute;
  z-index: 0;
  inset: -45%;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle, color-mix(in srgb, var(--theme-button-start) 32%, transparent) 0%, transparent 64%);
}

.stat > span,
.stat > strong {
  position: relative;
  z-index: 1;
}

.stat > span {
  display: block;
}

.stat.stat-celebrate {
  animation: statPillCelebrate 480ms cubic-bezier(0.17, 0.84, 0.44, 1);
}

.stat.stat-celebrate::after {
  animation: statPillLight 480ms ease-out;
}

.stat.stat-celebrate strong {
  animation: statValueCelebrate 480ms cubic-bezier(0.17, 0.84, 0.44, 1);
}

.stat.stat-celebrate-strong {
  animation: statPillCelebrateStrong 680ms cubic-bezier(0.17, 0.84, 0.44, 1);
}

.stat.stat-celebrate-strong::after {
  animation: statPillLightStrong 680ms ease-out;
}

.stat.stat-celebrate-strong strong {
  animation: statValueCelebrateStrong 680ms cubic-bezier(0.17, 0.84, 0.44, 1);
}

.stat strong {
  display: inline-block;
  margin-top: 8px;
  font-size: clamp(1.35rem, 3vw, 2.1rem);
  color: var(--text);
  transform-origin: center;
}

.card-zone {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 380px;
  margin: 20px 0;
  perspective: 1200px;
}

.word-card {
  width: min(380px, 100%);
  aspect-ratio: 0.82;
  position: relative;
  z-index: 4;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 28px 24px;
  text-align: center;
  border: 1px solid var(--card-border, var(--line));
  background: var(--card-bg, #ffffff);
  border-radius: 26px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.06);
  touch-action: none;
  user-select: none;
  transform: translate3d(0, 0, 0) rotate(0deg);
  transition: border-color 180ms ease, background 180ms ease;
  backface-visibility: hidden;
  will-change: transform, opacity;
  overflow: hidden;
}

.word-card::before {
  content: '';
  position: absolute;
  inset: 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  pointer-events: none;
}

.word-card h2 {
  width: 100%;
  max-width: 100%;
  margin: 6px 0 10px;
  font-size: var(--word-size, clamp(2rem, 8vw, 4.8rem));
  line-height: 1.15;
  white-space: nowrap;
  letter-spacing: -0.01em;
  color: var(--text);
}

.translation {
  min-height: 28px;
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 700;
}

.card-feedback {
  position: absolute;
  top: 26px;
  left: 26px;
  right: 26px;
  min-height: 42px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  opacity: 0;
  transform: translateY(-8px);
  font-weight: 900;
  transition: opacity 160ms ease, transform 160ms ease;
}

.word-card.show-de .card-feedback,
.word-card.show-het .card-feedback {
  opacity: 1;
  transform: translateY(0);
}

.word-card.show-de {
  border-color: rgba(103, 224, 183, 0.72);
}

.word-card.show-het {
  border-color: rgba(130, 183, 255, 0.72);
}

.word-card.show-de .card-feedback {
  background: rgba(16, 185, 129, 0.15);
  color: var(--de);
}

.word-card.show-het .card-feedback {
  background: rgba(59, 130, 246, 0.15);
  color: var(--het);
}

.ambient {
  position: absolute;
  border-radius: 999px;
  filter: blur(24px);
  opacity: 0.46;
  animation: drift 7s ease-in-out infinite alternate;
}

.ambient-one {
  width: 160px;
  height: 160px;
  background: var(--de);
  left: 12%;
  top: 18%;
}

.ambient-two {
  width: 190px;
  height: 190px;
  background: var(--het);
  right: 11%;
  bottom: 14%;
  animation-delay: -2s;
}

.theme-particles {
  position: absolute;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.particle-shockwave {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 50%;
  width: 260px;
  aspect-ratio: 1;
  border: 1px solid var(--particle-one);
  border-radius: 50%;
  box-shadow: 0 0 10px color-mix(in srgb, var(--particle-two) 18%, transparent);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.18);
}

.particle-shockwave.milestone-pulse::after {
  content: '';
  position: absolute;
  inset: -8px;
  border: 1px solid var(--particle-two);
  border-radius: inherit;
  animation: particle-shockwave 820ms 110ms ease-out forwards;
}

.particle-shockwave.pulse {
  animation: particle-shockwave 520ms ease-out forwards;
}

.theme-particle {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--particle-size, 12px);
  height: var(--particle-size, 12px);
  color: var(--particle-one);
  background: currentColor;
  opacity: 0.6;
  filter: drop-shadow(0 0 3px color-mix(in srgb, var(--particle-two) 38%, transparent));
  pointer-events: none;
  will-change: transform, opacity, filter;
}

.theme-particle::before,
.theme-particle::after {
  content: '';
  position: absolute;
  inset: 0;
}

.theme-particle[data-shape="star"],
.theme-particle[data-shape="starburst"] {
  clip-path: polygon(50% 0%, 61% 35%, 100% 50%, 61% 64%, 50% 100%, 38% 64%, 0% 50%, 38% 35%);
  background: linear-gradient(135deg, var(--particle-one), var(--particle-two));
  box-shadow: 0 0 16px var(--particle-two);
}

.theme-particle[data-shape="planet"],
.theme-particle[data-shape="bubble"],
.theme-particle[data-shape="node"],
.theme-particle[data-shape="sun-mote"] {
  border-radius: 50%;
}

.theme-particle[data-shape="planet"] {
  background: radial-gradient(circle at 35% 30%, #ffffff, var(--particle-two) 25%, var(--particle-one) 68%);
  box-shadow: 0 0 18px var(--particle-two);
}

.theme-particle[data-shape="leaf"],
.theme-particle[data-shape="leaf-alt"],
.theme-particle[data-shape="petal"],
.theme-particle[data-shape="rose-petal"] {
  border-radius: 100% 0 100% 0;
  background: linear-gradient(135deg, var(--particle-one), var(--particle-two));
}

.theme-particle[data-shape="leaf-alt"] {
  border-radius: 100% 0 100% 0;
  filter: hue-rotate(24deg);
}

.theme-particle[data-shape="bubble"] {
  border: 1.5px solid var(--particle-two);
  background: color-mix(in srgb, var(--particle-one) 10%, transparent);
  box-shadow: inset 2px 2px 4px rgba(255,255,255,.45), 0 0 9px var(--particle-two);
}

.theme-particle[data-shape="droplet"] {
  border-radius: 100% 0 100% 100%;
  background: linear-gradient(135deg, var(--particle-two), var(--particle-one));
}

.theme-particle[data-shape="wave"] {
  height: calc(var(--particle-size, 12px) / 2);
  border: 2px solid var(--particle-one);
  border-left: 0;
  border-right: 0;
  border-radius: 50%;
  background: transparent;
}

.theme-particle[data-shape="snowflake"] {
  background: linear-gradient(90deg, transparent 42%, #ffffff 42% 58%, transparent 58%), linear-gradient(0deg, transparent 42%, #ffffff 42% 58%, transparent 58%);
  filter: drop-shadow(0 0 5px var(--particle-two));
}

.theme-particle[data-shape="crystal"],
.theme-particle[data-shape="diamond"],
.theme-particle[data-shape="chip"] {
  transform-origin: center;
  border: 1.5px solid var(--particle-two);
  background: color-mix(in srgb, var(--particle-one) 24%, transparent);
}

.theme-particle[data-shape="spark"],
.theme-particle[data-shape="ray"],
.theme-particle[data-shape="line"] {
  height: 2px;
  border-radius: 99px;
  background: linear-gradient(90deg, transparent, var(--particle-one), var(--particle-two), transparent);
  box-shadow: 0 0 8px var(--particle-two);
}

.theme-particle[data-shape="node"] {
  width: calc(var(--particle-size, 12px) * .65);
  height: calc(var(--particle-size, 12px) * .65);
  box-shadow: 0 0 12px var(--particle-one);
}

.theme-particle[data-shape="sun-mote"] {
  background: radial-gradient(circle, #fff7c5 0 22%, var(--particle-two) 23% 58%, transparent 60%);
  box-shadow: 0 0 16px var(--particle-two);
}

.theme-particle[data-shape="sand-grain"] {
  border-radius: 2px;
  background: linear-gradient(135deg, var(--particle-one), var(--particle-two));
}

.theme-particle[data-shape="flower"] {
  border-radius: 50%;
  background: var(--particle-two);
  box-shadow: 7px 0 0 var(--particle-one), -7px 0 0 var(--particle-one), 0 7px 0 var(--particle-two), 0 -7px 0 var(--particle-two);
}

@keyframes particle-shockwave {
  0% { opacity: 0.16; transform: translate(-50%, -50%) scale(0.18); }
  65% { opacity: 0.06; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.55); }
}

@keyframes levelPickerProgressGlow {
  0%, 100% {
    filter: brightness(1) saturate(1);
    box-shadow: inset 0 0 0 color-mix(in srgb, var(--theme-button-start) 0%, transparent);
  }
  38% {
    filter: brightness(1.12) saturate(1.08);
    box-shadow: inset 0 0 18px color-mix(in srgb, #ffffff 58%, var(--theme-button-start));
  }
}

@keyframes statPillCelebrate {
  0%, 100% { transform: scale(1); border-color: var(--line); box-shadow: none; }
  42% { transform: scale(1.018); border-color: color-mix(in srgb, var(--theme-button-start) 58%, var(--line)); box-shadow: 0 0 20px color-mix(in srgb, var(--theme-button-start) 20%, transparent); }
}

@keyframes statPillCelebrateStrong {
  0%, 100% { transform: scale(1); border-color: var(--line); box-shadow: none; }
  38% { transform: scale(1.045); border-color: color-mix(in srgb, var(--theme-button-start) 74%, var(--line)); box-shadow: 0 0 30px color-mix(in srgb, var(--theme-button-start) 32%, transparent); }
}

@keyframes statPillLight {
  0%, 100% { opacity: 0; transform: scale(0.72); }
  42% { opacity: 1; transform: scale(1); }
}

@keyframes statPillLightStrong {
  0%, 100% { opacity: 0; transform: scale(0.66); }
  38% { opacity: 1; transform: scale(1.08); }
}

@keyframes statValueCelebrate {
  0%, 100% { transform: scale(1); }
  42% { transform: scale(1.1); }
}

@keyframes statValueCelebrateStrong {
  0%, 100% { transform: scale(1); }
  38% { transform: scale(1.2); }
}

@media (prefers-reduced-motion: reduce) {
  .ambient,
  .theme-particle {
    animation: none;
  }

  .theme-particles {
    display: none;
  }

  .particle-shockwave {
    display: none;
  }

  .milestone-burst,
  .milestone-ripple {
    display: none;
  }

  .game-panel.frenzy-active::after {
    animation: none;
    opacity: 0.16;
  }

  .level-chip.unlock-reveal {
    animation: none;
    filter: none;
  }

  .level-picker-trigger.progress-glow .level-picker-fill {
    animation: none;
  }

  .stat.stat-celebrate,
  .stat.stat-celebrate-strong,
  .stat.stat-celebrate::after,
  .stat.stat-celebrate-strong::after,
  .stat.stat-celebrate strong,
  .stat.stat-celebrate-strong strong {
    animation: none;
  }
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.answer-button {
  min-height: 68px;
  border: 1px solid var(--line);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 1.35rem;
  font-weight: 900;
  background: var(--card-bg, #ffffff);
  color: var(--text);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease, color 180ms ease;
}

.answer-button:hover {
  transform: translateY(-2px);
  background: var(--line);
  border-color: var(--muted);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
}

.de-button {
  color: var(--text);
}

.het-button {
  color: var(--text);
}

.arrow {
  font-size: 1.5rem;
}

.milestone {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: start center;
  padding-top: 48px;
  pointer-events: none;
  opacity: 0;
}

.milestone strong {
  position: relative;
  z-index: 2;
  padding: 12px 18px;
  border-radius: 999px;
  color: #1f2937;
  border: 2px solid #d9971e;
  background: #fffdf8;
  box-shadow: 0 16px 52px rgba(0, 0, 0, 0.18), 0 0 0 5px rgba(247, 201, 93, 0.16);
  backdrop-filter: blur(18px);
  font-size: clamp(1rem, 3vw, 1.35rem);
  font-weight: 900;
  transform: scale(0.72);
}

.milestone-burst {
  position: absolute;
  top: 48px;
  left: 50%;
  width: 90px;
  height: 90px;
  border-radius: 999px;
  border: 2px solid rgba(247, 201, 93, 0.16);
  transform: translateX(-50%) scale(0.2);
}

.milestone-ripple {
  position: absolute;
  top: 49px;
  left: 50%;
  width: 72px;
  height: 72px;
  border: 1px solid color-mix(in srgb, var(--gold) 30%, transparent);
  border-radius: 50%;
  box-shadow: 0 0 18px color-mix(in srgb, var(--gold) 10%, transparent);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.35);
}

.confetti {
  position: absolute;
  left: 50%;
  top: 74px;
  width: 10px;
  height: 12px;
  border-radius: 4px;
  background: var(--gold);
  transform: translate(-50%, -50%) rotate(var(--spin));
  animation: confetti 900ms cubic-bezier(0.17, 0.84, 0.44, 1) forwards;
}

.milestone.show {
  animation: milestoneFade 2s ease forwards;
}

.milestone.show strong {
  animation: milestonePop 680ms cubic-bezier(0.17, 0.84, 0.44, 1) forwards;
}

.milestone.show .milestone-burst {
  animation: burst 880ms ease-out forwards;
}

.milestone.show .milestone-ripple-one {
  animation: milestoneRipple 1s ease-out forwards;
}

.milestone.show .milestone-ripple-two {
  animation: milestoneRipple 1s 170ms ease-out forwards;
}

.milestone.show.level-complete {
  animation: levelCompletionFade 4s ease forwards;
}

.milestone.show.level-complete strong {
  color: #1f2937;
  border-color: #d9971e;
  background: #fffdf8;
  box-shadow: 0 16px 52px rgba(0, 0, 0, 0.18), 0 0 0 5px rgba(247, 201, 93, 0.16);
}

.fly-left {
  animation: flyLeft 430ms cubic-bezier(0.2, 0.72, 0.18, 1) forwards;
}

.fly-right {
  animation: flyRight 430ms cubic-bezier(0.2, 0.72, 0.18, 1) forwards;
}

.snap-back {
  transition: transform 220ms cubic-bezier(0.2, 0.72, 0.18, 1), border-color 180ms ease;
}

.shake {
  animation: shake 300ms ease;
}

@keyframes drift {
  to {
    transform: translate3d(18px, -22px, 0) scale(1.08);
  }
}

@keyframes flyLeft {
  to {
    transform: translate3d(-145%, 0, 0) rotate(-14deg);
    opacity: 0;
  }
}

@keyframes flyRight {
  to {
    transform: translate3d(145%, 0, 0) rotate(14deg);
    opacity: 0;
  }
}

@keyframes shake {
  25% {
    transform: translateX(-10px) rotate(-2deg);
  }
  50% {
    transform: translateX(8px) rotate(2deg);
  }
  75% {
    transform: translateX(-5px) rotate(-1deg);
  }
}

@keyframes milestoneFade {
  0%,
  68% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes levelCompletionFade {
  0%,
  85% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes milestonePop {
  0% {
    transform: scale(0.86) translateY(-8px);
  }
  45% {
    transform: scale(1.04) translateY(0);
  }
  100% {
    transform: scale(1) translateY(0);
  }
}

@keyframes burst {
  to {
    transform: translateX(-50%) scale(1.7);
    opacity: 0;
  }
}

@keyframes milestoneRipple {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.35);
  }
  18% {
    opacity: 0.18;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(2.8);
  }
}

@keyframes frenzyFlare {
  0% { opacity: 0; transform: scale(0.72) rotate(0deg); }
  12% { opacity: 1; }
  78% { opacity: 0.45; }
  100% { opacity: 0; transform: scale(1.1) rotate(18deg); }
}

@keyframes levelUnlockReveal {
  0% { transform: scale(0.9); filter: brightness(1); }
  38% { transform: scale(1.08); filter: brightness(1.5); }
  100% { transform: scale(1); filter: brightness(1); }
}

@keyframes confetti {
  70% {
    opacity: 1;
  }
  100% {
    transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) rotate(calc(var(--spin) + 300deg));
    opacity: 0;
  }
}

@media (max-width: 860px) {
  .app-shell {
    align-items: start;
  }

  .game-panel {
    min-height: auto;
  }
}

@media (max-width: 600px) {
  .app-shell {
    width: 100%;
    padding: 12px 12px 32px;
    min-height: 100vh;
    min-height: 100dvh;
    height: auto;
    align-items: center;
    gap: 16px;
  }

  .game-panel {
    border-radius: 24px;
    padding: 16px 14px;
    height: auto;
    min-height: auto;
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .about-section {
    border-radius: 20px;
    margin: 0;
    width: 100%;
    max-width: 420px;
    padding: 20px 18px;
  }

  .topbar {
    align-items: center;
  }
  
  .topbar-logo {
    height: 32px;
  }

  .level-progress-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    width: 100%;
  }

  .level-chip {
    display: block;
    min-width: 0;
    min-height: 42px;
    padding: 6px 10px;
  }

  .theme-launch-btn {
    min-height: 40px;
    padding: 0 14px;
    width: auto;
  }
  
  .level-row {
    display: flex;
    margin: 10px 0 12px;
    width: 100%;
  }

  .level-picker-trigger {
    min-height: 40px;
    padding: 7px 38px 7px 13px;
  }

  .level-picker-heading {
    font-size: 0.65rem;
  }

  .level-picker-value {
    margin-left: 5px;
    font-size: 0.82rem;
  }

  .level-picker-popover {
    width: min(100%, calc(100vw - 52px));
    padding: 8px;
  }

  .sound-toggle span:last-child {
    display: none;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .stat {
    min-height: 52px;
    padding: 8px 10px;
    border-radius: 14px;
  }
  
  .stat strong {
    font-size: 1.25rem;
    margin-top: 2px;
  }

  .card-zone {
    flex: initial;
    min-height: auto;
    margin: 14px 0 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
  }

  .word-card {
    width: min(280px, 80vw);
    aspect-ratio: 1;
    height: auto;
    padding: 20px 16px;
    border-radius: 22px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.07);
  }

  .word-card::before {
    inset: 8px;
    border-radius: 14px;
  }

  .word-card h2 {
    font-size: var(--word-size, clamp(1.8rem, 7.5vw, 3.4rem));
    margin: 4px 0 8px;
  }

  .translation {
    font-size: 1.05rem;
  }
  
  .ambient-one, .ambient-two {
    display: none;
  }

  .theme-particle:nth-child(n + 11) {
    display: none;
  }

  .actions {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 2px;
  }
  
  .answer-button {
    min-height: 54px;
    border-radius: 16px;
    font-size: 1.2rem;
  }
}

/* Menu & Topbar Actions */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.menu-container {
  position: relative;
}

.menu-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s ease;
}

.menu-toggle:hover {
  background: var(--line);
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: var(--card-bg, var(--bg));
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  min-width: 200px;
  z-index: 50;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
}

.dropdown-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-menu ul {
  list-style: none;
  margin: 0;
  padding: 8px 0;
}

.dropdown-menu li {
  padding: 0;
}

.dropdown-menu button,
.dropdown-menu a {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 20px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

.dropdown-menu button:hover,
.dropdown-menu a:hover {
  background: var(--line);
}

/* Modals */
.modal {
  border: none;
  border-radius: 16px;
  padding: 0;
  background: transparent;
  max-width: 600px;
  width: 90%;
  margin: auto;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.3s ease;
}

.modal-content {
  background: var(--card-bg, var(--bg));
  color: var(--text);
  padding: 32px;
  border-radius: 16px;
  position: relative;
  box-shadow: 0 20px 40px rgba(0,0,0,0.25);
  border: 1px solid var(--line);
}

.modal-content.scrollable {
  max-height: 80vh;
  overflow-y: auto;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s, color 0.2s;
}

.modal-close:hover {
  background: var(--line);
  color: var(--text);
}

.modal h2 {
  margin-top: 0;
  color: var(--text);
}

.policy-text h3 {
  margin-top: 24px;
  color: var(--text);
}

.policy-text p, .policy-text ul {
  color: var(--muted);
  line-height: 1.6;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Theme Modal Grid */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 16px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 4px;
}

.theme-card {
  background: var(--bg);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
  text-align: left;
}

.theme-card:hover {
  transform: translateY(-2px);
  border-color: var(--muted);
}

.theme-card-title {
  font-weight: 600;
  margin: 0 0 12px 0;
  font-size: 0.95rem;
  color: var(--text);
}

.theme-colors {
  display: flex;
  gap: 8px;
}

.theme-color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.theme-card.locked {
  opacity: 0.85;
}

.theme-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.theme-card-header .theme-card-title {
  margin: 0;
}

.theme-lock-badge {
  font-size: 0.76rem;
  background: var(--line);
  color: var(--text);
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

/* Footer & About Section */
.app-footer {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.about-section {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px 28px;
  text-align: center;
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.about-section h2 {
  margin: 0 0 8px;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
}

.about-section p {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.55;
}

.footer-bottom {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding-bottom: 8px;
}

.footer-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  transition: color 0.18s ease, background 0.18s ease;
}

.footer-btn:hover {
  color: var(--text);
  background: var(--line);
}

.footer-dot {
  color: var(--muted);
  opacity: 0.6;
  font-size: 0.8rem;
}

/* Share Modal */
.share-modal-content {
  max-width: 440px;
  text-align: center;
}

.share-subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  margin: -4px 0 20px;
}

.share-input-group {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.share-input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
}

.share-copy-btn {
  padding: 12px 18px;
  background: var(--text);
  color: var(--card-bg, var(--bg));
  border: 1px solid var(--text);
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.share-copy-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.native-share-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 18px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.native-share-btn:hover {
  background: var(--line);
  border-color: var(--muted);
}

/* Phone App Guide */
.phone-app-modal-content {
  max-width: 540px;
}

.phone-app-subtitle,
.phone-app-note {
  color: var(--muted);
  line-height: 1.55;
}

.phone-app-subtitle {
  margin: -4px 0 20px;
}

.phone-app-note {
  margin: 18px 0 0;
  font-size: 0.92rem;
}

.phone-app-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.phone-app-platform {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
  padding: 16px;
}

.phone-app-platform h3 {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 1rem;
}

.phone-app-platform ol {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.9rem;
}

.phone-app-platform li + li {
  margin-top: 7px;
}

@media (max-width: 520px) {
  .phone-app-steps {
    grid-template-columns: 1fr;
  }
}

/* Contact Modal */
.contact-modal-content {
  max-width: 440px;
  text-align: center;
}

.contact-subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  margin: -4px 0 20px;
}

.contact-box {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.contact-email-link {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.contact-email-link:hover {
  text-decoration: underline;
}

.contact-actions {
  display: flex;
  gap: 10px;
  width: 100%;
}

.contact-btn {
  flex: 1;
  padding: 12px 14px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

.contact-btn.email-btn {
  background: var(--text);
  color: var(--card-bg, var(--bg));
  border: 1px solid var(--text);
}

.contact-btn.copy-btn {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
}

.contact-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* Unlock & Thank You Modals */
.unlock-modal-content,
.thankyou-modal-content {
  max-width: 450px;
  text-align: center;
}

.modal-badge-icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

.unlock-subtitle,
.thankyou-subtitle {
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.5;
  margin: 0 0 20px;
}

.unlock-actions {
  margin-bottom: 14px;
}

.unlock-donate-btn,
.choose-theme-btn {
  display: inline-block;
  width: 100%;
  padding: 14px 20px;
  background: var(--text);
  color: var(--card-bg, var(--bg));
  border: 1px solid var(--text);
  border-radius: 14px;
  font-size: 1.05rem;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.unlock-donate-btn:hover,
.choose-theme-btn:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.unlock-note {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.4;
}
