:root {
  --bg: #1c120c;
  --walnut: #2a1b12;
  --walnut-2: #36241a;
  --walnut-3: #4b3325;
  --wood: #6b472e;
  --ivory: #f2e8d3;
  --cream: #dcc69c;
  --brass: #d4ad62;
  --brass-2: #a9843f;
  --claret: #a3322b;
  --green: #2d5a47;
  --muted: #b6a487;
  --line: rgba(212, 173, 98, .22);
  --r: 12px;
  --display: 'Yeseva One', Georgia, serif;
  font-family: 'Rubik', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ivory);
  background: var(--bg);
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
html { scroll-padding-top: env(safe-area-inset-top, 0px); scroll-behavior: smooth; }
*, *::before, *::after { box-sizing: inherit; }
body {
  margin: 0;
  min-height: 100vh;
  line-height: 1.5;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 .9 0 0 0 0 .8 0 0 0 .045 0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(90% 60% at 70% 0%, #4a2f1e 0%, transparent 60%),
    radial-gradient(70% 50% at 0% 100%, #2a3a2c 0%, transparent 60%),
    var(--bg);
}
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
.muted { color: var(--muted); }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #4f3628, #3d291d);
  padding: .62em 1.15em; border-radius: 999px;
  font-weight: 500; white-space: nowrap; text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 2px 6px #0005;
  transition: transform .12s, border-color .12s, filter .12s;
}
.btn:hover:not(:disabled) { border-color: var(--brass); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary {
  background: linear-gradient(180deg, #e6c47e, var(--brass) 45%, var(--brass-2));
  color: #2a1b12; border-color: #e9cf96; font-weight: 600;
  box-shadow: inset 0 1px 0 #fff6, 0 4px 14px rgba(212, 173, 98, .25);
}
.btn.primary:hover:not(:disabled) { filter: brightness(1.06); }
.btn.danger { background: transparent; border-color: rgba(163, 50, 43, .7); color: #eaa59c; box-shadow: none; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); box-shadow: none; }
.btn.ghost:hover { color: var(--ivory); }
.btn.big { font-size: 1.08rem; padding: .8em 1.7em; }
.btn.icon { font-size: 1.15rem; padding: .45em .6em; }

input:not([type=checkbox]) {
  background: rgba(0, 0, 0, .28); border: 1px solid var(--line); border-radius: 999px;
  padding: .62em 1em; min-width: 0; color: var(--ivory);
}
input::placeholder { color: #8d7c63; }

.avatar {
  --h: 30;
  width: 40px; height: 40px; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-weight: 600; font-size: .95rem; color: #fff;
  background: linear-gradient(145deg, hsl(var(--h) 45% 48%), hsl(var(--h) 50% 30%));
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .15), 0 2px 6px #0006;
}
.avatar.ghost { background: transparent; border: 2px dashed var(--walnut-3); color: var(--muted); box-shadow: none; }

/* ================= ЛОББИ ================= */
.lobby { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 22px 0; gap: 16px; }
.logo { display: flex; align-items: center; gap: 12px; font-family: var(--display); font-size: 1.7rem; text-decoration: none; color: var(--brass); }
.logo-die {
  width: 34px; height: 34px; border-radius: 9px; position: relative; transform: rotate(-12deg);
  background: linear-gradient(145deg, #fff, var(--ivory) 50%, #cdbb93); box-shadow: 0 3px 8px #0007;
}
.logo-die i { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: var(--claret); }
.logo-die i:nth-child(1) { top: 6px; left: 6px; }
.logo-die i:nth-child(2) { top: 14px; left: 14px; }
.logo-die i:nth-child(3) { bottom: 6px; right: 6px; }
.name-chip { display: flex; align-items: center; gap: 4px; background: rgba(0, 0, 0, .25); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.name-chip .avatar { width: 34px; height: 34px; font-size: .8rem; }
.name-chip input { border: 0; background: transparent; width: 170px; font-size: 1rem; }

.hero { display: grid; grid-template-columns: 1.05fr 1fr; gap: 40px; align-items: center; padding: 40px 0 72px; min-height: 520px; }
.hero h1 {
  font-family: var(--display); font-weight: 400; margin: 0 0 18px;
  font-size: clamp(2.6rem, 6vw, 4.6rem); line-height: 1.02; letter-spacing: -.01em;
  background: linear-gradient(180deg, #f6e7c4 10%, var(--brass) 70%, var(--brass-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 2px 30px rgba(212, 173, 98, .12);
}
.lead { font-size: 1.15rem; color: #d8c9ad; max-width: 34ch; margin: 0 0 30px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.join { display: flex; gap: 6px; background: rgba(0, 0, 0, .25); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.join input { border: 0; background: transparent; width: 160px; text-transform: uppercase; letter-spacing: .14em; }

.hero-art { position: relative; height: 460px; }
.scene { position: absolute; inset: 0; perspective: 1100px; display: grid; place-items: center; }
.board3d {
  width: min(380px, 80vw); aspect-ratio: 1; display: grid; grid-template-columns: repeat(8, 1fr);
  transform: rotateX(56deg) rotateZ(-38deg); transform-style: preserve-3d;
  border: 14px solid #5a3a25; border-radius: 6px;
  box-shadow: 0 0 0 2px var(--brass-2), 30px 40px 60px #000c;
  background: #5a3a25;
}
.board3d > span { position: relative; transform-style: preserve-3d; }
.board3d > span.l { background: #ecd9b5; }
.board3d > span.d { background: #a9784f; }
.board3d i {
  position: absolute; left: 50%; bottom: 50%; width: 150%; aspect-ratio: 1;
  transform-origin: 50% 100%;
  transform: translateX(-50%) rotateZ(38deg) rotateX(-90deg) translateY(28%);
}
.board3d i .piece { width: 100%; height: 100%; filter: drop-shadow(0 6px 3px #0006); }
.float-die {
  position: absolute; width: 66px; height: 66px; border-radius: 14px; padding: 9px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px;
  background: linear-gradient(145deg, #fff, var(--ivory) 55%, #cfbd95);
  box-shadow: inset -4px -5px 0 rgba(0, 0, 0, .12), 8px 14px 24px #000a;
}
.float-die i { border-radius: 50%; }
.float-die i.on { background: radial-gradient(circle at 40% 35%, #c2443b, #7c1f1a); }
.float-die.d1 { right: 4%; top: 10%; transform: rotate(18deg); animation: float 6s ease-in-out infinite; }
.float-die.d2 { right: 18%; top: 24%; width: 52px; height: 52px; padding: 7px; transform: rotate(-24deg); animation: float 6s ease-in-out -3s infinite; }
.float-ck { position: absolute; width: 58px; height: 58px; border-radius: 50%; }
.float-ck.w { left: 2%; bottom: 14%; background: radial-gradient(circle at 35% 30%, #fff, var(--ivory) 50%, #c6b48b); box-shadow: inset 0 0 0 9px rgba(0, 0, 0, .05), inset 0 0 0 11px #c9b791, 6px 12px 20px #000a; transform: rotateX(50deg); }
.float-ck.b { left: 12%; bottom: 6%; background: radial-gradient(circle at 35% 30%, #6a4a36, #23170f 60%); box-shadow: inset 0 0 0 9px rgba(255, 255, 255, .03), inset 0 0 0 11px #4a3325, 6px 12px 20px #000a; transform: rotateX(50deg); }
@keyframes float { 50% { translate: 0 -10px; } }

.section-title { font-family: var(--display); font-weight: 400; font-size: 2rem; margin: 0 0 22px; color: var(--cream); }
.games { padding: 20px 0 56px; }
.game-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.game-card {
  background: linear-gradient(180deg, #3a271c, #2b1c13);
  border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 18px 40px #0007;
  transition: transform .2s, border-color .2s;
}
.game-card:hover { transform: translateY(-4px); border-color: rgba(212, 173, 98, .55); }
.card-art { aspect-ratio: 16 / 10; position: relative; border-bottom: 3px solid #5a3a25; overflow: hidden; }
.card-art svg { width: 100%; height: 100%; display: block; }
.mini-chess { display: grid; grid-template-columns: repeat(8, 1fr); height: 100%; }
.mini-chess span { display: grid; place-items: center; }
.mini-chess span.l { background: #ecd9b5; }
.mini-chess span.d { background: #a9784f; }
.mini-chess .piece { width: 92%; height: 92%; filter: drop-shadow(0 2px 1px #0005); }
.card-body { padding: 20px 22px 24px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.card-body h3 { font-family: var(--display); font-weight: 400; font-size: 1.6rem; margin: 0; }
.card-body ul { list-style: none; padding: 0; margin: 0 0 6px; display: grid; gap: 6px; color: #d4c4a6; font-size: .95rem; flex: 1; }
.card-body li { padding-left: 18px; position: relative; }
.card-body li::before { content: ''; position: absolute; left: 2px; top: .55em; width: 7px; height: 7px; border-radius: 50%; background: var(--brass); }
.card-body .btn { align-self: flex-start; }

.how { padding: 10px 0 60px; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; counter-reset: st; }
.steps li { counter-increment: st; display: grid; grid-template-columns: auto 1fr; column-gap: 16px; align-items: start; padding: 18px 20px; border-radius: 16px; background: rgba(0, 0, 0, .2); border: 1px solid var(--line); }
.steps li::before { content: counter(st); grid-row: span 2; font-family: var(--display); font-size: 2.6rem; line-height: 1; color: var(--brass); }
.steps b { font-size: 1.08rem; }
.steps span { color: var(--muted); }
.foot { text-align: center; color: #7d6c55; padding: 26px 0 40px; border-top: 1px solid var(--line); font-size: .9rem; }

/* ================= КОМНАТА ================= */
.room { min-height: 100vh; display: flex; flex-direction: column; }
.room-bar {
  display: flex; align-items: center; gap: 10px; padding: 10px 18px;
  background: rgba(24, 15, 10, .82); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.room-title { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 12px; }
.room-title h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 1.45rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-title span { color: var(--muted); font-size: .9rem; white-space: nowrap; }
.room-title b { color: var(--brass); letter-spacing: .12em; }
.room-body { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; padding: 20px; max-width: 1320px; width: 100%; margin: 0 auto; }
.game-area { min-width: 0; display: flex; justify-content: center; }

/* карточка игрока */
.player {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 8px 14px 8px 8px;
  border-radius: 14px; background: rgba(0, 0, 0, .22); border: 1px solid transparent;
  transition: background .2s, border-color .2s;
}
.player.turn { background: linear-gradient(90deg, rgba(212, 173, 98, .18), rgba(212, 173, 98, .04)); border-color: rgba(212, 173, 98, .45); }
.player.away { opacity: .7; }
.player .who { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.player .who b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player .who small { color: var(--brass); font-weight: 500; margin-left: 4px; }
.player .who span { font-size: .82rem; color: var(--muted); }
.player.turn .who span { color: var(--brass); }
.player.turn .who span::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--brass); animation: pulse 1.4s infinite; vertical-align: 1px; }
@keyframes pulse { 50% { opacity: .25; } }
.player .token { display: grid; place-items: center; }
.player .token .piece { width: 36px; height: 36px; }
.player .token .ck { width: 26px; height: 26px; margin: 0; }
.player .stats { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: .88rem; color: var(--muted); }
.stat b { color: var(--ivory); font-size: 1.02rem; }
.captured { display: flex; align-items: center; flex-wrap: wrap; max-width: 220px; }
.captured .piece { width: 20px; height: 20px; margin-right: -5px; }
.adv { color: var(--brass); font-weight: 600; margin-left: 10px; }

.status { margin: 4px 0 0; font-size: 1.08rem; text-align: center; min-height: 1.5em; }
.status.alert { color: #f08a7e; font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; }
.offer { color: var(--brass); margin-right: 4px; }

/* боковая панель */
.side {
  display: flex; flex-direction: column; min-height: 0;
  max-height: calc(100vh - 110px); position: sticky; top: 84px;
  background: linear-gradient(180deg, #33221a, #2a1b12); border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
}
.tabs { display: flex; padding: 6px; gap: 4px; border-bottom: 1px solid var(--line); }
.tab { flex: 1; border: 0; background: transparent; padding: .6em; border-radius: 10px; color: var(--muted); font-weight: 500; }
.tab.active { background: rgba(212, 173, 98, .14); color: var(--ivory); }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--claret); color: #fff; font-size: .75rem; margin-left: 4px; }
.tab-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.info-pane { padding: 14px 16px; gap: 8px; }
.info-pane h4 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 1.15rem; color: var(--cream); }
.scroll { flex: 1; overflow-y: auto; min-height: 120px; }
.moves { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.moves td { padding: 5px 6px; }
.moves tr:nth-child(odd) { background: rgba(0, 0, 0, .18); }
.moves td:first-child { color: var(--muted); width: 2.6em; }
.moves tr:last-child td:not(:first-child):not(:empty):last-of-type { color: var(--brass); }
.log { list-style: none; margin: 0; padding: 0; font-size: .9rem; color: #d4c4a6; }
.log li { padding: 6px 8px; border-radius: 8px; }
.log li:nth-child(odd) { background: rgba(0, 0, 0, .18); }
.rules { border-top: 1px solid var(--line); padding-top: 10px; font-size: .88rem; color: var(--muted); }
.rules summary { cursor: pointer; color: var(--cream); }
.chat { min-height: 0; }
.chat-list { flex: 1; list-style: none; margin: 0; padding: 14px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; min-height: 160px; }
.chat-list li { display: flex; gap: 8px; align-items: flex-end; }
.chat-list .avatar { width: 28px; height: 28px; font-size: .7rem; }
.chat-list li div { background: rgba(0, 0, 0, .28); padding: 6px 12px; border-radius: 14px 14px 14px 4px; max-width: 85%; overflow-wrap: anywhere; }
.chat-list li b { display: block; font-size: .78rem; color: var(--brass); font-weight: 500; }
.chat-list li.mine { flex-direction: row-reverse; }
.chat-list li.mine div { background: rgba(212, 173, 98, .18); border-radius: 14px 14px 4px 14px; }
.chat-form { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; }

/* итог партии */
.overlay { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(10, 6, 3, .62); backdrop-filter: blur(3px); padding: 20px; }
.modal {
  width: min(380px, 100%); text-align: center; padding: 30px 26px 24px; border-radius: 22px;
  background: linear-gradient(180deg, #3d2a1e, #2a1b12); border: 1px solid rgba(212, 173, 98, .5);
  box-shadow: 0 30px 80px #000c; animation: pop .35s cubic-bezier(.2, 1.4, .4, 1);
}
.modal h3 { font-family: var(--display); font-weight: 400; font-size: 2.2rem; margin: 6px 0 4px; color: var(--brass); }
.modal p { margin: 0 0 20px; color: var(--muted); }
.modal-actions { display: flex; flex-direction: column; gap: 8px; }
.trophy { font-size: 3.4rem; line-height: 1; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }

/* ================= ШАХМАТЫ ================= */
.chess { width: min(100%, 640px, calc(100vh - 140px)); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.cframe {
  width: 100%; display: grid; grid-template-columns: 22px 1fr; grid-template-rows: 1fr 22px;
  padding: 10px 14px 6px 6px; border-radius: 14px;
  background: linear-gradient(145deg, #6e4a30, #4a3020 60%, #3b271a);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08), 0 20px 50px #000a;
}
.ranks { display: grid; grid-template-rows: repeat(8, 1fr); }
.files { grid-column: 2; display: grid; grid-template-columns: repeat(8, 1fr); }
.ranks i, .files i { font-style: normal; display: grid; place-items: center; font-size: .78rem; color: #e6cf9f; opacity: .8; }
.board-wrap { position: relative; }
.cboard {
  display: grid; grid-template-columns: repeat(8, 1fr); width: 100%; aspect-ratio: 1;
  border-radius: 3px; overflow: hidden; box-shadow: 0 0 0 2px var(--brass-2), inset 0 0 20px #0004;
}
.sq { position: relative; border: 0; padding: 0; display: grid; place-items: center; aspect-ratio: 1; }
.sq.l { background: linear-gradient(135deg, #f0dfbf, #e6d1a9); }
.sq.d { background: linear-gradient(135deg, #b5845a, #a3734b); }
.sq .piece { width: 90%; height: 90%; filter: drop-shadow(0 3px 2px rgba(0, 0, 0, .35)); transition: transform .1s; pointer-events: none; position: relative; z-index: 1; }
.cboard.myturn .sq.mv:hover .piece { transform: translateY(-3px) scale(1.04); }
.sq.last::before { content: ''; position: absolute; inset: 0; background: rgba(214, 178, 80, .42); }
.sq.sel::before { content: ''; position: absolute; inset: 0; background: rgba(45, 120, 85, .55); }
.sq.check::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle, #ff4a3a 0, rgba(255, 74, 58, .5) 40%, transparent 72%); }
.sq.tgt::after { content: ''; position: absolute; width: 30%; aspect-ratio: 1; border-radius: 50%; background: rgba(30, 80, 58, .6); z-index: 2; }
.sq.cap::after { content: ''; position: absolute; inset: 3%; border-radius: 50%; border: 5px solid rgba(30, 80, 58, .7); z-index: 2; }
.sq.tgt:hover::after { width: 42%; }
.promo {
  position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; align-content: center; gap: 12px;
  background: rgba(20, 12, 8, .72); backdrop-filter: blur(2px);
}
.promo p { margin: 0; font-size: 1.1rem; }
.promo > div { display: flex; gap: 10px; }
.promo button { width: clamp(56px, 16vw, 86px); aspect-ratio: 1; border-radius: 14px; border: 1px solid var(--brass); background: linear-gradient(145deg, #f0dfbf, #d8c197); display: grid; place-items: center; }
.promo .piece { width: 84%; height: 84%; }

/* фигуры */
.piece { display: block; }
.pw .b { fill: #faf5e8; stroke: #22160e; stroke-width: 1.5; stroke-linejoin: round; }
.pw .d { fill: none; stroke: #22160e; stroke-width: 1.5; stroke-linecap: round; }
.pw .f { fill: #22160e; }
.pb .b { fill: #2a1c13; stroke: #0b0604; stroke-width: 1.5; stroke-linejoin: round; }
.pb .d { fill: none; stroke: #e9dcc0; stroke-width: 1.3; stroke-linecap: round; }
.pb .f { fill: #e9dcc0; }

/* ================= НАРДЫ ================= */
.nardy { width: min(100%, 920px, calc((100vh - 200px) * 1.45)); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.nframe {
  width: 100%; padding: 14px; border-radius: 16px; position: relative;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, .07) 0 3px, transparent 3px 11px),
    linear-gradient(145deg, #6e4a30, #4a3020 60%, #3b271a);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08), 0 22px 50px #000b;
}
.nframe::before, .nframe::after {
  content: ''; position: absolute; width: 10px; height: 10px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f6dfa6, var(--brass-2)); top: 3px; left: 3px;
}
.nframe::after { left: auto; right: 3px; }
.nboard {
  width: 100%; aspect-ratio: 14 / 9.2; container-type: inline-size;
  display: grid; grid-template-columns: repeat(6, 1fr) .62fr repeat(6, 1fr) .85fr; grid-template-rows: 1fr 11% 1fr;
  border-radius: 6px; overflow: hidden;
  background:
    repeating-linear-gradient(88deg, rgba(0, 0, 0, .05) 0 2px, transparent 2px 7px, rgba(255, 255, 255, .025) 7px 9px, transparent 9px 16px),
    linear-gradient(180deg, #7b5436, #6b472e 50%, #7b5436);
  box-shadow: inset 0 0 0 2px var(--brass-2), inset 0 0 40px #0006;
}
.pt { position: relative; border: 0; background: none; padding: 0 3%; display: flex; flex-direction: column; align-items: center; }
.pt::before { content: ''; position: absolute; inset: 1.5% 5%; z-index: 0; }
.pt.top::before { clip-path: polygon(0 0, 100% 0, 50% 88%); }
.pt.bottom { flex-direction: column-reverse; }
.pt.bottom::before { clip-path: polygon(0 100%, 100% 100%, 50% 12%); }
.pt.odd::before { background: linear-gradient(180deg, #b23a31, #8a2822); }
.pt.even::before { background: linear-gradient(180deg, #ead7b0, #cdb388); }
.pt.bottom.odd::before { background: linear-gradient(0deg, #b23a31, #8a2822); }
.pt.bottom.even::before { background: linear-gradient(0deg, #ead7b0, #cdb388); }
.pt .stack { position: relative; z-index: 1; display: flex; flex-direction: inherit; align-items: center; width: 100%; height: 100%; padding: 4% 0; }
.pt .num { position: absolute; font-style: normal; font-size: max(9px, 1.25cqi); color: rgba(242, 232, 211, .55); z-index: 1; }
.pt.top .num { bottom: -1.7em; }
.pt.bottom .num { top: -1.7em; }
.ck {
  width: min(90%, 5.5cqi); aspect-ratio: 1; border-radius: 50%; flex: none; margin: 0;
  display: grid; place-items: center; position: relative;
}
.ck.w {
  background: radial-gradient(circle at 35% 28%, #fff 0, #f4ead4 40%, #cdbb92 100%);
  box-shadow: inset 0 0 0 .55cqi #dccaa3, inset 0 0 0 .8cqi #b8a47c, inset 0 0 0 1.8cqi rgba(0, 0, 0, 0), 0 .25cqi .4cqi #0008;
}
.ck.b {
  background: radial-gradient(circle at 35% 28%, #7a563f 0, #3a271b 40%, #170e09 100%);
  box-shadow: inset 0 0 0 .55cqi #2d1e15, inset 0 0 0 .8cqi #5c4231, 0 .25cqi .4cqi #000a;
}
.ck::after { content: ''; position: absolute; inset: 24%; border-radius: 50%; }
.ck.w::after { border: 1px solid rgba(160, 138, 98, .6); }
.ck.b::after { border: 1px solid rgba(140, 104, 78, .6); }
.ck b { font-size: max(10px, 1.9cqi); font-weight: 700; position: relative; z-index: 1; }
.ck.w b { color: #3a271b; }
.ck.b b { color: var(--ivory); }
.player .ck::after { inset: 22%; }

.pt.src .stack > .ck:last-child, .bar.src .ck:last-child { box-shadow: 0 0 0 .35cqi var(--brass), 0 0 1.4cqi rgba(212, 173, 98, .8); }
.nboard.myturn .pt.src { cursor: pointer; }
.pt.sel::after, .bar.sel::after { content: ''; position: absolute; inset: 0 2%; background: rgba(212, 173, 98, .22); border-radius: 6px; z-index: 0; }
.pt.tgt::after {
  content: ''; position: absolute; inset: 0 8%; z-index: 2; border-radius: 8px;
  background: rgba(45, 120, 85, .45); border: 2px dashed rgba(242, 232, 211, .85);
}
.pt.tgt:hover::after { background: rgba(45, 140, 95, .65); }
.pt.last .stack > .ck:last-child { box-shadow: 0 0 0 .3cqi rgba(242, 232, 211, .7), 0 .25cqi .4cqi #0008; }
.pt.from::before { filter: brightness(1.18); }
.bar {
  border: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; position: relative; padding: 0 6%;
  background: linear-gradient(90deg, #3a271b, #4e3424 50%, #3a271b);
  box-shadow: inset 2px 0 0 var(--brass-2), inset -2px 0 0 var(--brass-2);
}
.bar .ck { width: min(86%, 5.5cqi); }
.tray {
  border: 0; margin-left: 12%; display: flex; flex-direction: column-reverse; gap: 1px; padding: 8% 14%; position: relative;
  background: linear-gradient(180deg, #24170f, #1a100a); box-shadow: inset 0 2px 8px #000a;
}
.tray.up { flex-direction: column; }
.tray i { height: 3.9%; border-radius: 2px; flex: none; }
.tray i.w { background: linear-gradient(90deg, #cdbb92, #fff, #cdbb92); }
.tray i.b { background: linear-gradient(90deg, #170e09, #6a4a36, #170e09); }
.tray.tgt { background: rgba(45, 120, 85, .6); outline: 2px dashed var(--ivory); outline-offset: -4px; cursor: pointer; }
.tray em { position: absolute; inset: 0; display: grid; place-items: center; font-style: normal; font-size: max(10px, 1.3cqi); writing-mode: vertical-rl; }
.mid {
  display: flex; align-items: center; justify-content: center; gap: 1.6cqi;
  background: linear-gradient(180deg, rgba(0, 0, 0, .18), rgba(0, 0, 0, .05) 50%, rgba(0, 0, 0, .18));
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, .15), inset 0 -2px 0 rgba(0, 0, 0, .15);
}
.die {
  width: 6.4cqi; height: 6.4cqi; border-radius: 20%; padding: .85cqi; gap: .3cqi;
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
  background: linear-gradient(145deg, #fff, var(--ivory) 55%, #cdbb93);
  box-shadow: inset -.3cqi -.4cqi 0 rgba(0, 0, 0, .12), 0 .5cqi 1cqi #000a;
  transition: opacity .25s, transform .25s;
}
.die i { border-radius: 50%; }
.die i.on { background: radial-gradient(circle at 40% 35%, #c2443b, #7c1f1a); }
.die.used { opacity: .28; transform: scale(.88); }
.die.rolling { animation: roll .55s cubic-bezier(.3, 1.4, .5, 1) both; animation-delay: calc(var(--i) * 60ms); }
@keyframes roll {
  0% { transform: translateY(-120%) rotate(-200deg) scale(.6); opacity: 0; }
  60% { opacity: 1; }
  100% { transform: none; }
}
.roll-btn {
  border: 0; border-radius: 999px; padding: .6cqi 2.6cqi; font-weight: 600; font-size: max(13px, 1.7cqi); color: #2a1b12;
  background: linear-gradient(180deg, #ecd090, var(--brass) 50%, var(--brass-2));
  box-shadow: inset 0 1px 0 #fff7, 0 .4cqi 1.4cqi rgba(212, 173, 98, .45);
  animation: glow 1.8s ease-in-out infinite;
}
@keyframes glow { 50% { box-shadow: inset 0 1px 0 #fff7, 0 0 2.4cqi rgba(212, 173, 98, .8); } }

/* ---------- уведомления ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px);
  background: var(--ivory); color: var(--walnut); padding: 10px 20px; border-radius: 999px; font-weight: 500;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60; max-width: 90vw; text-align: center;
  box-shadow: 0 10px 30px #000a;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.conn { position: fixed; top: env(safe-area-inset-top, 0px); left: 0; right: 0; background: var(--claret); text-align: center; padding: 6px; z-index: 70; font-size: .9rem; }

/* ---------- адаптив ---------- */
@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; padding-top: 10px; min-height: 0; }
  .hero-art { height: 340px; order: -1; }
  .game-grid, .steps { grid-template-columns: 1fr; }
  .game-grid { max-width: 520px; }
  .room-body { grid-template-columns: 1fr; padding: 12px; gap: 14px; }
  .side { position: static; max-height: none; }
  .scroll { max-height: 220px; }
  .chat-list { max-height: 300px; }
  .chess, .nardy { width: 100%; }
}
@media (max-width: 600px) {
  .lobby { padding: 0 16px; }
  .name-chip input { width: 110px; }
  .hero-art { height: 280px; }
  .board3d { width: 250px; border-width: 9px; }
  .float-die.d1 { width: 48px; height: 48px; padding: 6px; right: 0; }
  .float-die.d2 { width: 38px; height: 38px; padding: 5px; }
  .float-ck { width: 40px; height: 40px; }
  .hero-cta .btn.big { width: 100%; }
  .join { width: 100%; }
  .join input { flex: 1; }
  .room-bar { padding: 8px 10px; gap: 4px; }
  .room-title { flex-direction: column; gap: 0; }
  .room-title h2 { font-size: 1.15rem; }
  .room-title span { font-size: .78rem; }
  .room-bar .btn { padding: .5em .8em; }
  .player { padding: 6px 10px 6px 6px; gap: 8px; }
  .avatar { width: 34px; height: 34px; font-size: .8rem; }
  .player .stats { gap: 8px; font-size: .78rem; }
  .player .token { display: none; }
  .cframe { grid-template-columns: 14px 1fr; grid-template-rows: 1fr 16px; padding: 6px 8px 4px 4px; }
  .ranks i, .files i { font-size: .65rem; }
  .nframe { padding: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
