/* ═══════════════════════════════════════════════════════════
   Games Module — Shared + 2048-specific styles
   Extends style.css custom properties — never redefines them.
   ═══════════════════════════════════════════════════════════ */

/* ── Layout ──────────────────────────────────────────────── */
:root {
  --gh-h: 60px;
  --g2048-cell: 64px;
  --g2048-gap: 10px;
  /* 2048 board bg colours */
  --g2048-board-bg: #1a2745;
  --g2048-cell-bg: rgba(8,15,35,0.55);
}
@media (min-width: 420px)  { :root { --g2048-cell: 76px;  --g2048-gap: 11px; } }
@media (min-width: 540px)  { :root { --g2048-cell: 96px;  --g2048-gap: 12px; } }
@media (min-width: 768px)  { :root { --g2048-cell: 106px; --g2048-gap: 14px; } }

[data-theme="light"] {
  --g2048-board-bg: #c9d4e8;
  --g2048-cell-bg: rgba(180,195,225,0.6);
}

html, body { height: auto; overflow: auto; }

.games-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-deep);
}

/* ── Game Header ─────────────────────────────────────────── */
.gh {
  height: var(--gh-h);
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(6,10,18,.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
[data-theme="light"] .gh {
  background: rgba(255,255,255,.92);
  border-bottom-color: var(--border);
}
.gh-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.2rem;
  height: 100%;
  display: flex;
  align-items: center;
  gap: .8rem;
}
.gh-home {
  display: flex;
  align-items: center;
  gap: .45rem;
  text-decoration: none;
  color: var(--text-dim);
  font-size: .82rem;
  font-weight: 600;
  transition: color .2s;
  flex-shrink: 0;
}
.gh-home:hover { color: var(--accent-light); }
.gh-home svg { opacity: .7; }
.gh-divider { width: 1px; height: 18px; background: var(--border-light); flex-shrink: 0; }
.gh-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: .01em;
  flex-shrink: 0;
}
.gh-scores {
  display: flex;
  gap: .6rem;
  margin-left: auto;
}
.gh-score-pill {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .2rem .75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 58px;
}
.gh-score-label {
  font-size: .58rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: .08em;
  text-transform: uppercase;
  line-height: 1;
  margin-bottom: .1rem;
}
.gh-score-val {
  font-family: var(--font-mono);
  font-size: .9rem;
  font-weight: 700;
  color: var(--text-bright);
  line-height: 1;
}
.gh-score-val.bump {
  animation: scoreBump .25s ease;
}
@keyframes scoreBump {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.25); color: var(--accent-light); }
  100% { transform: scale(1); }
}
.gh-actions { display: flex; gap: .35rem; align-items: center; margin-left: auto; }
.gh-btn {
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-dim);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
  flex-shrink: 0;
}
.gh-btn:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border-light); }
.gh-btn-restart {
  background: var(--accent-dim);
  border-color: transparent;
  color: white;
  font-size: .78rem;
  font-weight: 700;
  width: auto;
  padding: 0 .9rem;
  letter-spacing: .03em;
}
.gh-btn-restart:hover { background: var(--accent); color: white; }
.gh-user-link {
  display: flex; align-items: center; gap: .5rem;
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: .2rem .75rem .2rem .2rem;
  transition: all .2s;
  flex-shrink: 0;
}
.gh-user-link:hover { border-color: var(--border-light); background: var(--bg-hover); }
.gh-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 700; color: white;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.1);
  flex-shrink: 0;
}
.gh-avatar img { width: 100%; height: 100%; object-fit: cover; }
/* Theme-toggle label: hidden everywhere; only shown inside open mobile dropdown */
.tt-label { display: none; }

.gh-uname {
  font-size: .8rem; font-weight: 600;
  color: var(--text-bright);
  max-width: 90px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.gh-sign-in {
  font-size: .8rem; font-weight: 600;
  color: var(--accent-light);
  text-decoration: none;
  padding: .3rem .7rem;
  border: 1px solid var(--border-accent);
  border-radius: 20px;
  transition: all .2s;
  flex-shrink: 0;
}
.gh-sign-in:hover { background: var(--accent-glow); }

/* ── Page body + content wrap ────────────────────────────── */
.games-page-body {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 110px; /* bottom ad clearance on mobile */
}
@media (min-width: 1200px) {
  .games-page-body { padding-bottom: 2rem; }
}
.games-content-wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  display: flex;
  align-items: flex-start;
  gap: 2rem;
}
.games-main { flex: 1; min-width: 0; }

/* ── Ad placeholders ─────────────────────────────────────── */
.ad-sidebar {
  width: 180px;
  flex-shrink: 0;
  display: none;
}
@media (min-width: 1200px) {
  .ad-sidebar {
    display: block;
    position: fixed;
    top: calc(var(--gh-h) + 1.5rem);
    right: 1.5rem;
    width: 180px;
    /* Never taller than the visible viewport */
    max-height: calc(100vh - var(--gh-h) - 3rem);
  }
  /* Push content left so it never hides under fixed sidebar */
  .games-content-wrap {
    padding-right: calc(180px + 2.5rem);
  }
}

/* Bottom ad: hidden by default, only shown when a real ad fills it via JS */
.ad-bottom-wrap {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 96px;
  z-index: 90;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: none; /* hidden until a real ad is injected */
  align-items: center; justify-content: center;
}
/* When sidebar ad is visible (wide screens), never show bottom bar */
@media (min-width: 1200px) { .ad-bottom-wrap { display: none !important; } }

.ad-placeholder {
  width: 100%; height: 100%;
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  font-size: .72rem;
  font-family: var(--font-mono);
  opacity: .5;
  min-height: 90px;
}
.ad-sidebar .ad-placeholder { min-height: 250px; }

/* ── Breadcrumb ──────────────────────────────────────────── */
.games-breadcrumb {
  font-size: .78rem;
  color: var(--text-dim);
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
}
.games-breadcrumb a { color: var(--text-dim); text-decoration: none; }
.games-breadcrumb a:hover { color: var(--accent-light); }
.games-breadcrumb .bc-sep { opacity: .7; }

/* ── Game footer ─────────────────────────────────────────── */
.games-footer {
  margin-top: 3rem;
  border-top: 1px solid var(--border);
  padding-top: 2.5rem;
}
.gf-section { margin-bottom: 2.5rem; }
.gf-h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 1rem;
  display: flex; align-items: center; gap: .5rem;
}
.gf-h2 svg { color: var(--accent); opacity: .8; }
.gf-steps { list-style: none; display: flex; flex-direction: column; gap: .65rem; }
.gf-steps li {
  padding: .6rem .9rem .6rem 1rem;
  background: var(--bg-surface);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.6;
}
.gf-steps li strong { color: var(--text-bright); }
.gf-faq { display: flex; flex-direction: column; gap: .5rem; }
.gf-faq-item { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.gf-faq-btn {
  width: 100%; text-align: left;
  background: var(--bg-surface);
  border: none; cursor: pointer;
  padding: .75rem 1rem;
  display: flex; justify-content: space-between; align-items: center;
  color: var(--text-bright);
  font-size: 1.05rem; font-weight: 600;
  transition: background .15s;
  font-family: var(--font-display);
  gap: 1rem;
}
.gf-faq-btn:hover { background: var(--bg-hover); }
.gf-faq-arrow { font-size: .8rem; opacity: .5; transition: transform .2s; flex-shrink: 0; }
.gf-faq-item.open .gf-faq-arrow { transform: rotate(90deg); }
.gf-faq-body {
  max-height: 0; overflow: hidden;
  transition: max-height .3s ease;
  font-size: 1.05rem;
  color: var(--text);
  line-height: 1.7;
  padding: 0 1rem;
  background: var(--bg-card);
}
.gf-faq-item.open .gf-faq-body { max-height: 300px; padding: .8rem 1rem; }
.gf-blog-block { margin-bottom: 1.4rem; }
.gf-blog-h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: .4rem;
}
.gf-blog-p {
  font-size: 1.05rem;
  color: var(--text-dim);
  line-height: 1.75;
}
.gf-links {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem .8rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: .8rem;
}
.gf-links a { color: var(--text-muted); text-decoration: none; transition: color .15s; }
.gf-links a:hover { color: var(--accent-light); }
.gf-copyright { margin-top: .6rem; font-size: .75rem; color: var(--text-dim); }

