@import url("https://fonts.googleapis.com/css2?family=Baloo+2:wght@400;600;700&family=Inter:wght@400;600&display=swap");

:root {
  --bg: #0b0f2a;
  --panel: rgba(255, 255, 255, 0.08);
  --panel-strong: rgba(255, 255, 255, 0.14);
  --accent: #ffb800;
  --accent-2: #00e2ff;
  --accent-3: #ff4d9d;
  --bolt-yellow: #ffd23a;
  --bolt-red: #ff3b1f;
  --text: #f6f7ff;
  --muted: rgba(255, 255, 255, 0.65);
  --success: #70ff9a;
  --danger: #ff6b6b;
  --tier-glow-strong: rgba(0, 0, 0, 0);
  --tier-glow-soft: rgba(0, 0, 0, 0);
  --tier-glow-shadow: rgba(0, 0, 0, 0);
  --scene-edge-hot: rgba(255, 170, 94, 0.56);
  --scene-edge-warm: rgba(255, 132, 44, 0.3);
  --scene-edge-fade: rgba(255, 132, 44, 0);
  --safe-top: env(safe-area-inset-top, 0px);
  --frozen-tile-texture: url("ice_texture_exact.svg");
  --frozen-tile-color: rgba(120, 185, 230, 0.35);
  --frozen-tile-filter: saturate(1.2) contrast(1.08);
  --frozen-tile-border: rgba(140, 220, 255, 0.35);
  --frozen-tile-shadow: rgba(40, 120, 200, 0.18);
  --frozen-highlight-opacity: 0.45;
  --frozen-shine-opacity: 0.3;
}

body.frozen-tiles-alt {
  --frozen-tile-texture: none;
  --frozen-tile-color: transparent;
  --frozen-tile-filter: saturate(0.75) brightness(0.56) contrast(0.92);
  --frozen-tile-border: rgba(126, 152, 240, 0.24);
  --frozen-tile-shadow: rgba(5, 14, 56, 0.56);
  --frozen-highlight-opacity: 0;
  --frozen-shine-opacity: 0;
}

@property --goal-progress {
  syntax: "<number>";
  initial-value: 0;
  inherits: false;
}

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

html,
body {
  font-family: "Inter", sans-serif;
  background: radial-gradient(circle at 18% 0%, #2a3278 0%, #121842 45%, #090f2c 82%);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  touch-action: manipulation;
  height: 100%;
  overflow: hidden;
}

#app {
  max-width: 768px;
  width: 100%;
  margin: 0 auto;
  padding: calc(12px + clamp(0px, calc(env(safe-area-inset-top, 0px) - 12px), 999px)) 16px max(20px, env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 100%;
  height: 100%;
  max-height: 100%;
  position: relative;
}

#app.onboarding-active {
  z-index: auto;
}

#app.app--board-intro {
  pointer-events: none;
}

#app.game-paused::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(14, 20, 54, 0.2);
  backdrop-filter: blur(7px) saturate(0.82);
  pointer-events: none;
  z-index: 12;
}

#app.game-paused :is(.corner-actions, .score-progress__goals, .arena, .feed) {
  filter: blur(1.8px) saturate(0.8);
  opacity: 0.52;
}

#app.game-paused .time-orb-wrap {
  position: relative;
  z-index: 14;
}

.pause-overlay {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  z-index: 13;
  opacity: 0;
  transition: opacity 0.16s ease;
}

#app.game-paused .pause-overlay {
  opacity: 1;
}

.pause-overlay__title {
  font-family: "Baloo 2", cursive;
  font-size: clamp(44px, 13vw, 92px);
  line-height: 1;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.95);
  text-shadow:
    0 10px 28px rgba(0, 0, 0, 0.6),
    0 0 24px rgba(132, 188, 255, 0.32);
}

.pause-overlay__hint {
  font-family: "Inter", sans-serif;
  font-size: clamp(12px, 2.5vw, 16px);
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.88);
  text-shadow: 0 3px 12px rgba(0, 0, 0, 0.45);
}

#app.app--board-intro .board-intro-item {
  opacity: 0;
  transform: translateY(-10px) scale(0.996);
  filter: none;
  will-change: transform, opacity, filter;
  animation: boardIntroPageSweep 420ms cubic-bezier(0.22, 0.9, 0.3, 1) both;
  animation-delay: var(--board-intro-delay, 0ms);
}

@supports (height: 100dvh) {
  #app {
    min-height: 100dvh;
    height: 100dvh;
    max-height: 100dvh;
  }
}

.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  overflow: visible;
}

.brand {
  display: flex;
  align-items: stretch;
  gap: 12px;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  height: 100%;
}

.brand h1 {
  font-family: "Baloo 2", cursive;
  font-size: 32px;
  letter-spacing: 0.5px;
}

.brand p {
  color: var(--muted);
  font-size: 14px;
}

.spark {
  width: 60px;
  height: 60px;
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  align-self: stretch;
  aspect-ratio: 1 / 1;
  background-color: rgba(10, 14, 38, 0.35);
  border-radius: 14px;
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.3),
    inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0;
  cursor: pointer;
  overflow: hidden;
}

.spark-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.spark-fallback {
  display: none;
  pointer-events: none;
}

.spark:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.65);
  outline-offset: 3px;
}

.spark:active {
  transform: translateY(1px);
}

.top-actions {
  display: flex;
  gap: 12px;
}

.corner-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  --top-chip-size: 32px;
}

.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;
}

.language-switch {
  position: relative;
}

.icon-btn.language-select-btn {
  position: relative;
  width: auto;
  min-width: 52px;
  height: var(--top-chip-size);
  padding: 0 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  background: var(--panel-strong);
}

.language-switch label {
  font-size: 12px;
  color: var(--muted);
}

.language-switch .language-menu-list {
  top: calc(100% + 6px);
  bottom: auto;
  left: 0;
  right: auto;
  min-width: 160px;
}

.language-selected-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.2px;
  line-height: 1;
  color: #ffffff;
  font-family: "Baloo 2", cursive;
  pointer-events: none;
}

.language-selected-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  pointer-events: none;
}

.gems-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--panel-strong);
  font-family: "Baloo 2", cursive;
  font-size: 16px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
  position: relative;
  overflow: visible;
}

.wallet-pill {
  gap: 8px;
  height: var(--top-chip-size);
  min-height: var(--top-chip-size);
  padding: 0 12px;
}

.wallet-section {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.wallet-divider {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 999px;
}

.life-emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

.life-emoji--large {
  font-size: 56px;
  margin-bottom: 12px;
}

.coin-icon {
  position: relative;
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff7c1, #ffd04a 48%, #f1a600 78%);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.35),
    0 2px 6px rgba(0, 0, 0, 0.35);
}

.coin-icon::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  left: -4px;
  top: 3px;
  background: radial-gradient(circle at 30% 30%, #fff5b0, #ffc84a 50%, #e89b00 80%);
  box-shadow:
    inset 0 0 0 1.5px rgba(255, 255, 255, 0.25),
    0 2px 5px rgba(0, 0, 0, 0.25);
  opacity: 0.85;
  z-index: -1;
}

.coin-icon::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.5);
  opacity: 0.75;
}

.coin-icon--compact {
  width: 14px;
  height: 14px;
}

.coin-icon--compact::before {
  width: 12px;
  height: 12px;
}

.gems-pill strong {
  font-weight: 700;
  letter-spacing: 0.3px;
}

.gems-pill.wallet-nudge {
  animation: walletNudgeGlow 3.2s ease-out both;
}

.gems-pill.wallet-nudge::after {
  content: "";
  position: absolute;
  inset: -10px -12px;
  border-radius: 999px;
  background: radial-gradient(circle at 40% 30%, rgba(255, 190, 90, 0.55), rgba(255, 120, 0, 0) 70%);
  filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  animation: walletAura 3.2s ease-out both;
}

.wallet-sparkle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.95), rgba(255, 205, 120, 0.45) 45%, rgba(255, 120, 0, 0) 72%);
  transform: rotate(45deg) scale(0.7);
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: screen;
  will-change: transform, opacity;
  animation: walletSparkle 1.15s ease-out forwards;
}

@keyframes walletNudgeGlow {
  0% {
    transform: translateY(0) scale(1);
    box-shadow:
      0 10px 24px rgba(0, 0, 0, 0.25),
      0 0 0 rgba(255, 145, 0, 0);
    filter: saturate(1);
  }
  18% {
    transform: translateY(-1px) scale(1.03);
    box-shadow:
      0 14px 32px rgba(0, 0, 0, 0.25),
      0 0 24px rgba(255, 145, 0, 0.55),
      0 0 56px rgba(255, 145, 0, 0.25);
    filter: saturate(1.25);
  }
  55% {
    transform: translateY(0) scale(1.01);
    box-shadow:
      0 12px 28px rgba(0, 0, 0, 0.25),
      0 0 18px rgba(255, 145, 0, 0.38),
      0 0 42px rgba(255, 145, 0, 0.18);
    filter: saturate(1.15);
  }
  100% {
    transform: translateY(0) scale(1);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
    filter: saturate(1);
  }
}

@keyframes walletAura {
  0% {
    opacity: 0;
    transform: scale(0.92);
  }
  20% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.08);
  }
}

@keyframes walletSparkle {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0) rotate(45deg) scale(0.6);
  }
  18% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate3d(0, -14px, 0) rotate(45deg) scale(1.35);
  }
}

.icon-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--panel-strong);
}

.icon-btn.help-icon {
  font-family: "Baloo 2", cursive;
  font-size: 20px;
  line-height: 1;
}

.icon-btn img {
  width: 24px;
  height: 24px;
}

.wallet {
  gap: 20px;
}

.wallet-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 4px 4px 8px;
  text-align: center;
}

.wallet-header h2 {
  margin-bottom: 6px;
}

.wallet-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  font-family: "Baloo 2", cursive;
  font-size: 22px;
  align-self: center;
}

.wallet-badge__item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}


.wallet-grid {
  align-items: stretch;
}

.wallet-panel {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.wallet-balance {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 24px;
  font-family: "Baloo 2", cursive;
  margin-bottom: 8px;
}

button {
  border: none;
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  color: var(--text);
  background: var(--panel-strong);
}

button[data-gem-pack],
button[data-wallet-ad-count] {
  position: relative;
  overflow: hidden;
}

button[data-gem-pack] > *,
button[data-wallet-ad-count] > * {
  position: relative;
  z-index: 1;
}

button[data-gem-pack]:not(:disabled):not([aria-disabled="true"]),
button[data-wallet-ad-count]:not(:disabled):not([aria-disabled="true"]) {
  box-shadow:
    0 12px 26px rgba(0, 0, 0, 0.28),
    0 0 22px rgba(255, 246, 140, 0.28);
}

button[data-gem-pack]:not(:disabled):not([aria-disabled="true"])::before,
button[data-wallet-ad-count]:not(:disabled):not([aria-disabled="true"])::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 3px;
  background: linear-gradient(
    120deg,
    #fff3a6 0%,
    #9bff76 35%,
    #fff9d2 50%,
    #4cff98 70%,
    #fff3a6 100%
  );
  background-size: 240% 240%;
  animation: gemPackShine 3s linear infinite;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.95;
}

button[data-iap-lives] {
  position: relative;
  overflow: hidden;
}

button[data-iap-lives] > * {
  position: relative;
  z-index: 1;
}

button[data-iap-lives]:not(:disabled):not([aria-disabled="true"]) {
  box-shadow:
    0 12px 26px rgba(0, 0, 0, 0.28),
    0 0 18px rgba(26, 140, 78, 0.45);
}

button[data-iap-lives]:not(:disabled):not([aria-disabled="true"])::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 3px;
  background: linear-gradient(
    120deg,
    #0f5d2a 0%,
    #1f7a3a 35%,
    #2a8a45 50%,
    #0b4a22 70%,
    #1f7a3a 100%
  );
  background-size: 240% 240%;
  animation: gemPackShine 3s linear infinite;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.95;
}

button.life-iap:not(:disabled):not([aria-disabled="true"]) {
  box-shadow:
    0 12px 26px rgba(0, 0, 0, 0.28),
    0 0 18px rgba(255, 80, 80, 0.5);
}

button.life-iap:not(:disabled):not([aria-disabled="true"])::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 3px;
  background: linear-gradient(
    120deg,
    #ff7a7a 0%,
    #ff2f4d 35%,
    #ffd1d1 50%,
    #ff4b4b 70%,
    #ff7a7a 100%
  );
  background-size: 240% 240%;
  animation: gemPackShine 3s linear infinite;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.95;
}

#buyLifeWithGemsBtn {
  position: relative;
  overflow: hidden;
}

#buyLifeWithGemsBtn > * {
  position: relative;
  z-index: 1;
}

#buyLifeWithGemsBtn:not(:disabled):not([aria-disabled="true"]) {
  box-shadow:
    0 12px 26px rgba(0, 0, 0, 0.28),
    0 0 22px rgba(255, 120, 60, 0.35);
}

#buyLifeWithGemsBtn:not(:disabled):not([aria-disabled="true"])::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 3px;
  background: linear-gradient(
    120deg,
    #ffb25c 0%,
    #ff5e43 35%,
    #ffd59a 50%,
    #ff7a3d 70%,
    #ffb25c 100%
  );
  background-size: 240% 240%;
  animation: gemPackShine 3s linear infinite;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.95;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
}

button:disabled,
button[aria-disabled="true"] {
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  opacity: 0.7;
  filter: grayscale(0.15);
  color: rgba(255, 255, 255, 0.88);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

button[data-disabled="true"] {
  pointer-events: auto;
}

button:disabled:hover,
button[aria-disabled="true"]:hover {
  transform: none;
  box-shadow: none;
}

button:active {
  transform: translateY(1px);
}

button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  color: #1b113a;
}

#closeMarketplaceBtn.primary {
  background: linear-gradient(135deg, rgba(24, 26, 42, 0.95), rgba(10, 12, 26, 0.95));
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

#nextLevelBtn.auto-advance {
  background-color: rgba(120, 140, 210, 0.7);
  background-image: linear-gradient(135deg, var(--accent), var(--accent-3));
  background-repeat: no-repeat;
  background-position: right;
  background-size: var(--next-level-progress, 100%) 100%;
  transition: background-size 0.1s linear, background-color 0.2s ease;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(10, 14, 40, 0.45);
}

#streakMarketContinueBtn.auto-advance {
  background-color: rgba(120, 140, 210, 0.7);
  background-image: linear-gradient(135deg, var(--accent), var(--accent-3));
  background-repeat: no-repeat;
  background-position: right;
  background-size: var(--next-level-progress, 100%) 100%;
  transition: background-size 0.1s linear, background-color 0.2s ease;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(10, 14, 40, 0.45);
}

#submitBtn {
  min-width: 128px;
  min-height: 56px;
  font-size: 18px;
  padding-top: 14px;
  padding-bottom: 14px;
  padding-left: 24px;
  padding-right: 24px;
  position: relative;
  overflow: visible;
  opacity: 0.8;
}

