/* ============================================================
   JoyWordle — Design System & Components
   ============================================================ */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
ul { list-style-position: inside; }

/* ---------- Theme tokens ---------- */
:root {
  --accent:        #7c5cff;
  --accent-2:      #22c1a6;
  --accent-fg:     #ffffff;

  --bg:            #ffffff;
  --bg-soft:       #f6f7fb;
  --bg-elev:       #ffffff;
  --fg:            #1a1a2e;
  --fg-soft:       #5c5f77;
  --border:        #d7dae4;
  --border-strong: #b3b8c9;

  --key-bg:        #dfe1e9;
  --key-fg:        #1a1a2e;

  --correct:       #6aaa64;
  --present:       #d4b53f;
  --absent:        #7c7f88;
  --tile-empty-border: #d3d6da;
  --tile-filled-border: #9aa0ad;
  --tile-fg:       #1a1a2e;
  --tile-eval-fg:  #ffffff;

  --shadow: 0 8px 30px rgba(20, 20, 40, .12);
  --shadow-sm: 0 2px 8px rgba(20, 20, 40, .08);
  --radius: 12px;
  --radius-sm: 8px;
  --header-h: 56px;
  --maxw: 1080px;
}

:root[data-theme="dark"] {
  --bg:            #121213;
  --bg-soft:       #1b1b1d;
  --bg-elev:       #1e1e20;
  --fg:            #f5f5f7;
  --fg-soft:       #a3a5ad;
  --border:        #34353a;
  --border-strong: #4a4b52;

  --key-bg:        #565861;
  --key-fg:        #ffffff;

  --correct:       #538d4e;
  --present:       #b59f3b;
  --absent:        #3a3a3c;
  --tile-empty-border: #3a3a3c;
  --tile-filled-border: #565861;
  --tile-fg:       #ffffff;

  --shadow: 0 10px 40px rgba(0, 0, 0, .5);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, .4);
}

/* High-contrast (color-blind) mode: swap green/yellow for orange/blue */
:root[data-contrast="high"] {
  --correct: #f5793a;
  --present: #85c0f9;
  --absent:  #7c7f88;
}
:root[data-theme="dark"][data-contrast="high"] {
  --correct: #f5793a;
  --present: #85c0f9;
  --absent:  #3a3a3c;
}

/* ---------- Layout primitives ---------- */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 16px; }
.stack > * + * { margin-top: 1rem; }
.muted { color: var(--fg-soft); }
.center { text-align: center; }
.hidden { display: none !important; }
.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;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  display: flex; align-items: center;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
}
.site-header .container { display: flex; align-items: center; gap: 12px; height: 100%; }
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em;
  color: var(--fg); text-decoration: none; flex-shrink: 0;
}
.brand:hover { text-decoration: none; }
.brand .logo-tiles { display: inline-flex; gap: 3px; }
.brand .logo-tiles span {
  width: 22px; height: 22px; border-radius: 5px;
  display: grid; place-items: center;
  font-size: .8rem; font-weight: 800; color: #fff;
}
.brand .logo-tiles span:nth-child(1) { background: var(--correct); }
.brand .logo-tiles span:nth-child(2) { background: var(--present); }
.brand .logo-tiles span:nth-child(3) { background: var(--accent); }

.main-nav { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.main-nav a {
  color: var(--fg); font-weight: 600; font-size: .92rem;
  padding: 8px 12px; border-radius: var(--radius-sm);
}
.main-nav a:hover { background: var(--bg-soft); text-decoration: none; }
.main-nav a.active { color: var(--accent); }
.lang-select { margin-left: 6px; padding: 6px 8px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg-elev); color: var(--fg); font-weight: 600; font-size: .85rem; cursor: pointer; }
@media (max-width: 860px) { .lang-select { margin: 8px 4px; width: calc(100% - 8px); } }

.header-actions { display: flex; align-items: center; gap: 4px; margin-left: 8px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  display: grid; place-items: center; color: var(--fg);
}
.icon-btn:hover { background: var(--bg-soft); }
.icon-btn svg { width: 22px; height: 22px; }

.nav-toggle { display: none; }

