/* Crisp type + depth — loaded after main.css. */

/* Body and controls stay at least 15px / 16px, medium weight on dark backgrounds. */
@media (max-width: 40rem) {
  html { font-size: 16px; }
  body { font-size: 1rem; font-weight: 500; }
}
.btn, .icon-btn, .chip {
  font-size: 1rem;
  font-weight: 600;
}
.wheel-letters button, .puzzle-toolbar .btn, .play-actions .btn {
  font-size: 1rem;
  font-weight: 600;
}
.btn.primary, .icon-btn.primary {
  font-weight: 700;
  color: #1a1208;
  background: linear-gradient(180deg, #f3e3aa, var(--gold-dim));
  text-shadow: none;
  box-shadow: 0 1px 0 rgba(255,255,255,.35), 0 2px 0 #8a6a18, 0 6px 12px rgba(0,0,0,.25);
}
.btn:not(.primary):not(.ghost), .icon-btn:not(.ghost) {
  background: linear-gradient(180deg, rgba(255,255,255,.07), transparent 55%), var(--bg-elev);
  box-shadow: 0 1px 0 rgba(255,255,255,.08), 0 2px 6px rgba(0,0,0,.2);
}
.btn:active, .icon-btn:active { transform: translateY(1px); }

/* Visual overhaul — typography, depth, boards, cards, menu, puzzles, wheel, dominoes.
   Complements main.css. All art referenced here is drawn in CSS or js/art.js (original). */

html { background: var(--bg); }
body {
  background:
    radial-gradient(ellipse at 20% -10%, rgba(232, 212, 139, .09), transparent 50%),
    radial-gradient(ellipse at 90% 110%, rgba(14, 59, 46, .55), transparent 55%),
    var(--bg);
}
body::before {
  content: "";
  position: fixed;
  inset: -20%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 15% 20%, rgba(232,212,139,.06) 0, transparent 32%),
    radial-gradient(circle at 80% 80%, rgba(122,30,40,.08) 0, transparent 36%);
  animation: bgdrift 22s ease-in-out infinite alternate;
}
@keyframes bgdrift {
  from { transform: translate3d(-2%, -1%, 0); }
  to { transform: translate3d(3%, 2%, 0); }
}
@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
  .playing-card.deal-in, .speech-bubble.pop, .ludo-tok.playable { animation: none !important; }
}

.hero h1 { letter-spacing: .02em; text-shadow: 0 1px 0 rgba(0,0,0,.45); font-weight: 700; }
.hero p { font-size: 1.0625rem; font-weight: 500; }

