:root {
  --bg: #1b1410;
  --bg2: #261c16;
  --panel: #2f231c;
  --panel2: #3a2c23;
  --line: #55402f;
  --text: #f3e8d6;
  --muted: #b89f85;
  --accent: #e8a33d;
  --accent2: #3fb8af;
  --danger: #d0533b;
  --ok: #6fbf73;
  --card-w: 68px;
  --card-h: 100px;
  --cell-w: 72px;
  --cell-h: 104px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow-x: hidden; overscroll-behavior-x: none;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; font-size: 15px; }
button { font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--panel2);
  color: var(--text); padding: 8px 14px; border-radius: 10px; transition: .15s; }
button:hover { border-color: var(--accent); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent); color: #241709; border-color: var(--accent); font-weight: 600; }
button.danger { border-color: var(--danger); color: #ffb3a3; }
button.link { background: none; border: none; color: var(--accent2); text-decoration: underline; padding: 4px; }
input { font: inherit; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: #15100d; color: var(--text); outline: none; }
input:focus { border-color: var(--accent); }
.hidden { display: none !important; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: 13px; }
.screen { min-height: 100vh; }

/* ---------- вход ---------- */
.hero { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(1200px 600px at 20% 10%, #4a2c1a 0%, transparent 60%),
              radial-gradient(900px 500px at 90% 90%, #0f3b3a 0%, transparent 60%), var(--bg);
  background-size: cover; background-position: center; }
.hero.has-art { background-blend-mode: multiply; }
.hero { position: relative; }
.hero-bg, .hero-video, .hero-shade { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.hero-bg { z-index: 0; background: #1b1410 center / cover no-repeat; }
.hero-video { z-index: 0; object-fit: cover; filter: saturate(.85) contrast(1.05); opacity: 0; transition: opacity 1.4s ease; }
.hero-video.ready { opacity: 1; }
.hero-shade { z-index: 1; background: radial-gradient(ellipse at center, rgba(27,20,16,.25) 0%, rgba(27,20,16,.75) 70%, rgba(27,20,16,.95) 100%); }
.hero .login-box { position: relative; z-index: 2; }
.video-toggle { position: fixed; right: 12px; bottom: 12px; z-index: 3; padding: 4px 10px; font-size: 12px; border-radius: 999px; background: rgba(20,12,6,.7); color: var(--muted); border: 1px solid var(--line); }
.video-toggle:hover { color: var(--text); }
.login-box { width: min(440px, 100%); background: rgba(31, 22, 17, .92); border: 1px solid var(--line);
  border-radius: 18px; padding: 28px; display: flex; flex-direction: column; gap: 14px; backdrop-filter: blur(6px); }
.logo-wrap { text-align: center; }
.logo { width: 100%; border-radius: 12px; display: block; }
.with-logo { position: relative; }
/* надпись живёт во внутреннем картуше логотипа (центральные 44% ширины, картуш чуть ниже центра):
   заголовок переносится скриптом внутрь .logo-wrap, который сжат до ширины картинки и служит контейнером,
   поэтому все проценты и cqw считаются от реальной ширины логотипа, а не карточки */
.with-logo .logo-wrap { position: relative; display: inline-block; vertical-align: top; container-type: inline-size; max-width: 100%; }
.with-logo .logo-wrap .logo { display: block; }
.with-logo .logo-wrap .title { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; margin: 0; pointer-events: none;
  padding: 0 28%; box-sizing: border-box; line-height: 1.04; overflow-wrap: normal; word-break: normal; }
.with-logo .logo-wrap .title, .with-logo .logo-wrap .title span { font-size: clamp(12px, 4.9cqw, 20px); text-shadow: 0 2px 8px #000; }
.title { margin: 0; font-size: 34px; letter-spacing: .5px; color: var(--accent); text-align: center; }
.title.small { font-size: 24px; text-align: left; }
.subtitle { margin: 0; color: var(--muted); text-align: center; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.login-box input { width: 100%; }
.code-input { text-transform: uppercase; letter-spacing: 6px; font-weight: 700; width: 140px !important; text-align: center; }
.or { text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- лобби ---------- */
.lobby { max-width: 1080px; margin: 0 auto; padding: 24px 20px 40px; display: flex; flex-direction: column; gap: 16px; }
.lobby-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.room-code { font-size: 18px; color: var(--muted); }
.room-code b { font-size: 30px; color: var(--accent); letter-spacing: 6px; margin-left: 8px; }
.invite { display: flex; gap: 8px; }
.invite { flex-wrap: wrap; }
.invite input { flex: 1; min-width: 220px; color: var(--accent2); }
.btn-link { display: inline-flex; align-items: center; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); text-decoration: none; }
.btn-link:hover { border-color: var(--accent); }
.lobby-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 24px; }
@media (max-width: 800px) { .lobby-grid { grid-template-columns: 1fr; } }
h3 { margin: 6px 0 10px; color: var(--muted); font-weight: 600; font-size: 14px; text-transform: uppercase; letter-spacing: 1px; }
.settings { margin: 12px 0; display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.settings .opt-check { display: flex; align-items: flex-start; gap: 10px; line-height: 1.35; }
.settings .opt-check input { margin-top: 3px; flex: 0 0 auto; }
.settings .opt-check .hint { font-size: 13px; }
.opt-row { display: flex; align-items: flex-start; gap: 12px; }
.opt-row .opt-name { flex: 0 0 120px; padding-top: 8px; color: var(--text); }
.opt-row .opt-ctl { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.opt-row select { width: 100%; max-width: 260px; }
.opt-row .hint { font-size: 12px; margin: 0; }
.lobby-actions { margin-top: 4px; }
.chk { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
.world-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.world-opt { border: 2px solid var(--line); border-radius: 14px; padding: 10px; cursor: pointer; background: var(--panel);
  display: flex; flex-direction: column; gap: 6px; min-height: 90px; position: relative; overflow: hidden; }
.world-opt .w-art { height: 90px; border-radius: 8px; background-size: cover; background-position: center; background-color: #15100d; }
.world-opt b { font-size: 15px; }
.world-opt small { color: var(--muted); }
.world-opt .w-art { position: relative; }
.world-opt .plays { position: absolute; top: 6px; right: 6px; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 13px; display: grid; place-items: center;
  background: rgba(20,12,6,.82); color: var(--accent); border: 1px solid var(--accent); font-size: 12px; font-weight: 700; box-shadow: 0 2px 6px rgba(0,0,0,.6); }
.world-opt.active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(232,163,61,.2); }
.world-opt.readonly { cursor: default; }
.world-story { margin-top: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  font-size: 14px; line-height: 1.5; color: #e5d6c1; }
.world-story .roles { margin-top: 8px; display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.lobby-chat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.lobby-chat .pane { max-height: 160px; min-height: 60px; }

/* ---------- списки игроков ---------- */
.player-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.player-list li { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px;
  display: flex; align-items: center; gap: 10px; position: relative; }
.player-list li .avatar { width: 40px; height: 40px; border-radius: 50%; background: #15100d center/cover; display: grid;
  place-items: center; font-size: 20px; flex-shrink: 0; border: 2px solid var(--line); }
.player-list li .pname { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-list li .pname small { color: var(--muted); font-weight: 400; }
.player-list .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); flex-shrink: 0; }
.player-list .dot.off { background: #777; }
.player-list.game li.offline { opacity: .55; filter: saturate(.4); }
.offline-badge { font-size: 13px; flex-shrink: 0; }

.player-list .kick { padding: 3px 8px; font-size: 12px; }
.player-list.game li { flex-wrap: wrap; }



.player-list.game li.turn .avatar { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(232,163,61,.5); }

@keyframes turnPulse { 0%, 100% { box-shadow: 0 0 0 3px rgba(232,163,61,.35), 0 0 22px rgba(232,163,61,.45); } 50% { box-shadow: 0 0 0 3px rgba(232,163,61,.15), 0 0 8px rgba(232,163,61,.2); } }
.hand-bar.my-turn { border-top: 2px solid var(--accent2); box-shadow: 0 -6px 24px rgba(63,184,175,.25); }
.player-list.game li.me { background: #35281f; }
.player-list.game li.targetable { cursor: pointer; border-color: var(--accent2); animation: pulse 1.2s infinite; }
.player-list.game li.targetable:hover { background: #2a3b3a; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(63,184,175,.4);} 50% { box-shadow: 0 0 0 5px rgba(63,184,175,0);} }
.pmeta { width: 100%; display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.item-chip { padding: 2px 7px; border-radius: 8px; background: #1f3a2b; color: #a9e2b1; border: 1px solid #2d5a3f; }
.item-chip .ic { font-size: 12px; }
.item-chip.broken .ic { filter: grayscale(1); opacity: .6; }
.item-chip.broken { background: #4a1f18; color: #ffb3a3; border-color: #7a3328; text-decoration: line-through; }
.mic { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  background: #3a3a3a; color: #9a9a9a; border: 1px solid #555; transition: background .15s, box-shadow .15s; }
.mic.quiet { background: #5a4a12; color: #ffd36b; border-color: #b08a2a; }
.mic.talk { background: #1f5a2e; color: #8ff0a0; border-color: #4bc26a; box-shadow: 0 0 0 3px rgba(111,191,115,.35); }
.mic.muted { background: #4a1f18; color: #ffb3a3; border-color: #7a3328; }
.voice-members .mic { width: 16px; height: 16px; vertical-align: middle; }
.voice-members .mic svg { width: 10px; height: 10px; }
.badge-host { font-size: 11px; color: var(--accent); }

/* ---------- карточка игрока (вариант A: по эскизу) ---------- */
.players-pane { width: 100%; }
.player-list.game li { display: grid; grid-template-columns: 54px 1fr 24px; grid-template-rows: auto auto; gap: 3px 8px;
  padding: 8px 8px 13px 10px; align-items: center; border-radius: 12px; }
.player-list.game li.turn { padding-top: 24px; }
.player-list.game li.turn::before { content: "ХОДИТ"; position: absolute; top: 0; left: 0; right: 0; height: 16px; line-height: 16px; text-align: center;
  background: var(--accent); color: #241709; font-size: 10px; font-weight: 800; letter-spacing: 2px; border-radius: 11px 11px 0 0; padding: 0; }
.player-list.game li.turn.me::before { content: "ВАШ ХОД"; background: var(--accent2); color: #062a28; }
.player-list.game .avwrap { grid-row: 1 / 3; position: relative; width: 48px; height: 48px; }
.player-list.game .avwrap .avatar { width: 48px; height: 48px; font-size: 22px; }
.player-list.game .avwrap .badge-host { position: absolute; left: -5px; top: -5px; width: 17px; height: 17px; border-radius: 50%; background: var(--accent); color: #241709;
  font-size: 10px; line-height: 1; display: grid; place-items: center; box-shadow: 0 1px 3px rgba(0,0,0,.6); z-index: 2; }
.player-list.game .under { position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); display: flex; white-space: nowrap; }
.player-list.game .num { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: #15100d;
  border: 1px solid var(--line); font-size: 10px; line-height: 1; color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.6); }
.player-list.game .num.coins { color: #ffd36b; border-color: #b08a2a; margin-left: -4px; }
.player-list.game .pname { grid-column: 2; grid-row: 1; align-self: end; font-size: 13px; }
.player-list.game .items { grid-column: 2; grid-row: 2; display: flex; gap: 5px; align-items: center; }
.player-list.game .item-chip { width: 22px; height: 22px; min-width: 22px; padding: 0; border-radius: 50%; background: #1f3a2b; border: 1px solid #2d5a3f;
  display: inline-grid; place-items: center; position: relative; overflow: hidden; box-sizing: border-box; text-decoration: none; }
.player-list.game .item-chip .ic { font-size: 12px; line-height: 1; }
.player-list.game .item-chip .lbl { display: none; }
.player-list.game .item-chip.broken { background: #4a1f18; border-color: var(--danger); }
.player-list.game .item-chip.broken .ic { filter: grayscale(1); opacity: .5; }
.player-list.game .item-chip.broken::after { content: ""; position: absolute; left: 3px; right: 3px; top: 50%; height: 2px; margin-top: -1px; background: var(--danger); transform: rotate(-40deg); border-radius: 1px; }
.player-list.game .side { grid-column: 3; grid-row: 1 / 3; display: flex; flex-direction: column; align-items: center; gap: 7px; }
.player-list.game .side .mic { width: 22px; height: 22px; }
.player-list.game .side .mic svg { width: 12px; height: 12px; }
.player-list.game .side .dot { width: 8px; height: 8px; }
.player-list.game .side .offline-badge { font-size: 13px; }
.player-list.game li .kick { position: absolute; right: 30px; bottom: 6px; padding: 1px 7px; font-size: 11px; opacity: 0; transition: opacity .15s; }
.player-list.game li:hover .kick { opacity: 1; }
.player-list.game li.me .pname { color: var(--accent2); }
.player-list.game li.turn .pname { color: var(--accent); }
.player-list.game li.turn.me .pname { color: var(--accent2); }
.role-card { padding: 8px 10px 9px; border-radius: 10px; display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.role-card .r-title { display: block; font-size: 14px; line-height: 1.2; text-align: left; }
.role-card .r-body { display: flex; gap: 9px; align-items: flex-start; }
.role-card .r-art { width: 34px; height: 48px; border-radius: 5px; font-size: 20px; flex-shrink: 0; }
.role-card .r-goal { font-size: 11px; line-height: 1.3; display: block; color: var(--muted); }
.role-card .r-mates { font-size: 11px; color: var(--danger); }

.player-list.game li.turn { border-color: var(--accent); background: linear-gradient(90deg, #4a3414, #3a2a16);
  box-shadow: 0 0 0 3px rgba(232,163,61,.35), 0 0 22px rgba(232,163,61,.45); animation: turnPulse 1.6s ease-in-out infinite; }
.player-list.game li.turn.me { border-color: var(--accent2); background: linear-gradient(90deg, #16403d, #1f3a38); box-shadow: 0 0 0 3px rgba(63,184,175,.35), 0 0 22px rgba(63,184,175,.4); }

/* ---------- игра ---------- */
#screen-game { display: flex; flex-direction: column; height: 100vh; height: 100dvh; width: 100%; max-width: 100vw; overflow: hidden; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 8px 14px; background: var(--bg2); border-bottom: 1px solid var(--line); min-width: 0; }
.topbar .ico { display: none; }
.side-only { display: none; }
.brand { font-weight: 700; color: var(--accent); white-space: nowrap; }
.room-tag { font-weight: 400; color: var(--muted); font-size: 13px; margin-left: 6px; letter-spacing: 2px; }
.status { flex: 1; text-align: center; color: var(--text); font-weight: 600; }
.status.mine { color: var(--accent2); }
.topbar-right { display: flex; gap: 6px; align-items: center; }
.pill { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-size: 13px; color: var(--text); }
.pill.btn { cursor: pointer; }
/* переключатели в верхней строке: вкл — бирюзовая заливка, выкл — тусклый значок с красной чертой */
.pill.btn.tg { position: relative; }
.pill.btn.tg.on { background: #1f4a46; border-color: var(--accent2); color: #d9fffb; box-shadow: inset 0 0 0 1px rgba(111,220,200,.25); }
.pill.btn.tg.off { background: #1d1612; border-color: #3a2e26; color: #8a7a6c; }
.pill.btn.tg { display: inline-flex; align-items: center; gap: 6px; }
.pill.btn.tg .ico-svg { flex: 0 0 auto; display: block; }
.pill.btn.tg.on .ico-svg { color: #8fe3d6; }
.pill.btn.tg.off .ico-svg { color: #8a7a6c; }
.pill.btn:focus { outline: none; }
.pill.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pill.btn.av.busy { opacity: .6; cursor: progress; }

.game-layout { flex: 1; display: grid; grid-template-columns: 212px 1fr 280px; min-height: 0; }
.players-pane, .side-pane { background: var(--bg2); padding: 8px; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.players-pane { border-right: 1px solid var(--line); }
.side-pane { border-left: 1px solid var(--line); }
.role-card { background: var(--panel); border: 1px solid var(--line); }
.role-card .r-art { background: #15100d center/cover; display: grid; place-items: center; }

.role-card.friend .r-title { color: var(--accent2); }
.role-card.hustler .r-title { color: var(--danger); }


.board-wrap { overflow: auto; touch-action: pan-x pan-y; overscroll-behavior: contain; background:
  radial-gradient(circle at 30% 20%, rgba(232,163,61,.06), transparent 40%),
  repeating-linear-gradient(45deg, #1d1612 0 10px, #1a1310 10px 20px); position: relative; }
.board { position: relative; transform-origin: 0 0; margin: 20px; }
.cell { position: absolute; width: var(--card-w); height: var(--card-h); border-radius: 7px; }
.cell.empty { border: 1px dashed rgba(255,255,255,.04); }
.cell.valid { border: 2px dashed var(--accent2); cursor: pointer; background: rgba(63,184,175,.08); }
.cell.valid .ghost { opacity: .45; }
.cell.valid:hover .ghost { opacity: .9; }
.cell.rock-target { cursor: pointer; outline: 2px dashed var(--danger); outline-offset: 2px; }
.cell.rock-target:hover { outline-style: solid; }
.cell.goal-target { cursor: pointer; outline: 2px dashed var(--accent); outline-offset: 2px; }
.cell svg { width: 100%; height: 100%; display: block; border-radius: 7px; box-shadow: 0 2px 6px rgba(0,0,0,.5); }
.cell .peek { position: absolute; left: 4px; top: 4px; font-size: 18px; filter: drop-shadow(0 1px 2px #000); }
.cell.just-placed svg { animation: drop .35s ease-out; }
@keyframes drop { from { transform: scale(1.25); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- рука ---------- */
/* компьютер: подсказка и кнопки в одной строке над картами; телефон: подсказка — карты — кнопки (см. медиазапрос) */
.hand-bar { background: var(--bg2); border-top: 1px solid var(--line); padding: 8px 14px; display: grid; grid-template-columns: 1fr auto; grid-template-areas: "hint btns" "hand hand"; gap: 6px 10px; align-items: center; }
.hand-actions { grid-area: hint; display: flex; gap: 10px; align-items: center; min-height: 42px; position: relative; }
.hand-btns { grid-area: btns; display: flex; gap: 10px; align-items: center; min-height: 42px; position: relative; z-index: 1; }
.hand-btns button { padding: 7px 12px; line-height: 1.2; }
.hand { grid-area: hand; }
.action-hint { flex: 1; color: var(--muted); text-align: center; }
.action-hint.mine { color: var(--accent2); font-weight: 600; }
.hand { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.hcard { width: 86px; height: 126px; border-radius: 9px; cursor: pointer; transition: transform .35s cubic-bezier(.2,.7,.2,1) .06s, box-shadow .35s ease .06s; position: relative; transform-origin: 50% 100%; }
.hcard svg { width: 100%; height: 100%; display: block; border-radius: 9px; box-shadow: 0 3px 8px rgba(0,0,0,.6); }
@media (hover: hover) and (pointer: fine) {
  .hcard:hover { transform: translateY(-14px) scale(1.3); z-index: 6; }
  .hcard:hover svg { box-shadow: 0 12px 26px rgba(0,0,0,.7); }
  .hcard.sel:hover { transform: translateY(-14px) scale(1.3); }
}
.hcard.sel { transform: translateY(-10px) scale(1.06); box-shadow: 0 0 0 3px var(--accent); border-radius: 9px; z-index: 5; }
.hand-bar { overflow: visible; }
.hand { overflow: visible; }
/* крупный просмотр карты по долгому нажатию (телефон) */
.card-preview { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.72); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; pointer-events: none; animation: peekIn .15s ease-out; }
.card-preview .big-card { width: min(62vw, 300px); aspect-ratio: 2 / 3; border-radius: 14px; overflow: hidden; box-shadow: 0 10px 40px rgba(0,0,0,.8), 0 0 0 3px var(--accent); }
.card-preview .big-card svg { width: 100%; height: 100%; display: block; }
.card-preview h3 { margin: 0; color: var(--accent); font-size: 20px; text-transform: none; letter-spacing: 0; }
.card-preview p { margin: 0; color: var(--text); font-size: 14px; max-width: 80vw; text-align: center; line-height: 1.35; }
.hcard.disabled { opacity: .5; cursor: not-allowed; }
.hcard.disabled:hover { transform: none; }

/* ---------- панели ---------- */
.tabs { display: flex; gap: 4px; }
.tabs button { flex: 1; padding: 6px; border-radius: 8px; font-size: 13px; }
.tabs button.active { background: var(--accent); color: #241709; border-color: var(--accent); }
.tabs button.unread::after { content: "•"; color: var(--danger); margin-left: 4px; }
.pane { flex: 1; overflow: auto; background: #15100d; border: 1px solid var(--line); border-radius: 10px; padding: 8px; font-size: 13px;
  display: flex; flex-direction: column; gap: 4px; min-height: 120px; }
.pane .msg b { color: var(--accent); }
.pane .msg.sab b { color: var(--danger); }
.pane .msg.sys { color: var(--muted); font-style: italic; }
.pane .msg.hl { color: var(--accent); }
.chat-form { display: flex; gap: 6px; }
.chat-form input { flex: 1; min-width: 0; }
.chat-form button { padding: 6px 12px; }
.voice-members { font-size: 12px; color: var(--muted); }
.voice-members span { display: inline-block; margin-right: 8px; }

/* ---------- оверлеи ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.65); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 22px; width: min(640px, 100%);
  max-height: 90vh; overflow: auto; position: relative; }
.modal .close { position: absolute; right: 10px; top: 10px; padding: 4px 9px; }
.modal h2 { margin: 0 0 10px; color: var(--accent); }
.result .winner { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.result .winner.friend { color: var(--accent2); }
.result .winner.hustler { color: var(--danger); }
.result table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.result td, .result th { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.result .r-friend { color: var(--accent2); }
.result .r-hustler { color: var(--danger); }
.chooser .opts { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.rules-body { line-height: 1.5; font-size: 14px; }
.rules-body h3 { margin-top: 18px; }
.rules-body table { border-collapse: collapse; }
.rules-body td, .rules-body th { border: 1px solid var(--line); padding: 4px 8px; text-align: center; }
.rules-body th { text-align: left; }
.rules-body .card-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
.rules-body .card-row figure { margin: 0; width: 68px; text-align: center; font-size: 11px; color: var(--muted); }
.rules-body .card-row svg { width: 68px; height: 100px; border-radius: 6px; }

.toast { position: fixed; left: 50%; bottom: 170px; transform: translateX(-50%); background: #4a1f18; color: #ffd9cf; border: 1px solid var(--danger);
  padding: 10px 16px; border-radius: 10px; z-index: 60; box-shadow: 0 4px 16px rgba(0,0,0,.5); max-width: 90vw; }
.toast.info { background: #1f4a46; border-color: var(--accent2); color: #d9fffb; }

@media (max-width: 1000px) {
  /* правая панель становится выдвижной шторкой, открывается кнопкой 💬 */
  .game-layout { grid-template-columns: 220px 1fr; }
  .side-only { display: inline-flex; align-items: center; gap: 4px; }
  .side-pane { position: fixed; top: 0; right: 0; bottom: 0; width: min(92vw, 360px); z-index: 45; transform: translateX(105%);
    transition: transform .22s ease; box-shadow: -10px 0 30px rgba(0,0,0,.6); border-left: 1px solid var(--line); padding-top: 52px; }
  .side-pane.open { transform: translateX(0); }
  .side-pane .side-close { position: absolute; top: 10px; right: 10px; padding: 4px 10px; }
}
@media (min-width: 1001px) { .side-pane .side-close { display: none; } }
@media (max-width: 700px) {
  :root { --card-w: 56px; --card-h: 82px; --cell-w: 60px; --cell-h: 86px; }
  .cell { width: var(--card-w); height: var(--card-h); }
  .topbar { gap: 6px 8px; padding: 6px 8px; flex-wrap: wrap; overflow: visible; flex-shrink: 0; }
  .topbar .brand { font-size: 13px; white-space: nowrap; flex: 1 1 auto; }
  .topbar .room-tag { display: inline; font-size: 11px; }
  .status { display: block; flex: 0 0 auto; font-size: 13px; text-align: right; }
  .topbar-right { flex: 0 0 100%; display: flex; justify-content: space-between; gap: 4px; margin-left: 0; min-width: 0; overflow: hidden; }
  .topbar-right .pill { flex: 1 1 auto; text-align: center; justify-content: center; display: inline-flex; align-items: center; }
  .pill { padding: 4px 7px; font-size: 12px; white-space: nowrap; }
  #round-pill .lbl { display: none; }
  .topbar .lbl { display: none; }
  .topbar .ico { display: inline; }
  .pill.btn.tg { padding: 4px 9px; }           /* на телефоне только значок, подпись скрыта правилом .topbar .lbl */
  #btn-zoom-in, #btn-zoom-out { display: none; }   /* на телефоне масштаб — щипком */
  .login-box { padding: 20px 16px; }
  .login-box .row { flex-wrap: nowrap; }
  .login-box .code-input { width: 118px !important; flex: 0 0 118px; letter-spacing: 4px; }
  .login-box #btn-join, .login-box #btn-create { flex: 1; }

  .game-layout { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); min-height: 0; }
  /* компактные плитки игроков: до 5 в ряд, без прокрутки */
  .players-pane { flex-direction: column; overflow: hidden; gap: 6px; padding: 6px 8px; border-right: none; border-bottom: 1px solid var(--line); flex-shrink: 0; }
  .players-pane .player-list { flex-direction: row; flex-wrap: wrap; gap: 6px; justify-content: flex-start; }
  .players-pane .player-list li { flex: 0 0 calc(20% - 5px); max-width: calc(20% - 5px); min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 6px 2px 5px; border-radius: 10px; overflow: visible; }
  .players-pane .player-list li.turn { padding-top: 18px; }
  .players-pane .player-list li.turn::before { height: 14px; line-height: 14px; font-size: 8px; letter-spacing: .4px; border-radius: 9px 9px 0 0; overflow: hidden; white-space: nowrap; }
  .players-pane .player-list .avwrap { width: 40px; height: 40px; margin-bottom: 3px; }
  .players-pane .player-list .avwrap .avatar { width: 40px; height: 40px; font-size: 18px; }
  .players-pane .player-list .avwrap .badge-host { width: 13px; height: 13px; font-size: 8px; left: -3px; top: -1px; border: 1px solid #241709; }
  .players-pane .player-list .under { bottom: -3px; }                       /* счётчики лежат на нижнем крае аватара */
  .players-pane .player-list .num { min-width: 16px; height: 15px; padding: 0 3px; font-size: 9px; }
  .players-pane .player-list li .pname { width: 100%; text-align: center; font-size: 11px; line-height: 1.1; padding: 0 2px; box-sizing: border-box; }
  .players-pane .player-list .items { gap: 3px; }
  .players-pane .player-list .item-chip { width: 18px; height: 18px; min-width: 18px; }
  .players-pane .player-list .item-chip .ic { font-size: 11px; }
  .players-pane .player-list .side { position: absolute; top: 4px; right: 4px; flex-direction: column; gap: 3px; }
  .players-pane .player-list li.turn .side { top: 17px; }                  /* под плашкой «ХОДИТ / ВАШ ХОД», не поверх неё */
  .players-pane .player-list .side .mic { width: 16px; height: 16px; }
  .players-pane .player-list .side .mic svg { width: 9px; height: 9px; }
  .players-pane .player-list .side .dot { width: 6px; height: 6px; }
  .players-pane .player-list .side .offline-badge { font-size: 11px; }
  .players-pane .player-list li .kick { right: auto; left: -6px; top: -6px; bottom: auto; opacity: 1; padding: 0 5px; font-size: 10px; line-height: 16px; border-radius: 8px; }
  /* роль — одна строка, цель по нажатию */
  .role-card { padding: 4px 10px; gap: 8px; border-radius: 8px; cursor: pointer; }
  .role-card .r-art { width: 26px; height: 36px; border-radius: 4px; font-size: 18px; }
  .role-card { flex-direction: row; align-items: center; gap: 8px; padding: 4px 10px; }
  .role-card .r-title { font-size: 13px; order: 2; flex: 1; }
  .role-card .r-body { order: 1; }
  .role-card .r-goal, .role-card .r-mates { display: none; }
  .role-card .r-art { width: 26px; height: 36px; font-size: 16px; }
  .role-card::after { content: "ⓘ"; margin-left: auto; color: var(--muted); font-size: 13px; }

  .board-wrap { min-height: 0; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .board { margin: 10px; }

  .hand-bar { padding: 4px 8px calc(12px + env(safe-area-inset-bottom, 0px)); flex-shrink: 0; }   /* не прилипать к краю и к зоне жестов */
  .hand-bar { grid-template-columns: minmax(0, 1fr); grid-template-areas: "hint" "hand" "btns"; gap: 0; min-width: 0; max-width: 100vw; }
  #screen-game { min-height: 0; }                            /* иначе min-height: 100vh у .screen делает страницу выше экрана при видимой адресной строке */
  .hand-actions { min-height: 18px; font-size: 13px; }
  .action-hint { text-align: left; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 20px; }
  .hand-btns { min-height: 34px; gap: 6px; margin-top: 4px; }                 /* место под кнопки зарезервировано всегда — панель не прыгает */
  .hand-btns button { flex: 1 1 0; padding: 6px 6px; font-size: 12px; white-space: nowrap; }
  .kbd-hint { display: none; }
  .hand { flex-wrap: nowrap; overflow-x: auto; overflow-y: visible; justify-content: flex-start; padding: 11px 2px 3px; gap: 8px;
    min-width: 0; width: 100%; max-width: 100%; box-sizing: border-box; touch-action: pan-x pan-y;
    overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
  .hand::after { content: ""; flex: 0 0 10px; }              /* запас справа, чтобы последняя карта докручивалась целиком */
  .hcard { width: 66px; height: 97px; flex-shrink: 0; }
  .hcard.sel { transform: translateY(-5px) scale(1.03); }
  .hand { overflow-x: auto; }
  .toast { bottom: 150px; }
  .overlay { padding: 10px; }
  .modal { padding: 16px; }
  .peek-box .big-card { width: min(220px, 55vw); }
}
/* ---------- открытые комнаты на главной ---------- */
.open-rooms { border-top: 1px solid var(--line); padding-top: 10px; }
.open-rooms h3 { margin: 0 0 8px; }
.open-rooms ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 190px; overflow: auto; }
.open-rooms li { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; font-size: 13px; }
.open-rooms li .w-art { width: 44px; height: 30px; border-radius: 6px; background: #15100d center/cover; flex-shrink: 0; }
.open-rooms li .info { flex: 1; min-width: 0; }
.open-rooms li .info b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.open-rooms li .info small { color: var(--muted); }
.open-rooms li button { padding: 5px 10px; font-size: 13px; }

/* ---------- таймер хода ---------- */
.status .timer { margin-left: 10px; font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 400; }
.status .timer.urgent { color: var(--danger); font-weight: 700; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .4; } }
select { font: inherit; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: #15100d; color: var(--text); }
/* ---------- статистика ---------- */
.my-stats { border-top: 1px solid var(--line); padding-top: 10px; font-size: 13px; color: var(--muted); }
.my-stats b { color: var(--accent); }
.leaderboard { border-top: 1px solid var(--line); padding-top: 10px; }
.leaderboard .lb-toggle { background: none; border: none; padding: 4px 0; color: var(--muted); font-size: 14px; text-transform: uppercase; letter-spacing: 1px; font-weight: 600; display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; }
.leaderboard .lb-toggle:hover { color: var(--text); }
.leaderboard .lb-toggle .chev { display: inline-block; transition: transform .15s; font-size: 12px; }
.leaderboard .lb-toggle .hint { text-transform: none; letter-spacing: 0; font-weight: 400; margin-left: auto; }
.leaderboard:not(.collapsed) .lb-toggle .chev { transform: rotate(90deg); }
.leaderboard.collapsed table, .leaderboard.collapsed > p { display: none; }
.leaderboard table { margin-top: 8px; }
.leaderboard table { width: 100%; border-collapse: collapse; font-size: 13px; }
.leaderboard th, .leaderboard td { padding: 4px 6px; text-align: left; border-bottom: 1px solid var(--line); }
.leaderboard th { color: var(--muted); font-weight: 600; font-size: 12px; }
.leaderboard td.num, .leaderboard th.num { text-align: right; }
.leaderboard tr.me td { color: var(--accent); }
.result .delta.up { color: var(--ok); }
.result .delta.down { color: var(--danger); }

.about { font-size: 12px; text-align: center; opacity: .8; }

.rules-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 30px 12px 0; }
.rules-tab { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.rules-tab.active { background: var(--accent); color: #241709; border-color: var(--accent); }

/* ---------- разведка: крупный показ карты цели ---------- */
.peek-overlay { background: rgba(0,0,0,.78); cursor: pointer; }
.peek-box { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; animation: peekIn .25s ease-out; }
@keyframes peekIn { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.peek-box .big-card { width: min(260px, 60vw); aspect-ratio: 2 / 3; border-radius: 14px; box-shadow: 0 10px 40px rgba(0,0,0,.8), 0 0 0 4px var(--accent); overflow: hidden; }
.peek-box .big-card svg { width: 100%; height: 100%; display: block; }
.peek-box h2 { margin: 0; color: var(--accent); font-size: 26px; }
.peek-box h2.bad { color: #ccc; }
.peek-box p { margin: 0; color: var(--text); max-width: 420px; font-size: 15px; line-height: 1.4; }
.peek-box .where { color: var(--muted); font-size: 13px; }
.peek-box .bar { width: min(260px, 60vw); height: 5px; background: rgba(255,255,255,.15); border-radius: 3px; overflow: hidden; }
.peek-box .bar i { display: block; height: 100%; background: var(--accent); width: 100%; animation: peekBar 5s linear forwards; }
@keyframes peekBar { from { width: 100%; } to { width: 0; } }
.peek-box small { color: var(--muted); font-size: 12px; }

/* ---------- правая панель: сворачиваемые журнал и чат ---------- */
.side-pane { gap: 8px; }
.pane-sec { display: flex; flex-direction: column; gap: 6px; min-height: 0; flex: 1 1 0; }
.pane-sec.collapsed { flex: 0 0 auto; }
.pane-sec.collapsed .pane, .pane-sec.collapsed .chat-form, .pane-sec.collapsed .subtabs { display: none; }
.pane-sec .pane { flex: 1; min-height: 0; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.sec-toggle { background: none; border: none; padding: 4px 2px; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 1px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.sec-toggle:hover { color: var(--text); }
.sec-toggle .chev { display: inline-block; transition: transform .15s; font-size: 12px; }
.pane-sec.collapsed .chev { transform: rotate(-90deg); }
.subtabs { display: flex; gap: 4px; }
.subtabs button { padding: 3px 9px; font-size: 12px; border-radius: 8px; }
.subtabs button.active { background: var(--accent); color: #241709; border-color: var(--accent); }
.subtabs button.unread::after { content: "•"; color: var(--danger); margin-left: 4px; }
.unread-badge { background: var(--danger); color: #fff; border-radius: 999px; font-size: 11px; padding: 0 6px; min-width: 18px; text-align: center; }
.side-pane.both-collapsed { width: auto; }

/* ---------- полёт призов ---------- */
.prize { position: fixed; z-index: 80; font-size: 30px; line-height: 1; pointer-events: none; will-change: transform;
  filter: drop-shadow(0 0 6px rgba(255,211,107,.9)) drop-shadow(0 4px 8px rgba(0,0,0,.6)); }
.player-list.game li.bump { animation: bump .4s ease-out; }
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.08); box-shadow: 0 0 0 4px rgba(255,211,107,.6), 0 0 26px rgba(255,211,107,.6); } 100% { transform: scale(1); } }
.pmeta .coins.flash { animation: coinFlash .6s ease-out; }
@keyframes coinFlash { 0% { color: #ffd36b; transform: scale(1.5); } 100% { color: inherit; transform: scale(1); } }
.pmeta .coins { display: inline-block; transform-origin: left center; }

/* ---------- выбор цели для выручки / беды ---------- */
.player-list.game li.no-target { opacity: .35; filter: grayscale(.7); }
.player-list.game li.can-target { border-color: var(--ok); background: linear-gradient(90deg, #163a24, #1e3a2a); animation: none; box-shadow: 0 0 0 3px rgba(111,191,115,.35), 0 0 18px rgba(111,191,115,.35); }
.player-list.game li.can-target::after { content: attr(data-action); position: absolute; right: 8px; bottom: -9px; background: var(--ok); color: #0c2a14; font-size: 10px; font-weight: 800;
  padding: 2px 8px; border-radius: 999px; letter-spacing: .3px; box-shadow: 0 2px 6px rgba(0,0,0,.5); pointer-events: none; }
.player-list.game li.can-target.turn::before { opacity: .35; }
.item-chip.fixable { border-color: var(--ok) !important; background: #1f5a2e !important; box-shadow: 0 0 0 3px rgba(111,191,115,.5); transform: scale(1.18); animation: chipPulse 1s ease-in-out infinite; cursor: pointer; z-index: 2; }
.item-chip.fixable .ic { filter: none !important; opacity: 1 !important; }
.item-chip.fixable::after { display: none !important; }
.item-chip.breakable { border-color: var(--danger) !important; box-shadow: 0 0 0 3px rgba(208,83,59,.5); transform: scale(1.18); animation: chipPulse 1s ease-in-out infinite; cursor: pointer; z-index: 2; }
@keyframes chipPulse { 0%, 100% { transform: scale(1.18); } 50% { transform: scale(1.32); } }
/* при беде карточки целей подсвечиваем красным */
.player-list.game li.can-target[data-action^="💥"] { border-color: var(--danger); background: linear-gradient(90deg, #4a1f18, #3a2420); box-shadow: 0 0 0 3px rgba(208,83,59,.35), 0 0 18px rgba(208,83,59,.35); }
.player-list.game li.can-target[data-action^="💥"]::after { background: var(--danger); color: #fff; }



/* ---------- музыка с YouTube ---------- */
.music-sec { flex: 0 0 auto; }
.music-sec.collapsed .music-body { display: none; }
.music-body { display: flex; flex-direction: column; gap: 6px; }
.music-vol { display: flex; align-items: center; gap: 10px; padding: 6px 10px; background: var(--panel); font-size: 12px; color: var(--muted); }
.music-hint { margin: 0; font-size: 11px; }

.music-status { font-size: 11px; color: var(--muted); }
.music-status.err { color: #ffb3a3; }
.music-pp { padding: 2px 8px; font-size: 12px; }

  border: 1px solid var(--line); background: #000; box-shadow: 0 10px 30px rgba(0,0,0,.6); }
#music-player .music-stop { position: absolute; top: 6px; right: 6px; padding: 2px 8px; font-size: 12px; background: rgba(20,12,6,.85); z-index: 2; }
@media (max-width: 1000px) { #music-player.on { right: 8px; bottom: 150px; width: min(420px, calc(100vw - 16px)); } }
@media (max-width: 700px) { #music-player iframe { height: 200px; } }

/* ---------- плеер YouTube в правой панели ---------- */
#music-player { display: none; }
#music-player.on { display: block; position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #000; }
#music-player iframe { display: block; width: 100%; height: 200px; border: 0; }   /* не меньше 200 px: иначе YouTube останавливает воспроизведение */
#music-player .music-stop { position: absolute; top: 6px; right: 6px; padding: 2px 8px; font-size: 12px; background: rgba(20,12,6,.85); z-index: 2; }


@media (max-width: 700px) {
  .settings { padding: 10px 12px; }
  .opt-row .opt-name { flex-basis: 108px; }
  .opt-row select { max-width: none; }
  .lobby-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .lobby-actions #btn-start { grid-column: 1 / -1; padding: 12px; font-size: 17px; }
  .lobby-actions button { margin: 0; white-space: nowrap; }
}

.privacy-link { margin-left: 14px; font-size: 13px; color: var(--muted); text-decoration: none; }
.privacy-link:hover { color: var(--text); }

/* ---------- язык ---------- */
.lang-toggle { right: auto; left: 12px; font-weight: 700; letter-spacing: .5px; }
html[lang="en"] .player-list.game li.turn::before { content: "TURN"; }
html[lang="en"] .player-list.game li.turn.me::before { content: "YOUR TURN"; }
html[lang="tr"] .player-list.game li.turn::before { content: "SIRA"; }
html[lang="tr"] .player-list.game li.turn.me::before { content: "SIRA SENDE"; }
