:root {
  --bg: #0e1116;
  --bg-2: #161b22;
  --paper: #f3eee4;
  --ink: #14171c;
  --muted: #6d7380;
  --line: rgba(255, 255, 255, 0.08);
  --line-dark: #e6dfd2;
  --accent: #e23b2c;
  --accent-2: #f5c242;
  --good: #2f9e5b;
  --card: #1b212b;
  --font: "Figtree", system-ui, sans-serif;
  --display: "Bricolage Grotesque", "Figtree", sans-serif;
  --radius: 18px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--paper);
  line-height: 1.5;
  min-height: 100%;
}
a { color: inherit; }
img { max-width: 100%; }
button, input { font: inherit; }
.wrap { width: min(1120px, calc(100% - 1.5rem)); margin: 0 auto; }
.skip {
  position: absolute; left: -999px; top: 0;
  background: var(--accent); color: #fff; padding: 0.6rem 1rem;
}
.skip:focus { left: 0.5rem; top: 0.5rem; z-index: 20; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
.kicker, .eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-2);
  margin: 0 0 0.6rem;
}
h1, h2, h3 { font-family: var(--display); line-height: 1.12; letter-spacing: -0.03em; margin: 0 0 0.6rem; }
h1 { font-size: clamp(2.1rem, 5vw, 3.6rem); }

