/* Synonym Sprint — themes + flat layout */

/* —— theme tokens: dark (navy night sky — soft spark, easy on eyes) —— */
:root,
[data-theme="dark"] {
  color-scheme: dark;
  /*
   * Calm navy foundation + a few soft accents (sky, mint, honey, coral).
   * Bright enough for younger players; muted enough to avoid eye strain.
   */
  --bg: #0e1626;
  --bg-elevated: #1b2a44;
  --bg-slot: #223352;
  --bg-input: #152238;
  --border: #45628a;
  --border-strong: #6b8fb8;
  --text: #eef4fb;
  --text-muted: #a3b8d4;
  --accent: #5eb0ef;
  --accent-hover: #8ecaf8;
  --accent-soft: rgba(94, 176, 239, 0.2);
  --accent-glow: rgba(94, 176, 239, 0.28);
  --success: #5dcc9a;
  --success-bg: rgba(93, 204, 154, 0.16);
  --success-soft: rgba(93, 204, 154, 0.26);
  --warn: #e0b85c;
  --danger: #e08a8a;
  --danger-bg: rgba(224, 138, 138, 0.16);
  --on-accent: #0c1422;
  --panel-gradient-end: #15263f;
  --howto-bg: rgba(22, 36, 58, 0.94);
  /* Soft lift + faint cool rim — depth without neon stickers */
  --shadow:
    0 4px 16px rgba(4, 10, 22, 0.45),
    0 0 0 1px rgba(120, 170, 230, 0.08);
  --shadow-soft: 0 2px 8px rgba(4, 10, 22, 0.35);
  --caret: #9ad4ff;
  --radius: 18px;
  --radius-sm: 12px;
  --font: "Segoe UI", system-ui, sans-serif;
  --mono: "Cascadia Code", "Consolas", "Courier New", monospace;
  --topbar-bg: rgba(14, 22, 38, 0.92);
  --blob-a: rgba(70, 150, 230, 0.16);
  --blob-b: rgba(80, 200, 180, 0.1);
  --blob-c: rgba(230, 160, 100, 0.08);
  --outline: 2px solid var(--border);
  --chip-learn-bg: rgba(224, 184, 92, 0.16);
  --chip-learn-border: #e0b85c;
  --reveal-bg: linear-gradient(145deg, rgba(94, 176, 239, 0.12), rgba(93, 204, 154, 0.08));
  --reveal-border: #6b8fb8;
  --title-shine: linear-gradient(115deg, #8ecaf8 0%, #7ee0c8 48%, #f0d08a 100%);
  --star-color: rgba(200, 220, 255, 0.35);
  --card-rim: rgba(120, 180, 240, 0.35);
  --spark-coral: #f0a0a8;
  --spark-mint: #7ee0c8;
  --spark-sky: #9ad4ff;
}

/* —— theme tokens: light (sunny playground) —— */
[data-theme="light"] {
  color-scheme: light;
  --bg: #fff6e8;
  --bg-elevated: #ffffff;
  --bg-slot: #fff0d6;
  --bg-input: #ffffff;
  --border: #f0c48a;
  --border-strong: #e8a85c;
  --text: #4a2f1f;
  --text-muted: #8a6450;
  --accent: #ff6b9d;
  --accent-hover: #ff4d88;
  --accent-soft: rgba(255, 107, 157, 0.16);
  --accent-glow: rgba(255, 180, 80, 0.35);
  --success: #2db87a;
  --success-bg: rgba(45, 184, 122, 0.14);
  --success-soft: rgba(45, 184, 122, 0.22);
  --warn: #e8a020;
  --danger: #e85a6b;
  --danger-bg: rgba(232, 90, 107, 0.12);
  --on-accent: #ffffff;
  --panel-gradient-end: #ffe8c8;
  --howto-bg: rgba(255, 240, 214, 0.95);
  --shadow: 0 8px 0 rgba(240, 180, 120, 0.45), 0 14px 28px rgba(180, 100, 60, 0.12);
  --shadow-soft: 0 5px 0 rgba(240, 180, 120, 0.35);
  --caret: #ff6b9d;
  --topbar-bg: rgba(255, 246, 232, 0.92);
  --blob-a: rgba(255, 160, 200, 0.35);
  --blob-b: rgba(130, 210, 255, 0.28);
  --blob-c: rgba(255, 220, 100, 0.3);
  --outline: 3px solid var(--border);
  --chip-learn-bg: rgba(255, 220, 120, 0.45);
  --chip-learn-border: #e8a020;
  --reveal-bg: linear-gradient(160deg, #fff8ee, #ffeef6);
  --reveal-border: #f0c48a;
  --title-shine: linear-gradient(110deg, #ff6b9d 0%, #e8a020 45%, #2db87a 100%);
  --star-color: transparent;
  --card-rim: #f0c48a;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background:
    radial-gradient(ellipse 70% 45% at 15% 0%, var(--blob-a), transparent 55%),
    radial-gradient(ellipse 55% 40% at 90% 10%, var(--blob-b), transparent 50%),
    radial-gradient(ellipse 50% 35% at 50% 100%, var(--blob-c), transparent 55%),
    var(--bg);
  color: var(--text);
  line-height: 1.55;
  transition: background-color 0.25s ease, color 0.25s ease;
  position: relative;
}

/*
 * Night-sky field: soft color washes + faint stars.
 * Opacity stays low so it reads playful, not blinding.
 */
[data-theme="dark"] body,
:root:not([data-theme="light"]) body {
  background:
    radial-gradient(circle 1.5px at 10% 16%, var(--star-color), transparent 2.5px),
    radial-gradient(circle 1px at 26% 38%, var(--star-color), transparent 2px),
    radial-gradient(circle 1.5px at 74% 20%, var(--star-color), transparent 2.5px),
    radial-gradient(circle 1px at 90% 46%, var(--star-color), transparent 2px),
    radial-gradient(circle 1.5px at 48% 10%, var(--star-color), transparent 2.5px),
    radial-gradient(circle 1px at 62% 72%, var(--star-color), transparent 2px),
    radial-gradient(circle 1.5px at 16% 80%, var(--star-color), transparent 2.5px),
    radial-gradient(circle 1px at 84% 84%, var(--star-color), transparent 2px),
    radial-gradient(ellipse 70% 48% at 12% -5%, var(--blob-a), transparent 58%),
    radial-gradient(ellipse 55% 42% at 92% 8%, var(--blob-b), transparent 55%),
    radial-gradient(ellipse 50% 38% at 50% 105%, var(--blob-c), transparent 55%),
    radial-gradient(ellipse 45% 35% at 70% 55%, rgba(100, 140, 220, 0.08), transparent 60%),
    linear-gradient(180deg, #121c30 0%, #0e1626 48%, #101d32 100%);
}

[data-theme="dark"] .brand h1,
:root:not([data-theme="light"]) .brand h1 {
  background: var(--title-shine);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.35))
    drop-shadow(0 0 18px rgba(94, 176, 239, 0.22));
}

[data-theme="dark"] .brand .tag,
:root:not([data-theme="light"]) .brand .tag {
  background: linear-gradient(135deg, rgba(94, 176, 239, 0.28), rgba(126, 224, 200, 0.22));
  border-color: rgba(142, 202, 248, 0.55);
  color: #e8f6ff;
  box-shadow: 0 0 12px rgba(94, 176, 239, 0.15);
}

[data-theme="dark"] .card,
:root:not([data-theme="light"]) .card {
  background: linear-gradient(165deg, #223554 0%, #1b2a44 55%, #17253c 100%);
  border-color: var(--border);
  box-shadow:
    0 0 0 1px rgba(142, 202, 248, 0.08),
    var(--shadow);
}

[data-theme="dark"] .target-panel,
:root:not([data-theme="light"]) .target-panel {
  background:
    radial-gradient(ellipse 90% 80% at 50% 0%, rgba(94, 176, 239, 0.18), transparent 60%),
    linear-gradient(165deg, #274066 0%, #1c314f 55%, #18304c 100%);
  border-color: rgba(142, 202, 248, 0.45);
  box-shadow:
    0 0 0 1px rgba(126, 224, 200, 0.08),
    0 6px 22px rgba(20, 50, 90, 0.35),
    0 0 28px rgba(94, 176, 239, 0.1);
}

[data-theme="dark"] .target-word,
:root:not([data-theme="light"]) .target-word {
  color: #f4fbff;
  background: linear-gradient(180deg, #ffffff 0%, #9ad4ff 55%, #7ee0c8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 1px 0 rgba(10, 20, 40, 0.45))
    drop-shadow(0 0 14px rgba(154, 212, 255, 0.35));
  letter-spacing: 0.02em;
}

/* Fallback if background-clip text is unsupported — still bright */
@supports not (background-clip: text) {
  [data-theme="dark"] .target-word,
  :root:not([data-theme="light"]) .target-word {
    color: #9ad4ff;
    background: none;
    filter: drop-shadow(0 0 10px rgba(154, 212, 255, 0.3));
  }
}

[data-theme="dark"] .diff-btn,
:root:not([data-theme="light"]) .diff-btn {
  background: linear-gradient(145deg, #274066, #1e3350);
  border-color: #45628a;
  box-shadow: 0 2px 0 rgba(8, 16, 30, 0.4);
}

[data-theme="dark"] .diff-btn:hover,
:root:not([data-theme="light"]) .diff-btn:hover {
  background: linear-gradient(145deg, #2f4d78, #254060);
  border-color: #5eb0ef;
  box-shadow: 0 0 16px rgba(94, 176, 239, 0.18);
}

[data-theme="dark"] .hud-pill,
:root:not([data-theme="light"]) .hud-pill {
  background: linear-gradient(145deg, #243656, #1b2a44);
  border-color: #45628a;
  box-shadow: 0 0 0 1px rgba(142, 202, 248, 0.06);
}

[data-theme="dark"] .btn-primary,
:root:not([data-theme="light"]) .btn-primary {
  background: linear-gradient(180deg, #6ab8f0 0%, #4a9ad4 100%);
  border-color: #8ecaf8;
  color: #0c1422;
  box-shadow: 0 2px 0 #2a6088, 0 0 14px rgba(94, 176, 239, 0.2);
}

[data-theme="dark"] .btn-primary:hover:not(:disabled),
:root:not([data-theme="light"]) .btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #8ecaf8 0%, #5eb0ef 100%);
}

[data-theme="dark"] .btn-secondary,
:root:not([data-theme="light"]) .btn-secondary {
  background: linear-gradient(180deg, #2a4568 0%, #223652 100%);
  border-color: #5a7aa0;
  box-shadow: 0 2px 0 rgba(8, 16, 30, 0.35);
}

[data-theme="dark"] .btn-secondary.btn-next-round,
:root:not([data-theme="light"]) .btn-secondary.btn-next-round {
  background: linear-gradient(180deg, rgba(126, 224, 200, 0.22), rgba(94, 176, 239, 0.18));
  border-color: rgba(126, 224, 200, 0.55);
  color: #e8fff8;
}

[data-theme="dark"] .slot,
:root:not([data-theme="light"]) .slot {
  background: #223352;
  border-color: #45628a;
}

[data-theme="dark"] .slot.filled,
:root:not([data-theme="light"]) .slot.filled {
  background: linear-gradient(145deg, rgba(93, 204, 154, 0.22), rgba(93, 204, 154, 0.1));
  border-color: #5dcc9a;
  box-shadow: 0 0 12px rgba(93, 204, 154, 0.16);
  color: #9aefc8;
}

[data-theme="dark"] .slot.revealed,
:root:not([data-theme="light"]) .slot.revealed {
  background: linear-gradient(145deg, rgba(224, 184, 92, 0.18), rgba(94, 176, 239, 0.08));
  border-color: #e0b85c;
  box-shadow: 0 0 10px rgba(224, 184, 92, 0.12);
}

[data-theme="dark"] .input-shell input,
:root:not([data-theme="light"]) .input-shell input {
  background: #152238;
  border-color: #45628a;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .input-shell input:focus,
:root:not([data-theme="light"]) .input-shell input:focus {
  border-color: #5eb0ef;
  box-shadow:
    0 0 0 3px rgba(94, 176, 239, 0.22),
    0 0 16px rgba(94, 176, 239, 0.12);
}

[data-theme="dark"] .progress,
:root:not([data-theme="light"]) .progress {
  background: #152238;
  border-color: #45628a;
}

[data-theme="dark"] .progress-bar,
:root:not([data-theme="light"]) .progress-bar {
  background: linear-gradient(90deg, #5eb0ef, #7ee0c8 55%, #e0b85c);
}

[data-theme="dark"] .highscore-list li,
:root:not([data-theme="light"]) .highscore-list li {
  background: linear-gradient(145deg, #243656, #1b2a44);
  border-color: #45628a;
}

[data-theme="dark"] .howto,
:root:not([data-theme="light"]) .howto {
  background: linear-gradient(160deg, rgba(35, 58, 90, 0.95), rgba(22, 36, 58, 0.92));
  border-color: #45628a;
  box-shadow: 0 0 0 1px rgba(142, 202, 248, 0.06);
}

[data-theme="dark"] .missed.reveal-panel,
:root:not([data-theme="light"]) .missed.reveal-panel {
  border-color: #5a7aa0;
  box-shadow: 0 0 14px rgba(94, 176, 239, 0.1);
}

[data-theme="dark"] .theme-toggle,
:root:not([data-theme="light"]) .theme-toggle {
  background: linear-gradient(145deg, #274066, #1e3350);
  border-color: #5a7aa0;
  box-shadow: 0 0 10px rgba(94, 176, 239, 0.08);
}

[data-theme="dark"] .results-score .big,
:root:not([data-theme="light"]) .results-score .big {
  background: var(--title-shine);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 0 12px rgba(94, 176, 239, 0.2));
}

[data-theme="dark"] .highscore-banner,
:root:not([data-theme="light"]) .highscore-banner {
  background: linear-gradient(135deg, rgba(224, 184, 92, 0.35), rgba(94, 176, 239, 0.28));
  color: #fff8e8;
  border-color: rgba(224, 184, 92, 0.65);
  box-shadow: 0 0 14px rgba(224, 184, 92, 0.15);
}

[data-theme="dark"] .hud-nav-btn,
:root:not([data-theme="light"]) .hud-nav-btn {
  background: linear-gradient(145deg, #274066, #1e3350);
  border-color: #45628a;
  color: #eef4fb;
}

[data-theme="dark"] .hud-nav-btn:hover:not(:disabled),
:root:not([data-theme="light"]) .hud-nav-btn:hover:not(:disabled) {
  border-color: #5eb0ef;
  color: #9ad4ff;
  box-shadow: 0 0 12px rgba(94, 176, 239, 0.2);
}

[data-theme="dark"] .footer a,
:root:not([data-theme="light"]) .footer a,
[data-theme="dark"] .app-footer a,
:root:not([data-theme="light"]) .app-footer a {
  color: #8ecaf8;
}

[data-theme="dark"] .footer a:hover,
:root:not([data-theme="light"]) .footer a:hover,
[data-theme="dark"] .app-footer a:hover,
:root:not([data-theme="light"]) .app-footer a:hover {
  color: #7ee0c8;
  border-bottom-color: #7ee0c8;
}

[data-theme="dark"] .blank-cell.blank-hint,
:root:not([data-theme="light"]) .blank-cell.blank-hint {
  color: #9ad4ff;
  border-bottom-color: #5eb0ef;
}

[data-theme="dark"] .feedback.ok,
:root:not([data-theme="light"]) .feedback.ok {
  color: #9aefc8;
}

[data-theme="dark"] .feedback.err,
:root:not([data-theme="light"]) .feedback.err {
  color: #f0a0a8;
}

[data-theme="dark"] .timer-low,
:root:not([data-theme="light"]) .timer-low {
  color: #e0b85c !important;
}

/* —— top bar —— */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  background: var(--topbar-bg);
  border-bottom: 3px solid var(--border);
  backdrop-filter: blur(10px);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  background: var(--bg-elevated);
  border: 3px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
}

.theme-toggle:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.theme-toggle:active {
  transform: translateY(2px);
  box-shadow: none;
}

.theme-toggle .theme-icon {
  font-size: 1.05rem;
  line-height: 1;
}

.theme-toggle .theme-label-light {
  display: none;
}

[data-theme="light"] .theme-toggle .theme-label-dark {
  display: none;
}

[data-theme="light"] .theme-toggle .theme-label-light {
  display: inline;
}

/* —— screens —— */
.screen {
  display: none;
  max-width: 760px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  animation: fadeIn 0.3s ease;
}

.screen.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* —— header / brand —— */
.brand {
  text-align: center;
  margin-bottom: 1.75rem;
}

.brand h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.9rem, 5.5vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  text-shadow: 0 3px 0 var(--border);
}

.brand p {
  margin: 0;
  color: var(--text-muted);
  font-size: 1rem;
}

.brand .tag {
  display: inline-block;
  margin-top: 0.85rem;
  padding: 0.3rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--on-accent);
  background: var(--accent);
  border: 3px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
}

/* —— cards & panels —— */
.card {
  background: var(--bg-elevated);
  border: 3px solid var(--border);
  border-radius: var(--radius);
  padding: 1.3rem 1.4rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.1rem;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
}

.card p.muted {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* —— difficulty —— */
.diff-grid {
  display: grid;
  gap: 0.85rem;
}

.diff-btn {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.15rem 1rem;
  align-items: center;
  text-align: left;
  padding: 1.05rem 1.15rem;
  border: 3px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-slot);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  box-shadow: var(--shadow-soft);
  transition: border-color 0.15s, background 0.15s, transform 0.12s, box-shadow 0.12s;
}

.diff-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-2px);
}

.diff-btn:active {
  transform: translateY(2px);
  box-shadow: none;
}

.diff-btn .diff-label {
  grid-column: 1;
  grid-row: 1;
  font-weight: 800;
  font-size: 1.1rem;
}

.diff-btn .diff-meta {
  grid-column: 1;
  grid-row: 2;
  font-size: 0.78rem;
  color: var(--accent-hover);
  font-weight: 700;
}

.diff-btn .diff-blurb {
  grid-column: 2;
  grid-row: 1 / span 2;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* —— game HUD —— */
.hud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.75rem;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.hud strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.hud-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.8rem;
  background: var(--bg-elevated);
  border: 3px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.06);
  font-weight: 600;
}

/* Round pill with outer back / forward arrows for review navigation */
.hud-round-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.hud-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 2px solid var(--border);
  border-radius: 50%;
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.06);
  transition: background 0.15s, border-color 0.15s, transform 0.12s, opacity 0.15s;
}

.hud-nav-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent-hover);
  transform: translateY(-1px);
}

.hud-nav-btn:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: none;
}

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

/* —— target word (compact so synonym board can grow) —— */
.target-panel {
  text-align: center;
  padding: 0.75rem 0.9rem 0.85rem;
  margin-bottom: 0.75rem;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.target-panel .label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 800;
  color: var(--text-muted);
  margin: 0 0 0.25rem;
}

.target-word {
  margin: 0;
  font-size: clamp(1.55rem, 5.5vw, 2.15rem);
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--accent-hover);
  text-shadow: none;
  line-height: 1.15;
}

.target-prompt {
  margin: 0.4rem 0 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

/* —— synonym blanks table (full board, roomier) —— */
.slots-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
  flex-wrap: wrap;
}

.slots-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
}