/* Main board: make Spark fill the row */
.controls-row--basic #submitBtn {
  flex: 1 0 100%;
  width: 100%;
}

#submitBtn.spark-burst {
  animation: sparkButtonPulse 0.45s ease-out;
}

#submitBtn.spark-ready:not(:disabled):not([aria-disabled="true"]) {
  box-shadow:
    0px 11.02px 24.04px 0px rgba(255, 140, 24, 0.3),
    0px 0px 12px 0px rgba(255, 104, 24, 0.42),
    0px 0px 22px 0px rgba(255, 58, 36, 0.32);
  opacity: 1;
  color: #ffd86a;
  text-shadow:
    0 1px 2px rgba(67, 30, 0, 0.55),
    0 0 10px rgba(255, 200, 92, 0.45);
  animation: sparkReadyPulse 1.1s ease-in-out infinite;
}

.spark-button-sparkle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.95), rgba(255, 240, 180, 0.7) 40%, rgba(255, 180, 80, 0) 70%);
  transform: scale(0.4);
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: screen;
  will-change: transform, opacity;
  animation: sparkButtonSparkle 0.7s ease-out forwards;
}

.spark-button-sparkle--fine {
  background: radial-gradient(circle, rgba(255, 255, 255, 0.92), rgba(255, 220, 135, 0.58) 45%, rgba(255, 176, 74, 0) 74%);
  animation: sparkButtonSparkleFine 0.9s ease-out forwards;
}

@keyframes sparkButtonPulse {
  0% {
    transform: translateY(0) scale(1);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
  }
  35% {
    transform: translateY(-1px) scale(1.03);
    box-shadow:
      0 14px 30px rgba(0, 0, 0, 0.28),
      0 0 24px rgba(255, 210, 120, 0.6),
      0 0 42px rgba(255, 130, 90, 0.35);
  }
  100% {
    transform: translateY(0) scale(1);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
  }
}

@keyframes sparkReadyPulse {
  0% {
    box-shadow:
      0px 11.02px 24.04px 0px rgba(255, 140, 24, 0.3),
      0px 0px 12px 0px rgba(255, 104, 24, 0.42),
      0px 0px 22px 0px rgba(255, 58, 36, 0.32);
  }
  50% {
    box-shadow:
      0px 13px 28px 0px rgba(255, 122, 16, 0.36),
      0px 0px 22px 0px rgba(255, 84, 18, 0.62),
      0px 0px 38px 0px rgba(255, 40, 26, 0.48);
  }
  100% {
    box-shadow:
      0px 11.02px 24.04px 0px rgba(255, 140, 24, 0.3),
      0px 0px 12px 0px rgba(255, 104, 24, 0.42),
      0px 0px 22px 0px rgba(255, 58, 36, 0.32);
  }
}

@keyframes sparkButtonSparkle {
  0% {
    opacity: 0;
    transform: scale(0.3) translateY(0);
  }
  40% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(1.35) translateY(-14px);
  }
}

@keyframes sparkButtonSparkleFine {
  0% {
    opacity: 0;
    transform: scale(0.25) translateY(0);
  }
  30% {
    opacity: 0.85;
  }
  100% {
    opacity: 0;
    transform: scale(1.2) translateY(-10px);
  }
}

@keyframes gemPackShine {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 200% 50%;
  }
}

button.ghost {
  background: var(--panel);
}

button.overlay-gems-btn {
  border: 1px solid rgba(166, 109, 255, 0.9);
  box-shadow:
    0 0 0 1px rgba(166, 109, 255, 0.25) inset,
    0 8px 18px rgba(122, 70, 255, 0.2);
}

button.overlay-gems-btn:hover,
button.overlay-gems-btn:focus-visible {
  border-color: rgba(196, 149, 255, 0.98);
  box-shadow:
    0 0 0 1px rgba(196, 149, 255, 0.35) inset,
    0 10px 22px rgba(122, 70, 255, 0.28);
}

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

.streak-summary {
  display: flex;
  align-items: stretch;
  gap: 10px;
  height: 100%;
}

.streak-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  width: fit-content;
  padding: 4px 16px;
  border-radius: 14px;
  background: var(--panel-strong);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
  position: relative;
  height: 100%;
}

.streak-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: repeating-linear-gradient(
    120deg,
    #ff8a00 0% 20%,
    var(--accent) 20% 45%,
    rgba(255, 255, 255, 0.95) 45% 50%,
    var(--accent) 50% 75%,
    #ff8a00 75% 100%
  );
  background-size: 320px 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.streak-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.streak-row span {
  color: var(--text);
  font-size: 10px;
}

.streak-row strong {
  font-size: 16px;
  font-family: "Baloo 2", cursive;
}

.streak-value--current {
  color: var(--text);
}

.streak-card.streak-item--record {
  box-shadow: 0 0 18px rgba(255, 184, 0, 0.35), 0 10px 24px rgba(0, 0, 0, 0.25);
}

.streak-card.streak-item--record::before {
  opacity: 1;
  animation: streak-gradient 2.8s linear infinite;
}

.streak-row + .streak-row {
  margin-top: 0;
}

.score-progress {
  grid-column: 1 / -1;
  background: var(--panel);
  border-radius: 22px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(12px);
}

.score-progress__line {
  display: flex;
  align-items: center;
  gap: 14px;
}

.score-progress__goals {
  flex: 1;
  min-width: 0;
}

.score-progress__row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-direction: row-reverse;
}

.score-progress__bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.score-progress__label {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  pointer-events: none;
  text-align: left;
}

.score-progress__label--compact {
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
  gap: 6px;
}

.score-progress__label--compact .score-progress__icon {
  font-size: 16px;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
}

.score-progress__label--compact .coin-icon {
  width: 16px;
  height: 16px;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
}

.score-progress__label strong {
  font-size: 20px;
  font-family: "Baloo 2", cursive;
  color: var(--text);
  letter-spacing: 0.5px;
}

.score-progress__target {
  font-size: 11px;
  color: var(--muted);
}

.score-progress__track {
  position: relative;
  height: 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.score-progress--overfill .score-progress__track {
  overflow: visible;
}

.score-progress__fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 18px rgba(0, 226, 255, 0.35);
  transition: width 0.35s ease;
}

.score-progress--overfill .score-progress__fill {
  box-shadow: 0 0 22px rgba(255, 184, 0, 0.45);
}

.time-orb {
  --time-progress: 100%;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background:
    conic-gradient(var(--accent) 0% var(--time-progress), rgba(255, 255, 255, 0.12) var(--time-progress) 100%);
  display: grid;
  place-items: center;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.15),
    0 12px 26px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease;
  flex: 0 0 auto;
  cursor: pointer;
}

.time-orb-wrap {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  position: relative;
  align-self: center;
  transform: translateY(var(--timer-ring-shift-y, 0px));
}

.time-orb-bonus {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  font-family: "Baloo 2", cursive;
  font-size: 10px;
  color: var(--success);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

.time-orb-bonus.is-active {
  animation: timeBonusPop 1s ease-out;
}

.time-orb-label {
  font-family: "Baloo 2", cursive;
  font-size: 10px;
  letter-spacing: 0.3px;
  color: var(--muted);
}

.time-orb__inner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #0f1436;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: "Baloo 2", cursive;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.time-orb__inner strong {
  font-size: 18px;
  line-height: 1;
}

.time-orb__inner small {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.time-orb.urgent {
  background:
    conic-gradient(var(--danger) 0% var(--time-progress), rgba(255, 255, 255, 0.12) var(--time-progress) 100%);
  box-shadow:
    inset 0 0 0 2px rgba(255, 107, 107, 0.45),
    0 12px 24px rgba(255, 77, 99, 0.25);
}

.time-orb.beat {
  animation: heartbeat 0.6s cubic-bezier(0.25, 0.9, 0.3, 1);
}

.time-orb.is-paused {
  background:
    conic-gradient(var(--accent) 0% var(--time-progress), rgba(255, 255, 255, 0.18) var(--time-progress) 100%);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.2),
    0 10px 20px rgba(0, 0, 0, 0.32);
}

.time-orb.is-paused .time-orb__inner {
  background: #11193f;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.35),
    0 0 18px rgba(173, 215, 255, 0.25);
}

.time-orb.is-paused .time-orb__inner strong {
  color: #ffffff;
  text-shadow: 0 0 14px rgba(255, 255, 255, 0.45);
}

.time-orb__countdown--paused {
  font-size: 24px !important;
  line-height: 1;
  letter-spacing: 0;
  color: #ffffff;
}

.time-orb__countdown--onboarding-pause {
  animation: onboardingPauseIconFloat 2.8s ease-in-out infinite;
}

@keyframes timeBonusPop {
  0% {
    opacity: 0;
    transform: translate(-50%, 6px) scale(0.9);
  }
  30% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -8px) scale(0.95);
  }
}

.stat {
  background: var(--panel);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  backdrop-filter: blur(12px);
}

.stat span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat strong {
  font-size: 18px;
  font-family: "Baloo 2", cursive;
}

:is(.gems-pill, .streak-card, .score-progress, .stat, .arena, .panel, .corner-actions .icon-btn.language-select-btn, .corner-actions .icon-btn.leaderboard-icon) {
  position: relative;
}

:is(.gems-pill, .streak-card, .score-progress, .stat, .arena, .panel, .corner-actions .icon-btn.language-select-btn, .corner-actions .icon-btn.leaderboard-icon)::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background:
    radial-gradient(circle at 100% 0%, var(--scene-edge-hot) 0%, var(--scene-edge-warm) 30%, var(--scene-edge-fade) 64%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.03) 30%, rgba(255, 140, 52, 0.2) 66%, rgba(255, 140, 52, 0) 88%);
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.82;
}

.arena {
  background:
    radial-gradient(circle at 22% 14%, rgba(98, 140, 246, 0.2), rgba(0, 0, 0, 0) 58%),
    linear-gradient(180deg, rgba(32, 40, 94, 0.95), rgba(8, 12, 34, 0.985));
  border-radius: 24px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(136, 162, 232, 0.24);
  box-shadow:
    0 30px 72px rgba(0, 0, 0, 0.56),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.arena::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 16% 18%, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0) 60%),
    radial-gradient(circle at 88% 0%, rgba(168, 192, 255, 0.08), rgba(0, 0, 0, 0) 54%);
  opacity: 0.62;
  pointer-events: none;
}

#app.tier-glow .score-progress,
#app.tier-glow .arena {
  box-shadow:
    0 0 14px var(--tier-glow-shadow),
    0 0 28px var(--tier-glow-soft);
}

#app.tier-glow .score-progress::after,
#app.tier-glow .arena::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 2px;
  background:
    radial-gradient(circle at 100% 0%, var(--scene-edge-hot) 0%, var(--scene-edge-warm) 30%, var(--scene-edge-fade) 64%),
    linear-gradient(135deg, var(--tier-glow-strong), var(--tier-glow-soft));
  background-size: 200% 200%;
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  animation: tier-glow-shift 6s linear infinite;
}

#app.tier-glow .goals-title-group--primary .goals-title-label,
#app.tier-glow .streak-value--current {
  text-shadow:
    0 0 10px var(--tier-glow-shadow),
    0 0 20px var(--tier-glow-soft),
    0 2px 10px rgba(0, 0, 0, 0.45);
}

@keyframes tier-glow-shift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.wordbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  z-index: 1;
}

.current-word {
  font-size: 24px;
  font-family: "Baloo 2", cursive;
  letter-spacing: 3px;
}

.current-word.current-word--generating {
  position: relative;
  color: rgba(232, 238, 255, 0.94);
  text-shadow:
    0 0 10px rgba(140, 206, 255, 0.28),
    0 3px 10px rgba(0, 0, 0, 0.35);
}

.current-word.current-word--ready {
  animation: currentWordReadyIn 0.5s cubic-bezier(0.2, 0.9, 0.3, 1) both;
}

