/* Лучший сборник всех времен — UI. rem-based, high contrast, 48px targets, no tracking fonts. */
:root {
  --bg: #0b0f0e;
  --bg-elev: #141a18;
  --felt: #0e3b2e;
  --felt-dark: #0a2a21;
  --gold: #e8d48b;
  --gold-dim: #c9a227;
  --ivory: #f3efe3;
  --muted: #d2cdc0;
  --line: #2a4a3c;
  --danger: #e07060;
  --ok: #5dbe8a;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --radius: 12px;
  --font-ui: "Source Sans 3", "Noto Sans Hebrew", "Segoe UI", "Helvetica Neue", Roboto, "Noto Sans", Arial, sans-serif;
  --font-display: "Cormorant Garamond", Palatino, "Palatino Linotype", "Times New Roman", serif;
  --tap: 3rem; /* 48px at 16px root */
  --focus: 0 0 0 3px #0b0f0e, 0 0 0 6px var(--gold);
}
[data-theme="salon"] {
  --bg: #f3efe3; --bg-elev: #fffdf6; --felt: #6b1e2a; --felt-dark: #4a121c;
  --gold: #7a4e12; --gold-dim: #a36b1c; --ivory: #1a1410; --muted: #4a4038;
  --line: #d9cbb6; --danger: #a33; --ok: #1f7a4d; --shadow: 0 8px 24px rgba(80,40,20,.15);
}
[data-theme="midnight"] {
  --bg: #070b16; --bg-elev: #12182a; --felt: #102044; --felt-dark: #0a152e;
  --gold: #d7e4ff; --gold-dim: #8aa4d6; --ivory: #eef2ff; --muted: #c5cbe0; --line: #243056;
}
[data-theme="amber"] {
  --bg: #1a120a; --bg-elev: #2a1c10; --felt: #5a3a18; --felt-dark: #3a2410;
  --gold: #ffd58a; --gold-dim: #d4a24a; --ivory: #fff4e0; --muted: #e2d0b0; --line: #5a4030;
}
[data-theme="imperial"] {
  --bg: #140c16; --bg-elev: #241428; --felt: #3a1840; --felt-dark: #220c28;
  --gold: #f0d48a; --ivory: #f8f0e8; --muted: #d8c8d0; --line: #4a3050;
}
[data-theme="arctic"] {
  --bg: #0c1418; --bg-elev: #152228; --felt: #1a3a42; --felt-dark: #102830;
  --gold: #c8f0ea; --ivory: #eef8f6; --muted: #c5d8d4; --line: #2a4a50;
}
[data-theme="rose"] {
  --bg: #180c10; --bg-elev: #28141a; --felt: #5a2030; --felt-dark: #3a1420;
  --gold: #f3c4c8; --ivory: #fff0f0; --muted: #e0c8c8; --line: #5a3038;
}

* { box-sizing: border-box; }
html { font-size: 100%; height: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100%;
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--ivory);
  line-height: 1.5;
}
img { max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus { outline: none; }
:focus-visible { box-shadow: var(--focus); border-radius: 8px; }

.skip-link {
  position: absolute; left: .5rem; top: -3rem; z-index: 100;
  background: var(--gold); color: #111; padding: .6rem 1rem; min-height: var(--tap);
}
.skip-link:focus { top: .5rem; }

.app-header {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem 1rem; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--bg-elev), transparent);
  position: sticky; top: 0; z-index: 20;
  min-height: calc(var(--tap) + .5rem);
}
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: inherit; min-height: var(--tap); }
.brand img { width: 2.5rem; height: 2.5rem; border-radius: 8px; }
.brand-title { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; color: var(--gold); line-height: 1.2; }
.header-actions { margin-inline-start: auto; display: flex; gap: .35rem; flex-wrap: wrap; }