.slots-header span {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: right;
}

/* Wider cells: 2 columns default, 3 only on large screens (never 4 — keeps blanks readable) */
.slots,
.slots.slots-table {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem 0.5rem;
  margin-bottom: 1rem;
}

@media (min-width: 720px) {
  .slots.slots-table {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.slot {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.55rem;
  min-width: 0;
  padding: 0.42rem 0.5rem;
  background: var(--bg-slot);
  border: 2px dashed var(--border);
  border-radius: 12px;
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--text);
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
  overflow: hidden;
}

.slot.filled {
  border-style: solid;
  border-color: var(--success);
  background: var(--success-bg);
  color: var(--success);
  font-weight: 700;
  animation: popIn 0.28s ease;
}

.slot.revealed {
  border-style: solid;
  border-color: var(--chip-learn-border);
  background: var(--chip-learn-bg);
  color: var(--text);
  font-weight: 700;
  animation: revealPop 0.4s ease both;
}

/* List index only — plain "1." (no circle; letter-count badge keeps the pill) */
.slot .slot-n {
  flex-shrink: 0;
  min-width: 1.15rem;
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text-muted);
  background: none;
  border: none;
  border-radius: 0;
  text-align: right;
  letter-spacing: 0.01em;
}

.slot.filled .slot-n {
  color: var(--success);
  background: none;
  border: none;
}

