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

html { background: #3B520C; }

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: transparent;
  color: #f0ede6;
}

/* ── Full-page background canvas ── */
#bg-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: -1;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* ── Puzzle grid — fixed over canvas, shown only during game ── */
#grid {
  display: none;
  position: fixed;
  gap: 0;
  z-index: 1;
}

/* ── App shell ── */
#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

/* ── Screens ── */
.screen { display: none; flex-direction: column; flex: 1; overflow: hidden; }
.screen.active { display: flex; }

/* ─────────────────────────────────────────────
   HERO BANNER
───────────────────────────────────────────── */
#hero {
  display: grid;
  grid-template-columns: minmax(52px, 1fr) auto minmax(52px, 1fr);
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  position: relative;
  /* Layered glass: gradient + blur + inner highlight */
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.62) 0%,
    rgba(0, 0, 0, 0.44) 100%
  );
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  /* Top inner highlight + bottom border */
  box-shadow:
    inset 0 1px 0 #3B520C,
    0 1px 0 rgba(255, 255, 255, 0.07),
    0 4px 24px rgba(0, 0, 0, 0.35);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
  z-index: 100;
  transition: padding 0.18s ease;
}

.hero-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.wordmark {
  font-family: 'Jersey 25', sans-serif;
  font-size: 2.6rem;
  color: #f0e4a8;
  letter-spacing: 0.08em;
  line-height: 1;
  /* Warm glow + depth shadow */
  text-shadow:
    0 0 30px rgba(240, 210, 80, 0.28),
    0 0 8px  rgba(240, 210, 80, 0.15),
    0 2px 6px rgba(0, 0, 0, 0.55);
  transition: font-size 0.18s ease;
  white-space: nowrap;
}

/* Compact hero when in game */
#hero.hero--compact { padding: 8px 14px; }
#hero.hero--compact .wordmark { font-size: 1.15rem; letter-spacing: 0.06em; }

#game-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
}
#game-title {
  color: #e8d9a0;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
#game-difficulty {
  color: rgba(255,255,255,0.4);
  text-transform: capitalize;
  font-size: 0.68rem;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 4px;
  padding: 1px 6px;
  letter-spacing: 0.1em;
}
#game-difficulty:empty {visibility:hidden;}

.hero-actions {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

/* Styled icon buttons */
.icon-btn {
  position: relative;   /* anchors the .notif-dot pip */
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  cursor: pointer;
  width: 32px;
  height: 32px;
  padding: 0;
  color: #e8d9a0;
  border-radius: 8px;
  line-height: 0;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 1px 3px rgba(0, 0, 0, 0.3);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.icon-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.24);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    0 2px 6px rgba(0, 0, 0, 0.35);
}
.icon-btn:active {
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Compact hero (game screen): row layout, bigger than the old stacked 20px buttons */
.hero--compact .hero-actions { flex-direction: row; gap: 6px; }
.hero--compact .icon-btn { width: 28px; height: 28px; }
.hero--compact .icon-btn svg { width: 16px; height: 16px; }

/* Game-only hero elements */
.hero-game-only { display: none; }
#app[data-screen="game"] .hero-game-only { display: inline-flex; align-items: center; }
#app[data-screen="game"] div.hero-game-only { display: flex; }

/* Back button always occupies the first grid column so the wordmark stays centred.
   Hidden on home screen via visibility (not display:none, which removes it from flow). */
#btn-back {
  justify-self: start;
  display: inline-flex !important;
  visibility: hidden;
  pointer-events: none;
}
#app[data-screen="game"] #btn-back {
  visibility: visible;
  pointer-events: auto;
}

/* ─────────────────────────────────────────────
   HOME SCREEN
───────────────────────────────────────────── */
#screen-home {
  padding: 0 16px calc(2 * 48px);
  gap: 10px;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  justify-content: flex-end;
}

#home-date {
  font-size: 0.7rem;
  color: rgba(240, 217, 160, 0.65);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
#app[data-screen="game"] #home-date { display: none; }

#puzzle-tiles {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.puzzle-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 16px 20px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  cursor: pointer;
  background: rgba(10, 22, 6, 0.68);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
  transition: background 0.15s, border-color 0.15s;
}
.puzzle-tile:hover { background: rgba(10, 22, 6, 0.92); }
/* Empty tiles: same opacity, just muted colours */
.puzzle-tile.puzzle-tile-empty { cursor: default; pointer-events: none; }
.puzzle-tile.puzzle-tile-empty .tile-word { opacity: 0.35; }
.puzzle-tile.puzzle-tile-empty .tile-hint { opacity: 0.4; }

.puzzle-tile[data-diff="easy"]   { border-color: rgba(90,  200, 120, 0.45); }
.puzzle-tile[data-diff="medium"] { border-color: rgba(200, 180,  80, 0.45); }
.puzzle-tile[data-diff="hard"]   { border-color: rgba(220,  80,  80, 0.45); }

