:root,
[data-theme="light"] {
  --bg: #ffffff;
  --bg-accent: #f1f5f9;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --border: rgba(15, 23, 42, 0.1);
  --border-strong: rgba(15, 23, 42, 0.16);
  --tile: #e8eef5;
  --tile-end: #dce4ee;
  --tile-border: rgba(15, 23, 42, 0.12);
  --tile-hover: #d4e0f0;
  --tile-hover-end: #c5d5ea;
  --tile-active: #3b82f6;
  --tile-active-end: #2563eb;
  --tile-found: #34d399;
  --tile-found-end: #10b981;
  --tile-found-text: #052e16;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #0284c7;
  --danger: #dc2626;
  --success: #059669;
  --shadow: 0 12px 40px rgba(15, 23, 42, 0.08);
  --stat-bg: rgba(15, 23, 42, 0.04);
  --pill-bg: rgba(15, 23, 42, 0.05);
  --ghost-bg: rgba(15, 23, 42, 0.06);
  --selection-border: rgba(15, 23, 42, 0.1);
  --selected-ring: rgba(59, 130, 246, 0.25);
  --flash-ring: rgba(16, 185, 129, 0.2);
  --font-ui: "Nunito", "Segoe UI", sans-serif;
  --font-display: "Sora", "Nunito", sans-serif;
  --font-tile: "Nunito", "Malgun Gothic", "Yu Gothic", "Noto Sans CJK", "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  --bg: #060b16;
  --bg-accent: #030712;
  --panel: rgba(10, 18, 33, 0.95);
  --panel-soft: rgba(15, 24, 43, 0.95);
  --border: rgba(151, 167, 194, 0.14);
  --border-strong: rgba(151, 167, 194, 0.22);
  --tile: #13203a;
  --tile-end: #0d1628;
  --tile-border: rgba(157, 181, 255, 0.14);
  --tile-hover: #1f3660;
  --tile-hover-end: #16284a;
  --tile-active: #2f6df6;
  --tile-active-end: #2150cb;
  --tile-found: #2dd4bf;
  --tile-found-end: #14b8a6;
  --tile-found-text: #05221f;
  --text: #edf2ff;
  --muted: #9fb0d1;
  --accent: #7dd3fc;
  --danger: #ff7b89;
  --success: #6ee7b7;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --stat-bg: rgba(255, 255, 255, 0.04);
  --pill-bg: rgba(255, 255, 255, 0.05);
  --ghost-bg: rgba(255, 255, 255, 0.06);
  --selection-border: rgba(255, 255, 255, 0.08);
  --selected-ring: rgba(63, 132, 255, 0.22);
  --flash-ring: rgba(45, 212, 191, 0.18);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-ui);
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  height: 100%;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  min-height: 100dvh;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  color: var(--text);
  background: var(--bg);
  transition: background 0.25s ease, color 0.25s ease;
  touch-action: manipulation;
  -webkit-font-smoothing: antialiased;
}

button {
  border: 0;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

@media (hover: hover) and (pointer: fine) {
  button:hover {
    transform: translateY(-1px);
  }
}

.app-shell {
  width: min(1100px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(220px, 280px);
  gap: clamp(10px, 1.5vw, 16px);
  align-items: start;
  flex: 1 0 auto;
}

.game-panel,
.card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.game-panel {
  padding: clamp(12px, 2.2vw, 18px);
  display: flex;
  flex-direction: column;
  overflow: visible;
  min-width: 0;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
  min-width: 0;
}

.hero > div:first-child {
  min-width: 0;
  flex: 1;
}

.eyebrow {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.65rem;
  margin-bottom: 4px;
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2.5vw, 1.6rem);
  line-height: 1.1;
  margin-bottom: 4px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: transparent;
  background: linear-gradient(135deg, #7dd3fc 0%, #34d399 100%);
  background-size: 220% 220%;
  -webkit-background-clip: text;
  background-clip: text;
  animation: title-gradient-move 5s ease-in-out infinite;
}

.splash-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 5vw, 2rem);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: transparent;
  background: linear-gradient(135deg, #7dd3fc 0%, #34d399 100%);
  background-size: 220% 220%;
  -webkit-background-clip: text;
  background-clip: text;
  animation: title-gradient-move 5s ease-in-out infinite;
}

@keyframes title-gradient-move {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.hero-copy {
  max-width: 28rem;
  line-height: 1.35;
  font-size: 0.8rem;
}

.hero-actions {
  display: flex;
  align-items: stretch;
  min-width: 0;
  flex-shrink: 0;
}

.header-toolbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  min-width: min(100%, 360px);
}

.daily-chip,
.card,
.stats-card {
  background: var(--panel-soft);
}

.daily-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  font-size: 0.78rem;
  line-height: 1;
  border: 1px solid var(--border);
  white-space: nowrap;
  min-width: 0;
  max-width: 100%;
}

.day-switch {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  width: 100%;
}

#day-prev,
#day-next {
  justify-self: stretch;
  width: 100%;
  min-width: 0;
}

.top-actions {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  justify-items: center;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.top-actions > .icon-btn,
.top-actions > .streak-chip {
  justify-self: center;
}

.top-actions > .streak-chip {
  width: 100%;
  max-width: 64px;
  min-width: 0;
  justify-content: center;
  padding: 0 6px;
}

.lang-chip {
  height: 44px;
  min-height: 44px;
  max-width: 118px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--ghost-bg);
  color: var(--text);
  font-weight: 700;
  font-size: 0.78rem;
  line-height: 1.1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 1;
}

.lang-chip:hover {
  border-color: var(--accent);
}

.lang-chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn,
.day-icon-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--ghost-bg);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  line-height: 0;
  flex-shrink: 0;
}

.day-icon-btn {
  width: 100%;
  min-width: 44px;
  padding: 0 10px;
  gap: 6px;
  line-height: 1;
  justify-content: center;
}

.day-btn-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.icon-btn svg,
.day-icon-btn svg {
  width: 20px;
  height: 20px;
  display: block;
  flex-shrink: 0;
}

.icon-btn svg[hidden],
.day-icon-btn svg[hidden] {
  display: none;
}

.day-icon-btn.is-active,
.icon-btn-primary {
  color: #04111f;
  background: linear-gradient(135deg, #7dd3fc 0%, #34d399 100%);
  border-color: transparent;
}

.icon-btn:hover,
.day-icon-btn:hover {
  border-color: var(--accent);
}

.icon-btn-primary:hover {
  color: #04111f;
  opacity: 0.92;
}

.ghost-button,
.primary-button,
.theme-toggle {
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.78rem;
}

.ghost-button,
.theme-toggle {
  color: var(--text);
  background: var(--ghost-bg);
  border: 1px solid var(--border);
}

.primary-button {
  color: #04111f;
  background: linear-gradient(135deg, #7dd3fc 0%, #34d399 100%);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.theme-toggle.is-active {
  border-color: var(--accent);
  color: var(--accent);
}

.hero-copy,
.muted-copy {
  color: var(--muted);
}

.play-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: center;
  align-items: center;
  min-width: 0;
  width: 100%;
}

.level-progress {
  display: grid;
  gap: 8px;
  width: min(100%, 62vmin, 380px);
  max-width: 100%;
  margin: 0 auto;
}

.level-progress-row {
  display: grid;
  gap: 4px;
}

.level-progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.level-progress-label,
.level-progress-count {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.level-progress-track {
  height: 8px;
  border-radius: 999px;
  background: var(--ghost-bg);
  border: 1px solid var(--border);
  overflow: hidden;
}

.level-progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #38bdf8, #34d399);
  transition: width 0.35s ease;
}

.level-progress-row.is-complete .level-progress-label,
.level-progress-row.is-complete .level-progress-count {
  color: var(--success);
}

.level-progress-row.is-complete .level-progress-fill {
  background: linear-gradient(90deg, #34d399, #10b981);
}

.grid-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 1.5vw, 10px);
  width: 100%;
}

