/* «Котовый агент» — тёмный деревянный стол, на нём игра, напечатанная ризографией:
   бумажные карточки с зерном, краски команд, жёлтый — твой выбор и кнопки. */

@font-face { font-family: 'Unbounded'; font-weight: 800; font-display: swap; src: url('/fonts/unbounded-800-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Unbounded'; font-weight: 800; font-display: swap; src: url('/fonts/unbounded-800-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: 'Unbounded'; font-weight: 900; font-display: swap; src: url('/fonts/unbounded-900-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Unbounded'; font-weight: 900; font-display: swap; src: url('/fonts/unbounded-900-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: 'Fira Sans Extra Condensed'; font-weight: 700; font-display: swap; src: url('/fonts/fira-700-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Fira Sans Extra Condensed'; font-weight: 700; font-display: swap; src: url('/fonts/fira-700-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: 'Rubik'; font-weight: 400; font-display: swap; src: url('/fonts/rubik-400-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Rubik'; font-weight: 400; font-display: swap; src: url('/fonts/rubik-400-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: 'Rubik'; font-weight: 500; font-display: swap; src: url('/fonts/rubik-500-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Rubik'; font-weight: 500; font-display: swap; src: url('/fonts/rubik-500-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: 'Rubik'; font-weight: 600; font-display: swap; src: url('/fonts/rubik-600-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Rubik'; font-weight: 600; font-display: swap; src: url('/fonts/rubik-600-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: 'Rubik'; font-weight: 700; font-display: swap; src: url('/fonts/rubik-700-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Rubik'; font-weight: 700; font-display: swap; src: url('/fonts/rubik-700-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+20AC, U+2122; }

:root {
  --wood: #2a1f17;
  --wood-dark: #1f1712;
  --hollow: rgba(0, 0, 0, 0.17);
  --line: rgba(255, 235, 200, 0.18);
  --text: #f4ead8;
  --muted: #c9b89c;
  --muted-hi: #d9cbb2;
  --paper: #f4eee1;
  --paper-edge: #c9bfa5;
  --ink: #2a3163;
  --ink-muted: #4a5078;
  --yellow: #ffe800;
  --yellow-dark: #a99800;
  --neutral: #e3daca;
  --good: #4fd18b;
  --danger: #ff6c2f;
  --t0: #ff48b0;
  --t1: #0078bf;
  --t2: #00a95c;
  --t0-hi: #ff48b0;
  --t1-hi: #3d9be0;
  --t2-hi: #2bc77f;
  --grain: url('/art/grain.webp?v=1');
  --word: 'Fira Sans Extra Condensed', 'Arial Narrow', 'Roboto Condensed', sans-serif;
  --title: 'Unbounded', 'Rubik', system-ui, sans-serif;
  --gutter: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--wood);
  background-image: repeating-linear-gradient(92deg, rgba(255, 230, 190, 0.025) 0px, rgba(255, 230, 190, 0.025) 2px, rgba(0, 0, 0, 0) 2px, rgba(0, 0, 0, 0) 11px);
  color: var(--text);
  font: 16px/1.4 'Rubik', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  overscroll-behavior-y: none;
}
body.modal-open, body.typing { overflow: hidden; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
h3 { font-family: var(--title); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 10px; }
[hidden] { display: none !important; }
img { -webkit-user-drag: none; user-select: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.ic { display: inline-block; flex: none; vertical-align: middle; }

/* Бумага с зерном. Зерно — плитка-картинка: на слабых телефонах это дешевле SVG-фильтров. */
.pp, .pp2 { background-color: var(--paper); background-size: auto, 192px 192px; color: var(--ink); }
.pp { background-image: linear-gradient(rgba(244, 238, 225, 0.55), rgba(244, 238, 225, 0.55)), var(--grain); }
.pp2 { background-image: linear-gradient(rgba(244, 238, 225, 0.22), rgba(244, 238, 225, 0.22)), var(--grain); }

/* Заголовок с «непопаданием» красок: две краски, сдвинутые друг относительно друга */
.mis { position: relative; display: inline-block; font-family: var(--title); font-weight: 900; line-height: 1.04; text-align: center; white-space: nowrap; }
.mis > span { display: block; color: var(--c1, var(--t0)); mix-blend-mode: multiply; }
.mis > span + span { position: absolute; left: 0; top: 0; width: 100%; color: var(--c2, var(--t1)); transform: translate(3px, 2px); }

.screen {
  max-width: 600px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 12px) var(--gutter) 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ---------- Кнопки, поля, панели ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.18);
  font-weight: 500;
  text-align: center;
  touch-action: manipulation;
  transition: transform 0.08s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.btn.gold { background: var(--yellow); color: var(--ink); border: none; font-weight: 700; box-shadow: 0 2px 0 var(--yellow-dark), 0 6px 14px rgba(0, 0, 0, 0.35); }
.btn.gold:active { transform: translateY(2px); box-shadow: 0 0 0 var(--yellow-dark), 0 3px 8px rgba(0, 0, 0, 0.35); }
.btn.ghost { background: transparent; }
.btn.outline { background: transparent; border: 2px solid var(--yellow); color: var(--yellow); font-weight: 700; }
.btn.danger { background: var(--danger); color: var(--ink); border: none; font-weight: 700; box-shadow: 0 2px 0 #a8441a; }
.btn.big { width: 100%; min-height: 56px; font-size: 18px; }
.btn.small { min-height: 44px; padding: 6px 14px; font-size: 14px; border-radius: 12px; }
.btn.link { background: none; border: none; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; min-height: 44px; padding: 6px 8px; }
.btn.wide { width: 100%; }
.icon-btn {
  width: 44px; height: 44px; flex: none;
  border-radius: 12px;
  border: 1px solid rgba(255, 235, 200, 0.14);
  background: rgba(0, 0, 0, 0.2);
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
}
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.row.wrap { flex-wrap: wrap; }
.row.wrap > * { flex: 0 1 auto; }
input.text, .field input {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: 12px;
  border: none;
  background: var(--paper);
  color: var(--ink);
  font-size: 17px; font-weight: 500;
  outline: none;
}
input.text::placeholder, .field input::placeholder { color: #8d8a99; font-weight: 400; }
input.text:focus, .field input:focus { box-shadow: 0 0 0 2.5px var(--yellow); }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: 13px; color: var(--muted); }
.err { color: #ff9a6b; margin: 0; text-align: center; }
.hint { color: var(--muted); font-size: 14px; margin: 0; }
.wait { margin: 2px 0; color: var(--muted); text-align: center; }

/* Панели — углубления в столе */
.panel {
  background: var(--hollow);
  border-radius: 16px;
  padding: 12px;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.35);
}
.panel > p:first-child { margin-top: 0; }
.paper { border-radius: 8px; box-shadow: 0 2px 0 var(--paper-edge), 0 8px 16px rgba(0, 0, 0, 0.35); }

.topbar { display: flex; align-items: center; gap: 8px; }
.brand { font-family: var(--title); font-weight: 800; font-size: 19px; line-height: 1.15; flex: 1; min-width: 0; }

/* Герб команды: мордочка, лапка, клубок на краске своей команды */
.tm {
  --s: 20px;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: var(--s); height: var(--s);
  border-radius: 50%;
  background: var(--tc);
}
.tm svg { width: 70%; height: 70%; display: block; }
.tm0 { --tc: var(--t0); }
.tm1 { --tc: var(--t1); }
.tm2 { --tc: var(--t2); }
.t0 { --tc: var(--t0); --th: var(--t0-hi); }
.t1 { --tc: var(--t1); --th: var(--t1-hi); }
.t2 { --tc: var(--t2); --th: var(--t2-hi); }

/* Аватарки-котики */
.av {
  --s: 44px;
  width: var(--s); height: var(--s); flex: none;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: 0 0 0 max(2px, calc(var(--s) / 18)) var(--ring, transparent), 0 3px 6px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  display: inline-flex;
}
.av img { width: 100%; height: 100%; display: block; }
.av.off { opacity: 0.45; filter: grayscale(0.6); }
.avw { position: relative; display: inline-flex; flex: none; }
.capb {
  position: absolute; right: -5px; bottom: -4px;
  width: 19px; height: 19px;
  border-radius: 50%;
  background: var(--yellow); color: var(--ink);
  box-shadow: 0 0 0 2px var(--wood);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--title); font-weight: 900; font-size: 10px; line-height: 1;
}
.capb.sm { width: 15px; height: 15px; font-size: 8px; right: -4px; bottom: -3px; box-shadow: 0 0 0 1.5px var(--wood); }

/* ---------- Главный экран ---------- */
.home { padding-bottom: calc(env(safe-area-inset-bottom) + 22px); gap: 14px; }
#h-main { flex: 1; display: flex; flex-direction: column; gap: 14px; }
.home-top { display: flex; justify-content: flex-end; }
.poster {
  position: relative; align-self: center;
  width: min(300px, 78vw);
  padding: 14px 16px 18px;
  border-radius: 10px;
  transform: rotate(-2deg);
  box-shadow: 0 2px 0 #cfc3a6, 0 18px 36px rgba(0, 0, 0, 0.5);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-align: center;
}
.poster-art { width: 64%; aspect-ratio: 200 / 230; height: auto; display: block; }
.poster .mis { font-size: clamp(26px, 9vw, 34px); }
.poster p { margin: 4px 0 0; font-size: 14px; font-weight: 500; line-height: 1.35; color: var(--ink-muted); }
.home-sub { margin: 0; text-align: center; font-size: 14px; color: var(--muted); }
.home-form { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.name-row { display: flex; align-items: flex-end; gap: 12px; }
.code-row { display: flex; gap: 10px; }
.code-row input { flex: 1; min-width: 0; font-family: var(--title); font-weight: 800; font-size: 17px; letter-spacing: 0.08em; }
.code-row input:placeholder-shown { letter-spacing: 0.02em; font-weight: 800; }
.code-row .btn { flex: none; }
.big-line { font-size: 18px; margin: 0; text-align: center; }
.big-line b { font-family: var(--title); font-weight: 800; letter-spacing: 0.06em; }
.spinner { width: 34px; height: 34px; margin: 6px auto 0; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--yellow); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Лобби ---------- */
.lobby-top { display: flex; align-items: center; gap: 10px; min-height: 48px; }
.logo-head { width: 42px; height: 42px; border-radius: 50%; flex: none; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.45); }
.room-sticker {
  flex: 1; min-width: 0; height: 46px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0 12px;
  border: none; border-radius: 8px;
  transform: rotate(-2deg);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.35);
  text-align: left;
}
.room-sticker span { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.room-sticker small { font-size: 12px; font-weight: 600; color: var(--ink-muted); }
.room-sticker b { font-family: var(--title); font-weight: 800; font-size: 17px; letter-spacing: 0.06em; white-space: nowrap; }
.room-sticker .ic { color: var(--ink); }

.me-row { display: flex; align-items: flex-end; gap: 12px; }
.av-btn { padding: 0; border: none; background: none; border-radius: 50%; }
.cats-title { font-family: var(--title); font-size: 12px; font-weight: 800; letter-spacing: 0.06em; color: var(--muted); margin: 12px 0 8px; }
.cats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 4px; }
.cat {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 2px 0; border: none; background: none;
  color: var(--muted-hi); font-size: 13px; line-height: 15px;
  white-space: nowrap;
}
.cat.on { color: var(--yellow); font-weight: 700; }
.cat.on .av { --ring: var(--yellow); }

.teams { display: flex; flex-direction: column; gap: 10px; }
.team-card { padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.team-card.mine { box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.35), inset 0 0 0 1.5px color-mix(in srgb, var(--tc) 55%, transparent); }
.tc-head { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.tc-head .tm { box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.2); }
.tname-wrap { position: relative; min-width: 0; }
.tname {
  width: 100%; min-width: 0;
  height: 48px;
  padding: 0 38px 0 12px;
  border-radius: 10px;
  border: none;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--word); font-weight: 700; font-size: 22px;
  outline: none;
}
.tname:focus { box-shadow: 0 0 0 2.5px var(--yellow); }
.tname-wrap .ic { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-muted); pointer-events: none; }
.tname-static {
  min-width: 0; height: 48px;
  display: flex; align-items: center;
  padding: 0 12px;
  border-radius: 10px;
  background: rgba(244, 238, 225, 0.1);
  font-family: var(--word); font-weight: 700; font-size: 22px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tc-count { font-size: 13px; color: var(--muted); white-space: nowrap; }
.members { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px; }
.member {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-width: 60px; max-width: 128px;
  padding: 4px 0 0; border: none; background: none;
  font-size: 13px; line-height: 15px; font-weight: 500;
}
.member .pn { display: flex; align-items: center; justify-content: center; gap: 3px; max-width: 100%; white-space: nowrap; }
.member .pn span { overflow: hidden; text-overflow: ellipsis; }
.member.me .pn { color: var(--yellow); font-weight: 700; }
.member.off { opacity: 0.5; }
.member .crown { color: var(--yellow); display: inline-flex; flex: none; }
.member .you { font-style: normal; flex: none; }
.members .empty { color: var(--muted); font-size: 14px; padding: 10px 2px; }
.members .btn { margin-left: auto; }
.ideas {
  display: flex; align-items: center; gap: 6px;
  margin-right: -10px; padding-right: 10px;
  overflow-x: auto; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent);
  mask-image: linear-gradient(90deg, #000 88%, transparent);
}
.ideas::-webkit-scrollbar { display: none; }
.ideas span { font-size: 13px; color: var(--muted); flex: none; }
.idea { flex: none; height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.12); font-size: 14px; white-space: nowrap; }

.set-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px solid rgba(255, 235, 200, 0.1); flex-wrap: wrap; }
.set-row:first-of-type { border-top: none; padding-top: 0; }
.set-label { font-weight: 500; }
.set-ctl { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.note { margin: 0 0 4px; }
.seg { display: inline-flex; background: rgba(0, 0, 0, 0.3); border-radius: 12px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: none; background: none; border-radius: 9px; padding: 7px 12px; font-size: 14px; font-weight: 500; color: var(--muted-hi); min-height: 38px; }
.seg button.on { background: var(--yellow); color: var(--ink); font-weight: 700; }
.stepper { display: inline-flex; align-items: center; gap: 4px; background: rgba(0, 0, 0, 0.3); border-radius: 12px; padding: 3px; }
.stepper button { width: 38px; height: 38px; border: none; background: rgba(255, 235, 200, 0.08); border-radius: 9px; 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: 8px 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: rgba(0, 0, 0, 0.2); }
.ml { display: inline-flex; flex-direction: column; font-weight: 700; }
.ml > span { display: inline-flex; align-items: center; gap: 6px; }
.ml small { font-weight: 400; color: var(--muted); }

/* ---------- Нижняя панель ---------- */
.dock {
  position: sticky; bottom: 0; z-index: 5;
  margin: auto calc(-1 * var(--gutter)) 0;
  padding: 8px var(--gutter) calc(env(safe-area-inset-bottom) + 14px);
  background: linear-gradient(to top, var(--wood) 85%, rgba(42, 31, 23, 0));
  display: flex; flex-direction: column; gap: 10px;
}
.dock-in { display: flex; flex-direction: column; gap: 10px; }
.dock-in:empty { display: none; }

/* ---------- Игра: счёт ---------- */
.game { gap: 10px; padding-top: calc(env(safe-area-inset-top) + 10px); }
.scores { display: flex; gap: 8px; flex: 1; min-width: 0; }
.scores.three { gap: 6px; }
.score {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; gap: 4px;
  padding: 8px 10px 9px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
}
.three .score { padding: 7px 8px 8px; }
.score.cur { box-shadow: inset 0 0 0 2px var(--yellow); }
.score { position: relative; }
.score.mine.t0 { background: rgba(255, 72, 176, 0.17); }
.score.mine.t1 { background: rgba(0, 120, 191, 0.24); }
.score.mine.t2 { background: rgba(0, 169, 92, 0.2); }
.sc-you {
  position: absolute; top: -7px; right: 8px; z-index: 1;
  padding: 2px 7px 1px; border-radius: 6px;
  background: var(--tc); color: var(--paper);
  font-family: var(--title); font-weight: 900; font-size: 10px; letter-spacing: 0.08em; line-height: 1.3;
}
.score.t0 .sc-you { color: var(--ink); }
.score.out { opacity: 0.55; }
.sc-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.sc-name { font-size: 14px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.three .sc-name { font-size: 13px; }
.sc-pts { display: flex; align-items: baseline; gap: 5px; }
.sc-pts b { font-family: var(--title); font-weight: 800; font-size: 19px; line-height: 1; }
.three .sc-pts b { font-size: 17px; }
.sc-pts span { font-size: 13px; color: var(--muted); }
.sc-bot { display: flex; align-items: center; gap: 6px; min-width: 0; height: 16px; }
.pips { display: flex; gap: 2px; min-width: 0; }
.pip { flex: none; width: 7px; height: 7px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px rgba(244, 234, 216, 0.35); }
.pip.on { background: var(--th); box-shadow: none; }
.t1 .pip { border-radius: 1.5px; }
.t2 .pip { border-radius: 1px; transform: rotate(45deg) scale(0.85); }
.three .pip { width: 6px; height: 6px; }
.sc-found { font-size: 13px; color: var(--muted); white-space: nowrap; }
.three .sc-found { font-size: 12px; }
.out-label { padding: 1px 6px; border-radius: 4px; background: var(--ink); color: var(--paper); font-size: 12px; font-weight: 600; }

/* Кто сейчас ходит */
.strip { padding: 9px 8px 10px; display: flex; flex-direction: column; gap: 8px; }
.strip-head { display: flex; align-items: center; gap: 8px; font-size: 15px; min-width: 0; padding: 0 2px; }
.strip-head b { font-weight: 600; flex: none; max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strip-head .mine-tag { color: var(--muted); font-weight: 400; white-space: nowrap; min-width: 0; flex: 0 100 auto; overflow: hidden; text-overflow: ellipsis; }
.strip-head .rn { color: var(--muted); white-space: nowrap; margin-left: auto; padding-left: 6px; font-size: 13px; }
.strip-head .icon-btn { margin: -6px -2px -6px 4px; }
.strip-row { display: flex; gap: 4px; justify-content: space-around; overflow-x: auto; scrollbar-width: none; padding-top: 2px; }
.strip-row::-webkit-scrollbar { display: none; }
.pl { display: flex; flex-direction: column; align-items: center; gap: 3px; flex: 1 1 0; min-width: 66px; max-width: 104px; text-align: center; }
.pl .pn { font-size: 14px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl .st { font-size: 13px; line-height: 1.3; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 5px; border-radius: 5px; }
.pl.cap .st { background: var(--yellow); color: var(--ink); font-weight: 600; }
.pl.me .st { color: var(--text); font-weight: 600; }
.pl.cap.me .st { color: var(--ink); }
.pl.typing .st::after { content: ''; display: inline-block; width: 4px; height: 4px; margin-left: 3px; border-radius: 50%; background: currentColor; animation: blink 1s infinite; vertical-align: middle; }
@keyframes blink { 50% { opacity: 0.2; } }

/* Записка с подсказкой */
.note-row { display: flex; align-items: center; gap: 14px; padding: 0 4px; }
.clue-note {
  position: relative; overflow: hidden;
  flex: 1; min-width: 0;
  transform: rotate(-1.5deg);
  padding: 8px 14px 10px;
  display: flex; flex-direction: column; gap: 3px;
}
.clue-note.waiting { transform: rotate(1deg); }
.cn-stamp { position: absolute; right: 8px; bottom: 6px; width: 46px; height: 46px; transform: rotate(14deg); opacity: 0.45; mix-blend-mode: multiply; color: var(--tc); pointer-events: none; }
.cn-stamp svg { width: 100%; height: 100%; display: block; }
.cn-label { position: relative; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-muted); display: flex; align-items: center; gap: 8px; }
.cn-main { position: relative; display: flex; align-items: center; gap: 10px; min-width: 0; }
.cn-word { font-family: var(--title); font-weight: 900; font-size: 28px; line-height: 1.15; overflow-wrap: anywhere; min-width: 0; }
.cn-num {
  width: 34px; height: 34px; flex: none;
  border-radius: 50%;
  background: var(--tc, var(--ink)); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--title); font-weight: 900; font-size: 16px;
}
.t1 .cn-num, .t2 .cn-num { color: var(--paper); }
.cn-sub { position: relative; font-size: 14px; color: var(--ink-muted); display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
.cn-wait { position: relative; font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.cn-sub .btn.link { color: inherit; min-height: 0; padding: 0; font-size: 13px; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--tc, var(--ink)); animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: 0.2s; }
.dots i:nth-child(3) { animation-delay: 0.4s; }
.warn-tag { border: none; padding: 2px 8px; border-radius: 6px; background: var(--yellow); color: var(--ink); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }

.timer-ring { position: relative; width: 58px; height: 58px; flex: none; }
.timer-ring svg { width: 58px; height: 58px; transform: rotate(-90deg); }
.timer-ring .bg { fill: rgba(0, 0, 0, 0.3); stroke: rgba(244, 234, 216, 0.15); stroke-width: 4; }
.timer-ring .fg { fill: none; stroke: var(--yellow); stroke-width: 4; stroke-linecap: round; transition: stroke-dashoffset 0.25s linear; }
.timer-ring .tt { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--title); font-weight: 800; font-size: 12px; font-variant-numeric: tabular-nums; }
.timer-ring.low .fg { stroke: var(--danger); }
.timer-ring.low .tt { color: var(--danger); animation: blink 1s infinite; }
.timer-ring.over .tt { font-family: 'Rubik', sans-serif; font-size: 11px; color: var(--danger); text-align: center; line-height: 1.1; }

/* Итоги раунда */
.results { flex: 1; min-width: 0; transform: rotate(-1deg); border-radius: 10px; padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 2px 0 #cfc3a6, 0 14px 28px rgba(0, 0, 0, 0.5); }
.rs-reason { display: flex; align-items: center; gap: 10px; }
.rs-ic { width: 40px; height: 40px; flex: none; border-radius: 10px; background: var(--ink); display: flex; align-items: center; justify-content: center; color: var(--paper); }
.rs-ic img { width: 30px; height: 30px; }
.rs-ic .ic { color: var(--paper); }
.rs-ic.tm { border-radius: 50%; }
.rs-reason div { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.rs-reason b { font-size: 16px; font-weight: 700; }
.rs-reason span { font-size: 14px; color: var(--ink-muted); }
.rs-line { border-top: 2px dashed rgba(42, 49, 99, 0.3); }
.rs-table { display: grid; grid-template-columns: minmax(0, 1fr) 60px 56px; align-items: center; row-gap: 10px; column-gap: 6px; }
.rs-h { font-size: 12px; font-weight: 600; color: var(--ink-muted); text-align: right; }
.rs-team { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rs-team div { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.rs-team b { font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-team span { font-size: 13px; color: var(--ink-muted); }
.rs-num { font-family: var(--title); font-weight: 900; font-size: 20px; text-align: right; }
.rs-num.tot { font-weight: 800; }
.round-title { flex: 1; min-width: 0; font-family: var(--title); font-weight: 800; font-size: 19px; line-height: 1.15; }

/* ---------- Поле ---------- */
#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(52px, 1fr);
  gap: 7px;
  max-height: calc(var(--rows) * 92px);
}
.board.rows6 { gap: 6px; grid-auto-rows: minmax(50px, 1fr); }
.card {
  position: relative;
  min-height: 50px;
  border-radius: 8px;
  background-color: var(--paper);
  background-image: linear-gradient(rgba(244, 238, 225, 0.55), rgba(244, 238, 225, 0.55)), var(--grain);
  background-size: auto, 192px 192px;
  background-position: 0 0, var(--gp, 0 0);
  color: var(--ink);
  box-shadow: 0 2px 0 var(--paper-edge), 0 5px 10px rgba(0, 0, 0, 0.35);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  user-select: none; -webkit-user-select: none;
  touch-action: manipulation;
  transition: transform 0.12s, box-shadow 0.12s, opacity 0.2s;
}
.card::before { content: ''; position: absolute; inset: 4px; border: 1px solid rgba(42, 49, 99, 0.2); border-radius: 5px; pointer-events: none; }
.card .w {
  position: relative;
  display: inline-block;
  white-space: nowrap;
  text-align: center;
  font-family: var(--word);
  font-weight: 700;
  font-size: 17px;
  text-transform: uppercase;
  line-height: 1;
  transform-origin: center;
}
.card.tap { cursor: pointer; }
.card.tap:active { transform: translateY(1px) scale(0.98); }
.card .cr { position: absolute; left: 5px; top: 4px; width: 12px; height: 12px; color: var(--tc); }
.card .cr svg { width: 100%; height: 100%; display: block; }
.card .ok {
  position: absolute; right: 5px; top: 5px; z-index: 3;
  width: 17px; height: 17px;
  border-radius: 50%;
  background: var(--ink); color: var(--yellow);
  display: flex; align-items: center; justify-content: center;
}

/* Мой выбор и выбор капитана — жёлтая карточка с галочкой */
.card.sel, .card.chosen {
  background: var(--yellow);
  transform: translateY(-4px);
  box-shadow: 0 2px 0 var(--yellow-dark), 0 10px 18px rgba(0, 0, 0, 0.5);
  z-index: 2;
}
.card.sel::before, .card.chosen::before { border-color: rgba(42, 49, 99, 0.3); }
.card.sel, .card.chosen { padding-top: 12px; }
body.typing .card.sel, body.typing .card.chosen { padding-top: 8px; }
.card.chosen { box-shadow: inset 0 0 0 3px var(--tc), 0 2px 0 var(--yellow-dark), 0 10px 18px rgba(0, 0, 0, 0.5); }

/* Отметки товарищей — их котики внутри карточки */
.card .mks { position: absolute; right: 5px; bottom: 5px; display: flex; align-items: center; z-index: 3; }
.card .mks .av { --ring: var(--paper); box-shadow: 0 0 0 2px var(--paper), 0 1px 3px rgba(0, 0, 0, 0.4); }
.card .mks .av + .av { margin-left: -6px; }
.card .mks .more { margin-left: 3px; padding: 0 4px; border-radius: 6px; background: var(--ink); color: var(--paper); font-size: 11px; font-weight: 700; line-height: 16px; }
.card.marked { justify-content: flex-start; padding-top: 9px; }

/* Цвета для капитана и в итогах: бумага в рамке краски и герб в углу */
.card.k.o0, .card.k.o1, .card.k.o2 { box-shadow: inset 0 0 0 3px var(--tc), 0 2px 0 var(--paper-edge), 0 5px 10px rgba(0, 0, 0, 0.35); }
.card.k.o0::before, .card.k.o1::before, .card.k.o2::before { display: none; }
.card.k.o0 { --tc: var(--t0); }
.card.k.o1 { --tc: var(--t1); }
.card.k.o2 { --tc: var(--t2); }
.card.k.on { box-shadow: inset 0 0 0 1.5px rgba(42, 49, 99, 0.35), 0 2px 0 var(--paper-edge), 0 5px 10px rgba(0, 0, 0, 0.35); }
.card.k.on::before { display: none; }
.card.k.chosen { background: var(--yellow); }

/* Пылесос (ловушка) */
.card.ot { background: var(--ink); color: var(--paper); box-shadow: inset 0 0 0 2px rgba(244, 238, 225, 0.5), 0 3px 8px rgba(0, 0, 0, 0.45); }
.card.ot::before { display: none; }
.card.ot .vac { width: 26px; height: 26px; flex: none; }
.card.ot .w { font-size: 14px; }
.card.r.ot { box-shadow: inset 0 0 0 2px var(--yellow), 0 3px 8px rgba(0, 0, 0, 0.45); }

/* Открытые: заливка краской, герб и слово на бумажной плашке */
.card.r { background-image: radial-gradient(circle, rgba(42, 49, 99, 0.2) 1px, rgba(0, 0, 0, 0) 1.4px); background-size: 4px 4px; background-position: 0 0; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18), 0 3px 6px rgba(0, 0, 0, 0.3); }
.card.r::before { display: none; }
.card.r.o0 { background-color: var(--t0); }
.card.r.o1 { background-color: var(--t1); }
.card.r.o2 { background-color: var(--t2); }
.card.r.on { background-color: var(--neutral); background-image: radial-gradient(circle, rgba(42, 49, 99, 0.3) 1px, rgba(0, 0, 0, 0) 1.4px); }
.card.r .crest { width: 21px; height: 21px; flex: none; display: block; }
.card.r .crest svg { width: 100%; height: 100%; display: block; }
.card.r .zz { width: 40px; height: 25px; flex: none; }
.card.r:not(.ot) .w { display: inline-block; padding: 1px 4px; border-radius: 3px; background: var(--paper); font-size: 13.5px; line-height: 1.1; }
.board.keyview .card.r { opacity: 0.85; }

/* Строка последнего действия */
.last { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; color: var(--muted); min-height: 20px; text-align: center; }
.last .ic { color: var(--muted); }
.last.good .ic { color: var(--good); }
.last.bad .ic { color: var(--danger); }
.last.gold .ic { color: var(--yellow); }
.last span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.next-caps { display: flex; gap: 10px 12px; justify-content: center; align-items: center; flex-wrap: wrap; margin: 0; font-size: 14px; color: var(--muted); }
.next-caps .nc { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; }

/* ---------- Капитан пишет подсказку ---------- */
.chosen-strip { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.chosen-strip .chip { padding: 4px 9px; border-radius: 6px; background: var(--yellow); color: var(--ink); font-family: var(--word); font-weight: 700; font-size: 15px; line-height: 1.1; }
.warn-line { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; background: rgba(255, 232, 0, 0.1); box-shadow: inset 3px 0 0 var(--yellow); color: var(--text); font-size: 14px; line-height: 1.35; }
.warn-line .ic { color: var(--yellow); margin-top: 1px; }
.warns { display: flex; flex-direction: column; gap: 6px; }
.warns:empty { display: none; }
.clue-row { display: flex; gap: 8px; align-items: center; }
.clue-row input {
  flex: 1; min-width: 0;
  height: 50px;
  padding: 0 14px;
  border-radius: 12px;
  border: none;
  box-shadow: 0 0 0 2.5px var(--yellow);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--title); font-weight: 800; font-size: 17px;
  text-transform: uppercase;
  outline: none;
}
.clue-row input::placeholder { text-transform: none; font-family: 'Rubik', sans-serif; font-weight: 400; font-size: 16px; color: #7d7a8e; }
.num-token {
  width: 50px; height: 50px; flex: none;
  border-radius: 50%;
  border: none;
  background: var(--tc, var(--t0)); color: var(--ink);
  font-family: var(--title); font-weight: 900; font-size: 20px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}
.t1 .num-token, .t2 .num-token { color: var(--paper); }
.send-btn { width: 50px; height: 50px; flex: none; border: none; border-radius: 12px; background: var(--yellow); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 2px 0 var(--yellow-dark); }
.nums { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 5px; }
.num { height: 40px; border-radius: 50%; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.3); font-family: var(--title); font-weight: 800; font-size: 16px; }
.num.on { background: var(--yellow); color: var(--ink); border: none; }
.team-btn { gap: 8px; }

/* Режим «капитан пишет»: остаётся только поле над клавиатурой */
#g-mini { display: none; }
body.typing .screen.game {
  position: fixed; left: 0; right: 0; top: 0;
  height: 100%;
  min-height: 0;
  max-width: none;
  padding: 8px 12px 6px;
  gap: 6px;
  overflow: hidden;
}
body.typing #g-top, body.typing #g-strip, body.typing #g-note, body.typing #g-last { display: none; }
body.typing #g-mini { display: flex; align-items: center; gap: 10px; min-height: 40px; }
#g-mini .mini-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
#g-mini .mini-txt b { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#g-mini .mini-txt span { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#g-mini .mini-timer { padding: 4px 9px; border-radius: 999px; box-shadow: inset 0 0 0 2px var(--yellow); font-family: var(--title); font-weight: 800; font-size: 12px; font-variant-numeric: tabular-nums; }
#g-mini .icon-btn { width: 40px; height: 40px; }
body.typing #g-board { flex: 1 1 auto; min-height: 0; }
body.typing .board { gap: 5px; max-height: none; grid-auto-rows: minmax(30px, 1fr); }
body.typing .card { min-height: 30px; }
body.typing .card.sel, body.typing .card.chosen { transform: translateY(-2px); }
body.typing .card.k:not(.mine):not(.ot) { opacity: 0.42; }
body.typing .card.r { opacity: 0.4; }
body.typing .card.r .crest, body.typing .card.r .zz { display: none; }
body.typing .dock { position: static; margin: 0; padding: 0; background: none; }
body.typing .warn-line { padding: 5px 8px; font-size: 13px; }

/* ---------- Итоги матча ---------- */
#e-main { display: flex; flex-direction: column; gap: 12px; }
.win-card {
  position: relative; overflow: hidden;
  margin: 10px 4px 4px;
  padding: 14px 18px 20px;
  border-radius: 18px;
  transform: rotate(1.2deg);
  box-shadow: 0 0 0 3px var(--yellow), 0 24px 48px rgba(0, 0, 0, 0.55);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  text-align: center;
}
.win-art { width: min(286px, 100%); aspect-ratio: 280 / 190; height: auto; display: block; }
.win-card .mis { font-size: clamp(34px, 11vw, 44px); --c1: var(--t0); --c2: var(--yellow); }
.win-card .mis.draw { --c2: var(--t1); }
.win-sub { font-size: 16px; font-weight: 600; }
.win-score { width: 100%; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); align-items: end; gap: 6px; }
.ws-team { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.ws-team .tm { --s: 34px; }
.ws-team span { font-size: 14px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-team b { font-family: var(--title); font-weight: 900; font-size: 32px; line-height: 1; }
.ws-team.lose { color: var(--ink-muted); }
.win-line { width: 100%; border-top: 2px dashed rgba(42, 49, 99, 0.35); margin: 4px 0; }
.win-label { font-family: var(--title); font-size: 12px; font-weight: 800; letter-spacing: 0.06em; }
.win-clue { padding: 6px 16px; border-radius: 8px; background: var(--yellow); font-family: var(--title); font-weight: 900; font-size: 20px; transform: rotate(-2deg); box-shadow: 0 3px 6px rgba(0, 0, 0, 0.18); overflow-wrap: anywhere; }
.win-by { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 15px; flex-wrap: wrap; }
.win-by b { font-weight: 600; }
.win-by span { color: var(--ink-muted); }
.winners { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.winners .wn { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; width: 60px; }
.winners .wn span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.final { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.final li { padding: 9px 12px; border-radius: 10px; background: rgba(0, 0, 0, 0.2); }
.fl-top { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 16px; }
.fl-top span:not(.tm) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-top b { font-family: var(--title); font-weight: 900; font-size: 22px; }
.final small { color: var(--muted); font-size: 13px; }
.awards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.award { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; }
.award:nth-child(odd) { transform: rotate(-0.8deg); }
.award:nth-child(even) { transform: rotate(0.8deg); }
.aw-icon { font-size: 28px; line-height: 1; }
.aw-title { font-family: var(--title); font-weight: 800; font-size: 15px; }
.aw-who { font-weight: 600; }
.aw-text { font-size: 13px; color: var(--ink-muted); }
.best { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; }
.best li > span { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.best b { font-family: var(--word); font-weight: 700; font-size: 17px; }
.table-wrap { overflow-x: auto; }
.ptable { width: 100%; border-collapse: collapse; font-size: 15px; }
.ptable th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 500; padding: 6px 4px; border-bottom: 1px solid rgba(255, 235, 200, 0.12); }
.ptable td { padding: 7px 4px; border-bottom: 1px solid rgba(255, 235, 200, 0.12); }
.ptable td:not(:first-child), .ptable th:not(:first-child) { text-align: center; white-space: nowrap; }
.ptable .who { display: flex; align-items: center; gap: 8px; }
.rounds { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-direction: column; gap: 6px; }
.rounds li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rounds .rp { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; }

/* ---------- Окна ---------- */
.backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(12, 8, 6, 0.66); 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-color: var(--wood-dark);
  background-image: repeating-linear-gradient(92deg, rgba(255, 230, 190, 0.02) 0px, rgba(255, 230, 190, 0.02) 2px, rgba(0, 0, 0, 0) 2px, rgba(0, 0, 0, 0) 11px);
  border-radius: 20px 20px 0 0;
  padding: 14px var(--gutter) calc(env(safe-area-inset-bottom) + 18px);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.4);
  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: 12px; }
.sheet-head h2 { font-family: var(--title); font-weight: 800; font-size: 18px; }
.sheet-body { display: flex; flex-direction: column; gap: 10px; }
.sheet-body p { margin: 0; }
.menu { display: flex; flex-direction: column; gap: 6px; }
.menu-item { display: flex; align-items: center; gap: 12px; text-align: left; min-height: 50px; padding: 10px 14px; border-radius: 12px; border: none; background: rgba(0, 0, 0, 0.22); font-weight: 500; }
.menu-item .ic { color: var(--yellow); }
.menu-item.danger, .menu-item.danger .ic { color: var(--danger); }
.menu-who { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); margin: 0; }
.menu-who b { color: var(--text); }
.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: rgba(0, 0, 0, 0.22); box-shadow: inset 3px 0 0 var(--tc); }
.h-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.h-top b { font-family: var(--title); font-weight: 800; font-size: 16px; }
.h-warn { color: var(--yellow); font-size: 13px; margin-bottom: 6px; }
.h-words { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-family: var(--word); font-weight: 700; font-size: 14px; padding: 3px 8px; border-radius: 6px; text-transform: uppercase; }
.chip.o0 { background: var(--t0); color: var(--ink); }
.chip.o1 { background: var(--t1); color: var(--paper); }
.chip.o2 { background: var(--t2); color: var(--paper); }
.chip.on { background: var(--neutral); color: var(--ink); }
.chip.ot { background: var(--ink); color: var(--paper); box-shadow: inset 0 0 0 1px var(--yellow); }
.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: rgba(0, 0, 0, 0.22); flex-wrap: wrap; }
.pm-name { display: flex; align-items: center; gap: 10px; font-weight: 500; min-width: 0; }
.pm-name.off { opacity: 0.55; }
.pm-btns { display: flex; gap: 4px; }
.tbtn { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.3); display: inline-flex; align-items: center; justify-content: center; }
.tbtn.on { background: rgba(255, 232, 0, 0.16); border-color: var(--yellow); }
.tbtn.danger { color: var(--danger); }
.tbtn .crown { color: var(--yellow); }
.cap-team { display: flex; flex-direction: column; gap: 8px; padding: 8px 0; }
.cap-team .team-head { display: flex; align-items: center; gap: 8px; font-weight: 600; }

/* ---------- Важные моменты: бумажная карточка поверх поля ---------- */
.moment { position: fixed; inset: 0; z-index: 40; pointer-events: none; opacity: 0; transition: opacity 0.2s; }
.moment.show { opacity: 1; pointer-events: auto; }
.m-back { position: absolute; inset: 0; background: rgba(12, 8, 6, 0.74); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 20px; }
.m-card {
  position: relative; overflow: hidden;
  width: min(330px, 100%);
  padding: 18px 20px 18px;
  border-radius: 18px;
  box-shadow: 0 0 0 3px var(--mc, var(--yellow)), 0 24px 48px rgba(0, 0, 0, 0.6);
  transform: rotate(-2deg) scale(0.9);
  transition: transform 0.25s cubic-bezier(0.2, 1.4, 0.4, 1);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  text-align: center;
}
.moment.show .m-card { transform: rotate(-2deg) scale(1); }
.m-card.trap { box-shadow: 0 2px 0 #cfc3a6, 0 24px 48px rgba(0, 0, 0, 0.6); padding: 16px 20px 20px; }
.m-card.trap::before { content: ''; position: absolute; inset: 7px; border: 2px dashed rgba(42, 49, 99, 0.6); border-radius: 12px; pointer-events: none; }
.m-card.win { --mc: var(--yellow); }
.m-card.t0 { --mc: var(--t0); }
.m-card.t1 { --mc: var(--t1); }
.m-card.t2 { --mc: var(--t2); }
.m-art { width: 100%; max-width: 276px; aspect-ratio: 280 / 190; height: auto; display: block; }
.m-card .tm { --s: 52px; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.18); }
.m-title { font-size: clamp(30px, 10vw, 38px); }
.m-title.long { font-size: clamp(22px, 7.4vw, 28px); white-space: normal; }
.m-word { padding: 6px 16px; border-radius: 8px; background: var(--ink); color: var(--paper); font-family: var(--word); font-weight: 700; font-size: 24px; text-transform: uppercase; transform: rotate(2deg); display: inline-flex; align-items: center; gap: 10px; }
.m-word.light { background: var(--yellow); color: var(--ink); font-family: var(--title); font-weight: 900; font-size: 22px; }
.m-word .cn-num { width: 32px; height: 32px; font-size: 16px; }
.m-sub { font-size: 15px; color: var(--ink-muted); }
.m-line { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 16px; font-weight: 600; flex-wrap: wrap; }
.m-line .tm { --s: 28px; box-shadow: none; }
.m-pill { padding: 3px 12px; border-radius: 999px; background: var(--ink); color: var(--paper); font-family: var(--title); font-weight: 900; font-size: 17px; }
.m-pill.txt { font-family: 'Rubik', sans-serif; font-weight: 600; font-size: 14px; padding: 4px 12px; }
.m-avs { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.m-caps { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.m-tap { padding: 8px 16px; border-radius: 999px; background: rgba(12, 8, 6, 0.88); font-size: 13px; color: var(--muted-hi); }

/* ---------- Уведомление об ошибке ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 96px);
  transform: translate(-50%, 20px);
  max-width: min(92vw, 520px);
  padding: 11px 16px;
  border-radius: 12px;
  background: var(--paper); color: var(--ink);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
  font-size: 15px; font-weight: 500; text-align: center;
  z-index: 60;
  opacity: 0; pointer-events: none;
  transition: transform 0.25s, opacity 0.25s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.error { background: var(--yellow); color: var(--ink); }

@media (max-width: 360px) {
  :root { --gutter: 10px; }
  .board { gap: 5px; }
  .cats { gap: 6px 2px; }
  .three .sc-name { font-size: 12px; }
}

/* ---------- Правила по шагам ---------- */
.tut-banner {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  min-height: 52px; padding: 10px 14px;
  border: none; border-radius: 10px;
  transform: rotate(-0.8deg);
  box-shadow: 0 2px 0 var(--paper-edge), 0 8px 16px rgba(0, 0, 0, 0.35);
  text-align: left; font-size: 15px;
}
.tut-banner span { flex: 1; }
.tut-banner .ic { color: var(--ink); }
.tut { display: flex; flex-direction: column; gap: 10px; }
.tut-step { font-size: 13px; color: var(--muted); }
.tut-title { margin: 0; font-size: 16px; color: var(--text); letter-spacing: 0.02em; }
.tut-art { display: flex; justify-content: center; align-items: center; min-height: 190px; padding: 14px 8px; border-radius: 14px; background: var(--hollow); box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.35); }
.tut-row { display: flex; gap: 7px; justify-content: center; flex-wrap: wrap; }
.tut-col { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.tut-card { width: 70px; height: 56px; flex: none; }
.tut-card .w { font-size: 16px; }
.tut-card.r .w { font-size: 13px; }
.tut-note { flex: none; width: 210px; }
.tut-teams { display: flex; flex-direction: column; gap: 14px; }
.tut-team { display: flex; align-items: center; gap: 10px; }
.tut-btn { padding: 10px 22px; border-radius: 12px; background: var(--yellow); color: var(--ink); font-weight: 700; box-shadow: 0 2px 0 var(--yellow-dark); }
.tut-win { width: 220px; max-width: 100%; height: auto; border-radius: 10px; background: var(--paper); padding: 6px; transform: rotate(-1.5deg); }
.tut .rules { min-height: 200px; }
.tut-nav { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.tut-nav .btn { flex: none; min-width: 96px; }
.tut-dots { flex: 1; display: flex; justify-content: center; gap: 4px; }
.tut-dot { width: 26px; height: 26px; padding: 0; border: none; background: none; display: inline-flex; align-items: center; justify-content: center; }
.tut-dot::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: rgba(244, 234, 216, 0.3); }
.tut-dot.on::before { background: var(--yellow); }
.sheet.still, .backdrop.still { animation: none; }

/* ---------- Связь ---------- */
.conn {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 10px); bottom: auto; right: auto;
  transform: translateX(-50%);
  z-index: 70;
  width: max-content; max-width: calc(100vw - 24px);
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--paper); color: var(--ink);
  box-shadow: 0 0 0 2px var(--danger), 0 10px 24px rgba(0, 0, 0, 0.5);
  font-size: 14px; font-weight: 600; text-align: left;
}
.conn-spin { width: 16px; height: 16px; flex: none; border-radius: 50%; border: 2.5px solid rgba(42, 49, 99, 0.25); border-top-color: var(--ink); animation: spin 0.9s linear infinite; }

/* ---------- Анимации ---------- */
.card.flip { animation: flip 0.24s ease-out; }
@keyframes flip { 0% { transform: perspective(500px) rotateY(88deg); } 65% { transform: perspective(500px) rotateY(-10deg); } 100% { transform: none; } }
.sc-pts b.bump { display: inline-block; animation: bump 0.4s cubic-bezier(0.2, 1.6, 0.4, 1); }
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.45); color: var(--yellow); } 100% { transform: scale(1); } }
.score.pulse { animation: pulse 0.7s ease-out; }
@keyframes pulse { 0% { box-shadow: inset 0 0 0 2px var(--yellow), 0 0 0 0 rgba(255, 232, 0, 0.55); } 100% { box-shadow: inset 0 0 0 2px var(--yellow), 0 0 0 12px rgba(255, 232, 0, 0); } }
.clue-note.enter, .results.enter { animation: drop 0.32s cubic-bezier(0.2, 1.3, 0.4, 1); }
@keyframes drop { 0% { opacity: 0; transform: translateY(-18px) rotate(-5deg) scale(1.04); } }
.pop { animation: pop 0.3s cubic-bezier(0.2, 1.6, 0.4, 1); }
@keyframes pop { 0% { transform: scale(0.4); opacity: 0; } }
.moment.show .mis.stamp { animation: stamp 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) 0.1s both; }
@keyframes stamp { 0% { transform: scale(1.9) rotate(-8deg); opacity: 0; } 60% { opacity: 1; } 100% { transform: none; } }
.moment.show .m-card.trap .m-art { animation: shake 0.5s ease-in-out 0.2s; }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translateX(-5px) rotate(-1deg); } 40% { transform: translateX(5px) rotate(1deg); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
.confetti { position: absolute; top: -14px; width: 11px; height: 7px; border-radius: 1px; pointer-events: none; z-index: 3; animation-name: fall; animation-timing-function: cubic-bezier(0.3, 0.2, 0.6, 1); animation-fill-mode: forwards; }
@keyframes fall { to { transform: translate(var(--x), 105vh) rotate(var(--r)); } }
.win-card .mis.lost { font-size: clamp(24px, 8vw, 32px); --c2: var(--t1); white-space: normal; }
@media (prefers-reduced-motion: reduce) {
  .card.flip, .bump, .pulse, .enter, .pop, .moment.show .mis.stamp, .moment.show .m-card.trap .m-art, .sheet, .backdrop { animation: none !important; }
  .confetti { display: none; }
  .m-card, .card, .toast { transition: none; }
}

/* ---------- Твоя команда: рамка по краю экрана ---------- */
body.edge::after {
  content: ''; position: fixed; inset: 0; z-index: 30; pointer-events: none;
  box-shadow: inset 0 0 0 4px var(--myc);
}

/* Карточка раунда: «Ты в команде» */
.m-you {
  width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 12px 12px; border-radius: 12px; border: 3px solid var(--tc);
}
.m-you.t0 { background: rgba(255, 72, 176, 0.13); }
.m-you.t1 { background: rgba(0, 120, 191, 0.12); }
.m-you.t2 { background: rgba(0, 169, 92, 0.12); }
.m-you-l { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-muted); }
.m-you-n { display: flex; align-items: center; gap: 8px; font-family: var(--title); font-weight: 900; font-size: 22px; line-height: 1.1; }
.m-you .tm { --s: 34px; box-shadow: none; }
.m-you-r { font-size: 14px; text-align: center; }

/* ---------- Судья ---------- */
.warn-line.bad { background: rgba(255, 108, 47, 0.13); box-shadow: inset 3px 0 0 var(--danger); }
.warn-line.bad .ic { color: var(--danger); }

/* Голосование «штраф или простить» */
.vote-card {
  position: relative; flex: 1; min-width: 0;
  transform: rotate(-1deg);
  padding: 12px 16px 14px;
  display: flex; flex-direction: column; gap: 7px;
  color: var(--ink);
}
.vote-card::before { content: ''; position: absolute; inset: 6px; border: 2px dashed rgba(42, 49, 99, 0.45); border-radius: 10px; pointer-events: none; }
.vc-head { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.vc-title { font-family: var(--title); font-weight: 900; font-size: 19px; text-transform: uppercase; line-height: 1.1; }
.vc-time { flex: none; min-width: 46px; text-align: center; padding: 3px 9px; border-radius: 999px; background: var(--ink); color: var(--paper); font-family: var(--title); font-weight: 800; font-size: 14px; }
.vc-what { position: relative; font-size: 15px; }
.vc-what b { font-family: var(--title); font-weight: 900; }
.vc-r { position: relative; display: flex; gap: 6px; align-items: flex-start; font-size: 14px; color: var(--ink-muted); line-height: 1.3; }
.vc-r .ic { flex: none; margin-top: 2px; color: var(--danger); }
.vc-q { position: relative; font-size: 13px; color: var(--ink-muted); }
.vc-btns { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 2px; }
.vc-btn { min-height: 46px; border-radius: 10px; font: 700 16px 'Rubik', sans-serif; cursor: pointer; }
.vc-btn.fine { background: var(--ink); color: var(--paper); border: none; box-shadow: 0 2px 0 #151a3a; }
.vc-btn.forgive { background: transparent; color: var(--ink); border: 2px solid var(--ink); }
.vc-btn:active { transform: translateY(2px); }
.vc-mine { position: relative; font-size: 15px; padding: 6px 0 2px; }
.vc-voters { position: relative; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.vc-av { opacity: 0.3; transition: opacity 0.2s; }
.vc-av.on { opacity: 1; }
.vc-n { margin-left: 4px; font-size: 13px; color: var(--ink-muted); }

/* ---------- Итоги матча: истории на весь экран ---------- */
body.story-open { overflow: hidden; }
.story { display: none; }
.story.show { display: block; position: fixed; inset: 0; z-index: 45; }
.st-wrap {
  position: absolute; inset: 0; overflow: hidden;
  padding: calc(env(safe-area-inset-top) + 16px) 16px calc(env(safe-area-inset-bottom) + 10px);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  background-color: var(--wood-dark);
  background-image: repeating-linear-gradient(92deg, rgba(255, 230, 190, 0.02) 0px, rgba(255, 230, 190, 0.02) 2px, rgba(0, 0, 0, 0) 2px, rgba(0, 0, 0, 0) 11px);
  cursor: pointer; user-select: none; -webkit-user-select: none;
}
.st-top { width: 100%; max-width: 460px; display: flex; flex-direction: column; gap: 10px; }
.st-bars { display: flex; gap: 4px; }
.st-bars span { flex: 1; height: 4px; border-radius: 2px; background: rgba(255, 235, 200, 0.22); }
.st-bars span.done { background: var(--text); }
.st-bars span.cur { background: var(--yellow); }
.st-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--muted); }
.st-skip { min-height: 36px; padding: 0 16px; border-radius: 999px; border: 1px solid rgba(255, 235, 200, 0.24); background: transparent; color: var(--text); font-weight: 600; font-size: 14px; }
.st-stage { flex: 1; min-height: 0; width: 100%; overflow-y: auto; display: flex; flex-direction: column; align-items: center; padding: 8px 4px 16px; }
.st-stage > .st-card { margin: auto 0; }
.st-foot { width: 100%; max-width: 460px; display: flex; justify-content: space-between; }
.st-foot button { min-height: 40px; padding: 0 4px; border: none; background: none; color: var(--muted); font-size: 14px; }

.st-card {
  position: relative; flex: none;
  width: min(340px, 100%);
  padding: 16px 18px 22px;
  border-radius: 18px;
  transform: rotate(-1.5deg);
  box-shadow: 0 0 0 3px var(--sc, var(--yellow)), 0 20px 40px rgba(0, 0, 0, 0.55);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  text-align: center; color: var(--ink);
}
.story.moved .st-card { animation: st-in 0.34s cubic-bezier(0.2, 1.3, 0.4, 1); }
@keyframes st-in { from { opacity: 0; transform: translateY(18px) rotate(-4deg) scale(0.94); } }
.st-label { font-family: var(--title); font-weight: 800; font-size: 11px; letter-spacing: 0.14em; color: var(--ink-muted); }
/* На низком экране картинка уменьшается, чтобы карточка влезла целиком. */
.st-art { display: block; width: min(100%, 300px, 38vh); width: min(100%, 300px, 38dvh); aspect-ratio: 280 / 190; height: auto; mix-blend-mode: multiply; }
.st-title { width: 100%; }
.st-mis { font-size: clamp(28px, 9.6vw, 38px); white-space: normal; --c1: var(--t0); --c2: var(--t1); }
.st-who { display: flex; align-items: center; justify-content: center; gap: 10px; max-width: 100%; }
.st-avs { display: flex; flex: none; }
.st-who.many .st-avs .av + .av { margin-left: -10px; }
.st-names { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; min-width: 0; text-align: left; }
.st-names b { font-family: var(--title); font-weight: 900; font-size: 22px; overflow-wrap: anywhere; }
.st-who.many .st-names b { font-size: 17px; }
.st-names span { font-size: 13px; color: var(--ink-muted); }
.st-stat {
  max-width: 100%; padding: 6px 16px; border-radius: 8px; background: var(--yellow);
  font-family: var(--title); font-weight: 900; font-size: 22px; line-height: 1.2;
  transform: rotate(-2deg); white-space: nowrap; box-shadow: 0 3px 6px rgba(0, 0, 0, 0.18);
}
.story.moved .st-stat { animation: st-pop 0.4s cubic-bezier(0.2, 1.5, 0.4, 1) 0.18s both; }
@keyframes st-pop { from { opacity: 0; transform: rotate(-8deg) scale(0.4); } }
.st-sub { font-size: 15px; font-weight: 600; }
.st-desc { font-size: 15px; color: var(--ink-muted); }

/* Первая история — победа */
.st-win { padding-top: 14px; }
.st-win .win-art { width: min(100%, 286px, 36vh); width: min(100%, 286px, 36dvh); }
.st-win .mis { font-size: clamp(34px, 11vw, 44px); --c1: var(--t0); --c2: var(--yellow); }
.st-win .mis.draw { --c2: var(--t1); }
.st-win .mis.lost { font-size: clamp(24px, 8vw, 32px); --c2: var(--t1); white-space: normal; }
.story.moved .st-win .mis:not(.lost) { animation: stamp 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) 0.15s both; }

/* «Как шёл матч» */
.st-match { align-items: stretch; text-align: left; gap: 12px; }
.st-match .st-label, .st-match .st-title, .st-match .st-desc { text-align: center; }
.st-match .st-mis { font-size: clamp(22px, 7vw, 26px); white-space: nowrap; }
.sm-rounds { display: flex; flex-direction: column; gap: 10px; }
.sm-round { display: flex; flex-direction: column; gap: 4px; }
.sm-rl { font-size: 13px; font-weight: 600; }
.sm-rl span { font-weight: 400; color: var(--ink-muted); }
.sm-bar { display: flex; align-items: center; gap: 6px; }
.sm-bar i { display: block; height: 12px; min-width: 3px; width: calc((100% - 40px) * var(--f)); border-radius: 3px; }
.sm-bar b { font-family: var(--title); font-weight: 900; font-size: 13px; }
.st-match.dense .sm-rounds { gap: 6px; }
.st-match.dense .sm-round { gap: 2px; }
.st-match.dense .sm-bar i { height: 7px; }
.st-match.dense .sm-bar b { font-size: 11px; }
.sm-total { border-top: 2px dashed rgba(42, 49, 99, 0.35); padding-top: 10px; display: flex; justify-content: center; align-items: baseline; gap: 10px; font-family: var(--title); font-weight: 900; }
.sm-total b { font-size: 30px; }
.sm-total span { font-size: 22px; }

/* Экран итогов: награды маленькими карточками */
.aw-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.aw-head h3 { margin: 0; }
.link-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 2px; border: none; background: none; color: var(--yellow); font-weight: 600; font-size: 14px; }
.aw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px 12px; padding: 4px 3px 6px; }
.aw-mini {
  min-width: 0; padding: 8px 8px 10px; border: none; border-radius: 12px;
  box-shadow: 0 0 0 2.5px var(--sc, var(--yellow)), 0 6px 14px rgba(0, 0, 0, 0.4);
  display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; color: var(--ink);
}
.aw-mini:nth-child(odd) { transform: rotate(-1deg); }
.aw-mini:nth-child(even) { transform: rotate(1deg); }
.aw-mini:active { transform: scale(0.97); }
.aw-art { display: block; width: 100%; aspect-ratio: 280 / 190; height: auto; mix-blend-mode: multiply; }
.aw-t { font-family: var(--title); font-weight: 800; font-size: 12.5px; text-transform: uppercase; line-height: 1.2; margin-top: 2px; }
.aw-w { max-width: 100%; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aw-s { font-size: 12.5px; color: var(--ink-muted); }

/* Подробности — на светлой бумаге */
.more-btn { margin-top: 4px; }
.lp { padding: 12px 14px; border-radius: 14px; box-shadow: 0 2px 0 var(--paper-edge), 0 8px 16px rgba(0, 0, 0, 0.35); }
.lp h3 { color: var(--ink-muted); }
.lp-mute { color: var(--ink-muted); }
.lp .final li { background: rgba(42, 49, 99, 0.07); }
.lp .final small { color: var(--ink-muted); }
.lp .ptable th { color: var(--ink-muted); border-bottom-color: rgba(42, 49, 99, 0.18); }
.lp .ptable td { border-bottom-color: rgba(42, 49, 99, 0.12); }
.lp .best b { color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .story.moved .st-card, .story.moved .st-stat, .story.moved .st-win .mis { animation: none !important; }
}
.nw { white-space: nowrap; }

/* ---------- Главный экран: условия и подвал ---------- */
.home-legal { margin: 0; text-align: center; font-size: 13px; line-height: 1.4; color: var(--muted); }
.home-legal a, .home-foot a, .menu-legal a { color: var(--muted-hi); text-decoration: underline; text-underline-offset: 2px; }
.home-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2px 14px; font-size: 13px; color: var(--muted); }
.home-foot button { min-height: 36px; padding: 0; border: none; background: none; color: var(--muted-hi); text-decoration: underline; text-underline-offset: 2px; font-size: 13px; }
.home-foot a { display: inline-flex; align-items: center; min-height: 36px; }
.menu-legal { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 16px; font-size: 13px; }
.menu-legal a { display: inline-flex; align-items: center; min-height: 36px; }