.tile-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}
.puzzle-tile[data-diff="easy"]   .tile-label { color: #7aca8a; }
.puzzle-tile[data-diff="medium"] .tile-label { color: #c8b870; }
.puzzle-tile[data-diff="hard"]   .tile-label { color: #f08a8a; }

.tile-word {
  font-family: 'Jersey 25', sans-serif;
  font-size: 2.2rem;
  color: #e8d9a0;
  letter-spacing: 0.04em;
  line-height: 1.1;
}

.tile-hint {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.32);
  margin-top: 2px;
}

.tile-status {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}
.puzzle-tile[data-diff="easy"]   .tile-status--started { color: #7aca8a; }
.puzzle-tile[data-diff="medium"] .tile-status--started { color: #c8b870; }
.puzzle-tile[data-diff="hard"]   .tile-status--started { color: #f08a8a; }
.tile-status--won { color: #5aaa6a; font-size: 1.1rem; }

/* ─────────────────────────────────────────────
   GAME LAYOUT
───────────────────────────────────────────── */
#game-layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

#game-area { flex: 1; }

/* ── Clue panel (mobile: bottom strip; desktop: floating card) ── */
#clue-panel {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.58) 0%,
    rgba(0, 0, 0, 0.44) 100%
  );
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

/* ── Clue panel header (theme word + difficulty) ── */
#clue-panel-header {
  display: none; /* shown on desktop via media query */
  align-items: baseline;
  gap: 10px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}
#panel-theme {
  font-family: 'Jersey 25', sans-serif;
  font-size: 1.4rem;
  color: #f0e4a8;
  letter-spacing: 0.06em;
  line-height: 1;
  text-shadow: 0 0 16px rgba(240, 210, 80, 0.2), 0 1px 4px rgba(0,0,0,0.5);
}
#panel-diff {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: rgba(255, 255, 255, 0.38);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 2px 6px;
}

/* ── Active clue bar ── */
#clue-bar {
  /* Row layout: [number + arrow] left column | [clue text] fills the rest */
  padding: 10px 14px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  background: rgba(50, 110, 230, 0.13);
}
#clue-bar-meta {
  /* Badge container: number on top, arrow below — both inside one box */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  flex-shrink: 0;
  background: rgba(200, 180, 80, 0.12);
  border: 1px solid rgba(200, 180, 80, 0.22);
  border-radius: 6px;
  padding: 5px 10px;
  min-width: 42px;
}
#clue-number {
  font-weight: 700;
  white-space: nowrap;
  color: #c8b870;
  font-size: 1.0rem;
  text-align: center;
  line-height: 1;
}
#clue-dir-bar {
  font-size: 1.45rem;
  font-weight: 700;
  flex-shrink: 0;
  line-height: 1;
}
#clue-dir-bar.dir-across { color: #5ab0e8; }
#clue-dir-bar.dir-down   { color: #6ad870; }
#clue-dir-bar.dir-up     { color: #e89850; }
#clue-dir-bar.dir-back   { color: #e870b0; }
#clue-text {
  flex: 1;
  font-size: 1.0rem;
  color: #dff0ff;
  line-height: 1.35;
}

/* ─────────────────────────────────────────────
   GRID CELLS
───────────────────────────────────────────── */
.cell {
  width: var(--cell-size);
  height: var(--cell-size);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Blocked — fully transparent */
.cell.blocked {
  background: transparent;
  cursor: default;
}

/* Path cells — white frosted glass */
.cell:not(.blocked) {
  width: calc(var(--cell-size) - 6px);
  height: calc(var(--cell-size) - 6px);
  margin: 3px;
  background: rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(2px) saturate(1.1);
  -webkit-backdrop-filter: blur(2px) saturate(1.1);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 6px;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.14),
    0 2px 6px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
  cursor: pointer;
}

/* Theme row — clear glass */
.cell.prefilled {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.1),
    0 1px 4px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* Selected word */
.cell.selected-word:not(.blocked) {
  background: rgba(160, 215, 255, 0.38);
  border-color: rgba(140, 200, 255, 0.7);
}
.cell.selected-word.prefilled {
  background: rgba(160, 215, 255, 0.28);
  border-color: rgba(140, 200, 255, 0.55);
}

/* Active cell */
.cell.active-cell {
  background: rgba(90, 170, 240, 0.52) !important;
  border-color: rgba(80, 160, 240, 0.85) !important;
  box-shadow:
    0 2px 10px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(200, 230, 255, 0.5) !important;
}

/* Direction arrow on the active (empty) cell */
.cell.active-cell::after {
  content: attr(data-dir);
  position: absolute;
  bottom: 2px;
  right: 3px;
  font-size: calc(var(--cell-size) * 0.28);
  color: rgba(20, 60, 120, 0.5);
  pointer-events: none;
  line-height: 1;
}

/* Directional nudge animations */
@keyframes arrowDown  { 0%,100% { transform: translateY(0);    } 50% { transform: translateY(3px);  } }
@keyframes arrowUp    { 0%,100% { transform: translateY(0);    } 50% { transform: translateY(-3px); } }
@keyframes arrowRight { 0%,100% { transform: translateX(0);    } 50% { transform: translateX(3px);  } }
@keyframes arrowLeft  { 0%,100% { transform: translateX(0);    } 50% { transform: translateX(-3px); } }

.cell.active-cell[data-dir-name="down"]::after   { animation: arrowDown  0.9s ease-in-out infinite; }
.cell.active-cell[data-dir-name="up"]::after     { animation: arrowUp    0.9s ease-in-out infinite; }
.cell.active-cell[data-dir-name="across"]::after { animation: arrowRight 0.9s ease-in-out infinite; }
.cell.active-cell[data-dir-name="back"]::after   { animation: arrowLeft  0.9s ease-in-out infinite; }