.grid-wrap {
  position: relative;
  width: min(100%, 62vmin, 380px);
  max-width: 100%;
  margin: 0 auto;
  flex-shrink: 1;
  min-width: 0;
  transition: transform 0.35s ease;
  transform-origin: center center;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Keep rotate arrows + board on one row without horizontal overflow */
.grid-stage:has(.rotate-arrow:not([hidden])) .grid-wrap {
  width: min(100%, calc(100% - 104px), 62vmin, 380px);
}

.length-panel {
  display: grid;
  gap: 8px;
  width: min(100%, 62vmin, 380px);
  max-width: 100%;
}

.length-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.difficulty-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  background: color-mix(in srgb, var(--accent) 12%, var(--panel-soft));
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.length-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.cell {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: clamp(8px, 2vw, 12px);
  background: linear-gradient(180deg, var(--tile) 0%, var(--tile-end) 100%);
  border: 1px solid var(--tile-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
  font-family: var(--font-tile);
  font-size: clamp(0.95rem, 3.2vmin, 1.45rem);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text);
  -webkit-text-stroke: 0.25px currentColor;
  text-shadow: 0 0.4px 0 currentColor;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  min-height: 0;
  min-width: 0;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(5px, 1.4vw, 8px);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.screen-float-text {
  --stack-slot: 0;
  --stack-gap: 3.1rem;
  position: fixed;
  z-index: 1300;
  pointer-events: none;
  transform: translate(-50%, calc(-50% + var(--stack-slot) * var(--stack-gap)));
  font-family: var(--font-tile);
  font-weight: 800;
  letter-spacing: 0.08em;
  white-space: normal;
  max-width: min(92vw, 440px);
  text-align: center;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: screen-float-rise 1200ms ease-out forwards;
  line-height: 1.25;
}

.screen-float-text.is-word {
  font-size: clamp(1.05rem, 3.8vw, 1.45rem);
  color: var(--text);
  text-shadow: none;
}

.screen-float-text.is-info {
  font-family: var(--font-ui);
  font-size: clamp(0.82rem, 2.8vw, 0.95rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.screen-float-text.is-success {
  font-family: var(--font-ui);
  font-size: clamp(0.86rem, 3vw, 1.02rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--success);
  text-shadow: none;
}

.screen-float-text.is-error {
  font-family: var(--font-ui);
  font-size: clamp(0.92rem, 3.2vw, 1.08rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #fff;
  text-shadow: none;
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  border-color: rgba(185, 28, 28, 0.55);
  box-shadow: 0 12px 30px rgba(220, 38, 38, 0.28);
  animation-duration: 1800ms;
}

body.fx-boost .screen-float-text {
  animation-duration: 1500ms;
}

body.fx-boost .screen-float-text.is-error {
  animation-duration: 2200ms;
}

@keyframes screen-float-rise {
  0% {
    opacity: 0;
    transform: translate(-50%, calc(-50% + var(--stack-slot) * var(--stack-gap) - 6px)) scale(0.94);
  }
  14% {
    opacity: 1;
    transform: translate(-50%, calc(-50% + var(--stack-slot) * var(--stack-gap) - 28px)) scale(1.02);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, calc(-50% + var(--stack-slot) * var(--stack-gap) - 92px)) scale(1);
  }
}

.cell.mismatch-shake,
.cell.selected.mismatch-shake {
  color: #ffffff;
  background: linear-gradient(180deg, #f87171 0%, #dc2626 100%);
  border-color: rgba(254, 202, 202, 0.95);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 0 0 3px color-mix(in srgb, var(--danger) 35%, transparent);
  animation: mismatch-shake 420ms ease;
  transform: scale(1.06);
}

body.fx-boost .cell.mismatch-shake,
body.fx-boost .cell.selected.mismatch-shake {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.32),
    0 0 0 4px color-mix(in srgb, var(--danger) 40%, transparent),
    0 10px 24px rgba(220, 38, 38, 0.35);
}

.path-layer.is-mismatch .path-line {
  stroke: #ef4444;
  filter: drop-shadow(0 0 4px rgba(239, 68, 68, 0.75));
}

.path-layer.is-mismatch .path-arrow {
  fill: #ef4444;
  filter: drop-shadow(0 0 3px rgba(239, 68, 68, 0.85));
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: visible;
  min-width: 0;
}

.sidebar-drawer-head {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 2px;
}

.sidebar-drawer-head h2 {
  margin: 0;
  font-size: 1rem;
}

.menu-btn {
  display: none;
}

.menu-backdrop {
  display: none;
}

.card {
  padding: 12px 14px;
}

.targets-card {
  display: flex;
  flex-direction: column;
}

.word-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-content: flex-start;
  min-height: 48px;
}

.word-pill {
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--pill-bg);
  border: 1px solid var(--border);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat {
  padding: 10px 8px;
  border-radius: 12px;
  background: var(--stat-bg);
  border: 1px solid var(--border);
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 1.25rem;
  font-weight: 800;
}

.stat-label {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.rules-list {
  padding-left: 16px;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.74rem;
}

h2 {
  font-size: 0.85rem;
  margin-bottom: 6px;
}

.modal-panel {
  position: relative;
  width: min(440px, calc(100% - 24px), calc(100dvw - 24px));
  max-height: min(88vh, 88dvh, 640px);
  overflow: auto;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: clamp(14px, 3vw, 18px);
  z-index: 1;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.mobile-quick-nav {
  display: none;
}

.policy-content {
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
  max-height: min(40vh, 40dvh);
  overflow: auto;
  padding: 10px 4px 4px 0;
  -webkit-overflow-scrolling: touch;
}

.length-btn {
  min-width: 44px;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--ghost-bg);
  color: var(--text);
  font-weight: 700;
  font-size: 0.75rem;
}

/* Phones, tablets (iPad), and touch devices — fit viewport, no page scroll */
@media (max-width: 1366px), (pointer: coarse) {
  html,
  body {
    height: 100%;
    height: 100dvh;
    max-height: 100dvh;
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
  }

  body {
    padding: max(6px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
  }

  .app-shell {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    flex: 1 1 auto;
    gap: 0;
    overflow: hidden;
  }

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

  .hero {
    flex-direction: column;
    align-items: stretch;
    flex-shrink: 0;
    gap: 6px;
    margin-bottom: 6px;
  }

  .hero-copy,
  .eyebrow {
    display: none;
  }

  h1 {
    font-size: clamp(1rem, 4.5vw, 1.2rem);
    margin-bottom: 0;
  }

  .hero-actions,
  .header-toolbar,
  .top-actions {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .header-toolbar {
    gap: 6px;
  }

  .top-actions {
    gap: 4px;
  }

  .day-switch {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 4px;
    width: 100%;
    min-width: 0;
  }

  .day-icon-btn {
    width: 100%;
    min-width: 0;
    height: 40px;
    min-height: 40px;
    justify-content: center;
    padding: 0 6px;
  }

  .day-btn-label {
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.62rem;
  }

  #day-prev,
  #day-next {
    justify-self: stretch;
  }

  .daily-chip {
    flex: none;
    width: auto;
    max-width: min(40vw, 140px);
    min-width: 0;
    min-height: 40px;
    height: 40px;
    justify-self: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.65rem;
    padding: 0 6px;
  }

  .top-actions > .icon-btn,
  .top-actions > .streak-chip {
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
  }

  .top-actions > .streak-chip {
    width: 100%;
    max-width: 52px;
    min-width: 0;
    padding: 0 4px;
    font-size: 0.72rem;
  }

  .play-area {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    max-width: 100%;
    gap: 6px;
    justify-content: center;
    align-items: center;
    overflow: hidden;
  }

  .level-progress {
    flex-shrink: 0;
    width: min(100%, calc(100vw - 16px));
    gap: 4px;
  }

  .level-progress-track {
    height: 6px;
  }

  .level-progress-label,
  .level-progress-count {
    font-size: 0.62rem;
  }

  .grid-stage {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    max-width: 100%;
    align-items: center;
    justify-content: center;
  }

  .cell {
    font-size: clamp(1.05rem, 4.8vmin, 1.5rem);
    font-weight: 800;
    border-radius: clamp(10px, 2.2vmin, 12px);
    -webkit-text-stroke: 0.25px currentColor;
    text-shadow: 0 0.4px 0 currentColor;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
  }

  .grid {
    gap: clamp(6px, 1.6vmin, 8px);
  }

  .grid-wrap {
    width: min(100%, calc(100vw - 16px), calc(100dvh - 152px), 420px);
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: 1 / 1;
    height: auto;
  }

  .grid-stage:has(.rotate-arrow:not([hidden])) .grid-wrap {
    width: min(100%, calc(100vw - 96px), calc(100dvh - 152px), 400px);
  }

  .level-progress,
  .length-panel {
    width: min(100%, calc(100vw - 16px), 420px);
  }

  .length-panel {
    flex-shrink: 0;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    width: min(100%, calc(100vw - 16px));
    gap: 4px;
  }

  .length-filters {
    width: 100%;
    gap: 4px;
  }

  .length-btn {
    flex: 1 1 auto;
    min-height: 36px;
    padding: 4px 6px;
    font-size: 0.7rem;
  }

  .selection-label {
    font-size: 0.65rem;
  }

  .menu-btn {
    display: inline-flex;
  }

  .menu-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 45;
    background: rgba(2, 6, 23, 0.45);
    backdrop-filter: blur(3px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
  }

  .menu-backdrop[hidden] {
    display: none;
  }

  body.menu-open .menu-backdrop {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-drawer-head {
    display: flex;
  }

  .sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    width: min(360px, 90vw);
    max-width: 100%;
    margin: 0;
    padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--panel);
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow);
    transform: translateX(100%);
    transition: transform 0.25s ease;
    visibility: hidden;
  }

  .mobile-quick-nav,
  .mobile-nav-btn {
    display: none;
  }

  body.menu-open .sidebar {
    transform: translateX(0);
    visibility: visible;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
  }

  body.menu-open .menu-btn {
    border-color: var(--accent);
    color: var(--accent);
  }

  body.menu-open {
    overflow: hidden;
    touch-action: none;
    overscroll-behavior: none;
    position: relative;
  }

  body.menu-open .app-shell,
  body.menu-open .menu-backdrop {
    touch-action: none;
  }

  .targets-card {
    grid-column: auto;
  }

  .word-bank {
    max-height: min(36vh, 280px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .top-actions {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    justify-items: center;
    align-items: center;
  }

  .top-actions > .icon-btn,
  .top-actions > .streak-chip {
    justify-self: center;
  }

  .site-copyright {
    margin-top: auto;
    padding: 16px 4px max(8px, env(safe-area-inset-bottom));
  }

  .modal-panel {
    width: min(100%, calc(100% - 16px), calc(100dvw - 16px));
    max-height: min(92vh, 92dvh);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 700px) {
  .cell {
    font-size: clamp(1.05rem, 7.2vw, 1.45rem);
    font-weight: 800;
    border-radius: clamp(10px, 2.8vw, 12px);
    -webkit-text-stroke: 0.25px currentColor;
    text-shadow: 0 0.4px 0 currentColor;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
  }

  .grid {
    gap: clamp(6px, 1.8vw, 8px);
  }

  .modal-actions,
  .social-share-grid,
  .invite-link-box {
    grid-template-columns: 1fr;
  }

  .grid-wrap {
    width: min(100%, calc(100vw - 14px), calc(100dvh - 148px), 420px);
  }

  .grid-stage:has(.rotate-arrow:not([hidden])) .grid-wrap {
    width: min(100%, calc(100vw - 92px), calc(100dvh - 148px), 400px);
  }
}

@media (max-width: 520px) {
  .invite-tabs,
  .settings-tabs {
    grid-template-columns: 1fr;
  }

  .history-head {
    flex-direction: column;
    align-items: stretch;
  }

  h1 {
    font-size: clamp(0.95rem, 4.2vw, 1.1rem);
  }

  .stats-card {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .grid-stage {
    gap: 4px;
  }

  .grid-wrap {
    width: min(100%, calc(100vw - 12px), calc(100dvh - 142px), 420px);
  }

  .grid-stage:has(.rotate-arrow:not([hidden])) .grid-wrap {
    width: min(100%, calc(100vw - 88px), calc(100dvh - 142px), 400px);
  }

  .difficulty-options {
    grid-template-columns: 1fr;
  }

  .difficulty-btn {
    min-height: 44px;
    text-align: center;
  }
}

/* Tall phones / narrow portrait */
@media (max-width: 420px) {
  .grid-wrap {
    width: min(100%, calc(100vw - 10px), calc(100dvh - 136px), 420px);
  }

  .grid-stage:has(.rotate-arrow:not([hidden])) .grid-wrap {
    width: min(100%, calc(100vw - 84px), calc(100dvh - 136px), 400px);
  }

  .cell {
    font-size: clamp(1.08rem, 7.8vw, 1.45rem);
    font-weight: 800;
    -webkit-text-stroke: 0.25px currentColor;
    text-shadow: 0 0.4px 0 currentColor;
    border-radius: clamp(10px, 3vw, 12px);
  }

  .grid {
    gap: clamp(6px, 2vw, 8px);
  }

  .rotate-arrow {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
  }

  .length-btn {
    min-width: 36px;
    padding: 4px 6px;
    font-size: 0.68rem;
  }
}

/* Landscape phones and short screens */
@media (max-height: 520px) and (orientation: landscape) {
  html,
  body {
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
  }

  .app-shell {
    grid-template-columns: 1fr;
    align-items: stretch;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
  }

  .game-panel {
    height: 100%;
    max-height: 100%;
    overflow: hidden;
    padding: 6px;
  }

  .hero {
    margin-bottom: 4px;
    gap: 4px;
  }

  .hero-copy,
  .eyebrow,
  .rules-card {
    display: none;
  }

  .header-toolbar {
    gap: 4px;
  }

  .top-actions {
    justify-items: center;
  }

  .play-area {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 8px;
    min-height: 0;
    overflow: hidden;
  }

  .grid-stage {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
  }

  .grid-wrap {
    width: min(calc(100dvh - 24px), 62vw, 440px);
    max-height: calc(100dvh - 24px);
  }

  .grid-stage:has(.rotate-arrow:not([hidden])) .grid-wrap {
    width: min(calc(100dvh - 24px), 54vw, 400px);
  }

  .level-progress,
  .length-panel {
    width: min(220px, 38vw);
    flex-shrink: 0;
  }

  .length-panel {
    max-height: calc(100dvh - 48px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    flex-direction: column;
  }

  .length-btn {
    min-height: 36px;
    padding: 4px 8px;
  }

  .cell {
    font-size: clamp(1.05rem, 5.5vmin, 1.45rem);
    border-radius: clamp(10px, 2.4vmin, 12px);
  }

  .grid {
    gap: clamp(6px, 1.8vmin, 8px);
  }
}

/* iPad / tablet portrait+ — slightly roomier chrome, still no page scroll */
@media (min-width: 768px) and (max-width: 1366px),
  (pointer: coarse) and (min-width: 768px) {
  .game-panel {
    padding: 12px;
  }

  .hero {
    gap: 8px;
    margin-bottom: 8px;
  }

  h1 {
    font-size: clamp(1.15rem, 2.4vw, 1.45rem);
  }

  .eyebrow {
    display: block;
    margin-bottom: 2px;
  }

  .day-icon-btn,
  .daily-chip,
  .top-actions > .icon-btn,
  .top-actions > .streak-chip {
    height: 44px;
    min-height: 44px;
  }

  .day-icon-btn,
  .top-actions > .icon-btn {
    width: 44px;
    min-width: 44px;
  }

  .day-icon-btn {
    width: 100%;
    min-width: 0;
  }

  .day-btn-label {
    font-size: 0.72rem;
  }

  .length-btn {
    min-height: 40px;
    padding: 6px 10px;
  }

  .cell {
    font-size: clamp(1.15rem, 3.6vmin, 1.55rem);
    font-weight: 800;
    border-radius: clamp(10px, 1.8vmin, 12px);
    -webkit-text-stroke: 0.25px currentColor;
    text-shadow: 0 0.4px 0 currentColor;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
  }

  .grid {
    gap: clamp(7px, 1.4vmin, 10px);
  }

  .grid-wrap {
    width: min(100%, calc(100vw - 36px), calc(100dvh - 176px), 560px);
  }

  .grid-stage:has(.rotate-arrow:not([hidden])) .grid-wrap {
    width: min(100%, calc(100vw - 120px), calc(100dvh - 176px), 520px);
  }

  .level-progress,
  .length-panel {
    width: min(100%, calc(100vw - 36px), 560px);
  }
}

/* Short landscape tablets / foldables */
@media (max-height: 720px) and (orientation: landscape) and (max-width: 1366px),
  (max-height: 720px) and (orientation: landscape) and (pointer: coarse) {
  html,
  body {
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
  }

  .eyebrow {
    display: none;
  }

  .play-area {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 10px;
  }

  .grid-wrap {
    width: min(calc(100dvh - 28px), 58vw, 520px);
    max-height: calc(100dvh - 28px);
  }

  .grid-stage:has(.rotate-arrow:not([hidden])) .grid-wrap {
    width: min(calc(100dvh - 28px), 50vw, 480px);
  }

  .level-progress,
  .length-panel {
    width: min(240px, 36vw);
    flex-shrink: 0;
  }

  .length-panel {
    max-height: calc(100dvh - 48px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    flex-direction: column;
  }

  .cell {
    font-size: clamp(1.1rem, 4.8vmin, 1.5rem);
    border-radius: clamp(10px, 2vmin, 12px);
  }

  .grid {
    gap: clamp(6px, 1.6vmin, 9px);
  }
}

.length-btn.is-active {
  color: #04111f;
  background: linear-gradient(135deg, #7dd3fc 0%, #34d399 100%);
  border-color: transparent;
}

.length-group-label {
  width: 100%;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.rotate-arrow {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--ghost-bg);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 800;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  padding: 0;
}

.rotate-arrow:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.rotate-arrow[hidden] {
  display: none;
}

.cell:hover {
  background: linear-gradient(180deg, var(--tile-hover) 0%, var(--tile-hover-end) 100%);
}

.cell.selected {
  color: #ffffff;
  background: linear-gradient(180deg, var(--tile-active) 0%, var(--tile-active-end) 100%);
  border-color: rgba(183, 212, 255, 0.8);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 0 0 3px var(--selected-ring);
  transform: scale(1.06);
}

.cell.found {
  background: linear-gradient(180deg, var(--tile-found) 0%, var(--tile-found-end) 100%);
  color: var(--tile-found-text);
  border-color: rgba(205, 251, 244, 0.92);
  animation: found-pop 700ms cubic-bezier(0.2, 1.4, 0.3, 1);
}

.cell.flash {
  animation: found-flash 1100ms ease;
}

.cell.connect-pulse {
  animation: connect-pulse 280ms ease-out;
}

body.fx-boost .cell.selected {
  transform: scale(1.1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 0 0 4px var(--selected-ring),
    0 10px 24px rgba(37, 99, 235, 0.35);
}

body.fx-boost .cell.found {
  animation: found-pop-boost 900ms cubic-bezier(0.18, 1.5, 0.28, 1);
}

@keyframes found-pop {
  0% { transform: scale(1) rotate(0deg); }
  40% { transform: scale(1.18) rotate(-4deg); }
  70% { transform: scale(0.96) rotate(2deg); }
  100% { transform: scale(1) rotate(0deg); }
}

@keyframes found-pop-boost {
  0% { transform: scale(1) rotate(0deg); }
  30% { transform: scale(1.28) rotate(-8deg); }
  55% { transform: scale(0.9) rotate(6deg); }
  100% { transform: scale(1) rotate(0deg); }
}

@keyframes found-flash {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  40% { box-shadow: 0 0 0 12px var(--flash-ring); }
}

.burst-layer,
.fx-layer,
.path-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}

.path-layer {
  width: 100%;
  height: 100%;
  z-index: 2;
}

.fx-layer {
  z-index: 4;
}

.path-line {
  fill: none;
  stroke: url(#path-gradient);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.9;
  filter: drop-shadow(0 0 4px rgba(56, 189, 248, 0.65));
}

.path-arrow {
  fill: #38bdf8;
  opacity: 0.95;
  filter: drop-shadow(0 0 3px rgba(56, 189, 248, 0.8));
  transform-box: fill-box;
  transform-origin: center;
}

.path-arrow.is-new {
  animation: arrow-pop 280ms ease-out;
}

.connect-arrow {
  position: absolute;
  width: 22px;
  height: 22px;
  margin-left: -11px;
  margin-top: -11px;
  color: #0ea5e9;
  z-index: 4;
  pointer-events: none;
  animation: connect-fly 320ms ease-out forwards;
  filter: drop-shadow(0 0 6px rgba(14, 165, 233, 0.9));
}

.connect-arrow svg {
  width: 100%;
  height: 100%;
  display: block;
}

@keyframes arrow-pop {
  0% {
    transform: scale(0.35);
    opacity: 0;
  }
  70% {
    transform: scale(1.3);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 0.95;
  }
}

@keyframes connect-fly {
  0% {
    transform: translate(0, 0) scale(0.6) rotate(var(--angle));
    opacity: 0;
  }
  25% {
    opacity: 1;
  }
  100% {
    transform: translate(var(--dx), var(--dy)) scale(1.05) rotate(var(--angle));
    opacity: 0;
  }
}

@keyframes connect-pulse {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.14);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes mismatch-shake {
  0%, 100% { transform: translateX(0) scale(1); }
  20% { transform: translateX(-5px) scale(1.04); }
  40% { transform: translateX(5px) scale(1.04); }
  60% { transform: translateX(-4px) scale(1.02); }
  80% { transform: translateX(3px) scale(1.02); }
}

@keyframes mismatch-hover {
  0% { transform: translateY(0) scale(1); }
  30% { transform: translateY(-4px) scale(1.03); }
  60% { transform: translateY(-1px) scale(1.01); }
  100% { transform: translateY(0) scale(1); }
}

body.fx-boost .cell.mismatch-shake {
  animation-duration: 520ms;
}

body.fx-boost .path-line {
  stroke-width: 5;
}

body.fx-boost .connect-arrow {
  width: 26px;
  height: 26px;
  margin-left: -13px;
  margin-top: -13px;
}

.burst {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #7dd3fc 0%, #34d399 100%);
  animation: burst-move 900ms ease-out forwards;
}

body.fx-boost .burst {
  width: 16px;
  height: 16px;
  animation-duration: 1100ms;
}

.ring-burst {
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 3px solid #34d399;
  transform: translate(-50%, -50%);
  animation: ring-expand 700ms ease-out forwards;
}

@keyframes burst-move {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0.15); opacity: 0; }
}

@keyframes ring-expand {
  0% { transform: translate(-50%, -50%) scale(0.4); opacity: 0.9; }
  100% { transform: translate(-50%, -50%) scale(3.2); opacity: 0; }
}

.success-banner {
  position: absolute;
  left: 50%;
  top: 45%;
  transform: translate(-50%, -50%) scale(0.7);
  padding: 8px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, #7dd3fc 0%, #34d399 100%);
  color: #04111f;
  font-weight: 800;
  letter-spacing: 0.08em;
  opacity: 0;
  animation: banner-pop 900ms ease forwards;
  white-space: nowrap;
  z-index: 3;
}

.points-float,
.points-float-score {
  pointer-events: none;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #059669;
  text-shadow: 0 2px 10px rgba(5, 150, 105, 0.35);
  white-space: nowrap;
  z-index: 6;
}

.points-float {
  position: absolute;
  font-size: clamp(1.4rem, 5vw, 2rem);
  transform: translate(-50%, -50%);
  animation: points-float-up 1100ms ease-out forwards;
}

.points-float-score {
  position: fixed;
  font-size: 1.15rem;
  transform: translate(-50%, -50%);
  animation: points-float-score 1100ms ease-out forwards;
}

body.fx-boost .points-float,
body.fx-boost .points-float-score {
  animation-duration: 1400ms;
}

html[data-theme="dark"] .points-float,
html[data-theme="dark"] .points-float-score {
  color: #6ee7b7;
  text-shadow: 0 2px 12px rgba(110, 231, 183, 0.35);
}

#score-value.score-pop {
  display: inline-block;
  animation: score-pop 700ms ease;
  color: var(--success);
}

@keyframes points-float-up {
  0% {
    opacity: 0;
    transform: translate(-50%, -40%) scale(0.6);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, -70%) scale(1.15);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -160%) scale(1);
  }
}

@keyframes points-float-score {
  0% {
    opacity: 0;
    transform: translate(-50%, 10px) scale(0.7);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -8px) scale(1.12);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -42px) scale(1);
  }
}

@keyframes score-pop {
  0% { transform: scale(1); }
  35% { transform: scale(1.22); }
  100% { transform: scale(1); }
}

@keyframes banner-pop {
  0% { opacity: 0; transform: translate(-50%, -40%) scale(0.6); }
  30% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  100% { opacity: 0; transform: translate(-50%, -70%) scale(0.95); }
}

.selection-label {
  color: var(--muted);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

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

.stats-card {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

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

.word-pill.found {
  color: #05221f;
  background: linear-gradient(135deg, #99f6e4, #34d399);
  border-color: transparent;
  animation: found-pop 500ms ease;
}

.word-pill.bonus {
  border-style: dashed;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}

body.splash-active .modal {
  z-index: 140;
}

.modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.55);
  backdrop-filter: blur(4px);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.settings-list {
  display: grid;
  gap: 8px;
}

.settings-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 12px;
}

.invite-tabs {
  margin-top: 0;
  margin-bottom: 10px;
}

.settings-tab {
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--ghost-bg);
  color: var(--text);
  font-weight: 700;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

.settings-tab.is-active {
  color: #04111f;
  background: linear-gradient(135deg, #7dd3fc 0%, #34d399 100%);
  border-color: transparent;
}

.settings-tab-panels { margin-top: 8px; }
.settings-tab-panel { display: none; }
.settings-tab-panel.is-active { display: block; }

.history-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

.history-head .invite-copy {
  margin: 0;
  flex: 1;
}

.history-summary {
  margin-bottom: 10px;
  font-size: 0.78rem;
}

.yesterday-answers {
  margin: 14px 0 0;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  background: color-mix(in srgb, var(--accent) 7%, var(--panel-soft));
}

.yesterday-answers-head {
  margin-bottom: 10px;
}

.yesterday-answers-title {
  margin: 0 0 4px;
  font-size: 0.92rem;
  font-weight: 800;
}

.yesterday-answers-meta {
  margin: 0;
  font-size: 0.74rem;
}

.yesterday-answers-body {
  display: grid;
  gap: 10px;
  max-height: min(34vh, 280px);
  overflow: auto;
  padding-right: 2px;
  -webkit-overflow-scrolling: touch;
}

.yesterday-diff-heading {
  margin-bottom: 6px;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--muted);
}

.yesterday-word-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.yesterday-word-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  font-family: var(--font-tile);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.history-list {
  display: grid;
  gap: 8px;
  max-height: min(50vh, 50dvh);
  overflow: auto;
  padding-right: 2px;
  -webkit-overflow-scrolling: touch;
}

.history-item {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-soft);
}

.history-item.is-complete {
  border-color: color-mix(in srgb, var(--success) 45%, var(--border));
}

.history-item-title {
  font-weight: 700;
  font-size: 0.86rem;
  margin-bottom: 2px;
}

.history-item-meta,
.history-item-status {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.35;
}

.history-item-status {
  margin-top: 4px;
}

.danger-button {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
  white-space: nowrap;
  flex-shrink: 0;
}

.danger-button:hover {
  border-color: var(--danger);
}

.policy-content h3 {
  color: var(--text);
  font-size: 0.82rem;
  margin-top: 2px;
}

.policy-content ul { padding-left: 18px; }

.feedback-form { display: grid; gap: 8px; }

.feedback-form label {
  display: grid;
  gap: 5px;
  font-size: 0.74rem;
  color: var(--muted);
}

.feedback-form input,
.feedback-form select,
.feedback-form textarea,
.invite-link-box input,
#setting-display-name {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-soft);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
  font-size: 16px;
  line-height: 1.35;
}

.feedback-form textarea {
  resize: vertical;
  min-height: 96px;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-soft);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.setting-row-stack {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  cursor: default;
  gap: 8px;
}

.setting-row-stack > span {
  width: 100%;
}

.setting-row strong {
  display: block;
  font-size: 0.86rem;
  margin-bottom: 2px;
}

.setting-row small {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.3;
}

.setting-row input[type="checkbox"] {
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  accent-color: #34d399;
  flex-shrink: 0;
  touch-action: manipulation;
}

.streak-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 0 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--ghost-bg);
  color: var(--text);
  font-weight: 800;
  font-size: 0.82rem;
}

.hint-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #04111f;
  font-size: 0.65rem;
  font-weight: 800;
  display: grid;
  place-items: center;
}