.slot.revealed .slot-n {
  color: var(--text-muted);
  background: none;
  border: none;
}

.slot .slot-text {
  flex: 1;
  letter-spacing: 0.01em;
  min-width: 0;
  font-size: 0.88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/*
 * Letter blanks: ALWAYS one row per word (no wrap).
 * Cells can shrink slightly on long words so the pattern stays single-line.
 */
.slot-blanks {
  flex: 1;
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 0.12rem 0.16rem;
  min-width: 0;
  padding: 0.08rem 0;
  overflow: hidden;
}

.blank-cell {
  display: inline-flex;
  flex: 0 1 auto;
  align-items: center;
  justify-content: center;
  min-width: 0.72rem;
  height: 1.28rem;
  padding: 0 0.02rem;
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 700;
  font-style: normal;
  line-height: 1;
  color: var(--text-muted);
  border-bottom: 2.5px solid var(--border);
  user-select: none;
}

/* Long single words: keep one row by gently compressing letter cells */
.slot.slot-lg .blank-cell {
  min-width: 0.55rem;
  font-size: 0.78rem;
  height: 1.15rem;
}

.slot.slot-xl .blank-cell {
  min-width: 0.42rem;
  font-size: 0.68rem;
  height: 1.05rem;
  border-bottom-width: 2px;
}

.blank-cell.blank-hint {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 800;
}

.blank-gap {
  display: inline-block;
  width: 0.32rem;
  flex: 0 0 auto;
  flex-shrink: 0;
}

.blank-punct {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-width: 0.4rem;
  height: 1.28rem;
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text);
  user-select: none;
}