.status {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.status.status--needs-word {
  text-shadow:
    0 0 10px rgba(255, 120, 120, 0.6),
    0 0 20px rgba(255, 120, 120, 0.35);
  animation: statusNeedsWordPulse 0.5s ease;
}

.status.status--clear {
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
}

.status-points {
  display: block;
  color: var(--text);
  font-weight: 600;
}

.status-points__count {
  font-variant-numeric: tabular-nums;
}

.status-hint {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  color: rgba(210, 216, 228, 0.8);
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.status-flash {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.status-flash--bad {
  color: var(--danger);
}

.status-flash--good {
  color: var(--success);
}

.status-flash--neutral {
  color: var(--muted);
}

.status-hint__unit {
  text-transform: none;
}

.status-speed {
  position: relative;
  display: inline-block;
  overflow: hidden;
  font-size: 8px;
}

.status-speed::after {
  content: "";
  position: absolute;
  inset: -2px -20px;
  background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.8) 45%, transparent 70%);
  transform: translateX(-140%);
  opacity: 0;
  pointer-events: none;
}

.status-speed.is-animating::after {
  animation: speedShine 0.7s ease-out;
}

@keyframes speedShine {
  0% {
    transform: translateX(-140%);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  100% {
    transform: translateX(140%);
    opacity: 0;
  }
}

@keyframes currentWordGeneratingPulse {
  0% {
    opacity: 0.72;
    transform: translateY(0);
    letter-spacing: 2.6px;
  }
  50% {
    opacity: 1;
    transform: translateY(-0.5px);
    letter-spacing: 3px;
  }
  100% {
    opacity: 0.78;
    transform: translateY(0);
    letter-spacing: 2.7px;
  }
}

@keyframes currentWordReadyIn {
  0% {
    opacity: 0.5;
    transform: translateY(3px) scale(0.98);
    filter: blur(0.35px);
  }
  70% {
    opacity: 1;
    transform: translateY(0) scale(1.01);
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

.rack {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  z-index: 1;
}

.rack.rack--board-intro {
  pointer-events: none;
}

.tile--loading-shell {
  opacity: 0;
  transform: translateY(-8px) scale(0.988);
  will-change: transform, opacity;
  animation: boardIntroSweep 360ms cubic-bezier(0.22, 0.9, 0.3, 1) forwards;
  animation-delay: var(--board-intro-delay, 0ms);
}

.tile--loading-candidate .tile-letter--loading {
  opacity: 0;
  transform: translateY(2px) scale(0.94);
  filter: brightness(0.65) saturate(0.85) blur(0.35px);
  transition:
    opacity 220ms ease,
    transform 260ms ease,
    filter 260ms ease;
}

.rack--board-intro-charging .tile--loading-candidate .tile-letter--loading {
  animation: boardIntroLetterCharge 420ms cubic-bezier(0.22, 0.9, 0.3, 1) both;
}

.tile--spin-active .tile-letter--loading {
  opacity: 1;
  color: #ffffff;
  transform: translateY(0) scale(1);
  filter: brightness(1.15) saturate(1.05) blur(0);
  text-shadow:
    0 0 7px rgba(255, 240, 190, 0.36),
    0 0 16px rgba(140, 210, 255, 0.26),
    0 8px 16px rgba(0, 0, 0, 0.35);
}

.tile--letter-enter .tile-letter {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: none;
}

.tile--letter-enter .tile-multiplier {
  animation: boardIntroLetterIn 280ms cubic-bezier(0.25, 0.9, 0.32, 1) both;
}

.tile--activation-seamless .tile-letter {
  opacity: 1 !important;
  transform: translateY(0) scale(1) !important;
  filter: none !important;
}

.tile--activation-smooth {
  animation: boardIntroTileActivate 340ms cubic-bezier(0.22, 0.9, 0.3, 1) both;
}

.spark-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  mix-blend-mode: screen;
  will-change: contents;
}

.tile {
  background:
    radial-gradient(120% 140% at 28% 18%, rgba(252, 236, 214, 0.24) 0%, rgba(236, 205, 172, 0.09) 38%, rgba(232, 186, 138, 0) 68%),
    radial-gradient(circle at 72% 82%, rgba(90, 120, 214, 0.12), rgba(0, 0, 0, 0) 54%),
    linear-gradient(180deg, rgba(96, 80, 182, 0.94), rgba(26, 16, 72, 0.985));
  border-radius: 18px;
  padding: 10px 0;
  min-height: 52px;
  text-align: center;
  font-size: 20px;
  font-family: "Baloo 2", cursive;
  letter-spacing: 1px;
  position: relative;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  transition:
    transform 220ms cubic-bezier(0.22, 0.9, 0.3, 1),
    box-shadow 260ms cubic-bezier(0.22, 0.9, 0.3, 1),
    border-color 260ms ease,
    filter 260ms ease;
  border: 1px solid rgba(184, 204, 255, 0.24);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    inset 0 -20px 34px rgba(0, 0, 0, 0.34),
    0 10px 20px rgba(0, 0, 0, 0.28);
}

.tile.tile-multiplier--2::before,
.tile.tile-multiplier--3::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.5px;
  background: linear-gradient(140deg, #6bff7b 10%, #ffe06a 85%);
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.tile-letter {
  display: inline-block;
  font-weight: 700;
  position: relative;
  z-index: 1;
  text-shadow:
    0 8px 18px rgba(0, 0, 0, 0.42),
    0 1px 0 rgba(255, 255, 255, 0.14);
  transition: color 0.14s ease, text-shadow 0.14s ease, filter 0.14s ease;
}

.tile-multiplier {
  position: absolute;
  right: 10px;
  bottom: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: #eaff6a;
  background: linear-gradient(140deg, #6bff7b 10%, #ffe06a 85%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.tile.selected .tile-multiplier {
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.65);
}

.tile.tile-multiplier--2 {
  box-shadow:
    0 0 14px rgba(80, 200, 255, 0.35),
    0 8px 18px rgba(0, 0, 0, 0.2);
}

.tile.tile-multiplier--3 {
  box-shadow:
    0 0 18px rgba(255, 208, 120, 0.5),
    0 10px 22px rgba(0, 0, 0, 0.25);
}

.tile.selected {
  background:
    radial-gradient(120% 140% at 28% 18%, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0.07) 42%, rgba(255, 255, 255, 0) 68%),
    radial-gradient(circle at 72% 80%, rgba(255, 110, 178, 0.2), rgba(0, 0, 0, 0) 58%),
    linear-gradient(120deg, var(--accent), var(--accent-3));
  color: #fff8e6;
  transform: translateY(-6px) scale(1.02);
  border-color: rgba(255, 198, 132, 0.78);
  box-shadow:
    0 12px 26px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 178, 122, 0.62),
    0 0 22px rgba(255, 88, 163, 0.32);
}

.tile.selected .tile-letter {
  color: #fff6da;
  text-shadow:
    0 0 8px rgba(255, 230, 176, 0.82),
    0 0 16px rgba(255, 132, 194, 0.56),
    0 3px 10px rgba(0, 0, 0, 0.45);
  filter: brightness(1.06);
}

.tile.special {
  --special-color: var(--accent-3);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.3), var(--special-color));
  color: var(--text);
  box-shadow:
    0 0 0 2px var(--special-color),
    0 10px 22px rgba(0, 0, 0, 0.3);
}

.tile.special::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 10px var(--special-color);
}

.tile.special.selected {
  box-shadow:
    0 0 0 2px #ffffff,
    0 12px 26px rgba(0, 0, 0, 0.4);
  transform: translateY(-6px) scale(1.02);
}

.tile.special--rose {
  --special-color: var(--accent-3);
}

.tile.special--aqua {
  --special-color: var(--accent-2);
}

.tile.special--gold {
  --special-color: var(--accent);
}

.tile.frozen {
  background: var(--frozen-tile-texture) center / cover no-repeat;
  background-color: var(--frozen-tile-color);
  color: #e9f7ff;
  cursor: not-allowed;
  filter: var(--frozen-tile-filter);
  box-shadow:
    inset 0 0 0 1px var(--frozen-tile-border),
    0 10px 20px var(--frozen-tile-shadow);
  overflow: hidden;
}

.tile.frozen::before {
  content: "";
  position: absolute;
  inset: -10% -10%;
  background:
    radial-gradient(circle at 15% 30%, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 40%),
    radial-gradient(circle at 70% 18%, rgba(210, 245, 255, 0.3), rgba(255, 255, 255, 0) 45%),
    radial-gradient(circle at 45% 75%, rgba(170, 225, 255, 0.28), rgba(255, 255, 255, 0) 50%),
    linear-gradient(20deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0) 55%);
  opacity: var(--frozen-highlight-opacity);
  mix-blend-mode: soft-light;
  pointer-events: none;
}

.tile.frozen::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 65% 12%, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 45%),
    radial-gradient(circle at 30% 55%, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 50%),
    repeating-linear-gradient(
      120deg,
      rgba(255, 255, 255, 0.2) 0,
      rgba(255, 255, 255, 0.2) 3px,
      rgba(255, 255, 255, 0) 3px,
      rgba(255, 255, 255, 0) 16px
    );
  opacity: var(--frozen-shine-opacity);
  mix-blend-mode: screen;
  pointer-events: none;
}

.tile.frozen:hover {
  transform: none;
  box-shadow:
    inset 0 0 0 1px var(--frozen-tile-border),
    0 10px 20px var(--frozen-tile-shadow);
}

body.frozen-tiles-alt .tile.frozen {
  background:
    radial-gradient(
      120% 140% at 28% 18%,
      rgba(255, 255, 255, 0.05) 0%,
      rgba(255, 255, 255, 0.015) 40%,
      rgba(255, 255, 255, 0) 66%
    ),
    linear-gradient(180deg, rgba(44, 64, 140, 0.94), rgba(14, 22, 62, 0.98));
  color: rgba(196, 214, 255, 0.62);
}

body.frozen-tiles-alt .tile.frozen::before,
body.frozen-tiles-alt .tile.frozen::after {
  display: none;
}

body.frozen-tiles-alt .tile.frozen .tile-letter,
body.frozen-tiles-alt .tile.frozen .tile-multiplier {
  opacity: 0.45;
  text-shadow: none;
}

.tile.pop {
  animation: pop 0.4s ease;
}

@keyframes pop {
  0% {
    transform: scale(0.8);
  }
  60% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes boardIntroSweep {
  0% {
    opacity: 0;
    transform: translateY(-8px) scale(0.988);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes boardIntroLetterIn {
  0% {
    opacity: 0.78;
    transform: translateY(2px) scale(0.97);
    filter: none;
  }
  72% {
    opacity: 1;
    transform: translateY(0) scale(1.01);
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes boardIntroTileActivate {
  0% {
    transform: translateY(1px) scale(0.97);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.16),
      inset 0 -18px 30px rgba(0, 0, 0, 0.32),
      0 8px 16px rgba(0, 0, 0, 0.24);
    filter: brightness(0.92) saturate(0.9);
  }
  68% {
    transform: translateY(-1px) scale(1.015);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.26),
      inset 0 -20px 34px rgba(0, 0, 0, 0.34),
      0 12px 22px rgba(0, 0, 0, 0.3);
    filter: brightness(1.05) saturate(1.03);
  }
  100% {
    transform: translateY(0) scale(1);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.24),
      inset 0 -20px 34px rgba(0, 0, 0, 0.34),
      0 10px 20px rgba(0, 0, 0, 0.28);
    filter: brightness(1) saturate(1);
  }
}

@keyframes boardIntroLetterCharge {
  0% {
    opacity: 0;
    transform: translateY(2px) scale(0.94);
    filter: brightness(0.6) saturate(0.8);
  }
  100% {
    opacity: 0.92;
    transform: translateY(0) scale(1);
    filter: brightness(1.05) saturate(1) blur(0);
  }
}

@keyframes boardIntroPageSweep {
  0% {
    opacity: 0;
    transform: translateY(-10px) scale(0.996);
    filter: none;
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1;
}

.controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.controls-row--powerups {
  align-items: center;
}

.controls-row--powerups .powerup-btn {
  flex: 1;
  justify-content: center;
}

.powerups {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--panel);
  border-radius: 18px;
  padding: 14px;
}

.arena .powerups {
  background: transparent;
  border-radius: 0;
  padding: 0;
}

.powerups h3 {
  font-family: "Baloo 2", cursive;
  font-size: 16px;
}

.powerups .controls-row--powerups {
  flex-wrap: nowrap;
  gap: 8px;
}

.powerup-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
  opacity: 0;
  visibility: hidden;
  transition: opacity 200ms ease, visibility 0s linear 200ms;
}

.powerup-hint--streak {
  margin: 0;
  text-align: right;
  white-space: nowrap;
  position: absolute;
  top: 14px;
  right: 14px;
}

.powerup-hint.is-visible {
  opacity: 1;
  visibility: visible;
  transition: opacity 200ms ease;
}

.powerup-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  min-height: 38px;
  border-radius: 999px;
  background: linear-gradient(135deg, #3fb36f, #2a844f);
  color: #ffffff;
  box-shadow:
    0 8px 18px rgba(12, 58, 36, 0.34),
    inset 0 0 0 1px rgba(206, 255, 222, 0.24);
  font-size: 12px;
  line-height: 1;
}

button.continue-streak-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.powerup-btn--utility {
  background: linear-gradient(135deg, rgba(68, 145, 103, 0.66), rgba(34, 98, 64, 0.68));
  color: var(--text);
  box-shadow:
    0 8px 18px rgba(10, 42, 30, 0.35),
    inset 0 0 0 1px rgba(200, 248, 214, 0.18);
}

.powerup-btn:hover {
  box-shadow:
    0 10px 20px rgba(14, 72, 42, 0.42),
    inset 0 0 0 1px rgba(198, 236, 212, 0.3);
}

.powerup-btn--utility:hover {
  box-shadow:
    0 10px 20px rgba(10, 52, 34, 0.38),
    inset 0 0 0 1px rgba(188, 224, 202, 0.22);
}

.powerup-btn:disabled,
.powerup-btn[aria-disabled="true"] {
  /* Override the global disabled opacity so powerups remain readable while still muted. */
  opacity: 1;
  filter: none;
  background: linear-gradient(135deg, rgba(82, 92, 142, 0.5), rgba(40, 46, 88, 0.58));
  color: rgba(230, 236, 255, 0.76);
  box-shadow:
    inset 0 0 0 1px rgba(196, 210, 255, 0.12),
    0 0 0 rgba(0, 0, 0, 0);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.powerup-btn:disabled .powerup-cost,
.powerup-btn[aria-disabled="true"] .powerup-cost {
  background: rgba(24, 30, 60, 0.35);
  color: rgba(228, 234, 255, 0.72);
}

.powerup-btn:disabled .gem-icon,
.powerup-btn[aria-disabled="true"] .gem-icon {
  opacity: 0.9;
}

.inline-link {
  color: var(--accent-2);
  text-decoration: underline;
  cursor: pointer;
  font-weight: 600;
}

.inline-note {
  color: var(--muted);
  font-size: 12px;
  display: inline-block;
  margin-top: 6px;
}

.powerup-btn .powerup-label {
  font-weight: 700;
  font-size: 12px;
}

.powerup-btn .powerup-cost {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(20, 18, 56, 0.35);
  font-size: 11px;
  font-weight: 700;
  color: #e8eeff;
}

button.continue-streak-btn .powerup-cost {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(20, 18, 56, 0.35);
  font-size: 11px;
  font-weight: 700;
  color: #e8eeff;
}

.powerup-btn .gem-icon {
  width: 14px;
  height: 14px;
  vertical-align: middle;
}

button.continue-streak-btn .gem-icon {
  width: 14px;
  height: 14px;
  vertical-align: middle;
}

.feed {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  flex: 1;
  min-height: 0;
}

.panel {
  background: var(--panel);
  border-radius: 18px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  min-height: 0;
}

.panel h3 {
  font-family: "Baloo 2", cursive;
  font-size: 16px;
}

.goals {
  gap: 12px;
}

.goals-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.goals-header--streak {
  margin-bottom: 6px;
}

.goals-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}

.goals-title--streak {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text);
}

.goals-title-group {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.goals-title-group--secondary {
  color: var(--muted);
}

.goals-title-group--primary {
  color: var(--text);
}

.goals-title-label {
  font-size: 10px;
  letter-spacing: 1px;
  color: inherit;
}

.goals-title-divider {
  color: var(--muted);
}

.streak-value {
  font-family: "Baloo 2", cursive;
  font-size: 16px;
  letter-spacing: 0.4px;
}

.streak-value--secondary {
  color: var(--muted);
  font-size: 14px;
}

.streak-item--record .goals-title-group--primary .goals-title-label,
.streak-item--record .goals-title-group--primary .streak-value {
  color: var(--accent);
  background: repeating-linear-gradient(
    110deg,
    #ff8a00 0% 20%,
    var(--accent) 20% 45%,
    rgba(255, 255, 255, 0.95) 45% 50%,
    var(--accent) 50% 75%,
    #ff8a00 75% 100%
  );
  background-size: 320px 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: streak-gradient 3s linear infinite;
}

.goals-subtitle {
  font-size: 12px;
}

.goals-list {
  list-style: none;
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  overflow-x: auto;
  padding: 12px 0;
}

.goal-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 6px;
  border-radius: 10px;
  background: transparent;
  border: none;
  box-shadow: none;
  font-size: 10px;
  width: fit-content;
  position: relative;
  overflow: visible;
}

.goal-item--complete {
  background: transparent;
  border: none;
}

.goal-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-weight: 600;
}

.goal-label--pattern {
  gap: 6px;
}

.goal-pattern {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  font-family: "Baloo 2", cursive;
  letter-spacing: 0.1px;
  line-height: 1;
  color: rgba(255, 255, 255, 0.75);
}