.top {
  position: sticky; top: 0; z-index: 8;
  background: rgba(14, 17, 22, 0.86);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.bar { display: flex; align-items: center; gap: 1rem; padding: 0.75rem 0; }
.brand { display: flex; gap: 0.7rem; align-items: center; text-decoration: none; }
.brand small { display: block; color: var(--muted); font-size: 0.75rem; font-weight: 500; }
.mark {
  width: 2.4rem; height: 2.4rem; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(160deg, #f4efe6, #e23b2c 55%, #1d4e89);
  color: #fff; font-weight: 800; font-family: var(--display);
  font-size: 1.1rem; padding-left: 2px; text-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.nav { display: flex; gap: 1rem; margin-left: auto; }
.nav a { text-decoration: none; font-weight: 600; font-size: 0.92rem; color: #d7dbe3; }
.nav a:hover { color: #fff; }
.clock {
  display: flex; align-items: baseline; gap: 0.35rem;
  padding: 0.35rem 0.65rem; border: 1px solid var(--line); border-radius: 999px;
  font-variant-numeric: tabular-nums; font-size: 0.85rem; color: #cfd5de;
}
.clock-tz { color: var(--accent-2); font-weight: 700; font-size: 0.7rem; }

.hero { padding: 2.4rem 0 1.2rem; }
.hero-grid { display: grid; grid-template-columns: 1.35fr 0.9fr; gap: 1.5rem; align-items: stretch; }
.lede { color: #c5cbd4; font-size: 1.12rem; max-width: 40rem; }
.lede.tight { font-size: 1rem; max-width: none; }
.hero-actions { display: flex; gap: 0.7rem; flex-wrap: wrap; margin: 1.2rem 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none; border: 0; cursor: pointer;
  padding: 0.75rem 1.15rem; border-radius: 999px; font-weight: 700;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: #fff; border: 1px solid var(--line); }
.btn-tiny { padding: 0.4rem 0.75rem; font-size: 0.85rem; background: #2a3340; color: #fff; border: 0; border-radius: 10px; cursor: pointer; font-weight: 650; }
.btn-tiny:hover { background: #354252; }
.facts { display: flex; gap: 1rem; flex-wrap: wrap; padding: 0; margin: 0; list-style: none; color: var(--muted); font-size: 0.9rem; }
.facts li { position: relative; padding-left: 0.9rem; }
.facts li::before { content: ""; position: absolute; left: 0; top: 0.5em; width: 6px; height: 6px; border-radius: 50%; background: var(--good); }

.daily-card {
  display: flex; flex-direction: column; gap: 0.7rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 22px;
  padding: 1rem; text-decoration: none; box-shadow: var(--shadow);
}
.daily-art {
  height: 120px; border-radius: 14px; display: grid; place-items: center;
  font-size: 3rem; font-family: var(--display);
  position: relative; overflow: hidden;
}
.daily-card h2 { font-size: 1.45rem; }
.daily-card p { margin: 0; color: #b9c0ca; }
.text-link { font-weight: 700; color: var(--accent-2); }

.catalog { padding: 1rem 0 3rem; }
.toolbar { display: flex; justify-content: space-between; gap: 1rem; align-items: center; flex-wrap: wrap; margin-bottom: 1.1rem; }
.filters { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.chip {
  background: transparent; color: #d5dae2; border: 1px solid var(--line);
  border-radius: 999px; padding: 0.4rem 0.8rem; cursor: pointer; font-weight: 600;
}
.chip.is-on, .chip:hover { background: #fff; color: var(--ink); border-color: #fff; }
.search input {
  width: min(260px, 100%); background: #12161d; color: #fff;
  border: 1px solid var(--line); border-radius: 999px; padding: 0.55rem 0.9rem;
}
.grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.85rem;
  align-items: start; align-content: start; grid-auto-rows: min-content;
}
.game-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; text-decoration: none; display: flex; flex-direction: column;
  transition: transform 0.15s ease, border-color 0.15s ease;
  align-self: start; height: auto; min-height: 0;
}
.game-card[hidden] { display: none; }
.game-card:hover { transform: translateY(-3px); border-color: rgba(255,255,255,0.18); }
.thumb { height: 112px; position: relative; display: grid; place-items: center; overflow: hidden; }
.thumb-icon { font-size: 2.4rem; font-family: var(--display); text-shadow: 0 8px 24px rgba(0,0,0,.35); }

/* Card previews: miniature mock-ups of each board, drawn with markup only. */
.pv {
  position: absolute; inset: 0; display: grid; place-items: center;
}
.pv > * {
  transform: scale(1.7);
  transform-origin: center;
  transition: transform 0.18s ease;
}
.game-card:hover .pv > * { transform: scale(1.82); }
.pv-b { display: grid; }
.pv-c {
  display: grid; place-items: center; position: relative;
  width: var(--s, 12px); height: var(--s, 12px);
  font-style: normal; font-weight: 800; line-height: 1;
  font-size: calc(var(--s, 12px) * 0.6);
  border-radius: 2px; background: rgba(255,255,255,.14); color: #f3eee4;
}
.pv-stack { display: grid; gap: 6px; justify-items: center; }
.pv-svg { width: 220px; max-width: none; height: 108px; filter: drop-shadow(0 6px 14px rgba(0,0,0,.35)); }

.pv-card {
  width: 34px; height: 46px; border-radius: 4px; flex: none;
  background: #f7f1e6; color: #16191f; font-size: 0.82rem; font-weight: 800;
  display: grid; place-items: center; box-shadow: 0 3px 8px rgba(0,0,0,.4);
  border: 1px solid rgba(0,0,0,.18);
}
.pv-card.red { color: #c42323; }
.pv-card.back {
  background: repeating-linear-gradient(135deg, #1d4e89 0 5px, #163a66 5px 10px);
  border-color: rgba(255,255,255,.35);
}
.pv-fan { display: flex; }
.pv-fan .pv-card + .pv-card { margin-left: -10px; }
.pv-fan .pv-card:nth-child(1) { transform: rotate(-8deg) translateY(2px); }
.pv-fan .pv-card:nth-child(2) { transform: rotate(-3deg); }
.pv-fan .pv-card:nth-child(3) { transform: rotate(3deg); }
.pv-fan .pv-card:nth-child(4) { transform: rotate(8deg) translateY(2px); }
.pv-cells .pv-slot {
  border-radius: 3px; background: rgba(0,0,0,.28); border: 1px solid rgba(255,255,255,.25);
  font-size: 0.6rem;
}
.pv-cells .pv-slot.on { background: #f7f1e6; color: #16191f; border-color: transparent; }
.pv-cells .pv-slot.on.red { color: #c42323; }

.pv-word .pv-w { border-radius: 3px; background: #2b323d; }
.pv-word .t-ok { background: #2f9e5b; }
.pv-word .t-mid { background: #c9a227; color: #16191f; }
.pv-word .t-no { background: #39404b; color: #98a0ac; }

.pv-sudoku .pv-s { background: #eef1f6; color: #7d8797; border-radius: 1px; font-size: calc(var(--s) * 0.72); }
.pv-sudoku .pv-s.on { color: #16191f; }
.pv-sudoku .br { margin-right: 2px; }
.pv-sudoku .bb { margin-bottom: 2px; }

.pv-2048 { background: #8d8371; padding: 3px; border-radius: 5px; }
.pv-2048 .pv-t { background: rgba(238,228,218,.35); border-radius: 3px; }

.pv-mines .pv-m {
  background: #4a5361; border-radius: 1px;
  box-shadow: inset 1px 1px 0 rgba(255,255,255,.35), inset -1px -1px 0 rgba(0,0,0,.35);
}
.pv-mines .pv-m.open { background: #232a34; box-shadow: none; }
.pv-mines .pv-m.f { color: #e23b2c; font-size: 0.5rem; }

.pv-drop { background: #10141b; padding: 3px; border-radius: 4px; }
.pv-drop .pv-blk { background: rgba(255,255,255,.07); border-radius: 1px; }

.pv-mahjong .pv-tile {
  background: #f4efe3; color: #16191f; border-radius: 3px;
  font-size: 0.78rem; box-shadow: 0 2px 4px rgba(0,0,0,.35);
}

.pv-xword .pv-x { background: #f7f5f0; color: #16191f; border-radius: 1px; }
.pv-xword .pv-x u { position: absolute; top: 1px; left: 2px; font-size: 5px; text-decoration: none; color: #6a707c; }

.pv-snake { background: #0f1a12; padding: 3px; border-radius: 4px; }
.pv-snake .pv-g { background: rgba(255,255,255,.06); border-radius: 1px; }
.pv-snake .body { background: #2f9e5b; }
.pv-snake .head { background: #7ae0a3; }
.pv-snake .food { background: #f5c242; border-radius: 50%; }

.pv-checkers { border-radius: 3px; overflow: hidden; box-shadow: 0 6px 16px rgba(0,0,0,.4); }
.pv-checkers .pv-ck { border-radius: 0; }
.pv-checkers .dk { background: #6b452c; }
.pv-checkers .lt { background: #e7d3b0; }
.pv-disc { width: 68%; height: 68%; border-radius: 50%; display: block; }
.pv-disc.red { background: #d2452f; box-shadow: inset 0 -2px 0 rgba(0,0,0,.3); }
.pv-disc.black { background: #23282f; box-shadow: inset 0 -2px 0 rgba(255,255,255,.15); }

.pv-four { background: #1f57b6; padding: 3px; border-radius: 5px; }
.pv-four .pv-c4 { background: #101722; border-radius: 50%; }
.pv-four .r { background: #e23b2c; }
.pv-four .y { background: #f5c242; }

.pv-memory .pv-mem {
  border-radius: 3px; font-size: 0.7rem;
  background: repeating-linear-gradient(135deg, #1d4e89 0 4px, #163a66 4px 8px);
}
.pv-memory .pv-mem.up { background: #f7f1e6; }

.pv-search .pv-ws { background: transparent; color: #cfd5de; font-size: 0.6rem; }
.pv-search .hit { background: rgba(245,194,66,.28); color: #ffe6a8; border-radius: 3px; }

.daily-art .pv > * { transform: scale(1.6); }
.daily-card:hover .pv > * { transform: scale(1.7); }
.thumb-cat {
  position: absolute; left: 0.7rem; bottom: 0.7rem;
  background: rgba(0,0,0,.4); padding: 0.15rem 0.5rem; border-radius: 999px; font-size: 0.72rem; font-weight: 700;
}
.card-body { padding: 0.65rem 0.85rem 0.7rem; display: flex; flex-direction: column; gap: 0.15rem; flex: none; }
.card-body h2 { font-size: 1.12rem; margin: 0; }
.card-body p {
  margin: 0; color: #b7bec8; font-size: 0.88rem; line-height: 1.35;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.meta { display: flex; gap: 0.5rem; align-items: center; color: var(--muted); font-size: 0.78rem; font-weight: 600; }
.tag { background: rgba(245, 194, 66, 0.15); color: var(--accent-2); padding: 0.1rem 0.45rem; border-radius: 999px; }
.empty { text-align: center; color: var(--muted); padding: 2rem; }

.why { padding: 0 0 4rem; }
.why h2 { font-size: 1.8rem; margin-bottom: 1rem; }
.why-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.why-grid article {
  background: #141922; border: 1px solid var(--line); border-radius: 16px; padding: 1.1rem 1.15rem;
}
.why-grid p { color: #b7bec8; margin: 0; }

.foot { border-top: 1px solid var(--line); padding: 2rem 0 2.5rem; color: #b7bec8; font-size: 0.92rem; }
.foot-grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 1.4rem; }
.foot a { font-weight: 650; }

.play-page { padding: 1.2rem 0 3rem; }
.crumb { color: var(--muted); font-size: 0.88rem; }
.crumb a { color: #d7dbe3; }
.play-head { display: flex; justify-content: space-between; gap: 1rem; align-items: end; margin: 0.4rem 0 1rem; }
.play-stats { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.play-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 1.1rem; align-items: start; }
.stage {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 20px;
  padding: 0.85rem; min-height: 420px;
}
.side { display: grid; gap: 0.9rem; }
.side section {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 1rem;
}
.side h2 { font-size: 1rem; }
.side p { margin: 0 0 0.5rem; color: #c5cbd4; font-size: 0.92rem; }
.more { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.55rem; }
.more a { font-weight: 700; text-decoration: none; display: flex; align-items: center; gap: 0.6rem; }
.more-pv {
  width: 54px; height: 38px; border-radius: 8px; flex: none;
  position: relative; overflow: hidden; display: grid; place-items: center;
}
.more-pv .pv > * { transform: scale(0.34); }
.more a:hover .pv > * { transform: scale(0.37); }
.more a:hover { color: var(--accent-2); }
.notfound { padding: 4rem 0; }

.hud-bar {
  display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center;
  margin-bottom: 0.7rem;
}
.stat {
  background: #12161d; border: 1px solid var(--line); border-radius: 10px;
  padding: 0.35rem 0.6rem; font-size: 0.82rem; font-weight: 650; color: #d7dbe3;
}
.game-root { min-height: 360px; }

/* Solitaire / FreeCell cards */
.cards-board { display: grid; gap: 0.55rem; user-select: none; }
.soli-top, .soli-tab { display: grid; gap: 0.4rem; }
.soli-top { grid-template-columns: repeat(7, 1fr); align-items: start; }
.soli-tab { grid-template-columns: repeat(7, 1fr); min-height: 340px; }
.pile {
  min-height: 108px; border-radius: 10px; position: relative;
  background: rgba(255,255,255,0.03); outline: 1px dashed rgba(255,255,255,0.08);
}
.pile.drop { outline: 1px solid var(--accent-2); }
.stock-pile, .waste-pile {
  border: 0; width: 100%; color: #f5c242; font-size: 1.6rem; cursor: pointer;
  display: block; padding: 0; background: rgba(255,255,255,0.03);
}
.stock-pile { min-height: 108px; }
.stock-back { pointer-events: none; position: relative !important; }
.stock-count {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-size: 0.85rem; font-weight: 800; color: #f3eee4; text-shadow: 0 1px 4px #000;
  pointer-events: none;
}
.soli-gap { min-width: 8px; background: transparent; outline: none; }
.pcard {
  width: 100%; aspect-ratio: 3/4.2; max-height: 108px;
  border: 0; border-radius: 8px; background: #f7f1e6; color: #16191f;
  box-shadow: 0 6px 14px rgba(0,0,0,.28);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 0.22rem 0.3rem; font-weight: 800; font-size: clamp(0.7rem, 1.5vw, 0.95rem);
  position: absolute; left: 0; right: 0;
  cursor: pointer;
  will-change: transform;
}
button.pcard, button.pile { appearance: none; -webkit-appearance: none; font-family: inherit; }
.pcard.red { color: #c42323; }
.pcard.back {
  background: repeating-linear-gradient(135deg, #1d4e89 0 8px, #163a66 8px 16px);
  color: transparent;
}
.pcard.sel { outline: 2px solid var(--accent-2); transform: translateY(-6px); box-shadow: 0 12px 22px rgba(0,0,0,.4); }
.pcard.is-deal { animation: card-in 0.22s ease; }
@keyframes card-in {
  from { transform: scale(0.82) rotate(-6deg); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.board-2048-wrap {
  position: relative; width: min(420px, 100%); margin: 0 auto 0.6rem;
  touch-action: none; /* swipes drive the game, not the page scroll */
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.board-2048 {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem;
  background: #1b1712; padding: 0.6rem; border-radius: 12px;
}
.t2048-bg { aspect-ratio: 1; border-radius: 8px; background: #2a241c; }
.tiles-2048 { position: absolute; inset: 0.6rem; pointer-events: none; }
.t2048 {
  position: absolute; left: 0; top: 0;
  width: calc((100% - 1.5rem) / 4);
  height: calc((100% - 1.5rem) / 4);
  border-radius: 8px;
  display: grid; place-items: center;
  font-family: var(--display); font-weight: 800;
  font-size: clamp(1.1rem, 4vw, 1.8rem); color: #f7f1e6;
  transform: translate(calc(var(--c, 0) * (100% + 0.5rem)), calc(var(--r, 0) * (100% + 0.5rem)));
  transition: transform 0.18s ease;
}
.t2048.new { animation: tile-new 0.2s ease; }
.t2048.merge { animation: tile-pop 0.2s ease; }
@keyframes tile-new {
  from { transform: translate(calc(var(--c, 0) * (100% + 0.5rem)), calc(var(--r, 0) * (100% + 0.5rem))) scale(0); }
  to { transform: translate(calc(var(--c, 0) * (100% + 0.5rem)), calc(var(--r, 0) * (100% + 0.5rem))) scale(1); }
}
@keyframes tile-pop {
  0% { transform: translate(calc(var(--c, 0) * (100% + 0.5rem)), calc(var(--r, 0) * (100% + 0.5rem))) scale(1); }
  50% { transform: translate(calc(var(--c, 0) * (100% + 0.5rem)), calc(var(--r, 0) * (100% + 0.5rem))) scale(1.12); }
  100% { transform: translate(calc(var(--c, 0) * (100% + 0.5rem)), calc(var(--r, 0) * (100% + 0.5rem))) scale(1); }
}

.mem-card { transition: transform 0.25s ease, background 0.25s ease; }
.mem-card.up { animation: card-in 0.25s ease; }

/* Word / sudoku */
.word-grid { display: grid; gap: 0.28rem; justify-content: center; margin: 0.4rem auto 0.8rem; }
.word-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.28rem; }
.cell {
  width: min(58px, 14vw); aspect-ratio: 1; border: 2px solid #3a4250; border-radius: 8px;
  display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 1.35rem;
  text-transform: uppercase;
}
.cell.t-ok { background: #2f9e5b; border-color: #2f9e5b; }
.cell.t-mid { background: #c9a227; border-color: #c9a227; color: #16191f; }
.cell.t-no { background: #3a4250; border-color: #3a4250; }
.kb { display: grid; gap: 0.35rem; }
.kb-row { display: flex; justify-content: center; gap: 0.28rem; }
.kb button {
  min-width: 28px; padding: 0.55rem 0.4rem; border: 0; border-radius: 6px;
  background: #2d3542; color: #fff; font-weight: 700; cursor: pointer; text-transform: uppercase;
}
.kb button.wide { min-width: 64px; }
.kb button.t-ok { background: #2f9e5b; }
.kb button.t-mid { background: #c9a227; color: #16191f; }
.kb button.t-no { background: #222831; color: #8b919c; }

.sudoku {
  display: grid; grid-template-columns: repeat(9, 1fr); gap: 0;
  width: min(460px, 100%); margin: 0 auto; background: #0e131a; border: 2px solid #8b93a1;
}
.s-cell {
  aspect-ratio: 1; border: 1px solid #2c3440; background: #1a212c; color: #f3eee4;
  display: grid; place-items: center; font-weight: 800; font-size: 1.15rem; cursor: pointer;
}
.s-cell:nth-child(9n+3), .s-cell:nth-child(9n+6) { border-right: 2px solid #8b93a1; }
.s-cell.box-b { border-bottom: 2px solid #8b93a1; }
.s-cell.fixed { color: #9eb0d0; cursor: default; }
.s-cell.on { background: #2a3a58; }
.s-cell.same { background: #243044; }
.s-cell.bad { color: #ff6b6b; }
.s-cell .notes { font-size: 0.48rem; font-weight: 600; color: #8b93a1; letter-spacing: 0.05em; text-align: center; line-height: 1.15; }
.numbar { display: flex; justify-content: center; gap: 0.3rem; margin-top: 0.8rem; flex-wrap: wrap; }
.numbar button, .tools button {
  width: 40px; height: 40px; border-radius: 10px; border: 0; background: #2d3542; color: #fff;
  font-weight: 800; cursor: pointer;
}
.tools { display: flex; justify-content: center; gap: 0.4rem; margin-top: 0.6rem; flex-wrap: wrap; }

.mine-grid { display: grid; gap: 2px; margin: 0 auto; width: max-content; max-width: 100%; overflow: auto; }
.mcell {
  width: 28px; height: 28px; display: grid; place-items: center; font-size: 0.8rem; font-weight: 800;
  background: #3d4654; border-radius: 4px; cursor: pointer; color: #d7dbe3;
}
.mcell.open { background: #1c222c; cursor: default; }
.mcell.mine { background: #e23b2c; }
.mcell.f { background: #c9a227; color: #16191f; }

.canvas-wrap {
  display: grid; justify-content: center;
  touch-action: none; /* swipe steers Snake; don't scroll the page */
  user-select: none; -webkit-user-select: none;
}
canvas { display: block; max-width: 100%; height: auto; border-radius: 12px; background: #0b0e13; touch-action: none; }
.ctrl { display: flex; justify-content: center; gap: 0.4rem; margin-top: 0.6rem; flex-wrap: wrap; }
.ctrl button {
  min-width: 48px; height: 44px; border: 0; border-radius: 10px; background: #2d3542; color: #fff;
  font-weight: 800; cursor: pointer;
}

.mahjong-scroll { overflow: auto; padding: 34px 4px; }
.mahjong { display: grid; gap: 4px; width: max-content; margin: 0 auto; position: relative; }
.mtile {
  width: 42px; height: 52px; border-radius: 6px; background: #f3eee4; color: #16191f;
  display: grid; place-items: center; font-size: 1.35rem; cursor: pointer; box-shadow: 0 3px 0 #c9bfae;
  appearance: none; -webkit-appearance: none; border: 0; padding: 0; font-family: inherit;
  transition: transform 0.12s ease;
}
.mtile:hover:not(.gone) { transform: translateY(-2px); }
.mtile.on { outline: 3px solid var(--accent-2); transform: translateY(-2px); }
.mtile.hint { outline: 3px solid var(--good); }
.mtile.gone { visibility: hidden; pointer-events: none; }
.mtile.bad { animation: mtile-bad 0.32s ease; }
@keyframes mtile-bad {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.mlink { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.mseg {
  position: absolute; display: block; border-radius: 3px;
  background: var(--accent-2); box-shadow: 0 0 10px rgba(245,194,66,.85);
  animation: mseg-in 0.12s ease both;
}
@keyframes mseg-in { from { opacity: 0; } to { opacity: 1; } }

.xc-wrap { width: min(720px, 100%); margin: 0 auto; }
.xword {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  width: min(360px, 100%);
  aspect-ratio: 1;
  margin: 0 auto;
  gap: 2px;
  padding: 3px;
  background: #0b0e13;
  border-radius: 8px;
  box-shadow: 0 0 0 2px #d7d0c3;
}
.xsq {
  position: relative;
  background: #fbf7ee;
  min-width: 0;
  min-height: 0;
}
.xsq.word { background: #f3e2a8; }
.xsq.on { background: #f5c242; }
.xsq.bad input { color: #b42318; }
.xnum {
  position: absolute;
  top: 2px;
  left: 4px;
  z-index: 1;
  font-size: clamp(0.55rem, 2.4vw, 0.72rem);
  font-weight: 700;
  color: #16191f;
  line-height: 1;
  pointer-events: none;
}
.xcell {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #16191f;
  text-align: center;
  font-family: var(--display), Georgia, serif;
  font-weight: 800;
  font-size: clamp(1.05rem, 6vw, 1.55rem);
  text-transform: uppercase;
  caret-color: #16191f;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  padding: 10px 0 0;
}
.xcell:focus { outline: none; }
.clues {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
  color: #d7dbe3;
  font-size: 0.92rem;
}
.clues h3 { font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-2); margin: 0 0 0.45rem; }
.clues ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.2rem; }
.clue {
  display: grid;
  grid-template-columns: 1.6rem 1fr;
  gap: 0.35rem;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 0.35rem 0.4rem;
  border-radius: 8px;
  cursor: pointer;
}
.clue b { color: var(--accent-2); font-variant-numeric: tabular-nums; }
.clue.on { background: rgba(245, 194, 66, 0.16); color: #fff; }
@media (max-width: 640px) {
  .clues { grid-template-columns: 1fr; }
}

.ck-board, .c4-board { margin: 0 auto; }
.ck-board { display: grid; grid-template-columns: repeat(8, 1fr); width: min(440px, 100%); border: 4px solid #5b4636; }
.ck-sq { aspect-ratio: 1; display: grid; place-items: center; }
.ck-sq.dark { background: #5a3a28; }
.ck-sq.light { background: #e7d3b0; }
.man { width: 72%; height: 72%; border-radius: 50%; box-shadow: inset 0 -6px 0 rgba(0,0,0,.2); }
.man.red { background: #c42323; }
.man.black { background: #222; }
.man.king::after { content: "K"; display: grid; place-items: center; height: 100%; color: gold; font-weight: 800; }
.ck-sq.hi { outline: 3px solid var(--accent-2); outline-offset: -3px; }

.c4-board { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; background: #1d4e89; padding: 10px; border-radius: 16px; width: min(420px, 100%); }
.c4-slot { aspect-ratio: 1; border-radius: 50%; background: #0e1116; cursor: pointer; }
.c4-slot.r { background: #e23b2c; }
.c4-slot.y { background: #f5c242; }

.hang-fig { font-family: ui-monospace, Consolas, monospace; white-space: pre; text-align: center; font-size: 0.95rem; color: #d7dbe3; }
.word-slots { display: flex; justify-content: center; gap: 0.35rem; flex-wrap: wrap; margin: 0.8rem 0; font-size: 1.6rem; font-weight: 800; letter-spacing: 0.12em; }
.letters { display: flex; flex-wrap: wrap; gap: 0.3rem; justify-content: center; }
.letters button { width: 36px; height: 36px; border: 0; border-radius: 8px; background: #2d3542; color: #fff; font-weight: 700; cursor: pointer; }
.letters button[disabled] { opacity: 0.35; }

.mem { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; width: min(420px, 100%); margin: 0 auto; }
.mem-card {
  aspect-ratio: 1; border-radius: 12px; background: #1d4e89; display: grid; place-items: center;
  font-size: 1.8rem; cursor: pointer; transform-style: preserve-3d;
}
.mem-card.up, .mem-card.done { background: #f7f1e6; }

.ws-grid { display: grid; gap: 2px; width: min(520px, 100%); margin: 0 auto; user-select: none; }
.ws-cell {
  aspect-ratio: 1; display: grid; place-items: center; background: #1a212c; font-weight: 800;
  font-size: clamp(0.7rem, 2.4vw, 0.95rem); cursor: pointer; border-radius: 4px;
}
.ws-cell.hi { background: #c9a227; color: #16191f; }
.ws-cell.found { background: #2f9e5b; }
.ws-list { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: center; margin-top: 0.8rem; }
.ws-list span { background: #222831; padding: 0.2rem 0.5rem; border-radius: 999px; font-size: 0.82rem; font-weight: 700; }
.ws-list span.done { text-decoration: line-through; opacity: 0.5; }

.bj { display: grid; gap: 1rem; }
.bj-row { display: flex; gap: 0.4rem; flex-wrap: wrap; min-height: 90px; }
.overlay {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(8,10,14,.72); border-radius: 12px; text-align: center; padding: 1rem;
}
.stage { position: relative; }
.toast {
  position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%);
  background: #fff; color: var(--ink); padding: 0.65rem 1rem; border-radius: 999px;
  font-weight: 700; box-shadow: var(--shadow); z-index: 30;
}

@media (max-width: 900px) {
  .hero-grid, .play-layout, .why-grid, .foot-grid, .grid { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr 1fr; }
  .nav { display: none; }
  .soli-top { grid-template-columns: repeat(4, 1fr); }
  .soli-tab { grid-template-columns: repeat(7, minmax(36px, 1fr)); }
  .play-head { flex-direction: column; align-items: start; }
}
@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }
  .clock { display: none; }
}