.icon-btn, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: var(--tap); min-width: var(--tap);
  padding: 0 .9rem; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg-elev); color: var(--ivory);
  cursor: pointer; text-decoration: none; font-weight: 600;
}
.btn.primary { background: var(--gold-dim); color: #111; border-color: var(--gold); }
.btn.ghost { background: transparent; }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.sm { padding: 0 .75rem; }
.btn.active, .icon-btn.active { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.btn:disabled, .icon-btn:disabled { opacity: .45; cursor: not-allowed; }
.chip {
  min-height: var(--tap); min-width: var(--tap);
  padding: 0 .7rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg-elev); color: var(--ivory);
  cursor: pointer;
}

#app { max-width: 72rem; margin: 0 auto; padding: 1rem 1rem 4rem; }
.hero { text-align: center; padding: 1.2rem .5rem 1rem; }
.hero h1 { font-family: var(--font-display); font-size: clamp(1.6rem, 4vw, 2.6rem); color: var(--gold); margin: 0 0 .4rem; }
.hero p { margin: 0; color: var(--muted); }

.section-title { font-family: var(--font-display); color: var(--gold); font-size: 1.25rem; margin: 1.5rem 0 .7rem; }

.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); gap: .75rem; }
.game-card {
  display: flex; flex-direction: column; gap: .35rem;
  min-height: 8rem; padding: .85rem;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  color: inherit; text-decoration: none; cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .18s ease, border-color .18s;
}
.game-card:hover { transform: translateY(-2px); border-color: var(--gold-dim); }
.game-card h3 { margin: 0; font-size: 1rem; line-height: 1.3; }
.game-card p { margin: 0; font-size: .85rem; color: var(--muted); flex: 1; }
.badges { display: flex; flex-wrap: wrap; gap: .25rem; }
.badge { font-size: .7rem; letter-spacing: .04em; text-transform: uppercase; border: 1px solid var(--line); border-radius: 999px; padding: .15rem .4rem; color: var(--gold); }