/* Mobile nav */
@media (max-width: 860px) {
  .main-nav {
    position: fixed; inset: var(--header-h) 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg-elev); border-bottom: 1px solid var(--border);
    padding: 8px; box-shadow: var(--shadow);
    transform: translateY(-120%); transition: transform .22s ease;
    max-height: calc(100dvh - var(--header-h)); overflow-y: auto;
  }
  .main-nav.open { transform: translateY(0); }
  .main-nav a { padding: 12px 14px; border-radius: var(--radius-sm); }
  .nav-toggle { display: grid; }
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 48px; padding: 32px 0;
  background: var(--bg-soft); border-top: 1px solid var(--border);
  font-size: .9rem;
}
.site-footer .cols {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 24px;
}
.site-footer h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--fg-soft); margin-bottom: 10px; }
.site-footer ul { list-style: none; }
.site-footer li { margin-bottom: 6px; }
.site-footer a { color: var(--fg); }
.site-footer .foot-brand { font-weight: 800; font-size: 1.1rem; color: var(--fg); }
.site-footer .legal { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); color: var(--fg-soft); display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 999px; font-weight: 700; font-size: .95rem;
  background: var(--bg-soft); color: var(--fg); border: 1px solid var(--border);
  transition: transform .08s ease, background .15s ease, box-shadow .15s ease;
  text-decoration: none;
}
.btn:hover { text-decoration: none; box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-fg); border-color: transparent; }
.btn-primary:hover { background: #6b49f5; }
.btn-accent { background: var(--accent-2); color: #04231e; border-color: transparent; }
.btn-lg { padding: 14px 28px; font-size: 1.05rem; }
.btn-block { display: flex; width: 100%; }

/* ---------- Game area ---------- */
.game-wrap {
  display: flex; flex-direction: column; align-items: center;
  min-height: calc(100dvh - var(--header-h));
  padding: 4px 8px 8px;
}
.game-toolbar {
  width: 100%; max-width: 500px; display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 6px 4px; flex-wrap: wrap;
}
.game-title { font-weight: 800; font-size: 1.05rem; }
.game-sub { color: var(--fg-soft); font-size: .82rem; }
.toolbar-group { display: flex; gap: 6px; align-items: center; }

.length-select, .chip-select {
  padding: 7px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg-elev); color: var(--fg); font-weight: 700; font-size: .85rem;
}

/* Daily / Practice segmented toggle */
.seg-toggle { display: inline-flex; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 999px; padding: 3px; gap: 2px; }
.seg-toggle button { padding: 6px 13px; border-radius: 999px; font-weight: 700; font-size: .82rem; color: var(--fg-soft); white-space: nowrap; }
.seg-toggle button.active { background: var(--accent); color: #fff; }
.seg-toggle button:not(.active):hover { color: var(--fg); }

/* Boards area (supports 1..N boards) */
.boards {
  flex: 1; width: 100%;
  display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; align-content: flex-start;
  padding: 10px 0; overflow-y: auto;
}
.board {
  display: grid; gap: 5px; justify-content: center;
}
.board.done-win { outline: none; }
.board-row { display: grid; grid-auto-flow: column; gap: 5px; justify-content: center; }

.tile {
  width: var(--tile, 58px); height: var(--tile, 58px);
  display: grid; place-items: center;
  font-size: calc(var(--tile, 58px) * .5); font-weight: 800; text-transform: uppercase;
  border: 2px solid var(--tile-empty-border); color: var(--tile-fg);
  user-select: none; line-height: 1;
}
.tile.filled { border-color: var(--tile-filled-border); animation: pop .1s ease; }
.tile.correct { background: var(--correct); border-color: var(--correct); color: var(--tile-eval-fg); }
.tile.present { background: var(--present); border-color: var(--present); color: var(--tile-eval-fg); }
.tile.absent  { background: var(--absent);  border-color: var(--absent);  color: var(--tile-eval-fg); }
.tile.reveal { animation: flip .5s ease forwards; }
.board.shake .board-row.current { animation: shake .5s; }
.board.win .board-row.winrow .tile { animation: bounce .9s; }

@keyframes pop { from { transform: scale(.9); } to { transform: scale(1); } }
@keyframes flip {
  0% { transform: rotateX(0); }
  50% { transform: rotateX(-90deg); }
  100% { transform: rotateX(0); }
}
@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}
@keyframes bounce {
  0%,20% { transform: translateY(0); }
  40% { transform: translateY(-24px); }
  50% { transform: translateY(4px); }
  60% { transform: translateY(-12px); }
  80% { transform: translateY(2px); }
  100% { transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .tile.reveal, .board.win .board-row.winrow .tile, .board.shake .board-row.current, .tile.filled { animation: none !important; }
}

/* Multi-board scaling: smaller tiles when many boards */
.boards[data-boards="1"] { --tile: 58px; }
.boards[data-boards="2"] { --tile: 44px; }
.boards[data-boards="4"] { --tile: 32px; }
.boards[data-boards="8"] { --tile: 26px; }
.boards[data-boards="16"] { --tile: 20px; }
.boards[data-boards="2"] .board, .boards[data-boards="4"] .board,
.boards[data-boards="8"] .board, .boards[data-boards="16"] .board { gap: 3px; }
.boards[data-boards="2"] .board-row, .boards[data-boards="4"] .board-row,
.boards[data-boards="8"] .board-row, .boards[data-boards="16"] .board-row { gap: 3px; }

.board .mini-label {
  grid-column: 1 / -1; text-align: center; font-size: .7rem; font-weight: 700;
  color: var(--fg-soft); margin-bottom: 2px; min-height: 1em;
}
.board.solved .mini-label { color: var(--correct); }

/* Message toast */
.toast-host {
  position: fixed; top: calc(var(--header-h) + 10px); left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none;
}
.toast {
  background: var(--fg); color: var(--bg); padding: 12px 18px; border-radius: var(--radius-sm);
  font-weight: 700; box-shadow: var(--shadow); animation: toastIn .2s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* Inline "type a word, press Enter" hint (until first guess) */
.play-hint {
  text-align: center; font-size: .9rem; color: var(--fg-soft);
  margin: 6px auto 0; padding: 7px 16px; border-radius: 999px;
  background: var(--bg-soft); border: 1px solid var(--border);
  animation: hintPulse 2.4s ease-in-out infinite; max-width: 92%;
}
.play-hint strong { color: var(--accent); white-space: nowrap; }
@keyframes hintPulse { 0%, 100% { opacity: .72; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .play-hint { animation: none; } }

/* Hint button badge + revealed-letter strip */
.hint-btn { position: relative; }
.hint-badge {
  position: absolute; top: 1px; right: 1px; min-width: 15px; height: 15px; padding: 0 3px;
  border-radius: 999px; background: var(--accent); color: #fff; font-size: .58rem; font-weight: 800;
  display: grid; place-items: center; line-height: 1;
}
.hint-strip { display: flex; gap: 5px; align-items: center; justify-content: center; margin: 8px auto 0; }
.hint-strip .hint-ico { font-size: 1.05rem; margin-right: 2px; }
.hint-cell {
  width: 26px; height: 30px; display: grid; place-items: center; border-radius: 5px;
  font-weight: 800; text-transform: uppercase; background: var(--correct); color: #fff; font-size: .95rem;
}
.hint-cell.empty { background: transparent; border: 2px dashed var(--border-strong); }

/* Rewarded-ad overlay (demo placeholder; swap in a real network) */
.ad-overlay { position: fixed; inset: 0; z-index: 400; background: rgba(0,0,0,.78); display: grid; place-items: center; padding: 16px; animation: fade .15s ease; }
.ad-box { background: var(--bg-elev); color: var(--fg); width: 100%; max-width: 420px; border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px; text-align: center; animation: modalIn .2s ease; }
.ad-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--fg-soft); }
.ad-countdown { font-size: 1.6rem; font-weight: 800; margin: 14px 0 12px; letter-spacing: -.01em; }
.ad-bar { height: 8px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; }
.ad-bar-fill { height: 100%; width: 0; background: var(--accent); transition: width 1s linear; }
.ad-note { font-size: .74rem; color: var(--fg-soft); margin: 14px 0 16px; }
.ad-skip { padding: 11px 22px; border-radius: 999px; background: var(--bg-soft); border: 1px solid var(--border); font-weight: 700; }
.ad-skip.btn-reward { background: var(--accent); color: #fff; border-color: transparent; }

/* ---------- Keyboard ---------- */
.keyboard { width: 100%; max-width: 500px; margin: 8px auto 0; display: flex; flex-direction: column; gap: 6px; }
.kb-row { display: flex; gap: 5px; justify-content: center; touch-action: manipulation; }
.key {
  flex: 1; min-width: 0; height: 54px; border-radius: 6px;
  background: var(--key-bg); color: var(--key-fg);
  font-weight: 700; font-size: .95rem; text-transform: uppercase;
  display: grid; place-items: center;
  transition: transform .05s ease, background .15s ease, filter .15s;
}
.key:active { transform: scale(.94); }
.key.wide { flex: 1.5; font-size: .72rem; }
.key svg { width: 22px; height: 22px; }
.key.correct { background: var(--correct); color: var(--tile-eval-fg); }
.key.present { background: var(--present); color: var(--tile-eval-fg); }
.key.absent  { background: var(--absent);  color: var(--tile-eval-fg); }
.kb-spacer { flex: .5; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,.55);
  display: grid; place-items: center; padding: 16px;
  animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-elev); color: var(--fg);
  width: 100%; max-width: 480px; max-height: 90dvh; overflow-y: auto;
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px;
  animation: modalIn .2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.modal h2 { font-size: 1.4rem; letter-spacing: -.01em; }
.modal .modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.modal .close-btn { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.modal .close-btn:hover { background: var(--bg-soft); }
.modal h3 { margin-top: 18px; font-size: 1rem; }
.modal p, .modal li { font-size: .95rem; }
.modal ul { padding-left: 18px; list-style-position: outside; }
.modal hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* Example tiles inside help modal */
.eg-row { display: flex; gap: 4px; margin: 6px 0; }
.eg-tile {
  width: 34px; height: 34px; display: grid; place-items: center;
  font-weight: 800; text-transform: uppercase; border: 2px solid var(--tile-empty-border);
  border-radius: 3px; font-size: .95rem;
}
.eg-tile.correct { background: var(--correct); border-color: var(--correct); color: #fff; }
.eg-tile.present { background: var(--present); border-color: var(--present); color: #fff; }
.eg-tile.absent  { background: var(--absent);  border-color: var(--absent);  color: #fff; }

/* Stats */
.stats-grid { display: flex; justify-content: space-around; text-align: center; margin: 8px 0 4px; }
.stats-grid .num { font-size: 2rem; font-weight: 800; }
.stats-grid .lbl { font-size: .72rem; color: var(--fg-soft); }
.dist { margin: 12px 0; }
.dist-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: .85rem; }
.dist-row .g { width: 12px; font-weight: 700; }
.dist-bar { background: var(--absent); color: #fff; padding: 2px 8px; border-radius: 3px; font-weight: 700; text-align: right; min-width: 24px; }
.dist-bar.hi { background: var(--correct); }

/* Settings rows */
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.setting-row:last-child { border-bottom: none; }
.setting-row .txt strong { display: block; font-size: .98rem; }
.setting-row .txt small { color: var(--fg-soft); }
.switch { position: relative; width: 48px; height: 28px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .track { position: absolute; inset: 0; background: var(--border-strong); border-radius: 999px; transition: background .15s; }
.switch .thumb { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked ~ .track { background: var(--correct); }
.switch input:checked ~ .thumb { transform: translateX(20px); }

.share-actions { display: flex; gap: 10px; margin-top: 16px; }

/* Win confetti overlay */
.fx-confetti { position: fixed; inset: 0; z-index: 500; pointer-events: none; }

/* Daily calendar reminder links */
.reminder-row { display: flex; gap: 8px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.reminder-link { padding: 7px 14px; border-radius: 999px; background: var(--bg-soft); border: 1px solid var(--border); color: var(--fg); font-weight: 600; font-size: .82rem; }
.reminder-link:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* "Keep playing" more-games chips in the results modal */
.more-play { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.more-chip { padding: 6px 12px; border-radius: 999px; background: var(--bg-soft); border: 1px solid var(--border); color: var(--fg); font-weight: 600; font-size: .82rem; }
.more-chip:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* Social share buttons */
.social-label { text-align: center; font-size: .72rem; color: var(--fg-soft); margin: 16px 0 10px; text-transform: uppercase; letter-spacing: .08em; }
.social-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.social-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: #fff; transition: transform .1s ease, filter .15s ease; }
.social-btn:hover { transform: translateY(-2px); filter: brightness(1.08); }
.social-btn:active { transform: translateY(0); }
.social-btn svg { width: 21px; height: 21px; }
.s-x { background: #000; }
:root[data-theme="dark"] .s-x { background: #fff; color: #000; }
.s-facebook { background: #1877F2; }
.s-whatsapp { background: #25D366; }
.s-telegram { background: #229ED9; }
.s-reddit { background: #FF4500; }
.s-discord { background: #5865F2; }
.s-instagram { background: #E1306C; background-image: linear-gradient(45deg, #F58529, #DD2A7B, #8134AF, #515BD4); }

/* ---------- Content pages ---------- */
.page { padding: 24px 0 8px; }
.hero {
  text-align: center; padding: 40px 0 20px;
}
.hero h1 { font-size: clamp(2rem, 6vw, 3.2rem); letter-spacing: -.03em; line-height: 1.05; }
.hero p.lead { font-size: 1.15rem; color: var(--fg-soft); max-width: 640px; margin: 14px auto 0; }
.hero .cta-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 24px; }

.prose { max-width: 760px; margin-inline: auto; }
.prose h2 { margin-top: 32px; font-size: 1.5rem; letter-spacing: -.01em; }
.prose h3 { margin-top: 22px; font-size: 1.15rem; }
.prose p, .prose li { margin-top: 12px; font-size: 1.02rem; }
.prose ul, .prose ol { margin-top: 12px; padding-left: 22px; }
.prose a { font-weight: 600; }

/* Card grid (game hub) */
.section-head { text-align: center; margin: 40px 0 20px; }
.section-head h2 { font-size: 1.8rem; letter-spacing: -.02em; }
.section-head p { color: var(--fg-soft); margin-top: 6px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.game-card {
  display: flex; flex-direction: column; gap: 6px;
  padding: 20px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--bg-elev); color: var(--fg); text-decoration: none;
  transition: transform .12s ease, box-shadow .15s ease, border-color .15s;
  position: relative; overflow: hidden;
}
.game-card:hover { text-decoration: none; transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--accent); }
.game-card .emoji { font-size: 1.8rem; }
.game-card h3 { font-size: 1.1rem; }
.game-card p { font-size: .86rem; color: var(--fg-soft); }
.game-card .tag { position: absolute; top: 12px; right: 12px; font-size: .65rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; padding: 3px 8px; border-radius: 999px; background: var(--accent); color: #fff; }
.game-card .tag.hot { background: #ff5c7a; }
.game-card .tag.new { background: var(--accent-2); color: #04231e; }

/* Feature strip */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px,1fr)); gap: 20px; margin-top: 24px; }
.feature { padding: 22px; border-radius: var(--radius); background: var(--bg-soft); }
.feature .emoji { font-size: 1.6rem; }
.feature h3 { margin-top: 8px; font-size: 1.1rem; }
.feature p { margin-top: 6px; color: var(--fg-soft); font-size: .92rem; }

/* FAQ */
details.faq { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px 16px; margin-top: 10px; background: var(--bg-elev); }
details.faq summary { cursor: pointer; font-weight: 700; padding: 12px 0; list-style: none; display: flex; justify-content: space-between; align-items: center; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: "+"; font-size: 1.4rem; color: var(--fg-soft); font-weight: 400; }
details.faq[open] summary::after { content: "\2212"; }
details.faq p { padding-bottom: 14px; }

/* Solver */
.solver-wrap { max-width: 560px; margin-inline: auto; }
.solver-controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: center; margin-bottom: 12px; }
.solver-hint { text-align: center; color: var(--fg-soft); font-size: .9rem; margin-bottom: 12px; }
.solver-suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.solver-suggestions button {
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg-elev); font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
}
.solver-suggestions button:hover { border-color: var(--accent); color: var(--accent); }
.solver-count { text-align: center; margin-top: 10px; color: var(--fg-soft); font-size: .9rem; }
.solver-tile-hint { text-align:center; font-size:.8rem; color:var(--fg-soft); margin-top:6px; }

/* Leaderboard */
.lb-banner { background: color-mix(in srgb, var(--present) 18%, var(--bg-elev)); border: 1px solid var(--present); border-radius: var(--radius-sm); padding: 10px 14px; font-size: .86rem; margin-bottom: 16px; }
.lb-banner a { font-weight: 700; }
.lb-identity { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.lb-join { display: flex; gap: 8px; margin-top: 12px; }
.lb-input { flex: 1; padding: 10px 14px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--bg-elev); color: var(--fg); font-weight: 600; }
.lb-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.lb-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.lb-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.lb-table th, .lb-table td { padding: 11px 12px; text-align: left; white-space: nowrap; }
.lb-table th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--fg-soft); background: var(--bg-soft); position: sticky; top: 0; }
.lb-table tbody tr { border-top: 1px solid var(--border); }
.lb-table td.lb-rank { font-weight: 800; color: var(--fg-soft); width: 44px; text-align: center; }
.lb-table td.lb-medal { font-size: 1.15rem; }
.lb-table td.lb-name { font-weight: 700; width: 99%; }
.lb-table td.lb-pts { font-weight: 800; }
.lb-table tr.lb-me { background: color-mix(in srgb, var(--accent) 14%, var(--bg-elev)); }
.lb-table tr.lb-me td { border-top-color: var(--accent); }
.lb-you { display: inline-block; margin-left: 8px; font-size: .6rem; font-weight: 800; letter-spacing: .05em; background: var(--accent); color: #fff; padding: 2px 6px; border-radius: 999px; vertical-align: middle; }
.lb-link { display: block; text-align: center; margin-top: 14px; font-weight: 700; }

/* Breadcrumb */
.breadcrumb { font-size: .82rem; color: var(--fg-soft); padding: 12px 0 0; }
.breadcrumb a { color: var(--fg-soft); }

/* Cookie consent banner (only shown for cookie-based analytics) */
.consent-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 260;
  background: var(--bg-elev); border-top: 1px solid var(--border);
  box-shadow: 0 -6px 24px rgba(0,0,0,.14); padding: 14px 16px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
  animation: consentIn .25s ease;
}
@keyframes consentIn { from { transform: translateY(100%); } to { transform: none; } }
.consent-inner { max-width: var(--maxw); margin-inline: auto; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.consent-inner p { flex: 1 1 260px; font-size: .9rem; margin: 0; }
.consent-actions { display: flex; gap: 8px; }
.consent-actions .btn { padding: 9px 18px; }
.consent-link { font-size: .82rem; white-space: nowrap; }
@media (max-width: 540px) {
  .consent-actions { flex: 1 1 100%; order: 3; }
  .consent-actions .btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { .consent-bar { animation: none; } }

/* Utility */
.divider { height: 1px; background: var(--border); margin: 32px 0; border: none; }
.pill-links { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 16px; }
.pill-links a { padding: 7px 14px; border-radius: 999px; background: var(--bg-soft); color: var(--fg); font-weight: 600; font-size: .85rem; border: 1px solid var(--border); }
.pill-links a:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }

/* Small screens: tighten game */
@media (max-width: 500px) {
  .boards[data-boards="1"] { --tile: min(58px, 14vw); }
  .key { height: 48px; font-size: .9rem; }
  .keyboard, .game-toolbar { max-width: 100%; }
}
@media (max-height: 720px) {
  .boards[data-boards="1"] { --tile: 50px; }
  .key { height: 46px; }
}
