/* ———————————————————— palette ———————————————————— */
:root {
  --g-ink: #1d2340;
  --g-sun: #ffcc33;
  --g-pink: #ff4f8b;
  --g-sky: #3fa7ff;
  --g-mint: #35d49a;
  --g-orange: #ff8a3d;
  --g-violet: #8a6bff;
  --g-red: #ff5d73;
  --g-paper: #fffaf0;
  --g-font: "Fredoka", "Trebuchet MS", sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --dock-h: min(56vh, 460px);
}

[hidden] { display: none !important; }

/* ———————————————————— hub ———————————————————— */
.hub-screen { padding: 0; overflow: visible; }
.hub-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: visible;
  margin: 0;
  padding-bottom: calc(var(--space) * 2);
}
.hub-hero {
  position: relative;
  min-height: min(72vh, 640px);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.hub-hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 60% 40%;
  animation: hero-drift 24s ease-in-out infinite alternate;
}
.hub-hero-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(7, 19, 31, 0.86) 0%, rgba(7, 19, 31, 0.55) 38%, rgba(7, 19, 31, 0) 70%),
    linear-gradient(0deg, var(--bg) 0%, rgba(7, 19, 31, 0) 32%);
}
html[data-theme="light"] .hub-hero-shade {
  background:
    linear-gradient(90deg, rgba(10, 30, 48, 0.78) 0%, rgba(10, 30, 48, 0.42) 40%, rgba(10, 30, 48, 0) 70%),
    linear-gradient(0deg, #eef4f7 0%, rgba(238, 244, 247, 0) 30%);
}
.hub-hero-copy {
  position: relative;
  padding: clamp(16px, 3vw, 48px);
  padding-bottom: clamp(20px, 3vh, 36px);
  max-width: 760px;
  color: #fff;
  animation: rise 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.hub-logo {
  display: block;
  width: clamp(96px, 16vw, 140px);
  height: auto;
  margin: 0 0 4px;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.35));
}
.hub-brand {
  margin: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  font-weight: 800;
  font-size: clamp(32px, 4.6vw, 64px);
  line-height: 1.15;
  letter-spacing: -0.03em;
  overflow: visible;
  text-shadow: 0 6px 30px rgba(0, 0, 0, 0.35);
}
.hub-lead {
  margin: 10px 0 0;
  max-width: 520px;
  font-size: clamp(16px, 2.1vw, 21px);
  color: rgba(255, 255, 255, 0.92);
}
.hub-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.hub-btn {
  margin: 0;
  padding: 16px 26px;
  border-radius: 16px;
  font-family: var(--g-font);
  font-size: 19px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.hub-btn:hover { transform: translateY(-2px); }
.hub-btn-main { background: var(--g-sun); color: var(--g-ink); box-shadow: 0 6px 0 #c98f00; }
.hub-btn-main:active { transform: translateY(4px); box-shadow: 0 2px 0 #c98f00; }
.hub-btn-ghost { background: rgba(255, 255, 255, 0.16); color: #fff; backdrop-filter: blur(8px); }

.home-scroll { flex: 1 1 auto; min-height: 0; overflow: visible; }
.home-nav {
  position: sticky; top: 0; z-index: 2;
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 10px clamp(16px, 4vw, 48px);
  background: color-mix(in srgb, var(--bg, #07131f) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.home-nav a {
  color: var(--ink); text-decoration: none; font-weight: 700;
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel-solid);
}
.story {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(280px, 1.1fr);
  gap: 28px 36px;
  align-content: center;
  align-items: center;
  padding: 28px clamp(16px, 4vw, 56px) 40px;
  box-sizing: border-box;
}
.story-flip { background: color-mix(in srgb, var(--panel-solid) 55%, transparent); }
.story-copy h1, .story-copy h2 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: clamp(36px, 5vw, 58px);
  line-height: 1;
}
.story-kicker { margin: 0 0 8px; color: var(--accent-2, #ff8a5b); font-weight: 800; letter-spacing: 0.04em; }
.story-copy p, .story-copy li { color: var(--ink); font-size: 17px; line-height: 1.45; }
.story-copy ul { margin: 8px 0 16px; padding-left: 18px; }
.story-copy .hub-cta { margin-top: 8px; }
.story-copy .hub-btn-ghost { color: var(--ink); background: var(--panel-solid); border: 1px solid var(--line); }
.story-mosaic, .story-trio, .story-pair {
  display: grid; gap: 10px; margin: 0;
}
.story-mosaic { grid-template-columns: repeat(3, 1fr); }
.story-trio { grid-template-columns: repeat(3, 1fr); }
.story-pair { grid-template-columns: 1fr 1fr; }
.story figure { margin: 0; }
.story figure img {
  width: 100%; height: 148px; object-fit: cover; display: block;
  border-radius: 14px; background: var(--panel-solid);
}
.story .story-pair img, .story .story-trio img { height: min(28vh, 220px); object-fit: contain; padding: 12px; box-sizing: border-box; }
.story .story-photo img {
  height: auto;
  max-height: min(52vh, 460px);
  object-fit: contain;
  object-position: center top;
  background: #fff;
}
.story .story-board-shot img {
  height: min(38vh, 340px); object-fit: cover; object-position: center top;
}
.story figcaption {
  margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.35;
}
.story-chips {
  grid-column: 1 / -1; margin: 0;
  display: flex; flex-wrap: wrap; gap: 8px;
}
.story-chips span {
  padding: 6px 12px; border-radius: 999px;
  background: var(--panel-solid); border: 1px solid var(--line);
  color: var(--ink); font-size: 14px; font-weight: 700;
}
/* Инструмент 1: четыре экрана вопроса — видно механику и что даёт ответ. */
.story-qgrid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  align-content: start; margin: 0;
}
.story-qcard { margin: 0; }
/* Карточки вопроса — скриншоты 520×400: общее правило `.story figure img`
   с height:148px обрезало их по поясу, поэтому здесь своя высота и contain. */
.story .story-qcard img {
  width: 100%;
  height: auto;
  aspect-ratio: 520 / 400;
  object-fit: contain;
  padding: 0;
  background: var(--panel-solid);
}
.story-qcard img {
  width: 100%; height: auto; display: block;
  aspect-ratio: 520 / 400;
  border-radius: 16px; background: var(--panel-solid);
  border: 1px solid var(--line);
  box-shadow: 0 10px 26px rgba(16, 24, 40, 0.08);
}
.story-qcard figcaption {
  margin: 6px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.35;
}
.story-profile {
  margin: 0; padding: 22px 24px; border-radius: 20px;
  background: var(--panel-solid); border: 1px solid var(--line);
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.06);
}
.story-profile-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.story-profile-head img { width: 52px; height: 52px; object-fit: contain; }
.story-profile-head strong { display: block; font-size: 22px; }
.story-profile-head span { color: var(--muted); }
.story-profile dl { margin: 0; display: grid; gap: 10px; }
.story-profile dl div { display: flex; justify-content: space-between; gap: 16px; }
.story-profile dt { color: var(--muted); }
.story-profile dd { margin: 0; font-weight: 700; }
.story-profile p { margin: 16px 0 0; color: var(--ink); }
@media (max-width: 860px) {
  .story { grid-template-columns: 1fr; min-height: 0; }
  .story-mosaic { grid-template-columns: repeat(2, 1fr); }
  .story .story-photo img { height: min(42vh, 280px); }
  .story-qgrid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .story-qgrid { grid-template-columns: 1fr; }
}

/* ———————————————————— главная: герой и инструменты ———————————————————— */
.home-screen { padding: 0; }
.home-hero {
  display: grid;
  grid-template-columns: minmax(300px, 1.05fr) minmax(280px, 0.95fr);
  gap: clamp(20px, 4vw, 56px);
  align-items: center;
  padding: clamp(28px, 5vw, 64px) clamp(16px, 4vw, 56px);
  position: relative;
  isolation: isolate;
}
.home-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(680px 380px at 12% 0%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 62%),
    radial-gradient(560px 340px at 92% 10%, color-mix(in srgb, var(--g-sun, #ffcc33) 20%, transparent), transparent 60%);
  pointer-events: none;
}
.home-eyebrow {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-2, #ff8a5b);
}
.home-hero-copy h1 {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-size: clamp(38px, 6.2vw, 76px);
  line-height: 0.98;
  letter-spacing: -0.02em;
}
.home-hero-copy h1 span {
  background: linear-gradient(100deg, #ffcc33 0%, #ff8a5b 45%, #ff4f8b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.home-lead {
  margin: 0 0 22px;
  max-width: 56ch;
  font-size: clamp(16px, 1.35vw, 19px);
  line-height: 1.55;
  color: var(--muted);
}
.home-hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }
.home-btn {
  border: none;
  cursor: pointer;
  border-radius: 999px;
  padding: 13px 26px;
  font: 800 16px/1 var(--g-font, var(--font));
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}
.home-btn-main {
  background: linear-gradient(140deg, #ffcc33, #ff8a3d);
  color: #1d2340;
  box-shadow: 0 8px 20px rgba(255, 138, 61, 0.32);
}
.home-btn-ghost {
  background: var(--panel-solid);
  color: var(--ink);
  border: 1px solid var(--line);
}
.home-btn:hover { transform: translateY(-2px); }
.home-btn:active { transform: translateY(1px); }
.home-hero-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 26px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}
.home-hero-facts b {
  display: block;
  /* Цифры набираем обычным Manrope: у Syne они широкие и сливаются. */
  font-family: var(--font-nums);
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.home-hero-art {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: stretch;
}
.hero-tile {
  margin: 0;
  border-radius: 20px;
  overflow: hidden;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
}
.hero-tile img {
  width: 100%;
  height: auto;
  aspect-ratio: 720 / 440;
  object-fit: cover;
  object-position: center;
  display: block;
  background: color-mix(in srgb, var(--accent) 12%, var(--panel-solid));
}
.hero-tile figcaption {
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
}
.hero-tile-a { transform: translateY(-8px); }
.hero-tile-d { transform: translateY(-8px); }

.home-block {
  padding: clamp(26px, 4vw, 54px) clamp(16px, 4vw, 56px);
  border-top: 1px solid var(--line);
}
.home-block-head { max-width: 74ch; margin-bottom: 22px; }
.home-kicker {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-2, #ff8a5b);
}
.home-block-head h2 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: clamp(28px, 3.4vw, 44px);
  line-height: 1.05;
}
.home-sub { margin: 0; color: var(--muted); font-size: 16.5px; line-height: 1.5; }

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(268px, 1fr));
  gap: 16px;
}
.tool-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px 22px 20px;
  border-radius: 22px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.tool-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, var(--tool-a), var(--tool-b));
}
.tool-games { --tool-a: #ff5d73; --tool-b: #ff8a3d; }
.tool-class { --tool-a: #35d49a; --tool-b: #3fa7ff; }
.tool-board { --tool-a: #8a6bff; --tool-b: #ff4f8b; }
.tool-bank { --tool-a: #ffcc33; --tool-b: #35d49a; }
.tool-badge {
  align-self: flex-start;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(100deg, var(--tool-a), var(--tool-b));
}
.tool-card h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.15;
}
.tool-card p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.5; }
.tool-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.6;
}
.tool-link {
  margin-top: auto;
  align-self: flex-start;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  font: 800 15px/1.4 var(--font);
  color: var(--accent);
}
.tool-link:hover { text-decoration: underline; }

.story-facewall {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  padding: 14px;
  border-radius: 24px;
  background:
    radial-gradient(320px 220px at 30% 10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    var(--panel-solid);
  border: 1px solid var(--line);
  align-content: center;
}
.story-facewall figure {
  margin: 0;
  border-radius: 16px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  display: grid;
  place-items: center;
  aspect-ratio: 5 / 6;
  max-height: 132px;
  overflow: hidden;
}
.story-facewall img { width: 100%; height: 100%; object-fit: contain; }
/* Персонажи на превью слегка покачиваются — экран класса выглядит живым.
   Качаем отдельным свойством translate, чтобы не спорить с hover-увеличением. */
.story-facewall figure { animation: face-bob 3.4s ease-in-out infinite; }
.story-facewall figure:nth-child(2n) { animation-delay: 0.45s; }
.story-facewall figure:nth-child(3n) { animation-delay: 0.9s; }
.story-facewall figure:nth-child(5n) { animation-delay: 1.35s; }
@keyframes face-bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -5px; } }

/* Живые превью: SVG-ролики играют прямо в <img>, поэтому им нужен свой кадр. */
.story-mosaic .story-reel-wide { grid-column: span 2; }
.story .story-reel img {
  width: 100%;
  height: auto;
  max-height: none;
  aspect-ratio: 720 / 440;
  object-fit: cover;
  background: #ffffff;
  border-radius: 14px;
}
.story .story-mosaic .story-reel-wide img { height: auto; aspect-ratio: 720 / 440; object-fit: cover; }

@media (prefers-reduced-motion: reduce) {
  .hero-tile, .story-facewall figure { transition: none; animation: none; }
  /* Анимированные SVG внутри картинок тоже успокаиваем. */
  .story-facewall figure, .story-mosaic figure, .hero-tile { animation: none; }
}

.hero-tile, .story-facewall figure { transition: transform 0.25s ease; }
.hero-tile:hover, .story-facewall figure:hover { transform: translateY(-4px) scale(1.02); }

.home-start { border-top: 1px solid var(--line); }
.start-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.start-steps li {
  position: relative;
  padding: 20px 20px 18px;
  border-radius: 20px;
  background: color-mix(in srgb, var(--panel-solid) 70%, transparent);
  border: 1px solid var(--line);
}
.step-num {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-bottom: 12px;
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 17px;
  color: #1d2340;
  background: linear-gradient(140deg, #ffcc33, #ff8a3d);
}
.start-steps h3 { margin: 0 0 6px; font-size: 18px; }
.start-steps p { margin: 0; color: var(--muted); font-size: 14.5px; line-height: 1.5; }
.home-start-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 22px;
  border-radius: 20px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
}
.home-start-cta p { margin: 0; color: var(--muted); font-size: 15px; }

@media (max-width: 960px) {
  .home-hero { grid-template-columns: 1fr; }
  .home-hero-art { order: -1; }
}
@media (max-width: 560px) {
  .home-hero-art { grid-template-columns: 1fr 1fr; }
  .story-facewall { grid-template-columns: repeat(3, 1fr); }
  .home-start-cta { flex-direction: column; align-items: flex-start; }
}
.hub-games-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hub-games-head .primary { width: auto; margin: 0; }

.hub-games-head { padding: 8px clamp(16px, 5vw, 64px) 0; max-width: 1400px; margin: 0 auto; box-sizing: border-box; }
.hub-games-head h2 { margin: 0; font-family: var(--font-display); font-size: clamp(28px, 4vw, 44px); }
.hub-games-head p { margin: 6px 0 0; }

.games-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  max-width: 1400px;
  padding: 18px clamp(16px, 5vw, 64px) 32px;
  gap: 22px;
  justify-content: stretch;
}
.game-tile {
  aspect-ratio: auto;
  max-width: none;
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  border: none;
  background: var(--panel);
  animation: rise 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(var(--i) * 70ms + 200ms);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.game-tile:hover { transform: translateY(-6px) rotate(-0.4deg); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.32); }
.game-cover { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; display: block; transition: transform 0.4s ease; }
.game-tile:hover .game-cover { transform: scale(1.04); }
.game-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.02em;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}
.game-info { display: flex; flex-direction: column; gap: 4px; padding: 14px 18px 18px; color: var(--ink); position: relative; }
.game-info::before {
  content: "";
  position: absolute;
  left: 18px;
  top: -4px;
  width: 54px;
  height: 6px;
  border-radius: 3px;
  background: var(--accent);
}
.game-title { font-family: var(--g-font); font-size: 24px; font-weight: 700; margin-top: 6px; }
.game-tag { color: var(--accent); font-weight: 700; font-size: 15px; }
.game-desc { color: var(--muted); font-size: 14px; line-height: 1.45; text-align: justify; hyphens: none; -webkit-hyphens: none; text-wrap: pretty; }