#hint-btn {
  position: relative;
}

#hint-btn.is-empty {
  opacity: 0.55;
}

.cell.is-hint {
  position: relative;
  background: linear-gradient(180deg, #e0f2fe 0%, #bae6fd 100%);
  border-color: #0284c7;
  color: #0c4a6e;
  box-shadow:
    0 0 0 3px color-mix(in srgb, #0ea5e9 55%, transparent),
    inset 0 0 0 2px #38bdf8;
}

html[data-theme="dark"] .cell.is-hint {
  background: linear-gradient(180deg, #0c4a6e 0%, #075985 100%);
  border-color: #38bdf8;
  color: #e0f2fe;
  box-shadow:
    0 0 0 3px color-mix(in srgb, #38bdf8 45%, transparent),
    inset 0 0 0 2px #7dd3fc;
}

.cell.is-hint.selected {
  color: #0c4a6e;
  background: linear-gradient(180deg, #e0f2fe 0%, #bae6fd 100%);
  border-color: #0284c7;
  box-shadow:
    0 0 0 3px color-mix(in srgb, #0ea5e9 55%, transparent),
    inset 0 0 0 2px #38bdf8,
    0 0 0 5px var(--selected-ring);
  transform: scale(1.06);
}

html[data-theme="dark"] .cell.is-hint.selected {
  color: #e0f2fe;
  background: linear-gradient(180deg, #0c4a6e 0%, #075985 100%);
  border-color: #38bdf8;
  box-shadow:
    0 0 0 3px color-mix(in srgb, #38bdf8 45%, transparent),
    inset 0 0 0 2px #7dd3fc,
    0 0 0 5px var(--selected-ring);
}

body.fx-boost .cell.is-hint.selected {
  transform: scale(1.08);
  box-shadow:
    0 0 0 3px color-mix(in srgb, #0ea5e9 65%, transparent),
    inset 0 0 0 2px #38bdf8,
    0 0 0 5px var(--selected-ring),
    0 10px 24px rgba(14, 165, 233, 0.35);
}

html[data-theme="dark"] body.fx-boost .cell.is-hint.selected {
  box-shadow:
    0 0 0 3px color-mix(in srgb, #38bdf8 55%, transparent),
    inset 0 0 0 2px #7dd3fc,
    0 0 0 5px var(--selected-ring),
    0 10px 24px rgba(56, 189, 248, 0.35);
}

.hint-arrow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(1.1rem, 4.6vmin, 1.5rem);
  height: clamp(1.1rem, 4.6vmin, 1.5rem);
  color: #0369a1;
  pointer-events: none;
  z-index: 3;
  transform: translate(-50%, -50%) rotate(var(--hint-angle, 0deg)) translateX(48%);
  filter:
    drop-shadow(0 0 0.5px #fff)
    drop-shadow(0 0 1.5px #fff)
    drop-shadow(0 1px 3px rgba(3, 105, 161, 0.55));
}

html[data-theme="dark"] .hint-arrow {
  color: #7dd3fc;
  filter:
    drop-shadow(0 0 0.5px #0f172a)
    drop-shadow(0 0 2px rgba(14, 165, 233, 0.95))
    drop-shadow(0 1px 4px rgba(56, 189, 248, 0.65));
}

.hint-arrow svg {
  display: block;
  width: 100%;
  height: 100%;
}

.hint-guide-line {
  fill: none;
  stroke: url(#hint-guide-gradient);
  stroke-width: 4;
  stroke-linecap: round;
  opacity: 0.45;
  filter: drop-shadow(0 0 4px rgba(14, 165, 233, 0.55));
}

.hint-guide-flow {
  fill: none;
  stroke: url(#hint-guide-gradient);
  stroke-width: 5.5;
  stroke-linecap: round;
  stroke-dasharray: 12 16;
  opacity: 0.95;
  filter: drop-shadow(0 0 6px rgba(34, 211, 238, 0.85));
  animation: hint-guide-march 0.85s linear infinite;
}

.hint-guide-arrow {
  fill: #06b6d4;
  stroke: #0284c7;
  stroke-width: 1.2;
  filter: drop-shadow(0 0 5px rgba(34, 211, 238, 0.95));
}

html[data-theme="dark"] .hint-guide-arrow {
  fill: #67e8f9;
  stroke: #38bdf8;
}

@keyframes hint-guide-march {
  to {
    stroke-dashoffset: -28;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hint-guide-flow {
    animation: none;
    stroke-dasharray: none;
  }
}

.result-share-text {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-soft);
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.45;
  text-align: left;
  white-space: pre-wrap;
  max-width: 100%;
  overflow: auto;
}

.celebrate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
  pointer-events: auto;
}

.celebrate-actions .ghost-button,
.celebrate-actions .primary-button {
  min-height: 44px;
  min-width: 120px;
  flex: 1 1 auto;
  touch-action: manipulation;
}

@media (max-width: 420px) {
  .celebrate-actions {
    flex-direction: column;
  }

  .celebrate-actions .ghost-button,
  .celebrate-actions .primary-button {
    width: 100%;
  }

  .social-share-grid {
    grid-template-columns: 1fr;
  }
}

.leaderboard-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-soft);
}

.leaderboard-rank {
  font-weight: 800;
  color: var(--accent);
}

.leaderboard-name {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-score {
  font-weight: 800;
}

#setting-display-name {
  width: min(140px, 42vw);
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  padding: 8px 10px;
  font: inherit;
}

.consent-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1200;
  padding:
    12px
    max(12px, env(safe-area-inset-right, 0px))
    calc(12px + env(safe-area-inset-bottom, 0px))
    max(12px, env(safe-area-inset-left, 0px));
  pointer-events: none;
}

.consent-card {
  pointer-events: auto;
  width: min(520px, 100%);
  margin: 0 auto;
  padding: 14px 14px 12px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  box-shadow: var(--shadow);
  display: grid;
  gap: 10px;
}

.consent-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

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

.consent-actions .primary-button,
.consent-actions .ghost-button {
  flex: 1 1 auto;
  min-width: 88px;
}

@media (max-width: 520px) {
  .consent-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .consent-actions #consent-privacy {
    grid-column: 1 / -1;
  }
}

.difficulty-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 4px;
}

.language-options {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-height: 280px;
  overflow-y: auto;
  padding-right: 2px;
}

@media (max-width: 420px) {
  .language-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.difficulty-btn {
  min-height: 44px;
  padding: 10px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--ghost-bg);
  color: var(--text);
  font-weight: 700;
  font-size: 0.78rem;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.difficulty-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.difficulty-btn.is-active {
  color: #04111f;
  background: linear-gradient(135deg, #7dd3fc 0%, #34d399 100%);
  border-color: transparent;
}

.difficulty-btn:hover {
  border-color: var(--accent);
}

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

.invite-copy {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
  margin-bottom: 10px;
}

.invite-link-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 12px;
}

.invite-link-box input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-soft);
  color: var(--text);
  padding: 10px 12px;
  font-size: 16px;
}

.social-share-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.social-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel-soft);
  color: var(--text);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.social-btn:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.social-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 0.68rem;
  font-weight: 800;
  color: #ffffff;
  flex-shrink: 0;
}

.social-whatsapp .social-icon { background: #25d366; }
.social-facebook .social-icon { background: #1877f2; }
.social-twitter .social-icon { background: #111827; }
.social-telegram .social-icon { background: #229ed9; }
.social-linkedin .social-icon { background: #0a66c2; }
.social-email .social-icon { background: #ea4335; }
.social-sms .social-icon { background: #7c3aed; }
.social-native .social-icon { background: #0ea5e9; }

.celebrate-overlay {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: grid;
  place-items: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 40%, rgba(14, 165, 233, 0.28), transparent 42%),
    radial-gradient(circle at 30% 70%, rgba(52, 211, 153, 0.22), transparent 40%),
    rgba(4, 17, 31, 0.35);
  opacity: 0;
}

.celebrate-overlay.is-playing {
  pointer-events: auto;
  opacity: 1;
  animation: celebrate-fade-in 0.55s ease forwards;
}

.celebrate-overlay[hidden] {
  display: none;
}

.celebrate-card {
  text-align: center;
  padding: 1.2rem 1.4rem;
  border-radius: 22px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.94), rgba(224, 242, 254, 0.92));
  color: #0b1b2b;
  box-shadow: 0 20px 50px rgba(2, 12, 27, 0.35);
  transform: scale(0.7) translateY(18px);
  opacity: 0;
  width: min(92vw, 360px);
  max-width: min(92vw, 360px);
  max-height: min(85dvh, 560px);
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  pointer-events: auto;
}

.celebrate-overlay.is-playing .celebrate-card {
  animation: celebrate-card-in 0.65s cubic-bezier(0.22, 1.2, 0.36, 1) forwards;
}

html[data-theme="dark"] .celebrate-card {
  background: linear-gradient(160deg, rgba(15, 23, 42, 0.96), rgba(8, 47, 73, 0.94));
  color: #e2e8f0;
}

.celebrate-eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #0284c7;
  font-weight: 700;
}

.celebrate-title {
  margin: 0;
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  background: linear-gradient(120deg, #0284c7, #059669);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: celebrate-title-pulse 1.5s ease-in-out 0.2s 4;
}

.celebrate-sub {
  margin: 0.55rem 0 0;
  font-size: 0.92rem;
  opacity: 0.8;
}

.celebrate-burst {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.celebrate-piece {
  position: absolute;
  top: 45%;
  left: 50%;
  width: 10px;
  height: 14px;
  border-radius: 3px;
  opacity: 0;
  animation: celebrate-confetti 1.8s ease-out forwards;
}

body.fx-boost .celebrate-overlay.is-playing .celebrate-card {
  animation-duration: 0.5s;
}

@keyframes celebrate-fade-in {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes celebrate-card-in {
  0% { opacity: 0; transform: scale(0.65) translateY(24px); }
  70% { opacity: 1; transform: scale(1.06) translateY(0); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes celebrate-fade {
  0% { opacity: 0; }
  5% { opacity: 1; }
  88% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes celebrate-card {
  0% { opacity: 0; transform: scale(0.65) translateY(24px); }
  8% { opacity: 1; transform: scale(1.06) translateY(0); }
  14% { transform: scale(1); }
  88% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.96) translateY(-10px); }
}

@keyframes celebrate-title-pulse {
  0%, 100% { filter: brightness(1); transform: scale(1); }
  50% { filter: brightness(1.15); transform: scale(1.04); }
}

@keyframes celebrate-confetti {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(0deg) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--cx), var(--cy)) rotate(var(--rot)) scale(0.6);
  }
}

.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  align-content: center;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  overflow-y: auto;
  background: var(--bg);
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.splash-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

body.splash-active {
  overflow: hidden;
}

.splash-inner {
  width: min(420px, 100%);
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
  animation: splash-rise 700ms ease-out both;
}

.splash-language {
  width: 100%;
  margin-top: 4px;
  display: grid;
  justify-items: center;
  gap: 10px;
  position: relative;
  z-index: 2;
}

.splash-lang-chip {
  max-width: none;
  min-width: 140px;
  height: 44px;
}

.splash-language-panel {
  width: min(420px, 100%);
  max-height: min(58vh, 420px);
  overflow: auto;
  text-align: left;
  margin: 0;
  animation: splash-rise 280ms ease-out both;
}

.splash-language-panel .modal-head {
  justify-content: flex-end;
}

.splash-language-panel .settings-list {
  margin-top: 0;
}

.splash-language-panel .language-options {
  max-height: min(34vh, 240px);
}

html[dir="rtl"] .splash-language-panel {
  text-align: right;
}

.splash-actions {
  display: grid;
  gap: 8px;
  width: min(100%, 280px);
  margin-top: 8px;
}

.splash-actions[hidden] {
  display: none;
}

.splash-start-btn {
  margin-top: 0;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 0;
  color: #04111f;
  font-weight: 800;
  font-size: 0.9rem;
  background: linear-gradient(135deg, #7dd3fc 0%, #34d399 100%);
  box-shadow: 0 10px 24px rgba(14, 165, 233, 0.22);
}

.splash-start-btn:hover {
  transform: translateY(-1px);
}

.splash-tutorial-btn {
  min-height: 42px;
  padding: 9px 16px;
  border-radius: 12px;
  border: 1px solid rgba(125, 211, 252, 0.55);
  background: rgba(8, 47, 73, 0.35);
  color: #e0f2fe;
  font-weight: 700;
  font-size: 0.88rem;
  box-shadow:
    0 0 0 0 color-mix(in srgb, #38bdf8 0%, transparent),
    0 0 14px color-mix(in srgb, #0ea5e9 35%, transparent);
  animation: quick-tips-glow 2.2s ease-in-out infinite;
}

.splash-tutorial-btn:hover {
  border-color: #7dd3fc;
  background: rgba(14, 116, 144, 0.35);
}

.settings-tutorial-btn {
  width: 100%;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  background: color-mix(in srgb, var(--accent) 10%, var(--panel-soft));
  color: var(--text);
  font-weight: 800;
  font-size: 0.92rem;
  box-shadow:
    0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent),
    0 0 14px color-mix(in srgb, var(--accent) 30%, transparent);
  animation: quick-tips-glow 2.2s ease-in-out infinite;
}

.settings-tutorial-btn:hover {
  border-color: var(--accent);
}

@keyframes quick-tips-glow {
  0%, 100% {
    box-shadow:
      0 0 0 0 color-mix(in srgb, #38bdf8 0%, transparent),
      0 0 12px color-mix(in srgb, #0ea5e9 28%, transparent);
  }
  50% {
    box-shadow:
      0 0 0 4px color-mix(in srgb, #38bdf8 28%, transparent),
      0 0 24px color-mix(in srgb, #0ea5e9 55%, transparent);
  }
}

.tutorial-modal {
  position: fixed;
  inset: 0;
  z-index: 2400;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.tutorial-modal[hidden] {
  display: none;
}

.tutorial-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.62);
  backdrop-filter: blur(6px);
}

.tutorial-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 400px);
  display: grid;
  gap: 14px;
  padding: 18px 16px 16px;
  border-radius: 20px;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  box-shadow: 0 22px 56px rgba(15, 23, 42, 0.32);
  animation: splash-consent-in 280ms ease both;
}

.tutorial-head {
  display: grid;
  gap: 2px;
  padding-right: 64px;
  position: relative;
}

.tutorial-kicker {
  margin: 0;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tutorial-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
}

.tutorial-close {
  position: absolute;
  top: 0;
  right: 0;
  min-height: 36px;
  padding: 6px 10px;
}

.tutorial-panel--demo {
  width: min(100%, 420px);
}

.tutorial-demo {
  display: grid;
  gap: 10px;
}

.tutorial-demo-stage {
  position: relative;
  min-height: 258px;
  padding: 54px 14px 14px;
  border-radius: 16px;
  background:
    radial-gradient(circle at 20% 20%, rgba(56, 189, 248, 0.18), transparent 45%),
    radial-gradient(circle at 80% 70%, rgba(52, 211, 153, 0.14), transparent 42%),
    var(--panel-soft);
  border: 1px solid var(--border);
  cursor: pointer;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.tutorial-demo-score {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 6;
  display: grid;
  justify-items: end;
  gap: 2px;
  padding: 6px 10px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  border: 1px solid var(--border);
}

.tutorial-demo-score-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 800;
}

.tutorial-demo-score strong {
  font-family: var(--font-display);
  font-size: 1.15rem;
  line-height: 1;
  color: var(--text);
}

.tutorial-demo-score strong.score-pop {
  animation: score-pop 700ms ease;
}

.tutorial-demo-burst,
.tutorial-demo-fx,
.tutorial-demo-float-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.tutorial-demo-burst,
.tutorial-demo-fx {
  z-index: 5;
}

.tutorial-demo-float-layer {
  z-index: 8;
  display: grid;
  place-items: center;
}

.tutorial-demo-float-layer .screen-float-text {
  position: absolute;
  left: 50%;
  top: 58%;
  transform: translate(-50%, -50%);
  max-width: calc(100% - 24px);
}

.tutorial-demo-stage.is-ready {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--success) 35%, transparent);
}

.tutorial-demo-board {
  position: relative;
  width: 204px;
  height: 204px;
}

.tutorial-demo-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(5, 36px);
  gap: 6px;
  width: 204px;
  height: 204px;
}

.tutorial-demo-cell {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--tile-border);
  background: linear-gradient(180deg, var(--tile), var(--tile-end));
  color: var(--text);
  font-family: var(--font-tile);
  font-weight: 800;
  font-size: 0.95rem;
  display: grid;
  place-items: center;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.tutorial-demo-cell.is-pulse {
  animation: tutorial-cell-pulse 900ms ease-in-out infinite;
}

.tutorial-demo-cell.is-active {
  transform: scale(1.06);
  border-color: color-mix(in srgb, var(--tile-active) 70%, white);
  background: linear-gradient(180deg, var(--tile-active), var(--tile-active-end));
  color: #fff;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tile-active) 28%, transparent);
}

.tutorial-demo-cell.is-found {
  border-color: color-mix(in srgb, var(--tile-found) 70%, white);
  background: linear-gradient(180deg, var(--tile-found), var(--tile-found-end));
  color: var(--tile-found-text);
}

.tutorial-demo-cell.is-found.is-hint {
  border-color: color-mix(in srgb, var(--tile-found) 70%, white);
  background: linear-gradient(180deg, var(--tile-found), var(--tile-found-end));
  color: var(--tile-found-text);
  box-shadow: none;
}

.tutorial-demo-celebrate {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  border-radius: 16px;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 40%, rgba(14, 165, 233, 0.28), transparent 42%),
    radial-gradient(circle at 30% 70%, rgba(52, 211, 153, 0.22), transparent 40%),
    rgba(4, 17, 31, 0.35);
  opacity: 0;
}

.tutorial-demo-celebrate.is-playing {
  pointer-events: auto;
  opacity: 1;
  animation: celebrate-fade-in 0.55s ease forwards;
}

.tutorial-demo-celebrate[hidden] {
  display: none;
}

.tutorial-demo-celebrate-burst {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.tutorial-demo-celebrate-card {
  position: relative;
  z-index: 1;
  width: min(calc(100% - 24px), 280px);
  padding: 1rem 1.1rem;
  transform: scale(0.75) translateY(12px);
  opacity: 0;
}

.tutorial-demo-celebrate.is-playing .tutorial-demo-celebrate-card {
  animation: celebrate-card-in 0.65s cubic-bezier(0.22, 1.2, 0.36, 1) forwards;
}

.tutorial-demo-hint-btn {
  position: absolute;
  top: 10px;
  left: 12px;
  z-index: 6;
  cursor: default;
}

.tutorial-demo-hint-btn.is-pulse {
  animation: tutorial-hint-pulse 900ms ease-in-out infinite;
}

.tutorial-demo-hint-btn.is-tap {
  transform: scale(0.92);
  transition: transform 120ms ease;
}

.tutorial-demo-hint-path {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
  overflow: visible;
}

.tutorial-demo-path {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
  overflow: visible;
}


.tutorial-demo-cell.is-hint {
  position: relative;
  background: linear-gradient(180deg, #e0f2fe 0%, #bae6fd 100%);
  border-color: #0284c7;
  color: #0c4a6e;
  box-shadow:
    0 0 0 3px color-mix(in srgb, #0ea5e9 55%, transparent),
    inset 0 0 0 2px #38bdf8;
}

html[data-theme="dark"] .tutorial-demo-cell.is-hint {
  background: linear-gradient(180deg, #0c4a6e 0%, #075985 100%);
  border-color: #38bdf8;
  color: #e0f2fe;
  box-shadow:
    0 0 0 3px color-mix(in srgb, #38bdf8 45%, transparent),
    inset 0 0 0 2px #7dd3fc;
}

.tutorial-demo-cell.is-hint.is-active {
  color: #0c4a6e;
  background: linear-gradient(180deg, #e0f2fe 0%, #bae6fd 100%);
  border-color: #0284c7;
  box-shadow:
    0 0 0 3px color-mix(in srgb, #0ea5e9 55%, transparent),
    inset 0 0 0 2px #38bdf8,
    0 0 0 5px var(--selected-ring);
  transform: scale(1.06);
}

html[data-theme="dark"] .tutorial-demo-cell.is-hint.is-active {
  color: #e0f2fe;
  background: linear-gradient(180deg, #0c4a6e 0%, #075985 100%);
  border-color: #38bdf8;
  box-shadow:
    0 0 0 3px color-mix(in srgb, #38bdf8 45%, transparent),
    inset 0 0 0 2px #7dd3fc,
    0 0 0 5px var(--selected-ring);
}

body.fx-boost .tutorial-demo-cell.is-hint.is-active {
  transform: scale(1.08);
  box-shadow:
    0 0 0 3px color-mix(in srgb, #0ea5e9 65%, transparent),
    inset 0 0 0 2px #38bdf8,
    0 0 0 5px var(--selected-ring),
    0 10px 24px rgba(14, 165, 233, 0.35);
}

html[data-theme="dark"] body.fx-boost .tutorial-demo-cell.is-hint.is-active {
  box-shadow:
    0 0 0 3px color-mix(in srgb, #38bdf8 55%, transparent),
    inset 0 0 0 2px #7dd3fc,
    0 0 0 5px var(--selected-ring),
    0 10px 24px rgba(56, 189, 248, 0.35);
}

.tutorial-demo-hint-path .hint-guide-line,
.tutorial-demo-hint-path .hint-guide-flow,
.tutorial-demo-hint-path .hint-guide-arrow {
  pointer-events: none;
}

.tutorial-demo-path.is-mismatch .path-line {
  stroke: var(--danger);
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--danger) 35%, transparent));
}

.tutorial-demo-path.is-mismatch .path-arrow {
  fill: var(--danger);
  filter: drop-shadow(0 0 3px color-mix(in srgb, var(--danger) 45%, transparent));
}

.tutorial-demo-fx .connect-arrow {
  position: absolute;
  margin-left: -11px;
  margin-top: -11px;
}

@keyframes tutorial-hint-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 color-mix(in srgb, #0ea5e9 45%, transparent);
  }
  50% {
    box-shadow: 0 0 0 6px color-mix(in srgb, #0ea5e9 0%, transparent);
  }
}

.tutorial-demo-cell.is-selected {
  transform: scale(1.04);
  border-color: color-mix(in srgb, var(--danger) 65%, white);
  background: linear-gradient(180deg, color-mix(in srgb, var(--danger) 75%, #fff), var(--danger));
  color: #fff;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 24%, transparent);
}

.tutorial-demo-cell.mismatch-shake {
  animation: mismatch-shake 420ms ease;
}

.tutorial-demo-cell.flash {
  animation: found-pop-boost 700ms cubic-bezier(0.18, 1.5, 0.28, 1);
}

.tutorial-demo-fx .points-float,
.tutorial-demo-fx .points-float-score,
.tutorial-demo-fx .success-banner,
.tutorial-demo-burst .burst,
.tutorial-demo-fx .ring-burst {
  position: absolute;
}

.tutorial-demo-cursor {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 2px solid #fff;
  background: color-mix(in srgb, var(--accent) 82%, #0ea5e9);
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.45);
  opacity: 0;
  z-index: 4;
  pointer-events: none;
  transition: opacity 160ms ease, left 120ms linear, top 120ms linear;
}

.tutorial-demo-cursor::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.35);
}

.tutorial-demo-float {
  position: absolute;
  left: 50%;
  top: 18%;
  transform: translateX(-50%);
  padding: 6px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--success) 18%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--success) 45%, transparent);
  color: var(--success);
  font-weight: 800;
  font-size: 0.92rem;
  z-index: 5;
  animation: tutorial-float-up 900ms ease both;
}

.tutorial-demo-targets {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  z-index: 3;
}

.tutorial-demo-target {
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--pill-bg);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.tutorial-demo-target.is-found {
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 40%, transparent);
  background: color-mix(in srgb, var(--success) 12%, var(--panel));
  animation: tutorial-target-pop 420ms ease both;
}

.tutorial-demo-target.is-muted {
  opacity: 0.55;
}

.tutorial-demo-caption {
  margin: 0;
  min-height: 2.8em;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.45;
  text-align: center;
}

.tutorial-demo-progress {
  height: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 18%, transparent);
  overflow: hidden;
}

.tutorial-demo-progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--success));
  transition: width 120ms linear;
}

.tutorial-actions {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 8px;
}

.tutorial-actions .primary-button,
.tutorial-actions .ghost-button {
  min-height: 44px;
}

.tutorial-actions .primary-button.is-ready {
  animation: tutorial-ready-pulse 900ms ease-in-out infinite;
}

@keyframes tutorial-cell-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
}

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

@keyframes tutorial-target-pop {
  from { transform: scale(0.92); opacity: 0.4; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes tutorial-ready-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent); }
  50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 24%, transparent); }
}

@media (prefers-reduced-motion: reduce) {
  .tutorial-demo-cell.is-pulse,
  .tutorial-demo-cell.mismatch-shake,
  .tutorial-demo-cell.flash,
  .tutorial-actions .primary-button.is-ready,
  .tutorial-demo-target.is-found,
  .tutorial-demo-hint-btn.is-pulse {
    animation: none;
  }

  .tutorial-demo-celebrate.is-playing,
  .tutorial-demo-celebrate.is-playing .tutorial-demo-celebrate-card,
  .tutorial-demo-celebrate .celebrate-title {
    animation: none;
  }
}

.splash-consent-modal {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.splash-consent-modal[hidden] {
  display: none;
}

.splash-consent-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.58);
  backdrop-filter: blur(5px);
}

.splash-consent-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 360px);
  display: grid;
  gap: 14px;
  padding: 18px 16px;
  border-radius: 18px;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.28);
  text-align: center;
  animation: splash-consent-in 280ms ease both;
}

.splash-consent-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.splash-consent-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.splash-consent-actions .primary-button,
.splash-consent-actions .ghost-button {
  min-height: 44px;
  width: 100%;
}

@keyframes splash-consent-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

body.splash-consent-open .splash-inner {
  pointer-events: none;
  user-select: none;
}

.splash-logo {
  margin-bottom: 8px;
  animation: splash-tile-pop 700ms ease both;
}

.splash-logo-mark {
  width: clamp(96px, 28vw, 120px);
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(8px, 2.4vw, 10px);
  padding: clamp(10px, 3vw, 12px);
  border-radius: 22px;
  background: linear-gradient(135deg, #7dd3fc 0%, #34d399 100%);
  box-shadow: 0 14px 32px rgba(14, 165, 233, 0.22);
}

.splash-logo-mark span {
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #e8f7f1 100%);
  font-family: var(--font-tile);
  font-size: clamp(1.1rem, 4vw, 1.35rem);
  font-weight: 800;
  color: #0f172a;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
  animation: splash-tile-pop 600ms ease both;
}

.splash-logo-mark span:nth-child(1) { animation-delay: 80ms; }
.splash-logo-mark span:nth-child(2) { animation-delay: 160ms; }
.splash-logo-mark span:nth-child(3) { animation-delay: 240ms; }
.splash-logo-mark span:nth-child(4) { animation-delay: 320ms; }

.splash-logo-mark span.is-accent {
  background: #0ea5e9;
  color: #ffffff;
  box-shadow: none;
}

.splash-eyebrow {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.68rem;
  font-weight: 700;
}

.splash-screen.is-waiting {
  cursor: pointer;
}

.splash-screen.is-waiting .splash-progress-fill {
  width: 0;
  animation: none;
}

.splash-screen.is-running .splash-progress-fill {
  animation: splash-progress 0.2s linear forwards;
}

.splash-start-hint {
  margin-top: 4px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  animation: splash-hint-pulse 1.4s ease-in-out infinite;
}

.splash-copy {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
  max-width: 24rem;
}

.splash-progress {
  width: min(220px, 70vw);
  height: 4px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--ghost-bg);
  overflow: hidden;
}

.splash-progress-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #38bdf8, #34d399);
}