.goal-pattern__value {
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  color: rgba(255, 255, 255, 0.96);
}

.goal-pattern__label {
  font-size: 6px;
  font-weight: 600;
  text-transform: uppercase;
  line-height: 1;
  color: rgba(255, 255, 255, 0.78);
}

.goal-icon {
  --goal-icon-color: var(--accent-3);
  width: 16px;
  height: 16px;
  border-radius: 6px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.35), var(--goal-icon-color));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.35),
    0 6px 12px rgba(0, 0, 0, 0.35),
    0 0 10px var(--goal-icon-color);
  position: relative;
}

.goal-icon::after {
  content: "";
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  right: 2px;
  top: 2px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 8px var(--goal-icon-color);
}

.goal-icon--rose {
  --goal-icon-color: var(--accent-3);
}

.goal-icon--aqua {
  --goal-icon-color: var(--accent-2);
}

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

.goal-ring {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  position: relative;
  z-index: 0;
  overflow: visible;
  --goal-progress: 0;
  --goal-ring-start: var(--accent);
  --goal-ring-end: var(--accent-2);
  --goal-ring-rest: rgba(255, 255, 255, 0.18);
  background: conic-gradient(
    var(--goal-ring-start) 0%,
    var(--goal-ring-end) calc(var(--goal-progress) * 1%),
    var(--goal-ring-rest) calc(var(--goal-progress) * 1%) 100%
  );
  transition:
    --goal-progress 0.6s cubic-bezier(0.2, 0.9, 0.3, 1),
    background-color 0.35s ease-out;
}

.goal-ring::before {
  content: "";
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.goal-item--complete .goal-ring {
  --goal-ring-rest: var(--goal-ring-end);
  box-shadow: none;
}

.goal-item--complete .goal-ring::before {
  opacity: 0;
}

.goal-ring::after {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: rgba(9, 12, 34, 0.75);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  z-index: 1;
}

.goal-ring__inner {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  position: relative;
  z-index: 2;
}

.goal-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.75);
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.35);
}

.goal-count {
  font-family: "Baloo 2", cursive;
  font-size: 10px;
  letter-spacing: 0.3px;
  color: var(--muted);
}

.goal-item .coin-icon {
  width: 14px;
  height: 14px;
}

.goal-progress {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  font-family: "Baloo 2", cursive;
  font-size: 11px;
  letter-spacing: 0.3px;
  position: relative;
  z-index: 0;
  --goal-progress: 0;
  --goal-ring-color: var(--accent-2);
  transition:
    --goal-progress 0.35s ease-out,
    background-color 0.35s ease-out;
}

.goal-progress::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: conic-gradient(
    var(--goal-ring-color) calc(var(--goal-progress) * 1turn),
    rgba(255, 255, 255, 0.2) 0
  );
  -webkit-mask:
    radial-gradient(
      farthest-side,
      transparent calc(100% - 3px),
      #000 calc(100% - 2px)
    );
  mask:
    radial-gradient(
      farthest-side,
      transparent calc(100% - 3px),
      #000 calc(100% - 2px)
    );
  z-index: -1;
}

.goal-item--complete .goal-progress {
  background: rgba(112, 255, 154, 0.16);
  color: var(--text);
  --goal-ring-color: var(--success);
}

.goal-item.goal-hit .goal-ring {
  animation: goalGlow 0.9s ease-out;
}

.goals-list.is-blitz .goal-item--blitz {
  cursor: pointer;
}

.goals-list.is-blitz .goal-item--blitz .goal-ring {
  animation: blitzPulse 1.6s ease-in-out infinite;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    0 0 14px var(--goal-glow-color, rgba(255, 255, 255, 0.4));
}

.goal-sparkle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.95), var(--sparkle-color, var(--accent-2)) 50%, rgba(255, 255, 255, 0) 72%);
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: screen;
  will-change: transform, opacity;
  animation: goalSparkle 0.9s ease-out forwards;
}

.goal-particle {
  position: fixed;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 1), var(--particle-color, var(--accent-2)) 55%, rgba(0, 0, 0, 0) 80%);
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: 0.9;
  z-index: 8;
  filter: blur(0.2px);
  will-change: transform, opacity;
}

.goal-particle.goal-coin {
  width: 22px;
  height: 22px;
  background: radial-gradient(circle at 30% 30%, #fffbe0, #ffd04a 52%, #e69100 84%);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.65),
    inset 0 0 10px rgba(255, 255, 255, 0.25),
    0 4px 10px rgba(0, 0, 0, 0.4),
    0 0 12px rgba(255, 209, 82, 0.55);
  filter: none;
}

.goal-particle.goal-dust {
  width: 7px;
  height: 7px;
  opacity: 0.9;
}

.goal-particle.goal-spark {
  width: 22px;
  height: 22px;
  box-shadow: 0 0 20px var(--particle-color, var(--accent-2));
}

.goal-particle.goal-burst {
  width: 12px;
  height: 12px;
  opacity: 0.9;
}

@keyframes goalGlow {
  0% {
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.04),
      0 0 0 rgba(255, 255, 255, 0),
      0 0 0 var(--goal-glow-color, rgba(255, 255, 255, 0));
  }
  45% {
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.2),
      0 0 16px rgba(255, 255, 255, 0.2),
      0 0 20px var(--goal-glow-color, rgba(255, 255, 255, 0.6));
  }
  100% {
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.04),
      0 10px 22px rgba(7, 10, 28, 0.35);
  }
}

@keyframes blitzPulse {
  0% {
    transform: scale(1);
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.12),
      0 0 10px rgba(255, 255, 255, 0.15);
  }
  50% {
    transform: scale(1.04);
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.2),
      0 0 18px var(--goal-glow-color, rgba(255, 255, 255, 0.55));
  }
  100% {
    transform: scale(1);
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.12),
      0 0 10px rgba(255, 255, 255, 0.15);
  }
}

@keyframes goalSparkle {
  0% {
    transform: scale(0.4);
    opacity: 0;
  }
  40% {
    opacity: 1;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

.icon-btn.leaderboard-icon {
  width: 32px;
  height: 32px;
  font-size: 17px;
  line-height: 1;
  border-radius: 999px;
}

.is-hidden {
  display: none;
}

.pill-list {
  display: none; /* Hidden – "Made words" tags during gameplay */
}

.pill {
  border: 0;
  color: var(--text);
  font-family: inherit;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 11px;
  cursor: pointer;
}

.pill.is-active {
  background: rgba(0, 226, 255, 0.25);
  box-shadow: inset 0 0 0 1px rgba(0, 226, 255, 0.45);
}

.word-definition {
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-height: 0;
}

.word-definition__header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 0;
}

.word-definition__row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  column-gap: 8px;
  min-width: 0;
}

.word-definition__row--text {
  align-items: stretch;
}

.word-definition__title {
  font-size: 12px;
  letter-spacing: 0.3px;
  margin: 0;
  line-height: 26px;
}

.definition-language-menu {
  position: relative;
}

.icon-btn.definition-language-btn {
  position: relative;
  width: auto;
  max-width: 100%;
  min-width: 50px;
  height: 26px;
  padding: 0 7px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.definition-language-icon {
  font-size: 11px;
  line-height: 1;
  pointer-events: none;
}

.definition-language-flag {
  min-width: 16px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
  line-height: 1;
  text-align: center;
  pointer-events: none;
}

.definition-language-menu-list {
  position: absolute;
  left: 0;
  right: auto;
  bottom: calc(100% + 6px);
  z-index: 40;
  display: grid;
  gap: 2px;
  min-width: 132px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(12, 10, 34, 0.96);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.35);
}

.definition-language-menu-list.is-hidden {
  display: none;
}

.definition-language-option {
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  padding: 8px 10px;
  cursor: pointer;
}

.definition-language-option:hover,
.definition-language-option:focus-visible {
  outline: none;
  background: rgba(255, 255, 255, 0.12);
}

.definition-language-option.is-active {
  background: rgba(255, 255, 255, 0.14);
}

.word-definition__text {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
}

/* AI thinking shine animation on the font itself */
.word-definition__text--translating {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.35) 0%,
    rgba(255, 255, 255, 0.35) 42%,
    #ffd23a 46%,
    #ffb800 50%,
    #ffd23a 54%,
    rgba(255, 255, 255, 0.35) 58%,
    rgba(255, 255, 255, 0.35) 100%
  );
  background-size: 200% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  animation: aiThinkingShine 1.2s linear infinite;
}

@keyframes aiThinkingShine {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.word-definition__title--scrambling {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.1em;
}

.best-score {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 24px;
  font-family: "Baloo 2", cursive;
}

.best-score small {
  color: var(--muted);
  font-size: 12px;
}

.leaderboard-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  text-align: center;
}

.leaderboard-modal {
  gap: 10px;
}

.leaderboard-header h2 {
  margin: 0;
}

.leaderboard-modal.is-break-view .leaderboard-header h2 {
  margin: 0 0 2px;
}

.leaderboard-modal.is-break-view .leaderboard-notice {
  display: none;
  min-height: 0;
  margin: 0;
}

.leaderboard-modal.is-break-view .leaderboard-summary {
  margin: 0 0 4px;
  align-items: center;
  text-align: center;
  gap: 4px;
}

.leaderboard-summary {
  margin: 0;
  min-height: 0;
}

.leaderboard-summary.is-hidden,
.leaderboard-summary:empty {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
  min-height: 0 !important;
  height: 0 !important;
}

.leaderboard-modal.is-break-view .leaderboard-summary strong {
  font-family: "Inter", sans-serif;
  font-size: clamp(18px, 3vw, 22px);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.2px;
  color: var(--muted);
}

input[type="text"] {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 8px 10px;
  color: var(--text);
  font-size: 13px;
  font-family: "Inter", sans-serif;
}

input[type="text"]:focus {
  outline: 2px solid rgba(0, 226, 255, 0.45);
  outline-offset: 2px;
}

.leaderboard-notice {
  min-height: 0;
  margin: 0;
}

.leaderboard-notice:empty {
  display: none;
}

.leaderboard-notice:not(:empty) {
  display: block;
  min-height: 18px;
  margin: 4px 0 6px;
}

.leaderboard-streak-summary {
  margin: 6px 0 8px;
}

.leaderboard-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 2px 0 6px;
}

.leaderboard-language-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: -2px 0 6px;
  text-align: left;
}