.slot.slot-lg .blank-punct,
.slot.slot-xl .blank-punct {
  height: 1.1rem;
  font-size: 0.75rem;
}

.slot-len {
  flex-shrink: 0;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.25rem;
  display: grid;
  place-items: center;
  font-family: var(--font);
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--text-muted);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 999px;
}

.slot-len.filled-len {
  color: var(--on-accent);
  background: var(--success);
  border-color: var(--success);
}

.slot.revealed .slot-len {
  color: var(--text);
  background: var(--warn);
  border-color: var(--chip-learn-border);
}

.slot.empty .slot-text {
  color: var(--text-muted);
  font-style: italic;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 500;
}

@keyframes popIn {
  from {
    transform: scale(0.92);
    opacity: 0.5;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes revealPop {
  0% {
    transform: scale(0.9);
    opacity: 0;
  }
  60% {
    transform: scale(1.03);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* stagger revealed slots a little */
.slot.revealed:nth-child(1) {
  animation-delay: 0.05s;
}
.slot.revealed:nth-child(2) {
  animation-delay: 0.1s;
}
.slot.revealed:nth-child(3) {
  animation-delay: 0.15s;
}
.slot.revealed:nth-child(4) {
  animation-delay: 0.2s;
}
.slot.revealed:nth-child(5) {
  animation-delay: 0.25s;
}
.slot.revealed:nth-child(6) {
  animation-delay: 0.3s;
}

/* —— input row + live caret —— */
.input-row {
  display: flex;
  gap: 0.55rem;
  margin-bottom: 0.65rem;
  align-items: stretch;
}

.input-shell {
  position: relative;
  flex: 1;
  min-width: 0;
}

.input-mirror {
  position: absolute;
  inset: 0;
  padding: 0.8rem 1.05rem;
  font: inherit;
  font-size: 1.08rem;
  white-space: pre;
  overflow: hidden;
  pointer-events: none;
  visibility: hidden;
  z-index: 0;
}

.input-mirror .mirror-before {
  white-space: pre;
}

.live-caret {
  display: none;
  position: absolute;
  top: 50%;
  left: 1rem;
  width: 3px;
  height: 1.25em;
  margin-top: -0.625em;
  background: var(--caret);
  border-radius: 2px;
  pointer-events: none;
  z-index: 2;
  animation: caretBlink 1.05s step-end infinite;
  box-shadow: 0 0 8px var(--accent-glow);
}

.input-shell.is-focused .live-caret {
  display: block;
}

.input-shell.is-focused.is-disabled .live-caret {
  display: none;
}

@keyframes caretBlink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

.input-shell input {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 0.8rem 1.05rem;
  font: inherit;
  font-size: 1.08rem;
  font-weight: 600;
  color: var(--text);
  background: var(--bg-input);
  border: 3px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  caret-color: transparent;
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.04);
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.2s;
}

.input-shell input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.input-shell input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.input-shell input::placeholder {
  color: var(--text-muted);
  font-weight: 500;
}

.input-shell.caret-fresh .live-caret {
  animation: none;
  opacity: 1;
}

/* —— buttons —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.75rem 1.2rem;
  font: inherit;
  font-weight: 800;
  font-size: 0.95rem;
  border: 3px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, opacity 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.12s;
}

.btn:active:not(:disabled) {
  transform: translateY(2px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none !important;
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--border);
  box-shadow: var(--shadow-soft);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-slot);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--shadow-soft);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--border);
  background: var(--bg-slot);
}

.btn-block {
  width: 100%;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.actions .btn {
  flex: 1;
  min-width: 6rem;
}

/* —— feedback —— */
.feedback {
  min-height: 1.45rem;
  margin: 0.4rem 0 0;
  font-size: 0.92rem;
  font-weight: 700;
}

.feedback.ok {
  color: var(--success);
}

.feedback.err {
  color: var(--danger);
}

.feedback.info {
  color: var(--warn);
}

/* —— how to play —— */
.howto {
  margin-top: 1.5rem;
  padding: 1.1rem 1.2rem;
  border: 3px solid var(--border);
  border-radius: var(--radius);
  background: var(--howto-bg);
  box-shadow: var(--shadow-soft);
}

.howto h3 {
  margin: 0 0 0.55rem;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
}

.howto ol {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.howto li {
  margin-bottom: 0.4rem;
}

/* —— results —— */
.results-score {
  text-align: center;
  padding: 1.6rem 1rem;
}

.results-score .big {
  font-size: 3.25rem;
  font-weight: 800;
  color: var(--accent-hover);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  text-shadow: 0 3px 0 var(--accent-soft);
}

.results-score .sub {
  color: var(--text-muted);
  margin-top: 0.4rem;
  font-weight: 600;
}

.results-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.results-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0;
  border-bottom: 2px dashed var(--border);
  font-size: 0.92rem;
  color: var(--text);
}

.results-list li:last-child {
  border-bottom: none;
}

.results-list .word {
  font-weight: 800;
  text-transform: capitalize;
}

.results-list .detail {
  color: var(--text-muted);
  text-align: right;
  font-size: 0.86rem;
  font-weight: 600;
}

/* —— round answer reveal —— */
.missed {
  margin-top: 0.85rem;
  padding: 1rem 1.05rem;
  background: var(--reveal-bg);
  border: 3px solid var(--reveal-border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--text-muted);
  box-shadow: var(--shadow-soft);
  animation: fadeIn 0.35s ease;
}

.missed.reveal-panel {
  background: var(--reveal-bg);
}

.missed .reveal-title {
  margin: 0 0 0.65rem;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
}

.missed .reveal-label {
  display: block;
  margin: 0.55rem 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.missed .reveal-label.found {
  color: var(--success);
}

.missed .reveal-label.learn {
  color: var(--warn);
}

.missed strong {
  color: var(--text);
}

.missed .chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.2rem;
  margin-bottom: 0.35rem;
}

.chip {
  padding: 0.28rem 0.65rem;
  background: var(--bg-slot);
  border-radius: 999px;
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  border: 2px solid var(--border);
  animation: revealPop 0.35s ease both;
}

.chip-found {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--success);
}

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

.chip:nth-child(1) {
  animation-delay: 0.05s;
}
.chip:nth-child(2) {
  animation-delay: 0.1s;
}
.chip:nth-child(3) {
  animation-delay: 0.15s;
}
.chip:nth-child(4) {
  animation-delay: 0.2s;
}
.chip:nth-child(5) {
  animation-delay: 0.25s;
}
.chip:nth-child(6) {
  animation-delay: 0.3s;
}
.chip:nth-child(7) {
  animation-delay: 0.35s;
}
.chip:nth-child(8) {
  animation-delay: 0.4s;
}

/* —— progress bar —— */
.progress {
  height: 10px;
  background: var(--bg-slot);
  border: 3px solid var(--border);
  border-radius: 999px;
  margin-bottom: 1.1rem;
  overflow: hidden;
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.05);
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.35s ease;
  width: 0%;
}

/* —— shake on wrong —— */
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-5px);
  }
  40% {
    transform: translateX(5px);
  }
  60% {
    transform: translateX(-4px);
  }
  80% {
    transform: translateX(4px);
  }
}

