@font-face {
  font-family: 'Narrow';
  src: url('/fonts/narrow-700-cyr.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Narrow';
  src: url('/fonts/narrow-700-lat.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+20AC, U+2122;
}

:root {
  --bg: #12141a;
  --bg2: #1a1d25;
  --panel: #1f232d;
  --line: #2f3542;
  --text: #eef0f5;
  --muted: #9aa3b5;
  --accent: #ffd166;
  --accent-text: #1b1606;
  --danger: #ff6b6b;
  --warn: #ffb547;
  --warn-bg: rgba(255, 181, 71, 0.12);
  --t0: #e5484d;
  --t1: #3e7bfa;
  --t2: #22a861;
  --t0-soft: rgba(229, 72, 77, 0.2);
  --t1-soft: rgba(62, 123, 250, 0.22);
  --t2-soft: rgba(34, 168, 97, 0.22);
  --paper: #f4efe3;
  --paper-text: #1d1d22;
  --paper-edge: #cfc6b2;
  --neutral: #b3a587;
  --neutral-text: #3a3326;
  --trap: #050507;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  --radius: 14px;
  --gutter: 14px;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f2efe9;
    --bg2: #ffffff;
    --panel: #ffffff;
    --line: #e3ddd2;
    --text: #1b1d22;
    --muted: #6a7080;
    --accent: #f2b705;
    --accent-text: #1b1606;
    --warn-bg: rgba(242, 160, 0, 0.12);
    --paper: #fffaf0;
    --paper-edge: #d9cfbb;
    --shadow: 0 6px 24px rgba(40, 30, 10, 0.12);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
body.modal-open { overflow: hidden; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h3 { font-size: 15px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
[hidden] { display: none !important; }

.screen {
  max-width: 760px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 10px) var(--gutter) 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---------- Кнопки и поля ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 46px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-weight: 600;
  text-align: center;
  transition: transform 0.08s, opacity 0.2s;
  touch-action: manipulation;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.btn.danger { background: var(--danger); color: #fff; border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.big { width: 100%; min-height: 54px; font-size: 18px; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.btn.link { background: none; border: none; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; min-height: 36px; padding: 6px 8px; font-weight: 500; }
.icon-btn {
  width: 42px; height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 20px;
  line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  flex: none;
}
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.row.wrap { flex-wrap: wrap; }
.row.wrap > * { flex: 0 1 auto; }
input[type], input:not([type]) {
  width: 100%;
  min-height: 50px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg2);
  font-size: 17px;
  outline: none;
}
input:focus { border-color: var(--accent); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 14px; color: var(--muted); }
.err { color: var(--danger); margin: 0; text-align: center; }
.hint { color: var(--muted); font-size: 14px; margin: 0; }
.wait { margin: 4px 0; color: var(--muted); }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}
.panel > p:first-child { margin-top: 0; }

.topbar { display: flex; align-items: center; gap: 10px; }
.brand { font-weight: 800; font-size: 20px; letter-spacing: 0.01em; flex: 1; }

/* ---------- Главный экран ---------- */
.home { justify-content: center; padding-bottom: 32px; }
#h-main { display: flex; flex-direction: column; gap: 14px; }
.logo { text-align: center; margin-bottom: 8px; }
.logo svg { width: 84px; height: 84px; }
.logo h1 { font-size: 34px; margin-top: 6px; }
.logo .sub { color: var(--muted); margin: 6px auto 0; max-width: 320px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.big-line { font-size: 18px; margin: 0 0 12px; text-align: center; }
.home .panel { display: flex; flex-direction: column; gap: 10px; }
#code { text-align: center; letter-spacing: 0.2em; font-weight: 700; }
#code:placeholder-shown { letter-spacing: normal; font-weight: 400; }
.spinner {
  width: 34px; height: 34px; margin: 6px auto 0;
  border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Лобби ---------- */
.room-card {
  display: flex; gap: 14px; align-items: center;
  margin-top: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px;
}
.qr {
  width: 118px; height: 118px; flex: none;
  padding: 0; border: none; border-radius: 10px; overflow: hidden; background: #fff;
}
.qr svg { width: 100%; height: 100%; display: block; }
.room-info { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; min-width: 0; }
.room-code { font-size: 40px; font-weight: 800; letter-spacing: 0.12em; line-height: 1; }

.teams { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.teams.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.team {
  border-radius: var(--radius);
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 4px solid var(--tc);
  display: flex; flex-direction: column; gap: 8px;
  min-width: 0;
}
.team.t0, .t0 { --tc: var(--t0); --ts: var(--t0-soft); }
.team.t1, .t1 { --tc: var(--t1); --ts: var(--t1-soft); }
.team.t2, .t2 { --tc: var(--t2); --ts: var(--t2-soft); }
.team-head { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.team-head span:not(.dot) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.team li {
  display: flex; align-items: center; gap: 4px;
  padding: 7px 8px;
  border-radius: 9px;
  background: var(--ts);
  font-size: 15px;
  min-width: 0;
}
.team li.me { outline: 2px solid var(--tc); outline-offset: -2px; }
.team li.off { opacity: 0.45; }
.team li.empty { background: none; color: var(--muted); font-size: 13px; padding-left: 2px; }
.pn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { font-size: 12px; flex: none; }
.tag.you { color: var(--muted); }
.you-here { text-align: center; font-size: 13px; color: var(--muted); min-height: 36px; display: flex; align-items: center; justify-content: center; }
.teams.cols-3 .team { padding: 8px 6px; }
.teams.cols-3 .team-head { font-size: 14px; gap: 4px; }
#l-teams { display: flex; flex-direction: column; gap: 10px; }
.teams.cols-3 .team li { font-size: 14px; padding: 6px; }
.teams.cols-3 .btn.small { padding: 6px 4px; font-size: 13px; }

.dot { color: var(--tc); font-size: 0.95em; line-height: 1; display: inline-block; }

.set-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.set-row:first-of-type { border-top: none; }
.set-label { font-weight: 600; }
.set-ctl { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.note { margin: 0 0 4px; }
.seg { display: inline-flex; background: var(--bg2); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: none; background: none; border-radius: 8px; padding: 7px 11px; font-size: 14px; font-weight: 600; color: var(--muted); min-height: 36px; }
.seg button.on { background: var(--accent); color: var(--accent-text); }
.stepper { display: inline-flex; align-items: center; gap: 4px; background: var(--bg2); border: 1px solid var(--line); border-radius: 11px; padding: 3px; }
.stepper button { width: 36px; height: 36px; border: none; background: var(--panel); border-radius: 8px; font-size: 20px; font-weight: 700; }
.stepper b { min-width: 74px; text-align: center; font-size: 15px; }
.summary { margin: 0 0 6px; }
.wins { margin: 8px 0; padding-left: 22px; }
.wins li { padding: 3px 0; }
.wins li span { margin-right: 8px; }
details summary { cursor: pointer; color: var(--muted); font-size: 14px; padding: 6px 0; }
.match-list { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-direction: column; gap: 8px; }
.match-list li { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 8px; border-radius: 10px; background: var(--bg2); }
.ml { display: inline-flex; flex-direction: column; font-weight: 700; }
.ml small { font-weight: 400; color: var(--muted); }

/* ---------- Нижняя панель ---------- */
.dock {
  position: sticky;
  bottom: 0;
  margin: auto calc(-1 * var(--gutter)) 0;
  padding: 10px var(--gutter) calc(env(safe-area-inset-bottom) + 12px);
  background: linear-gradient(to top, var(--bg) 82%, transparent);
  z-index: 5;
}
.dock-in { display: flex; flex-direction: column; gap: 8px; max-width: 760px; margin: 0 auto; }
.dock .row { flex-wrap: wrap; }

/* ---------- Игра ---------- */
.game { gap: 10px; }
.round-no { font-weight: 800; font-size: 17px; display: flex; flex-direction: column; line-height: 1.1; flex: none; }
.round-no small { font-weight: 500; font-size: 12px; color: var(--muted); }
.scores { display: flex; gap: 6px; flex: 1; justify-content: center; min-width: 0; }
.score {
  display: flex; flex-direction: column; align-items: center;
  min-width: 56px; padding: 4px 8px;
  border-radius: 11px;
  background: var(--ts);
  border: 2px solid transparent;
  line-height: 1.1;
}
.score .sym { color: var(--tc); font-size: 12px; }
.score b { font-size: 20px; }
.score small { font-size: 11px; color: var(--muted); }
.score.cur { border-color: var(--tc); }
.score.out { opacity: 0.45; }

.turn {
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--ts, var(--panel));
  border: 1px solid var(--line);
  border-left: 5px solid var(--tc, var(--line));
  display: flex; flex-direction: column; gap: 4px;
}
.turn.mine { box-shadow: 0 0 0 2px var(--tc) inset; }
.turn.ended { background: var(--panel); border-left-color: var(--accent); }
.turn-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; }
.turn-main { font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.turn-main.thinking { color: var(--muted); font-weight: 600; font-size: 17px; }
.clue-word { font-family: 'Narrow', 'PT Sans Narrow', 'Arial Narrow', sans-serif; font-size: 28px; letter-spacing: 0.02em; word-break: break-word; }
.clue-num {
  min-width: 38px; height: 38px; padding: 0 8px;
  border-radius: 10px;
  background: var(--tc, var(--accent)); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.turn-sub { font-size: 14px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.turn-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.role { font-size: 13px; color: var(--muted); }
.rp { font-weight: 700; color: var(--text); }
.warn-badge { border: none; background: var(--warn-bg); color: var(--warn); border-radius: 9px; padding: 4px 9px; font-weight: 700; font-size: 14px; }
.timer {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 9px;
  background: var(--bg2);
  white-space: nowrap;
}
.timer.low { background: var(--danger); color: #fff; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.65; } }

.game #g-board { flex: 1 0 auto; display: flex; flex-direction: column; }
.board {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  grid-auto-rows: minmax(46px, 1fr);
  gap: 5px;
  max-height: calc(var(--rows) * 96px);
}
.card {
  position: relative;
  min-height: 46px;
  border-radius: 9px;
  background: var(--paper);
  color: var(--paper-text);
  box-shadow: inset 0 -3px 0 var(--paper-edge);
  display: flex; align-items: center; justify-content: center;
  padding: 2px 3px 4px;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.card .w {
  display: inline-block;
  white-space: nowrap;
  font-family: 'Narrow', 'PT Sans Narrow', 'Arial Narrow', 'Roboto Condensed', sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  line-height: 1;
  font-size: 15px;
}
.card.tap { cursor: pointer; }
.card.tap:active { transform: scale(0.95); }
.card.tap-soft { cursor: pointer; }
.card.sel { outline: 3px solid var(--accent); outline-offset: -1px; box-shadow: 0 0 0 4px rgba(255, 209, 102, 0.35); z-index: 1; }
.card .sym { position: absolute; top: 2px; left: 4px; font-size: 10px; line-height: 1; opacity: 0.9; }
.card .mks { position: absolute; top: 2px; right: 2px; display: flex; gap: 1px; }
.card .mk {
  font-style: normal;
  font-size: 9px; font-weight: 800;
  min-width: 15px; height: 15px; padding: 0 2px;
  border-radius: 8px;
  background: var(--accent); color: var(--accent-text);
  display: inline-flex; align-items: center; justify-content: center;
}

/* Цвета для капитана (неоткрытые) */
.card.k.o0 { background: linear-gradient(var(--t0-soft), var(--t0-soft)), var(--paper); box-shadow: inset 0 0 0 2px var(--t0); }
.card.k.o1 { background: linear-gradient(var(--t1-soft), var(--t1-soft)), var(--paper); box-shadow: inset 0 0 0 2px var(--t1); }
.card.k.o2 { background: linear-gradient(var(--t2-soft), var(--t2-soft)), var(--paper); box-shadow: inset 0 0 0 2px var(--t2); }
.card.k.on { box-shadow: inset 0 0 0 1px var(--paper-edge); }
.card.k.ot { background: #2b2b31; color: #fff; box-shadow: inset 0 0 0 2px #000; }
.card.k.o0 .sym { color: var(--t0); }
.card.k.o1 .sym { color: var(--t1); }
.card.k.o2 .sym { color: var(--t2); }

/* Открытые */
.card.r { box-shadow: none; }
.card.r .w { opacity: 0.88; }
.card.r.on .w { opacity: 0.6; }
.card.r.o0 { background: var(--t0); color: #fff; }
.card.r.o1 { background: var(--t1); color: #fff; }
.card.r.o2 { background: var(--t2); color: #fff; }
.card.r.on { background: var(--neutral); color: var(--neutral-text); }
.card.r.ot { background: var(--trap); color: #fff; box-shadow: inset 0 0 0 2px var(--danger); }
.board:not(.over) .card.r { filter: saturate(0.85); }

.card.flip { animation: flip 0.45s ease-out; }
@keyframes flip {
  0% { transform: rotateY(90deg) scale(0.9); }
  100% { transform: rotateY(0) scale(1); }
}

/* Форма подсказки */
.clue-form { gap: 8px; }
.clue-row { display: flex; gap: 8px; }
.clue-row input { flex: 1; min-width: 0; font-weight: 700; text-transform: uppercase; font-size: 18px; }
.clue-row .btn { flex: none; }
.nums { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 4px; }
.num {
  min-height: 42px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 18px; font-weight: 700;
}
.num.on { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.warns { display: flex; flex-direction: column; gap: 6px; }
.warn { background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 8px 10px; font-size: 14px; }
.team-btn { border-top: 3px solid var(--tc); }
.btn.wide { width: 100%; }

/* ---------- Итоги ---------- */
.end { gap: 12px; }
#e-main { display: flex; flex-direction: column; gap: 12px; }
.winner {
  text-align: center;
  padding: 20px 14px;
  border-radius: var(--radius);
  background: var(--ts, var(--panel));
  border: 2px solid var(--tc, var(--line));
}
.winner .cup { font-size: 48px; line-height: 1; }
.winner h1 { font-size: 28px; margin-top: 6px; }
.winner p { margin: 6px 0 0; color: var(--muted); }
.final { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.final li { padding: 8px 10px; border-radius: 10px; background: var(--ts); }
.fl-top { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; }
.fl-top span:not(.dot) { flex: 1; }
.fl-top b { font-size: 24px; }
.final small { color: var(--muted); }
.awards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.award { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: 12px; background: var(--bg2); border-left: 4px solid var(--tc, var(--accent)); }
.aw-icon { font-size: 28px; line-height: 1; }
.aw-title { font-weight: 800; }
.aw-who { font-weight: 600; }
.aw-text { font-size: 13px; color: var(--muted); }
.best { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.table-wrap { overflow-x: auto; }
.ptable { width: 100%; border-collapse: collapse; font-size: 15px; }
.ptable th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 600; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.ptable th small { font-weight: 400; }
.ptable td { padding: 8px 4px; border-bottom: 1px solid var(--line); }
.ptable td:not(:first-child), .ptable th:not(:first-child) { text-align: center; white-space: nowrap; }
.rounds { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-direction: column; gap: 4px; }

/* ---------- Окна ---------- */
.backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade 0.15s;
}
.sheet {
  width: 100%; max-width: 560px;
  max-height: 88vh; max-height: 88dvh;
  overflow-y: auto;
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  padding: 14px var(--gutter) calc(env(safe-area-inset-bottom) + 18px);
  box-shadow: var(--shadow);
  animation: rise 0.2s ease-out;
}
@media (min-width: 600px) {
  .backdrop { align-items: center; }
  .sheet { border-radius: 20px; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(30px); opacity: 0.6; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.sheet-head h2 { font-size: 20px; }
.sheet-body { display: flex; flex-direction: column; gap: 10px; }
.sheet-body p { margin: 0; }
.menu { display: flex; flex-direction: column; gap: 6px; }
.menu-item {
  text-align: left;
  min-height: 50px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-weight: 600;
}
.menu-item.danger { color: var(--danger); }
.rules ul { padding-left: 20px; }
.rules p, .rules li { margin: 6px 0; }
.history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.history li { padding: 10px; border-radius: 12px; background: var(--panel); border-left: 4px solid var(--tc); }
.h-top { margin-bottom: 4px; }
.h-warn { color: var(--warn); font-size: 13px; margin-bottom: 4px; }
.h-words { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-family: 'Narrow', 'PT Sans Narrow', sans-serif; font-weight: 700; font-size: 13px; padding: 3px 8px; border-radius: 7px; }
.chip.o0 { background: var(--t0); color: #fff; }
.chip.o1 { background: var(--t1); color: #fff; }
.chip.o2 { background: var(--t2); color: #fff; }
.chip.on { background: var(--neutral); color: var(--neutral-text); }
.chip.ot { background: var(--trap); color: #fff; }
.qr-big { background: #fff; border-radius: 14px; padding: 10px; max-width: 320px; width: 100%; margin: 0 auto; }
.qr-big svg { width: 100%; height: auto; display: block; }
.link-text { word-break: break-all; color: var(--muted); font-size: 14px; }
.pmanage { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pmanage li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 12px; background: var(--panel); flex-wrap: wrap; }
.pm-name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.pm-name.off { opacity: 0.55; }
.pm-btns { display: flex; gap: 4px; }
.tbtn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); font-size: 15px; color: var(--tc, var(--text)); }
.tbtn.on { background: var(--tc); color: #fff; border-color: transparent; }
.tbtn.danger { color: var(--danger); }
.cap-team { display: flex; flex-direction: column; gap: 6px; padding: 8px 0; }

/* ---------- Уведомления ---------- */
.toast {
  position: fixed;
  left: 50%;
  top: calc(env(safe-area-inset-top) + 64px);
  transform: translate(-50%, -30px);
  opacity: 0;
  max-width: min(92vw, 520px);
  padding: 11px 16px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 15px;
  z-index: 60;
  transition: transform 0.25s ease, opacity 0.25s ease;
  pointer-events: none;
  text-align: center;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.bad { border-color: var(--danger); }
.toast.good { border-color: var(--accent); }
.toast.error { border-color: var(--danger); color: var(--danger); }
.conn {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
  padding: 8px 12px calc(env(safe-area-inset-bottom) + 8px);
  text-align: center; font-size: 14px; font-weight: 600;
  background: var(--danger); color: #fff;
}

/* Узкие телефоны */
@media (max-width: 360px) {
  :root { --gutter: 10px; }
  .board { gap: 4px; }
  .score { min-width: 48px; padding: 3px 6px; }
  .room-code { font-size: 34px; }
  .qr { width: 100px; height: 100px; }
}
/* Планшеты и ноутбуки: поле крупнее */
@media (min-width: 700px) {
  .board { gap: 8px; }
  .card { border-radius: 12px; }
}