/* Correct */
.cell.correct,
.cell.correct.selected-word,
.cell.correct.active-cell {
  background: rgba(90, 200, 120, 0.38) !important;
  border-color: rgba(70, 185, 100, 0.65) !important;
  box-shadow:
    0 1px 6px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(180, 255, 200, 0.4) !important;
}

/* ── Cell contents ── */
.cell-letter {
  font-size: calc(var(--cell-size) * 0.5);
  font-weight: 800;
  text-transform: uppercase;
  pointer-events: none;
  user-select: none;
  line-height: 1;
  color: #1a2e0a;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.4);
}

.cell.prefilled .cell-letter {
  color: #3a2800;
}

.cell-number {
  position: absolute;
  top: 2px;
  left: 3px;
  font-size: calc(var(--cell-size) * 0.22);
  line-height: 1;
  color: rgba(20, 40, 10, 0.65);
  pointer-events: none;
  font-weight: 700;
}

/* ─────────────────────────────────────────────
   CLUE LIST
───────────────────────────────────────────── */
#clue-list-wrap {
  display: none; /* mobile: only the active clue bar is shown */
}
/* Custom scrollbar */
#clue-list-wrap::-webkit-scrollbar { width: 4px; }
#clue-list-wrap::-webkit-scrollbar-track { background: transparent; }
#clue-list-wrap::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

#clue-list { display: flex; flex-direction: column; }

.clue-item {
  font-size: 0.9rem;
  padding: 8px 18px 8px 5px;
  cursor: pointer;
  display: flex;
  gap: 8px;
  align-items: baseline;
  color: #b8ac68;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transition: background 0.12s, color 0.12s;
}
.clue-item:last-child { border-bottom: none; }
.clue-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #d4c880;
}
.clue-item.active {
  background: rgba(50, 130, 240, 0.18);
  color: #e8f4ff;
  font-weight: 600;
}
.clue-item.solved {
  color: #3a4a3c;
  text-decoration: line-through;
}

.clue-num {
  font-weight: 700;
  min-width: 20px;
  color: #c8b870;
  flex-shrink: 0;
  font-size: 0.78rem;
  text-align: right;
}
.clue-item.active .clue-num { color: #e8d580; }

/* Hard-mode theme word entry — sits at the bottom, slightly set apart */
.clue-item-theme {
  margin-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 10px;
}
.clue-item-theme .clue-num { color: #d4a84b; }

.clue-dir {
  font-size: 0.8rem;
  flex-shrink: 0;
  font-weight: 700;
}
/* Colored direction arrows */
.clue-dir.dir-across { color: #5ab0e8; }
.clue-dir.dir-down   { color: #6ad870; }
.clue-dir.dir-up     { color: #e89850; }
.clue-dir.dir-back   { color: #e870b0; }

/* ─────────────────────────────────────────────
   CUSTOM KEYBOARD (mobile)
───────────────────────────────────────────── */
#keyboard {
  display: none;
  padding: 6px 4px 10px;
  background: rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  gap: 5px;
  flex-direction: column;
  flex-shrink: 0;
}
#keyboard.visible { display: flex; }

/* Hide the on-screen keyboard only on devices with a precise pointer that can
   hover (mouse/trackpad) — these have a physical keyboard. Gating on input
   capability instead of screen width keeps the keyboard available on large
   tablets (coarse pointer, no hover), which would otherwise be unplayable. */
@media (hover: hover) and (pointer: fine) {
  #keyboard { display: none !important; }
}

.kb-row { display: flex; justify-content: center; gap: 4px; }

.kb-key {
  height: 42px;
  min-width: 30px;
  padding: 0 4px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.09);
  color: #e8d9a0;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255,255,255,0.08);
  flex: 1;
  max-width: 38px;
}
.kb-key.wide { max-width: 54px; }
.kb-key:active { background: rgba(255, 255, 255, 0.2); }

/* ─────────────────────────────────────────────
   WIN SCREEN
───────────────────────────────────────────── */
#screen-win {
  align-items: center;             /* horizontal centering of the card */
  justify-content: safe center;    /* vertically centred when it fits; when the card is
                                      taller than the space it falls back to the top
                                      (1rem below the hero via padding) instead of
                                      overflowing upward, and #screen-win scrolls. */
  overflow-y: auto;
  padding: 1rem;
}
/* Success screen borrows the stats-modal look (dark glass, per-difficulty rows). */
.win-card {
  position: relative;
  flex-shrink: 0;                  /* keep natural height so the screen scrolls, not the card */
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 420px;
  padding: 28px 24px 24px;
  background: rgba(10, 16, 26, 0.86);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border: 1px solid rgba(110, 170, 230, 0.5);
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.45);
  text-align: center;
}
/* Fade in + slide up when the screen becomes active. */
#screen-win.active .win-card {
  animation: winRise 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes winRise {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}
.win-card h2 {
  font-family: 'Jersey 25', sans-serif;
  font-size: 2.6rem;
  color: #f0e4a8;
  letter-spacing: 0.05em;
  margin: 0;
  text-shadow: 0 0 16px rgba(240, 210, 80, 0.2), 0 1px 4px rgba(0, 0, 0, 0.5);
}
#win-sub {
  font-size: 0.85rem;
  color: rgba(240, 217, 160, 0.75);
  margin-top: -8px;
}
#win-sub:empty { display: none; }
#win-badge:empty { display: none; }
#win-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}
#win-rows:empty { display: none; }
.win-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 4px;
}
#btn-play-again {
  padding: 10px 28px;
  background: transparent;
  border: 1.5px solid rgba(110, 170, 230, 0.5);
  border-radius: 100px;
  color: #dbe7f5;
  font-size: 0.95rem;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: background 0.15s, border-color 0.15s;
}
#btn-play-again:hover {
  background: rgba(110, 170, 230, 0.12);
  border-color: rgba(150, 200, 245, 0.8);
}
.win-share {
  padding: 10px 28px;
  background: rgba(110, 170, 230, 0.9);
  border: 1.5px solid rgba(150, 200, 245, 0.9);
  border-radius: 100px;
  color: #0a101a;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: background 0.15s, border-color 0.15s;
}
.win-share:hover { background: rgba(150, 200, 245, 1); }
.win-share[hidden] { display: none; }