/* Promo — house ad, navy / dark burgundy, not on game screens */
.dev-promo {
  margin: 1rem 0;
  background: linear-gradient(160deg, #08080A 0%, #1b2a41 58%, #2A1A20 100%);
  color: #f3efe3;
  border: 1px solid rgba(232, 212, 139, .28);
  border-radius: 14px;
  padding: .85rem 1rem 1rem;
  position: relative;
}
.dev-promo-kicker {
  font-size: .72rem; letter-spacing: .1em; text-transform: uppercase;
  color: #e8d48b; margin-bottom: .5rem; font-weight: 700;
}
.dev-promo-row { display: flex; align-items: center; gap: .85rem; flex-wrap: wrap; }
.dev-promo-logo { width: 2.5rem; height: 2.5rem; flex: 0 0 auto; border-radius: 8px; background: #08080A; }
.dev-promo-copy { flex: 1 1 12rem; }
.dev-promo-line { margin: 0; color: #f3efe3; }
.dev-promo-hero { width: 100%; max-width: 18rem; border-radius: 8px; display: block; margin-bottom: .5rem; }
.dev-promo-cta { min-height: var(--tap) !important; background: #e8d48b; color: #1b2a41 !important; border-color: #e8d48b; }
.dev-promo-dismiss {
  position: absolute; top: .4rem; inset-inline-end: .4rem;
  min-width: var(--tap); min-height: var(--tap);
  border: 0; background: transparent; color: #e8d48b; font-size: 1.4rem; cursor: pointer;
}
.dev-promo.card { margin: 1rem auto; max-width: 28rem; }

.felt-table {
  background:
    radial-gradient(ellipse at center, rgba(255,255,255,.06), transparent 55%),
    repeating-linear-gradient(45deg, rgba(255,255,255,.015) 0 2px, transparent 2px 6px),
    linear-gradient(180deg, var(--felt) 0%, var(--felt-dark) 100%);
  border-radius: 16px; padding: 1rem; box-shadow: inset 0 0 0 3px rgba(232,212,139,.15), var(--shadow);
}

.wood-board {
  background:
    repeating-linear-gradient(90deg, rgba(80,40,10,.15) 0 2px, transparent 2px 7px),
    linear-gradient(180deg, #8a5a2a, #5a3818);
  border-radius: 8px; box-shadow: inset 0 0 0 4px #3a220c, var(--shadow);
}

/* Cards */
.playing-card {
  width: 4.4rem; height: 6.2rem; border-radius: .35rem; position: relative;
  background: #fffdf8; color: #1a1a1a;
  box-shadow: 0 2px 0 #c9c2b4, 0 6px 12px rgba(0,0,0,.25);
  display: inline-block; user-select: none;
  transition: transform .2s ease;
}
.playing-card.red { color: #b02a2a; }
.playing-card.black { color: #1c1816; }
.playing-card.small { width: 3.1rem; height: 4.4rem; }
.playing-card.selected { transform: translateY(-8px); box-shadow: 0 0 0 2px var(--gold), 0 8px 16px rgba(0,0,0,.3); }
.playing-card.playable { cursor: pointer; }
.playing-card.playable:hover { transform: translateY(-4px); }
.playing-card.disabled { opacity: .5; pointer-events: none; }
.card-face { position: absolute; inset: 0; }
.corner { position: absolute; display: flex; flex-direction: column; align-items: center; font-weight: 700; line-height: 1; }
.corner.tl { top: .18rem; left: .2rem; }
.corner.br { bottom: .18rem; right: .2rem; transform: rotate(180deg); }
.corner .rk { font-size: .7rem; }
.corner .sy { font-size: .7rem; }
.pips { position: absolute; inset: 12% 18%; }
.pip-dot { position: absolute; transform: translate(-50%,-50%); font-size: 1rem; }
.pip-dot.flip { transform: translate(-50%,-50%) rotate(180deg); }
.ace-pip { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); font-size: 2.2rem; }
.face-plate { position: absolute; inset: 16% 18%; border: 1px solid rgba(201,162,39,.45); border-radius: 4px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; background: linear-gradient(#fff, #f6efe0); }
.face-mono { font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; }
.face-suit { font-size: 1.1rem; }
.playing-card.back, .playing-card.back .card-back { background: transparent; }
.card-back, .playing-card.back {
  background: var(--felt-dark);
  border-radius: .35rem;
}
.card-back { position: absolute; inset: 0; overflow: hidden; }
.back-pattern { position: absolute; inset: .22rem; border-radius: .2rem; border: 2px solid rgba(232,212,139,.45);
  background:
    repeating-linear-gradient(45deg, rgba(232,212,139,.2) 0 6px, transparent 6px 12px),
    repeating-linear-gradient(-45deg, rgba(232,212,139,.15) 0 6px, transparent 6px 12px),
    #6b1e2e;
}
[data-card-back="navy"] .back-pattern { background-color: #16325a; }
[data-card-back="forest"] .back-pattern { background-color: #1a4a32; }
[data-card-back="midnight"] .back-pattern { background-color: #12101c; }
[data-card-back="gold"] .back-pattern { background-color: #7a5a12; }
[data-card-back="damask"] .back-pattern {
  background-image: radial-gradient(circle at 30% 30%, rgba(255,255,255,.2) 0 2px, transparent 3px),
    repeating-linear-gradient(45deg, rgba(232,212,139,.25) 0 8px, transparent 8px 16px);
  background-color: #4a2040;
}
[data-card-back="emerald"] .back-pattern { background-color: #0e4a3a; }
[data-card-back="stars"] .back-pattern {
  background-image: radial-gradient(circle, #e8d48b 1px, transparent 1.5px);
  background-size: 10px 10px; background-color: #14203a;
}
[data-card-back="royal"] .back-pattern { background-color: #3a1450; }
[data-card-back="aurora"] .back-pattern {
  background-image: linear-gradient(135deg, #1b3a50, #3a2060 40%, #1a4a40);
}

/* Chess / checkers */
.chess-board, .checkers-board {
  display: grid; grid-template-columns: repeat(8, 1fr); width: min(92vw, 28rem); aspect-ratio: 1;
  border: 8px solid #5a3a1a; border-radius: 4px; box-shadow: var(--shadow);
}
.chess-board.flipped { transform: rotate(180deg); }
.chess-board.flipped .sq > * { transform: rotate(180deg); }
.sq { position: relative; display: flex; align-items: center; justify-content: center; }
.sq.light { background: #e8d9b0; }
.sq.dark { background: #6b8f5a; }
[data-theme="salon"] .sq.light { background: #f0e0c0; } [data-theme="salon"] .sq.dark { background: #8a4a3a; }
.sq.sel { outline: 3px solid var(--gold); outline-offset: -3px; }
.sq.last { box-shadow: inset 0 0 0 3px rgba(232,212,139,.7); }
.sq.check { background: #c45 !important; }
.sq .dot { width: 22%; height: 22%; border-radius: 50%; background: rgba(20,40,20,.35); }
.sq.cap::after { content: ""; position: absolute; inset: 8%; border: 3px solid rgba(180,40,40,.55); border-radius: 50%; }
.coord { position: absolute; font-size: .65rem; color: rgba(0,0,0,.45); pointer-events: none; }
.coord.file { bottom: 1px; right: 3px; }
.coord.rank { top: 1px; left: 3px; }
.piece { font-size: 8vmin; line-height: 1; filter: drop-shadow(0 1px 1px rgba(0,0,0,.4)); pointer-events: none; }
.piece.w { color: #f6f0e4; text-shadow: 0 0 1px #222, 0 1px 2px rgba(0,0,0,.5); }
.piece.b { color: #1a1a1a; text-shadow: 0 0 1px #fff; }
.promo-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.45); }
.promo-overlay.hidden, .hidden { display: none !important; }
.promo-row { display: flex; gap: .4rem; background: var(--bg-elev); padding: .5rem; border-radius: 10px; }
.promo-btn { min-width: var(--tap); min-height: var(--tap); font-size: 2rem; }

.game-shell { display: flex; flex-direction: column; gap: .75rem; }
.game-status { min-height: 1.5rem; font-weight: 600; }
.game-side { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.fen-line { font-size: .7rem; color: var(--muted); word-break: break-all; width: 100%; }

/* Sudoku */
.sudoku-board { display: grid; grid-template-columns: repeat(9, 1fr); width: min(96vw, 26rem); aspect-ratio: 1;
  border: 3px solid var(--ivory); background: #f7f3ea; color: #111; }
.su-cell { position: relative; border: 1px solid #c9c2b4; display: flex; align-items: center; justify-content: center;
  min-height: 2.2rem; cursor: pointer; font-weight: 700; }
.su-cell.box-l { border-left: 2px solid #222; }
.su-cell.box-t { border-top: 2px solid #222; }
.su-cell.sel { background: #ffe9a0; }
.su-cell.hl { background: #efe6cc; }
.su-cell.same { color: #1a4a8a; }
.su-cell.bad { background: #f8c8c0; }
.su-cell.given .su-n { color: #111; }
.su-n { font-size: 1.2rem; }
.su-notes { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; height: 100%; font-size: .55rem; color: #456; }
.sudoku-pad { display: grid; grid-template-columns: repeat(5, 1fr); gap: .4rem; max-width: 26rem; }
.su-key { min-height: var(--tap); }
.su-key.done { opacity: .4; }
.puzzle-toolbar { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.sudoku-timer { margin-inline-start: auto; font-variant-numeric: tabular-nums; }

/* Dice 3D */
.dice-3d { width: 3.4rem; height: 3.4rem; perspective: 240px; display: inline-block; }
.d3-cube { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; }
.d3-face { position: absolute; inset: 0; background: #f7f3ea; border-radius: .4rem; border: 2px solid #d0c8b4;
  display: grid; grid-template-columns: repeat(3, 1fr); padding: .28rem; box-shadow: inset 0 0 0 1px #fff; backface-visibility: hidden; }
.d3-face .dp { border-radius: 50%; }
.d3-face .dp.on { background: #1a1a1a; }
.d3-face.front  { transform: rotateY(0) translateZ(1.7rem); }
.d3-face.back   { transform: rotateY(180deg) translateZ(1.7rem); }
.d3-face.right  { transform: rotateY(90deg) translateZ(1.7rem); }
.d3-face.left   { transform: rotateY(-90deg) translateZ(1.7rem); }
.d3-face.top    { transform: rotateX(90deg) translateZ(1.7rem); }
.d3-face.bottom { transform: rotateX(-90deg) translateZ(1.7rem); }
.dice-3d.small { width: 2.4rem; height: 2.4rem; }
.dice-3d.small .d3-face.front { transform: rotateY(0) translateZ(1.2rem); }
.dice-3d.small .d3-face.back { transform: rotateY(180deg) translateZ(1.2rem); }
.dice-3d.small .d3-face.right { transform: rotateY(90deg) translateZ(1.2rem); }
.dice-3d.small .d3-face.left { transform: rotateY(-90deg) translateZ(1.2rem); }
.dice-3d.small .d3-face.top { transform: rotateX(90deg) translateZ(1.2rem); }
.dice-3d.small .d3-face.bottom { transform: rotateX(-90deg) translateZ(1.2rem); }

/* Seats / bots */
.seat { display: flex; align-items: center; gap: .6rem; position: relative; }
.seat-meta { display: flex; flex-direction: column; }
.seat-name { font-weight: 700; }
.seat-title { font-size: .8rem; color: var(--muted); }
.bot-avatar { width: 3.2rem; height: 3.2rem; position: relative; flex: 0 0 auto; }
.bot-avatar.small { width: 2.5rem; height: 2.5rem; }
.av-bg { position: absolute; inset: 0; border-radius: 50%; background: var(--bot-accent, #3a5a3c); box-shadow: inset 0 -6px 0 rgba(0,0,0,.15); }
.av-body { position: absolute; inset: 8% 12% 4%; }
.av-face { position: absolute; inset: 28% 10% 18%; background: #f0d0b4; border-radius: 50%; }
.av-eye { position: absolute; top: 38%; width: 18%; height: 18%; background: #222; border-radius: 50%; }
.av-eye.l { left: 18%; } .av-eye.r { right: 18%; }
.av-mouth { position: absolute; left: 30%; right: 30%; bottom: 22%; height: 10%; border-bottom: 2px solid #a45; border-radius: 0 0 8px 8px; }
.av-blush { position: absolute; top: 52%; width: 16%; height: 10%; background: rgba(220,80,80,.3); border-radius: 50%; }
.av-blush.l { left: 8%; } .av-blush.r { right: 8%; }
.look-ushanka .av-hat { position: absolute; top: 0; left: 5%; right: 5%; height: 38%; background: #2a2a2a; border-radius: 12px 12px 0 0; }
.look-ushanka .av-beard { position: absolute; left: 18%; right: 18%; bottom: 6%; height: 28%; background: #c4b8a0; border-radius: 0 0 12px 12px; }
.look-bob .av-hair { position: absolute; top: 8%; left: 0; right: 0; height: 45%; background: #3a2010; border-radius: 14px 14px 4px 4px; }
.look-scholar .av-acc::after { content: ""; position: absolute; left: 12%; right: 12%; top: 42%; height: 8%; border: 2px solid #222; border-radius: 8px; }
.look-bun .av-hair { position: absolute; top: 0; left: 20%; right: 20%; height: 28%; background: #c4a050; border-radius: 50%; }
.look-cap .av-hat { position: absolute; top: 6%; left: 8%; right: 8%; height: 28%; background: #1f4a8a; border-radius: 8px 8px 0 0; }
.look-curl .av-hair { position: absolute; top: 4%; left: -4%; right: -4%; height: 40%; background: #4a2038; border-radius: 50% 50% 20% 20%; }
.look-mess .av-hair { position: absolute; top: 2%; left: 8%; right: 8%; height: 32%; background: #2a2018; border-radius: 8px 20px 0 8px; }
.look-crown .av-hat { position: absolute; top: -6%; left: 18%; right: 18%; height: 28%; background: var(--gold-dim); clip-path: polygon(0 80%, 15% 0, 35% 60%, 50% 0, 65% 60%, 85% 0, 100% 80%); }
.look-you .av-face { background: #e8d2b0; }
.speech-bubble {
  position: absolute; inset-inline-start: 3.6rem; top: -0.6rem; z-index: 5;
  max-width: 16rem; background: #fffdf6; color: #1a1410; border-radius: 12px;
  padding: .45rem .65rem; font-size: .9rem; box-shadow: var(--shadow);
}
.speech-bubble::after {
  content: ""; position: absolute; inset-inline-start: -6px; top: 14px;
  border: 6px solid transparent; border-inline-end-color: #fffdf6;
}
html[dir="rtl"] .speech-bubble::after { border-inline-end-color: transparent; border-inline-start-color: #fffdf6; }
.speech-bubble.hidden { opacity: 0; pointer-events: none; }
.speech-bubble.pop { animation: pop .35s ease; }
@keyframes pop { from { transform: scale(.86); opacity: 0; } to { transform: none; opacity: 1; } }

/* Chat / video */
.comm-panel { border: 1px solid var(--line); border-radius: 12px; padding: .75rem; background: var(--bg-elev); }
.comm-head { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: space-between; align-items: center; }
.comm-more { display: flex; flex-wrap: wrap; gap: .35rem; }
.comm-status { color: var(--muted); }
.chat-log { min-height: 6rem; max-height: 10rem; overflow: auto; margin: .5rem 0; }
.chat-line { margin: .25rem 0; }
.chat-who { font-weight: 700; margin-inline-end: .35rem; color: var(--gold); }
.chat-composer.disabled { opacity: .45; pointer-events: none; }
.chat-quick, .chat-emoji { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .35rem; }
.chat-input-row { display: flex; gap: .4rem; }
.chat-input {
  flex: 1; min-height: var(--tap); padding: 0 .75rem;
  border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ivory);
}
.video-stage { position: relative; background: #08080A; border-radius: 10px; overflow: hidden; aspect-ratio: 16/10; margin: .5rem 0; }
.vid.remote { width: 100%; height: 100%; object-fit: cover; background: #111; }
.vid.local { position: absolute; width: 28%; bottom: .4rem; inset-inline-end: .4rem; border-radius: 8px; border: 2px solid #e8d48b; }
.video-hint { position: absolute; left: .6rem; right: .6rem; bottom: .5rem; color: #f3efe3; font-size: .85rem; }
.video-ctrls { position: absolute; left: .5rem; bottom: .5rem; display: flex; gap: .3rem; flex-wrap: wrap; }
.fine { font-size: .85rem; color: var(--muted); }
.comm-note { margin: .4rem 0 0; }

/* Settings / forms */
.settings-list, .about-block, .profile-block { display: grid; gap: .85rem; }
.setting-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between;
  padding: .6rem 0; border-bottom: 1px solid var(--line); }
.setting-row label, .setting-help { color: var(--ivory); }
.setting-help { width: 100%; font-size: .85rem; color: var(--muted); margin: 0; }
.choice-row { display: flex; flex-wrap: wrap; gap: .35rem; }
.lock { opacity: .4; pointer-events: none; }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 40;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.modal-card, .consent-card {
  background: var(--bg-elev); color: var(--ivory); border-radius: 14px;
  padding: 1.1rem; max-width: 28rem; width: 100%; border: 1px solid var(--line); box-shadow: var(--shadow);
}
.modal-card h2, .consent-card h2 { margin-top: 0; color: var(--gold); font-family: var(--font-display); }
.modal-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; margin-top: 1rem; }
.rules-body { white-space: pre-wrap; }

.toast-stack { position: fixed; inset-inline-end: 1rem; bottom: 1rem; z-index: 50; display: flex; flex-direction: column; gap: .4rem; }
.toast { background: var(--bg-elev); border: 1px solid var(--gold-dim); color: var(--ivory);
  padding: .7rem 1rem; border-radius: 10px; min-height: var(--tap); min-width: 12rem;
  opacity: 0; transform: translateY(8px); transition: .3s; }
.toast.show { opacity: 1; transform: none; }
.fx-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 45; }
.shake { animation: shake .35s ease; }
@keyframes shake { 0%,100%{transform:none} 25%{transform:translateX(-4px)} 75%{transform:translateX(4px)} }

.xp-bar { height: .55rem; background: var(--line); border-radius: 99px; overflow: hidden; }
.xp-bar > span { display: block; height: 100%; background: var(--gold-dim); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr)); gap: .5rem; }
.stat-card { background: var(--bg-elev); border: 1px solid var(--line); border-radius: 10px; padding: .7rem; }
.quest-item, .ach-item { display: flex; justify-content: space-between; gap: .5rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.ach-item.locked { opacity: .5; }

.play-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; }

@media (max-width: 40rem) {
  .brand-title { max-width: 12rem; }
  .playing-card { width: 3.4rem; height: 4.8rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
[data-anim="off"] *, [data-anim="off"] *::before, [data-anim="off"] *::after {
  animation: none !important; transition: none !important;
}

.durak-hand, .opp-hand { display:flex; flex-wrap:wrap; gap:.35rem; justify-content:center; margin:.5rem 0; }
.atk-pair { display:inline-flex; flex-direction:column; margin:.35rem; }
.atk-pair .playing-card:last-child { margin-top:-2rem; margin-inline-start:1rem; }
.trump-stack { color:var(--gold); font-weight:700; margin-bottom:.5rem; }
.crossword-grid { display:grid; gap:1px; background:#333; width:max-content; max-width:100%; margin:0 auto; }
.cw-cell { width:2rem; height:2rem; min-width:2rem; min-height:2rem; border:0; text-align:center; text-transform:uppercase; font-weight:700; font-size:1rem; background:#fffdf6; color:#111; padding:0; }
.cw-cell.block { background:#1a1a1a; pointer-events:none; }
.cw-cell.sel { outline:2px solid #c9a227; }
.cw-cell.bad { background:#f8c8c0; }
.cw-num { position:absolute; top:0; left:1px; font-size:.55rem; color:#444; }
.cw-wrap { position:relative; display:inline-block; }
.cw-cell-wrap { position:relative; }
.rebus-stage { text-align:center; font-size:1.6rem; padding:1rem; }
.rebus-eq { font-size:2rem; letter-spacing:.04em; }


/* ---- Solitaire helpers ---- */
.playing-card.empty {
  background: rgba(255,255,255,.06);
  box-shadow: none;
  border: 1px dashed rgba(255,255,255,.28);
}
.kl-tabs { overflow-x: auto; padding-bottom: .4rem; }
.found-pile, .stock-pile { min-width: 4.4rem; min-height: 6.2rem; }

/* ---- Nardy / backgammon ---- */
.nardy-board {
  background: linear-gradient(165deg, #4a2e1c, #2a1810 55%, #3d2416);
  border: 8px solid #1b2a41;
  border-radius: 10px;
  padding: 8px;
  box-shadow: inset 0 0 0 2px #c9a22755, 0 12px 30px rgba(0,0,0,.45);
}
.nardy-row { display: flex; gap: 2px; }
.nardy-pt {
  flex: 1 1 0;
  min-height: 10.5rem;
  position: relative;
  cursor: pointer;
  min-width: 1.6rem;
}
.nardy-pt.top { background: linear-gradient(to bottom, transparent 0, transparent 8%, currentColor 8%, transparent 100%); }
.nardy-pt.darkt { color: #8b1e2d55; background-image: linear-gradient(to bottom, #7a1c28 0, #7a1c2800 88%); }
.nardy-pt.lightt { color: #e8d5a855; background-image: linear-gradient(to bottom, #d8c39a 0, #d8c39a00 88%); }
.nardy-row.bot .nardy-pt.darkt { background-image: linear-gradient(to top, #7a1c28 0, #7a1c2800 88%); }
.nardy-row.bot .nardy-pt.lightt { background-image: linear-gradient(to top, #d8c39a 0, #d8c39a00 88%); }
.nardy-pt.sel { outline: 2px solid #e8d48b; outline-offset: -2px; }
.nardy-pt.dest { box-shadow: inset 0 0 0 2px #7dcea0; }
.nardy-stack {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  padding: 2px 0;
}
.nardy-row.bot .nardy-stack { flex-direction: column-reverse; }
.nardy-man {
  width: 86%;
  max-width: 2.2rem;
  aspect-ratio: 1;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .7rem;
  font-weight: 700;
  margin: -4px 0;
  box-shadow: 0 2px 0 rgba(0,0,0,.35), inset 0 2px 0 rgba(255,255,255,.28);
}
.nardy-man.w { background: radial-gradient(circle at 35% 30%, #fff, #d8c8a0 40%, #8a6a3a); color: #1b2a41; }
.nardy-man.b { background: radial-gradient(circle at 35% 30%, #666, #222 55%, #111); color: #eee; }
.nardy-count { font-size: .7rem; color: #f4e4bc; }
.nardy-bar {
  width: 22px;
  flex: 0 0 22px;
  background: #1b2a41;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 10.5rem;
}
.nardy-mid {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 6px;
  color: #f4e4bc;
  font-weight: 700;
  font-size: .85rem;
}
.nardy-off { cursor: pointer; padding: .35rem .6rem; border-radius: 6px; min-height: 48px; display: inline-flex; align-items: center; }
.nardy-off.w { background: #d8c8a033; }
.nardy-off.b { background: #0003; }
.nardy-dice { justify-content: center; margin: .25rem 0; }
.dice-row { display: flex; gap: .6rem; align-items: center; justify-content: center; flex-wrap: wrap; }

/* ---- Ludo ---- */
.ludo-board {
  display: grid;
  width: min(92vw, 28rem);
  aspect-ratio: 1;
  margin: 0 auto;
  border: 6px solid #1b2a41;
  border-radius: 8px;
  background: #1b2a41;
  box-shadow: 0 10px 24px rgba(0,0,0,.4);
}
.ludo-cell { position: relative; min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; }
.ludo-cell.path { background: #f3efe6; }
.ludo-cell.ludo-center { background: #2A1A20; }
.ludo-cell.yard-r, .ludo-cell.home-r, .ludo-cell.start-r { background: #c0392b; }
.ludo-cell.yard-g, .ludo-cell.home-g, .ludo-cell.start-g { background: #1e8449; }
.ludo-cell.yard-y, .ludo-cell.home-y, .ludo-cell.start-y { background: #d4ac0d; }
.ludo-cell.yard-b, .ludo-cell.home-b, .ludo-cell.start-b { background: #2471a3; }
.ludo-cell.path.start-r { box-shadow: inset 0 0 0 2px #f5b7b1; }
.ludo-tok {
  width: 72%;
  aspect-ratio: 1;
  border-radius: 50%;
  box-shadow: 0 1px 2px #0008, inset 0 2px 0 #fff6;
  z-index: 2;
  cursor: pointer;
}
.ludo-tok.r { background: radial-gradient(circle at 30% 30%, #f5b7b1, #922b21); }
.ludo-tok.g { background: radial-gradient(circle at 30% 30%, #a9dfbf, #145a32); }
.ludo-tok.y { background: radial-gradient(circle at 30% 30%, #f9e79f, #9a7d0a); }
.ludo-tok.b { background: radial-gradient(circle at 30% 30%, #aed6f1, #1a5276); }
.ludo-tok.playable { outline: 2px solid #fff; outline-offset: 1px; animation: pulse 1.2s ease-in-out infinite; }
@media (max-width: 520px) {
  .nardy-pt { min-height: 7.2rem; }
  .nardy-man { max-width: 1.5rem; }
}