/* ═══════════════════════════════════════════════════════════
   2048 — Game-specific styles
   ═══════════════════════════════════════════════════════════ */

/* ── Board container ─────────────────────────────────────── */
.g2048-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.4rem;
  margin-bottom: 2.5rem;
}

.g2048-board {
  position: relative;
  background: var(--g2048-board-bg);
  border-radius: var(--radius-lg);
  padding: var(--g2048-gap);
  box-shadow: 0 8px 40px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.06);
  width:  calc(4 * var(--g2048-cell) + 5 * var(--g2048-gap));
  height: calc(4 * var(--g2048-cell) + 5 * var(--g2048-gap));
  flex-shrink: 0;
  touch-action: none;
  user-select: none;
}

/* Board shake when move is invalid */
@keyframes g2048Shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-6px); }
  40%      { transform: translateX(6px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(4px); }
}
.g2048-board.shake { animation: g2048Shake .35s ease; }

/* ── Background cells ────────────────────────────────────── */
.g2048-cells {
  position: absolute;
  inset: 0;
  padding: var(--g2048-gap);
  display: grid;
  grid-template-columns: repeat(4, var(--g2048-cell));
  grid-template-rows:    repeat(4, var(--g2048-cell));
  gap: var(--g2048-gap);
  pointer-events: none;
}
.g2048-cell-bg {
  background: var(--g2048-cell-bg);
  border-radius: calc(var(--radius-sm) - 2px);
}

/* ── Tile layer ──────────────────────────────────────────── */
.g2048-tiles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* ── Individual tile ─────────────────────────────────────── */
.g2048-tile {
  position: absolute;
  width:  var(--g2048-cell);
  height: var(--g2048-cell);
  top: 0; left: 0;
  will-change: transform;
}
.g2048-tile-inner {
  width: 100%; height: 100%;
  border-radius: calc(var(--radius-sm) - 2px);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: calc(var(--g2048-cell) * 0.38);
  line-height: 1;
  letter-spacing: -.02em;
  transition: background .15s, color .15s;
  position: relative;
  overflow: hidden;
}

/* ── Diagonal shine sweep on merge ──────────────────────────── */
@keyframes g2048Fuse {
  from { transform: translateX(-120%) skewX(-22deg); }
  to   { transform: translateX(280%)  skewX(-22deg); }
}
.g2048-tile-fuse .g2048-tile-inner::after {
  content: '';
  position: absolute;
  inset: 0;
  width: 55%;
  background: linear-gradient(to right,
    transparent,
    rgba(255,255,255,.22) 50%,
    transparent);
  animation: g2048Fuse .28s ease-out forwards;
  pointer-events: none;
  z-index: 1;
}
/* Font-size by digit count */
.g2048-tile[data-value="128"] .g2048-tile-inner,
.g2048-tile[data-value="256"] .g2048-tile-inner,
.g2048-tile[data-value="512"] .g2048-tile-inner
  { font-size: calc(var(--g2048-cell) * 0.30); }
.g2048-tile[data-value="1024"] .g2048-tile-inner,
.g2048-tile[data-value="2048"] .g2048-tile-inner
  { font-size: calc(var(--g2048-cell) * 0.24); }
.g2048-tile[data-value="4096"] .g2048-tile-inner,
.g2048-tile[data-value="8192"] .g2048-tile-inner
  { font-size: calc(var(--g2048-cell) * 0.21); }
.g2048-tile[data-value="16384"] .g2048-tile-inner,
.g2048-tile[data-value="32768"] .g2048-tile-inner,
.g2048-tile[data-value="65536"] .g2048-tile-inner,
.g2048-tile[data-value="131072"] .g2048-tile-inner
  { font-size: calc(var(--g2048-cell) * 0.17); }

/* Spawn animation */
@keyframes g2048Spawn {
  0%   { transform: scale(0) ; opacity: 0; }
  60%  { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1) ; opacity: 1; }
}
.g2048-tile-spawn .g2048-tile-inner { animation: g2048Spawn .18s cubic-bezier(.2,.8,.3,1) both; }

/* Merge pulse */
@keyframes g2048Merge {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}
.g2048-tile-merge { animation: g2048Merge .2s cubic-bezier(.2,.8,.3,1); }