@keyframes splash-hint-pulse {
  0%, 100% { opacity: 0.72; }
  50% { opacity: 1; }
}

@keyframes splash-rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes splash-progress {
  from { width: 0; }
  to { width: 100%; }
}

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

@media (pointer: coarse) {
  .icon-btn,
  .day-icon-btn,
  .length-btn,
  .settings-tab,
  .difficulty-btn,
  .social-btn,
  .mobile-nav-btn,
  .lang-chip,
  .ghost-button,
  .primary-button,
  .theme-toggle {
    min-height: 44px;
  }

  .setting-row input[type="checkbox"] {
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
  }

  .cell {
    font-weight: 800;
    font-size: clamp(1.05rem, 4.8vmin, 1.5rem);
    border-radius: clamp(10px, 2.2vmin, 12px);
    -webkit-text-stroke: 0.25px currentColor;
    text-shadow: 0 0.4px 0 currentColor;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
  }

  .grid {
    gap: clamp(6px, 1.6vmin, 8px);
  }

  .cell:hover {
    transform: none;
  }

  .cell:active {
    transform: scale(0.97);
  }
}

/* Cross-platform: reduce hover-only affordances on touch, tighten landscape phones */
@media (hover: none) {
  .icon-btn:hover,
  .day-icon-btn:hover,
  .social-btn:hover,
  .difficulty-btn:hover,
  .mobile-nav-btn:hover,
  .lang-chip:hover {
    transform: none;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .celebrate-card {
    max-height: min(88dvh, 420px);
    padding: 0.85rem 1rem;
  }

  .celebrate-title {
    font-size: clamp(1.2rem, 4vw, 1.6rem);
  }

  .result-share-text {
    max-height: 28dvh;
    font-size: 0.72rem;
  }
}

.site-copyright {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: auto 0 0;
  padding: 12px 4px 4px;
  box-sizing: border-box;
  text-align: center;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  opacity: 0.9;
  flex-shrink: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10000;
  padding: 10px 14px;
  background: var(--accent);
  color: #04111f;
  font-weight: 800;
  border-radius: 0 0 10px 0;
}

.skip-link:focus {
  left: 0;
}

.seo-content {
  width: min(960px, calc(100% - 24px));
  margin: 0 auto 28px;
  padding: 18px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  color: var(--text);
}

.seo-content h2,
.seo-content h3 {
  font-family: var(--font-display);
  margin: 0 0 8px;
}

.seo-content h2 {
  font-size: 1.15rem;
}

.seo-content h3 {
  font-size: 0.95rem;
  margin-top: 14px;
}

.seo-content p,
.seo-content li {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.seo-content ol,
.seo-content ul {
  margin: 8px 0 0;
  padding-left: 1.2rem;
}

.seo-content li + li {
  margin-top: 4px;
}

.seo-faq {
  margin: 8px 0 0;
}

.seo-faq dt {
  font-weight: 700;
  color: var(--text);
  font-size: 0.9rem;
  margin-top: 10px;
}

.seo-faq dd {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.ad-slot {
  width: min(1100px, calc(100% - 24px));
  margin: 0 auto 12px;
  padding: 8px 10px 10px;
  min-height: 60px;
  text-align: center;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  overflow: hidden;
}

.ad-slot[hidden] {
  display: none !important;
}

.ad-slot-label {
  display: block;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 6px;
}

.ad-slot-sidebar {
  width: 100%;
  margin: 10px 0 0;
}

.ad-slot-play-bottom {
  display: none;
  width: 100%;
  margin-top: 10px;
}

.ad-slot-footer {
  margin-bottom: 20px;
}

body.splash-active .ad-slot {
  display: none !important;
}

@media (max-width: 839px) {
  .ad-slot-play-bottom:not([hidden]) {
    display: block;
  }

  .ad-slot-sidebar {
    display: none !important;
  }
}

.policy-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.noscript-fallback {
  margin-top: 24px;
}

html[dir="rtl"] .header-toolbar,
html[dir="rtl"] .top-actions,
html[dir="rtl"] .day-switch { direction: rtl; }
html[dir="rtl"] .hero-copy,
html[dir="rtl"] .sidebar,
html[dir="rtl"] .modal-panel { text-align: right; }
html[dir="rtl"] .grid,
html[dir="rtl"] .grid-wrap,
html[dir="rtl"] .length-filters { direction: ltr; }