/* Transient copy/share confirmation toast. */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translate(-50%, 16px);
  z-index: 60;
  padding: 10px 18px;
  background: rgba(10, 16, 26, 0.92);
  border: 1px solid rgba(110, 170, 230, 0.5);
  border-radius: 100px;
  color: #dbe7f5;
  font-size: 0.9rem;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
#btn-win-close {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 1.1rem;
  font-weight: 700;
  z-index: 2;
}

/* ─────────────────────────────────────────────
   BADGE REVEAL (win screen)
───────────────────────────────────────────── */
#win-badge { overflow: hidden; }
.badge-reveal {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 16px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  animation: badgeExpand 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes badgeExpand {
  from { max-height: 0;     opacity: 0; padding-top: 0; padding-bottom: 0; }
  to   { max-height: 340px; opacity: 1; }
}
/* Velvety rarity gradients — uncommon=green, rare=amber, epic=navy, legendary=purple */
.badge-reveal[data-rarity="uncommon"]  { background: radial-gradient(circle at 50% 28%, #3c8351, #123019 80%); box-shadow: inset 0 0 46px rgba(120,255,160,0.12); }
.badge-reveal[data-rarity="rare"]      { background: radial-gradient(circle at 50% 28%, #bd851d, #3a2604 80%); box-shadow: inset 0 0 46px rgba(255,200,90,0.14); }
.badge-reveal[data-rarity="epic"]      { background: radial-gradient(circle at 50% 28%, #2b569d, #081428 80%); box-shadow: inset 0 0 48px rgba(90,150,255,0.16); }
.badge-reveal[data-rarity="legendary"] { background: radial-gradient(circle at 50% 28%, #5e37a6, #170e2c 80%); box-shadow: inset 0 0 52px rgba(180,120,255,0.20); }

.badge-coin-stage { width: 138px; height: 138px; }
.badge-coin { position: relative; width: 100%; height: 100%; }
/* Coin body = a low-res canvas scaled up crisp. The spin is drawn frame-by-frame in JS
   (a foreshortened ellipse that shows its edge at the thin points), so it reads as a real
   rotation, not a squish. */
.badge-coin-px  { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
/* Name + center face foreshorten with the coin during the spin (scaleX driven in JS). */
.badge-coin-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; transform-origin: center; }
/* Name hugs the rim in a system font; the center face stays pixel-font. */
.badge-coin-name   { font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: 11px; font-weight: 700; letter-spacing: 0.4px; }
.badge-coin-date   { font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: 8px; font-weight: 700; letter-spacing: 1px; fill: rgba(255, 255, 255, 0.60);}
[data-metal="bronze"] .badge-coin-date {fill: #e6ac64;}
[data-metal="silver"] .badge-coin-date {fill: #e9edf1;}
[data-metal="gold"]   .badge-coin-date {fill: #f4d968;}
.badge-coin-center { font-family: 'Jersey 25', sans-serif; }
.badge-reveal .badge-coin-name, .badge-reveal .badge-coin-center { fill: rgba(42, 27, 8, 0.9); }
.badge-reveal[data-metal="silver"] .badge-coin-name,
.badge-reveal[data-metal="silver"] .badge-coin-center { fill: rgba(36, 44, 54, 0.9); }

.badge-rarity { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.18em; font-weight: 700; margin-top: 2px; }
.badge-reveal[data-rarity="uncommon"]  .badge-rarity { color: #9fe6b4; }
.badge-reveal[data-rarity="rare"]      .badge-rarity { color: #f4cf7e; }
.badge-reveal[data-rarity="epic"]      .badge-rarity { color: #93c2ff; }
.badge-reveal[data-rarity="legendary"] .badge-rarity { color: #cba6ff; }
/* Description in the puzzle font (Jersey). */
.badge-desc {
  font-family: 'Jersey 25', sans-serif; font-size: 1.2rem; color: #fff;
  letter-spacing: 0.03em; text-align: center; line-height: 1.15;
  text-shadow: 0 1px 6px rgba(0,0,0,0.5);
}

/* ─────────────────────────────────────────────
   STATS SCREEN
───────────────────────────────────────────── */
#screen-stats {
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.stats-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 420px;
  padding: 28px 24px 24px;
  background: rgba(10, 16, 26, 0.86);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border: 1px solid rgba(110, 170, 230, 0.5);
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.45);
}
#btn-stats-close {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 1.1rem;
  font-weight: 700;
}
.stats-card h2 {
  font-family: 'Jersey 25', sans-serif;
  font-size: 2rem;
  color: #f0e4a8;
  letter-spacing: 0.05em;
  text-shadow: 0 0 16px rgba(240, 210, 80, 0.2), 0 1px 4px rgba(0,0,0,0.5);
}
#stats-date {
  font-size: 0.7rem;
  color: rgba(240, 217, 160, 0.65);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: -12px;
}
#stats-rows {
  position:relative;
  padding:0.5rem 0 0;
  left:-1rem;
  width:calc(100% + 2rem);
}
.stats-row {
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.04);
  margin:0 0 0.5rem
}
.stats-row[data-diff="easy"]   { border-color: rgba(90,  200, 120, 0.2); }
.stats-row[data-diff="medium"] { border-color: rgba(200, 180,  80, 0.2); }
.stats-row[data-diff="hard"]   { border-color: rgba(220,  80,  80, 0.2); }

.stats-row-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.stats-diff {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}
.stats-row[data-diff="easy"]   .stats-diff { color: #7aca8a; }
.stats-row[data-diff="medium"] .stats-diff { color: #c8b870; }
.stats-row[data-diff="hard"]   .stats-diff { color: #f08a8a; }

.stats-word {
  font-family: 'Jersey 25', sans-serif;
  font-size: 1.3rem;
  color: #e8d9a0;
  letter-spacing: 0.04em;
}

.stats-row-body {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.stats-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0; /* let the grid column stay at its 1fr share instead of growing to fit long values like "Not played" */
}
.stats-stat-label {
  font-size: 0.62rem;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.stats-stat-value {
  font-size: 0.85rem;
  color: #f0ede6;
  font-weight: 600;
}

/* ─────────────────────────────────────────────
   YOUR GARDEN — player profile modal
───────────────────────────────────────────── */
#screen-profile {
  align-items: center;
  /* When the card is taller than the space, top-align it (1rem below the hero)
     and let the screen scroll — same trick as #screen-win. */
  justify-content: safe center;
  overflow-y: auto;
  padding: 1rem;
}
.profile-card {
  flex-shrink: 0;      /* keep natural height so the screen scrolls, not the card */
  gap: 12px;
}
#screen-profile.active .profile-card {
  animation: winRise 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}
#btn-profile-close {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 1.1rem;
  font-weight: 700;
  z-index: 2;
}
/* #profile-main (accordion + footer) and #profile-legal (Privacy/Terms/Credits) are
   swapped in place of one another — see showProfileMain()/showLegalPage() in game.js.
   Each needs its own flex/gap since they're no longer direct children of .profile-card. */
#profile-main, #profile-legal {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
/* The [hidden] attribute selector needs to OUTRANK the id rule above (an id beats a
   plain attribute selector on specificity), or the browser's default [hidden]{display:none}
   loses and a "hidden" panel still renders as a flex box. */
#profile-main[hidden], #profile-legal[hidden] { display: none; }
.profile-card h2 {
  font-family: 'Jersey 25', sans-serif;
  font-size: 2rem;
  color: #f0e4a8;
  letter-spacing: 0.05em;
  text-shadow: 0 0 16px rgba(240, 210, 80, 0.2), 0 1px 4px rgba(0,0,0,0.5);
  margin: 0;
}

/* ── Accordion ── */
.accordion { display: flex; flex-direction: column; }
.acc-item {padding:0.75rem 0; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.acc-item:last-child { border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
.acc-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
  color: #e8d9a0;
  font-size: 0.9rem;
  font-weight:bold;
  text-align: left;
  text-transform:uppercase;
}
.acc-title { display: inline-flex; align-items: center; gap: 8px; }
.acc-count {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #cddff0;
  background: rgba(110, 170, 230, 0.22);
  border: 1px solid rgba(110, 170, 230, 0.4);
  border-radius: 100px;
  padding: 1px 8px;
  line-height: 1.4;
}
.acc-count:empty { display: none; }
.acc-chevron {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.55);
  transition: transform 0.2s ease;
}
.acc-item.open .acc-chevron { transform: rotate(180deg); }
.acc-body { padding: 2px 2px 16px; }
.acc-item:not(.open) .acc-body { display: none; }
.acc-note {
  font-size: 0.82rem;
  line-height: 1.4;
  color: rgba(220, 231, 245, 0.85);
  margin: 1rem 0 12px;
}
.acc-note b { color: #f0e4a8; }

/* ── Achievements grid — 6 per row; tap a coin to grow it to a 2×2 cell + definition ── */
.ach-grid {
  display: grid;
  /* minmax(0,1fr) lets the tracks shrink below content width — without it iOS Safari
     keeps the coin's intrinsic width and the last column spills past the modal edge. */
  grid-template-columns: repeat(6, minmax(0, 1fr));
  /* Row flow (not dense): the expanded coin is placed explicitly (see toggleAchExpand),
     so it stays in its own row on the correct half instead of snapping to a fit. */
  grid-auto-flow: row;
  gap: 0.6rem;
  align-items: start;
  margin: 1rem 0 0;
}
.ach-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
/* Keep the .badge-reveal element (coin.js's name/date fill rules key off it) but strip
   it back to just the coin — no gradient rectangle, no border, no expand animation. */
.ach-slot .badge-reveal {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  animation: none !important;
  max-height: none !important;
  overflow: visible !important;
  width: 100%;
}
/* Rarity reads as a ring hugging the round coin, not a rectangle behind it. */
.ach-slot .badge-coin-stage {
  width: 100%;
  height: auto;
  max-width: 96px;
  aspect-ratio: 1;
  margin: 0 auto;
  border-radius: 50%;
  box-shadow: 0 0 0 2.5px var(--ring, rgba(255, 255, 255, 0.2));
}
.ach-slot .badge-reveal[data-rarity="uncommon"]  { --ring: #57c07a; }
.ach-slot .badge-reveal[data-rarity="rare"]      { --ring: #f0b43c; }
.ach-slot .badge-reveal[data-rarity="epic"]      { --ring: #5b91e6; }
.ach-slot .badge-reveal[data-rarity="legendary"] { --ring: #b07cff; }
/* Earned coins are tappable; blank slots are not. */
.ach-slot:not(.ach-blank) { cursor: pointer; }

/* Tap-to-expand: the coin blooms into a 3×3 rarity card with its definition below.
   aspect-ratio:1 makes the block a square that matches its 3-row span, so the coin +
   definition sit INSIDE it — instead of the content being taller than its rows and
   stretching the neighbouring row tracks (which is what pushed the other coins apart). */
.ach-slot.expanded {
  grid-column: span 3;
  grid-row: span 3;
  aspect-ratio: 1;
  justify-content: center;
  gap: 5px;
  padding: 8px;
  border-radius: 16px;
  overflow: hidden;
}
.ach-slot.expanded[data-rarity="uncommon"]  { background: radial-gradient(circle at 50% 30%, #3c8351, #123019 82%); }
.ach-slot.expanded[data-rarity="rare"]      { background: radial-gradient(circle at 50% 30%, #bd851d, #3a2604 82%); }
.ach-slot.expanded[data-rarity="epic"]      { background: radial-gradient(circle at 50% 30%, #2b569d, #081428 82%); }
.ach-slot.expanded[data-rarity="legendary"] { background: radial-gradient(circle at 50% 30%, #5e37a6, #170e2c 82%); }
/* Bigger coin; drop the ring since the gradient panel now carries the rarity colour.
   Sized to leave room for the rarity + definition inside the square (nothing clips). */
.ach-slot.expanded .badge-coin-stage {
  width: 67%;
  max-width: 150px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}
/* Rarity tier under the coin — just the word, tinted to match its gradient. */
.ach-rarity {
  display: none;                 /* hidden until the coin is expanded */
  font-size: 0.55rem;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  text-align: center;
}
.ach-slot.expanded .ach-rarity { display: block; }
.ach-slot[data-rarity="uncommon"]  .ach-rarity { color: #9fe6b4; }
.ach-slot[data-rarity="rare"]      .ach-rarity { color: #f4cf7e; }
.ach-slot[data-rarity="epic"]      .ach-rarity { color: #93c2ff; }
.ach-slot[data-rarity="legendary"] .ach-rarity { color: #cba6ff; }
.ach-def {
  display: none;                 /* hidden until the coin is expanded */
  font-size: 0.66rem;
  line-height: 1.25;
  color: #fff;
  text-align: center;
}
.ach-slot.expanded .ach-def { display: block; }
/* Blank slots — a centered dashed circle with the same footprint as a coin. */
.ach-blank { justify-content: flex-start; }
.ach-blank-circle {
  width: 100%;
  max-width: 96px;
  aspect-ratio: 1;
  margin: 0 auto;
  border-radius: 50%;
  border: 2px dashed rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.03);
  box-sizing: border-box;
}

/* ── Share panel ── */
.share-row { display: flex; gap: 8px; }
.share-input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  color: #e8f0fb;
  font-size: 0.82rem;
  font-family: system-ui, -apple-system, sans-serif;
}
.share-btn {
  padding: 9px 18px;
  background: #f0e4a8;                 /* font-gold */
  border: 1.5px solid #f0e4a8;
  border-radius: 8px;
  color: #1a2410;
  font-weight: 600;
  font-size:0.75rem;  text-transform:uppercase;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}
.share-btn:hover { background: #f6ecba; border-color: #f6ecba; }
.share-stats {
  margin-top: 10px;
  font-size: 0.78rem;
  color: rgba(240, 217, 160, 0.8);
}
.share-stats:empty { display: none; }
.share-stats-row {margin:1.5rem 0 0; text-align:center; display:block;}

/* ── Preferences toggles ── */
.pref-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  cursor: pointer;
}
.pref-toggle + .pref-toggle { border-top: 1px solid rgba(255, 255, 255, 0.08); }
.pref-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pref-text b { font-size: 0.9rem; color: #f0ede6; font-weight: 600; }
.pref-text small { font-size: 0.72rem; color: rgba(255, 255, 255, 0.5); line-height: 1.3; }
/* Slider switch */
.pref-toggle input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: background 0.18s;
}
.pref-toggle input[type="checkbox"]::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e8e2d2;
  transition: transform 0.18s;
}
.pref-toggle input[type="checkbox"]:checked {
  background: rgba(110, 170, 230, 0.9);
  border-color: rgba(150, 200, 245, 0.9);
}
.pref-toggle input[type="checkbox"]:checked::after { transform: translateX(18px); }

/* Breathing room between the date and the stat rows inside the modal. */
#screen-profile #stats-date { margin: 6px 0 12px; }

/* Red "new" pip on the profile icon for returning players (cleared on first open). */
.notif-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e0453a;
  box-shadow: 0 0 6px rgba(224, 69, 58, 0.75);
}
.notif-dot[hidden] { display: none; }

/* ── Shared buttons ── */
.btn {
  padding: 11px 28px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.4);
  color: #e8d9a0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.15s;
}
.btn:hover { background: rgba(0, 0, 0, 0.58); }

#copyright { padding-top: 8px;}
#copyright p {text-align:center; font-size:11px; color:#e8d9a0;}
#copyright p a {display:inline-block; margin:0 0.125rem; color:#e8d9a0; font-weight:500; cursor: pointer;}
#copyright p a:hover {color: #f6ecba;}

/* ── Legal / info pages (Privacy, Terms, Credits) ── */
.legal-back-btn {
  align-self: flex-start;
  background: none;
  border: 0;
  padding: 0;
  color: rgba(240, 217, 160, 0.75);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
}
.legal-back-btn:hover { color: #f0e4a8; }
#legal-title { font-size: 1.7rem; }
.legal-body {
  font-size: 0.82rem;
  line-height: 1.55;
  color: rgba(240, 237, 230, 0.85);
}
.legal-body p { margin: 0 0 10px; }
.legal-body ul { margin: 0 0 10px; padding-left: 1.2em; }
.legal-body p:last-child, .legal-body ul:last-child { margin-bottom: 0; }
.legal-body li { margin-bottom: 4px; }
.legal-body strong { color: #f0e4a8; font-weight: 700; }
.legal-body a { color:#e8d9a0; font-weight:500; text-decoration: underline; text-underline-offset: 2px; }
.legal-body a:hover { color: #f6ecba; }
.legal-credits { list-style: none; padding-left: 0; display: flex; flex-direction: column; gap: 10px; }
.legal-updated { font-size: 0.68rem; color: rgba(255, 255, 255, 0.4); margin-top: 2px; }

/* ─────────────────────────────────────────────
   CLUE PANEL ENTRANCE ANIMATION
───────────────────────────────────────────── */
.panel-hidden {
  opacity: 0 !important;
  pointer-events: none !important;
}

@keyframes panelReveal {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0);    }
}
.panel-reveal {
  animation: panelReveal 0.45s ease forwards;
}

/* ─────────────────────────────────────────────
   CELL LOAD ANIMATIONS
───────────────────────────────────────────── */

/* Initial hidden state — no transition so the cell is instantly invisible */
.cell.cell-enter {
  opacity: 0 !important;
  transform: translateY(8px) !important;
  transition: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Theme tile pop: spring in from below */
@keyframes cellPop {
  0%   { opacity: 0; transform: scale(0.4)  translateY(4px);  }
  60%  { opacity: 1; transform: scale(1.08) translateY(-1px); }
  100% { opacity: 1; transform: scale(1)    translateY(0);    }
}
.cell.cell-pop {
  animation: cellPop 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) forwards !important;
}

/* Glass tile reveal: keyframe so it always plays from opacity-0 regardless of prior state */
@keyframes cellReveal {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0);   }
}
.cell.cell-reveal {
  animation: cellReveal 0.4s ease forwards !important;
}

/* ─────────────────────────────────────────────
   DESKTOP TWO-COLUMN LAYOUT  (≥ 800px, mouse + keyboard)
   Gated on a precise hovering pointer so touch tablets — wide but coarse-
   pointer — fall through to the mobile single-column layout instead.
───────────────────────────────────────────── */
@media (min-width: 800px) and (hover: hover) and (pointer: fine) {
  /* Home tiles go horizontal */
  #screen-home { max-width: 860px; padding: calc(3 * 48px) 32px 24px; justify-content: flex-start; }
  #puzzle-tiles { flex-direction: row; gap: 16px; }
  .puzzle-tile { flex: 1; }
  .tile-word { font-size: 2.6rem; }
  #home-date { font-size: 0.8rem; }

  /* Game layout: grid left, floating panel right */
  #game-layout { flex-direction: row; align-items: stretch; }
  #game-area { flex: 1; }

  /* Floating glass card — top/left/bottom set by positionPanel() in JS */
  #clue-panel {
    position: fixed;
    max-width: 420px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.13);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(18px) saturate(1.3);
    -webkit-backdrop-filter: blur(18px) saturate(1.3);
    box-shadow:
      0 4px 24px rgba(0, 0, 0, 0.38),
      inset 0 1px 0 rgba(255, 255, 255, 0.08);
    border-top: 1px solid rgba(255, 255, 255, 0.13);
  }

  /* Show panel header on desktop */
  #clue-panel-header {
    display: flex;
    padding: 16px 18px 14px;
  }

  /* Active clue bar not needed on desktop — the list shows which is selected */
  #clue-bar { display: none; }

  .clue-item.active .clue-num { color: #e8d580; }

  #clue-list-wrap {
    display: block; /* restore — was hidden for mobile */
    flex: 1;
    max-height: none;
    overflow-y: auto;
    padding: 6px 0 6px;
  }


  /* Larger wordmark on desktop */
  .wordmark { font-size: 2.4rem; }
  #hero.hero--compact .wordmark { font-size: 1.2rem; }

  /* Desktop: buttons side by side, more room on each side */
  .hero-actions { flex-direction: row; gap: 6px; }
  #hero { grid-template-columns: minmax(96px, 1fr) auto minmax(96px, 1fr); }
}

/* ── Touch devices: strip backdrop-filter from grid cells ─────────────────
   On iOS Safari (iPhone AND iPad), each cell's backdrop-filter creates a GPU
   compositing layer. With ~50+ cells on screen, these layers can sit above
   position:fixed elements in the compositor's tree regardless of CSS z-index,
   blocking paint and touch on the hero until a full compositor rebuild (e.g.
   screen rotation). At 48px a 2px blur is imperceptible — safe to remove.
   Gated on coarse pointer so it covers tablets too, not just narrow phones. */
@media (pointer: coarse) {
  .cell:not(.blocked) {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  body.puzzle-loaded .cell:not(.blocked) {
    backdrop-filter: blur(2px) saturate(1.1);
    -webkit-backdrop-filter: blur(2px) saturate(1.1);
  }
}

/* ─────────────────────────────────────────────
   TABLET PORTRAIT  (large touch device, no mouse/keyboard, held upright)
   Wider than a phone (≥600px) but coarse-pointer, so it uses the mobile
   single-column layout. The phone-sized keyboard + clue bar are tiny here,
   and there's ample vertical room, so scale the on-screen keyboard up ~1.5×,
   lift it off the bottom edge, and enlarge the clue bar to match. The play
   area (fixed grid) is sized in JS from the live DOM — it re-measures the
   taller keyboard/clue panel automatically, so no grid rule is needed here.
───────────────────────────────────────────── */
@media (orientation: portrait) and (pointer: coarse) and (min-width: 600px) {
  /* Home: phone layout bottom-anchors small tiles, leaving a huge empty field
     above on a tall tablet. Centre the stack and scale the tiles up so the
     three puzzles read as the main content, not a strip at the bottom. */
  #screen-home {
    max-width: 620px;
    justify-content: center;
    gap: 16px;
    padding: 0 24px 6vh;
  }
  #home-date { font-size: 0.95rem; }
  #puzzle-tiles { gap: 16px; }
  .puzzle-tile { padding: 26px 32px; border-radius: 18px; gap: 8px; }
  .tile-label { font-size: 0.78rem; }
  .tile-word { font-size: 3rem; }
  .tile-hint { font-size: 0.9rem; }
  .tile-status { top: 14px; right: 16px; font-size: 1.35rem; }
  .tile-status--won { font-size: 1.5rem; }

  /* Keyboard scaled ~1.5× + lifted off the bottom edge for thumb reach */
  #keyboard {
    gap: 8px;
    padding: 10px 8px 6vh;
  }
  .kb-row { gap: 6px; }
  .kb-key {
    height: 63px;
    min-width: 45px;
    padding: 0 6px;
    border-radius: 7px;
    font-size: 1.3rem;
    max-width: 57px;
  }
  .kb-key.wide { max-width: 81px; }

  /* Clue panel scaled to match: roomier bar, larger clue text */
  #clue-bar { padding: 15px 20px; gap: 16px; }
  #clue-bar-meta { padding: 7px 14px; min-width: 56px; gap: 2px; }
  #clue-number { font-size: 1.3rem; }
  #clue-dir-bar { font-size: 1.9rem; }
  #clue-text { font-size: 1.3rem; }
}

/* ─────────────────────────────────────────────
   TABLET LANDSCAPE  (large touch device, no mouse/keyboard, held sideways)
   Coarse-pointer, so it falls through to the mobile single-column layout.
   Gated on the short side (min-height ≥600px) to catch tablets but not phones
   held sideways. Vertical room is tighter than portrait, so the base keyboard
   size is kept (per feedback) — it's only lifted off the bottom edge. The wide
   viewport suits a horizontal tile row for the home screen.
───────────────────────────────────────────── */
@media (orientation: landscape) and (pointer: coarse) and (min-height: 600px) {
  /* Home: use the roomy horizontal tile row (like desktop) and centre it,
     instead of the narrow bottom-anchored column the phone layout gives. */
  #screen-home {
    max-width: 900px;
    justify-content: center;
    gap: 16px;
    padding: 0 32px 5vh;
  }
  #home-date { font-size: 0.9rem; }
  #puzzle-tiles { flex-direction: row; gap: 16px; }
  .puzzle-tile { flex: 1; padding: 22px; border-radius: 16px; }
  .tile-word { font-size: 2.6rem; }
  .tile-hint { font-size: 0.82rem; }

  /* Keyboard: base size is fine here — just lift it off the bottom edge so it
     isn't jammed against the screen bottom. */
  #keyboard { padding: 8px 8px 4vh; }
}