.toggle-btn {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 11px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.toggle-btn.is-active {
  background: rgba(0, 226, 255, 0.2);
  border-color: rgba(0, 226, 255, 0.4);
}

.toggle-btn.is-disabled-learning {
  opacity: 0.55;
  cursor: not-allowed;
}

.leaderboard-trend {
  font-size: 12px;
  min-height: 18px;
}

.performance-panel {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
}

.performance-title {
  margin: 0 0 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}

.performance-list {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.performance-list.is-hidden {
  display: none;
}

.performance-row {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  text-align: center;
  font-size: 12px;
}

.performance-score {
  font-weight: 600;
  color: var(--text);
}

.performance-label {
  font-size: 11px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.performance-message {
  margin-top: 6px;
  font-size: 11px;
  text-align: center;
}

.leaderboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.leaderboard-auth-gate {
  margin: 0 0 12px;
  display: grid;
  gap: 10px;
}

.leaderboard-auth-overlay {
  max-width: 520px;
}

.leaderboard-auth-overlay .leaderboard-auth-gate {
  margin: 0;
}

.leaderboard-auth-overlay #leaderboardAuthTitle {
  font-size: 24px;
  line-height: 1.2;
}

.leaderboard-auth-overlay .leaderboard-auth-gate > p.muted:first-of-type {
  font-size: 12px;
  line-height: 1.35;
}

.leaderboard-auth-gate.is-hidden {
  display: none;
}

.leaderboard-auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.leaderboard-auth-actions .auth-btn {
  flex: 1;
  min-width: 120px;
}

.leaderboard-auth-skip {
  justify-self: center;
}

.auth-btn {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.2s;
}

.auth-btn:hover {
  opacity: 0.9;
}

.auth-btn--apple {
  background: #000;
  color: #fff;
}

.auth-btn--google {
  background: #fff;
  color: #3c4043;
  border: 1px solid #dadce0;
}

.auth-btn--magic {
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  color: #1b113a;
}

.auth-btn--magic-send {
  background: rgba(0, 226, 255, 0.25);
  color: var(--text);
  border: 1px solid rgba(0, 226, 255, 0.4);
}

.leaderboard-auth-email {
  display: flex;
  gap: 8px;
  align-items: center;
}

.leaderboard-auth-email.is-hidden {
  display: none;
}

.leaderboard-auth-email input,
.leaderboard-profile input {
  width: 100%;
}

.leaderboard-email-input {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
}

.leaderboard-email-input::placeholder {
  color: var(--muted);
}

.leaderboard-email-input:focus {
  outline: 2px solid rgba(0, 226, 255, 0.45);
  outline-offset: 2px;
}

.leaderboard-profile {
  margin: 0 0 10px;
}

.leaderboard-profile.is-hidden {
  display: none;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.leaderboard-list--history {
  gap: 12px;
}

.overlay-message {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.overlay-message .streak-line {
  font-family: "Baloo 2", cursive;
  font-size: 18px;
}

.overlay-message .streak-sub {
  color: var(--muted);
  font-size: 14px;
}

.round-learned-summary {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.round-learned-title {
  margin: 0;
  font-size: 20px;
  font-family: "Baloo 2", cursive;
}

.round-learned-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: 8px;
}

.round-learned-metrics[data-metric-count="1"] {
  grid-template-columns: 1fr;
}

.round-learned-metrics[data-metric-count="2"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.round-learned-metrics[data-metric-count="3"] {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.round-learned-metric {
  border-radius: 12px;
  padding: 8px 10px;
  text-align: center;
  background: rgba(255, 255, 255, 0.08);
}

.round-learned-metric strong {
  display: block;
  font-size: 20px;
  line-height: 1.1;
}

.round-learned-metric > span {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.round-learned-metric .round-learned-metric-value {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.round-learned-metric .round-learned-metric-value strong {
  display: inline;
  font-size: 20px;
  line-height: 1.1;
}

.round-learned-metric .round-learned-metric-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.round-learned-word-list {
  max-height: min(34vh, 230px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.round-learned-word-row {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  text-align: left;
  transition: max-height 260ms ease;
}

.round-learned-word-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}

.round-learned-word-label {
  font-weight: 700;
  letter-spacing: 0.3px;
}

.round-learned-word-points {
  color: rgba(122, 235, 255, 0.95);
  font-weight: 600;
}

.round-learned-word-translation {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  text-align: left;
}

.round-learned-word-definition {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 12px;
  line-height: 1.35;
  text-align: left;
}

.round-learned-word-detail {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 260ms ease, transform 260ms ease;
}

.round-learned-word-detail.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.round-learned-empty {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.overlay-preview {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.overlay-preview.is-hidden {
  display: none;
}

.overlay-preview__title {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.leaderboard-separator {
  text-align: center;
  color: var(--muted);
  letter-spacing: 4px;
  font-size: 12px;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
}

.leaderboard-row.is-editable {
  cursor: pointer;
}

.leaderboard-row.is-editable .leaderboard-name {
  text-decoration: underline dotted rgba(255, 255, 255, 0.35);
  text-decoration-thickness: 1px;
}

.leaderboard-name input[type="text"] {
  width: 100%;
}

.leaderboard-row.is-current {
  background: rgba(255, 184, 0, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255, 184, 0, 0.3);
}

.leaderboard-rank {
  font-family: "Baloo 2", cursive;
  font-size: 14px;
}

.leaderboard-name {
  font-weight: 600;
}

.leaderboard-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.leaderboard-sub {
  color: var(--muted);
  font-size: 11px;
}

.leaderboard-score {
  font-family: "Baloo 2", cursive;
  font-size: 14px;
}

.leaderboard-row.empty {
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.history-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
}

.history-date-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 120px;
  text-align: left;
}

.history-date {
  font-size: 11px;
  color: var(--muted);
}

.history-detail {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.2;
}

.history-bar {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.history-bar__fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(0, 226, 255, 0.9), rgba(0, 255, 187, 0.9));
}

.history-value {
  font-family: "Baloo 2", cursive;
  font-size: 13px;
  min-width: 42px;
  text-align: right;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.summary-cta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: none;
  border-radius: 0;
  padding: 0;
}

.summary-cta__label {
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.summary-cta strong {
  font-size: 14px;
  font-family: "Baloo 2", cursive;
}

.summary-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.summary-pill {
  background: none;
  border-radius: 0;
  padding: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.summary-pill span {
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.summary-pill strong {
  font-size: 14px;
  font-family: "Baloo 2", cursive;
}


.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(20px, env(safe-area-inset-top, 0px)) 16px max(20px, env(safe-area-inset-bottom, 0px));
  background: rgba(7, 10, 30, 0.35);
  backdrop-filter: blur(14px);
  z-index: 20;
  overflow-y: auto;
}

.overlay--above {
  z-index: 21;
}

#app.app--win-overlay-wallet .corner-actions > :not(#marketplaceBtn) {
  opacity: 0.28;
  filter: blur(2px) saturate(0.7);
  pointer-events: none;
}

#app.app--win-overlay-wallet #marketplaceBtn {
  position: relative;
  z-index: 26;
  pointer-events: none;
}

.onboarding {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding: 8px 16px 12px;
  background: transparent;
  pointer-events: none;
  isolation: isolate;
  --onboarding-outro-x: 40px;
  --onboarding-outro-y: 40px;
}

.onboarding.hidden {
  display: none;
}

.onboarding__glass {
  width: min(768px, 100%);
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  border-radius: 28px;
  border: none;
  background: transparent;
  backdrop-filter: none;
  box-shadow: none;
  overflow: visible;
  transition:
    opacity 420ms ease,
    clip-path 760ms cubic-bezier(0.22, 0.9, 0.3, 1),
    transform 420ms ease;
}

.onboarding.onboarding-stage-outro .onboarding__glass {
  opacity: 0;
  transform: scale(1);
  clip-path: none;
}

.onboarding__viewport {
  flex: 1;
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  position: relative;
  z-index: 10001;
}

.onboarding__viewport::-webkit-scrollbar {
  display: none;
}

.onboarding__slide {
  flex: 0 0 100%;
  min-width: 100%;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding: 6px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  text-align: center;
  position: relative;
  z-index: 10001;
}

.onboarding__slide--top {
  justify-content: flex-start;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  padding-bottom: 8px;
}

#onboardingSlideSparking {
  justify-content: flex-start;
  padding-top: calc(8px + env(safe-area-inset-top, 0px));
  padding-bottom: 0;
}

#onboardingSlideSparking .onboarding__panel {
  margin-top: clamp(16px, 4vh, 34px);
  margin-bottom: 0;
  transition: transform 420ms cubic-bezier(0.22, 0.9, 0.3, 1);
}

#onboardingSlideSparking .onboarding__panel,
#onboardingSlideSpark .onboarding__panel {
  min-height: clamp(132px, 20vh, 188px);
  justify-content: center;
}

#onboardingSlideSparking .onboarding__dots,
#onboardingSlideSpark .onboarding__dots {
  margin-bottom: 10px;
}

/* Position 2: just below mid-screen. */
.onboarding.onboarding-stage-goals #onboardingSlideSparking .onboarding__panel,
.onboarding.onboarding-stage-lengths #onboardingSlideSparking .onboarding__panel,
.onboarding.onboarding-stage-special #onboardingSlideSparking .onboarding__panel,
.onboarding.onboarding-stage-timer #onboardingSlideSparking .onboarding__panel,
.onboarding.onboarding-stage-powerups #onboardingSlideSparking .onboarding__panel,
.onboarding.onboarding-stage-lives #onboardingSlideSparking .onboarding__panel {
  transform: translateY(clamp(240px, 43vh, 430px));
}

/* Position 1: default panel spot (hard cut when entering powerups/lives). */
/* (unused for lives now; kept for future staging tweaks) */

.onboarding__slide--bottom {
  justify-content: flex-end;
}

.onboarding__panel {
  width: 100%;
  max-width: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 7px 5px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background:
    linear-gradient(180deg, rgba(13, 20, 56, 0.68), rgba(8, 13, 36, 0.82)),
    rgba(7, 11, 32, 0.76);
  box-shadow:
    0 20px 48px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
}

.onboarding__slide h2 {
  font-family: "Baloo 2", cursive;
  font-size: clamp(20px, 3.4vw, 30px);
  line-height: 1.05;
  letter-spacing: 0.2px;
  text-align: center;
}

.onboarding__slide p {
  max-width: 100%;
  color: rgba(255, 255, 255, 0.86);
  font-size: clamp(14px, 2.2vw, 20px);
  line-height: 1.3;
  text-align: center;
}

.onboarding__footer {
  position: sticky;
  bottom: 0;
  z-index: 2;
  width: 100%;
  padding: 4px 12px max(10px, env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(7, 11, 36, 0), rgba(7, 11, 36, 0.9) 36%, rgba(7, 11, 36, 0.97));
}

.onboarding__dots {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 0;
}

.onboarding__dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  padding: 0;
  border: none;
  background: rgba(255, 255, 255, 0.35);
  box-shadow: none;
  transform: none;
}

.onboarding__dot.is-active {
  width: 14px;
  background: linear-gradient(120deg, var(--accent), var(--accent-3));
}

.onboarding__dot:hover,
.onboarding__dot:active {
  box-shadow: none;
}

.onboarding__done-btn {
  width: min(320px, calc(100% - 18px));
  min-height: 36px;
  font-size: clamp(12px, 1.8vw, 15px);
  padding: 6px 12px;
}

.onboarding__next-btn {
  display: none;
  margin-top: 8px;
  min-width: 120px;
}

.onboarding__panel button:not(.onboarding__dot) {
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  color: #1b113a;
}

.onboarding.onboarding-stage-goals #onboardingPrimaryNextBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.onboarding.onboarding-stage-lengths #onboardingPrimaryNextBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.onboarding.onboarding-stage-special #onboardingPrimaryNextBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.onboarding.onboarding-stage-timer #onboardingPrimaryNextBtn,
.onboarding.onboarding-stage-powerups #onboardingPrimaryNextBtn,
.onboarding.onboarding-stage-lives #onboardingPrimaryNextBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.onboarding.onboarding-stage-outro #onboardingPrimaryNextBtn {
  display: none;
}

.onboarding__outro {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10020;
  pointer-events: none;
  padding: 24px;
}

.onboarding__outro.hidden {
  display: none;
}

#onboardingOutroText {
  max-width: min(720px, 94vw);
  text-align: center;
  font-family: "Baloo 2", cursive;
  font-size: clamp(24px, 4.5vw, 46px);
  line-height: 1.12;
  color: rgba(255, 255, 255, 0.96);
  text-shadow:
    0 12px 28px rgba(0, 0, 0, 0.5),
    0 0 24px rgba(122, 176, 255, 0.34);
}

.onboarding-outro-word {
  opacity: 0;
  transform: translateY(10px);
  filter: blur(2px);
  transition:
    opacity 180ms ease,
    transform 180ms ease,
    filter 180ms ease;
}

.onboarding-outro-word.is-visible {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

#app.onboarding-stage-outro::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9990;
  pointer-events: none;
  background: rgba(8, 12, 34, 0.34);
  backdrop-filter: blur(12px) saturate(0.85);
  -webkit-mask: radial-gradient(
    circle 50px at var(--onboarding-outro-x, 40px) var(--onboarding-outro-y, 40px),
    transparent 0 52px,
    #000 66px
  );
  mask: radial-gradient(
    circle 50px at var(--onboarding-outro-x, 40px) var(--onboarding-outro-y, 40px),
    transparent 0 52px,
    #000 66px
  );
}

#app.onboarding-stage-outro .topbar {
  position: relative;
  z-index: 10030;
}

#app.onboarding-stage-outro #helpBtn {
  position: relative;
  z-index: 10030;
}

#app.onboarding-active .topbar {
  position: relative;
  z-index: 2147483646;
}

#app.onboarding-active #helpBtn {
  position: relative;
  z-index: 2147483647;
  opacity: 1 !important;
  filter: none !important;
}

.onboarding-focus-target {
  transition:
    filter 180ms ease,
    opacity 180ms ease;
}

#app.onboarding-controls-active .onboarding-focus-target.onboarding-focus-dimmed {
  filter: blur(7px) saturate(0.55);
  opacity: 0.2;
}

#app.onboarding-controls-active .onboarding-focus-target.onboarding-focus-locked {
  pointer-events: none !important;
}

#app.onboarding-active.onboarding-focus--spark:not(.onboarding-spark-visible) :is(.powerups, .feed, .feed .panel) {
  filter: blur(8px) saturate(0.5) !important;
  opacity: 0.2 !important;
  pointer-events: none !important;
}

#app.onboarding-active.onboarding-focus--spark:not(.onboarding-spark-visible) .wordbar {
  filter: blur(8px) saturate(0.5) !important;
  opacity: 0.2 !important;
  pointer-events: none !important;
}

#app.onboarding-active.onboarding-focus--goals #levelGoalsList .goal-item:not(:first-child),
#app.onboarding-active.onboarding-focus--goals .time-orb-wrap {
  filter: none !important;
  opacity: 0.2 !important;
  pointer-events: none !important;
}

#app.onboarding-active.onboarding-focus--goals.onboarding-stage-lengths #levelGoalsList .goal-item:nth-child(2),
#app.onboarding-active.onboarding-focus--goals.onboarding-stage-lengths #levelGoalsList .goal-item:nth-child(3) {
  filter: none !important;
  opacity: 1 !important;
  pointer-events: none !important;
  animation: onboardingGoalRingReveal 280ms ease-out both;
}

#app.onboarding-active.onboarding-focus--goals.onboarding-stage-lengths #levelGoalsList .goal-item:first-child {
  opacity: 0.2 !important;
  filter: none !important;
  pointer-events: none !important;
}

#app.onboarding-active.onboarding-focus--goals.onboarding-stage-lengths #levelGoalsList .goal-item:nth-child(2) {
  animation-delay: 80ms;
}

#app.onboarding-active.onboarding-focus--goals.onboarding-stage-lengths #levelGoalsList .goal-item:nth-child(3) {
  animation-delay: 340ms;
}

#app.onboarding-active.onboarding-focus--goals.onboarding-stage-special #levelGoalsList .goal-item:not(:last-child) {
  filter: none !important;
  opacity: 0.2 !important;
  pointer-events: none !important;
}

#app.onboarding-active.onboarding-focus--goals.onboarding-stage-special #levelGoalsList .goal-item:last-child {
  filter: none !important;
  opacity: 1 !important;
  pointer-events: none !important;
  animation: onboardingGoalRingReveal 300ms ease-out both;
}

#app.onboarding-active.onboarding-focus--goals.onboarding-stage-timer #levelGoalsList .goal-item {
  filter: none !important;
  opacity: 0.2 !important;
  pointer-events: none !important;
}

#app.onboarding-active.onboarding-focus--goals.onboarding-stage-timer .time-orb-wrap {
  filter: none !important;
  opacity: 1 !important;
  pointer-events: none !important;
  animation: onboardingGoalRingReveal 280ms ease-out both;
}

#app.onboarding-active.onboarding-focus--goals.onboarding-stage-powerups #levelGoalsList,
#app.onboarding-active.onboarding-focus--goals.onboarding-stage-powerups .time-orb-wrap,
#app.onboarding-active.onboarding-focus--goals.onboarding-stage-lives #levelGoalsList,
#app.onboarding-active.onboarding-focus--goals.onboarding-stage-lives .time-orb-wrap {
  filter: none !important;
  opacity: 0.2 !important;
  pointer-events: none !important;
}

#app.onboarding-active.onboarding-focus--goals.onboarding-stage-lives :is(.score-progress__goals, #rack .tile) {
  filter: none !important;
  opacity: 0.2 !important;
  pointer-events: none !important;
}

#app.onboarding-active.onboarding-focus--goals.onboarding-stage-powerups .arena::before,
#app.onboarding-active.onboarding-focus--goals.onboarding-stage-lives .arena::before {
  opacity: 0.35;
  backdrop-filter: none;
}

#app.onboarding-active.onboarding-focus--goals.onboarding-stage-powerups .powerups,
#app.onboarding-active.onboarding-focus--goals.onboarding-stage-powerups .powerups .powerup-btn {
  filter: none !important;
  opacity: 1 !important;
  pointer-events: none !important;
}

#app.onboarding-active.onboarding-focus--goals.onboarding-stage-lives .powerups,
#app.onboarding-active.onboarding-focus--goals.onboarding-stage-lives .powerups .powerup-btn {
  filter: none !important;
  opacity: 0.2 !important;
  pointer-events: none !important;
}

#app.onboarding-active.onboarding-focus--goals.onboarding-stage-lives #marketplaceBtn {
  position: relative;
  z-index: 16;
  filter: none !important;
  opacity: 1 !important;
  animation: onboardingWalletPulse 1.7s ease-in-out infinite;
}

#app.onboarding-active.onboarding-focus--goals.onboarding-stage-lives #marketplaceBtn::after {
  content: "";
  position: absolute;
  inset: -8px -10px;
  border-radius: 999px;
  pointer-events: none;
  background: radial-gradient(
    circle at 45% 40%,
    rgba(255, 212, 108, 0.52),
    rgba(255, 148, 64, 0.18) 52%,
    rgba(255, 124, 52, 0) 76%
  );
  filter: blur(2px);
  animation: onboardingWalletAura 1.7s ease-in-out infinite;
}

