/* ===== Reset & Base ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

body {
  background:
    radial-gradient(circle at 15% 10%, rgba(255, 126, 179, 0.16), transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(77, 195, 255, 0.14), transparent 45%),
    linear-gradient(160deg, #17132e 0%, #0f0d22 60%, #0a0918 100%) fixed;
  color: #e0e0e0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 20px 16px;
  overflow-x: hidden;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

/* ===== Container ===== */
.container {
  width: 100%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

/* ===== HUD ===== */
.hud {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hud-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.hud-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.title {
  font-size: 2.8rem;
  font-weight: 900;
  background: linear-gradient(135deg, #ffe066, #ff9a3d 45%, #ff5f8f);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -1px;
}

/* ===== Stats Bar ===== */
.stats-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 6px 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  width: 100%;
  flex-wrap: wrap;
}

.stats-bar-secondary {
  padding: 4px 14px;
  background: rgba(255, 255, 255, 0.04);
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #8888aa;
  font-weight: 600;
}

.stat-value {
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}

.stat-sep {
  color: #333;
  font-size: 0.9rem;
  user-select: none;
}

/* ===== Undo Button ===== */
.undo-btn {
  background: rgba(255, 255, 255, 0.07);
  color: #c9c3e6;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, color 0.15s, border-color 0.15s;
  letter-spacing: 0.5px;
}

.undo-btn:hover:not(:disabled) {
  color: #00d4ff;
  border-color: #00d4ff;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 212, 255, 0.2);
}

.undo-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.undo-btn:active:not(:disabled) {
  transform: translateY(0);
}

/* ===== Score boxes (kept for pop animation compat) ===== */
.scores {
  display: flex;
  gap: 8px;
}

.score-box {
  background: #1a1a2e;
  border-radius: 8px;
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.score-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #8888aa;
  font-weight: 600;
}

.score-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}

.new-game-btn {
  background: linear-gradient(135deg, #ffb84d, #ff5f8f);
  color: #fff;
  border: none;
  border-radius: 12px;
  box-shadow: 0 4px 0 rgba(150, 40, 80, 0.55);
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  letter-spacing: 0.5px;
}

.new-game-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(246, 94, 59, 0.4);
}

.new-game-btn:active {
  transform: translateY(0);
}

/* ===== Mode Selector ===== */
.mode-selector {
  max-width: 380px;
  margin: 0 auto 16px;
}

.mode-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.mode-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: #aaa;
  padding: 10px 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.mode-btn .mode-sub {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: #666;
  margin-top: 2px;
}

.mode-btn:hover {
  border-color: rgba(0, 212, 255, 0.4);
  color: #ddd;
}

.mode-btn.selected {
  border-color: #00d4ff;
  color: #fff;
  background: rgba(0, 212, 255, 0.08);
  box-shadow: 0 0 16px rgba(0, 212, 255, 0.15);
}

.mode-btn.selected .mode-sub {
  color: #00d4ff;
}

/* ===== Timer Bar ===== */
.board-wrapper {
  width: 100%;
  max-width: min(500px, max(220px, calc(100vh - var(--gp-header-h, 80px) - 154px)));
  max-width: min(500px, max(220px, calc(100dvh - var(--gp-header-h, 80px) - 154px)));
  position: relative;
}

.timer-bar-track {
  width: 100%;
  height: 6px;
  background: #1a1a2e;
  border-radius: 3px 3px 0 0;
  overflow: hidden;
  display: none;
}

.timer-bar-track.active {
  display: block;
}

.timer-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ff5f8f, #ffe066, #4dc3ff);
  border-radius: 3px;
  transition: width 0.25s linear;
}

.timer-bar-track.urgent .timer-bar-fill { animation: urgent 0.5s ease-in-out infinite alternate; }

@keyframes urgent {
  from { filter: brightness(1); }
  to { filter: brightness(1.6) saturate(1.4); }
}

/* ===== Board ===== */
.board-container {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 500px;
}

