/* Лучший сборник всех времен — 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: #e4dfd2;
  --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", "Noto Sans Georgian", "Noto Sans Arabic", "Noto Sans SC", "Noto Sans JP", "Segoe UI", "PingFang SC", "Hiragino Sans", "Noto Sans CJK SC", "Noto Sans CJK JP", "Microsoft YaHei", "Yu Gothic", "Malgun Gothic", "Helvetica Neue", Roboto, "Noto Sans", Arial, sans-serif;
  --font-display: "Cormorant Garamond", "Noto Sans Hebrew", "Noto Sans Georgian", "Noto Sans Arabic", "Noto Sans SC", "Noto Sans JP", Palatino, "Palatino Linotype", "Times New Roman", "PingFang SC", "Hiragino Mincho ProN", 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: #6a420e; --gold-dim: #a36b1c; --ivory: #1a1410; --muted: #3f352e;
  --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: #d0d6ea; --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%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1;
}
body {
  margin: 0; min-height: 100%;
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 500;
  background: var(--bg);
  color: var(--ivory);
  line-height: 1.55;
  letter-spacing: .01em;
}
img { max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; font-weight: 600; }
: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.15rem; 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; font-size: 1rem;
}
.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; font-weight: 600; font-size: 1rem;
}
.chip.on { border-color: var(--gold); color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }

#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: 1.05rem; line-height: 1.3; font-weight: 700; }
.game-card p { margin: 0; font-size: .9375rem; color: var(--muted); flex: 1; font-weight: 500; }
.badges { display: flex; flex-wrap: wrap; gap: .25rem; }
.badge { font-size: .75rem; letter-spacing: .04em; text-transform: uppercase; border: 1px solid var(--line); border-radius: 999px; padding: .15rem .4rem; color: var(--gold); font-weight: 700; }

/* 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: .8rem; 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: #c0152a; }
.playing-card.black { color: #14120f; }
.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: .82rem; font-weight: 700; font-family: var(--font-ui); font-style: normal; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.corner .sy { font-size: .78rem; font-style: normal; }
.playing-card.rank-10 .corner .rk { font-size: .68rem; letter-spacing: -.04em; }
.playing-card.small .corner .rk { font-size: .7rem; }
.playing-card.small .corner .sy { font-size: .66rem; }
.pips { position: absolute; inset: 12% 18%; }
.pip-dot { position: absolute; transform: translate(-50%,-50%); font-size: 1.15rem; line-height: 1; }
.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: .75rem; font-weight: 700; pointer-events: none; line-height: 1; }
.sq.light .coord { color: #3a2414; }
.sq.dark .coord { color: #f4ead0; }
.coord.file { bottom: 1px; right: 3px; }
.coord.rank { top: 1px; left: 3px; }
.piece { font-size: 8vmin; line-height: 1; pointer-events: none; }
.piece.w { color: #f6f0e4; }
.piece.b { color: #1a1a1a; }
.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: .7rem; color: #1b2a41; font-weight: 600; }
.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: .875rem; color: var(--muted); font-weight: 500; }
.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); display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.chat-unread {
  display: inline-flex; min-width: 1.25rem; height: 1.25rem; padding: 0 .28rem;
  border-radius: 999px; background: #c44545; color: #fff8ee;
  font-size: .72rem; font-weight: 800; align-items: center; justify-content: center;
  letter-spacing: 0;
}
.chat-unread.hidden { display: none; }
.chat-log { min-height: 6rem; max-height: 10rem; overflow: auto; margin: .5rem 0; }
.chat-line { margin: .25rem 0; unicode-bidi: isolate; }
.chat-line.me .chat-text { font-weight: 600; }
.chat-who { font-weight: 700; margin-inline-end: .35rem; color: var(--gold); }
.chat-text { unicode-bidi: plaintext; }
.share-link { font-size: .78rem; }
.room-code { user-select: all; }
.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-wrap { margin: .5rem 0 .35rem; }
.video-stage { position: relative; background: #08080A; border: 1px solid var(--gold-dim); border-radius: 10px; overflow: hidden; aspect-ratio: 16/10; min-height: 11rem; }
.vid.remote { width: 100%; height: 100%; object-fit: cover; background: #111; display: block; }
.vid.local {
  position: absolute; width: 32%; min-width: 7rem; bottom: .45rem; inset-inline-end: .45rem;
  border-radius: 8px; border: 2px solid #e8d48b; background: #111; z-index: 2; object-fit: cover;
  aspect-ratio: 4/3; box-shadow: 0 2px 10px rgba(0,0,0,.55);
}
.video-stage.solo-local .vid.local {
  inset: 0; width: 100%; height: 100%; min-width: 0; border-radius: 0; border: 0; aspect-ratio: auto; box-shadow: none;
}
.video-stage.solo-local .vid.remote { opacity: 0; }
.video-hint { color: #f3efe3; font-size: .85rem; margin: .35rem 0 .2rem; }
.video-ctrls { display: flex; gap: .3rem; flex-wrap: wrap; margin: .25rem 0 .4rem; }
.fine { font-size: .9375rem; 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: .9375rem; 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; }


.update-toast {
  position: fixed;
  z-index: 80;
  inset-inline: 0.75rem;
  bottom: calc(1rem + var(--host-safe-bottom, 0px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--bg-elev);
  border: 1px solid var(--gold-dim);
  border-radius: 12px;
  color: var(--ivory);
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
  pointer-events: auto;
}
.update-toast-msg { flex: 1 1 auto; font-weight: 600; }
.update-toast-btn { flex: 0 0 auto; pointer-events: auto; }
.settings-version { margin-top: 1.25rem; opacity: .8; }

.toast-stack { position: fixed; inset-inline-end: 1rem; top: 4.5rem; bottom: auto; z-index: 50; display: flex; flex-direction: column; gap: .4rem; pointer-events: none; }
.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:.7rem; color:#1b2a41; font-weight:700; }
.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: .8rem;
  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: .8rem; color: #f4e4bc; font-weight: 700; }
.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; }
}


/* ===== Poker ===== */
.poker-disclaimer {
  margin: .5rem 0 0;
  padding: .55rem .75rem;
  border: 1px solid var(--gold-dim);
  border-radius: 10px;
  background: rgba(20,16,10,.45);
  color: var(--ivory);
  font-weight: 700;
  text-align: center;
}
.poker-disclaimer.compact {
  margin: 0;
  padding: .2rem .5rem;
  font-size: .78rem;
  line-height: 1.25;
  border-radius: 8px;
}
.poker-hub-lead { max-width: 40rem; }
.poker-hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr)); gap: .75rem; margin: 1rem 0; }
.poker-hub-card {
  display: flex; flex-direction: column; gap: .4rem;
  text-decoration: none; color: inherit;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 14px;
  padding: .7rem; min-height: var(--tap);
  box-shadow: var(--shadow);
}
.poker-hub-card h3 { margin: 0; font-family: var(--font-display); color: var(--gold); }
.poker-hub-card p { margin: 0; color: var(--muted); font-size: .92rem; }
.poker-setup { display: grid; gap: .65rem; max-width: 28rem; margin: 0 auto; padding: .5rem; }
.poker-setup-row { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; justify-content: space-between; }
.poker-shell { display: flex; flex-direction: column; gap: .45rem; }
.poker-topbar { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; justify-content: space-between; }
.poker-table-wrap { position: relative; width: 100%; max-width: 52rem; margin: 0 auto; }
.poker-table .playing-card.deal-in { animation: pkdeal .42s ease both; }
@keyframes pkdeal { from { transform: translateY(-14px) scale(.86); opacity: 0; } to { transform: none; opacity: 1; } }
.poker-table {
  position: relative;
  width: 100%;
  aspect-ratio: 1.55 / 1;
  min-height: 16.5rem;
  border-radius: 50% / 42%;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 28%, rgba(255,255,255,.09), transparent 50%),
    radial-gradient(ellipse at 50% 60%, #176b4e 0%, #0c3a2c 55%, #071f18 100%);
  box-shadow:
    inset 0 0 0 11px #4a2c14,
    inset 0 0 0 13px #e8d48b,
    inset 0 0 0 16px #2a180c,
    0 18px 40px rgba(0,0,0,.45);
}
.poker-seat {
  position: absolute; width: 6.4rem; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: .15rem;
  z-index: 2;
}
.poker-seat.to-act { z-index: 3; }
.poker-seat.to-act .seat { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 12px; }
.poker-seat.folded { opacity: .48; }
.poker-seat .pk-cards { display: flex; gap: 2px; min-height: 2.8rem; }
.poker-seat .pk-cards .playing-card { width: 2.15rem; height: 3.05rem; }
.poker-seat.hero .pk-cards .playing-card { width: 3.3rem; height: 4.65rem; }
.poker-seat .pk-bet { font-size: .78rem; color: var(--gold); font-weight: 700; min-height: 1rem; }
.pk-button {
  position: absolute; width: 1.35rem; height: 1.35rem; border-radius: 50%;
  background: #f4f0e4; color: #111; font-size: .7rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #c9a227; box-shadow: 0 2px 4px rgba(0,0,0,.35);
  transform: translate(2.4rem, -2.1rem);
}
.poker-board {
  position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: .35rem; z-index: 1;
}
.poker-board-cards { display: flex; gap: .28rem; min-height: 4.6rem; }
.poker-board-cards .playing-card { width: 3.15rem; height: 4.45rem; }
.poker-pot { color: #f4ead0; font-weight: 800; text-shadow: 0 1px 4px #000; }
.poker-street { color: var(--gold); font-size: .85rem; letter-spacing: .04em; }
.chip-row { display: flex; gap: 2px; justify-content: center; align-items: flex-end; min-height: 1.1rem; max-width: 6.2rem; overflow: hidden; flex-wrap: nowrap; }
.pk-chip {
  width: 1.05rem; height: 1.05rem; border-radius: 50%;
  border: 2px dashed rgba(255,255,255,.45);
  box-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.pk-chip.c1 { background: #f3efe3; }
.pk-chip.c5 { background: #b33; }
.pk-chip.c25 { background: #1e7a4a; }
.pk-chip.c100 { background: #1a1a1a; }
.pk-chip.c500 { background: #5b2a8a; }
.pk-chip.c1000 { background: #c9a227; }
.poker-actions {
  display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center;
  align-items: center; padding: .35rem 0 .55rem;
}
.poker-actions .btn { min-width: 5.5rem; }
.poker-raise { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; justify-content: center; width: 100%; }
.poker-raise input[type="range"] { width: min(100%, 16rem); accent-color: #e8d48b; }
.poker-hero-hand { display: flex; justify-content: center; gap: .28rem; min-height: 4.9rem; padding: .1rem 0 .15rem; position: relative; z-index: 3; }
.poker-hero-hand .playing-card { width: 3.35rem; height: 4.75rem; }
.poker-hint { text-align: center; color: var(--muted); font-size: .9rem; min-height: 1.2rem; }
.poker-log { max-height: 4.5rem; overflow: auto; font-size: .85rem; color: var(--muted); }
.pk-ranks { width: 100%; border-collapse: collapse; margin-top: .7rem; }
.pk-ranks th, .pk-ranks td { text-align: start; padding: .35rem .5rem; border-bottom: 1px solid var(--line); }
.pk-ranks th { color: var(--gold); }
.poker-vp, .poker-cs, .poker-ofc { display: grid; gap: .7rem; justify-items: center; }
.poker-hold-row { display: flex; gap: .22rem; flex-wrap: nowrap; justify-content: center; align-items: center; overflow-x: auto; }
.poker-cs .poker-hold-row .playing-card,
.poker-vp .poker-hold-row .playing-card { width: 3.05rem; height: 4.3rem; flex: none; }
.poker-hold-row .playing-card.held { outline: 3px solid var(--gold); outline-offset: 2px; }
.ofc-rows { display: grid; gap: .5rem; width: 100%; max-width: 28rem; }
.ofc-row { display: flex; gap: .25rem; align-items: center; min-height: 4.8rem; padding: .3rem; border: 1px dashed var(--gold-dim); border-radius: 10px; }
.ofc-row.legal { border-style: solid; background: rgba(232,212,139,.08); }
.ofc-label { width: 6.5rem; font-weight: 700; color: var(--gold); flex: none; }

@media (max-width: 420px) {
  .poker-table { aspect-ratio: 1 / 1.02; min-height: 16.2rem; border-radius: 46% / 38%; }
  .poker-seat { width: 5.6rem; }
  .poker-seat .pk-cards .playing-card { width: 1.7rem; height: 2.4rem; }
  .poker-hero-hand .playing-card { width: 2.95rem; height: 4.15rem; }
  .poker-board-cards .playing-card { width: 2.45rem; height: 3.45rem; }
}
@media (max-width: 380px) {
  .poker-seat { width: 5.2rem; }
  .poker-board { top: 50%; }
  .poker-table { min-height: 14.8rem; aspect-ratio: 1 / 0.98; }
  .poker-hero-hand { min-height: 3.7rem; }
  .poker-hero-hand .playing-card { width: 2.55rem; height: 3.6rem; }
  .poker-hint { font-size: .82rem; min-height: 1rem; }
  .poker-actions { gap: .28rem; padding: .2rem 0 .4rem; }
  .poker-actions .btn { min-width: 4.6rem; }
  .poker-disclaimer.compact { font-size: .7rem; padding: .15rem .4rem; }
}
@media (prefers-reduced-motion: reduce) {
  .poker-table .playing-card.deal-in { animation: none; }
}

.choice-row.lang-row { max-height: 9.5rem; overflow-y: auto; }
html[dir="rtl"] .letter-pad { direction: rtl; }