.shake {
  animation: shake 0.35s ease;
}

/* —— high scores —— */
.highscore-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.highscore-list li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.65rem 0.85rem;
  background: var(--bg-slot);
  border: 3px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.highscore-list .hs-diff {
  font-weight: 800;
}

.highscore-list .hs-score {
  font-weight: 700;
  color: var(--accent-hover);
  text-align: right;
}

.highscore-list .hs-score.muted-score {
  color: var(--text-muted);
  font-weight: 600;
}

.highscore-list .hs-time {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  min-width: 5.5rem;
  text-align: right;
}

.highscore-banner {
  display: inline-block;
  margin: 0 0 0.65rem;
  padding: 0.35rem 0.85rem;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--on-accent);
  background: var(--accent);
  border: 3px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
  animation: revealPop 0.4s ease;
}

.results-best {
  margin-top: 0.55rem !important;
  font-weight: 700;
}

/* low overall time warning */
.timer-low {
  color: var(--warn) !important;
}

.timer-out {
  color: var(--danger) !important;
}

/* —— footer / credits —— */
.footer {
  text-align: center;
  margin-top: 2rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.footer p {
  margin: 0.25rem 0;
}

.footer-credit strong {
  color: var(--text);
  font-weight: 800;
}

.footer a,
.app-footer a {
  color: var(--accent-hover);
  font-weight: 700;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: border-color 0.15s, color 0.15s;
}

.footer a:hover,
.app-footer a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.footer-compact {
  margin-top: 1.5rem;
  font-size: 0.8rem;
}

/* Site-wide centered credit under every screen */
.app-footer {
  text-align: center;
  margin: 1.75rem auto 1.5rem;
  padding: 0 1rem 0.5rem;
  max-width: 760px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
}

.app-footer a {
  font-weight: 800;
  letter-spacing: 0.01em;
}

.app-footer-credit {
  margin: 0;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem 0.5rem;
}

.app-footer-sep {
  opacity: 0.55;
}

.app-footer-rights {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text-muted);
}

@media (max-width: 420px) {
  .diff-btn {
    grid-template-columns: 1fr;
  }

  .diff-btn .diff-blurb {
    grid-column: 1;
    grid-row: 3;
  }

  .actions {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  .live-caret {
    animation: none;
    opacity: 1;
  }

  .screen,
  .slot.filled,
  .slot.revealed,
  .chip,
  .missed {
    animation: none;
  }

  body {
    transition: none;
  }
}