@keyframes onboardingGoalRingReveal {
  0% {
    filter: blur(8px) saturate(0.5);
    opacity: 0.2;
    transform: scale(0.96);
  }
  100% {
    filter: blur(0);
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes onboardingPauseIconFloat {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
  100% {
    transform: translateY(0);
  }
}

@keyframes onboardingWalletPulse {
  0% {
    transform: scale(1);
    box-shadow:
      0 8px 22px rgba(0, 0, 0, 0.34),
      0 0 0 rgba(255, 172, 84, 0);
  }
  50% {
    transform: scale(1.035);
    box-shadow:
      0 12px 28px rgba(0, 0, 0, 0.34),
      0 0 26px rgba(255, 172, 84, 0.55),
      0 0 56px rgba(255, 146, 58, 0.25);
  }
  100% {
    transform: scale(1);
    box-shadow:
      0 8px 22px rgba(0, 0, 0, 0.34),
      0 0 0 rgba(255, 172, 84, 0);
  }
}

@keyframes onboardingWalletAura {
  0% {
    opacity: 0.22;
  }
  50% {
    opacity: 0.72;
  }
  100% {
    opacity: 0.22;
  }
}

#app.onboarding-controls-active .arena::before,
#app.onboarding-preload-lock .arena::before {
  opacity: 0.92;
  background: rgba(8, 12, 34, 0.52);
  backdrop-filter: blur(9px) saturate(0.7);
}

#app.onboarding-controls-active #rack .tile,
#app.onboarding-preload-lock #rack .tile {
  position: relative;
  z-index: 2;
}

/* Preload lock prevents first-load flash before onboarding classes attach. */
#app.onboarding-preload-lock :is(.topbar, .stats, .wordbar, .powerups, .controls, .feed, #sparkCanvas) {
  filter: blur(7px) saturate(0.55);
  opacity: 0.24;
  pointer-events: none !important;
}

#app.onboarding-preload-lock :is(.powerups, .feed, .feed .panel, .wordbar) {
  filter: blur(8px) saturate(0.5) !important;
  opacity: 0.2 !important;
  pointer-events: none !important;
}

#app.onboarding-preload-lock .arena > :not(#rack) {
  filter: blur(8px) saturate(0.5) !important;
  opacity: 0.2 !important;
  pointer-events: none !important;
}

#app.onboarding-preload-lock :is(.feed, .feed .panel) {
  filter: blur(8px) saturate(0.5) !important;
  opacity: 0.2 !important;
  pointer-events: none !important;
}

#app.onboarding-preload-lock #rack,
#app.onboarding-preload-lock #rack .tile {
  filter: none !important;
  opacity: 1 !important;
}

.onboarding__panel,
.onboarding__footer {
  position: relative;
  z-index: 10002;
  pointer-events: auto;
}

.level-intro {
  position: fixed;
  inset: 0;
  z-index: 11000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Baloo 2", cursive;
  font-size: clamp(56px, 16vw, 146px);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.96);
  background: rgba(8, 12, 34, 0.5);
  backdrop-filter: blur(16px) saturate(0.9);
  text-shadow:
    0 10px 28px rgba(0, 0, 0, 0.52),
    0 0 24px rgba(120, 174, 255, 0.42);
}

.level-intro.hidden {
  display: none;
}

.overlay.hidden {
  display: none;
}

.celebration {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 15;
}

.celebration.hidden {
  display: none;
}

.streak-milestone {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 18;
  opacity: 0;
}

.streak-milestone.hidden {
  display: none;
}

.streak-milestone.is-active {
  animation: streakMilestoneFade 2.6s ease-out both;
}

.streak-milestone__edge {
  position: absolute;
  inset: 16px;
  border-radius: 28px;
  padding: 3px;
  border: 2px solid transparent;
  background:
    linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0)) padding-box,
    conic-gradient(
        from 90deg,
        #00e2ff,
        #6a5bff,
        #ff4d9d,
        #ffb800,
        #00e2ff
      )
      border-box;
  filter:
    drop-shadow(0 0 18px rgba(0, 226, 255, 0.45))
    drop-shadow(0 0 28px rgba(255, 77, 157, 0.35));
  animation: streakEdgePulse 2.6s ease-out both;
}

.streak-milestone__image {
  position: relative;
  z-index: 1;
  width: min(72vw, 460px);
  max-height: 44vh;
  object-fit: contain;
  opacity: 0.92;
  filter:
    drop-shadow(0 18px 34px rgba(0, 0, 0, 0.5))
    drop-shadow(0 0 30px rgba(120, 255, 140, 0.55));
  animation: streakLabelPop 2.6s ease-out both;
}

.streak-milestone__label {
  position: relative;
  z-index: 1;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2px;
  font-family: "Baloo 2", cursive;
  font-size: clamp(28px, 4vw, 56px);
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 14px 28px;
  border-radius: 999px;
  background: linear-gradient(120deg, #fef2c4, #c9fff3, #ffd0e7);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow:
    0 10px 30px rgba(0, 0, 0, 0.5),
    0 0 24px rgba(255, 255, 255, 0.35);
  animation: streakLabelPop 2.6s ease-out both;
}

.streak-milestone__reward {
  font-size: clamp(14px, 2.2vw, 24px);
  letter-spacing: 0.6px;
  text-transform: none;
}

.gem-reward-blast {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 24;
}

.gem-reward-blast.hidden {
  display: none;
}

.gem-reward-blast__content {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 4px;
  opacity: 0;
  transform: scale(0);
  transform-origin: center center;
}

.gem-reward-blast.is-active .gem-reward-blast__content {
  animation: gemRewardBlastPop var(--gem-reward-duration, 1500ms) cubic-bezier(0.16, 1, 0.3, 1) both;
}

.gem-reward-blast__image {
  width: min(82vw, 520px);
  max-height: 46vh;
  object-fit: contain;
  filter:
    drop-shadow(0 14px 30px rgba(0, 0, 0, 0.5))
    drop-shadow(0 0 28px rgba(120, 255, 140, 0.45));
}

.gem-reward-blast__title {
  margin-top: -8px;
  font-family: "Baloo 2", cursive;
  font-size: clamp(24px, 5.2vw, 44px);
  line-height: 1;
  letter-spacing: 1.4px;
  color: #f1ffe8;
  text-shadow:
    0 8px 20px rgba(0, 0, 0, 0.45),
    0 0 22px rgba(125, 255, 138, 0.45);
}

.gem-reward-blast__subtitle {
  font-size: clamp(14px, 2.5vw, 22px);
  font-weight: 700;
  color: rgba(232, 255, 231, 0.95);
  text-shadow: 0 5px 14px rgba(0, 0, 0, 0.42);
}

.gem-reward-blast__subtitle.is-hidden {
  display: none;
}

@keyframes gemRewardBlastPop {
  0% {
    opacity: 0;
    transform: scale(0);
  }
  35% {
    opacity: 1;
    transform: scale(1.08);
  }
  62% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1);
  }
}

.confetti {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 14px;
  border-radius: 3px;
  background: hsl(var(--hue), 90%, 60%);
  opacity: 0;
  will-change: transform, opacity;
  animation: confetti-fall var(--dur) ease-in forwards;
  animation-delay: var(--delay);
  left: var(--left);
  transform: rotate(var(--rot));
}

.winner-words {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-family: "Baloo 2", cursive;
  font-size: clamp(26px, 3.6vw, 44px);
  letter-spacing: 2px;
  text-transform: uppercase;
  text-shadow:
    0 8px 24px rgba(0, 0, 0, 0.4),
    0 0 24px rgba(255, 255, 255, 0.35);
  background: linear-gradient(120deg, #fff2c2, #c9fff3, #ffd0e7);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  z-index: 1;
  padding: 16px 24px;
  border-radius: 999px;
}

.winner-words span {
  opacity: 0;
  transform: translateY(18px) scale(0.9);
}

.winner-words.animate span {
  animation: word-pop 0.8s cubic-bezier(0.25, 0.9, 0.3, 1) forwards;
  animation-delay: calc(var(--i) * 0.18s);
}

.modal {
  background: radial-gradient(circle at top, rgba(255, 255, 255, 0.16), rgba(7, 10, 30, 0.88))
    padding-box;
  border-radius: 28px;
  padding: 28px 28px 20px;
  max-width: 900px;
  width: min(900px, 100%);
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow:
    0 24px 60px rgba(6, 10, 30, 0.6),
    0 0 32px rgba(94, 234, 255, 0.15);
}

.modal--compact {
  max-width: 360px;
  width: 100%;
  padding: 24px;
}

.modal.wide {
  max-width: 900px;
}

#marketplaceModal .modal.wallet {
  max-width: 760px;
  width: min(760px, 100%);
  min-height: 0;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  border: none !important;
  outline: none;
  box-shadow: 0 24px 60px rgba(6, 10, 30, 0.6) !important;
  background: rgba(10, 14, 34, 0.92);
}

#marketplaceModal .modal.wallet::before,
#marketplaceModal .modal.wallet::after {
  display: none !important;
  content: none !important;
}

#marketplaceModal .wallet-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(145deg, rgba(28, 34, 58, 0.94), rgba(14, 18, 34, 0.96));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    0 8px 16px rgba(0, 0, 0, 0.28);
  color: rgba(255, 255, 255, 0.92);
  font-size: 26px;
  line-height: 1;
  z-index: 2;
}

#marketplaceModal .wallet-close-btn:hover {
  transform: translateY(-1px);
}

#marketplaceModal .wallet-close-btn:active {
  transform: translateY(0);
}

/* Marketplace overlay: fill height so modal can show all items with scroll */
#marketplaceModal.overlay {
  align-items: stretch;
  padding: max(40px, env(safe-area-inset-top, 0px)) 24px max(40px, env(safe-area-inset-bottom, 0px));
}

#marketplaceModal .marketplace-grid {
  flex: 1 1 0;
  min-height: 0;
  align-items: stretch;
}

#marketplaceModal .wallet-panel {
  width: 100%;
  max-width: 700px;
  margin: 0 auto;
  border: none;
  box-shadow: none;
  background: transparent;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#marketplaceModal .wallet-panel::after {
  display: none;
}

#marketplaceModal .wallet-header {
  flex-shrink: 0;
}

.marketplace-scroll {
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1 1 0;
  min-height: 0;
  padding-right: 4px;
  -webkit-overflow-scrolling: touch;
}

#marketplaceModal .marketplace-scroll {
  max-height: none;
}

#marketplaceModal .store-actions {
  align-items: center;
  background: transparent;
  gap: 8px;
  text-align: left;
}

#marketplaceModal .store-actions > button {
  width: min(100%, 520px);
}

#marketplaceModal .store-actions .wallet-offer-primary {
  font-size: 17px;
}

#marketplaceModal .store-actions .wallet-offer-secondary {
  font-size: 12px;
}

#marketplaceModal .store-actions .wallet-offer-image {
  max-height: 48px;
  width: clamp(36px, 9vw, 62px);
}

#marketplaceModal .store-actions .wallet-offer-art {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 8px;
}

#marketplaceModal .store-actions .wallet-offer-art::before {
  font-size: 16px;
}

.marketplace-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 8px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  width: min(100%, 520px);
}

.marketplace-row.wallet-offer-btn {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

#learningModeRow {
  cursor: pointer;
}

#marketplaceModal #restorePurchasesBtn {
  width: min(100%, 520px);
  min-height: 40px;
  margin-top: 4px;
}

/* Learning mode OFF: golden outline on the block */
body:not(.learning-mode-active) #learningModeRow {
  position: relative;
  overflow: hidden;
}

body:not(.learning-mode-active) #learningModeRow::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 2px;
  background: linear-gradient(
    135deg,
    #ffd54f 0%,
    #ffb300 25%,
    #ffeb3b 50%,
    #ffc107 75%,
    #ffd54f 100%
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

body:not(.learning-mode-active) #learningModeRow > * {
  position: relative;
  z-index: 1;
}

/* Learning mode ON: no outline, switch goes gold */
body.learning-mode-active #learningModeRow::before {
  display: none;
}

body.learning-mode-active #learningModeRow .marketplace-switch__input:checked + .marketplace-switch__track {
  background: rgba(255, 200, 80, 0.45);
  border-color: rgba(255, 193, 7, 0.6);
}

.infinity-symbol {
  font-size: 1.5em;
  line-height: 1;
  font-weight: 700;
}

body.learning-mode-active .marketplace-life-offers {
  display: none;
}

#marketplaceModal #buyLifeWithGemsBtn,
#marketplaceModal button[data-gem-pack="3"] {
  display: none;
}

#marketplaceModal .marketplace-life-offers {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

#marketplaceModal .marketplace-life-offers > button {
  position: relative;
  overflow: hidden;
  width: min(100%, 520px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: 8px 12px;
  border-radius: 16px;
}

#marketplaceModal .marketplace-life-offers > button:not(:disabled):not([aria-disabled="true"]) {
  box-shadow:
    0 12px 26px rgba(0, 0, 0, 0.28),
    0 0 18px rgba(255, 80, 80, 0.4);
}

#marketplaceModal .marketplace-life-offers > button > * {
  position: relative;
  z-index: 1;
}

#marketplaceModal .marketplace-life-offers > button:not(:disabled):not([aria-disabled="true"]):hover {
  box-shadow:
    0 14px 28px rgba(0, 0, 0, 0.3),
    0 0 20px rgba(255, 80, 80, 0.45);
}

#marketplaceModal .marketplace-life-offers > button:not(:disabled):not([aria-disabled="true"])::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 3px;
  background: linear-gradient(
    120deg,
    #ff7a7a 0%,
    #ff2f4d 35%,
    #ffd1d1 50%,
    #ff4b4b 70%,
    #ff7a7a 100%
  );
  background-size: 240% 240%;
  animation: gemPackShine 3s linear infinite;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.95;
}

.marketplace-row__copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  text-align: left;
}

.marketplace-row__copy .wallet-offer-primary,
.marketplace-row__copy .wallet-offer-secondary {
  text-align: left;
}

.marketplace-switch {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

.marketplace-switch__input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.marketplace-switch__track {
  position: relative;
  width: 56px;
  height: 32px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: background 0.2s, border-color 0.2s;
}

.marketplace-switch__thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.7));
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  display: grid;
  place-items: center;
  font-size: 14px;
  transition: transform 0.2s ease;
}

.marketplace-switch__input:checked + .marketplace-switch__track .marketplace-switch__thumb {
  transform: translateX(24px);
}

.marketplace-switch__input:checked + .marketplace-switch__track {
  background: rgba(112, 255, 154, 0.35);
  border-color: rgba(112, 255, 154, 0.5);
}

#helpModal .modal {
  text-align: left;
}

.modal h2 {
  font-family: "Baloo 2", cursive;
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  text-shadow:
    0 10px 24px rgba(0, 0, 0, 0.45),
    0 0 18px rgba(255, 255, 255, 0.25);
}

.muted {
  color: var(--muted);
}