.grid-background {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.04));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  display: grid;
  grid-template-columns: repeat(var(--grid-size, 4), 1fr);
  grid-template-rows: repeat(var(--grid-size, 4), 1fr);
  gap: var(--grid-gap);
  padding: var(--grid-gap);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.board-container.bump { animation: bump 0.22s ease-out; }
.board-container.is-over .tile-container { filter: grayscale(0.85) brightness(0.8); transition: filter 0.6s ease; }
.board-container.is-over { animation: over-shake 0.5s ease-out; }

@keyframes bump {
  30% { transform: scale(0.985); }
  100% { transform: scale(1); }
}

@keyframes over-shake {
  10%, 50% { transform: translateX(-6px); }
  30%, 70% { transform: translateX(6px); }
  90% { transform: translateX(-2px); }
}

:root {
  --grid-gap: 12px;
  --grid-size: 4;
  --c-2: #7ee8b0; --c-4: #7fd0ff; --c-8: #b796ff; --c-16: #ff7eb3; --c-32: #ff8a6b; --c-64: #ffa53d;
  --c-128: #ffd84d; --c-256: #9be35a; --c-512: #3fd8c4; --c-1024: #8f5cff; --c-2048: #ffc21a; --c-super: #ff5f8f;
}

.grid-cell {
  background: rgba(10, 8, 30, 0.35);
  border-radius: 12px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.35);
}

.tile-container {
  position: absolute;
  inset: 0;
  padding: var(--grid-gap);
  pointer-events: none;
}

/* ===== Tiles ===== */
.tile {
  position: absolute;
  left: 0;
  top: 0;
  transition: transform 0.12s cubic-bezier(.2, .9, .3, 1);
  z-index: 10;
  will-change: transform;
}

.tile-container.no-anim .tile { transition: none; }

.tile-inner {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  border-radius: 12px;
  overflow: hidden;
  background: var(--g);
  color: var(--ink, #fff);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.12);
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.16), inset 0 2px 0 rgba(255, 255, 255, 0.55), 0 6px 14px rgba(0, 0, 0, 0.28);
  font-variant-numeric: tabular-nums;
}

.tile-inner::before {
  content: '';
  position: absolute;
  left: 8%;
  right: 8%;
  top: 5%;
  height: 38%;
  border-radius: 10px 10px 40% 40%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.tile-inner.tile-new {
  animation: pop-in 0.22s cubic-bezier(.2, 1.5, .4, 1);
}

.tile-inner.tile-merged {
  animation: merge-pulse 0.26s cubic-bezier(.2, 1.6, .4, 1);
  z-index: 20;
}

@keyframes pop-in {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes merge-pulse {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.22);
  }
  100% {
    transform: scale(1);
  }
}