@keyframes hero-drift { from { transform: scale(1.04) translate(0, 0); } to { transform: scale(1.12) translate(-2%, -1%); } }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(0.6); opacity: 0; } 70% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* ———————————————————— modals: join / create ———————————————————— */
.join-card, .create-card { width: min(520px, 100%); }
.modal-card { overflow-x: hidden; }
.create-card { padding: 0 22px 22px; }
.create-card .create-cover { width: calc(100% + 44px); max-width: none; margin: 0 -22px 14px; display: block; aspect-ratio: 16 / 7; object-fit: cover; }
.modal-close { z-index: 3; }
.create-card .modal-close {
  top: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  background: rgba(10, 20, 35, 0.6);
  color: #fff;
  font-size: 26px;
  backdrop-filter: blur(6px);
}
.join-hero-head { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.join-hero-head p { margin: 0; }
.join-hero-head b { font-family: var(--g-font); font-size: 18px; }
.join-hero-pick {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 18px;
  background: radial-gradient(circle at 50% 60%, rgba(255, 204, 51, 0.45), rgba(255, 204, 51, 0.08) 70%);
  animation: rc-pop 0.35s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.skin-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 6px; }
.skin-tab {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  padding: 7px 12px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  font: 600 14px/1 var(--g-font);
  white-space: nowrap;
  cursor: pointer;
}
.skin-tab.on { background: var(--g-sun); border-color: var(--g-sun); color: var(--g-ink); }
.join-skins {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 8px;
  margin: 4px 0 6px;
  max-height: min(270px, 38vh);
  overflow-y: auto;
  padding: 4px;
}
.skin { margin: 0; padding: 4px; aspect-ratio: 1; border-radius: 14px; background: rgba(255, 255, 255, 0.07); border: 3px solid transparent; transition: transform 0.12s; cursor: pointer; }
.skin img { width: 100%; height: 100%; object-fit: contain; display: block; }
.skin:hover { transform: translateY(-2px); }
.skin.on { border-color: var(--g-sun); background: rgba(255, 204, 51, 0.2); transform: scale(1.06); }
.join-roster-names { display: flex; flex-wrap: wrap; gap: 8px; max-height: 34vh; overflow: auto; }
.roster-name { margin: 0; padding: 8px 14px; border-radius: 12px; font-weight: 700; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.roster-name span { font-weight: 600; font-size: 0.85rem; opacity: 0.85; }
.roster-name.on { background: var(--accent); color: var(--accent-ink); }
.row-gap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row-gap > button { margin-top: 0; }
.lobby-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.lobby-grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 12px; }
@media (max-width: 560px) { .lobby-grid2, .lobby-grid3 { grid-template-columns: 1fr; } }

/* ———————————————————— lobby ———————————————————— */
.lobby-screen { position: relative; overflow: auto; }
.lobby-bg {
  position: fixed;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(26px) saturate(1.3);
  opacity: 0.35;
  transform: scale(1.1);
  pointer-events: none;
  z-index: 0;
}
.lobby-wrap { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 24px; align-items: start; }
@media (max-width: 980px) { .lobby-wrap { grid-template-columns: 1fr; } }
.lobby-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.lobby-eyebrow { margin: 0; font-family: var(--g-font); font-size: 20px; color: var(--accent-2); font-weight: 600; }
.lobby-code-line { margin: 6px 0 0; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.lobby-code-label { font-family: var(--g-font); font-size: 15px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

/* код комнаты плашками */
.room-code {
  display: inline-flex;
  gap: clamp(5px, 0.8vw, 9px);
  cursor: pointer;
  user-select: all;
  position: relative;
  --rc-size: clamp(44px, 6.4vw, 66px);
}
.rc-tile {
  display: grid;
  place-items: center;
  width: var(--rc-size);
  height: calc(var(--rc-size) * 1.16);
  border-radius: calc(var(--rc-size) * 0.24);
  background: linear-gradient(180deg, #ffffff 0%, #fff4d6 100%);
  color: var(--g-ink);
  font: 700 calc(var(--rc-size) * 0.66) / 1 var(--g-font);
  box-shadow: 0 calc(var(--rc-size) * 0.09) 0 #e0a92b, 0 calc(var(--rc-size) * 0.18) 18px rgba(0, 0, 0, 0.28);
  transform: rotate(calc((var(--i) - 2) * 1.4deg));
  animation: rc-pop 0.5s cubic-bezier(0.3, 1.6, 0.5, 1) both;
  animation-delay: calc(var(--i) * 60ms);
}
.rc-tile:nth-child(3n + 2) { background: linear-gradient(180deg, #ffffff 0%, #ffe3ef 100%); box-shadow: 0 calc(var(--rc-size) * 0.09) 0 #e2588c, 0 calc(var(--rc-size) * 0.18) 18px rgba(0, 0, 0, 0.28); }
.rc-tile:nth-child(3n) { background: linear-gradient(180deg, #ffffff 0%, #dcf1ff 100%); box-shadow: 0 calc(var(--rc-size) * 0.09) 0 #3b8fd9, 0 calc(var(--rc-size) * 0.18) 18px rgba(0, 0, 0, 0.28); }
.room-code:hover .rc-tile { transform: translateY(-2px) rotate(calc((var(--i) - 2) * 1.4deg)); }
.room-code::after {
  content: 'Скопировано';
  position: absolute;
  left: 50%;
  top: 100%;
  margin-top: 12px;
  transform: translateX(-50%);
  padding: 4px 10px;
  border-radius: 10px;
  background: var(--g-ink);
  color: #fff;
  font: 600 13px/1.2 var(--g-font);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.room-code.copied::after { opacity: 1; }
@media (max-width: 700px) {
  .lobby-code-line .room-code { --rc-size: min(60px, calc((100vw - 48px) / (var(--n) * 1.18))); }
}
@keyframes rc-pop { from { opacity: 0; transform: translateY(14px) scale(0.6); } }
.lobby-student { text-align: center; padding: 18px 0 4px; }
.lobby-me-avatar { width: min(46vw, 200px); animation: bob 1.6s ease-in-out infinite; filter: drop-shadow(0 12px 20px rgba(0, 0, 0, 0.3)); }
.lobby-me-name { font-family: var(--g-font); font-size: 30px; font-weight: 700; margin: 4px 0 0; }
.lobby-wait { color: var(--muted); margin: 4px 0 0; font-size: 17px; }
.lobby-players { list-style: none; padding: 0; margin: 18px 0 6px; display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; }
.lobby-players li {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 6px 12px;
  border-radius: 18px;
  background: var(--panel);
  animation: pop 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(var(--i) * 40ms);
}
.lobby-players li.me { outline: 3px solid var(--g-sun); }
.lobby-players img { width: 72px; animation: bob 2s ease-in-out infinite; animation-delay: calc(var(--i) * -0.3s); }
.lobby-players span { font-weight: 700; font-size: 15px; text-align: center; word-break: break-word; }
.lobby-kick { position: absolute; top: 4px; right: 4px; margin: 0; width: 28px; height: 28px; padding: 0; border-radius: 50%; line-height: 1; font-size: 18px; background: rgba(255, 93, 115, 0.2); border: none; color: var(--danger); }
.lobby-side { background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 18px; box-shadow: var(--shadow-md); backdrop-filter: blur(14px); display: flex; flex-direction: column; gap: 14px; }
.lobby-preview { display: grid; grid-template-columns: 112px 1fr; gap: 12px 14px; align-items: center; }
.lobby-preview img { width: 112px; height: 112px; object-fit: cover; border-radius: 18px; grid-column: 1; grid-row: 1; }
.lobby-preview-head { grid-column: 2; grid-row: 1; }
.lobby-preview-title { margin: 0; font-family: var(--g-font, inherit); font-size: 1.25rem; font-weight: 700; }
.lobby-preview p { margin: 4px 0 0; }
.lobby-preview .lobby-preview-desc { grid-column: 1 / -1; margin: 0; text-align: justify; hyphens: none; -webkit-hyphens: none; text-wrap: pretty; }
.lobby-game-pick { width: 100%; text-align: left; border-radius: 14px; padding: 10px 12px; border: 1px solid var(--line); background: var(--panel-soft); font: inherit; font-weight: 700; cursor: pointer; }
.lobby-game-list { display: grid; gap: 8px; max-height: 280px; overflow: auto; margin-top: 8px; }
.lobby-game-card { display: grid; grid-template-columns: 64px 1fr; gap: 8px; text-align: left; border: 0; border-radius: 14px; padding: 8px; background: var(--panel-soft); cursor: pointer; font: inherit; }
.lobby-game-card.on { outline: 3px solid var(--accent); }
.lobby-game-card img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; grid-column: 1; grid-row: 1; }
.lobby-game-copy { grid-column: 2; grid-row: 1; }
.lobby-game-card b { display: block; }
.lobby-game-card span { display: block; color: var(--muted); font-size: 0.85rem; }
.lobby-game-desc { grid-column: 1 / -1; text-align: justify; hyphens: none; -webkit-hyphens: none; text-wrap: pretty; }
.lobby-invite { display: grid; grid-template-columns: 140px 1fr; gap: 14px; align-items: center; }
.lobby-qr { width: 140px; height: 140px; border-radius: 14px; background: #fff; padding: 6px; }
.lobby-invite-row { display: flex; flex-direction: column; gap: 6px; }
.lobby-invite-row input { font-size: 13px; margin: 0; padding: 8px 10px; }
.lobby-invite-row button { margin: 0; }
.lobby-invite-text p { margin: 0 0 6px; }
.lobby-settings label { margin: 10px 0; }
.lobby-field { margin: 10px 0; }

.lobby-role {
  display: flex;
  gap: 8px;
}

.lobby-role button {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 12px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.lobby-role button.on {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.lobby-field-title { display: block; font-size: var(--text-sm); color: var(--muted); margin-bottom: 6px; }
.time-fields { display: flex; gap: 10px; }
.lobby-settings .time-fields label { display: flex; align-items: center; gap: 6px; margin: 0; }
.time-fields input { width: 76px; margin: 0; text-align: center; font-weight: 600; }
.lobby-settings .check-row { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.lobby-settings .check-row input { width: auto; margin: 0; }
.lobby-bots-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; align-items: end; }
.lobby-bots-row .check-row { margin: 10px 0; min-height: 44px; }
.lobby-bots-row select:disabled { opacity: 0.5; cursor: not-allowed; }
@media (max-width: 560px) { .lobby-bots-row { grid-template-columns: 1fr; } }
.range-label { display: grid !important; grid-template-columns: 1fr auto; align-items: center; }
.range-label input { grid-column: 1 / -1; padding: 0; accent-color: var(--accent); }
.range-label output { font-weight: 600; color: var(--ink); }
.btn-start-lg { width: 100%; font-size: 20px; padding: 16px; margin-top: 14px; }
.mix-chip { display: inline-block; margin: 2px 3px 0 0; padding: 1px 8px; border-radius: 8px; font-size: 12px; font-weight: 700; background: rgba(255, 255, 255, 0.1); color: var(--ink); }
.lobby-report-row { margin-top: 10px; }

/* ———————————————————— bank ———————————————————— */
.bank-mech-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.mech-tab { margin: 0; padding: 8px 14px; font-size: 14px; border-radius: 999px; font-weight: 700; background: #fff; }
.mech-tab b { opacity: 0.65; font-weight: 600; margin-left: 4px; }
.mech-tab.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.bank-item {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 14px;
}
.bank-item:has(.bank-pic) { grid-template-columns: auto 96px minmax(0, 1fr); }
.bank-check { display: flex; align-items: flex-start; margin: 2px 0 0; }
.bank-pic {
  width: 96px;
  height: 96px;
  object-fit: contain;
  border-radius: 14px;
  background: #f3f6fb;
}
.bank-body { min-width: 0; }
.bank-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 4px; }
.bank-tags .q-pin { margin: 0 0 0 auto; padding: 2px 10px; font-size: 12px; line-height: 1.6; }
.bank-chip {
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef2f8;
  color: #3d4a66;
  font-size: 12px;
  font-weight: 700;
}
/* Текст вопроса — на всю ширину строки: никаких переносов через слово. */
.bank-item .q-text {
  margin: 0;
  max-width: 90ch;
  font-size: clamp(16px, 1.05vw, 19px);
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: break-word;
  text-wrap: pretty;
}
.bank-item .q-ans { margin: 8px 0 0; font-size: 15px; color: #1f9e70; font-weight: 700; }
/* Варианты — компактные чипы в строку: карточка ниже, вопросов на экране больше. */
.q-choices {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.q-choices li {
  margin: 0;
  padding: 5px 12px;
  border-radius: 999px;
  background: #f2f5f9;
  color: #111;
  font-size: 14px;
  line-height: 1.35;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.q-choices li.ok { background: #e2f6ec; color: #0d6b45; font-weight: 700; box-shadow: inset 0 0 0 1px #b6e7cf; }
.bank-item .q-ans::before { content: 'Ответ: '; color: #6b7390; font-weight: 600; }
.bank-row-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.bank-row-actions button { margin: 0; }
.bank-item .bank-meta { font-size: 12px; color: var(--muted); }
.bank-badge, .mix-chip { --mc: #7c8ba1; }
.bank-badge { padding: 3px 8px; border-radius: 8px; font-size: 12px; font-weight: 800; color: #fff; background: var(--mc); white-space: nowrap; }
.m-mcq { --mc: #3fa7ff; } .m-true_false { --mc: #8a6bff; } .m-gap_fill { --mc: #ff8a3d; } .m-matching { --mc: #14b8a6; }
.m-type_answer { --mc: #ff4f8b; } .m-listen { --mc: #e0457b; } .m-picture { --mc: #35b36b; } .m-scramble { --mc: #e8a000; }
.m-order { --mc: #4a6cf7; } .m-match { --mc: #0fa3b1; } .m-odd_one_out { --mc: #b5651d; }
.mix-chip[class*="m-"] { background: color-mix(in srgb, var(--mc) 30%, transparent); }
html[data-theme="dark"] .mech-tab { background: var(--panel); color: var(--ink); }
html[data-theme="dark"] .bank-chip { background: #1a3348; color: #e8eef6; }
html[data-theme="dark"] .bank-pic { background: #152433; }
.mech-tab[class*="m-"].on { background: var(--mc); color: #fff; }
.bank-list { max-height: none; flex: 1; }
.bank-main { display: flex; flex-direction: column; min-height: 0; }
.bank-list-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.bank-list-head button { margin: 0; }
.bank-more { margin: 10px auto; }
.bank-move { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bank-move select { width: auto; min-width: 140px; margin: 0; padding: 6px 10px; font-size: 0.85rem; }

/* Подборка — сворачиваемая колонка: по умолчанию вопросы занимают всю ширину. */
#screen-bank .bank-layout { grid-template-columns: minmax(0, 1fr); }
#screen-bank.side-open .bank-layout {
  grid-template-columns: minmax(0, 1fr) minmax(calc(300px * var(--ui-scale)), calc(360px * var(--ui-scale)));
}
#screen-bank .bank-side { display: none; }
#screen-bank.side-open .bank-side { display: block; }
@media (max-width: 980px) {
  #screen-bank.side-open .bank-layout { grid-template-columns: minmax(0, 1fr); }
  #screen-bank.side-open .bank-side { display: block; }
}
.modal-card.levels-card { width: min(calc(760px * var(--ui-scale)), 100%); }
.levels-list { display: flex; flex-direction: column; gap: 8px; max-height: 52vh; overflow: auto; margin: 10px 0; }
.level-row {
  display: grid; grid-template-columns: minmax(90px, 1fr) minmax(120px, 1.4fr) auto auto; gap: 8px 10px; align-items: end;
  padding: 10px 12px; border-radius: 12px; background: var(--panel-soft); border: 1px solid var(--line);
}
.level-row label, .levels-add label { margin: 0; }
.level-row input, .levels-add input { margin-top: 4px; }
.level-count { white-space: nowrap; padding-bottom: 10px; }
.level-btns { flex-wrap: nowrap; }
.level-btns button { margin: 0; white-space: nowrap; }
.level-del { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.level-del select { width: auto; margin: 0; }
.level-del button { margin: 0; }
.levels-add { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 10px; align-items: end; padding-top: 10px; border-top: 1px solid var(--line); }
.levels-add button { margin: 0; }
@media (max-width: 640px) {
  .level-row { grid-template-columns: 1fr 1fr; }
  .level-count { padding-bottom: 0; }
  .level-btns { grid-column: 1 / -1; }
  .levels-add { grid-template-columns: 1fr 1fr; }
  .levels-add button { grid-column: 1 / -1; }
}
.bank-mix { display: inline; }
.collections-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow: auto; }
.collections-list li { padding: 10px 12px; border-radius: 12px; background: var(--panel-soft); border: 1px solid var(--line); }
.collections-list li.editing { border-color: var(--accent); }
.collections-list .col-name { font-weight: 600; }
.collections-list .col-name .muted { font-weight: 500; }
.collections-list button { margin: 4px 0 0; }

/* Готовые подборки и свои — два отдельных блока, чтобы не путать. */
.col-block { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.col-block h3 { margin: 0 0 4px; }
.col-block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.col-block-head #col-subject-name { font-weight: 700; color: var(--accent); }
.collections-ready { max-height: 30vh; }
.collections-ready li { background: color-mix(in srgb, var(--accent) 10%, var(--panel-soft)); }
.col-empty { padding: 8px 2px; }

/* ——— Вопрос из базы на доску: предмет → поиск → карточка ——— */
.board-q-picker {
  position: fixed;
  top: 76px;
  right: 18px;
  z-index: 60;
  width: min(430px, calc(100vw - 28px));
  max-height: calc(100vh - 100px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-radius: 18px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
}
.board-q-picker[hidden] { display: none; }
.bqp-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bqp-head h3 { margin: 0; font-size: 18px; }
.bqp-x {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line);
  background: transparent; color: var(--ink); font-size: 20px; line-height: 1; cursor: pointer;
}
.bqp-label { display: flex; flex-direction: column; gap: 4px; font-weight: 700; font-size: 13px; }
.bqp-label select, .bqp-label input { font-family: var(--font); }
.bqp-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; overflow: auto; }
.bqp-item {
  width: 100%; text-align: left; display: flex; flex-direction: column; gap: 2px;
  padding: 9px 11px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel-soft); color: var(--ink); font-family: var(--font); cursor: pointer;
}
.bqp-item:hover, .bqp-item:focus-visible { border-color: var(--accent); }
.bqp-topic {
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--accent-ink, #0f766e);
}
.bqp-prompt { font-weight: 600; font-size: 14px; line-height: 1.35; }
.bqp-meta { font-size: 12px; color: var(--muted); }

@media (max-width: 720px) {
  .board-q-picker { top: auto; bottom: 12px; right: 12px; left: 12px; width: auto; max-height: 62vh; }
}
.danger-text { color: var(--danger) !important; }
.qe-card { width: min(820px, 100%); }
.qe-card textarea { font-family: var(--font); font-size: var(--text); min-height: 64px; }
.qe-help { margin: 0 0 6px; padding: 8px 12px; border-radius: 10px; background: rgba(20, 184, 166, 0.12); }
.qe-block[hidden], .qe-media[hidden] { display: none !important; }
.qe-media-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 700px) { .qe-media-row { grid-template-columns: 1fr; } }
.qe-media { padding: 12px; border-radius: 12px; border: 1px dashed var(--line); }
.qe-media p { margin: 0 0 6px; }
.qe-media audio { width: 100%; margin-top: 8px; }
.qe-image-preview { max-width: 100%; max-height: 160px; margin-top: 8px; border-radius: 10px; }
.qe-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.qe-choice { display: flex; align-items: center; gap: 8px; margin: 0; }
.qe-choice input[type="radio"] { width: 22px; height: 22px; margin: 0; flex: 0 0 auto; accent-color: var(--ok); }
.qe-choice input[type="text"] { margin: 0; }
.qe-actions { margin-top: 12px; }

/* ———————————————————— play shell ———————————————————— */
body.in-play { overflow: hidden; }
body.in-play #app > header.top { visibility: hidden; }
.play {
  position: fixed;
  inset: 0;
  z-index: 40;
  font-family: var(--g-font);
  color: var(--g-ink);
  background: linear-gradient(180deg, #8fd8ff, #c9f0ff);
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.play[hidden] { display: none !important; }
.play button { font-family: var(--g-font); margin: 0; }
.play-stage { position: absolute; inset: 0; }
.play-stage canvas { display: block; }
.play[data-layout="dock"] .play-stage { bottom: var(--dock-h); }
.play[data-layout="dom"] { touch-action: auto; user-select: auto; -webkit-user-select: auto; background: radial-gradient(120% 80% at 50% 0%, #ffe68a 0%, #ffb3d9 45%, #9fd4ff 100%); }
.play[data-layout="dom"] .play-stage { top: calc(58px + var(--safe-t)); overflow: auto; }

.play-top {
  position: absolute;
  top: calc(8px + var(--safe-t));
  left: calc(8px + var(--safe-l));
  right: calc(8px + var(--safe-r));
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 5;
  pointer-events: none;
}
.play-top > * { pointer-events: auto; }
.play-ico {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  display: grid;
  place-content: center;
  gap: 4px;
  border-radius: 14px;
  border: none;
  background: #fff;
  box-shadow: 0 4px 0 rgba(29, 35, 64, 0.25);
  padding: 0;
}
.play-ico span { width: 20px; height: 3px; border-radius: 2px; background: var(--g-ink); display: block; }
.snd-btn {
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231d2340' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9h4l5-4v14l-5-4H4z' fill='%231d2340'/%3E%3Cpath d='M16.5 8.5a5 5 0 0 1 0 7M19 6a8.5 8.5 0 0 1 0 12'/%3E%3C/svg%3E") center / 24px no-repeat;
}
.snd-btn.muted-all {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff5d73' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9h4l5-4v14l-5-4H4z' fill='%23ff5d73'/%3E%3Cpath d='M16 9l5 6M21 9l-5 6'/%3E%3C/svg%3E");
}
.lobby-title-btns { display: flex; gap: 8px; align-items: center; }

/* панель звука */
.snd-panel { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px; background: rgba(10, 14, 30, 0.45); }
.snd-panel[hidden] { display: none; }
.snd-card {
  width: min(380px, 100%);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  background: var(--g-paper, #fffaf0);
  color: var(--g-ink, #1d2340);
  border-radius: 22px;
  padding: 16px 18px 14px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  font-family: var(--g-font, inherit);
  animation: snd-in 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes snd-in { from { transform: translateY(16px) scale(0.96); } }
.snd-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.snd-head b { font-size: 22px; }
.snd-close { margin: 0; width: 36px; height: 36px; padding: 0; border-radius: 50%; border: none; background: rgba(29, 35, 64, 0.08); color: inherit; font-size: 22px; line-height: 1; }
.snd-row { display: block; margin: 10px 0 0; padding: 10px 12px; border-radius: 14px; background: #fff; color: inherit; }
.snd-top { display: flex; justify-content: space-between; font-weight: 700; font-size: 16px; }
.snd-top output { font-variant-numeric: tabular-nums; color: #2a9d74; }
.snd-line { display: flex; align-items: center; gap: 10px; margin: 6px 0 2px; }
.snd-row small { color: rgba(29, 35, 64, 0.6); font-size: 12px; }
.snd-mute {
  flex: 0 0 auto;
  margin: 0;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 10px;
  border: none;
  background: #e9f8f1 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231d2340' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9h4l5-4v14l-5-4H4z' fill='%231d2340'/%3E%3Cpath d='M16.5 8.5a5 5 0 0 1 0 7'/%3E%3C/svg%3E") center / 20px no-repeat;
}
.snd-mute.off {
  background-color: #ffe1e6;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e2445c' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9h4l5-4v14l-5-4H4z' fill='%23e2445c'/%3E%3Cpath d='M16 9l5 6M21 9l-5 6'/%3E%3C/svg%3E");
}
.snd-line input[type="range"] {
  flex: 1;
  margin: 0;
  height: 28px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  --p: 50%;
}
.snd-line input[type="range"]::-webkit-slider-runnable-track { height: 10px; border-radius: 5px; background: linear-gradient(90deg, #35d49a var(--p), rgba(29, 35, 64, 0.12) var(--p)); }
.snd-line input[type="range"]::-moz-range-track { height: 10px; border-radius: 5px; background: linear-gradient(90deg, #35d49a var(--p), rgba(29, 35, 64, 0.12) var(--p)); }
.snd-line input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -8px; border-radius: 50%; background: #fff; border: 3px solid #2a9d74; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25); }
.snd-line input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 3px solid #2a9d74; }
.snd-foot { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.snd-foot .ghost { margin: 0; color: inherit; border-color: rgba(29, 35, 64, 0.2); }
.snd-credit { margin: 0; font-size: 11px; line-height: 1.35; color: rgba(29, 35, 64, 0.55); }
.play-hud { flex: 1 1 auto; display: flex; align-items: center; gap: 6px; min-width: 0; }
.play-timer {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 14px;
  background: var(--g-ink);
  color: #fff;
  font-weight: 700;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25);
}
.play-timer.low { background: var(--g-red); animation: bob 0.6s ease-in-out infinite; }
.hud-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 14px;
  background: #fff;
  font-weight: 700;
  font-size: 18px;
  box-shadow: 0 4px 0 rgba(29, 35, 64, 0.2);
  white-space: nowrap;
}
.hud-chip img { width: 24px; height: 24px; }
.hud-chip.big b { font-size: 24px; }
.hud-chip span { opacity: 0.6; font-size: 15px; }
.minimap { flex: 1 1 auto; min-width: 80px; padding: 0 10px; }
.mm-track { position: relative; height: 12px; border-radius: 6px; background: rgba(255, 255, 255, 0.75); box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.08); }
.mm-dot { position: absolute; top: 50%; width: 26px; height: 26px; transform: translate(-50%, -50%); transition: left 0.3s linear; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.25)); }
.mm-dot.me { width: 34px; height: 34px; z-index: 2; }
.mm-flag { position: absolute; right: -4px; top: -6px; width: 8px; height: 24px; border-radius: 2px; background: repeating-linear-gradient(0deg, #1d1d2b 0 4px, #fff 4px 8px); }
.mm-gate { position: absolute; top: -3px; width: 4px; height: 18px; border-radius: 2px; background: var(--g-pink); transform: translateX(-50%); }
.hud-score { white-space: nowrap; display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 14px; background: #fff; font-weight: 700; font-size: 16px; box-shadow: 0 4px 0 rgba(29, 35, 64, 0.2); }
.hud-score b { font-size: 22px; }
.hud-score .t0 { color: var(--g-red); }
.hud-score .t1 { color: var(--g-sky); }
.play-hud { overflow: hidden; }
.hud-chip.opt b:first-child { color: var(--g-ink); opacity: 0.55; }
.splat-score { gap: 8px; }
.hud-chip .splat-bar { display: flex; width: 120px; height: 12px; border-radius: 6px; overflow: hidden; opacity: 1; box-shadow: inset 0 0 0 2px rgba(29, 35, 64, 0.12); }
.splat-bar i { display: block; height: 100%; transition: width 0.4s ease; }
.hud-chip .splat-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; opacity: 1; margin-right: 2px; }
.dive-oxy.low { background: #ffe1e6; animation: oxy-blink 0.7s ease-in-out infinite alternate; }
@keyframes oxy-blink { to { box-shadow: 0 4px 0 rgba(29, 35, 64, 0.2), 0 0 0 4px rgba(255, 77, 109, 0.5); } }

/* controls */
.play-controls { position: absolute; inset: auto 0 0 0; height: 0; z-index: 4; }
.play[data-layout="dock"] .play-controls { bottom: var(--dock-h); }
.play.quiz-open .play-controls { opacity: 0; pointer-events: none; }
.joy { position: absolute; left: calc(18px + var(--safe-l)); bottom: calc(22px + var(--safe-b)); width: 150px; height: 150px; touch-action: none; }
.joy-base { position: absolute; inset: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.32); border: 4px solid rgba(255, 255, 255, 0.7); display: grid; place-items: center; }
.joy-knob { width: 64px; height: 64px; border-radius: 50%; background: #fff; box-shadow: 0 5px 0 rgba(29, 35, 64, 0.25); transition: transform 0.05s; }
.joy.on .joy-base { background: rgba(255, 255, 255, 0.45); }
.pbtns { position: absolute; right: calc(14px + var(--safe-r)); bottom: calc(18px + var(--safe-b)); display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap-reverse; justify-content: flex-end; max-width: 60vw; }
.play[data-game="stumble"] .pbtns { left: calc(14px + var(--safe-l)); max-width: none; justify-content: space-between; }
.pbtn {
  position: relative;
  min-width: 82px;
  height: 82px;
  padding: 6px 12px;
  border-radius: 24px;
  border: none;
  background: #fff;
  color: var(--g-ink);
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 6px 0 rgba(29, 35, 64, 0.28);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  touch-action: none;
  transition: transform 0.06s;
}
.pbtn img { width: 40px; height: 40px; pointer-events: none; }
.pbtn.down { transform: translateY(5px); box-shadow: 0 1px 0 rgba(29, 35, 64, 0.28); }
.pbtn.off { opacity: 0.45; }
.pbtn[hidden] { display: none; }
.pbtn-main { min-width: 104px; height: 104px; border-radius: 34px; background: var(--g-sun); box-shadow: 0 7px 0 #c98f00; font-size: 16px; }
.pbtn-main img { width: 54px; height: 54px; }
.pbtn-term { background: #c7f1ff; box-shadow: 0 6px 0 #4aa8c9; animation: bob 0.9s ease-in-out infinite; }
.pbtn-item.ready { background: var(--g-pink); color: #fff; box-shadow: 0 6px 0 #b81f57; animation: bob 0.8s ease-in-out infinite; }
.pbtn-arrow { min-width: 96px; font-size: 36px; }
.pbtn-jump { min-width: 120px; }
.pbtn.cooling::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: conic-gradient(rgba(29, 35, 64, 0.55) var(--cd, 0deg), transparent 0);
  pointer-events: none;
}
.pbtn-quiz { background: #e6dcff; box-shadow: 0 6px 0 #7f62d9; }
.pbtn-quiz.ready { background: var(--g-violet); color: #fff; animation: bob 0.9s ease-in-out infinite; }
.pbtn-badge { position: absolute; top: -8px; right: -8px; min-width: 30px; height: 30px; border-radius: 15px; padding: 0 6px; background: var(--g-ink); color: #fff; font-size: 16px; line-height: 30px; }
.play[data-game="racing"] .pbtns { bottom: 12px; }
@media (max-width: 440px) {
  .joy { width: 124px; height: 124px; left: calc(10px + var(--safe-l)); }
  .joy-knob { width: 54px; height: 54px; }
  .pbtns { gap: 8px; right: calc(10px + var(--safe-r)); max-width: calc(100vw - 150px); }
  .pbtn { min-width: 68px; height: 68px; border-radius: 20px; font-size: 12px; }
  .pbtn img { width: 32px; height: 32px; }
  .pbtn-main { min-width: 86px; height: 86px; border-radius: 28px; }
  .pbtn-main img { width: 44px; height: 44px; }
  .pbtn-arrow { min-width: 84px; }
  .hud-chip { font-size: 15px; padding: 5px 8px; }
  .hud-chip.opt { display: none; }
  .hud-chip .splat-bar { width: 64px; }
  .hud-score { font-size: 13px; padding: 5px 8px; }
  .hud-score b { font-size: 18px; }
}

/* toasts & banner */
.play-toasts { position: absolute; top: calc(66px + var(--safe-t)); left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 8; pointer-events: none; }
.ptoast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 16px;
  background: #fff;
  font-weight: 700;
  font-size: 17px;
  box-shadow: 0 5px 0 rgba(29, 35, 64, 0.2);
  animation: pop 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  transition: opacity 0.4s, transform 0.4s;
  max-width: 92vw;
  text-align: center;
}
.ptoast img { width: 24px; }
.ptoast.good { background: var(--g-mint); color: #053b27; }
.ptoast.bad { background: var(--g-red); color: #fff; }
.ptoast.neutral { background: #fff; }
.ptoast.mega { background: linear-gradient(90deg, var(--g-sun), var(--g-pink)); color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.2); }
.ptoast.big { font-size: 26px; padding: 12px 24px; }
.ptoast.out { opacity: 0; transform: translateY(-14px) scale(0.95); }
.play-banner { position: absolute; left: 50%; top: calc(64px + var(--safe-t)); transform: translateX(-50%); z-index: 6; padding: 8px 16px; border-radius: 14px; background: rgba(29, 35, 64, 0.86); color: #fff; font-size: 15px; max-width: 92vw; text-align: center; }
.play-banner[hidden] { display: none; }

/* drawer */
.play-scrim { position: absolute; inset: 0; background: rgba(10, 14, 30, 0.45); z-index: 20; }
.play-scrim[hidden], .play-drawer[hidden] { display: none; }
.play-drawer {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(360px, 88vw);
  z-index: 21;
  background: var(--g-paper);
  padding: calc(16px + var(--safe-t)) 16px calc(16px + var(--safe-b)) calc(16px + var(--safe-l));
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  animation: slide-in 0.25s ease both;
  box-shadow: 10px 0 40px rgba(0, 0, 0, 0.25);
}
@keyframes slide-in { from { transform: translateX(-100%); } to { transform: none; } }
.play-drawer-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.play-drawer-head p { margin: 0; color: var(--g-ink); }
.pd-time { margin: 12px 0 4px; }
.pd-time b { color: var(--g-ink); background: var(--g-sun); padding: 1px 8px; border-radius: 8px; font-family: var(--g-font); }
.pd-time-btns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 6px; }
.pd-time-btns button {
  padding: 10px 4px;
  border-radius: 12px;
  border: 0;
  font: 700 15px/1 var(--g-font);
  color: var(--g-ink);
  background: #fff;
  box-shadow: 0 3px 0 rgba(29, 35, 64, 0.25);
  cursor: pointer;
}
.pd-time-btns button[data-add^="-"] { background: #ffe1e6; }
.pd-time-btns button:not([data-add^="-"]) { background: #d9f7ea; }
.pd-time-btns button:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(29, 35, 64, 0.25); }
.pd-time-btns button:disabled { opacity: 0.5; }
.play-drawer .room-code { --rc-size: 40px; margin-top: 4px; }
.pd-invite { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 10px; align-items: center; padding: 10px; border-radius: 14px; background: #fff; }
.pd-invite[hidden] { display: none; }
.play-drawer-qr { width: 112px; height: 112px; background: #fff; border-radius: 10px; display: block; }
.pd-invite-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pd-invite-text p { margin: 0; color: var(--g-ink); line-height: 1.25; }
.pd-invite-text input { margin: 0; width: 100%; min-width: 0; padding: 7px 9px; font-size: 12px; color: var(--g-ink); background: #f3f5fb; border: 1px solid rgba(29, 35, 64, 0.15); border-radius: 9px; }
.pd-invite-text button { margin: 0; }
.play-drawer-players { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.play-drawer-players li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 12px; background: #fff; font-weight: 600; }
.play-drawer-players li img { width: 34px; }
.play-drawer-players li span { flex: 1; }
.play-drawer-actions { display: flex; flex-direction: column; gap: 8px; margin-top: auto; }
.play-drawer .ghost { color: var(--g-ink); border-color: rgba(29, 35, 64, 0.2); }
.play-req { display: flex; align-items: center; gap: 6px; padding: 8px; border-radius: 12px; background: #fff3c4; }
.play-req span { flex: 1; font-weight: 600; }

/* ———————————————————— quiz ———————————————————— */
.pq { position: absolute; z-index: 10; pointer-events: none; }
.pq[hidden] { display: none; }
.pq > * { pointer-events: auto; }
.pq-sheet {
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0 calc(10px + var(--safe-r)) calc(10px + var(--safe-b)) calc(10px + var(--safe-l));
  transform: translateY(105%);
  transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.pq-sheet.open { transform: none; }
.pq-dock {
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--dock-h);
  padding: 10px calc(10px + var(--safe-r)) calc(10px + var(--safe-b)) calc(10px + var(--safe-l));
  background: linear-gradient(180deg, #ffe9a8, #ffd1e6);
  border-top: 5px solid #fff;
  overflow: auto;
}
.pq-inline { position: relative; }
.pq-card {
  position: relative;
  /* Свой цвет текста: тёмные игры (кузница, хор) задают светлый цвет сцены,
     и текст вопроса на белой карточке становился почти невидимым. */
  color: var(--g-ink, #1d2340);
  max-width: 720px;
  margin: 0 auto;
  padding: 14px 14px 16px;
  border-radius: 26px;
  background: #fff;
  box-shadow: 0 8px 0 rgba(29, 35, 64, 0.18), 0 20px 50px rgba(29, 35, 64, 0.18);
  overflow: hidden;
  animation: pop 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.pq-dock .pq-card { box-shadow: 0 6px 0 rgba(29, 35, 64, 0.14); }
.pq-idle { text-align: center; padding: 26px; font-size: 20px; color: rgba(29, 35, 64, 0.6); animation: none; }
.pq-idle p { margin: 0; animation: bob 1.4s ease-in-out infinite; }
.pq-timer { position: absolute; left: 0; right: 0; top: 0; height: 6px; background: rgba(29, 35, 64, 0.08); }
.pq-timer i { display: block; height: 100%; background: linear-gradient(90deg, var(--g-mint), var(--g-sun), var(--g-red)); transform-origin: left; animation: shrink linear forwards; }
.pq-card.sent .pq-timer i { animation-play-state: paused; }
@keyframes shrink { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.pq-head { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.pq-tag, .pq-repeat, .pq-hint { padding: 3px 10px; border-radius: 10px; font-size: 13px; font-weight: 600; background: #eef1ff; color: #4a56b8; }
.pq-repeat { background: #fff0c2; color: #8a5a00; }
.pq-hint { background: #e7fff4; color: #0d7a4f; }
.pq-media { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 8px 0 2px; }
.pq-emoji { font-size: 72px; line-height: 1; animation: pop 0.4s both; }
.pq-img { max-height: 150px; max-width: 70%; border-radius: 16px; }
.pq-listen { display: flex; align-items: center; gap: 10px; padding: 12px 20px; border-radius: 18px; border: none; background: var(--g-pink); color: #fff; font-size: 18px; font-weight: 700; box-shadow: 0 5px 0 #b81f57; }
.pq-wave { display: flex; gap: 3px; align-items: center; height: 22px; }
.pq-wave i { width: 4px; height: 8px; border-radius: 2px; background: #fff; transform: scaleY(0.55); }
.pq-listen.is-on .pq-wave i { height: 100%; animation: wave 0.9s ease-in-out infinite; }
.pq-wave i:nth-child(2) { animation-delay: -0.2s; } .pq-wave i:nth-child(3) { animation-delay: -0.4s; } .pq-wave i:nth-child(4) { animation-delay: -0.6s; }
@keyframes wave { 0%, 100% { transform: scaleY(0.35); } 50% { transform: scaleY(1); } }
.pq-prompt { margin: 8px 0 10px; font-size: clamp(19px, 4.6vw, 26px); font-weight: 600; line-height: 1.22; text-align: center; }
.pq-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pq-choices.n2 .pq-ch { min-height: 78px; font-size: 22px; }
.pq-ch {
  position: relative;
  min-height: 64px;
  padding: 10px 12px 10px 38px;
  border: none;
  border-radius: 18px;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  text-align: left;
  line-height: 1.15;
  background: var(--chc);
  box-shadow: 0 5px 0 var(--chs);
  transition: transform 0.08s, opacity 0.2s, filter 0.2s;
  word-break: break-word;
}
.pq-ch:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--chs); }
.pq-key { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border-radius: 7px; background: rgba(255, 255, 255, 0.28); font-size: 13px; display: grid; place-items: center; }
.c0 { --chc: #ff5d73; --chs: #c22b45; } .c1 { --chc: #3fa7ff; --chs: #1d6fc0; } .c2 { --chc: #f5a700; --chs: #b47a00; }
.c3 { --chc: #2fbf7a; --chs: #188a52; } .c4 { --chc: #8a6bff; --chs: #5a3fd0; } .c5 { --chc: #0fb3c4; --chs: #08808c; }
.pq-card.sent .pq-ch:not(.picked):not(.right) { opacity: 0.45; }
.pq-card.bad .pq-ch.picked { filter: grayscale(0.7); }
.pq-ch.right { outline: 4px solid #fff; box-shadow: 0 0 0 7px var(--g-mint); }
.pq-text { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.pq-input { margin: 0; font-family: var(--g-font); font-size: 24px; padding: 12px 16px; border-radius: 16px; border: 3px solid #d8ddf5; background: #f7f8ff; color: var(--g-ink); text-align: center; }
.pq-input:focus { outline: none; border-color: var(--g-sky); }
.pq-input::placeholder { font-size: 16px; color: #aab1d6; }
.pq-go { padding: 0 22px; border: none; border-radius: 16px; background: var(--g-mint); color: #053b27; font-size: 20px; font-weight: 700; box-shadow: 0 5px 0 #188a52; min-height: 54px; }
.pq-go:disabled { opacity: 0.4; }
.pq-go.pulse:not(:disabled) { animation: bob 0.7s ease-in-out infinite; }
.pq-len { grid-column: 1 / -1; margin: 0; text-align: center; letter-spacing: 6px; color: #9aa3cf; }
.pq-slots, .pq-tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.pq-slots { margin-bottom: 12px; }
.pq-slot { width: 44px; height: 52px; border-radius: 12px; border: 3px dashed #c9cff0; background: #f7f8ff; font-size: 26px; font-weight: 700; color: var(--g-ink); text-transform: lowercase; padding: 0; }
.pq-slot.on { border-style: solid; border-color: var(--g-sky); background: #e8f4ff; }
.pq-tile { width: 50px; height: 56px; border-radius: 14px; border: none; background: var(--g-sun); box-shadow: 0 5px 0 #c98f00; font-size: 28px; font-weight: 700; color: var(--g-ink); padding: 0; transition: transform 0.1s, opacity 0.2s; }
.pq-tile.used { opacity: 0.15; transform: scale(0.85); }
.pq-row { display: flex; justify-content: center; gap: 10px; margin-top: 10px; }
.pq-mini { padding: 8px 16px; border-radius: 12px; border: none; background: #eef1ff; color: #4a56b8; font-weight: 600; font-size: 15px; }
.pq-built { min-height: 58px; display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; margin-bottom: 10px; border-radius: 16px; background: #f4f6ff; border: 3px dashed #c9cff0; align-items: center; justify-content: center; }
.pq-built-empty { color: #9aa3cf; font-size: 15px; }
.pq-tokens { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.pq-tok { padding: 10px 14px; border-radius: 14px; border: none; background: var(--g-sky); color: #fff; font-size: 19px; font-weight: 600; box-shadow: 0 4px 0 #1d6fc0; transition: opacity 0.2s, transform 0.1s; }
.pq-tok.on { background: #fff; color: var(--g-ink); box-shadow: 0 3px 0 #c9cff0; }
.pq-tok.used { opacity: 0.15; transform: scale(0.9); }
.pq-pairs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pq-col { display: flex; flex-direction: column; gap: 8px; }
.pq-pl, .pq-pr { padding: 12px 10px; border-radius: 14px; border: 3px solid #e1e5fa; background: #fff; font-size: 17px; font-weight: 600; color: var(--g-ink); }
.pq-pl.sel { border-color: var(--g-sun); background: #fff6d6; }
.pq-pl.paired, .pq-pr.paired { color: #fff; border-color: transparent; background: var(--chc); }
.pq-fb { margin-top: 12px; text-align: center; font-size: 20px; }
.pq-fb span { display: block; font-size: 17px; margin-top: 2px; }
.pq-fb[hidden] { display: none; }
.pq-streak { display: inline-block; margin-left: 6px; padding: 2px 10px; border-radius: 10px; background: var(--g-sun); font-size: 15px; }
.pq-card.ok { animation: ok-flash 0.5s ease; }
.pq-card.ok .pq-fb { color: #11935a; }
.pq-card.bad { animation: shake 0.4s ease; }
.pq-card.bad .pq-fb { color: #d23c55; }
@keyframes ok-flash { 0% { box-shadow: 0 0 0 0 rgba(53, 212, 154, 0.8); } 100% { box-shadow: 0 0 0 26px rgba(53, 212, 154, 0); } }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

/* wide screens: dock на правой стороне */
@media (min-width: 980px) and (min-aspect-ratio: 4/3) {
  .play { --dock-w: 440px; }
  .play[data-layout="dock"] .play-stage { bottom: 0; right: var(--dock-w); }
  .play[data-layout="dock"] .play-controls { bottom: 0; right: var(--dock-w); }
  .pq-dock { top: 0; left: auto; width: var(--dock-w); height: auto; border-top: none; border-left: 5px solid #fff; padding-top: 70px; }
  .pq-sheet .pq-card { max-width: 640px; }
  .play[data-layout="dock"] .play-top { right: calc(var(--dock-w) + 8px); }
}
@media (max-height: 640px) {
  .pq-prompt { font-size: 18px; margin: 4px 0 6px; }
  .pq-ch { min-height: 50px; font-size: 16px; }
  .pq-emoji { font-size: 48px; }
  :root { --dock-h: 58vh; }
}

/* ———————————————————— results ———————————————————— */
.results { position: absolute; inset: 0; z-index: 30; overflow: auto; padding: calc(16px + var(--safe-t)) 12px calc(20px + var(--safe-b)); background: radial-gradient(120% 70% at 50% 0%, rgba(255, 230, 138, 0.97), rgba(255, 140, 190, 0.97) 55%, rgba(120, 150, 255, 0.97)); touch-action: auto; user-select: text; }
.results[hidden] { display: none; }
.results-card { max-width: 980px; margin: 0 auto; text-align: center; animation: rise 0.5s ease both; }
.results-eyebrow { margin: 0; font-weight: 600; opacity: 0.75; }
.results-title { margin: 2px 0 8px; font-size: clamp(30px, 7vw, 56px); color: #fff; text-shadow: 0 4px 0 rgba(29, 35, 64, 0.25); }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 10px; margin: 10px 0 16px; }
.podium-col { width: min(30vw, 160px); animation: pop 0.6s both; }
.podium-col.p1 { animation-delay: 0.3s; } .podium-col.p2 { animation-delay: 0.15s; } .podium-col.p3 { animation-delay: 0.45s; }
.podium-col img { width: 72%; animation: bob 1.4s ease-in-out infinite; }
.podium-col.p1 img { width: 90%; }
.podium-name { margin: 0 0 4px; font-weight: 700; font-size: 17px; word-break: break-word; }
.podium-block { border-radius: 18px 18px 6px 6px; color: #fff; font-size: 34px; font-weight: 700; display: grid; place-items: center; box-shadow: 0 6px 0 rgba(0, 0, 0, 0.15); }
.p1 .podium-block { height: 120px; background: var(--g-sun); color: var(--g-ink); }
.p2 .podium-block { height: 86px; background: #c3cbe6; color: var(--g-ink); }
.p3 .podium-block { height: 64px; background: #f0a36b; }
.results-me { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; max-width: 560px; margin: 0 auto 12px; }
.results-me div { background: #fff; border-radius: 18px; padding: 10px 4px; box-shadow: 0 5px 0 rgba(29, 35, 64, 0.15); }
.results-me strong { display: block; font-size: 26px; }
.results-me span { font-size: 13px; opacity: 0.7; }
.results-review { max-width: 560px; margin: 0 auto 12px; background: #fff; border-radius: 18px; padding: 12px 16px; text-align: left; }
.results-review p { margin: 0 0 6px; font-weight: 700; }
.results-review ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.results-review li { display: flex; justify-content: space-between; gap: 10px; font-size: 15px; }
.results-review b { color: #11935a; white-space: nowrap; }
.results-perfect { font-size: 22px; font-weight: 700; }
.results-class { background: #fff; border-radius: 22px; padding: 14px; text-align: left; margin: 10px 0; }
.results-acc { margin: 0 0 6px; font-size: 18px; }
.rep h3 { margin: 12px 0 6px; font-size: 18px; }
.rep-scroll { overflow: auto; }
.rep table { width: 100%; border-collapse: collapse; font-family: var(--font); font-size: 14px; }
.rep th, .rep td { padding: 6px 8px; border-bottom: 1px solid #eceff8; text-align: left; vertical-align: top; }
.rep th { background: #f4f6ff; font-weight: 700; }
.rep-review { color: #b4475c; }
.results-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 14px; }
.results-actions .primary { background: var(--g-ink); color: #fff; padding: 14px 24px; font-size: 18px; box-shadow: 0 5px 0 rgba(0, 0, 0, 0.3); border-radius: 16px; }
.results-actions .ghost { background: #fff; color: var(--g-ink); border: none; padding: 14px 20px; border-radius: 16px; font-size: 16px; }
.results-actions .muted { width: 100%; margin: 0; color: var(--g-ink); opacity: 0.7; }
@media (max-width: 520px) { .results-me { grid-template-columns: repeat(2, 1fr); } }

/* ———————————————————— tycoon ———————————————————— */
.ty { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 280px; grid-template-areas: "head head board" "quiz shop board"; gap: 14px; padding: 8px 14px calc(16px + var(--safe-b)); max-width: 1320px; margin: 0 auto; align-items: start; }
.ty-head { grid-area: head; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ty-cash { display: flex; align-items: center; gap: 10px; padding: 8px 22px 8px 12px; border-radius: 22px; background: #fff; box-shadow: 0 6px 0 rgba(29, 35, 64, 0.18); }
.ty-cash img { width: 50px; animation: bob 1.8s ease-in-out infinite; }
.ty-cash b { font-size: 44px; font-variant-numeric: tabular-nums; }
.ty-cash.bump { animation: pop 0.35s ease; }
.ty-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.ty-tag { padding: 6px 12px; border-radius: 12px; font-weight: 700; background: #fff; }
.ty-tag.gold { background: var(--g-sun); }
.ty-tag.ice { background: #c7f1ff; }
.ty-quiz { grid-area: quiz; }
.ty-shop { grid-area: shop; min-width: 0; }
.ty-shop h3, .ty-board h3 { margin: 4px 0 8px; font-size: 20px; }
.ty-ups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ty-up, .ty-pw { position: relative; min-width: 0; display: grid; grid-template-columns: 44px minmax(0, 1fr); grid-template-rows: auto auto auto; column-gap: 8px; text-align: left; padding: 10px; border-radius: 18px; border: none; background: #fff; box-shadow: 0 5px 0 rgba(29, 35, 64, 0.16); color: var(--g-ink); transition: transform 0.1s; }
.ty-up img, .ty-pw img { grid-row: 1 / 3; width: 44px; height: 44px; }
.ty-up-t { font-weight: 700; font-size: 16px; }
.ty-up-d { font-size: 12px; opacity: 0.65; font-family: var(--font); }
.ty-pips { grid-column: 1 / -1; display: flex; gap: 3px; margin-top: 6px; }
.ty-pips i { flex: 1; height: 6px; border-radius: 3px; background: #e5e8f5; }
.ty-pips i.on { background: var(--g-mint); }
.ty-price { position: absolute; right: 10px; top: 8px; padding: 2px 8px; border-radius: 10px; background: var(--g-sun); font-weight: 700; font-size: 14px; }
/* Цена на верхней кромке карточки: в узкой колонке она закрывала конец названия («Множите…»). */
.ty-up .ty-price { top: -9px; right: 8px; box-shadow: 0 2px 0 rgba(29, 35, 64, 0.12); }
.ty-up:disabled, .ty-pw:disabled { opacity: 0.5; }
.ty-up.bought, .ty-pw.bought { transform: scale(0.95); }
.ty-pws { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ty-pw { grid-template-columns: 1fr; justify-items: center; text-align: center; padding-top: 30px; font-weight: 700; font-size: 14px; }
.ty-pw img { grid-row: auto; }
.ty-pw .ty-price { left: 50%; right: auto; transform: translateX(-50%); }
.ty-board { grid-area: board; background: rgba(255, 255, 255, 0.65); border-radius: 22px; padding: 12px; }
.ty-board ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ty-board li { display: grid; grid-template-columns: 26px 34px 1fr auto; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 14px; background: #fff; font-weight: 600; transition: transform 0.3s; }
.ty-board li.me { background: var(--g-sun); }
.ty-board li.frozen { background: #c7f1ff; }
.ty-board li img { width: 32px; }
.ty-rank { font-weight: 700; opacity: 0.6; text-align: center; }
.ty-nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ty-feed { list-style: none; margin: 10px 0 0; padding: 0; font-size: 13px; font-family: var(--font); display: flex; flex-direction: column; gap: 4px; }
.ty-feed li { padding: 4px 8px; border-radius: 10px; background: rgba(255, 255, 255, 0.7); animation: rise 0.3s both; }
.ty-ice { position: fixed; inset: 0; z-index: 9; display: grid; place-content: center; text-align: center; background: rgba(160, 225, 255, 0.55); backdrop-filter: blur(3px); pointer-events: none; }
.ty-ice[hidden] { display: none; }
.ty-ice img { width: 140px; margin: 0 auto; animation: bob 1s ease-in-out infinite; }
.ty-ice p { font-size: 30px; font-weight: 700; margin: 6px 0 0; }
.ty-ice b { font-size: 40px; }
.ty-spec { grid-template-columns: minmax(0, 760px); grid-template-areas: "board"; justify-content: center; }
.ty-spec .ty-head, .ty-spec .ty-shop, .ty-spec .ty-quiz { display: none; }
.ty-spec .ty-board { padding: 20px; }
.ty-spec .ty-board h3 { font-size: 30px; text-align: center; }
.ty-spec .ty-board li { grid-template-columns: 40px 54px 1fr auto; font-size: 24px; padding: 10px 14px; }
.ty-spec .ty-board li img { width: 50px; }
.ty-spec .ty-feed { font-size: 17px; }
.ty-up-t, .ty-up-d { padding-right: 46px; }
/* Средние экраны (ноутбук, планшет боком): колонка магазина узкая — иконки и названия поменьше,
   чтобы «Множитель» и «Страховка» не резались. */
@media (min-width: 901px) and (max-width: 1280px) {
  .ty-up { grid-template-columns: 30px minmax(0, 1fr); padding: 10px 8px; }
  .ty-up img { width: 30px; height: 30px; }
  .ty-up-t { font-size: 14px; }
}
@media (max-width: 900px) {
  .ty { grid-template-columns: 1fr; grid-template-areas: "head" "quiz" "shop" "board"; }
  .ty-cash b { font-size: 34px; }
}
@media (max-width: 520px) {
  .ty { padding: 4px 8px calc(12px + var(--safe-b)); gap: 10px; }
  .ty-ups { grid-template-columns: 1fr; gap: 8px; }
  .ty-pws { gap: 8px; }
  .ty-pw { font-size: 12px; }
}

/* ———————————————————— draw ———————————————————— */
.dr { display: grid; grid-template-columns: minmax(0, 1fr) 280px; grid-template-areas: "top side" "board side" "guess side"; gap: 10px; padding: 6px 12px calc(14px + var(--safe-b)); max-width: 1200px; margin: 0 auto; }
.dr-top { grid-area: top; text-align: center; }
.dr-round { margin: 0; font-weight: 600; opacity: 0.7; }
.dr-word { margin: 2px 0 0; font-size: clamp(28px, 6vw, 46px); font-weight: 700; letter-spacing: 0.04em; color: var(--g-ink); }
.dr-sub { margin: 0; font-size: 15px; opacity: 0.75; min-height: 1.2em; }
.dr-board { grid-area: board; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.dr-canvas-wrap { position: relative; width: min(100%, 64vh); aspect-ratio: 1; border-radius: 22px; overflow: hidden; box-shadow: 0 8px 0 rgba(29, 35, 64, 0.16); background: #fff; }
#dr-canvas { width: 100%; height: 100%; display: block; touch-action: none; }
#dr-canvas.can-draw { cursor: crosshair; }
.dr-pick, .dr-reveal { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: rgba(255, 250, 240, 0.94); animation: pop 0.3s both; }
.dr-pick[hidden], .dr-reveal[hidden] { display: none; }
.dr-pick p, .dr-reveal p { margin: 0; font-size: 20px; font-weight: 600; }
.dr-pick button { width: min(80%, 320px); padding: 12px; border-radius: 18px; border: none; background: var(--g-sky); color: #fff; box-shadow: 0 5px 0 #1d6fc0; display: flex; flex-direction: column; }
.dr-pick button b { font-size: 26px; }
.dr-pick button span { opacity: 0.85; }
.dr-reveal b { font-size: 48px; }
.dr-reveal span { font-size: 22px; opacity: 0.7; }
.dr-tools { display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(100%, 64vh); }
.dr-tools[hidden] { display: none; }
.dr-colors, .dr-sizes { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.dr-color { width: 36px; height: 36px; border-radius: 50%; border: 3px solid #fff; background: var(--c); box-shadow: 0 3px 0 rgba(29, 35, 64, 0.2); padding: 0; }
.dr-color.on { transform: scale(1.2); border-color: var(--g-ink); }
.dr-size, .dr-act { height: 40px; min-width: 40px; border-radius: 12px; border: none; background: #fff; display: grid; place-items: center; padding: 0 10px; box-shadow: 0 3px 0 rgba(29, 35, 64, 0.2); font-weight: 600; }
.dr-size i { display: block; border-radius: 50%; background: var(--g-ink); }
.dr-size.on { background: var(--g-sun); }
.dr-guess { grid-area: guess; display: grid; grid-template-columns: 1fr auto auto; gap: 8px; max-width: 640px; width: 100%; margin: 0 auto; }
.dr-guess[hidden] { display: none; }
.dr-hint { border: none; border-radius: 16px; background: var(--g-pink); color: #fff; font-weight: 700; padding: 4px 12px; box-shadow: 0 5px 0 #b81f57; line-height: 1.05; }
.dr-side { grid-area: side; display: flex; flex-direction: column; gap: 10px; }
.dr-scores { list-style: none; margin: 0; padding: 10px; display: flex; flex-direction: column; gap: 6px; background: rgba(255, 255, 255, 0.65); border-radius: 20px; }
.dr-scores li { display: grid; grid-template-columns: 32px 1fr auto; gap: 6px; align-items: center; padding: 4px 8px; border-radius: 12px; background: #fff; font-weight: 600; }
.dr-scores li img { width: 30px; }
.dr-scores li.got { background: #c9f7e2; }
.dr-scores li.drawer { background: #ffe9a8; }
.dr-scores li.me { outline: 3px solid var(--g-ink); }
.dr-chat { list-style: none; margin: 0; padding: 10px; max-height: 32vh; overflow: auto; background: rgba(255, 255, 255, 0.65); border-radius: 20px; font-size: 14px; font-family: var(--font); display: flex; flex-direction: column; gap: 3px; }
.dr-chat li.ok { color: #11935a; font-weight: 700; }
.dr-chat li.sys { opacity: 0.7; }
@media (max-width: 900px) {
  .dr { grid-template-columns: 1fr; grid-template-areas: "top" "board" "guess" "side"; }
  .dr-canvas-wrap, .dr-tools { width: min(100%, 52vh); }
  .dr-chat { max-height: 22vh; }
}

/* join toast поверх игры */
.join-toast { z-index: 60; }

/* ———————————————————— связь ———————————————————— */
.net-banner {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  padding: 10px 18px 10px 40px;
  border-radius: 16px;
  background: #1d2340;
  color: #fff;
  font: 700 15px/1.2 var(--g-font, sans-serif);
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.25);
  max-width: 92vw;
}
.net-banner::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border-radius: 50%;
  border: 3px solid #ffc53d;
  border-right-color: transparent;
  animation: spin 0.9s linear infinite;
}
.net-banner.is-resume { padding-left: 18px; }
.net-banner.is-resume::before { display: none; }
.net-banner .btn-resume {
  margin-left: 12px;
  border: 0;
  border-radius: 999px;
  padding: 6px 12px;
  background: #ffc53d;
  color: #1d2340;
  font: 700 14px/1 var(--g-font, sans-serif);
  cursor: pointer;
}
.net-banner[hidden] { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.lobby-players li.offline img, .play-drawer li.offline img { filter: grayscale(1); opacity: 0.55; }
.off-tag { font-style: normal; font-size: 12px; font-weight: 700; color: #b4475c; }

/* ———————————————————— учитель: экран игрока ———————————————————— */
.pw-bar {
  position: absolute;
  left: calc(8px + var(--safe-l));
  right: calc(8px + var(--safe-r));
  bottom: calc(8px + var(--safe-b));
  z-index: 7;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 18px;
  background: rgba(29, 35, 64, 0.82);
  backdrop-filter: blur(6px);
  overflow-x: auto;
  scrollbar-width: thin;
}
.pw-bar[hidden], .pw[hidden] { display: none; }
.pw-bar-label { flex: 0 0 auto; color: #fff; font-weight: 700; font-size: 14px; padding-left: 6px; }
.pw-chips { display: flex; gap: 6px; }
.pw-chip {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px 4px 4px;
  border: none;
  border-radius: 14px;
  background: #fff;
  color: var(--g-ink);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25);
}
.pw-chip img { width: 30px; height: 30px; }
.pw-chip.on { background: var(--g-sun); outline: 3px solid #fff; }
.pw {
  position: absolute;
  top: calc(64px + var(--safe-t));
  right: calc(10px + var(--safe-r));
  max-height: calc(100% - 140px - var(--safe-t) - var(--safe-b));
  width: min(340px, 42vw);
  z-index: 8;
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 8px 0 rgba(29, 35, 64, 0.2), 0 20px 50px rgba(29, 35, 64, 0.25);
  overflow: hidden;
  animation: rise 0.3s ease both;
}
.pw-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--g-ink); color: #fff; }
.pw-head img { width: 44px; height: 44px; }
.pw-head > div { flex: 1; min-width: 0; }
.pw-eyebrow { margin: 0; font-size: 12px; opacity: 0.75; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.pw-name { margin: 0; font-size: 22px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pw-close { width: 36px; height: 36px; border: none; border-radius: 50%; background: rgba(255, 255, 255, 0.16); color: #fff; font-size: 24px; line-height: 1; cursor: pointer; padding: 0; }
.pw-body { flex: 1; overflow: auto; padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 10px; touch-action: pan-y; user-select: text; }
.pw-label { margin: 0 0 4px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #8a93c0; }
.pw-q { padding: 10px 12px; border-radius: 16px; background: #f4f6ff; }
.pw-prompt { margin: 0 0 8px; font-size: 18px; font-weight: 700; white-space: pre-line; }
.pw-emoji { font-size: 44px; text-align: center; }
.pw-img { display: block; max-width: 100%; max-height: 140px; margin: 0 auto 6px; border-radius: 12px; }
.pw-choices { margin: 0; padding-left: 22px; display: grid; gap: 4px; font-size: 16px; }
.pw-tiles { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; }
.pw-tiles span { min-width: 28px; padding: 4px 6px; border-radius: 8px; background: var(--g-sun); text-align: center; font-weight: 700; }
.pw-tiles.words span { background: #dff0ff; }
.pw-pairs { margin: 0; }
.pw-muted { margin: 0; color: #7a83ad; font-size: 14px; }
.pw-wait { margin: 0; padding: 14px; border-radius: 16px; background: #f4f6ff; color: #7a83ad; text-align: center; }
.pw-last { padding: 10px 12px; border-radius: 16px; }
.pw-last p:not(.pw-label) { margin: 0; font-size: 16px; }
.pw-last.ok { background: #d9f8ea; }
.pw-last.bad { background: #ffe1e6; }
.pw-stats { margin: 0; font-size: 15px; font-weight: 700; text-align: center; }
@media (max-width: 700px) {
  .pw { top: auto; left: calc(8px + var(--safe-l)); right: calc(8px + var(--safe-r)); width: auto; max-height: 46vh; bottom: calc(64px + var(--safe-b)); }
}

/* ———————————————————— заставка перед игрой ———————————————————— */
.intro {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: grid;
  place-items: center;
  padding: calc(12px + var(--safe-t)) calc(12px + var(--safe-r)) calc(12px + var(--safe-b)) calc(12px + var(--safe-l));
  background: rgba(10, 14, 30, 0.62);
  backdrop-filter: blur(6px);
  font-family: var(--g-font);
  color: var(--g-ink);
  animation: intro-fade 0.25s ease both;
}
@keyframes intro-fade { from { opacity: 0; } }
.intro-x {
  position: absolute;
  top: calc(4px + var(--safe-t));
  right: calc(12px + var(--safe-r));
  z-index: 2;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #1d2340;
  font-size: 30px;
  line-height: 0;
  display: grid;
  place-items: center;
  padding: 0 0 5px;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(29, 35, 64, 0.25);
}
.intro-x:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(29, 35, 64, 0.25); }
.intro-card {
  width: min(860px, 100%);
  max-height: calc(100dvh - 24px - var(--safe-t) - var(--safe-b));
  display: flex;
  flex-direction: column;
  background: var(--g-paper);
  border-radius: 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  animation: snd-in 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.intro-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  background: linear-gradient(90deg, #ffe68a, #ffc7e0 60%, #bfe6ff);
}
.intro-cover { width: 92px; height: 92px; border-radius: 20px; object-fit: cover; box-shadow: 0 5px 0 rgba(29, 35, 64, 0.2); }
.intro-eyebrow { margin: 0; font-size: 14px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.65; }
.intro-title h2 { margin: 2px 0 0; font-size: clamp(24px, 3.4vw, 34px); line-height: 1.05; }
.intro-tag { margin: 4px 0 0; font-size: 17px; font-weight: 600; opacity: 0.8; }
.intro-clock { position: relative; width: 84px; height: 84px; display: grid; place-items: center; }
.intro-clock svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.intro-clock circle { fill: #fff; stroke: rgba(29, 35, 64, 0.12); stroke-width: 4; }
.intro-clock .intro-ring { fill: none; stroke: var(--g-mint); stroke-linecap: round; stroke-dasharray: 119.4; stroke-dashoffset: 0; }
.intro-clock b { position: relative; font-size: 34px; font-variant-numeric: tabular-nums; }
.intro.low .intro-ring, .intro-card.low .intro-ring { stroke: var(--g-red); }
.intro-card.low .intro-clock b { color: var(--g-red); animation: bob 0.6s ease-in-out infinite; }
.intro-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px 18px;
}
.intro-sec { padding: 12px 14px; border-radius: 18px; background: #fff; box-shadow: 0 3px 0 rgba(29, 35, 64, 0.08); }
.intro-sec h3 { margin: 0 0 6px; font-size: 19px; }
.intro-sec p { margin: 0; font-size: 16px; line-height: 1.4; }
.intro-sec p + p { margin-top: 6px; }
.intro-muted { color: #6b7399; font-size: 14px !important; }
.intro-goal { grid-column: 1 / -1; background: #fff6d6; }
.intro-goal p { font-size: 18px; font-weight: 600; }
.intro-controls { grid-row: span 2; }
.intro-ctrl { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.intro-ctrl li { display: grid; gap: 4px; font-size: 16px; line-height: 1.3; }
.intro-key { justify-self: start; padding: 4px 10px; border-radius: 10px; background: var(--g-ink); color: #fff; font-weight: 700; font-size: 14px; line-height: 1.25; }
.intro-snd-ico {
  display: inline-block;
  width: 26px;
  height: 26px;
  vertical-align: middle;
  border-radius: 9px;
  box-shadow: 0 2px 0 rgba(29, 35, 64, 0.2), inset 0 0 0 1px rgba(29, 35, 64, 0.12);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231d2340' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9h4l5-4v14l-5-4H4z' fill='%231d2340'/%3E%3Cpath d='M16.5 8.5a5 5 0 0 1 0 7M19 6a8.5 8.5 0 0 1 0 12'/%3E%3C/svg%3E") center / 18px no-repeat;
}
.intro-sound button { margin-top: 8px; }
.intro-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px 16px;
  border-top: 1px solid rgba(29, 35, 64, 0.08);
}
.intro-count { margin: 0; font-size: 17px; }
.intro-count b { font-size: 20px; }
.intro-btns { display: flex; gap: 10px; align-items: center; margin-left: auto; }
.intro-btns button { margin: 0; }
.intro-go {
  min-height: 56px;
  padding: 0 26px;
  border: none;
  border-radius: 18px;
  background: var(--g-mint);
  color: #053b27;
  font: 700 20px/1 var(--g-font);
  box-shadow: 0 6px 0 #1f9e70;
  cursor: pointer;
}
.intro-go:active { transform: translateY(4px); box-shadow: 0 2px 0 #1f9e70; }
.intro-go:disabled { background: #dfe4f2; color: #6b7399; box-shadow: 0 4px 0 #b9c0d6; cursor: default; transform: none; }
@media (max-width: 640px) {
  .intro { padding: calc(6px + var(--safe-t)) calc(6px + var(--safe-r)) calc(6px + var(--safe-b)) calc(6px + var(--safe-l)); }
  .intro-card { border-radius: 22px; max-height: calc(100dvh - 12px - var(--safe-t) - var(--safe-b)); }
  .intro-head { grid-template-columns: 1fr auto; gap: 10px; padding: 12px 14px; }
  .intro-cover { display: none; }
  .intro-tag { font-size: 15px; }
  .intro-clock { width: 66px; height: 66px; }
  .intro-clock b { font-size: 26px; }
  .intro-body { grid-template-columns: 1fr; padding: 12px; gap: 10px; }
  .intro-controls { grid-row: auto; }
  .intro-sec p, .intro-ctrl li { font-size: 15px; }
  .intro-foot { padding: 10px 12px 12px; }
  .intro-btns { width: 100%; }
  .intro-go { flex: 1; }
}
/* ════════════════════ Новые игры: общие панели ════════════════════ */
/* Все 14 новых сцен живут в .play-stage; у DOM-сцен он скроллится сам. */
.play[data-layout="dom"] .play-stage { scrollbar-width: thin; }

.tw, .tg, .sg, .ch, .fg {
  min-height: 100%;
  padding: 8px 14px calc(14px + var(--safe-b));
  max-width: 1280px;
  margin: 0 auto;
  position: relative;
  color: var(--g-ink);
}
.tw-quiz, .tg-quiz, .sg-quiz, .ch-quiz, .fg-quiz {
  max-width: 620px;
  margin: 0 auto;
}

/* ——— Небоскрёб знаний ——— */
.tw { display: grid; grid-template-rows: 1fr auto; gap: 12px; }
.tw-sky {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(6px, 1.6vw, 26px);
  min-height: 40vh;
  padding: 24px 6px 0;
  border-radius: 26px;
  background:
    radial-gradient(120% 70% at 50% 0%, #d9eeff 0%, #eef7ff 55%, #f7fbff 100%);
  overflow: hidden;
}
.tw-sky::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0; height: 34px;
  background: linear-gradient(180deg, rgba(159, 212, 255, 0.45), rgba(159, 212, 255, 0));
  pointer-events: none;
}
.tw-col { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 62px; }
.tw-tower { position: relative; display: flex; flex-direction: column-reverse; align-items: center; gap: 2px; transform-origin: bottom center; }
.tw-tower.bump { animation: tw-bump 0.4s cubic-bezier(0.34, 1.8, 0.64, 1); }
.tw-tower.shake { animation: tw-shake 0.42s ease; }
@keyframes tw-bump { 0% { transform: scale(1); } 45% { transform: scale(1.14, 0.92); } 100% { transform: scale(1); } }
@keyframes tw-shake {
  0%, 100% { transform: translateX(0) rotate(0); }
  25% { transform: translateX(-7px) rotate(-2deg); }
  60% { transform: translateX(6px) rotate(2deg); }
}
.tw-floor {
  display: block;
  width: clamp(30px, 3.4vw, 46px);
  height: clamp(13px, 1.5vw, 19px);
  border-radius: 4px;
  background: linear-gradient(180deg, #ffffff, #d7e6ff);
  border: 2px solid #9ab7dd;
  box-shadow: inset 0 -3px 0 rgba(29, 35, 64, 0.08);
}
.tw-floor.gold {
  background: linear-gradient(180deg, #ffe680, #ffc53d);
  border-color: #d99a12;
  box-shadow: 0 0 12px rgba(255, 197, 61, 0.75);
}
.tw-roof {
  width: 0; height: 0;
  border-left: clamp(19px, 2.1vw, 27px) solid transparent;
  border-right: clamp(19px, 2.1vw, 27px) solid transparent;
  border-bottom: clamp(18px, 2vw, 26px) solid #ff5d73;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.18));
}
.tw-height {
  position: absolute;
  top: -30px; left: 50%;
  transform: translateX(-50%);
  font: 700 20px/1 var(--g-font);
  font-variant-numeric: tabular-nums;
  color: #1d2340;
  background: #fff;
  border-radius: 12px;
  padding: 3px 9px;
  box-shadow: 0 3px 0 rgba(29, 35, 64, 0.16);
}
.tw-over {
  position: absolute;
  top: -56px; left: 50%;
  transform: translateX(-50%);
  font: 700 14px/1 var(--g-font);
  color: #7a5cff;
}
.tw-meta { display: flex; flex-direction: column; align-items: center; gap: 2px; font: 600 12px/1.2 var(--g-font); max-width: 84px; }
.tw-meta img { width: clamp(30px, 3.6vw, 44px); height: auto; }
.tw-meta span { text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 100%; }
.tw-col.me .tw-height { background: var(--g-sun); }
.tw-col.me .tw-meta span { color: #8a6400; font-weight: 700; }
.tw-me {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 5px 0 rgba(29, 35, 64, 0.12);
}
.tw-me-label { margin: 0; font: 600 14px/1 var(--g-font); opacity: 0.7; }
.tw-me b { font: 700 34px/1 var(--g-font); font-variant-numeric: tabular-nums; }
.tw-me span { font: 600 15px/1 var(--g-font); opacity: 0.65; }
.tw-me-hint { flex-basis: 100%; margin: 0; font: 600 13px/1.3 var(--font); color: #4b5478; text-align: center; }
.tw-me-hint.warn { color: #b4475c; font-weight: 700; }
.tw-empty { font: 600 16px/1.4 var(--g-font); opacity: 0.55; padding: 40px 0; }

/* ——— Перетягивание каната ——— */
.tg { display: grid; grid-template-rows: auto 1fr auto; gap: 10px; align-content: start; }
.tg-sky { position: relative; height: clamp(190px, 30vh, 300px); border-radius: 26px; overflow: hidden;
  background: linear-gradient(180deg, #bfe6ff 0%, #e6f6ff 52%, #2a1f4a 52%, #5b3fa8 100%); }
.tg-cloud { position: absolute; background: #fff; border-radius: 999px; opacity: 0.75; filter: blur(0.4px); }
.tg-cloud.c1 { width: 120px; height: 34px; top: 22px; left: 8%; }
.tg-cloud.c2 { width: 90px; height: 26px; top: 54px; left: 62%; }
.tg-cloud.c3 { width: 150px; height: 40px; top: 12px; left: 38%; opacity: 0.6; }
.tg-pit { position: absolute; left: 50%; bottom: 22px; width: 220px; height: 78px; transform: translateX(-50%);
  background: radial-gradient(ellipse at center, #ff8a3d 0%, #b4341f 60%, rgba(42, 31, 74, 0) 72%);
  opacity: 0.75; }
.tg-team { position: absolute; top: 46%; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tg-team.tg-left { left: 3%; }
.tg-team.tg-right { right: 3%; }
.tg-team p { margin: 0; font: 700 14px/1 var(--g-font); color: #fff; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.4); }
.tg-pullers { display: flex; gap: 2px; align-items: flex-end; }
.tg-puller { display: flex; flex-direction: column; align-items: center; gap: 1px; font: 600 10px/1.1 var(--g-font); color: #fff; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); }
.tg-puller img { width: clamp(30px, 4vw, 48px); transform: rotate(-8deg) scale(var(--p, 1)); transition: transform 0.25s; }
.tg-puller.hot img { filter: drop-shadow(0 0 8px rgba(255, 197, 61, 0.95)); }
.tg-puller.me { outline: 2px solid var(--g-sun); outline-offset: 2px; border-radius: 12px; }
.tg-puller i { font-style: normal; opacity: 0.85; }
.tg-empty { font: 600 12px/1 var(--g-font); color: #fff; opacity: 0.6; }
.tg-rope { position: absolute; left: 4%; right: 4%; top: 50%; height: 12px; border-radius: 999px;
  background: repeating-linear-gradient(90deg, #c9a15a 0 14px, #a8823f 14px 20px);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.28); }
.tg-center { position: absolute; left: 50%; top: -6px; width: 4px; height: 24px; transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.85); border-radius: 2px; }
.tg-knot { position: absolute; top: 50%; width: 26px; height: 26px; border-radius: 50%; transform: translate(-50%, -50%);
  background: radial-gradient(circle at 30% 30%, #fff, #ff5d73 60%);
  box-shadow: 0 0 0 5px rgba(255, 93, 115, 0.3), 0 4px 0 rgba(0, 0, 0, 0.28);
  transition: left 0.45s cubic-bezier(0.2, 1.2, 0.4, 1); }
.tg-knot.jerk { animation: tg-jerk 0.34s ease; }
@keyframes tg-jerk { 0% { transform: translate(-50%, -50%) scale(1); } 40% { transform: translate(-50%, -50%) scale(1.35); } 100% { transform: translate(-50%, -50%) scale(1); } }
.tg-meter { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); margin: 0;
  font: 700 26px/1 var(--g-font); font-variant-numeric: tabular-nums; color: #fff;
  background: rgba(29, 35, 64, 0.55); border-radius: 14px; padding: 5px 16px; }
.tg-meter.danger { background: rgba(255, 93, 115, 0.85); animation: tg-pulse 0.9s ease-in-out infinite; }
@keyframes tg-pulse { 50% { transform: translateX(-50%) scale(1.07); } }

/* ——— Осада замка ——— */
.sg { display: grid; grid-template-rows: 1fr auto auto; gap: 10px; align-content: start; }
.sg-sky { position: relative; border-radius: 26px; overflow: hidden; padding: 12px 4% 0;
  display: flex; align-items: flex-end; justify-content: space-between;
  min-height: clamp(240px, 46vh, 440px); }
.sg-cat { width: clamp(110px, 17vw, 220px); margin-bottom: 4px; filter: drop-shadow(0 10px 10px rgba(40, 24, 8, 0.35)); transform-origin: 50% 90%; }
.sg-cat.r { transform: scaleX(-1); }
.sg-cat.fire { animation: sg-recoil 0.45s ease; }
.sg-cat.r.fire { animation-name: sg-recoil-r; }
@keyframes sg-recoil { 30% { transform: rotate(-6deg) translateX(-6px); } }
@keyframes sg-recoil-r { 30% { transform: scaleX(-1) rotate(-6deg) translateX(-6px); } }
.sg-keep { display: grid; justify-items: center; }
.sg-turret { width: clamp(80px, 10vw, 130px); margin-bottom: -10px; position: relative; z-index: 1; filter: drop-shadow(0 6px 8px rgba(40, 24, 8, 0.3)); }
.sg-field { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: start; }
.sg-side { display: flex; flex-direction: column; gap: 4px; }
.sg-side-t { margin: 0; font: 700 13px/1 var(--g-font); text-transform: uppercase; letter-spacing: 0.06em; color: #fff; text-shadow: 0 2px 6px rgba(40, 24, 8, 0.6); }
.sg-def .sg-side-t { color: #cfe3ff; }
.sg-att .sg-side-t { text-align: right; color: #ffd3d8; }
.sg-crew { display: flex; flex-direction: column; gap: 4px; }
.sg-att .sg-crew { align-items: flex-end; }
.sg-man { display: flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 12px; background: rgba(255, 255, 255, 0.82); font: 600 12px/1.1 var(--g-font); }
.sg-man.me { box-shadow: inset 0 0 0 2px var(--g-sun); }
.sg-def .sg-man { border-left: 4px solid #3d8bff; }
.sg-att .sg-man { border-right: 4px solid #ff4d5e; }
.sg-man img { width: 26px; }
.sg-man em { font-style: normal; font-variant-numeric: tabular-nums; opacity: 0.7; }
.sg-charge { width: 42px; height: 6px; border-radius: 3px; background: #e2e6f2; overflow: hidden; }
.sg-charge b { display: block; height: 100%; background: linear-gradient(90deg, #ffc53d, #ff5d73); transition: width 0.3s; }
.sg-wall { display: grid; grid-template-columns: repeat(3, auto); gap: 2px; padding: 4px; border-radius: 10px 10px 0 0; }
.sg-block { display: block; width: clamp(44px, 5.4vw, 72px); height: clamp(26px, 3.2vw, 42px);
  background: url("/assets/sprites/wall-block.webp") center/cover no-repeat; border-radius: 4px;
  box-shadow: 0 2px 0 rgba(60, 40, 20, 0.35); transition: transform 0.25s, opacity 0.3s, filter 0.2s; }
.sg-block.hit { animation: sg-hit 0.5s ease; }
.sg-block.down { opacity: 0.18; transform: scale(0.7) rotate(-8deg); filter: grayscale(1); }
@keyframes sg-hit { 0% { transform: translateX(0); filter: brightness(1.9); } 50% { transform: translateX(4px); } 100% { transform: translateX(0); filter: none; } }
.sg-shot { position: absolute; width: 34px; bottom: 30%; filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.35)); animation: 0.8s cubic-bezier(.3,.6,.6,1) forwards; }
.sg-shot.t0 { left: 14%; animation-name: sg-fly-right; }
.sg-shot.t1 { left: 82%; animation-name: sg-fly-left; }
@keyframes sg-fly-right { 50% { bottom: 78%; transform: rotate(180deg); } 100% { left: 46%; bottom: 40%; transform: rotate(360deg); opacity: 0.4; } }
@keyframes sg-fly-left { 50% { bottom: 78%; transform: rotate(-180deg); } 100% { left: 50%; bottom: 40%; transform: rotate(-360deg); opacity: 0.4; } }
.sg-round { margin: 0; text-align: center; font: 700 15px/1 var(--g-font); opacity: 0.65; }

/* ——— Хор голосов ——— */
.ch { display: grid; grid-template-rows: auto 1fr auto; gap: 12px; justify-items: center;
  align-content: start; background: transparent; position: relative; }
.ch-notes { position: absolute; left: 50%; top: 34%; width: 0; height: 0; pointer-events: none; z-index: 3; }
.ch-flynote { position: absolute; width: 54px; left: -27px; top: 0; opacity: 0; filter: drop-shadow(0 0 10px rgba(255, 220, 140, 0.8));
  animation: ch-fly 2s ease-out forwards; }
@keyframes ch-fly { 0% { opacity: 0; transform: translate(0, 40px) scale(0.4); } 15% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx, 0), -220px) rotate(var(--rot, 0)) scale(1.1); } }
.ch-mic { width: clamp(70px, 9vw, 110px); justify-self: center; filter: drop-shadow(0 0 calc(6px + var(--lvl, 0) * 26px) rgba(255, 209, 102, 0.85));
  animation: ch-sway 2.4s ease-in-out infinite; }
@keyframes ch-sway { 50% { transform: rotate(4deg) translateY(-3px); } }
.ch-waves { position: relative; width: min(520px, 88vw); aspect-ratio: 1; display: grid; place-items: center; }
.ch-wave { position: absolute; inset: calc(6% * var(--i)); border-radius: 50%;
  border: 2px solid rgba(127, 227, 255, 0.4); animation: ch-breath 3.4s ease-in-out infinite;
  animation-delay: calc(var(--i) * -0.5s); }
.ch-wave:nth-child(2) { border-color: rgba(160, 107, 255, 0.35); }
.ch-wave:nth-child(3) { border-color: rgba(255, 209, 102, 0.32); }
.ch-wave:nth-child(4) { border-color: rgba(127, 227, 255, 0.24); }
@keyframes ch-breath { 50% { transform: scale(1.05); opacity: 0.55; } }
.ch-core { position: absolute; display: grid; justify-items: center; gap: 4px; text-align: center; }
.ch-core.pulse { animation: ch-pulse 0.32s ease; }
@keyframes ch-pulse { 50% { transform: scale(1.06); } }
.ch-label { margin: 0; font: 600 13px/1 var(--g-font); }
.ch-level { font: 700 clamp(38px, 7vw, 66px)/1 var(--g-font); font-variant-numeric: tabular-nums; }
.ch-level span { color: #7a5cff; }
.ch-bar { position: relative; width: min(340px, 70vw); height: 16px; border-radius: 999px; background: rgba(255, 255, 255, 0.6); overflow: hidden; }
.ch-bar i { display: block; height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, #7fe3ff, #a06bff 60%, #ffd166); transition: width 0.35s ease; }
.ch-bar i.full { box-shadow: 0 0 16px rgba(255, 209, 102, 0.9); }
.ch-bar i.muted { background: #9aa3c4; filter: grayscale(0.6); }
.ch-hold { position: absolute; left: 0; top: 0; height: 100%; border-right: 3px solid #fff; width: 0; }
.ch-note { margin: 2px 0 0; font: 600 13px/1.3 var(--font); min-height: 18px; }
.ch-note.warn { color: #b4475c; font-weight: 700; }
.ch-voices { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; width: 100%; }
.ch-voice { position: relative; display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.82); font: 600 12px/1 var(--g-font); }
.ch-voice img { width: 28px; transform: scale(var(--p, 1)); transition: transform 0.3s; }
.ch-voice.me { box-shadow: inset 0 0 0 2px var(--g-sun); }
.ch-voice.hot { background: #fff3c4; }
.ch-voice b { font-variant-numeric: tabular-nums; opacity: 0.75; }
.ch-combo { position: absolute; top: -7px; right: -5px; font: 700 10px/1 var(--g-font); font-style: normal;
  background: var(--g-pink); color: #fff; border-radius: 999px; padding: 3px 6px; }
.ch.shake .ch-waves { animation: ch-shake 0.4s ease; }
@keyframes ch-shake { 25% { transform: translateX(-8px); } 60% { transform: translateX(7px); } }
.ch.triumph .ch-waves::after {
  content: "100%";
  position: absolute; inset: 0; display: grid; place-items: center;
  font: 700 64px/1 var(--g-font); color: rgba(255, 209, 102, 0.9);
  animation: ch-triumph 1.4s ease forwards;
}
@keyframes ch-triumph { 0% { transform: scale(0.5); opacity: 0; } 40% { transform: scale(1.1); opacity: 1; } 100% { transform: scale(1.4); opacity: 0; } }

/* ——— Кузница ——— */
.fg { display: grid; grid-template-rows: 1fr auto; gap: 12px; align-content: start; }
.fg-glow { position: absolute; inset: 0; pointer-events: none; opacity: 0.4;
  background: radial-gradient(60% 46% at 50% 78%, rgba(255, 138, 61, 0.85), rgba(255, 138, 61, 0) 70%);
  transition: opacity 0.4s; }
.fg-floor { position: relative; display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; align-items: end; }
.fg-floor.flash { animation: fg-flash 0.7s ease; }
@keyframes fg-flash { 0% { filter: brightness(2); } 100% { filter: none; } }
.fg-smith { position: relative; display: grid; justify-items: center; gap: 4px; padding: 10px 8px 8px; border-radius: 18px;
  background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.14); }
.fg-smith.me { border-color: rgba(255, 209, 102, 0.75); background: rgba(255, 209, 102, 0.12); }
.fg-forge { position: relative; width: 100%; height: 104px; }
.fg-fire { width: 44px; height: 52px; border-radius: 50% 50% 46% 46%;
  background: radial-gradient(circle at 50% 70%, #fff3b0, var(--hc, #ff8a3d) 62%, rgba(255, 93, 61, 0));
  filter: blur(0.4px); animation: fg-flicker 1.1s ease-in-out infinite; }
@keyframes fg-flicker { 0%, 100% { transform: translateX(-50%); } 50% { transform: translateX(-50%) scale(1.08, 0.94); } }
.fg-fire { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); opacity: calc(0.35 + var(--heat, 0%) / 100%); }
.fg-anvil-img { position: absolute; left: 50%; bottom: -4px; width: 92px; transform: translateX(-50%); filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.45)); }
.fg-sword { position: absolute; left: 50%; bottom: 30px; width: 70px; transform: translateX(-46%) rotate(-8deg);
  filter: drop-shadow(0 0 calc(var(--heat, 0%) / 6%) rgba(255, 160, 60, 0.9)); animation: fg-hammer 0.9s ease-in-out infinite; }
@keyframes fg-hammer { 0%, 100% { transform: translateX(-46%) rotate(-8deg); } 12% { transform: translateX(-46%) translateY(3px) rotate(-6deg); } }
.fg-sparks { position: absolute; left: 50%; bottom: 46px; width: 0; height: 0; opacity: 0; }
.fg-smith.hot .fg-sparks { opacity: 1; }
.fg-sparks i { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: #ffd166; box-shadow: 0 0 6px #ff8a3d;
  animation: fg-spark 0.9s ease-out infinite; }
.fg-sparks i:nth-child(2) { animation-delay: 0.22s; --dx: -26px; }
.fg-sparks i:nth-child(3) { animation-delay: 0.45s; --dx: 22px; }
.fg-sparks i:nth-child(4) { animation-delay: 0.67s; --dx: -12px; }
@keyframes fg-spark { 0% { transform: translate(0, 0); opacity: 1; } 100% { transform: translate(var(--dx, 16px), -34px); opacity: 0; } }
.fg-read { display: flex; align-items: center; gap: 6px; font: 600 12px/1.1 var(--g-font); }
.fg-read img { width: 26px; }
.fg-name { max-width: 76px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fg-heat { color: #ffd166; font-variant-numeric: tabular-nums; }
.fg-bar { position: relative; width: 100%; height: 8px; border-radius: 4px; background: rgba(0, 0, 0, 0.28); overflow: hidden; }
.fg-bar s { position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(255, 255, 255, 0.45); }
.fg-bar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #ff8a3d, #ffd166); transition: width 0.3s; }
.fg-count { margin: 0; font: 600 11px/1 var(--g-font); opacity: 0.7; }
.fg-anvil { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 16px; background: rgba(255, 255, 255, 0.1); }
.fg-anvil-t { margin: 0; font: 600 12px/1 var(--g-font); opacity: 0.75; }
.fg-blades { display: flex; gap: 4px; flex-wrap: wrap; }
.fg-blade { display: grid; justify-items: center; font-size: 11px; color: #ffd166; letter-spacing: -1px; animation: fg-pop 0.5s ease; }
.fg-blade img { width: 40px; transform: rotate(-35deg); filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5)); }
.fg-anvil-ico { width: 40px; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5)); }
@keyframes fg-pop { 0% { transform: scale(0.3); } 70% { transform: scale(1.15); } 100% { transform: none; } }
.fg-none { font: 600 12px/1 var(--g-font); opacity: 0.55; }

/* ——— Адаптив новых сцен ——— */
@media (max-width: 900px) {
  .sg-field { grid-template-columns: 1fr; grid-template-rows: auto auto auto; }
  .sg-att .sg-side-t { text-align: left; }
  .sg-att .sg-crew { align-items: flex-start; }
  .sg-block { width: clamp(28px, 8vw, 44px); height: clamp(20px, 5vw, 30px); }
  .sg-cat { width: clamp(80px, 22vw, 130px); }
  .sg-sky { min-height: 200px; }
  .fg-smith { padding: 8px 6px; }
}
@media (max-width: 640px) {
  .tw, .tg, .sg, .ch, .fg { padding: 6px 8px calc(10px + var(--safe-b)); }
  .tw-sky { min-height: 34vh; }
  .tw-floor { width: 26px; height: 12px; }
  .tw-meta span { font-size: 10px; }
  .tg-team p { font-size: 12px; }
  .tg-sky { height: 170px; }
  .tg-pullers { gap: 0; }
  .tg-puller img { width: 26px; }
  .sg-sky { padding: 8px; }
  .sg-man { font-size: 11px; padding: 2px 6px; }
  .sg-charge { width: 30px; }
  .fg-forge { height: 84px; }
  .fg-anvil-img { width: 72px; }
  .fg-sword { width: 56px; }
  .fg-fire { width: 34px; height: 42px; }
  .ch-waves { width: min(300px, 78vw); }
  .ch-level { font-size: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .tw-tower, .tg-knot, .tw-floor, .ch-wave, .ch-mic, .fg-fire, .fg-sword, .fg-sparks i, .sg-block { animation: none !important; transition: none !important; }
}

/* ——— Живые фоны арен (assets/games/<id>/bg.svg) ———
   Сцена занимает весь экран, а игровые панели лежат поверх как стекло.
   Так арена выглядит как локация, а не как пустой лист с блоками.
   Фон ставим на сам .play: он рисуется под всеми панелями и не скроллится. */
.play[data-layout="dom"][data-game="tower"] { background: #cfe9ff url("/assets/games/tower/bg.webp") center/cover no-repeat; }
.play[data-layout="dom"][data-game="tug"] { background: #bfe6ff url("/assets/games/tug/bg.webp") center/cover no-repeat; }
.play[data-layout="dom"][data-game="siege"] { background: #ffd9a8 url("/assets/games/siege/bg.webp") center/cover no-repeat; }
.play[data-layout="dom"][data-game="choir"] { background: #1a1236 url("/assets/games/choir/bg.webp") center/cover no-repeat; }
.play[data-layout="dom"][data-game="forge"] { background: #2a1b14 url("/assets/games/forge/bg.webp") center/cover no-repeat; }
.play[data-layout="dom"] .play-stage { background: transparent; }

/* Сцены перестают быть «плоскими карточками»: фон просвечивает сквозь панели. */
.tw-sky,
.tg-sky,
.sg-sky {
  background: rgba(255, 255, 255, 0.34);
  backdrop-filter: blur(6px) saturate(1.1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5), 0 18px 40px rgba(11, 16, 32, 0.22);
}
.tw-sky { background: linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.6)); }
.tg-sky { background: rgba(255, 255, 255, 0.18); }
.sg-sky { background: transparent; box-shadow: none; backdrop-filter: none; }

/* Кузница: сцена тёмная, поэтому текст и панели светлее. */
.play[data-game="forge"] .fg { color: #f6efe4; }
.fg-smith { background: rgba(255, 255, 255, 0.12); backdrop-filter: blur(4px); }
.fg-anvil { background: rgba(255, 255, 255, 0.14); backdrop-filter: blur(4px); }

/* Хор: сцена ночная, панели — стекло с подсветкой. */
.play[data-game="choir"] .ch { color: #eef3ff; }
.ch-voice { background: rgba(24, 18, 48, 0.55); color: #eef3ff; backdrop-filter: blur(6px); }
.ch-voice.hot { background: rgba(255, 209, 102, 0.32); }
.ch-bar { background: rgba(12, 8, 28, 0.5); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18); }

/* Небоскрёб: башни на фоне неба, метрики — читаемые плашки. */
.tw-me, .tw-height { backdrop-filter: blur(4px); }
.tw-sky::after { background: linear-gradient(180deg, rgba(159, 212, 255, 0.55), rgba(159, 212, 255, 0)); }

/* Канат: пропасть уже на фоне, панель команд — лёгкое стекло. */
.tg-puller, .tg-team p { text-shadow: 0 2px 8px rgba(8, 12, 30, 0.65); }

/* Осада: стена должна читаться на фоне заката. */
.sg-wall { background: rgba(52, 36, 20, 0.22); }
.sg-man { background: rgba(255, 255, 255, 0.88); }

/* Рисованные фоны (bg.webp) уже содержат небо, пропасть и т. п.:
   стеклянные панели и нарисованные кодом облака их только мутят. */
.tw-sky, .tg-sky { background: transparent; box-shadow: none; backdrop-filter: none; }
.tw-sky::after { display: none; }
.tg-cloud, .tg-pit { display: none; }
.fg-smith, .fg-anvil { background: rgba(30, 16, 8, 0.42); backdrop-filter: none; border-color: rgba(255, 190, 120, 0.28); }
.fg-smith.me { background: rgba(80, 44, 10, 0.5); }

/* Небоскрёб: этажи — цветные блоки с окнами, у каждой башни свой цвет. */
.tw-col { --fc: #8ec5ff; --fd: #3d7fd6; }
.tw-col:nth-child(5n+2) { --fc: #ff9fb4; --fd: #d64d6b; }
.tw-col:nth-child(5n+3) { --fc: #9be7c4; --fd: #2fa978; }
.tw-col:nth-child(5n+4) { --fc: #ffd27a; --fd: #d99a12; }
.tw-col:nth-child(5n+5) { --fc: #c8a8ff; --fd: #7a5cff; }
.tw-floor {
  width: clamp(40px, 4.6vw, 64px);
  height: clamp(18px, 2vw, 26px);
  border: 2px solid var(--fd);
  border-radius: 5px;
  background:
    linear-gradient(90deg, transparent 18%, #fff7c2 18% 34%, transparent 34% 66%, #fff7c2 66% 82%, transparent 82%) center 45% / 100% 44% no-repeat,
    linear-gradient(180deg, var(--fc), color-mix(in srgb, var(--fc) 70%, var(--fd)));
  box-shadow: 0 3px 0 rgba(29, 35, 64, 0.18);
}
.tw-floor.gold { background: linear-gradient(90deg, transparent 18%, #fff 18% 34%, transparent 34% 66%, #fff 66% 82%, transparent 82%) center 45% / 100% 44% no-repeat, linear-gradient(180deg, #ffe680, #ffc53d); }
/* Высокие башни сжимают этажи (tower.js → fit), чтобы вопрос не уезжал за край экрана. */
.tw-sky.tw-fit .tw-floor { height: var(--fh); }
.tw-roof { border-left-width: clamp(24px, 2.8vw, 38px); border-right-width: clamp(24px, 2.8vw, 38px); border-bottom: clamp(22px, 2.4vw, 32px) solid var(--fd); }
.tw-meta { background: rgba(255, 255, 255, 0.85); border-radius: 12px; padding: 3px 6px; }
.tw-meta img { width: clamp(38px, 4.4vw, 56px); }

/* Канат: толще, узел — красная лента, тянущие крупнее. */
.tg-rope { height: 18px; background: repeating-linear-gradient(115deg, #d9b26a 0 10px, #a8823f 10px 16px); box-shadow: 0 5px 8px rgba(0, 0, 0, 0.35); }
.tg-knot { width: 34px; height: 34px; }
.tg-puller img { width: clamp(40px, 5vw, 64px); filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.35)); }
.tg-left .tg-puller { border-bottom: 4px solid #3d8bff; border-radius: 10px; }
.tg-right .tg-puller { border-bottom: 4px solid #ff4d5e; border-radius: 10px; }
.tg-team p { font-size: 17px; }

@media (max-width: 640px) {
  .tw-sky, .tg-sky { box-shadow: 0 10px 24px rgba(11, 16, 32, 0.24); }
}


/* Записи экранов на главной (assets/home/video): кадр 720×440, как у прежних превью. */
.reel-video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 720 / 440;
  object-fit: cover;
  background: #eef3ff;
}
.story .story-reel .reel-video { border-radius: 14px; }

/* ——— Каталог «Игры»: арт-обложка с подсветкой цвета игры, кадр из игры при наведении ——— */
.game-tile {
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22), 0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent), 0 10px 34px -8px var(--accent);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.3s ease;
}
.game-tile:hover, .game-tile:focus-visible {
  transform: translateY(-6px) scale(1.015);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.3), 0 0 0 3px var(--accent), 0 16px 48px -6px var(--accent);
}
.game-media { position: relative; display: block; overflow: hidden; border-radius: 22px 22px 0 0; aspect-ratio: 4 / 3; }
.game-media::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.35) 50%, transparent 65%);
  transform: translateX(-120%);
}
.game-tile:hover .game-media::after { transform: translateX(120%); transition: transform 0.9s ease; }
.game-media .game-art,
.game-media .game-cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.game-media .game-art { transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), filter 0.4s ease; filter: saturate(1.08); }
.game-media .game-cover { opacity: 0; transform: scale(1.04); transition: opacity 0.35s ease 0.25s, transform 0.5s ease 0.25s; }
.game-tile:hover .game-art { transform: scale(1.07); filter: saturate(1.2) brightness(1.05); }
.game-tile:hover .game-media .game-cover,
.game-tile:focus-visible .game-media .game-cover { opacity: 1; transform: scale(1); }
.game-frame-tag {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.3s ease 0.3s;
}
.game-tile:hover .game-frame-tag, .game-tile:focus-visible .game-frame-tag { opacity: 1; }
.lobby-game-card img { box-shadow: 0 4px 12px color-mix(in srgb, var(--accent, #7c3aed) 35%, transparent); }
@media (hover: none) {
  .game-media .game-cover, .game-frame-tag { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .game-tile, .game-tile:hover { transform: none; }
  .game-media .game-art, .game-media .game-cover, .game-frame-tag { transition: opacity 0.2s linear; }
  .game-tile:hover .game-art { transform: none; }
  .game-media .game-cover { transform: none; }
  .game-media::after { display: none; }
}