/* ── Tile colours — dark theme ───────────────────────────── */
.g2048-tile[data-value="2"]     .g2048-tile-inner { background:#1e3a5f; color:#93c5fd; }
.g2048-tile[data-value="4"]     .g2048-tile-inner { background:#1e4d8c; color:#60a5fa; }
.g2048-tile[data-value="8"]     .g2048-tile-inner { background:#1d5fba; color:#bfdbfe; }
.g2048-tile[data-value="16"]    .g2048-tile-inner { background:#0e7490; color:#67e8f9; }
.g2048-tile[data-value="32"]    .g2048-tile-inner { background:#065f46; color:#6ee7b7; }
.g2048-tile[data-value="64"]    .g2048-tile-inner { background:#92400e; color:#fcd34d; }
.g2048-tile[data-value="128"]   .g2048-tile-inner { background:#991b1b; color:#fca5a5; box-shadow:0 0 12px rgba(239,68,68,.3); }
.g2048-tile[data-value="256"]   .g2048-tile-inner { background:#6d28d9; color:#c4b5fd; box-shadow:0 0 14px rgba(124,58,237,.35); }
.g2048-tile[data-value="512"]   .g2048-tile-inner { background:#9d174d; color:#fbcfe8; box-shadow:0 0 14px rgba(219,39,119,.3); }
.g2048-tile[data-value="1024"]  .g2048-tile-inner { background:#78350f; color:#fbbf24; box-shadow:0 0 18px rgba(245,158,11,.4); }
.g2048-tile[data-value="2048"]  .g2048-tile-inner {
  background: linear-gradient(135deg,#78350f,#a16207);
  color: #fef08a;
  box-shadow: 0 0 24px rgba(250,204,21,.55), 0 0 48px rgba(245,158,11,.3);
  animation: g2048GoldenPulse 2s ease-in-out infinite;
}
@keyframes g2048GoldenPulse {
  0%,100% { box-shadow: 0 0 24px rgba(250,204,21,.55), 0 0 48px rgba(245,158,11,.3); }
  50%     { box-shadow: 0 0 32px rgba(250,204,21,.8),  0 0 60px rgba(245,158,11,.45); }
}
.g2048-tile[data-value="4096"]  .g2048-tile-inner,
.g2048-tile[data-value="8192"]  .g2048-tile-inner,
.g2048-tile[data-value="16384"] .g2048-tile-inner,
.g2048-tile[data-value="32768"] .g2048-tile-inner,
.g2048-tile[data-value="65536"] .g2048-tile-inner,
.g2048-tile[data-value="131072"].g2048-tile-inner {
  background: linear-gradient(135deg,#4a1942,#7e22ce);
  color: #f0abfc;
  box-shadow: 0 0 28px rgba(168,85,247,.5);
}

/* ── Tile colours — light theme ──────────────────────────── */
[data-theme="light"] .g2048-tile[data-value="2"]     .g2048-tile-inner { background:#dbeafe; color:#1e40af; }
[data-theme="light"] .g2048-tile[data-value="4"]     .g2048-tile-inner { background:#bfdbfe; color:#1e3a8a; }
[data-theme="light"] .g2048-tile[data-value="8"]     .g2048-tile-inner { background:#3b82f6; color:#fff; }
[data-theme="light"] .g2048-tile[data-value="16"]    .g2048-tile-inner { background:#2563eb; color:#fff; }
[data-theme="light"] .g2048-tile[data-value="32"]    .g2048-tile-inner { background:#0e7490; color:#fff; }
[data-theme="light"] .g2048-tile[data-value="64"]    .g2048-tile-inner { background:#059669; color:#fff; }
[data-theme="light"] .g2048-tile[data-value="128"]   .g2048-tile-inner { background:#d97706; color:#fff; }
[data-theme="light"] .g2048-tile[data-value="256"]   .g2048-tile-inner { background:#dc2626; color:#fff; }
[data-theme="light"] .g2048-tile[data-value="512"]   .g2048-tile-inner { background:#7c3aed; color:#fff; }
[data-theme="light"] .g2048-tile[data-value="1024"]  .g2048-tile-inner { background:#92400e; color:#fef3c7; }
[data-theme="light"] .g2048-tile[data-value="2048"]  .g2048-tile-inner {
  background: linear-gradient(135deg,#d97706,#f59e0b); color:#fff;
  box-shadow: 0 0 20px rgba(217,119,6,.45);
}
[data-theme="light"] .g2048-tile[data-value="4096"]  .g2048-tile-inner,
[data-theme="light"] .g2048-tile[data-value="8192"]  .g2048-tile-inner,
[data-theme="light"] .g2048-tile[data-value="16384"] .g2048-tile-inner,
[data-theme="light"] .g2048-tile[data-value="32768"] .g2048-tile-inner,
[data-theme="light"] .g2048-tile[data-value="65536"] .g2048-tile-inner,
[data-theme="light"] .g2048-tile[data-value="131072"].g2048-tile-inner {
  background: linear-gradient(135deg,#7c3aed,#4f46e5); color:#fff;
  box-shadow: 0 0 20px rgba(124,58,237,.4);
}

/* ── Score float animation ───────────────────────────────── */
@keyframes scoreFloat {
  0%   { opacity: 1; transform: translate(-50%,-10px); }
  100% { opacity: 0; transform: translate(-50%,-50px); }
}
.g2048-score-float {
  position: fixed;
  pointer-events: none;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 1rem;
  color: var(--accent-light);
  z-index: 999;
  animation: scoreFloat .8s ease forwards;
  text-shadow: 0 1px 8px rgba(0,0,0,.5);
}

/* ── Overlay (win / game over) ───────────────────────────── */
.g2048-overlay {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  gap: .8rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s;
  z-index: 20;
  text-align: center;
  padding: 1rem;
}
.g2048-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}
.g2048-overlay-win  { background: rgba(6,30,15,.88); }
.g2048-overlay-over { background: rgba(6,10,18,.88); }
[data-theme="light"] .g2048-overlay-win  { background: rgba(220,252,231,.92); }
[data-theme="light"] .g2048-overlay-over { background: rgba(238,242,255,.92); }

.g2048-ov-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-bright);
  line-height: 1.1;
}
.g2048-ov-sub {
  font-size: 1.05rem;
  color: var(--text-dim);
}
.g2048-ov-score-row {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
}
.g2048-ov-stat { display: flex; flex-direction: column; align-items: center; gap: .15rem; }
.g2048-ov-stat-val {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent-light);
}
.g2048-ov-stat-lbl { font-size: .72rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; }
.g2048-ov-btns { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: center; }
.g2048-ov-btn {
  padding: .55rem 1.2rem;
  border-radius: var(--radius);
  border: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
  transition: all .2s;
  background: var(--accent);
  color: #fff;
}
.g2048-ov-btn:hover { background: var(--accent-light); transform: translateY(-1px); }
.g2048-ov-btn.secondary { background: var(--bg-surface); color: var(--text-bright); border: 1px solid var(--border-light); }
.g2048-ov-btn.secondary:hover { background: var(--bg-hover); }

/* ── Leaderboard ─────────────────────────────────────────── */
.g2048-lb {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 2rem;
}
.g2048-lb-header {
  padding: .9rem 1.2rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.g2048-lb-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-bright);
  display: flex; align-items: center; gap: .5rem;
}
.g2048-lb-hint {
  font-size: .75rem;
  color: var(--text-muted);
}
.g2048-lb-body { overflow-x: auto; }
.g2048-lb table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1.05rem;
}
.g2048-lb thead th {
  padding: .5rem 1rem;
  text-align: left;
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.g2048-lb thead th:last-child { text-align: right; }
.g2048-lb tbody td {
  padding: .55rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.03);
  vertical-align: middle;
  white-space: nowrap;
}
[data-theme="light"] .g2048-lb tbody td { border-bottom-color: rgba(0,0,0,.04); }
.g2048-lb tbody tr:last-child td { border-bottom: none; }
.g2048-lb tbody tr:hover td { background: var(--bg-hover); }
.g2048-lb tbody tr.lb-me td { background: rgba(59,130,246,.08); }
.g2048-lb tbody tr.lb-me td:first-child { border-left: 3px solid var(--accent); }
[data-theme="light"] .g2048-lb tbody tr.lb-me td { background: rgba(37,99,235,.06); }
.lb-rank {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-dim);
  min-width: 32px;
}
.lb-rank-gold   { color: #fbbf24; }
.lb-rank-silver { color: #94a3b8; }
.lb-rank-bronze { color: #b45309; }
.lb-name { color: var(--text-bright); font-weight: 500; }
.lb-score {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-light);
}
.lb-tile-badge {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: .72rem;
  font-weight: 700;
  padding: .15rem .45rem;
  border-radius: 5px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.lb-tile-2048  { background: #78350f; color: #fef08a; border-color: #a16207; }
.lb-tile-1024  { background: #78350f; color: #fbbf24; border-color: #92400e; }
.lb-tile-4096  { background: #4a1942; color: #f0abfc; border-color: #7e22ce; }
.lb-tile-super { background: linear-gradient(135deg,#4a1942,#7e22ce); color: #f0abfc; border: none; }
.lb-date { color: var(--text-muted); font-size: 1.05rem; text-align: right; }
.lb-separator td {
  padding: .4rem 1rem;
  background: var(--bg-card);
  font-size: .72rem;
  color: var(--text-muted);
  text-align: center;
  border-bottom: 1px solid var(--border);
  font-style: italic;
}
.lb-loading {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 1.05rem;
}
.lb-guest-cta {
  padding: .8rem 1.2rem;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  font-size: 1.05rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.lb-guest-cta a { color: var(--accent-light); font-weight: 600; }

/* ── Hamburger button (hidden on desktop) ────────────────── */
.gh-menu-btn {
  display: none;
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-dim);
  cursor: pointer;
  align-items: center; justify-content: center;
  transition: all .2s;
  flex-shrink: 0;
  margin-left: auto; /* push to far right */
}
.gh-menu-btn:hover { background: var(--bg-hover); color: var(--text); }

/* ── Responsive ──────────────────────────────────────────── */

/* Tablet — hide username text, shrink pills */
@media (max-width: 640px) {
  .gh-uname { display: none; }
  .gh-score-pill { min-width: 48px; padding: .2rem .5rem; }
  .gh-score-val { font-size: .8rem; }
}

/* New-game dropdown button: hidden on desktop, shown only inside mobile dropdown */
.gh-new-game-dropdown { display: none; }

/* Mobile — hamburger takes over, actions become dropdown */
@media (max-width: 560px) {
  .gh-menu-btn { display: flex; }
  .gh-scores { margin-left: auto; } /* scores stay visible, push right */

  /* Header restart button: hidden on mobile — lives in the dropdown instead */
  .gh-btn-restart-header { display: none !important; }

  /* Dropdown New Game button */
  .gh-new-game-dropdown {
    display: flex;
    width: 100%;
    justify-content: flex-start;
    gap: .5rem;
  }

  /* gh-actions collapses into a dropdown under the header */
  .gh-actions {
    display: none;
    position: absolute;
    top: var(--gh-h);
    right: 0;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: 0;
    padding: .6rem .75rem;
    gap: .45rem;
    z-index: 200;
    min-width: 180px;
    box-shadow: 0 8px 24px rgba(0,0,0,.5);
    align-items: flex-start;
  }
  .gh.menu-open .gh-actions { display: flex; }

  /* Inside dropdown: user link fills width */
  .gh-actions .gh-user-link { width: 100%; }
  .gh-actions .gh-sign-in   { width: 100%; text-align: center; }

  /* Every button in the open dropdown — uniform height, padding, font */
  .gh.menu-open .gh-actions .gh-btn,
  .gh.menu-open .gh-actions .gh-new-game-dropdown {
    width: 100%;
    height: auto;
    min-height: 44px;
    padding: .6rem .85rem;
    justify-content: flex-start;
    gap: .6rem;
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: normal;
  }

  /* Username hidden at tablet breakpoint — always show it inside the open dropdown */
  .gh.menu-open .gh-actions .gh-uname { display: inline; }

  /* Show the Light/Dark text label inside the dropdown only */
  .gh.menu-open .gh-actions .tt-label {
    display: inline;
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
  }

  /* Header difficulty wrapper: hide on mobile — lives in the dropdown instead */
  .gh-header-diff { display: none !important; }

  /* Diff pill: hide on very narrow */
  .g2048-diff-pill { display: none !important; }

  .games-content-wrap { padding: 1rem .8rem 2rem; }
}

/* ── Game status bar (scores shown below breadcrumbs) ───────── */
.game-status-bar {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  margin-bottom: .9rem;
  align-items: center;
}
.gsb-pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: .22rem .8rem;
}
.gsb-label {
  font-family: var(--font-display);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.gsb-val {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-bright);
  min-width: 1.8ch;
  text-align: center;
}

/* Expert Minesweeper on mobile: hide bottom ad so board has full vertical space */
@media (max-width: 767px) {
  body.expert-mobile .ad-bottom-wrap { display: none !important; }
}

/* Close menu when clicking outside */
@media (max-width: 560px) {
  .gh.menu-open::after {
    content: '';
    position: fixed;
    inset: var(--gh-h) 0 0 0;
    z-index: 199;
  }
}

@media (max-width: 540px) {
  .g2048-lb-hint { display: none; }
  .lb-date { display: none; }
}

/* ═══════════════════════════════════════════════════════════
   Memory / Pexeso
   ═══════════════════════════════════════════════════════════ */

/* ── Difficulty splash screen ──────────────────────────────── */
.gmem-diff-splash {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}
[data-theme="light"] .gmem-diff-splash { background: #fff; }

.gmem-ds-logo {
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.03em;
  background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 50%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.gmem-ds-tagline {
  font-size: 1.05rem;
  color: var(--text-dim);
  letter-spacing: .04em;
  margin: -.4rem 0 .4rem;
}
.gmem-ds-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: .75rem;
  width: 100%;
  max-width: 600px;
}
.gmem-ds-btn {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1rem 1rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
  transition: background .18s, border-color .18s, transform .18s, box-shadow .18s;
  text-align: center;
  width: 100%;
}
.gmem-ds-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,.3);
}
.gmem-ds-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.gmem-ds-default {
  border-color: var(--accent);
  background: rgba(59,130,246,.09);
  box-shadow: 0 0 0 1px rgba(59,130,246,.2);
}
.gmem-ds-default:hover { background: rgba(59,130,246,.16); }
[data-theme="light"] .gmem-ds-default { background: rgba(37,99,235,.06); }

.gmem-ds-badge {
  position: absolute;
  top: -.65rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-dim);
  color: #fff;
  font-family: var(--font-display);
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  padding: .15rem .55rem;
  border-radius: 10px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(59,130,246,.4);
}
.gmem-ds-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-bright);
}
.gmem-ds-desc {
  font-size: .92rem;
  color: var(--text-dim);
  line-height: 1.4;
}
.gmem-ds-pairs {
  font-family: var(--font-mono);
  font-size: .85rem;
  font-weight: 700;
  color: var(--accent-light);
  background: rgba(59,130,246,.1);
  padding: .15rem .6rem;
  border-radius: 8px;
  margin-top: .15rem;
}

@media (max-width: 480px) {
  .gmem-ds-grid { grid-template-columns: 1fr; }
  .gmem-ds-logo { font-size: 2.8rem; }
}

/* ── Game area ─────────────────────────────────────────────── */
.gmem-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  margin-bottom: 2.5rem;
}

.gmem-board {
  display: grid;
  gap: var(--gmem-gap, 10px);
  grid-template-columns: repeat(var(--gmem-cols, 4), var(--gmem-cell, 80px));
  user-select: none;
}

/* ── Card ──── */
.gmem-card {
  width: var(--gmem-cell, 80px);
  height: var(--gmem-cell, 80px);
  perspective: 600px;
  cursor: pointer;
}
.gmem-card-inner {
  width: 100%; height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform .35s cubic-bezier(.4,0,.2,1);
  border-radius: var(--radius);
}
.gmem-card.flipped .gmem-card-inner,
.gmem-card.matched .gmem-card-inner  { transform: rotateY(180deg); }

.gmem-card-face {
  position: absolute; inset: 0;
  border-radius: var(--radius);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex; align-items: center; justify-content: center;
}

.gmem-card-front {
  background: var(--bg-surface);
  border: 2px solid var(--border);
  background-image: repeating-linear-gradient(
    135deg,
    transparent, transparent 4px,
    rgba(255,255,255,.03) 4px, rgba(255,255,255,.03) 5px
  );
  transition: border-color .2s;
}
.gmem-card:hover .gmem-card-front { border-color: var(--border-light); }
[data-theme="light"] .gmem-card-front { background: #e8ecf6; border-color: #c8d0e8; }

.gmem-card-back {
  background: var(--bg-card);
  border: 2px solid var(--accent);
  transform: rotateY(180deg);
  font-size: calc(var(--gmem-cell, 80px) * 0.48);
  line-height: 1;
}
[data-theme="light"] .gmem-card-back { background: #fff; }

.gmem-card.matched .gmem-card-back {
  border-color: #4ade80;
  background: rgba(74,222,128,.1);
}
[data-theme="light"] .gmem-card.matched .gmem-card-back { background: rgba(74,222,128,.15); }

/* ── Memory win overlay ── */
.gmem-overlay {
  position: absolute;
  inset: -16px;
  background: rgba(6,10,18,.9);
  border-radius: var(--radius-lg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .8rem;
  opacity: 0; pointer-events: none;
  transition: opacity .35s;
  z-index: 10;
  text-align: center;
  padding: 2rem;
}
[data-theme="light"] .gmem-overlay { background: rgba(240,244,255,.93); }
.gmem-overlay.visible { opacity: 1; pointer-events: auto; }
.gmem-ov-icon { font-size: 2.5rem; line-height: 1; }
.gmem-ov-title { font-size: 1.6rem; font-weight: 800; color: var(--text-bright); }
.gmem-ov-sub   { font-size: 1.05rem; color: var(--text-dim); }
.gmem-ov-stats { display: flex; gap: 2rem; justify-content: center; }
.gmem-ov-stat  { display: flex; flex-direction: column; align-items: center; gap: .1rem; }
.gmem-ov-stat-val { font-family: var(--font-mono); font-size: 1.4rem; font-weight: 800; color: var(--accent-light); }
.gmem-ov-stat-lbl { font-size: .72rem; text-transform: uppercase; letter-spacing:.05em; color: var(--text-dim); }
.gmem-ov-btns { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: center; margin-top: .4rem; }
.gmem-ov-btn {
  padding: .55rem 1.2rem; border-radius: var(--radius); border: none;
  font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; cursor: pointer;
  background: var(--accent); color: #fff; transition: all .2s;
}
.gmem-ov-btn:hover { background: var(--accent-light); transform: translateY(-1px); }
.gmem-ov-btn.secondary { background: var(--bg-surface); color: var(--text-bright); border: 1px solid var(--border-light); }
.gmem-ov-btn.secondary:hover { background: var(--bg-hover); }

/* ═══════════════════════════════════════════════════════════
   Minesweeper
   ═══════════════════════════════════════════════════════════ */
.gms-scroll-wrap { overflow: hidden; margin-bottom: 2rem; }
.gms-board-wrap  { display: flex; justify-content: center; }

.gms-board {
  display: inline-grid;
  gap: 2px;
  background: var(--bg-surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  user-select: none;
  margin: 0 auto;
  width: fit-content;
}

.gms-cell {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-family: var(--font-mono);
  font-weight: 800;
  transition: background .1s;
  user-select: none;
  -webkit-user-select: none;
}
.gms-cell:hover:not(.revealed) { background: var(--bg-hover); }
[data-theme="light"] .gms-cell { background: #d0d8f0; border-color: #b0bad8; }
[data-theme="light"] .gms-cell:hover:not(.revealed) { background: #bcc8e8; }

.gms-cell.revealed {
  background: var(--bg-deep);
  border-color: transparent;
  cursor: default;
}
[data-theme="light"] .gms-cell.revealed { background: #e8ecf8; }

.gms-cell.mine       { background: #450a0a; }
.gms-cell.mine-hit   { background: #dc2626 !important; }
[data-theme="light"] .gms-cell.mine { background: #fecaca; }
[data-theme="light"] .gms-cell.mine-hit { background: #ef4444 !important; }

.gms-cell.flagged { font-size: .9em; }

/* Minesweeper overlays */
.gms-overlay {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  display: none;
  flex-direction: column; align-items: center; gap: .8rem;
  margin-bottom: 2rem;
  animation: fadeIn .3s ease;
}
.gms-overlay.visible { display: flex; }
@keyframes fadeIn { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:none; } }
.gms-ov-icon  { font-size: 2.5rem; }
.gms-ov-title { font-size: 1.6rem; font-weight: 800; color: var(--text-bright); }
.gms-ov-sub   { font-size: 1.05rem; color: var(--text-dim); }
.gms-ov-btns  { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: center; margin-top: .4rem; }
.gms-ov-btn {
  padding: .55rem 1.2rem; border-radius: var(--radius); border: none;
  font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; cursor: pointer;
  background: var(--accent); color: #fff; transition: all .2s;
}
.gms-ov-btn:hover { background: var(--accent-light); transform: translateY(-1px); }
.gms-ov-btn.secondary { background: var(--bg-surface); color: var(--text-bright); border: 1px solid var(--border-light); }

/* ═══════════════════════════════════════════════════════════
   Word Search
   ═══════════════════════════════════════════════════════════ */
/* ── Game area — desktop: grid left + sidebar right ────────── */
.gws-game-area {
  display: flex;
  gap: 1.2rem;
  align-items: flex-start;
  margin-bottom: 2rem;
}

/* Left column: grid + direction chips */
.gws-grid-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  flex-shrink: 0;
}
.gws-grid-wrap { display: flex; justify-content: center; max-width: 100%; overflow: hidden; }
.gws-grid {
  display: grid;
  gap: 3px;
  user-select: none;
  touch-action: none;
  padding: 6px;
  background: rgba(0,0,0,.2);
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.04);
}
[data-theme="light"] .gws-grid {
  background: rgba(0,0,0,.05);
  border-color: rgba(0,0,0,.08);
}

/* ── Cells ────────────────────────────────────────────────── */
.gws-cell {
  background: linear-gradient(180deg, #182236 0%, #111a2b 100%);
  border: 1px solid rgba(255,255,255,.06);
  border-top-color: rgba(255,255,255,.1);
  border-bottom-color: rgba(0,0,0,.25);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  text-transform: uppercase;
  cursor: default;
  color: rgba(255,255,255,.7);
  box-shadow: 0 1px 2px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.05);
  transition: background .12s, color .12s, box-shadow .3s, transform .1s, opacity .5s;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
  position: relative;
}
[data-theme="light"] .gws-cell {
  background: linear-gradient(180deg, #fff 0%, #e8edf6 100%);
  border-color: rgba(0,0,0,.08);
  border-top-color: rgba(255,255,255,.9);
  border-bottom-color: rgba(0,0,0,.12);
  color: #334155;
  box-shadow: 0 1px 2px rgba(0,0,0,.1), inset 0 1px 0 rgba(255,255,255,.8);
  text-shadow: none;
}
/* Selection ring — works on top of found-cell backgrounds */
.gws-cell.selecting {
  outline: 2.5px solid rgba(165,160,255,.9);
  outline-offset: -1px;
  box-shadow: 0 0 0 3px rgba(99,102,241,.45), inset 0 0 12px rgba(99,102,241,.25);
  transform: scale(1.06);
  z-index: 2;
  color: #fff;
}
/* Unfound cells get a tinted background too */
.gws-cell.selecting:not(.found) {
  background: rgba(99,102,241,.45);
}
[data-theme="light"] .gws-cell.selecting {
  outline-color: rgba(79,70,229,.85);
  box-shadow: 0 0 0 3px rgba(79,70,229,.35), inset 0 0 12px rgba(79,70,229,.18);
  transform: scale(1.06);
  color: #1e1b4b;
}
[data-theme="light"] .gws-cell.selecting:not(.found) {
  background: rgba(79,70,229,.35);
}
.gws-cell.found {
  color: #fff;
  border-color: rgba(255,255,255,.08);
  border-top-color: rgba(255,255,255,.14);
  border-bottom-color: rgba(0,0,0,.2);
  box-shadow: 0 1px 2px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.08);
}
[data-theme="light"] .gws-cell.found {
  color: #1e293b;
  font-weight: 800;
  border-color: rgba(0,0,0,.06);
  border-top-color: rgba(255,255,255,.5);
  border-bottom-color: rgba(0,0,0,.1);
  box-shadow: 0 1px 2px rgba(0,0,0,.08), inset 0 1px 0 rgba(255,255,255,.5);
}
.gws-cell.gws-black {
  background: #0a0f1a;
  border-color: transparent;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.5);
  text-shadow: none;
}
[data-theme="light"] .gws-cell.gws-black {
  background: #cbd5e1;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.12);
}
.gws-cell.message-letter {
  background: rgba(250,204,21,.18) !important;
  color: #fbbf24 !important;
  box-shadow: inset 0 0 0 2px #fbbf24, 0 0 8px rgba(250,204,21,.3);
  border-color: transparent;
  border-radius: 50%;
}
[data-theme="light"] .gws-cell.message-letter {
  background: rgba(202,138,4,.22) !important;
  color: #78350f !important;
  box-shadow: inset 0 0 0 2px #b45309, 0 0 8px rgba(202,138,4,.35);
}

/* ── Completed state — dim word cells, pop message letters ── */
.gws-grid.gws-completed .gws-cell.found:not(.message-letter) {
  opacity: .38;
  filter: saturate(.3) brightness(.75);
}
[data-theme="light"] .gws-grid.gws-completed .gws-cell.found:not(.message-letter) {
  opacity: .35;
  filter: saturate(.25) brightness(.9);
}
.gws-grid.gws-completed .gws-cell.message-letter {
  opacity: 1 !important;
  filter: none !important;
  background: rgba(250,204,21,.28) !important;
  box-shadow: inset 0 0 0 2.5px #fbbf24, 0 0 14px rgba(250,204,21,.5), 0 0 28px rgba(250,204,21,.15);
  animation: gws-msg-pulse 2s ease-in-out infinite;
}
[data-theme="light"] .gws-grid.gws-completed .gws-cell.message-letter {
  background: rgba(202,138,4,.32) !important;
  box-shadow: inset 0 0 0 2.5px #b45309, 0 0 14px rgba(202,138,4,.45), 0 0 28px rgba(202,138,4,.12);
}
@keyframes gws-msg-pulse {
  0%, 100% { box-shadow: inset 0 0 0 2.5px #fbbf24, 0 0 14px rgba(250,204,21,.5), 0 0 28px rgba(250,204,21,.15); }
  50%      { box-shadow: inset 0 0 0 2.5px #fbbf24, 0 0 20px rgba(250,204,21,.65), 0 0 40px rgba(250,204,21,.25); }
}
/* Black cells in completed state stay dark */
.gws-grid.gws-completed .gws-cell.gws-black {
  opacity: .2;
}

/* ── Right sidebar: secret message + word list ────────────── */
.gws-sidebar {
  flex: 1;
  min-width: 0;
}

/* Secret message banner (shown on win) */
.gws-secret-wrap {
  text-align: center;
  padding: .6rem 1rem;
  background: rgba(250,204,21,.08);
  border: 1px solid rgba(250,204,21,.2);
  border-radius: var(--radius);
  margin-bottom: .6rem;
}
.gws-secret-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: .25rem; }
.gws-secret-msg { font-family: var(--font-mono); font-weight: 700; color: #fbbf24; font-size: .95rem; word-break: break-word; }
[data-theme="light"] .gws-secret-wrap { background: rgba(202,138,4,.08); border-color: rgba(202,138,4,.2); }
[data-theme="light"] .gws-secret-msg { color: #92400e; }

/* Word list title */
.gws-words-title {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: .45rem;
}

/* Word list — flowing wrap chips, always fully visible */
.gws-word-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .3rem .4rem;
}
.gws-word-list li {
  font-family: var(--font-display);
  font-size: .88rem;
  font-weight: 500;
  letter-spacing: .03em;
  color: var(--text-bright);
  padding: .22rem .55rem;
  border-radius: 4px;
  transition: all .2s;
  line-height: 1.35;
  background: var(--bg-surface);
  border: 1px solid var(--border);
}
.gws-word-list li.found {
  text-decoration: line-through;
  color: var(--text-muted);
  opacity: .45;
  border-color: transparent;
  background: transparent;
}

/* ── Win overlay ──────────────────────────────────────────── */
.gws-overlay {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem; text-align: center;
  display: none; flex-direction: column; align-items: center; gap: .8rem;
  margin-bottom: 2rem;
  animation: fadeIn .3s ease;
}
.gws-overlay.visible { display: flex; }
.gws-ov-icon  { font-size: 2.5rem; }
.gws-ov-title { font-size: 1.6rem; font-weight: 800; color: var(--text-bright); }
.gws-ov-secret { display: flex; flex-direction: column; gap: .2rem; align-items: center; }
.gws-ov-secret-lbl { font-size: 1.05rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.gws-ov-secret-val { font-family: var(--font-mono); font-weight: 800; font-size: 1.1rem; color: #fbbf24; }
.gws-ov-btns { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: center; margin-top: .4rem; }
.gws-ov-btn {
  padding: .55rem 1.2rem; border-radius: var(--radius); border: none;
  font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; cursor: pointer;
  background: var(--accent); color: #fff; transition: all .2s;
}
.gws-ov-btn:hover { background: var(--accent-light); transform: translateY(-1px); }
.gws-ov-btn.secondary { background: var(--bg-surface); color: var(--text-bright); border: 1px solid var(--border-light); }

/* ── Mobile: stacked, grid fills width ────────────────────── */
@media (max-width: 700px) {
  .gws-game-area {
    flex-direction: column;
    align-items: center;
  }
  .gws-grid-col { width: 100%; }
  .gws-grid-wrap { width: 100%; justify-content: center; }
  .gws-sidebar { width: 100%; text-align: center; }
  .gws-word-list { justify-content: center; }
  .gws-words-title { text-align: center; }
}

/* ═══════════════════════════════════════════════════════════
   Sudoku
   ═══════════════════════════════════════════════════════════ */

/* ── Game area: desktop = grid left + sidebar right ────────── */
.gsu-wrap {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  margin-bottom: 2.5rem;
}
.gsu-grid-col {
  flex-shrink: 0;
}
.gsu-sidebar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  flex: 1;
  min-width: 0;
  padding-top: .25rem;
}

/* ── Board ────────────────────────────────────────────────── */
.gsu-board {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  border: 2px solid var(--text-dim);
  border-radius: var(--radius-sm);
  overflow: hidden;
  user-select: none;
}
.gsu-cell {
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 1.15rem; font-weight: 700;
  color: var(--text-bright);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s;
  position: relative;
}
.gsu-cell:last-child { border-right: none; }
.gsu-cell.box-top    { border-top: 2px solid var(--text-dim); }
.gsu-cell.box-left   { border-left: 2px solid var(--text-dim); }
.gsu-cell.box-bottom { border-bottom: 2px solid var(--text-dim); }
.gsu-cell.box-right  { border-right: 2px solid var(--text-dim); }
.gsu-cell.given      { color: var(--text-bright); background: var(--bg-card); cursor: default; }
.gsu-cell.selected   { background: rgba(59,130,246,.2) !important; }
.gsu-cell.related    { background: rgba(59,130,246,.06); }
.gsu-cell.same-val   { background: rgba(59,130,246,.14); }
.gsu-cell.error      { color: #f87171; background: rgba(239,68,68,.1) !important; }
.gsu-cell.hint       { color: var(--accent-light); }
[data-theme="light"] .gsu-cell                { background: #fff; border-color: #c8d0e8; }
[data-theme="light"] .gsu-cell.given          { background: #e8ecf6; }
[data-theme="light"] .gsu-cell.selected       { background: rgba(37,99,235,.15) !important; }
[data-theme="light"] .gsu-cell.related        { background: rgba(37,99,235,.06); }
[data-theme="light"] .gsu-cell.same-val       { background: rgba(37,99,235,.1); }

/* Pencil mode cell */
.gsu-cell.pencil-mode {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 2px;
  gap: 0;
}
.gsu-cell.pencil-mode span {
  display: flex; align-items: center; justify-content: center;
  font-size: .48rem;
  font-weight: 600;
  color: var(--accent-light);
  line-height: 1;
}

/* ── Number pad ──────────────────────────────────────────── */
.gsu-pad {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: .4rem;
  max-width: 440px;
  width: 100%;
}
.gsu-pad-btn {
  height: 48px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 1.1rem; font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  display: flex; align-items: center; justify-content: center;
}
.gsu-pad-btn:hover { background: var(--bg-hover); border-color: var(--border-light); color: var(--accent-light); }
.gsu-pad-erase { color: var(--text-dim); }

/* ── Controls ────────────────────────────────────────────── */
.gsu-controls { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: center; }
.gsu-ctrl-btn {
  padding: .45rem 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-bright);
  font-family: var(--font-display);
  font-size: 1.05rem; font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.gsu-ctrl-btn:hover { background: var(--bg-hover); border-color: var(--border-light); }
.gsu-ctrl-btn.active { background: var(--accent-dim); border-color: var(--accent); color: #fff; }

/* ── Desktop: size board to fill viewport height ─────────── */
@media (min-width: 701px) {
  .gsu-cell {
    /* JS sets size dynamically; this is the fallback */
    width: 48px; height: 48px;
  }
  .gsu-pad {
    grid-template-columns: repeat(3, 1fr);
    max-width: 260px;
  }
  .gsu-pad-btn { height: 52px; font-size: 1.15rem; }
}

/* ── Mobile (portrait): stacked, board fills width ───────── */
@media (max-width: 700px) {
  .gsu-wrap {
    flex-direction: column;
    align-items: center;
  }
  .gsu-grid-col { width: 100%; display: flex; justify-content: center; }
  .gsu-sidebar { width: 100%; }
  .gsu-cell { width: 36px; height: 36px; font-size: 1rem; }
  .gsu-cell.pencil-mode span { font-size: .38rem; }
  .gsu-pad-btn { height: 40px; font-size: 1.05rem; }
  .gsu-pad { grid-template-columns: repeat(5, 1fr); max-width: 100%; }
}

/* ── Overlay ─────────────────────────────────────────────── */
.gsu-overlay {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 2rem; text-align: center;
  display: none; flex-direction: column; align-items: center; gap: .8rem;
  margin-bottom: 2rem; animation: fadeIn .3s ease;
}
.gsu-overlay.visible { display: flex; }
.gsu-ov-icon  { font-size: 2.5rem; }
.gsu-ov-title { font-size: 1.6rem; font-weight: 800; color: var(--text-bright); }
.gsu-ov-sub   { font-size: 1.05rem; color: var(--text-dim); }
.gsu-ov-stat  { display: flex; flex-direction: column; align-items: center; gap: .1rem; }
.gsu-ov-stat-val { font-family: var(--font-mono); font-size: 1.4rem; font-weight: 800; color: var(--accent-light); }
.gsu-ov-stat-lbl { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); }
.gsu-ov-btns { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: center; }
.gsu-ov-btn {
  padding: .55rem 1.2rem; border-radius: var(--radius); border: none;
  font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; cursor: pointer;
  background: var(--accent); color: #fff; transition: all .2s;
}
.gsu-ov-btn:hover { background: var(--accent-light); transform: translateY(-1px); }
.gsu-ov-btn.secondary { background: var(--bg-surface); color: var(--text-bright); border: 1px solid var(--border-light); }

/* ═══════════════════════════════════════════════════════════
   2048 — Difficulty splash (full-width panel, outside board)
   ═══════════════════════════════════════════════════════════ */

/* Board hidden while splash is showing */
.g2048-board--splash { display: none !important; }

.g2048-diff-splash {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}
.g2048-diff-splash.hidden { display: none; }
[data-theme="light"] .g2048-diff-splash { background: #fff; }

.g2048-ds-logo {
  font-family: var(--font-mono);
  font-size: 4rem;
  font-weight: 800;
  color: var(--text-bright);
  line-height: 1;
  letter-spacing: -.04em;
  /* Gradient glow matching tile colours */
  background: linear-gradient(135deg, #60a5fa 0%, #bfdbfe 60%, #fbbf24 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.g2048-ds-tagline {
  font-size: 1.05rem;
  color: var(--text-dim);
  letter-spacing: .06em;
  margin: -.4rem 0 .4rem;
}

/* ── 5-button grid — 2 cols wide, last button centred ────── */
.g2048-ds-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
  width: 100%;
  max-width: 520px;
}
/* Last button (Hard) spans both columns and self-centres */
.g2048-ds-btn:last-child {
  grid-column: 1 / -1;
  max-width: calc(50% - .375rem);
  justify-self: center;
}

.g2048-ds-btn {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1rem 1rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  transition: background .18s, border-color .18s, transform .18s, box-shadow .18s;
  text-align: center;
  width: 100%;
}
.g2048-ds-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,.3);
}
.g2048-ds-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.g2048-ds-default {
  border-color: var(--accent);
  background: rgba(59,130,246,.09);
  box-shadow: 0 0 0 1px rgba(59,130,246,.2);
}
.g2048-ds-default:hover { background: rgba(59,130,246,.16); }
[data-theme="light"] .g2048-ds-default { background: rgba(37,99,235,.06); }

/* "Recommended" badge */
.g2048-ds-badge {
  position: absolute;
  top: -.65rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-dim);
  color: #fff;
  font-family: var(--font-display);
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  padding: .15rem .55rem;
  border-radius: 10px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(59,130,246,.4);
}

.g2048-ds-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-bright);
  line-height: 1.1;
}
.g2048-ds-desc {
  font-size: 1.05rem;
  color: var(--text-dim);
  line-height: 1.4;
}

/* ── Tile previews ───────────────────────────────────────── */
.g2048-ds-tiles {
  display: flex;
  gap: .3rem;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: .2rem;
}
.g2048-ds-tile {
  width: 32px; height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: .72rem;
  font-weight: 800;
  line-height: 1;
}
.g2048-ds-tile.t2  { background: #1e3a5f; color: #93c5fd; }
.g2048-ds-tile.t4  { background: #1e4d8c; color: #60a5fa; }
.g2048-ds-tile.t8  { background: #1d5fba; color: #bfdbfe; }
.g2048-ds-tile.t16 { background: #0e7490; color: #67e8f9; }
.g2048-ds-tile.g2048-ds-tile-wild { background: linear-gradient(135deg,#1e4d8c,#0e7490); color: #bfdbfe; }
[data-theme="light"] .g2048-ds-tile.t2  { background: #dbeafe; color: #1e40af; }
[data-theme="light"] .g2048-ds-tile.t4  { background: #bfdbfe; color: #1e3a8a; }
[data-theme="light"] .g2048-ds-tile.t8  { background: #3b82f6; color: #fff; }
[data-theme="light"] .g2048-ds-tile.t16 { background: #2563eb; color: #fff; }
[data-theme="light"] .g2048-ds-tile.g2048-ds-tile-wild { background: linear-gradient(135deg,#3b82f6,#0284c7); color: #fff; }

/* Responsive: single column on small screens */
@media (max-width: 480px) {
  .g2048-ds-grid { grid-template-columns: 1fr; }
  .g2048-ds-btn:last-child { grid-column: auto; max-width: 100%; justify-self: stretch; }
  .g2048-ds-logo { font-size: 3rem; }
}

/* ═══════════════════════════════════════════════════════════
   2048 — Difficulty pill in game header
   ═══════════════════════════════════════════════════════════ */

.g2048-diff-pill {
  font-family: var(--font-mono);
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .07em;
  padding: .15rem .6rem;
  border-radius: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  text-transform: uppercase;
  flex-shrink: 0;
  transition: color .2s, border-color .2s;
}
/* Hide when empty (no game started) */
.g2048-diff-pill:empty { display: none; }
/* Colour per difficulty */
.g2048-diff-pill[data-diff="easy"]     { color: #93c5fd; border-color: #1e3a5f; }
.g2048-diff-pill[data-diff="beginner"] { color: #60a5fa; border-color: #1e4d8c; }
.g2048-diff-pill[data-diff="medium"]   { color: var(--accent-light); border-color: var(--border-accent); }
.g2048-diff-pill[data-diff="advanced"] { color: #67e8f9; border-color: #0e7490; }
.g2048-diff-pill[data-diff="hard"]     { color: #fbbf24; border-color: #92400e; }

/* ═══════════════════════════════════════════════════════════
   2048 — Leaderboard difficulty tabs
   ═══════════════════════════════════════════════════════════ */

/* Allow header to wrap on narrow viewports */
.g2048-lb-header { flex-wrap: wrap; gap: .6rem 1rem; }

.g2048-lb-diff-tabs {
  display: flex;
  gap: .3rem;
  flex-wrap: wrap;
}
.g2048-lb-tab {
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  padding: .2rem .65rem;
  cursor: pointer;
  transition: color .18s, border-color .18s, background .18s;
  text-transform: capitalize;
  line-height: 1.4;
}
.g2048-lb-tab:hover {
  color: var(--text-bright);
  border-color: var(--border-light);
}
.g2048-lb-tab.active {
  background: var(--accent-dim);
  border-color: transparent;
  color: #fff;
}
.g2048-lb-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════════
   Sudoku difficulty splash
   ═══════════════════════════════════════════════════════════ */
.gsu-diff-splash {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}
[data-theme="light"] .gsu-diff-splash { background: #fff; }

.gsu-ds-logo {
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.03em;
  background: linear-gradient(135deg, #a78bfa 0%, #818cf8 50%, #60a5fa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.gsu-ds-tagline {
  font-size: 1.05rem;
  color: var(--text-dim);
  letter-spacing: .04em;
  margin: -.4rem 0 .4rem;
}
/* 5-button grid: 2 cols wide, last button centred */
.gsu-ds-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
  width: 100%;
  max-width: 520px;
}
.gsu-ds-btn:last-child {
  grid-column: 1 / -1;
  max-width: calc(50% - .375rem);
  justify-self: center;
}
.gsu-ds-btn {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1rem 1rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
  transition: background .18s, border-color .18s, transform .18s, box-shadow .18s;
  text-align: center;
  width: 100%;
}
.gsu-ds-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,.3);
}
.gsu-ds-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.gsu-ds-default {
  border-color: var(--accent);
  background: rgba(59,130,246,.09);
  box-shadow: 0 0 0 1px rgba(59,130,246,.2);
}
.gsu-ds-default:hover { background: rgba(59,130,246,.16); }
[data-theme="light"] .gsu-ds-default { background: rgba(37,99,235,.06); }

.gsu-ds-badge {
  position: absolute;
  top: -.65rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-dim);
  color: #fff;
  font-family: var(--font-display);
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  padding: .15rem .55rem;
  border-radius: 10px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(59,130,246,.4);
}
.gsu-ds-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-bright);
}
.gsu-ds-desc {
  font-size: .92rem;
  color: var(--text-dim);
  line-height: 1.4;
}
.gsu-ds-givens {
  font-family: var(--font-mono);
  font-size: .85rem;
  font-weight: 700;
  color: var(--accent-light);
  background: rgba(59,130,246,.1);
  padding: .15rem .6rem;
  border-radius: 8px;
  margin-top: .15rem;
}

.gsu-wrap--splash { display: none; }

@media (max-width: 480px) {
  .gsu-ds-grid { grid-template-columns: 1fr; }
  .gsu-ds-btn:last-child { grid-column: auto; max-width: 100%; justify-self: stretch; }
  .gsu-ds-logo { font-size: 2.8rem; }
}

/* ── Sudoku loading spinner ───────────────────────────────── */
.gsu-loading {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  padding: 4rem 2rem;
  text-align: center;
}
.gsu-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: gsu-spin .8s linear infinite;
}
@keyframes gsu-spin {
  to { transform: rotate(360deg); }
}
.gsu-loading-text {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: .02em;
}

/* ═══════════════════════════════════════════════════════════
   Minesweeper difficulty splash
   ═══════════════════════════════════════════════════════════ */
.gms-diff-splash {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}
[data-theme="light"] .gms-diff-splash { background: #fff; }

.gms-ds-logo {
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.03em;
  background: linear-gradient(135deg, #f87171 0%, #f97316 50%, #fbbf24 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.gms-ds-tagline {
  font-size: 1.05rem;
  color: var(--text-dim);
  letter-spacing: .04em;
  margin: -.4rem 0 .4rem;
}
/* 3 buttons, last one centred */
.gms-ds-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
  width: 100%;
  max-width: 520px;
}
.gms-ds-btn:last-child {
  grid-column: 1 / -1;
  max-width: calc(50% - .375rem);
  justify-self: center;
}
.gms-ds-btn {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1rem 1rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  transition: background .18s, border-color .18s, transform .18s, box-shadow .18s;
  text-align: center;
  width: 100%;
}
.gms-ds-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,.3);
}
.gms-ds-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.gms-ds-default {
  border-color: var(--accent);
  background: rgba(59,130,246,.09);
  box-shadow: 0 0 0 1px rgba(59,130,246,.2);
}
.gms-ds-default:hover { background: rgba(59,130,246,.16); }
[data-theme="light"] .gms-ds-default { background: rgba(37,99,235,.06); }

.gms-ds-badge {
  position: absolute;
  top: -.65rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-dim);
  color: #fff;
  font-family: var(--font-display);
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  padding: .15rem .55rem;
  border-radius: 10px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(59,130,246,.4);
}
.gms-ds-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-bright);
  line-height: 1.1;
}
.gms-ds-desc {
  font-size: .92rem;
  color: var(--text-dim);
  line-height: 1.4;
}
.gms-ds-mines {
  font-family: var(--font-mono);
  font-size: .85rem;
  font-weight: 700;
  color: #f97316;
  background: rgba(249,115,22,.1);
  padding: .15rem .6rem;
  border-radius: 8px;
  margin-top: .15rem;
}

@media (max-width: 480px) {
  .gms-ds-grid { grid-template-columns: 1fr; }
  .gms-ds-btn:last-child { grid-column: auto; max-width: 100%; justify-self: stretch; }
  .gms-ds-logo { font-size: 2.8rem; }
}

/* ═══════════════════════════════════════════════════════════
   Word Search — Direction colours
   Cell backgrounds are set via JS (supports gradient overlaps).
   Word list borders and legend chips stay in CSS.
   ═══════════════════════════════════════════════════════════ */

/* Word list — found words get direction colour border */
.gws-word-list li.found.dir-right { border-color: rgba(6,182,212,.5); }
.gws-word-list li.found.dir-left  { border-color: rgba(167,139,250,.5); }
.gws-word-list li.found.dir-down  { border-color: rgba(52,211,153,.5); }
.gws-word-list li.found.dir-up    { border-color: rgba(251,191,36,.5); }
.gws-word-list li.found.dir-dr    { border-color: rgba(251,113,133,.5); }
.gws-word-list li.found.dir-dl    { border-color: rgba(56,189,248,.5); }
.gws-word-list li.found.dir-ur    { border-color: rgba(163,230,53,.5); }
.gws-word-list li.found.dir-ul    { border-color: rgba(248,113,113,.5); }
[data-theme="light"] .gws-word-list li.found.dir-right { border-color: rgba(8,145,178,.5); }
[data-theme="light"] .gws-word-list li.found.dir-left  { border-color: rgba(109,40,217,.45); }
[data-theme="light"] .gws-word-list li.found.dir-down  { border-color: rgba(5,150,105,.5); }
[data-theme="light"] .gws-word-list li.found.dir-up    { border-color: rgba(217,119,6,.5); }
[data-theme="light"] .gws-word-list li.found.dir-dr    { border-color: rgba(190,18,60,.45); }
[data-theme="light"] .gws-word-list li.found.dir-dl    { border-color: rgba(2,132,199,.5); }
[data-theme="light"] .gws-word-list li.found.dir-ur    { border-color: rgba(101,163,13,.5); }
[data-theme="light"] .gws-word-list li.found.dir-ul    { border-color: rgba(220,38,38,.45); }

/* Direction legend — sits below the grid */
.gws-dir-legend {
  display: flex;
  justify-content: center;
}
.gws-dir-legend-items {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .35rem;
}
.gws-dir-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 5px;
  font-size: .8rem;
  font-weight: 700;
  line-height: 1;
}
/* Dark theme legend chips — match vivid cell palette */
.gws-dir-chip.dir-right { background: rgba(6,182,212,.25);  color: #22d3ee; }  /* cyan */
.gws-dir-chip.dir-left  { background: rgba(167,139,250,.25); color: #c4b5fd; } /* violet */
.gws-dir-chip.dir-down  { background: rgba(52,211,153,.25); color: #6ee7b7; }  /* emerald */
.gws-dir-chip.dir-up    { background: rgba(251,191,36,.25); color: #fcd34d; }  /* amber */
.gws-dir-chip.dir-dr    { background: rgba(251,113,133,.25); color: #fda4af; } /* rose */
.gws-dir-chip.dir-dl    { background: rgba(56,189,248,.25); color: #7dd3fc; }  /* sky */
.gws-dir-chip.dir-ur    { background: rgba(163,230,53,.25); color: #bef264; }  /* lime */
.gws-dir-chip.dir-ul    { background: rgba(248,113,113,.25); color: #fca5a5; } /* red */
/* Light theme legend chips — stronger */
[data-theme="light"] .gws-dir-chip.dir-right { background: rgba(8,145,178,.2);  color: #0e7490; }
[data-theme="light"] .gws-dir-chip.dir-left  { background: rgba(109,40,217,.2); color: #6d28d9; }
[data-theme="light"] .gws-dir-chip.dir-down  { background: rgba(5,150,105,.2);  color: #047857; }
[data-theme="light"] .gws-dir-chip.dir-up    { background: rgba(217,119,6,.2);  color: #b45309; }
[data-theme="light"] .gws-dir-chip.dir-dr    { background: rgba(190,18,60,.2);  color: #9f1239; }
[data-theme="light"] .gws-dir-chip.dir-dl    { background: rgba(2,132,199,.2);  color: #0369a1; }
[data-theme="light"] .gws-dir-chip.dir-ur    { background: rgba(101,163,13,.2); color: #4d7c0f; }
[data-theme="light"] .gws-dir-chip.dir-ul    { background: rgba(220,38,38,.2);  color: #b91c1c; }

/* ═══════════════════════════════════════════════════════════
   Word Search — Difficulty splash
   ═══════════════════════════════════════════════════════════ */
.gws-diff-splash {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}
[data-theme="light"] .gws-diff-splash { background: #fff; }

.gws-ds-logo {
  font-family: var(--font-display);
  font-size: 3.2rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.03em;
  background: linear-gradient(135deg, #22c55e 0%, #38bdf8 50%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.gws-ds-tagline {
  font-size: 1.05rem;
  color: var(--text-dim);
  letter-spacing: .04em;
  margin: -.4rem 0 .4rem;
}
/* 3 buttons: 2 cols, last centred */
.gws-ds-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
  width: 100%;
  max-width: 520px;
}
.gws-ds-btn:last-child {
  grid-column: 1 / -1;
  max-width: calc(50% - .375rem);
  justify-self: center;
}
.gws-ds-btn {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1rem 1rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  transition: background .18s, border-color .18s, transform .18s, box-shadow .18s;
  text-align: center;
  width: 100%;
}
.gws-ds-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,.3);
}
.gws-ds-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.gws-ds-default {
  border-color: var(--accent);
  background: rgba(59,130,246,.09);
  box-shadow: 0 0 0 1px rgba(59,130,246,.2);
}
.gws-ds-default:hover { background: rgba(59,130,246,.16); }
[data-theme="light"] .gws-ds-default { background: rgba(37,99,235,.06); }

.gws-ds-badge {
  position: absolute;
  top: -.65rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-dim);
  color: #fff;
  font-family: var(--font-display);
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  padding: .15rem .55rem;
  border-radius: 10px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(59,130,246,.4);
}
.gws-ds-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-bright);
  line-height: 1.1;
}
.gws-ds-desc {
  font-size: .92rem;
  color: var(--text-dim);
  line-height: 1.4;
}
.gws-ds-size {
  font-family: var(--font-mono);
  font-size: .85rem;
  font-weight: 700;
  color: #22c55e;
  background: rgba(34,197,94,.1);
  padding: .15rem .6rem;
  border-radius: 8px;
  margin-top: .15rem;
}

@media (max-width: 480px) {
  .gws-ds-grid { grid-template-columns: 1fr; }
  .gws-ds-btn:last-child { grid-column: auto; max-width: 100%; justify-self: stretch; }
  .gws-ds-logo { font-size: 2.4rem; }
}

/* ── Word Search loading spinner ─────────────────────────── */
.gws-loading {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  padding: 4rem 2rem;
  text-align: center;
}
.gws-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: #22c55e;
  border-radius: 50%;
  animation: gws-spin .8s linear infinite;
}
@keyframes gws-spin {
  to { transform: rotate(360deg); }
}
.gws-loading-text {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: .02em;
}