.game-grid { grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr)); gap: .9rem; }
.game-card {
  background: linear-gradient(180deg, rgba(255,255,255,.04), transparent 40%), var(--bg-elev);
  box-shadow: 0 8px 20px rgba(0,0,0,.22);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
  padding: .7rem .75rem .85rem;
}
.game-card:hover { transform: translateY(-4px); box-shadow: 0 14px 28px rgba(0,0,0,.32); }
.game-thumb { height: 5.2rem; border-radius: 8px; overflow: hidden; margin-bottom: .55rem; background: #0a2a21; }
.game-thumb svg { width: 100%; height: 100%; display: block; }
.game-card h3 { font-family: var(--font-ui); font-weight: 700; font-size: 1.05rem; letter-spacing: .01em; }

/* Cards — thickness, gradient, hover, deal, flip */
.playing-card {
  width: 4.5rem; height: 6.3rem;
  border-radius: .38rem;
  box-shadow:
    0 1px 0 rgba(255,255,255,.5),
    0 2px 0 #c9b896,
    0 3px 0 #a8946a,
    0 8px 16px rgba(0,0,0,.32);
  background: linear-gradient(180deg, #fffef9 0%, #f6eed8 100%);
  transition: transform .22s ease, box-shadow .22s ease;
  transform-origin: center bottom;
}
.playing-card.playable:hover, .playing-card.playable:focus-visible {
  transform: translateY(-8px);
  box-shadow: 0 1px 0 #fff, 0 10px 22px rgba(0,0,0,.38);
  z-index: 3;
}
.playing-card.selected { transform: translateY(-12px); }
.playing-card.deal-in { animation: dealIn .4s ease backwards; }
@keyframes dealIn {
  from { transform: translateY(-28px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.playing-card .court-art { position: absolute; inset: 12% 10% 8%; overflow: hidden; }
.playing-card .court-art svg { width: 100%; height: 100%; }
.card-fly {
  position: fixed; z-index: 80; pointer-events: none;
  transition: left .45s cubic-bezier(.2,.7,.2,1), top .45s cubic-bezier(.2,.7,.2,1), transform .45s ease;
}

/* Durak table furniture */
.durak-table { display: flex; flex-direction: column; gap: .8rem; position: relative; }
.durak-mid {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  flex-wrap: wrap;
}
.durak-stock {
  position: relative; width: 7.2rem; height: 5.6rem; flex: 0 0 auto;
}
.durak-stock .trump-peek {
  position: absolute; left: 0; top: 18%;
  transform: rotate(-90deg);
  transform-origin: center center;
  box-shadow: 0 4px 10px rgba(0,0,0,.35);
}
.durak-stock .stock-backs { position: absolute; right: .2rem; top: .35rem; }
.durak-stock .stock-backs .playing-card { position: absolute; right: 0; }
.durak-stock .stock-count {
  position: absolute; right: -0.2rem; bottom: -0.2rem;
  background: #1b2a41; color: #e8d48b; border-radius: 999px;
  min-width: 1.8rem; height: 1.8rem; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .8rem; border: 1px solid #e8d48b;
  z-index: 4;
}
.durak-discard { position: relative; min-width: 4.5rem; min-height: 5.6rem; }
.durak-discard .playing-card { position: absolute; top: 0; }
.durak-pairs { display: flex; flex: 1; flex-wrap: wrap; justify-content: center; gap: .6rem; min-height: 6rem; }
.atk-pair { position: relative; width: 5.2rem; min-height: 6.2rem; }
.atk-pair .playing-card:nth-child(2) { position: absolute; left: 1.1rem; top: 1.2rem; transform: rotate(12deg); }

/* Felt depth */
.felt-table {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255,255,255,.08), transparent 50%),
    repeating-linear-gradient(135deg, rgba(255,255,255,.03) 0 2px, transparent 2px 8px),
    linear-gradient(180deg, var(--felt) 0%, var(--felt-dark) 100%);
  box-shadow: inset 0 0 0 3px rgba(232,212,139,.18), inset 0 0 60px rgba(0,0,0,.28), var(--shadow);
}

/* Chess / checkers — wood frame, bevel, grain */
.chess-board-wrap {
  display: flex; justify-content: center; padding: .6rem;
}
.chess-board, .checkers-board {
  width: min(92vw, 28rem);
  max-width: 100%;
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  border: 14px solid #5a3a1e;
  border-radius: 4px;
  box-shadow:
    0 0 0 3px #c9a22755,
    0 0 0 10px #3a2414,
    inset 0 2px 0 rgba(255,255,255,.15),
    0 16px 30px rgba(0,0,0,.45);
  background: #3a2414;
}
.sq.light {
  background:
    repeating-linear-gradient(90deg, rgba(90,50,20,.05) 0 1px, transparent 1px 6px),
    linear-gradient(145deg, #f3e6c4, #dcc896);
}
.sq.dark {
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,.1) 0 1px, transparent 1px 6px),
    linear-gradient(145deg, #8a5a32, #5a3a1e);
}
.sq.last { box-shadow: inset 0 0 0 3px rgba(232, 180, 60, .85); background-image: linear-gradient(145deg, rgba(232,180,60,.28), rgba(232,180,60,.08)); }
.sq.sel { outline: 3px solid #e8d48b; outline-offset: -3px; }
.piece { width: 86%; height: 86%; display: flex; align-items: center; justify-content: center; }
.piece .chess-svg, .piece svg { width: 100%; height: 100%; display: block; filter: drop-shadow(1px 2px 0 rgba(0,0,0,.45)); }
.fen-line { display: none; } /* hide raw FEN in the polished UI */

/* Dice — slight resting tilt so the cube reads as 3D */
.dice-3d {
  perspective: 320px;
  width: 3.6rem; height: 3.6rem;
  margin: .4rem;
  filter: drop-shadow(0 8px 8px rgba(0,0,0,.35));
}
.d3-cube { transform-style: preserve-3d; }
.d3-face {
  background: linear-gradient(145deg, #fffdf6, #e8e0d0);
  box-shadow: inset 0 0 0 1px #fff, inset 0 0 8px rgba(0,0,0,.08);
}
.dice-3d:not(.rolling) .d3-cube { /* applied via JS too */ }

/* Nardy — triangular inlaid points */
.nardy-board {
  background:
    linear-gradient(90deg, #3a2414 0 8px, transparent 8px),
    linear-gradient(#4a2e1c, #2a1810);
  border: 12px solid #2a1810;
  box-shadow: 0 0 0 3px #c9a22766, 0 16px 32px rgba(0,0,0,.45), inset 0 0 20px rgba(0,0,0,.35);
}
.nardy-pt {
  background: none !important;
  overflow: visible;
}
.nardy-pt::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.nardy-row.top .nardy-pt.darkt::before {
  clip-path: polygon(50% 100%, 0 0, 100% 0);
  background: linear-gradient(to bottom, #8b1e2d, #4a1018);
}
.nardy-row.top .nardy-pt.lightt::before {
  clip-path: polygon(50% 100%, 0 0, 100% 0);
  background: linear-gradient(to bottom, #efe0b8, #c9b07a);
}
.nardy-row.bot .nardy-pt.darkt::before {
  clip-path: polygon(50% 0, 0 100%, 100% 100%);
  background: linear-gradient(to top, #8b1e2d, #4a1018);
}
.nardy-row.bot .nardy-pt.lightt::before {
  clip-path: polygon(50% 0, 0 100%, 100% 100%);
  background: linear-gradient(to top, #efe0b8, #c9b07a);
}
.nardy-pt, .nardy-bar { min-height: 8.6rem; height: 8.6rem; }
.nardy-stack { z-index: 1; height: 100%; overflow: visible; }
.nardy-man {
  width: 78%;
  max-width: 1.55rem;
  margin: -11px 0 0;
  box-shadow: 0 2px 0 rgba(0,0,0,.4), inset 0 4px 0 rgba(255,255,255,.28), inset 0 -3px 6px rgba(0,0,0,.25);
}
.nardy-row.top .nardy-man:first-child { margin-top: 1px; }
.nardy-row.bot .nardy-man { margin: 0 0 -11px; }
.nardy-row.bot .nardy-man:first-child { margin-bottom: 1px; }

/* Ludo polish */
.ludo-board {
  border: 8px solid #1b2a41;
  box-shadow: 0 0 0 3px #e8d48b44, 0 14px 28px rgba(0,0,0,.4);
  background: #0e1520;
}
.ludo-cell { border: 1px solid rgba(0,0,0,.15); }
.ludo-cell.path { background: #f6f1e4; }
.ludo-cell.ludo-center {
  background: conic-gradient(#c0392b 0 90deg, #2471a3 90deg 180deg, #d4ac0d 180deg 270deg, #1e8449 270deg 360deg);
}
.ludo-tok { box-shadow: 0 2px 2px rgba(0,0,0,.4), inset 0 3px 0 rgba(255,255,255,.4); }

/* Sudoku / crossword elegance */
.sudoku-board {
  margin: 0 auto;
  background: #f7f1e4;
  border: 8px solid #1b2a41;
  border-radius: 6px;
  box-shadow: 0 10px 24px rgba(0,0,0,.28);
  width: min(94vw, 28rem);
}
.su-cell { background: #fbf7ee; }
.su-n { font-family: var(--font-display); font-size: 1.35rem; color: #1b2a41; font-weight: 600; }
.su-cell.given .su-n { color: #111; font-weight: 700; }
.su-key {
  min-height: var(--tap);
  background: linear-gradient(180deg, #fffdf6, #e8e0d0);
  color: #1b2a41 !important;
  border: 1px solid #c9b896;
  border-radius: 8px;
  font-weight: 700;
  font-size: 1.15rem;
  box-shadow: 0 2px 0 #c9b896;
}
.su-key.wide { font-size: .9rem; }
.su-key.active { border-color: var(--gold-dim); box-shadow: inset 0 0 0 2px var(--gold); }
.sudoku-pad { margin: .8rem auto 0; max-width: 28rem; }
.cw-cell { font-family: var(--font-display); background: #fbf7ee; color: #1b2a41; border: 1px solid #1b2a41; }

/* Bots */
.bot-avatar {
  box-shadow: 0 3px 0 rgba(0,0,0,.25);
  border-radius: 50%;
}
.speech-bubble {
  animation: pop .35s ease;
  border: 1px solid #e8d48b55;
}

/* Puzzle shells */
.puzzle-shell { display: flex; flex-direction: column; gap: .7rem; align-items: center; }
.puzzle-toolbar { display: flex; flex-wrap: wrap; gap: .4rem; width: 100%; align-items: center; }

/* 15-puzzle */
.fifteen-board {
  display: grid; gap: .35rem; width: min(92vw, 22rem); aspect-ratio: 1;
  background: #1b2a41; padding: .45rem; border-radius: 10px;
  box-shadow: 0 10px 24px rgba(0,0,0,.3);
}
.fifteen-tile {
  background: linear-gradient(180deg, #e8d48b, #c9a227);
  color: #1b2a41; font-family: var(--font-display); font-weight: 700;
  font-size: clamp(1.2rem, 6vw, 2rem);
  border: 0; border-radius: 8px; cursor: pointer;
  box-shadow: inset 0 2px 0 #fff8, 0 3px 0 #8a6a18;
  min-height: var(--tap);
}
.fifteen-tile.empty { background: transparent; box-shadow: none; cursor: default; }
.fifteen-tile.playable { box-shadow: inset 0 2px 0 #fff8, 0 3px 0 #8a6a18, 0 0 0 2px #fff4; }

/* Minesweeper */
.mine-board { display: grid; gap: 1px; background: #2a4a3c; border: 6px solid #1b2a41; margin: 0 auto; }
.mine-cell {
  width: 1.85rem; height: 1.85rem; min-width: 1.85rem; min-height: 1.85rem;
  background: linear-gradient(#8aa07a, #6b805c); border: 0; color: #111; font-weight: 700; padding: 0;
  font-size: .9rem;
}
.mine-cell.open { background: #dce6cc; }
.mine-cell.boom { background: #c0392b; }
.mine-cell.flag { color: #8b1e2d; }

/* 2048 */
.g2048-board {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: .45rem;
  width: min(92vw, 22rem); background: #bbada0; padding: .55rem; border-radius: 10px;
}
.g2048-cell {
  aspect-ratio: 1; border-radius: 6px; background: #cdc1b4;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; color: #776e65;
}
.g2048-cell.t2{background:#eee4da} .g2048-cell.t4{background:#ede0c8}
.g2048-cell.t8{background:#f2b179;color:#fff} .g2048-cell.t16{background:#f59563;color:#fff}
.g2048-cell.t32{background:#f67c5f;color:#fff} .g2048-cell.t64{background:#f65e3b;color:#fff}
.g2048-cell.t128{background:#edcf72;color:#fff;font-size:1.3rem}
.g2048-cell.t256{background:#edcc61;color:#fff;font-size:1.3rem}
.g2048-cell.t512{background:#edc850;color:#fff;font-size:1.2rem}
.g2048-cell.t1024,.g2048-cell.t2048{background:#edc22e;color:#fff;font-size:1.05rem}

/* Match-3 */
.match3-board { display: grid; gap: 3px; background: #1b1220; padding: 6px; border-radius: 10px; width: min(92vw, 24rem); }
.match3-cell { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 8px; background: #24182c; }
.match3-cell.sel { outline: 2px solid #e8d48b; }
.match3-cell svg { width: 78%; height: 78%; }

/* Nonogram */
.nono-grid { border-collapse: collapse; margin: 0 auto; }
.nono-grid td, .nono-grid th { border: 1px solid #4a4038; width: 1.5rem; height: 1.5rem; text-align: center; font-size: .75rem; font-weight: 700; padding: 0; }
.nono-grid th { background: transparent; color: var(--ivory); font-weight: 600; }
.nono-cell { background: #f7f1e4; cursor: pointer; }
.nono-cell.fill { background: #1b2a41; }
.nono-cell.mark { background: #f7f1e4; color: #8b1e2d; }

/* Word search */
.ws-grid { display: grid; margin: 0 auto; gap: 2px; background: #1b2a41; padding: 4px; border-radius: 8px; width: max-content; max-width: 100%; }
.ws-cell {
  width: var(--ws-cell, 1.7rem); height: var(--ws-cell, 1.7rem); display: flex; align-items: center; justify-content: center;
  background: #f7f1e4; color: #1b2a41; font-weight: 700; cursor: pointer; user-select: none;
  box-sizing: border-box;
  font-size: clamp(.6rem, calc(var(--ws-cell, 1.7rem) * .5), .95rem);
}
.ws-cell.on { background: #e8d48b; }
.ws-cell.found { background: #5dbe8a; color: #0a2a21; }
.ws-list { display: flex; flex-wrap: wrap; gap: .4rem .8rem; justify-content: center; }
.ws-list .got { text-decoration: line-through; opacity: .55; }

/* Hanoi */
.hanoi-row { display: flex; justify-content: space-around; align-items: flex-end; width: min(96vw, 36rem); min-height: 16rem; }
.hanoi-peg {
  flex: 1; display: flex; flex-direction: column-reverse; align-items: center;
  min-height: 16rem; cursor: pointer; position: relative; padding-bottom: 1rem;
}
.hanoi-peg::before {
  content: ""; position: absolute; bottom: 1.4rem; width: 8px; height: 12rem;
  background: #c9a227; border-radius: 4px; z-index: 0;
}
.hanoi-peg::after {
  content: ""; position: absolute; bottom: .4rem; width: 80%; height: 14px;
  background: #5a3a18; border-radius: 4px;
}
.hanoi-disc {
  position: relative; z-index: 1; height: 1.35rem; border-radius: 8px;
  margin: 2px 0; box-shadow: inset 0 2px 0 #fff6, 0 2px 0 rgba(0,0,0,.3);
}
.hanoi-peg.sel { filter: brightness(1.15); }

/* Lights out */
.lo-board { display: grid; gap: .35rem; width: min(80vw, 18rem); }
.lo-cell {
  aspect-ratio: 1; border: 0; border-radius: 8px; cursor: pointer; min-height: 48px;
  background: #1a2a30; box-shadow: inset 0 0 0 2px #2a4a50;
}
.lo-cell.on { background: #e8d48b; box-shadow: 0 0 12px #e8d48b88; }

/* Lucky Wheel */
.wheel-wrap { display: flex; flex-direction: column; align-items: center; gap: .8rem; }
.wheel-stage { position: relative; width: min(86vw, 22rem); aspect-ratio: 1; }
.wheel-rotor {
  width: 100%; height: 100%; border-radius: 50%;
  box-shadow: 0 0 0 8px #1b2a41, 0 0 0 12px #e8d48b, 0 16px 28px rgba(0,0,0,.4);
  transition: transform 0s;
  will-change: transform;
  position: relative; overflow: hidden;
}
.wheel-pointer {
  position: absolute; top: -8px; left: 50%; transform: translateX(-50%);
  width: 0; height: 0; border-left: 12px solid transparent; border-right: 12px solid transparent;
  border-top: 22px solid #e8d48b; z-index: 2; filter: drop-shadow(0 2px 2px #0008);
}
.wheel-phrase {
  display: flex; flex-wrap: wrap; justify-content: center; gap: .35rem .5rem;
  max-width: 40rem; font-family: var(--font-display); font-size: 1.6rem;
}
.wheel-letter {
  min-width: 1.7rem; min-height: 2.15rem; text-align: center;
  border: 1px solid #e8d48b66; border-bottom: 3px solid #e8d48b;
  background: #0e1a1488; border-radius: 4px;
  padding: 0 .15rem; color: #e8d48b;
  display: inline-flex; align-items: center; justify-content: center;
}
.wheel-letter.space { border: 0; min-width: .8rem; }
.wheel-letters { display: flex; flex-wrap: wrap; gap: .3rem; justify-content: center; max-width: 36rem; }
.wheel-letters button { min-width: 2.4rem; min-height: var(--tap); }

/* Dominoes */
.domino-table { min-height: 14rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2px; padding: 1rem; }
.domino-tile {
  width: 3.4rem; height: 6.4rem; border-radius: 6px;
  background: linear-gradient(180deg, #fffdf6, #e8e0d0);
  border: 1px solid #c9a227;
  box-shadow: 0 2px 0 #c9b896, 0 6px 10px rgba(0,0,0,.3), inset 0 1px 0 #fff;
  display: flex; flex-direction: column; cursor: pointer;
  flex: 0 0 auto;
}
.domino-tile.hz { width: 6.4rem; height: 3.4rem; flex-direction: row; }
.domino-tile .half { flex: 1; position: relative; }
.domino-tile .bar { height: 2px; background: #1b2a41; }
.domino-tile.hz .bar { width: 2px; height: auto; }
.domino-pip {
  position: absolute; width: 10px; height: 10px; border-radius: 50%;
  background: #1b2a41; transform: translate(-50%,-50%);
  box-shadow: inset 0 1px 0 #fff4, 0 1px 0 #0004;
}
.domino-hand { display: flex; flex-wrap: wrap; gap: .35rem; justify-content: center; }
.domino-tile.playable:hover { transform: translateY(-6px); }

/* Daily XP spin (profile) */
.daily-spin { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; padding: .8rem; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-elev); }

/* Mobile 390-ish */
@media (max-width: 430px) {
  #app { padding: .6rem .6rem 5rem; }
  .app-header { flex-wrap: wrap; gap: .4rem; }
  .hero { padding: .6rem .2rem .8rem; }
  .hero h1 { font-size: 1.7rem; }
  .playing-card { width: 3.5rem; height: 4.9rem; }
  .playing-card.small { width: 2.6rem; height: 3.7rem; }
  .chess-board, .checkers-board { border-width: 8px; }
  .nardy-pt { min-height: 6.4rem; }
  .game-grid { grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); }
  .header-actions .btn { padding: 0 .55rem; font-size: 1rem; }
  .mine-cell { width: 1.55rem; height: 1.55rem; min-width: 1.55rem; min-height: 1.55rem; }
  .wheel-phrase { font-size: 1.25rem; font-weight: 700; }
  .wheel-stage { width: min(76vw, 16.2rem); }
  .wheel-letter { min-width: 1.35rem; min-height: 1.7rem; }
}
.online-side:empty { display: none; }
@media (min-width: 900px) {
  .play-wrap:has(.online-side:not(:empty)) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(14rem, 18rem);
    gap: 1rem;
    align-items: start;
  }
  .play-wrap:has(.online-side:not(:empty)) .play-actions { grid-column: 1 / -1; }
  .play-wrap:has(.online-side:not(:empty)) .felt-table,
  .play-wrap:has(.online-side:not(:empty)) .game-mount { grid-column: 1; }
  .play-wrap:has(.online-side:not(:empty)) .online-side { grid-column: 2; grid-row: 2 / span 3; }
}

@media (max-height: 860px) {
  .sudoku-board { width: min(92vw, 22rem); }
  .su-key { min-height: var(--tap); }
  .nardy-pt, .nardy-bar { min-height: 8.2rem; height: 8.2rem; }
}

/* Wheel hub + mobile nardy fit */
.wheel-rotor::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 18%; height: 18%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f7efd4, #c9a227 55%, #6a5428);
  box-shadow: 0 0 0 3px #1b2a41, 0 2px 6px #0008;
  z-index: 2;
}
@media (max-width: 430px) {
  .nardy-board { border-width: 8px; width: 100%; max-width: 100%; }
  .nardy-pt { min-width: 0; min-height: 6.2rem; height: 6.2rem; }
  .nardy-bar { min-width: 12px; width: 12px; flex: 0 0 12px; min-height: 6.2rem; height: 6.2rem; }
  .nardy-man { max-width: 1.25rem; }
  .ludo-board { width: min(92vw, 20rem); }
}
@media (max-height: 860px) {
  .ludo-board { width: min(92vw, 24rem); }
}
.opp-hand { min-height: 4.2rem; }

/* Compact header on game screens (especially mobile) */
body.in-game .header-compact { flex-wrap: nowrap; align-items: center; gap: .3rem; padding: .3rem .55rem; }
body.in-game .header-compact .brand-title { font-size: 1rem; font-weight: 700; max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.in-game .header-compact img { width: 28px; height: 28px; }
@media (max-width: 430px) {
  body.in-game .header-compact { flex-wrap: wrap; }
  body.in-game .header-compact .brand-title { display: none; }
  body.in-game .header-compact .header-actions { flex-wrap: wrap; gap: .3rem; justify-content: flex-end; }
  body.in-game .header-compact .header-actions .btn { padding: 0 .55rem; font-size: 1rem; min-height: var(--tap); font-weight: 600; }
}
.piece.moving { z-index: 6; will-change: transform; pointer-events: none; }

/* Mahjong solitaire — original tile faces */
.mj-shell { overflow-x: auto; }
.mj-board { position: relative; margin: .4rem auto 1rem; min-height: 12rem; }
.mj-tile {
  position: absolute;
  width: 42px; height: 56px;
  padding: 0; border: 0;
  border-radius: 5px;
  background: linear-gradient(180deg, #f6f0dc 0%, #e6d8b0 100%);
  box-shadow: 2px 3px 0 #3a2a14, inset 0 0 0 1px #cbb98a;
  color: #1b1208;
  display: flex; align-items: center; justify-content: center;
  opacity: .92;
}
.mj-tile.free { opacity: 1; cursor: pointer; filter: brightness(1.06); }
.mj-tile.free:hover { transform: translateY(-2px); }
.mj-tile.sel, .mj-tile.hint { outline: 3px solid #e8c15a; z-index: 80 !important; }
.mj-tile:disabled { cursor: default; }
.mj-face { width: 100%; height: 100%; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2px; padding: 4px; pointer-events: none; }
.mj-dots { display: grid; grid-template-columns: repeat(3, 1fr); place-items: center; }
.mj-dot { width: 7px; height: 7px; border-radius: 50%; background: #b33; box-shadow: inset 0 0 0 1px #7a1d1d; }
.mj-bams { flex-direction: column; gap: 1px; }
.mj-bam { width: 6px; height: 8px; border-radius: 3px; background: #1f7a3a; }
.mj-char { font-family: var(--font-display); font-size: 1.15rem; color: #8b1a1a; font-weight: 700; }
.mj-wind { font-weight: 800; font-size: 1rem; color: #16325c; }
.mj-drag { width: 18px; height: 18px; border-radius: 50%; }
.mj-drag-R { background: #c0392b; }
.mj-drag-G { background: #1e8449; }
.mj-drag-Wh { background: #f4f0e4; box-shadow: inset 0 0 0 2px #2a2a2a; }
.mj-flower { color: #a4286a; font-size: .85rem; font-weight: 700; }
.mj-season { color: #1a5f8a; font-size: .85rem; font-weight: 700; }
@media (max-width: 430px) {
  .mj-tile { width: 34px; height: 46px; }
  .mj-char { font-size: .95rem; }
}


/* Keep bot jokes from covering the turn status */
.game-side { align-items: flex-start; }
.speech-bubble {
  position: relative;
  inset: auto;
  top: auto;
  inset-inline-start: auto;
  max-width: 16rem;
  flex: 0 1 auto;
  z-index: 2;
}
.game-status { position: relative; z-index: 3; }


/* ---- Graphics polish (cards, boards, bones, buttons, felt) ---- */
.playing-card {
  background:
    linear-gradient(165deg, #fffefb 0%, #f7f0de 55%, #efe4c8 100%);
  box-shadow:
    1px 0 0 #d4c4a0,
    0 1px 0 rgba(255,255,255,.65),
    0 2px 0 #c9b896,
    0 3px 0 #a8946a,
    0 8px 16px rgba(0,0,0,.32);
}
.playing-card.face::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(160, 120, 50, .28);
  border-radius: .22rem;
  pointer-events: none;
  z-index: 2;
}
.back-pattern::after {
  content: "";
  position: absolute;
  inset: 12%;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 110'><g fill='none' stroke='%23e8d48b' stroke-width='1.4'><rect x='8' y='10' width='64' height='90' rx='6' opacity='.85'/><path d='M40 22 L52 40 L40 58 L28 40 Z'/><circle cx='40' cy='40' r='8'/><circle cx='40' cy='80' r='10'/></g><path d='M40 74 L43 80 L50 81 L45 86 L46 93 L40 90 L34 93 L35 86 L30 81 L37 80 Z' fill='%23e8d48b' opacity='.9'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: .8;
  pointer-events: none;
}
.felt-table {
  border: 10px solid #3a2414;
  box-shadow:
    0 0 0 3px rgba(201,162,39,.45),
    0 16px 36px rgba(0,0,0,.45),
    inset 0 0 80px rgba(0,0,0,.28),
    inset 0 2px 0 rgba(255,255,255,.08);
}

.man {
  width: 78%;
  aspect-ratio: 1;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: none;
  box-shadow: none;
}
.man svg, .man .checker-svg { width: 100%; height: 100%; display: block; }
.sq.dest { box-shadow: inset 0 0 0 3px #7dcea0; }

.nardy-man.w {
  background: radial-gradient(circle at 32% 28%, #fffaf0, #e8d5a8 38%, #b8944a 72%, #6a4a1c);
  box-shadow: 0 2px 0 rgba(0,0,0,.45), inset 0 0 0 2px rgba(90,60,20,.35), inset 0 4px 0 rgba(255,255,255,.35);
}
.nardy-man.b {
  background: radial-gradient(circle at 32% 28%, #7a7a80, #2a2a30 55%, #0a0a0c);
  box-shadow: 0 2px 0 rgba(0,0,0,.55), inset 0 0 0 2px rgba(220,200,160,.28), inset 0 4px 0 rgba(255,255,255,.18);
}
.nardy-bar {
  background:
    repeating-linear-gradient(180deg, #2a1810 0 3px, #3a2418 3px 6px);
  box-shadow: inset 2px 0 0 #c9a22755, inset -2px 0 0 #c9a22755;
}

.domino-tile {
  background:
    repeating-linear-gradient(90deg, rgba(80,50,20,.05) 0 1px, transparent 1px 5px),
    linear-gradient(180deg, #fffdf8, #efe6d0 70%, #e4d8bc);
  box-shadow: 0 2px 0 #c9b896, 0 6px 12px rgba(0,0,0,.32), inset 0 1px 0 #fff, inset 0 0 0 1px #d8c8a0;
}
.domino-pip {
  width: 11px; height: 11px;
  background: radial-gradient(circle at 35% 32%, #3a4a58, #0e1a24 58%, #000);
  box-shadow: inset 0 1px 1px rgba(0,0,0,.45), 0 1px 0 rgba(255,255,255,.45);
}

.ludo-tok {
  box-shadow: 0 2px 2px rgba(0,0,0,.45), inset 0 3px 0 rgba(255,255,255,.45), inset 0 -3px 4px rgba(0,0,0,.2);
}

.game-thumb {
  box-shadow: inset 0 0 0 1px rgba(232,212,139,.22), 0 2px 0 rgba(0,0,0,.25);
}

/* Keep type sharp: no blur filters or fractional scales on text. */
.speech-bubble, .toast, .brand-title, .hero h1, .section-title, .game-status, .btn, .game-card h3 {
  text-shadow: none;
}
.hero h1 { text-shadow: 0 1px 0 rgba(0,0,0,.45); }

@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
  .playing-card, .game-card, .btn, .icon-btn { transition: none !important; }
}


/* ===== Lucky Wheel — original studio-show presentation ===== */
.wheel-show { gap: .65rem; width: 100%; max-width: 40rem; margin: 0 auto; }
.wheel-show .wheel-scores { display: flex; flex-wrap: wrap; gap: .35rem; justify-content: center; }
.wheel-score {
  min-height: 2rem; padding: .2rem .7rem; border-radius: 999px;
  background: #141c38; color: #fff6d8; border: 1px solid #e8c86a;
  font-weight: 700; font-size: .95rem;
}
.wheel-score.on { background: #e8b020; color: #1a1208; box-shadow: 0 0 10px #e8b020aa; }
.wheel-board {
  width: 100%;
  background:
    radial-gradient(ellipse at 50% 0%, #2a4a8c 0%, #122048 45%, #0a1228 100%);
  border: 6px solid #d4af37;
  box-shadow:
    0 0 0 3px #7a5a18,
    0 0 0 8px #1a1230,
    inset 0 0 40px rgba(0,0,0,.35),
    0 12px 28px rgba(0,0,0,.45);
  border-radius: 14px;
  padding: .45rem .5rem .7rem;
  position: relative;
}
.wheel-bulbs { display: flex; justify-content: space-between; gap: 3px; padding: .15rem .2rem; }
.wheel-bulb {
  width: 10px; height: 10px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6c8, #f0c020 45%, #a07010);
  box-shadow: 0 0 6px #f0c020cc;
  animation: wbulb 1.2s ease-in-out infinite;
}
.wheel-bulb.alt { animation-delay: .6s; background: radial-gradient(circle at 35% 30%, #fff, #7ec8ff 50%, #1a5a9a); box-shadow: 0 0 6px #7ec8ffaa; }
@keyframes wbulb { 0%,100%{ opacity: 1; } 50%{ opacity: .45; } }
.wheel-show .wheel-phrase {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end;
  gap: .45rem .55rem; padding: .55rem .2rem .4rem; font-size: 1.45rem;
}
.wheel-word { display: inline-flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.wheel-show .wheel-letter {
  --tile-w: 1.85rem;
  width: var(--tile-w); min-width: var(--tile-w); height: 2.25rem;
  border: 2px solid #8ad0e8;
  background: linear-gradient(180deg, #0b3a6a, #07284a);
  color: #102030;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px #041428, 0 2px 0 #041020;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0;
  transform: rotateY(0deg);
  transition: transform .35s ease, background .3s ease, color .3s ease;
}
.wheel-show .wheel-letter.on {
  background: linear-gradient(180deg, #fffef6, #e8f2ff);
  color: #102040;
  border-color: #f2d56a;
  box-shadow: inset 0 1px 0 #fff, 0 2px 0 #8a6a20, 0 0 8px #f2d56a66;
  animation: wflip .4s ease;
}
.wheel-show .wheel-letter.space {
  width: .7rem; min-width: .7rem; height: 2.25rem;
  border: 0; background: transparent; box-shadow: none;
}
.wheel-show .wheel-letter.punct { background: transparent; border: 0; box-shadow: none; color: #f2d56a; }
@keyframes wflip { from { transform: rotateY(90deg); } to { transform: none; } }
.wheel-board.win { box-shadow: 0 0 0 3px #7a5a18, 0 0 0 8px #1a1230, 0 0 28px #f0c020aa, 0 12px 28px rgba(0,0,0,.45); }
.wheel-show .wheel-stage {
  position: relative;
  width: min(82vw, 20.5rem);
  aspect-ratio: 1;
  margin: .2rem auto 0;
  filter: drop-shadow(0 16px 20px rgba(0,0,0,.5));
}
.wheel-rim-lights {
  position: absolute; inset: -10px; border-radius: 50%; pointer-events: none; z-index: 3;
}
.wheel-rim-bulb {
  position: absolute; left: 50%; top: 50%; width: 9px; height: 9px; margin: -4px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #ffe27a 45%, #c9a020);
  box-shadow: 0 0 8px #ffe27acc;
  transform-origin: 0 0;
  animation: wbulb 0.9s linear infinite;
}
.wheel-rim-bulb:nth-child(odd) { animation-delay: .45s; }
.wheel-show .wheel-rotor {
  width: 100%; height: 100%; border-radius: 50%;
  box-shadow:
    0 0 0 10px #3a220c,
    0 0 0 14px #f0d48a,
    0 0 0 18px #7a5218,
    0 4px 0 #2a1608,
    0 18px 30px rgba(0,0,0,.5);
  overflow: hidden;
  position: relative;
}
.wheel-face { width: 100%; height: 100%; position: absolute; inset: 0; pointer-events: none; }
.wheel-show .wheel-rotor::after {
  content: "";
  position: absolute; left: 50%; top: 50%;
  width: 22%; height: 22%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #fff7d0, #f0c020 40%, #8a5a10 72%, #3a2408);
  box-shadow: 0 0 0 4px #1a1008, 0 0 0 7px #f0d48a, 0 3px 8px #0009;
  z-index: 2;
}
.wheel-show .wheel-pointer {
  position: absolute; top: -6px; left: 50%; z-index: 4;
  width: 22px; height: 34px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #fff3b0, #e8b020 45%, #8a5a10);
  clip-path: polygon(50% 100%, 0 0, 100% 0);
  filter: drop-shadow(0 3px 2px #0008);
  transform-origin: 50% 0;
}
.wheel-show .wheel-pointer.tick { animation: wtick .08s linear; }
@keyframes wtick { 50% { transform: translateX(-50%) rotate(-12deg); } }
.wheel-show .wheel-letters { max-width: 38rem; gap: .28rem; }
.wheel-show .wheel-key { min-width: 2.15rem; font-weight: 800; }
.wheel-show .wheel-key.vowel { border-color: #e8b020; color: #e8b020; }
.wheel-solve-box { display: flex; flex-wrap: wrap; gap: .35rem; justify-content: center; width: 100%; }
.wheel-solve-input {
  min-height: var(--tap); min-width: 12rem; flex: 1 1 12rem; max-width: 22rem;
  border-radius: 10px; border: 1px solid #e8c86a; background: #0e1630; color: #fff8e8;
  padding: 0 .8rem; font-size: 1rem;
}
@media (max-width: 430px) {
  .wheel-show .wheel-stage { width: min(78vw, 16.8rem); }
  .wheel-show .wheel-letter { --tile-w: 1.45rem; height: 1.9rem; font-size: 1.05rem; }
  .wheel-show .wheel-phrase { font-size: 1.15rem; gap: .35rem .4rem; }
  .wheel-show .wheel-key { min-width: 1.95rem; }
  .wheel-board { border-width: 4px; }
}
@media (max-width: 380px) {
  .wheel-show .wheel-stage { width: min(86vw, 15.2rem); }
  .wheel-show .wheel-letter { --tile-w: 1.28rem; height: 1.75rem; }
}
@media (prefers-reduced-motion: reduce) {
  .wheel-bulb, .wheel-rim-bulb, .wheel-show .wheel-letter.on, .wheel-show .wheel-pointer.tick { animation: none; }
  .wheel-show .wheel-letter { transition: none; }
}
[data-gfx="low"] .wheel-bulb, [data-gfx="low"] .wheel-rim-bulb { animation: none; }
[data-gfx="low"] .wheel-show .wheel-stage { filter: none; }


/* v14 — Lucky Wheel clue plaque + always-on vowel row */
.wheel-clue {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .45rem .7rem;
  flex-wrap: wrap;
  padding: .55rem .75rem;
  border-radius: 14px;
  background:
    linear-gradient(180deg, #ffe58a 0%, #e8b020 48%, #c49214 100%);
  color: #1a1208;
  border: 2px solid #fff6c8;
  box-shadow:
    0 0 0 3px #6a4a14,
    0 8px 18px rgba(0,0,0,.4);
  position: relative;
  z-index: 4;
}
.wheel-clue-label {
  font-size: .72rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  font-weight: 800;
  color: #4a3008;
}
.wheel-clue-text {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: .04em;
  color: #1a1208;
  line-height: 1.15;
}
.wheel-clue-speak {
  min-width: 2.6rem;
  min-height: 2.6rem;
  border-radius: 999px;
  border: 2px solid #4a3008;
  background: #1b2a41;
  color: #ffe58a;
  font-size: 1.15rem;
  cursor: pointer;
  box-shadow: 0 2px 0 #0a1018;
}
.wheel-clue-speak:focus-visible { outline: 3px solid #1b2a41; outline-offset: 2px; }
.wheel-show .game-status {
  color: #fff6d8;
  text-align: center;
  font-size: 1.02rem;
}
.wheel-letter-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .28rem;
  width: 100%;
}
.wheel-letter-row.vows {
  margin-top: .35rem;
  padding: .45rem .4rem .4rem;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(232,176,32,.2), rgba(16,14,32,.72));
  border: 1px solid #e8c86a;
}
.wheel-vowel-label {
  width: 100%;
  text-align: center;
  font-weight: 800;
  font-size: .78rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #f0d48a;
  margin-bottom: .15rem;
}
.wheel-show .wheel-key.vowel {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  min-width: 2.35rem;
  min-height: 2.7rem;
  padding: .2rem .28rem .15rem;
  line-height: 1.05;
  background: linear-gradient(180deg, #3a2a10, #1a1408);
  border: 2px solid #e8b020;
  color: #ffe9a0;
  box-shadow: inset 0 1px 0 rgba(255,240,180,.25);
}
.wheel-key-cost {
  display: block;
  font-size: .6rem;
  font-weight: 700;
  color: #f0d48a;
  letter-spacing: .02em;
  line-height: 1;
}
.wheel-show .wheel-key.vowel:disabled,
.wheel-show .wheel-key.vowel.is-disabled {
  opacity: 1;
  color: #d4b878;
  border-color: #8a6a28;
  background: #1a140c;
  filter: none;
  cursor: not-allowed;
}
.wheel-show .wheel-key.vowel:disabled .wheel-key-cost { color: #a89050; }
.wheel-show .wheel-key.used {
  text-decoration: line-through;
  opacity: .7;
}
.wheel-show .wheel-key.cons:disabled {
  opacity: .45;
}
@media (max-width: 430px) {
  .wheel-show { gap: .4rem; }
  .wheel-clue { padding: .4rem .55rem; }
  .wheel-clue-text { font-size: 1.18rem; }
  .wheel-clue-label { font-size: .68rem; }
  .wheel-show .game-status { margin: 0; font-size: .95rem; }
  .wheel-score { min-height: 1.7rem; padding: .12rem .55rem; font-size: .85rem; }
  .wheel-board { padding: .3rem .35rem .4rem; }
  .wheel-show .wheel-phrase { padding: .28rem .12rem .18rem; }
  .wheel-show .wheel-letters { gap: .18rem; }
  .wheel-letters button,
  .wheel-show .wheel-key {
    min-width: 1.7rem;
    min-height: 2rem;
    font-size: .88rem;
    padding: .12rem .1rem;
  }
  .wheel-show .wheel-key.vowel { min-width: 1.68rem; min-height: 2.05rem; padding: .08rem .12rem .06rem; }
  .wheel-letter-row.vows { padding: .28rem .28rem .22rem; }
}
@media (max-width: 360px) {
  .wheel-show { gap: .3rem; }
  .wheel-clue { padding: .32rem .4rem; }
  .wheel-clue-text { font-size: 1.08rem; }
  .wheel-show .wheel-stage { width: min(78vw, 12.4rem); }
  .wheel-letters button,
  .wheel-show .wheel-key {
    min-width: 1.5rem;
    min-height: 1.85rem;
    font-size: .8rem;
  }
  .wheel-show .wheel-key.vowel { min-width: 1.48rem; min-height: 1.95rem; }
  .wheel-key-cost { font-size: .5rem; }
  .wheel-vowel-label { font-size: .66rem; margin-bottom: 0; letter-spacing: .08em; }
}


/* v15 — flatten boards on touch so pieces sit on their hit squares,
   and make legal targets / domino ends obvious. */
/* Flatten playable surfaces so a tap/click lands on the piece the player sees
   (3D tilt offset the hit box on both touch and mouse). */
[data-gfx="high"] .chess-board,
[data-gfx="high"] .chess-board.flipped,
[data-gfx="high"] .checkers-board,
[data-gfx="high"] body.in-game .nardy-board,
[data-gfx="high"] body.in-game .game-mount.felt-table,
[data-gfx="high"] .poker-setup.felt-table,
[data-gfx="high"] .sudoku-board,
[data-gfx="high"] .fifteen-board,
[data-gfx="high"] .g2048-board,
[data-gfx="high"] .mine-board,
[data-gfx="high"] .ws-grid,
[data-gfx="high"] .crossword-grid,
[data-gfx="high"] .nono-grid,
[data-gfx="high"] .match3-board,
[data-gfx="high"] .hanoi-stage,
[data-gfx="high"] .lo-grid,
[data-gfx="high"] .mj-board {
  transform: none !important;
}
[data-gfx="high"] .piece,
[data-gfx="high"] .man,
[data-gfx="high"] .nardy-man,
[data-gfx="high"] .chess-board.flipped .piece,
[data-gfx="high"] .chess-board.flipped .man {
  transform: none !important;
}
.piece, .man { pointer-events: none; }
.sq {
  touch-action: manipulation;
  min-height: 2rem;
}
.sq.dest {
  box-shadow: inset 0 0 0 3px #7dcea0, inset 0 0 16px rgba(125, 206, 160, .35);
}
.sq.dest .dot {
  width: 28%;
  height: 28%;
  background: #1d5c3a;
  box-shadow: 0 0 0 3px rgba(255,246,200,.85);
}
.sq.cap {
  box-shadow: inset 0 0 0 3px #c45, inset 0 0 14px rgba(180,40,40,.28);
}
.game-status.is-your-turn {
  color: #fff6d0;
  font-weight: 800;
}
.game-status.is-your-turn::before { content: "● "; color: #7dcea0; }
.game-status.is-bot-turn { opacity: .9; }
.game-status.is-bot-turn::before { content: "● "; color: #c9a227; }
[data-gfx="high"] .mj-tile,
.mj-tile.free:hover { transform: none !important; }
.mj-tile { touch-action: manipulation; }
.domino-tile.playable {
  outline: 2px solid #e8c86a;
  box-shadow: 0 0 0 2px rgba(232,200,106,.35), 0 6px 12px rgba(0,0,0,.28);
}
.domino-tile.selected,
.domino-tile.playable.selected {
  outline: 3px solid #fff3b0;
  transform: translateY(-6px);
}
.domino-tile.drop-target,
.domino-tile.chain-end.drop-target {
  outline: 3px solid #7dcea0;
  box-shadow: 0 0 0 3px rgba(125,206,160,.45), 0 8px 16px rgba(0,0,0,.3);
  cursor: pointer;
}
.domino-start-slot {
  margin: .6rem auto;
  display: block;
}
.domino-hand { touch-action: manipulation; }
.domino-chain-row { display: flex; flex-wrap: wrap; gap: 2px; width: 100%; }
/* 3D tilt + a position:absolute ::after without a containing block ate taps —
   events landed on .domino-hand instead of the tile. Keep thickness via shadow. */
.domino-tile {
  position: relative;
  z-index: 1;
  touch-action: manipulation;
}
[data-gfx="high"] .domino-table,
[data-gfx="high"] .domino-tile,
[data-gfx="high"] .domino-tile.playable:hover,
[data-gfx="high"] .domino-tile.playable:focus-visible,
[data-gfx="high"] .domino-tile.selected,
.domino-tile.playable:hover {
  transform: none !important;
}
[data-gfx="high"] .domino-tile::after,
.domino-tile::after {
  pointer-events: none !important;
}

/* v15 packs — theme picker + on-screen letter pad */
.pack-picker {
  display: flex; flex-wrap: wrap; gap: .35rem;
  justify-content: center; padding: .35rem .2rem .55rem;
  max-width: 40rem; margin: 0 auto;
}
.pack-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 3.6rem; min-height: 3.4rem; padding: .25rem .35rem;
  border: 1px solid var(--line, #c9a22755);
  border-radius: 10px;
  background: rgba(20,16,10,.35);
  color: #fff6d0;
  cursor: pointer;
  touch-action: manipulation;
  font: inherit;
}
.pack-tile .pack-icon { font-size: 1.25rem; line-height: 1; }
.pack-tile .pack-name { font-size: .68rem; font-weight: 700; margin-top: .15rem; max-width: 4.8rem; text-align: center; line-height: 1.15; }
.pack-tile.is-on {
  outline: 2px solid #e8c86a;
  background: rgba(232,200,106,.18);
  box-shadow: 0 0 0 2px rgba(232,200,106,.25);
}
.letter-pad {
  display: flex; flex-direction: column; gap: .28rem;
  padding: .45rem .3rem .7rem;
  max-width: 28rem; margin: .3rem auto 0;
  touch-action: manipulation;
}
.letter-pad-row, .letter-pad-acts {
  display: flex; flex-wrap: wrap; gap: .22rem; justify-content: center;
}
.letter-key {
  min-width: 1.85rem; min-height: 2.15rem;
  padding: 0 .2rem;
  border: 1px solid #c9a22788;
  border-radius: 7px;
  background: linear-gradient(180deg, #fffdf4, #efe4c4);
  color: #1b1208;
  font-weight: 800; font-size: .95rem;
  cursor: pointer;
  touch-action: manipulation;
}
.letter-key.wide { min-width: 4.2rem; }
.letter-key.primary, .letter-enter {
  background: linear-gradient(180deg, #e8c86a, #c9a227);
  color: #1b1208;
}
.cw-cell[role="button"], .cw-cell.tap {
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; touch-action: manipulation;
  user-select: none;
}
.rebus-slots {
  display: flex; flex-wrap: wrap; gap: .25rem; justify-content: center;
  min-height: 2.2rem; margin: .4rem 0;
  font-weight: 800; letter-spacing: .08em; font-size: 1.15rem;
}
.rebus-slots .slot {
  min-width: 1.35rem; min-height: 1.8rem;
  border-bottom: 2px solid #c9a227;
  text-align: center;
}
@media (max-width: 430px) {
  .letter-key { min-width: 1.45rem; min-height: 1.65rem; font-size: .8rem; padding: 0 .12rem; }
  .letter-key.wide { min-width: 3.4rem; }
  .letter-pad { gap: .12rem; padding: .2rem .15rem .25rem; margin-top: .1rem; }
  .letter-pad-row, .letter-pad-acts { gap: .12rem; }
  .pack-tile { min-width: 3.2rem; min-height: 3.1rem; }
}
@media (max-height: 900px) and (max-width: 500px) {
  .letter-key { min-width: 1.4rem; min-height: 1.55rem; font-size: .78rem; }
  .cw-pad-host, .sw-pad-host, .rebus-pad-host { padding: .15rem .2rem .2rem; }
  .crossword-shell, .scanword-shell, .rebus-shell { height: 100%; max-height: 100%; }
}


/* Keep in-game action buttons (draw, play left/right) tappable on short desktops */
.game-shell > .play-actions {
  position: sticky;
  bottom: 0;
  z-index: 8;
  background: linear-gradient(180deg, transparent, rgba(8, 18, 14, .92) 28%);
  padding-top: .55rem;
  padding-bottom: max(.45rem, calc(env(safe-area-inset-bottom, 0px) + var(--host-safe-bottom, 2.6rem)));
}

/* Domino dock: hand + turn actions stay above the fold and never sit under buttons. */
.game-shell.domino-shell {
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: .45rem;
}
.domino-rules {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  justify-content: center;
  padding: .1rem .2rem .2rem;
}
.domino-rules .btn.is-on {
  outline: 2px solid #e8c86a;
  background: rgba(232, 200, 106, .18);
}
.game-shell.domino-shell .domino-table {
  flex: 1 1 auto;
  min-height: 8rem;
  max-height: min(42vh, 22rem);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.domino-dock {
  position: sticky;
  bottom: 0;
  z-index: 16;
  background: linear-gradient(180deg, transparent, rgba(8, 18, 14, .94) 16%, rgba(8, 18, 14, .98));
  padding: .35rem .15rem max(.55rem, env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -10px 22px rgba(0, 0, 0, .32);
}
.domino-dock .domino-hand,
.domino-dock .play-actions {
  position: relative;
  z-index: 17;
}
.domino-dock .play-actions {
  justify-content: center;
  min-height: 0;
}
@media (max-width: 430px) {
  .domino-dock .domino-hand .domino-tile:not(.hz) {
    width: 3rem;
    height: 5.6rem;
  }
}

.g2048-pad { display: flex; gap: .35rem; justify-content: center; width: 100%; margin-top: .35rem; }
.g2048-dir { min-width: 3rem; min-height: 2.6rem; font-size: 1.15rem; }
.sudoku-shell { display: flex; flex-direction: column; min-height: 0; width: 100%; overflow: hidden; }
.sudoku-shell > .sudoku-wrap { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; width: 100%; }
.sudoku-pad {
  position: relative;
  flex: 0 0 auto;
  z-index: 8;
  margin: .25rem auto 0;
  padding-bottom: .3rem;
  background: linear-gradient(180deg, transparent, rgba(8,18,14,.94) 18%);
}
.mine-shell { display: flex; flex-direction: column; min-height: 0; width: 100%; overflow: hidden; }
.mine-shell > .mine-board {
  flex: 0 0 auto;
  margin: .2rem auto 0;
}
.mine-cell {
  width: var(--mine-cell, 1.85rem);
  height: var(--mine-cell, 1.85rem);
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
}




/* Dock puzzle letter pads inside the visible play-wrap. play-wrap has perspective,
   which traps position:fixed to the tall content box, so we fill the wrap with a
   column flex and keep the pad in-flow at the bottom. The board/clues scroll.
   Compact the theme picker and toolbar on narrow screens so the grid is not crushed. */
body.in-game .play-wrap:has(.crossword-shell),
body.in-game .play-wrap:has(.rebus-shell),
body.in-game .play-wrap:has(.scanword-shell) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body.in-game .play-wrap:has(.crossword-shell) .game-mount,
body.in-game .play-wrap:has(.rebus-shell) .game-mount,
body.in-game .play-wrap:has(.scanword-shell).game-mount,
body.in-game .play-wrap:has(.scanword-shell) .game-mount,
.crossword-shell,
.rebus-shell,
.scanword-shell {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.crossword-shell > .cw-board,
.scanword-shell > .sw-board-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  scroll-padding: 0.6rem;
  -webkit-overflow-scrolling: touch;
}
.cw-cell-wrap, .sw-cell {
  scroll-margin: 0.55rem;
}
.crossword-grid {
  display: grid;
  width: max-content;
  max-width: 100%;
  margin: 0 auto;
}
.crossword-grid .cw-cell-wrap {
  width: var(--cw-cell, 2rem);
  height: var(--cw-cell, 2rem);
  min-width: 0;
  min-height: 0;
}
.crossword-grid .cw-cell {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
  font-size: clamp(.65rem, calc(var(--cw-cell, 2rem) * .45), 1rem);
}
.cw-num { pointer-events: none; }
.rebus-shell > .rebus-stage {
  flex: 1 1 auto;
  min-height: 5rem;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.rebus-shell > .rebus-slots,
.rebus-shell > .play-actions {
  flex: 0 0 auto;
}
.rebus-shell > .play-actions {
  position: relative;
  padding-top: .2rem;
  padding-bottom: .15rem;
  background: transparent;
  box-shadow: none;
  gap: .3rem;
}
.crossword-shell > .cw-clues {
  order: 5;
  flex: 0 1 auto;
  max-height: 18%;
  overflow: auto;
}
.cw-pad-host,
.sw-pad-host,
.rebus-pad-host {
  order: 6;
  position: relative;
  flex: 0 0 auto;
  z-index: 16;
  background: var(--bg);
  padding: .25rem .3rem .4rem;
  box-shadow: 0 -8px 18px color-mix(in srgb, var(--bg) 80%, transparent);
}
@media (max-width: 900px) {
  .crossword-shell > .puzzle-toolbar,
  .scanword-shell > .play-actions,
  .rebus-shell > .puzzle-toolbar {
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: center;
    gap: .28rem;
  }
  .crossword-shell > .puzzle-toolbar .btn,
  .scanword-shell > .play-actions .btn,
  .rebus-shell > .puzzle-toolbar .btn {
    min-height: 2rem;
    padding: 0 .55rem;
    font-size: .85rem;
  }
  .crossword-shell > .cw-picker,
  .scanword-shell > .pack-picker,
  .rebus-shell > .rebus-picker,
  .wordsearch-shell > .ws-picker {
    flex: 0 0 auto;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    max-height: 4.2rem;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }
  .crossword-shell .pack-picker,
  .scanword-shell .pack-picker,
  .rebus-shell .pack-picker,
  .wordsearch-shell .pack-picker {
    flex-wrap: nowrap;
    justify-content: flex-start;
    max-width: 100%;
  }
  .crossword-shell .pack-tile,
  .scanword-shell .pack-tile,
  .rebus-shell .pack-tile,
  .wordsearch-shell .pack-tile {
    flex: 0 0 auto;
  }
  .letter-pad { padding: .25rem .2rem .35rem; gap: .18rem; }
  .letter-key { min-width: 1.55rem; min-height: 1.85rem; font-size: .85rem; }
}

@media (max-height: 920px) {
  .crossword-shell > .cw-clues {
    max-height: 4.6rem;
  }
  .crossword-shell > .cw-board,
  .scanword-shell > .sw-board-wrap {
    min-height: 0;
  }
}

/* Room for a host badge (e.g. deed.page) so it cannot steal taps from
   the roll dock or the bottom letter pad. Harmless when no badge is present. */
:root { --host-safe-bottom: 2.6rem; }


/* Ludo short-viewport: keep the board and tokens above the roll dock */
.game-shell > .play-actions {
  pointer-events: none;
}
.game-shell > .play-actions .btn {
  pointer-events: auto;
}
.game-shell > .play-actions:empty {
  display: none;
  padding: 0;
}
/* Keep dice-poker dock and word-search grid above the host badge on short phones. */
body.in-game .play-wrap:has(.yahtzee-shell),
body.in-game .play-wrap:has(.wordsearch-shell) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body.in-game .play-wrap:has(.yahtzee-shell) .game-mount,
body.in-game .play-wrap:has(.wordsearch-shell) .game-mount,
.yahtzee-shell,
.wordsearch-shell {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.wordsearch-shell { gap: .45rem; align-items: center; }
.wordsearch-shell > .puzzle-toolbar,
.wordsearch-shell > .ws-picker,
.wordsearch-shell > .game-status,
.wordsearch-shell > .ws-list { flex: 0 0 auto; width: 100%; }
.wordsearch-shell > .ws-grid { flex: 0 0 auto; }
.wordsearch-shell > .ws-list {
  max-height: 4.6rem;
  overflow: auto;
  padding-bottom: .15rem;
  margin-bottom: var(--host-safe-bottom, 2.6rem);
}
@media (max-width: 430px) {
  .wordsearch-shell { gap: .3rem; }
  .wordsearch-shell > .ws-picker {
    max-height: 4.2rem;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }
  .wordsearch-shell .pack-picker { flex-wrap: nowrap; justify-content: flex-start; max-width: 100%; }
  .wordsearch-shell .pack-tile { flex: 0 0 auto; min-width: 2.8rem; min-height: 2.6rem; font-size: .8rem; }
}

body.in-game .play-wrap:has(.ludo-shell) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body.in-game .play-wrap:has(.ludo-shell) .game-mount {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ludo-shell {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  gap: .2rem;
}
.ludo-shell .ludo-board {
  box-sizing: border-box;
  justify-self: center;
  align-self: center;
  width: min(92vw, 28rem, 100%);
  max-width: 100%;
  max-height: 100%;
  height: auto;
  aspect-ratio: 1;
  margin: 0 auto;
}
@media (max-height: 880px) {
  .ludo-shell .speech-bubble { display: none; }
  .ludo-shell .game-side {
    max-height: 5.4rem;
    overflow: hidden;
  }
  .ludo-shell .seat-title { display: none; }
  .ludo-shell .seat { gap: .35rem; }
}


/* 2.2 compact letter pad on short phones — must follow the max-width 900px rules. */
@media (max-height: 900px) and (max-width: 500px) {
  .letter-pad { gap: .08rem; padding: .12rem .1rem .15rem; margin-top: .05rem; }
  .letter-pad-row, .letter-pad-acts { gap: .08rem; }
  .letter-key { min-width: 1.2rem; min-height: 1.3rem; font-size: .72rem; padding: 0 .08rem; border-radius: 5px; }
  .letter-key.wide { min-width: 2.8rem; }
  .cw-pad-host, .sw-pad-host, .rebus-pad-host { padding: .1rem .15rem .12rem; max-height: 36%; overflow: auto; }
}


/* 2.2.1 desktop/short crossword: don't let the theme picker crush the board */
@media (max-height: 920px) {
  .crossword-shell > .cw-picker,
  .scanword-shell > .pack-picker,
  .rebus-shell > .rebus-picker,
  .crossword-shell .pack-picker,
  .scanword-shell .pack-picker,
  .rebus-shell .pack-picker,
  .wordsearch-shell .pack-picker {
    flex: 0 0 auto;
    max-height: 4.4rem;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }
  .crossword-shell .pack-picker,
  .scanword-shell .pack-picker,
  .rebus-shell .pack-picker,
  .wordsearch-shell .pack-picker {
    flex-wrap: nowrap;
    justify-content: flex-start;
  }
  .crossword-shell .pack-tile,
  .scanword-shell .pack-tile,
  .rebus-shell .pack-tile,
  .wordsearch-shell .pack-tile {
    flex: 0 0 auto;
  }
}
@media (min-width: 801px) and (max-height: 920px) {
  .crossword-shell > .cw-board,
  .scanword-shell > .sw-board-wrap {
    flex: 1 1 auto;
    min-height: 0;
  }
  .crossword-shell > .cw-clues {
    flex: 0 0 auto;
    max-height: 5.6rem;
  }
  /* Compact the Cyrillic pad so it stays in the play-wrap; the board keeps the rest. */
  .cw-pad-host, .sw-pad-host, .rebus-pad-host { padding: .12rem .2rem .15rem; }
  .letter-pad { gap: .1rem; padding: .12rem .15rem .15rem; }
  .letter-key { min-width: 1.35rem; min-height: 1.45rem; font-size: .78rem; }
  .letter-key.wide { min-width: 3rem; }
}