/* ---------- Страницы: приватность, условия, лицензии ---------- */
.doc { max-width: 760px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 16px) var(--gutter) calc(env(safe-area-inset-bottom) + 30px); display: flex; flex-direction: column; gap: 14px; }
.doc-top { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; align-self: flex-start; color: var(--text); text-decoration: none; font-family: var(--title); font-weight: 800; font-size: 15px; }
.doc-top img { width: 40px; height: 40px; border-radius: 50%; }
.doc-card { padding: 22px 22px 26px; border-radius: 14px; box-shadow: 0 2px 0 var(--paper-edge), 0 14px 28px rgba(0, 0, 0, 0.4); }
.doc-card h1 { margin-bottom: 4px; font-family: var(--title); font-weight: 900; font-size: clamp(24px, 6.5vw, 32px); }
.doc-card h2 { margin: 22px 0 6px; font-family: var(--title); font-weight: 800; font-size: 16px; }
.doc-card p, .doc-card li, .doc-card dd { font-size: 15px; line-height: 1.5; }
.doc-card p { margin: 6px 0; }
.doc-card ul { margin: 6px 0; padding-left: 20px; }
.doc-card li { margin: 3px 0; }
.doc-card a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.doc-date { color: var(--ink-muted); font-size: 13px; }
.doc-card dl { margin: 8px 0 0; }
.doc-card dt { margin-top: 12px; font-weight: 700; font-size: 15px; }
.doc-card dd { margin: 2px 0 0; }
.doc-card .doc-keep { color: var(--ink-muted); }
.doc-foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 16px; font-size: 13px; color: var(--muted); }
.doc-foot a { display: inline-flex; align-items: center; min-height: 36px; color: var(--muted-hi); }