/* ===== Tile Colors ===== */
.tile-2    { --g: linear-gradient(160deg, #d6fbe7, #7ee8b0); --ink: #1d5c3c; }
.tile-4    { --g: linear-gradient(160deg, #d9f1ff, #7fd0ff); --ink: #19476e; }
.tile-8    { --g: linear-gradient(160deg, #e7dcff, #b796ff); }
.tile-16   { --g: linear-gradient(160deg, #ffd0e4, #ff7eb3); }
.tile-32   { --g: linear-gradient(160deg, #ffd0c2, #ff8a6b); }
.tile-64   { --g: linear-gradient(160deg, #ffe0b0, #ffa53d); }
.tile-128  { --g: linear-gradient(160deg, #fff6c2, #ffd84d); --ink: #6b4f00; box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.14), inset 0 2px 0 rgba(255, 255, 255, 0.6), 0 0 22px rgba(255, 216, 77, 0.45); }
.tile-256  { --g: linear-gradient(160deg, #e8ffc6, #9be35a); --ink: #2f5a10; box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.14), inset 0 2px 0 rgba(255, 255, 255, 0.6), 0 0 24px rgba(155, 227, 90, 0.45); }
.tile-512  { --g: linear-gradient(160deg, #c8fff6, #3fd8c4); --ink: #0e4f48; box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.14), inset 0 2px 0 rgba(255, 255, 255, 0.6), 0 0 26px rgba(63, 216, 196, 0.5); }
.tile-1024 { --g: linear-gradient(160deg, #e4d0ff, #8f5cff); box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.16), inset 0 2px 0 rgba(255, 255, 255, 0.5), 0 0 30px rgba(143, 92, 255, 0.55); }
.tile-2048 { --g: linear-gradient(160deg, #fff4b8, #ffc21a 60%, #ff9a1a); --ink: #6b3d00; box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.14), inset 0 2px 0 rgba(255, 255, 255, 0.7), 0 0 40px rgba(255, 194, 26, 0.7); }
.tile-2048::after { content: ''; position: absolute; inset: -50%; background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, 0.7) 50%, transparent 60%); animation: shine 2.4s linear infinite; }
.tile-super { --g: linear-gradient(135deg, #ff5f8f, #ffb84d, #ffe066, #5ce1a0, #4dc3ff, #b28dff); background-size: 300% 300%; animation: rainbow 4s linear infinite; box-shadow: 0 0 40px rgba(255, 95, 143, 0.6); }

@keyframes shine {
  from { transform: translateX(-60%); }
  to { transform: translateX(60%); }
}

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

.fx-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 40;
}

.fx-ring {
  position: absolute;
  width: var(--size);
  height: var(--size);
  margin: calc(var(--size) / -2) 0 0 calc(var(--size) / -2);
  border: 4px solid #fff;
  border-radius: 16px;
  animation: ring 0.45s ease-out forwards;
}

@keyframes ring {
  from { transform: scale(0.9); opacity: 0.9; }
  to { transform: scale(1.6); opacity: 0; }
}

.fx-spark {
  position: absolute;
  width: 7px;
  height: 7px;
  margin: -3.5px 0 0 -3.5px;
  border-radius: 50%;
  animation: spark 0.55s ease-out forwards;
}

@keyframes spark {
  from { transform: translate(0, 0) scale(1); opacity: 1; }
  to { transform: translate(var(--dx), var(--dy)) scale(0.2); opacity: 0; }
}

.fx-text {
  position: absolute;
  transform: translate(-50%, -50%);
  font-weight: 900;
  font-size: 18px;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35), 0 0 12px rgba(255, 255, 255, 0.5);
  white-space: nowrap;
  animation: float-up 0.8s ease-out forwards;
}

.fx-text.combo, .fx-text.best { font-size: 30px; color: #ffe066; letter-spacing: 2px; animation: float-pop 1.1s ease-out forwards; }

@keyframes float-up {
  from { transform: translate(-50%, -50%); opacity: 1; }
  to { transform: translate(-50%, -150%); opacity: 0; }
}

@keyframes float-pop {
  0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
  20% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
  70% { transform: translate(-50%, -60%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -90%) scale(1); opacity: 0; }
}

.fx-confetti {
  position: absolute;
  width: 8px;
  height: 12px;
  border-radius: 2px;
  animation: confetti 1.6s cubic-bezier(.3, .6, .5, 1) forwards;
}

@keyframes confetti {
  from { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  to { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; }
}

.hint-arrow {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: min(36vw, 180px);
  font-weight: 900;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 0 30px rgba(255, 224, 102, 0.9), 0 6px 0 rgba(0, 0, 0, 0.25);
  animation: hint-pulse 0.8s ease-in-out infinite alternate;
}

.hint-btn { padding-left: 12px; padding-right: 12px; }

@keyframes hint-pulse {
  from { opacity: 0.45; }
  to { opacity: 0.95; }
}

/* ===== Overlays ===== */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 12, 34, 0.78);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fade-in 0.4s ease-out;
}

.overlay.hidden {
  display: none;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.overlay-content {
  text-align: center;
  padding: 32px;
}

.overlay-content h2 {
  font-size: 2.2rem;
  margin-bottom: 8px;
  color: #ff7e9e;
}

.overlay-content.win h2 {
  background: linear-gradient(135deg, #edc22e, #f59563);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 2.6rem;
}

.overlay-content p {
  font-size: 1.1rem;
  color: #8888aa;
  margin-bottom: 24px;
}

.win-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.overlay-btn {
  background: linear-gradient(135deg, #ffb84d, #ff5f8f);
  color: #fff;
  border: none;
  border-radius: 999px;
  box-shadow: 0 5px 0 rgba(150, 40, 80, 0.55);
  padding: 14px 32px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  pointer-events: auto;
}

.overlay-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(246, 94, 59, 0.4);
}

.overlay-btn.secondary {
  background: #1a1a2e;
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.overlay-btn.secondary:hover {
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
}

/* ===== Instructions ===== */
.instructions {
  font-size: 0.85rem;
  color: #5a5a7a;
  text-align: center;
  line-height: 1.5;
}

.instructions strong {
  color: #8888aa;
}

/* ===== Score Pop ===== */
.score-pop {
  position: absolute;
  top: -10px;
  right: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: #edc22e;
  animation: score-float 0.7s ease-out forwards;
  pointer-events: none;
  z-index: 50;
}

@keyframes score-float {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-30px);
  }
}

/* ===== Responsive ===== */
@media (max-width: 520px) {
  :root {
    --grid-gap: 8px;
  }

  body {
    padding: 12px 8px;
  }

  .title {
    font-size: 2rem;
  }

  .score-box {
    min-width: 64px;
    padding: 6px 10px;
  }

  .score-value {
    font-size: 1.1rem;
  }

  .new-game-btn {
    padding: 8px 14px;
    font-size: 0.8rem;
  }

  .undo-btn {
    padding: 8px 12px;
    font-size: 0.8rem;
  }

  .tile {
    border-radius: 6px;
  }

  .grid-cell {
    border-radius: 6px;
  }

  .grid-background {
    border-radius: 10px;
  }

  .stats-bar {
    gap: 6px;
    padding: 5px 10px;
  }

  .stat-value {
    font-size: 0.85rem;
  }

  .stat-label {
    font-size: 0.6rem;
  }

  .mode-buttons {
    gap: 6px;
  }

  .mode-btn {
    padding: 8px 6px;
    font-size: 12px;
  }
}

@media (max-width: 360px) {
  :root {
    --grid-gap: 6px;
  }

  .title {
    font-size: 1.6rem;
  }

  .hud {
    gap: 6px;
  }

  .stats-bar {
    gap: 4px;
    padding: 4px 8px;
  }

  .stat-value {
    font-size: 0.75rem;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  .container {
    max-width: 900px;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: center;
    gap: 16px;
  }
  .hud { width: 280px; }
  .board-wrapper {
    width: max(200px, calc(100vh - var(--gp-header-h, 48px) - 28px));
    width: max(200px, calc(100dvh - var(--gp-header-h, 48px) - 28px));
    max-width: none;
  }
  .instructions { display: none; }
}

@media (orientation: landscape) and (max-height: 500px) {
  #start-overlay > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 24px; align-items: center; align-content: center; justify-items: center; width: min(780px, calc(100% - 24px)); max-width: none; }
  #start-overlay > div > * { grid-column: 2; }
  #start-overlay .how-to { grid-column: 1; grid-row: 1 / span 6; margin: 0; max-width: 340px; width: 100%; }
}

@media (max-height: 700px) {
  #start-overlay > div { padding: 14px !important; }
  #start-overlay h1 { font-size: 38px !important; margin-bottom: 4px !important; }
  #start-overlay .how-to { line-height: 1.5 !important; padding: 10px 14px !important; margin-bottom: 10px !important; }
}

@media (pointer: coarse) {
  .new-game-btn, .undo-btn { min-height: 38px; }
}

@media (orientation: landscape) and (max-height: 500px) {
  #start-overlay h1 { font-size: 30px !important; }
  #start-overlay .mode-btn { padding-top: 6px; padding-bottom: 6px; }
}

@media (pointer: coarse) and (min-width: 700px) and (min-height: 700px) {
  .container { max-width: 620px; }
  .board-wrapper {
    max-width: min(620px, max(220px, calc(100vh - var(--gp-header-h, 80px) - 154px)));
    max-width: min(620px, max(220px, calc(100dvh - var(--gp-header-h, 80px) - 154px)));
  }
}

.start-box { text-align: center; padding: 30px; }
.start-title { font-size: 48px; margin-bottom: 8px; background: linear-gradient(135deg, #ffe066, #ff9a3d 45%, #ff5f8f); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 4px 0 rgba(120, 40, 90, 0.45)); }
.start-sub { color: #888; margin-bottom: 16px; }
.how-to { max-width: 340px; text-align: left; margin: 0 auto 16px; padding: 14px 18px; background: rgba(255,255,255,0.04); border-radius: 8px; font-size: 13px; line-height: 1.7; color: #aaa; }
.how-to-title { font-size: 11px; font-weight: 700; letter-spacing: 2px; color: #666; margin-bottom: 8px; text-transform: uppercase; }
.start-btn { padding: 12px 36px; font-size: 16px; font-weight: 800; border: 0; border-radius: 999px; background: linear-gradient(135deg, #ffb84d, #ff5f8f); color: #fff; cursor: pointer; letter-spacing: 1px; box-shadow: 0 5px 0 rgba(150, 40, 80, 0.55); }
.section-label { margin-bottom: 10px; }

[data-theme="light"] html,
[data-theme="light"] body { background: var(--gp-page-grad) fixed; color: var(--gp-ink); }
[data-theme="light"] .stats-bar, [data-theme="light"] .score-box, [data-theme="light"] .undo-btn { background: var(--gp-surface); box-shadow: inset 0 0 0 1px var(--gp-line); }
[data-theme="light"] .stats-bar-secondary { background: rgba(255, 255, 255, 0.7); }
[data-theme="light"] .stat-label, [data-theme="light"] .score-label, [data-theme="light"] .instructions strong { color: var(--gp-ink-3); }
[data-theme="light"] .stat-value, [data-theme="light"] .score-value { color: var(--gp-ink); }
[data-theme="light"] .undo-btn { color: var(--gp-ink-2); }
[data-theme="light"] .undo-btn:hover:not(:disabled) { color: #0a84b8; }
[data-theme="light"] .mode-btn { color: var(--gp-ink-2); }
[data-theme="light"] .mode-btn:hover, [data-theme="light"] .mode-btn.selected { color: var(--gp-ink); }
[data-theme="light"] .mode-btn.selected .mode-sub { color: #0a84b8; }
[data-theme="light"] .timer-bar-track { background: #e5e2f3; }
[data-theme="light"] .overlay { background: var(--gp-overlay); color: var(--gp-ink); }
[data-theme="light"] .overlay-content p { color: var(--gp-ink-2); }
[data-theme="light"] .overlay-btn.secondary { background: #e5e2f3; color: var(--gp-ink); }
[data-theme="light"] #start-overlay { background: var(--gp-overlay); }
[data-theme="light"] .start-title { filter: none; }
[data-theme="light"] .start-sub { color: var(--gp-ink-2); }
[data-theme="light"] .how-to { background: rgba(31, 27, 69, 0.05); color: var(--gp-ink-2); }
[data-theme="light"] .how-to-title { color: var(--gp-ink-3); }
[data-theme="light"] .grid-background { background: linear-gradient(160deg, #ffffff, #f1ecff); border-color: rgba(120, 100, 200, 0.18); box-shadow: 0 16px 40px rgba(80, 60, 160, 0.14); }
[data-theme="light"] .grid-cell { background: #e9e3fb; box-shadow: inset 0 2px 5px rgba(80, 60, 160, 0.12); }
[data-theme="light"] .tile-inner { box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.12), inset 0 2px 0 rgba(255, 255, 255, 0.6), 0 5px 12px rgba(80, 60, 160, 0.18); }
[data-theme="light"] .fx-text { color: #3b2a7a; text-shadow: 0 2px 0 rgba(255, 255, 255, 0.8); }
[data-theme="light"] .fx-text.combo, [data-theme="light"] .fx-text.best { color: #e85d04; }
[data-theme="light"] .hint-arrow { color: rgba(80, 60, 160, 0.8); text-shadow: 0 0 24px rgba(255, 184, 77, 0.8); }
[data-theme="light"] .board-container.is-over .tile-container { filter: grayscale(0.85) brightness(1.05); }

.gp-btn-music.off { opacity: .4; }