.modal .muted {
  font-size: 16px;
  letter-spacing: 0.3px;
}

.modal .wallet-description {
  font-size: clamp(12px, 1.2vw + 9px, 15px);
}

.wallet-description-secondary {
  display: block;
  font-size: 0.9em;
}

.gem-icon {
  width: 18px;
  height: 18px;
  vertical-align: -3px;
  display: inline-block;
}

.chest-icon {
  width: 36px;
  height: 26px;
  vertical-align: -4px;
  display: inline-block;
}

.gem-icon.large {
  width: 26px;
  height: 26px;
  vertical-align: middle;
}

.gem-pile {
  position: relative;
  display: inline-block;
  vertical-align: -4px;
}

.gem-pile img {
  position: absolute;
  width: 16px;
  height: 16px;
}

.gem-pile--3 {
  width: 34px;
  height: 22px;
}

.gem-pile--3 img:nth-child(1) {
  left: 0;
  top: 6px;
}

.gem-pile--3 img:nth-child(2) {
  left: 10px;
  top: 0;
}

.gem-pile--3 img:nth-child(3) {
  left: 20px;
  top: 6px;
}

.gem-pile--5 {
  width: 40px;
  height: 26px;
}

.gem-pile--5 img:nth-child(1) {
  left: 0;
  top: 10px;
}

.gem-pile--5 img:nth-child(2) {
  left: 12px;
  top: 10px;
}

.gem-pile--5 img:nth-child(3) {
  left: 24px;
  top: 10px;
}

.gem-pile--5 img:nth-child(4) {
  left: 6px;
  top: 0;
}

.gem-pile--5 img:nth-child(5) {
  left: 18px;
  top: 0;
}

.gem-pile--10 {
  width: 62px;
  height: 30px;
}

.gem-pile--10 img:nth-child(1) {
  left: 0;
  top: 14px;
}

.gem-pile--10 img:nth-child(2) {
  left: 12px;
  top: 12px;
}

.gem-pile--10 img:nth-child(3) {
  left: 24px;
  top: 14px;
}

.gem-pile--10 img:nth-child(4) {
  left: 36px;
  top: 12px;
}

.gem-pile--10 img:nth-child(5) {
  left: 46px;
  top: 14px;
}

.gem-pile--10 img:nth-child(6) {
  left: 6px;
  top: 0;
}

.gem-pile--10 img:nth-child(7) {
  left: 18px;
  top: 2px;
}

.gem-pile--10 img:nth-child(8) {
  left: 30px;
  top: 0;
}

.gem-pile--10 img:nth-child(9) {
  left: 42px;
  top: 2px;
}

.gem-pile--10 img:nth-child(10) {
  left: 54px;
  top: 0;
}

.modal-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

#overlay #restartBtn {
  order: 1;
}

#overlay #overlayStreakShieldBtn {
  order: 2;
}

.streak-market {
  text-align: left;
  position: relative;
  overflow: hidden;
}

.streak-market > :not(.streak-market__confetti) {
  position: relative;
  z-index: 1;
}

.streak-market__confetti {
  z-index: 0;
  pointer-events: none;
}

.streak-market__header {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.streak-market__title {
  margin: 0;
}

.streak-market__subtitle {
  margin: -2px 0 0;
  font-size: 14px;
}

.streak-stars {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 6px 0 2px;
}

.streak-star {
  width: 52px;
  min-height: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  transform: translateY(10px) scale(0.86);
  opacity: 0;
  position: relative;
}

.streak-star .tile-letter {
  pointer-events: none;
}

.streak-star:disabled {
  cursor: default;
  opacity: 1;
}

.streak-stars.is-animating .streak-star {
  animation: angryBirdsStarBounce 0.88s cubic-bezier(0.2, 0.9, 0.3, 1) both;
  animation-delay: calc(var(--i, 0) * 90ms);
}

@keyframes angryBirdsStarBounce {
  0% {
    opacity: 0;
    transform: translateY(14px) scale(0.72) rotate(-10deg);
    filter: blur(0.4px);
  }
  55% {
    opacity: 1;
    transform: translateY(-10px) scale(1.12) rotate(3deg);
    filter: blur(0);
  }
  78% {
    transform: translateY(3px) scale(0.98) rotate(-1deg);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0deg);
  }
}

.streak-market__crossword {
  margin-top: 4px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.crossword-hints {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  text-align: center;
}

.crossword-hint-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}

.crossword-hint-primary {
  font-size: 14px;
  line-height: 1.25;
  font-weight: 600;
}

.crossword-hint-secondary {
  font-size: 13px;
  line-height: 1.25;
  color: rgba(255, 255, 255, 0.72);
}

.crossword-hint-secondary.is-hidden {
  display: none;
}

.crossword-grid {
  --cw-cell: 44px;
  --cw-gap: 6px;
  display: grid;
  grid-template-columns: repeat(var(--cw-cols, 6), var(--cw-cell));
  gap: var(--cw-gap);
  justify-content: center;
  padding: 6px 0 2px;
  user-select: none;
}

.cw-cell {
  width: var(--cw-cell);
  height: var(--cw-cell);
  border-radius: 12px;
  position: relative;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.14),
    0 10px 22px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.cw-cell:has(.cw-input):not(.is-filled) {
  box-shadow:
    inset 0 0 0 2px rgba(255, 214, 124, 0.72),
    inset 0 1px 0 rgba(255, 245, 214, 0.28),
    0 10px 22px rgba(0, 0, 0, 0.35),
    0 0 18px rgba(255, 184, 72, 0.24);
}

.cw-cell--block {
  background: rgba(0, 0, 0, 0.35);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 10px 22px rgba(0, 0, 0, 0.25);
}

.cw-letter {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-family: "Baloo 2", cursive;
  font-size: 22px;
  letter-spacing: 0.4px;
  color: rgba(255, 255, 255, 0.88);
  text-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
}

.cw-letter--locked {
  background: linear-gradient(160deg, rgba(0, 226, 255, 0.14), rgba(255, 255, 255, 0.04));
  box-shadow: inset 0 0 0 1px rgba(0, 226, 255, 0.18);
}

.cw-input {
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  color: #ffffff;
  text-align: center;
  font-family: "Baloo 2", cursive;
  font-size: 22px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  outline: none;
  padding: 0;
  caret-color: transparent;
  pointer-events: none;
}

.cw-cell:has(.cw-input:focus) {
  box-shadow:
    inset 0 0 0 2px rgba(0, 226, 255, 0.55),
    0 14px 28px rgba(0, 0, 0, 0.4),
    0 0 18px rgba(0, 226, 255, 0.18);
  transform: translateY(-1px);
}

.cw-cell.is-filled {
  background:
    radial-gradient(120% 140% at 28% 18%, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0.07) 42%, rgba(255, 255, 255, 0) 68%),
    radial-gradient(circle at 72% 80%, rgba(255, 110, 178, 0.2), rgba(0, 0, 0, 0) 58%),
    linear-gradient(120deg, var(--accent), var(--accent-3));
  box-shadow:
    0 12px 26px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 178, 122, 0.62),
    0 0 22px rgba(255, 88, 163, 0.32);
}

.cw-input.is-filled {
  color: #fff6da;
  text-shadow:
    0 0 8px rgba(255, 230, 176, 0.82),
    0 0 16px rgba(255, 132, 194, 0.56),
    0 3px 10px rgba(0, 0, 0, 0.45);
  filter: brightness(1.06);
}

.crossword-status {
  min-height: 18px;
  text-align: center;
  font-size: 12px;
}

.streak-market__round-review {
  margin-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 10px;
}

.streak-market__round-review-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 8px;
}

.streak-market__round-review .round-learned-word-list {
  max-height: min(22vh, 150px);
}

@media (max-width: 430px) {
  .corner-actions {
    --top-chip-size: 26px;
  }

  .crossword-grid {
    --cw-cell: 40px;
    --cw-gap: 5px;
  }
  .streak-star {
    width: 42px;
    height: 42px;
    font-size: 24px;
  }
}


.marketplace-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.gem-balance {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 22px;
  font-family: "Baloo 2", cursive;
}

.store-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#marketplaceModal .store-actions > .wallet-offer-btn,
#marketplaceModal .marketplace-row {
  text-align: left;
}

#marketplaceModal .store-actions > .wallet-offer-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-height: 52px;
  padding: 8px 12px;
  border-radius: 16px;
  position: relative;
  overflow: hidden;
}

.wallet-offer-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
}

.wallet-offer-primary {
  font-size: 19px;
  line-height: 1.08;
  font-family: "Baloo 2", cursive;
  color: rgba(255, 255, 255, 0.96);
  text-align: left;
}

.wallet-offer-secondary {
  font-size: 13px;
  line-height: 1.15;
  color: rgba(255, 255, 255, 0.66);
  text-align: left;
}

.wallet-offer-art {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.05));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 6px 12px rgba(0, 0, 0, 0.24);
}

.wallet-offer-art::before {
  font-size: 18px;
  line-height: 1;
  content: "🎮";
}

.wallet-offer-art--life-gems::before,
.wallet-offer-art--life-lg::before,
.wallet-offer-art--life-xl::before {
  content: "❤️";
}

.wallet-offer-art--gem-1::before,
.wallet-offer-art--gem-3::before,
.wallet-offer-art--gem-5::before {
  content: "💎";
}

.wallet-offer-art--ad::before {
  content: "🎬";
}

.wallet-offer-image {
  height: auto;
  max-height: 58px;
  width: clamp(42px, 11vw, 76px);
  object-fit: contain;
  flex: 0 0 auto;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.35));
}

.wallet-offer-image--learning {
  width: clamp(42px, 11vw, 72px);
}

.wallet-offer-image--small-sack {
  width: clamp(40px, 10vw, 66px);
}

.wallet-offer-image--heart {
  width: clamp(36px, 9vw, 58px);
}

.wallet-offer-image--heart-five {
  width: clamp(44px, 11vw, 72px);
}

.wallet-offer-image--heart-bundle {
  width: clamp(48px, 12vw, 78px);
}

.wallet-offer-image--big-sack {
  width: clamp(46px, 12vw, 80px);
}

.wallet-offer-image--chest {
  width: clamp(50px, 13vw, 84px);
}

.store-actions .wallet-section {
  margin-left: 6px;
}

.marketplace-row__copy {
  flex: 1 1 auto;
}

.marketplace-switch {
  margin-left: auto;
}

.powerup-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.powerup-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
}

.powerup-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.powerup-icon {
  width: 56px;
  height: 56px;
  padding: 0;
  border-radius: 16px;
  background: transparent;
  box-shadow: none;
  display: block;
}

.powerup-card strong {
  display: block;
}

.powerup-card small {
  color: var(--muted);
  font-size: 12px;
}


ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-left: 18px;
}

.goals-list {
  flex-direction: row;
  padding-left: 0;
}

.flash {
  animation: flash 0.6s ease;
}

@keyframes flash {
  0% {
    box-shadow: 0 0 0 rgba(255, 255, 255, 0.1);
  }
  50% {
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.35);
  }
  100% {
    box-shadow: 0 0 0 rgba(255, 255, 255, 0.1);
  }
}

@keyframes statusNeedsWordPulse {
  0% {
    text-shadow:
      0 0 0 rgba(255, 120, 120, 0),
      0 0 0 rgba(255, 120, 120, 0);
  }
  50% {
    text-shadow:
      0 0 12px rgba(255, 120, 120, 0.7),
      0 0 24px rgba(255, 120, 120, 0.4);
  }
  100% {
    text-shadow:
      0 0 0 rgba(255, 120, 120, 0),
      0 0 0 rgba(255, 120, 120, 0);
  }
}

@keyframes confetti-fall {
  0% {
    opacity: 1;
    transform: translateY(-10vh) rotate(var(--rot));
  }
  60% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(110vh) rotate(calc(var(--rot) + 260deg));
  }
}

@keyframes word-pop {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.9);
  }
  60% {
    opacity: 1;
    transform: translateY(-6px) scale(1.05);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes streakMilestoneFade {
  0% {
    opacity: 0;
  }
  12% {
    opacity: 1;
  }
  82% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes streakEdgePulse {
  0% {
    opacity: 0;
    transform: scale(0.98);
  }
  22% {
    opacity: 1;
    transform: scale(1);
  }
  80% {
    opacity: 0.9;
    transform: scale(1.01);
  }
  100% {
    opacity: 0;
    transform: scale(1.03);
  }
}

@keyframes streakLabelPop {
  0% {
    opacity: 0;
    transform: translateY(8px) scale(0.92);
  }
  24% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  80% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-6px) scale(1.03);
  }
}