/* ---------- Лобби: складывающиеся настройки ---------- */
.team-tools { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 0 2px; }
.team-tools .btn { margin-left: auto; }
.set-toggle { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0; border: none; background: none; text-align: left; }
.set-sum { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.set-sum b { font-weight: 600; }
.set-sum small { font-size: 13px; color: var(--muted); }
.set-toggle .ic { color: var(--muted); transition: transform 0.15s; }
.set-toggle[aria-expanded="true"] .ic { transform: rotate(180deg); }
.set-body { margin-top: 8px; padding-top: 2px; border-top: 1px solid rgba(255, 235, 200, 0.1); }
#l-settings { display: flex; flex-direction: column; gap: 10px; }
.seg .seg-add { display: inline-flex; align-items: center; gap: 4px; color: var(--yellow); font-weight: 600; }
.themes-link { display: block; margin-left: auto; min-height: 36px; padding: 2px 0 6px; font-size: 13px; }

/* Своя тема */
.field textarea {
  width: 100%; min-height: 128px; padding: 10px 14px; resize: vertical;
  border: none; border-radius: 12px; outline: none;
  background: var(--paper); color: var(--ink);
  font: 500 16px/1.35 'Rubik', system-ui, sans-serif;
}
.field textarea::placeholder { color: #8d8a99; font-weight: 400; }
.field textarea:focus { box-shadow: 0 0 0 2.5px var(--yellow); }
.theme-preview { display: flex; flex-direction: column; gap: 8px; }
.tp-count { font-size: 15px; color: var(--muted-hi); }
.tp-count b { font-family: var(--title); font-weight: 800; color: var(--danger); }
.tp-count.ok b { color: var(--good); }

/* Как подключить общий экран */
.scr-on { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; background: rgba(79, 209, 139, 0.14); color: var(--good); font-weight: 600; }
.scr-steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; }
.scr-big { display: block; font-family: var(--title); font-weight: 800; font-size: 18px; color: var(--yellow); overflow-wrap: anywhere; }

/* ---------- Общий экран: холст 1280×720, масштаб задаёт tvFit() ---------- */
body.tv { overflow: hidden; }
.tv-view { position: fixed; top: 0; right: 0; bottom: 0; left: 0; overflow: hidden; }
.tv .m-tap, .tv .st-foot, .tv .st-skip { display: none; }

.tv-home { display: flex; align-items: center; justify-content: center; }
#tv-main { display: flex; align-items: center; justify-content: center; gap: 72px; width: 100%; padding: 0 60px; }
.tv-home .poster { width: 330px; flex: none; align-self: center; }
.tv-home .poster .mis { font-size: 38px; }
.tv-form { flex: 0 1 480px; display: flex; flex-direction: column; gap: 14px; }
.tv-form h2 { font-family: var(--title); font-weight: 900; font-size: 34px; }
.tv-form p { margin: 0; font-size: 18px; color: var(--muted-hi); }
.tv-form .tv-or { margin-top: 6px; font-size: 15px; color: var(--muted); }
.tv-form .err { font-size: 16px; }

.tv-lobby { display: grid; grid-template-columns: 372px minmax(0, 1fr); gap: 26px; padding: 26px; }
.tv-join {
  align-self: center; display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 20px 22px 22px; border-radius: 14px; text-align: center;
  transform: rotate(-1deg);
  box-shadow: 0 2px 0 #cfc3a6, 0 18px 36px rgba(0, 0, 0, 0.5);
}
.tv-join .mis { font-size: 24px; }
.tv-qr { width: 288px; padding: 10px; border-radius: 10px; background: #fff; }
.tv-qr svg { display: block; width: 100%; height: auto; }
.tv-hint { font-size: 15px; line-height: 1.35; color: var(--ink-muted); }
.tv-hint b { color: var(--ink); }
.tv-code { font-family: var(--title); font-weight: 900; font-size: 44px; line-height: 1; letter-spacing: 0.05em; white-space: nowrap; }
.tv-room { min-height: 0; display: flex; flex-direction: column; gap: 12px; }
#tv-teams { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; }
.tv-team { flex: 1 1 0; min-height: 0; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; overflow: hidden; }
.tv-team-head { display: flex; align-items: center; gap: 12px; }
.tv-team-head b { font-family: var(--word); font-weight: 700; font-size: 32px; line-height: 1; }
.tv-team-head span:last-child { margin-left: auto; font-size: 16px; color: var(--muted); }
.tv-members { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.tv-member { width: 88px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 15px; font-weight: 600; text-align: center; }
.tv-member > span:last-child { display: flex; align-items: center; justify-content: center; gap: 3px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv-member .crown { color: var(--yellow); display: inline-flex; flex: none; }
.tv-member.off { opacity: 0.5; }
.tv-members .empty { font-size: 16px; color: var(--muted); padding: 14px 2px; }
#tv-info { display: flex; flex-direction: column; gap: 4px; }
#tv-info p { margin: 0; }
.tv-wait { font-size: 18px; font-weight: 600; }
.tv-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--muted); }
.tv-bar b { font-family: var(--title); font-weight: 800; color: var(--text); letter-spacing: 0.04em; }
.tv-btns { display: flex; gap: 6px; }
.tv-btns .icon-btn { width: 34px; height: 34px; border-radius: 9px; opacity: 0.7; }

.tv-game { display: grid; grid-template-columns: minmax(0, 1fr) 392px; gap: 14px; padding: 12px; }
.tv-game #g-board { min-height: 0; flex: none; display: flex; }
.tv .board, .tv .board.rows6 { flex: 1; gap: 8px; max-height: none; grid-auto-rows: minmax(0, 1fr); }
.tv .card { min-height: 0; border-radius: 10px; }
.tv .card .cr { width: 18px; height: 18px; left: 7px; top: 6px; }
.tv .card.r .crest { width: 36px; height: 36px; }
.tv .card.r .zz { width: 64px; height: 40px; }
.tv .card.ot .vac { width: 44px; height: 44px; }
.tv .card.ot .w { font-size: 22px; }
.tv .card.r:not(.ot) .w { padding: 2px 7px; font-size: 22px; }
.tv-side { min-height: 0; display: flex; flex-direction: column; gap: 10px; overflow: hidden; }
.tv-scores { flex: none; display: flex; flex-direction: column; gap: 6px; }
.tv .score { flex: none; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; padding: 8px 14px 9px; }
.tv .score .sc-top { grid-column: 1; }
.tv .score .sc-bot { grid-column: 1; }
.tv .score .sc-pts { grid-column: 2; grid-row: 1 / span 2; }
.tv .score .tm { --s: 26px !important; }
.tv .sc-name { font-size: 18px; }
.tv .sc-pts b { font-size: 32px; }
.tv .sc-pts span { display: none; }
.tv .pip { width: 9px; height: 9px; }
.tv .sc-found { font-size: 14px; }
.tv .note-row { padding: 0 2px; gap: 10px; }
.tv .cn-word { font-size: 34px; }
.tv .cn-num { width: 42px; height: 42px; font-size: 20px; }
.tv .cn-wait { font-size: 19px; }
.tv .cn-sub { font-size: 15px; }
.tv .cn-sub .btn.link { display: none; }
.tv .pl .pn { font-size: 15px; }
.tv .strip-row { flex-wrap: wrap; justify-content: flex-start; overflow: hidden; }
.tv .pl { flex: 0 1 84px; min-width: 70px; }
#tv-hist { flex: 1 1 0; min-height: 0; overflow: hidden; }
#tv-hist h3 { margin-bottom: 6px; }
.tv-hist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.tv-hist li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 5px 9px; border-radius: 8px; background: rgba(0, 0, 0, 0.2); box-shadow: inset 3px 0 0 var(--tc); }
.tv-hist b { font-family: var(--title); font-weight: 800; font-size: 13px; }
.tv-hist .chip { font-size: 13px; padding: 1px 6px; }
.tv .last { font-size: 15px; }
.tv .last span { white-space: normal; }
.tv .next-caps { font-size: 15px; }
.tv .wait { font-size: 15px; }
.tv #g-strip:empty { display: none; }

.tv-end { display: grid; grid-template-columns: 420px minmax(0, 1fr); gap: 24px; padding: 18px 24px; align-items: center; }
.tv-end .win-card { margin: 0; gap: 8px; padding: 12px 18px 18px; }
.tv-end .win-art { width: 240px; }
.tv-end-side { min-height: 0; max-height: 100%; display: flex; flex-direction: column; gap: 12px; }
.tv-end .aw-grid { grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 12px; }
.tv-end .aw-art { max-height: 128px; object-fit: contain; }

/* Важные моменты и истории — крупнее: на них смотрят издалека */
.tv .m-card { zoom: 1.45; }
.tv .m-card.trap, .tv .m-card.win { zoom: 1.25; }
.tv .st-card { zoom: 1.2; width: 380px; }
.tv .st-top { max-width: 720px; }