@keyframes heartbeat {
  0% {
    transform: scale(1);
  }
  35% {
    transform: scale(1.12);
  }
  70% {
    transform: scale(0.98);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes streak-gradient {
  0% {
    background-position: 0px 50%;
  }
  100% {
    background-position: 320px 50%;
  }
}

@media (max-width: 768px) {
  .topbar {
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
  }

  .brand {
    min-width: 0;
    gap: 12px;
  }

  .brand-copy {
    gap: 4px;
  }

  .brand h1 {
    font-size: 26px;
  }

  .brand p {
    font-size: 12px;
  }

  .spark {
    font-size: 0;
    border-radius: 14px;
  }

  .streak-summary {
    gap: 8px;
  }

  .streak-card {
    padding: 4px 16px;
  }

  .corner-actions {
    gap: 10px;
    --top-chip-size: 32px;
  }

  .gems-pill {
    padding: 6px 12px;
    font-size: 16px;
  }

  .icon-btn {
    width: 40px;
    height: 40px;
  }

  .score-progress__line {
    gap: 12px;
  }

  .time-orb {
    width: 56px;
    height: 56px;
  }

  .time-orb__inner {
    width: 40px;
    height: 40px;
  }

  .time-orb__inner strong {
    font-size: 18px;
  }

  .rack {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 430px) {
  #app {
    padding: calc(10px + clamp(0px, calc(env(safe-area-inset-top, 0px) - 12px), 999px)) 16px max(18px, env(safe-area-inset-bottom, 0px));
    gap: 16px;
  }

  .spark {
    width: 52px;
    height: 52px;
    font-size: 0;
  }

  .streak-card {
    padding: 4px 12px;
  }

  .streak-row strong {
    font-size: 15px;
  }

  .streak-row span {
    font-size: 9px;
  }

  .icon-btn.language-select-btn {
    min-width: 48px;
    padding: 0 7px;
    gap: 5px;
    font-size: 11px;
  }

  .language-selected-flag,
  .language-selected-icon {
    min-width: 16px;
    font-size: 11px;
    text-align: center;
  }

  .gems-pill {
    font-size: 14px;
  }

  .wallet-pill {
    padding: 0 10px;
  }

  .wallet-divider {
    height: 14px;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
  }

  .corner-actions .icon-btn.language-select-btn,
  .corner-actions .icon-btn.leaderboard-icon {
    position: relative;
    border-radius: 999px;
    background: var(--panel-strong);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
  }

  .corner-actions .icon-btn.leaderboard-icon {
    width: var(--top-chip-size);
    height: var(--top-chip-size);
    font-size: 14px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
  }

  .corner-actions .icon-btn.leaderboard-icon::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background:
      radial-gradient(circle at 100% 0%, var(--scene-edge-hot) 0%, var(--scene-edge-warm) 30%, var(--scene-edge-fade) 64%),
      linear-gradient(160deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.03) 30%, rgba(255, 140, 52, 0.2) 66%, rgba(255, 140, 52, 0) 88%);
    -webkit-mask:
      linear-gradient(#fff 0 0) content-box,
      linear-gradient(#fff 0 0);
    mask:
      linear-gradient(#fff 0 0) content-box,
      linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0.82;
  }

  .corner-actions .icon-btn.language-select-btn::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background:
      radial-gradient(circle at 100% 0%, var(--scene-edge-hot) 0%, var(--scene-edge-warm) 30%, var(--scene-edge-fade) 64%),
      linear-gradient(160deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.03) 30%, rgba(255, 140, 52, 0.2) 66%, rgba(255, 140, 52, 0) 88%);
    -webkit-mask:
      linear-gradient(#fff 0 0) content-box,
      linear-gradient(#fff 0 0);
    mask:
      linear-gradient(#fff 0 0) content-box,
      linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0.82;
  }

  .history-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "meta value"
      "bar bar";
    row-gap: 6px;
  }

  .history-date-wrap {
    grid-area: meta;
    min-width: 0;
  }

  .history-bar {
    grid-area: bar;
    min-width: 0;
  }

  .history-value {
    grid-area: value;
  }

  #rack .tile {
    min-width: 46px;
    min-height: clamp(42px, 5.2vh, 56px);
  }

  #marketplaceModal .marketplace-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  #marketplaceModal .wallet-panel {
    min-width: 0;
  }

  #marketplaceModal .store-actions {
    gap: 6px;
    min-width: 0;
  }

  #marketplaceModal .store-actions > .wallet-offer-btn,
  #marketplaceModal .marketplace-life-offers > button {
    width: 100%;
    min-width: 0;
    max-width: none;
    min-height: 48px;
    padding: 6px 10px;
    border-radius: 14px;
  }

  #marketplaceModal .store-actions .wallet-offer-primary {
    font-size: 15px;
  }

  #marketplaceModal .store-actions .wallet-offer-secondary {
    font-size: 11px;
  }

  #marketplaceModal .store-actions .wallet-offer-image {
    max-height: 42px;
  }

  .marketplace-row {
    width: 100%;
    min-width: 0;
    max-width: none;
    min-height: 48px;
    padding: 6px 10px;
    border-radius: 14px;
  }

  #marketplaceModal.overlay {
    padding-left: 16px;
    padding-right: 16px;
  }

  #marketplaceModal .modal.wallet {
    width: 100%;
    max-width: none;
    padding-left: 20px;
    padding-right: 20px;
  }

  .marketplace-switch__track {
    width: 50px;
    height: 28px;
  }

  .marketplace-switch__thumb {
    width: 20px;
    height: 20px;
    top: 4px;
    left: 4px;
    font-size: 12px;
  }

  .marketplace-switch__input:checked + .marketplace-switch__track .marketplace-switch__thumb {
    transform: translateX(22px);
  }

  .round-learned-metrics {
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: 6px;
  }

  .round-learned-metric {
    padding: 7px 8px;
  }

  .round-learned-metric strong {
    font-size: 18px;
  }

  .round-learned-metric span {
    font-size: 10px;
    letter-spacing: 0.4px;
    white-space: nowrap;
  }

  .wallet-offer-primary {
    font-size: 17px;
  }

  .wallet-offer-secondary {
    font-size: 11px;
  }

  .wallet-offer-art {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    flex-basis: 30px;
  }

  .wallet-offer-image {
    max-height: 46px;
    width: 50px;
  }

  .wallet-offer-image--small-sack {
    width: 44px;
  }

  .wallet-offer-image--heart {
    width: 40px;
  }

  .wallet-offer-image--big-sack {
    width: 52px;
  }

  .wallet-offer-image--chest {
    width: 56px;
  }

  .score-progress {
    padding: 12px 14px;
    gap: 8px;
  }

  .score-progress__line {
    gap: 10px;
  }

  .time-orb {
    width: 52px;
    height: 52px;
  }

  .time-orb__inner {
    width: 36px;
    height: 36px;
  }

  .time-orb__inner strong {
    font-size: 16px;
  }

  .time-orb-label {
    font-size: 9px;
  }

  .goals-list {
    gap: 10px;
  }

  .goal-item {
    padding: 4px;
    gap: 3px;
  }

  .goal-ring {
    width: 42px;
    height: 42px;
  }

  .goal-ring::after {
    inset: 6px;
  }

  .goal-ring__inner {
    width: 24px;
    height: 24px;
  }

  .goal-count {
    font-size: 11px;
  }

  .goal-icon {
    width: 14px;
    height: 14px;
    border-radius: 5px;
  }

  .goal-progress {
    width: 30px;
    height: 30px;
    font-size: 10px;
  }
}

@media (max-width: 390px) {
  #app {
    padding: calc(8px + clamp(0px, calc(env(safe-area-inset-top, 0px) - 12px), 999px)) 14px max(16px, env(safe-area-inset-bottom, 0px));
  }

  .spark {
    width: 50px;
    height: 50px;
    font-size: 0;
  }

  .streak-card {
    padding: 4px 10px;
  }

  .gems-pill {
    font-size: 13px;
  }

  .score-progress__line {
    gap: 8px;
  }

  .time-orb {
    width: 50px;
    height: 50px;
  }

  .time-orb__inner {
    width: 34px;
    height: 34px;
  }

  #rack .tile {
    min-width: 44px;
    min-height: clamp(40px, 5vh, 54px);
  }

  .goal-ring {
    width: 40px;
    height: 40px;
  }

  .goal-ring::after {
    inset: 5px;
  }

  .goal-ring__inner {
    width: 22px;
    height: 22px;
  }

  .round-learned-metric strong {
    font-size: 16px;
  }

  .round-learned-metric span {
    font-size: 9px;
  }

  #marketplaceModal.overlay {
    padding-left: 14px;
    padding-right: 14px;
  }

  #marketplaceModal .modal.wallet {
    padding-left: 18px;
    padding-right: 18px;
  }

  #marketplaceModal .store-actions > .wallet-offer-btn,
  #marketplaceModal .marketplace-life-offers > button,
  .marketplace-row {
    padding: 6px 8px;
  }
}

@media (max-width: 360px) {
  .corner-actions {
    --top-chip-size: 24px;
  }

  #app {
    padding: calc(7px + clamp(0px, calc(env(safe-area-inset-top, 0px) - 12px), 999px)) 12px max(14px, env(safe-area-inset-bottom, 0px));
    gap: 14px;
  }

  .spark {
    width: 48px;
    height: 48px;
    font-size: 0;
  }

  .streak-row strong {
    font-size: 14px;
  }

  .streak-row span {
    font-size: 8px;
  }

  .icon-btn.language-select-btn {
    min-width: 44px;
    padding: 0 6px;
    gap: 4px;
  }

  .language-selected-flag,
  .language-selected-icon {
    font-size: 10px;
  }

  .gems-pill {
    font-size: 12px;
  }

  .wallet-pill {
    padding: 0 8px;
  }

  .corner-actions .icon-btn.leaderboard-icon {
    width: var(--top-chip-size);
    height: var(--top-chip-size);
    font-size: 13px;
  }

  #rack .tile {
    min-width: 42px;
    min-height: clamp(38px, 4.8vh, 52px);
  }

  .goal-item {
    padding: 3px;
  }

  #marketplaceModal.overlay {
    padding-left: 12px;
    padding-right: 12px;
  }

  #marketplaceModal .modal.wallet {
    padding-left: 16px;
    padding-right: 16px;
  }

  #marketplaceModal .store-actions > .wallet-offer-btn,
  #marketplaceModal .marketplace-life-offers > button,
  .marketplace-row {
    padding: 5px 8px;
  }

  #marketplaceModal .store-actions .wallet-offer-image {
    max-height: 38px;
  }
}

@media (max-height: 860px) {
  #app {
    gap: 14px;
  }

  .score-progress {
    padding: 10px 12px;
    gap: 6px;
    border-radius: 20px;
  }

  .score-progress__line {
    gap: 10px;
  }

  .goals-list {
    padding: 8px 0;
    gap: 10px;
  }

  .goal-item {
    padding: 3px;
    gap: 2px;
  }

  .goal-ring {
    width: 40px;
    height: 40px;
  }

  .goal-ring::after {
    inset: 5px;
  }

  .goal-ring__inner {
    width: 22px;
    height: 22px;
  }

  .goal-count {
    font-size: 10px;
  }

  .time-orb {
    width: 50px;
    height: 50px;
  }

  .time-orb__inner {
    width: 34px;
    height: 34px;
  }

  .time-orb-label {
    font-size: 9px;
  }

  .arena {
    padding: 16px;
    gap: 10px;
  }

  .wordbar {
    gap: 8px;
  }

  .current-word {
    font-size: 20px;
    letter-spacing: 2px;
  }

  .status {
    font-size: 12px;
  }

  .powerups .controls-row--powerups {
    gap: 6px;
  }

  .powerup-btn {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 11px;
  }

  .powerup-btn .powerup-label {
    font-size: 11px;
  }

  .powerup-btn .powerup-cost,
  .continue-streak-btn .powerup-cost {
    font-size: 10px;
    padding: 2px 7px;
  }

  #submitBtn {
    min-height: 48px;
    font-size: 16px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  #rack {
    gap: 6px;
  }

  #rack .tile {
    min-width: 44px;
    min-height: clamp(38px, 4.9vh, 50px);
    padding: clamp(6px, 0.8vh, 9px) 0;
    font-size: 18px;
    border-radius: 16px;
  }

  #rack .tile-multiplier {
    right: 8px;
    bottom: 6px;
    font-size: 10px;
  }

  /* Marketplace: compact for shorter viewports */
  #marketplaceModal {
    padding: 24px 20px;
    align-items: stretch;
    overflow-y: auto;
  }

  #marketplaceModal .modal.wallet {
    max-height: 100%;
    gap: 14px;
  }

  #marketplaceModal .wallet-header {
    gap: 8px;
    padding: 0 0 4px;
  }

  #marketplaceModal .wallet-header h2 {
    margin-bottom: 2px;
  }

  #marketplaceModal .wallet-description {
    font-size: clamp(11px, 1vw + 8px, 14px);
    line-height: 1.3;
  }

}

@media (max-height: 760px) {
  #app {
    gap: 10px;
  }

  .score-progress {
    padding: 8px 10px;
    gap: 5px;
    border-radius: 18px;
  }

  .score-progress__line {
    gap: 8px;
  }

  .goals-list {
    padding: 6px 0;
    gap: 8px;
  }

  .goal-item {
    padding: 2px;
    gap: 2px;
  }

  .goal-ring {
    width: 36px;
    height: 36px;
  }

  .goal-ring::after {
    inset: 4px;
  }

  .goal-ring__inner {
    width: 20px;
    height: 20px;
  }

  .goal-count {
    font-size: 9px;
  }

  .time-orb {
    width: 46px;
    height: 46px;
  }

  .time-orb__inner {
    width: 32px;
    height: 32px;
  }

  .time-orb__inner strong {
    font-size: 15px;
  }

  .time-orb-label {
    font-size: 8px;
  }

  .arena {
    padding: 12px;
    gap: 8px;
    border-radius: 20px;
  }

  .wordbar {
    gap: 6px;
  }

  .current-word {
    font-size: 18px;
    letter-spacing: 1.6px;
  }

  .status {
    font-size: 11px;
  }

  .controls {
    gap: 8px;
  }

  .controls-row {
    gap: 8px;
  }

  .powerups .controls-row--powerups {
    gap: 5px;
  }

  .powerup-btn {
    min-height: 30px;
    padding: 5px 8px;
    font-size: 10px;
    border-radius: 14px;
  }

  .powerup-btn .powerup-label {
    font-size: 10px;
  }

  .powerup-btn .powerup-cost,
  .continue-streak-btn .powerup-cost {
    gap: 3px;
    padding: 2px 6px;
    font-size: 9px;
  }

  .powerup-btn .gem-icon,
  .continue-streak-btn .gem-icon {
    width: 12px;
    height: 12px;
  }

  #submitBtn {
    min-height: 42px;
    font-size: 15px;
    padding-top: 8px;
    padding-bottom: 8px;
    padding-left: 18px;
    padding-right: 18px;
  }

  #rack {
    gap: 5px;
  }

  #rack .tile {
    min-width: 40px;
    min-height: clamp(34px, 4.6vh, 46px);
    padding: clamp(5px, 0.7vh, 8px) 0;
    font-size: 17px;
    border-radius: 14px;
  }

  #rack .tile-multiplier {
    right: 7px;
    bottom: 5px;
    font-size: 9px;
  }

  /* Marketplace: more compact for short viewports */
  #marketplaceModal {
    padding: 16px 16px;
  }

  #marketplaceModal .modal.wallet {
    max-height: 100%;
    gap: 10px;
  }

  #marketplaceModal .wallet-header {
    gap: 6px;
    padding: 0;
  }

  #marketplaceModal .wallet-header h2 {
    font-size: clamp(22px, 3.5vw, 32px);
    margin-bottom: 0;
  }

  #marketplaceModal .wallet-description {
    font-size: 12px;
  }

  #marketplaceModal .wallet-badge {
    padding: 6px 12px;
    font-size: 18px;
    gap: 8px;
  }

  #marketplaceModal .store-actions {
    gap: 5px;
  }

  #marketplaceModal .store-actions > .wallet-offer-btn,
  #marketplaceModal .marketplace-life-offers > button,
  .marketplace-row {
    min-height: 44px;
    padding: 5px 10px;
    border-radius: 12px;
  }

  #marketplaceModal .store-actions .wallet-offer-primary {
    font-size: 14px;
  }

  #marketplaceModal .store-actions .wallet-offer-secondary {
    font-size: 11px;
  }

  #marketplaceModal .store-actions .wallet-offer-image {
    max-height: 38px;
  }
}

@media (min-height: 930px) {
  .arena {
    padding: 22px;
    gap: 16px;
  }

  #rack {
    gap: 10px;
  }

  #rack .tile {
    min-height: clamp(62px, 7.2vh, 84px);
    padding: clamp(12px, 1.4vh, 20px) 0;
    font-size: clamp(20px, 2.2vh, 24px);
  }

  #rack .tile-multiplier {
    bottom: 8px;
  }

  .feed {
    flex: 0 0 auto;
    max-height: clamp(150px, 22vh, 240px);
  }
}

