/*
 * Повторюшка — дизайн-система.
 * Светлый тёплый фон, белые карточки, сочные акценты, объёмные «нажимаемые» кнопки.
 * Заголовки — Unbounded, текст — Rubik (обе с кириллицей).
 */
:root {
  --bg: #fff4e6;
  --bg-2: #ffe6cc;
  --surface: #ffffff;
  --surface-2: #fff9f2;
  --ink: #1f1a2e;
  --muted: #7a7189;
  --line: #f0e4d6;

  --primary: #ff5a3c;
  --primary-d: #d13c20;
  --violet: #7c5cff;
  --violet-d: #5a3ed6;
  --yellow: #ffc83d;
  --yellow-d: #e0a41a;
  --mint: #22c99a;
  --mint-d: #12977a;
  --pink: #ff6fae;
  --sky: #38b6ff;
  --bad: #ef4444;

  --wave: #ff5a3c;
  --wave-ref: #b9b0c6;
  --melody: #1f1a2e;

  --r-sm: 14px;
  --r: 22px;
  --r-lg: 30px;
  --shadow: 0 12px 32px rgba(31, 26, 46, 0.08), 0 2px 6px rgba(31, 26, 46, 0.05);
  --shadow-lg: 0 24px 60px rgba(31, 26, 46, 0.14);
  --font-display: 'Unbounded', 'Rubik', system-ui, sans-serif;
  --font: 'Rubik', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html {
  -webkit-text-size-adjust: 100%;
  background:
    radial-gradient(60vmax 60vmax at 110% -10%, rgba(255, 111, 174, 0.22), transparent 60%),
    radial-gradient(55vmax 55vmax at -15% 20%, rgba(124, 92, 255, 0.16), transparent 60%),
    radial-gradient(60vmax 60vmax at 50% 120%, rgba(255, 200, 61, 0.28), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 16px;
  color: var(--ink);
  background: transparent;
  padding-bottom: calc(130px + env(safe-area-inset-bottom));
  overflow-x: hidden;
}
body.has-reactions { padding-bottom: calc(200px + env(safe-area-inset-bottom)); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
small { font-size: 0.8em; }
img { display: block; max-width: 100%; }
.muted { color: var(--muted); }
.center { text-align: center; }
h1, h2, h3, .display { font-family: var(--font-display); letter-spacing: -0.01em; }

/* ───── кнопки ───── */
.btn {
  --c: var(--surface);
  --cd: #e6dccf;
  --tc: var(--ink);
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 12px 22px;
  border: 0; border-radius: 18px;
  background: var(--c); color: var(--tc);
  font-weight: 700; font-size: 1rem; text-decoration: none;
  box-shadow: 0 5px 0 var(--cd);
  transform: translateY(0);
  transition: transform 0.12s var(--spring), box-shadow 0.12s, filter 0.2s, opacity 0.2s;
  user-select: none;
}
.btn:hover:not(:disabled) { filter: brightness(1.04); }
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--cd); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { --c: var(--primary); --cd: var(--primary-d); --tc: #fff; }
.btn.violet { --c: var(--violet); --cd: var(--violet-d); --tc: #fff; }
.btn.mint { --c: var(--mint); --cd: var(--mint-d); --tc: #fff; }
.btn.yellow { --c: var(--yellow); --cd: var(--yellow-d); }
.btn.tg { --c: #2aabee; --cd: #1a86bd; --tc: #fff; }
.btn.vk { --c: #0077ff; --cd: #0059c0; --tc: #fff; }
.btn.big { width: 100%; min-height: 64px; font-size: 1.15rem; font-family: var(--font-display); font-weight: 700; border-radius: 22px; }
.btn.small { min-height: 42px; padding: 8px 16px; font-size: 0.92rem; border-radius: 14px; box-shadow: 0 4px 0 var(--cd); }
.btn.ghost { --c: transparent; --cd: transparent; color: var(--muted); box-shadow: none; font-weight: 600; }
.btn.ghost:active { transform: scale(0.97); }
.btn.icon { width: 52px; padding: 0; }
.btn .ico { font-size: 1.2em; line-height: 1; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field > span { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.input, .field input, .field textarea, .field select {
  width: 100%; padding: 15px 18px;
  border: 2px solid var(--line); border-radius: 16px;
  background: var(--surface-2); font-size: 1.05rem; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.input:focus, .field input:focus, .field textarea:focus { border-color: var(--violet); background: #fff; box-shadow: 0 0 0 5px rgba(124, 92, 255, 0.14); }

/* ───── каркас ───── */
.stage { max-width: 560px; margin: 0 auto; padding: 12px 16px 24px; }
.stage.wide { max-width: 760px; }
.card {
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow);
  padding: 20px; margin-bottom: 14px;
  display: flex; flex-direction: column; gap: 16px;
}
.card h2 { margin: 0; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
.card h2 small { color: var(--muted); font-family: var(--font); font-weight: 500; }
.notice {
  background: #fff7d6; border-radius: var(--r); padding: 12px 16px; margin-bottom: 14px;
  font-weight: 600; text-align: center; box-shadow: var(--shadow);
}
.enter > * { animation: rise 0.45s var(--spring) both; }
.enter > *:nth-child(2) { animation-delay: 0.05s; }
.enter > *:nth-child(3) { animation-delay: 0.1s; }
.enter > *:nth-child(4) { animation-delay: 0.15s; }
.enter > *:nth-child(5) { animation-delay: 0.2s; }
.enter > *:nth-child(n+6) { animation-delay: 0.25s; }

/* ───── аватары ───── */
.ava {
  --s: 56px;
  position: relative; flex: 0 0 auto;
  width: var(--s); height: var(--s); border-radius: 50%;
  background: var(--ava-bg, #ffe1d6);
  display: grid; place-items: center; overflow: hidden;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.06);
}
.ava img { width: 100%; height: 100%; object-fit: cover; }
.ava .ava-emoji { font-size: calc(var(--s) * 0.56); line-height: 1; }
.ava.xs { --s: 34px; }
.ava.sm { --s: 44px; }
.ava.lg { --s: 92px; }
.ava.xl { --s: 150px; box-shadow: 0 18px 40px rgba(31, 26, 46, 0.18), inset 0 -6px 0 rgba(0, 0, 0, 0.06); }
.ava.off { filter: grayscale(1); opacity: 0.45; }

/* ───── верхняя панель ───── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  max-width: 760px; margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) 16px 8px;
}
.tb-pill {
  display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0;
  background: rgba(255, 255, 255, 0.86); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-radius: 999px; padding: 6px 6px 6px 14px; box-shadow: var(--shadow);
}
.tb-code { font-family: var(--font-display); font-weight: 700; font-size: 0.85rem; letter-spacing: 2px; color: var(--violet); }
.tb-phase { font-weight: 700; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-round { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.timer { position: relative; width: 44px; height: 44px; flex: 0 0 auto; }
.timer svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer circle { fill: none; stroke-width: 5; }
.timer .track { stroke: #f1eaf9; }
.timer .bar { stroke: var(--violet); stroke-linecap: round; transition: stroke-dashoffset 0.25s linear, stroke 0.3s; }
.timer b { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); font-size: 0.85rem; }
.timer.hurry .bar { stroke: var(--bad); }
.timer.hurry b { color: var(--bad); animation: pulse 0.5s infinite alternate; }
.sound-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.86); box-shadow: var(--shadow); font-size: 1.1rem; flex: 0 0 auto; }

/* полоска игроков */
.strip { display: flex; gap: 6px; overflow-x: auto; padding: 4px 16px 6px; max-width: 760px; margin: 0 auto; scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 3px; width: 62px; position: relative; padding-top: 2px; }
.chip .ava { --s: 46px; transition: transform 0.3s var(--spring); border: 3px solid transparent; }
.chip.me .ava { border-color: var(--violet); }
.chip.done .ava { border-color: var(--mint); }
.chip.active .ava { border-color: var(--yellow); transform: scale(1.1); }
.chip.off { opacity: 0.4; }
.chip-name { font-size: 0.7rem; font-weight: 600; max-width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-score { position: absolute; top: 0; right: 2px; min-width: 22px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--ink); color: #fff; font-size: 0.7rem; font-weight: 700; display: grid; place-items: center; }
.chip-badge { position: absolute; left: 0; top: 0; font-size: 0.9rem; }
.chip.done::after { content: '✓'; position: absolute; bottom: 18px; right: 6px; width: 18px; height: 18px; border-radius: 50%; background: var(--mint); color: #fff; font-size: 0.7rem; font-weight: 800; display: grid; place-items: center; animation: pop 0.35s var(--spring); }

/* ───── главный экран ───── */
.home { display: flex; flex-direction: column; gap: 14px; padding-top: 6px; }
.hero { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: 8px; }
.hero-media {
  width: min(78vw, 300px); aspect-ratio: 1; border-radius: 50%; overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #fff, #ffd9c4); box-shadow: var(--shadow-lg);
  display: grid; place-items: center; animation: floaty 4s ease-in-out infinite;
}
.hero-media img, .hero-media video { width: 100%; height: 100%; object-fit: cover; }
.hero-media .hero-emoji { font-size: 7.5rem; animation: wobble 2.6s ease-in-out infinite; }
.logo {
  margin: 18px 0 4px; font-family: var(--font-display); font-weight: 800;
  font-size: clamp(2.2rem, 10vw, 3.3rem); line-height: 1; letter-spacing: -0.02em;
  background: linear-gradient(100deg, var(--primary) 0%, var(--pink) 45%, var(--violet) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { margin: 6px 0 0; color: var(--muted); font-size: 1.02rem; }
.av-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
.av-pick { border: 0; padding: 0; background: none; border-radius: 50%; transition: transform 0.25s var(--spring); }
.av-pick .ava { --s: 100%; aspect-ratio: 1; width: 100%; height: auto; border: 3px solid transparent; }
.av-pick.on { transform: scale(1.12); }
.av-pick.on .ava { border-color: var(--violet); box-shadow: 0 6px 16px rgba(124, 92, 255, 0.35); }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 0.85rem; }
.or::before, .or::after { content: ''; flex: 1; height: 2px; background: var(--line); border-radius: 2px; }
.join-row { display: flex; gap: 10px; }
.join-row input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: 8px; text-align: center; font-family: var(--font-display); font-weight: 700; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.step { background: var(--surface); border-radius: var(--r); padding: 14px 10px; text-align: center; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; align-items: center; }
.step i { font-style: normal; font-size: 1.8rem; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; }
.step:nth-child(1) i { background: #ffe1d6; }
.step:nth-child(2) i { background: #e7e0ff; }
.step:nth-child(3) i { background: #d6f6ec; }
.step b { font-size: 0.85rem; }
.step span { font-size: 0.75rem; color: var(--muted); line-height: 1.3; }

/* ───── лобби ───── */
.invite { align-items: center; text-align: center; background: linear-gradient(135deg, var(--violet), #a55cff); color: #fff; }
.invite-label { opacity: 0.85; font-size: 0.85rem; }
.invite-code { font-family: var(--font-display); font-weight: 800; font-size: 3.2rem; letter-spacing: 12px; margin-right: -12px; line-height: 1; cursor: pointer; }
.invite-btns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.invite .btn { --c: rgba(255, 255, 255, 0.95); --cd: rgba(0, 0, 0, 0.18); --tc: var(--violet-d); }
.players { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); gap: 12px; }
.pl { display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; animation: pop 0.4s var(--spring) both; }
.pl .ava { --s: 64px; }
.pl-name { font-size: 0.82rem; font-weight: 600; max-width: 82px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-name small { color: var(--violet); }
.pl .crown { position: absolute; top: -10px; left: 50%; transform: translateX(-50%) rotate(-8deg); font-size: 1.3rem; }
.pl .x { position: absolute; top: -4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: #fff; box-shadow: var(--shadow); color: var(--muted); font-size: 0.7rem; }
.pl.off { opacity: 0.4; }
.pl-empty .ava { background: transparent; border: 2px dashed #e2d6c8; box-shadow: none; }
.pl-empty .ava-emoji { font-size: 1.4rem; color: #cdbfb0; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode {
  text-align: left; border: 2px solid var(--line); border-radius: var(--r); background: var(--surface-2);
  padding: 14px; display: flex; flex-direction: column; gap: 4px;
  transition: border-color 0.2s, background 0.2s, transform 0.2s var(--spring);
}
.mode i { font-style: normal; font-size: 1.6rem; }
.mode b { font-size: 0.98rem; }
.mode span { font-size: 0.8rem; color: var(--muted); line-height: 1.3; }
.mode.on { border-color: var(--violet); background: #f3efff; transform: translateY(-2px); }
.mode:disabled { cursor: default; }
.packs { display: flex; gap: 12px; overflow-x: auto; margin: 0 -20px; padding: 4px 20px 10px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.packs::-webkit-scrollbar { display: none; }
.pack {
  flex: 0 0 132px; scroll-snap-align: start; border: 0; padding: 0; background: none; text-align: left;
  display: flex; flex-direction: column; gap: 8px; transition: transform 0.25s var(--spring);
}
.pack-cover {
  position: relative; width: 132px; height: 132px; border-radius: var(--r); overflow: hidden;
  display: grid; place-items: center; font-size: 3rem;
  box-shadow: var(--shadow); border: 3px solid transparent; transition: border-color 0.2s;
}
.pack-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pack-title { font-weight: 700; font-size: 0.88rem; line-height: 1.2; }
.pack-meta { font-size: 0.75rem; color: var(--muted); }
.pack.on { transform: translateY(-4px); }
.pack.on .pack-cover { border-color: var(--violet); box-shadow: 0 10px 24px rgba(124, 92, 255, 0.3); }
.pack.on .pack-cover::after { content: '✓'; position: absolute; right: 8px; top: 8px; width: 26px; height: 26px; border-radius: 50%; background: var(--violet); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 0.85rem; }
.pro { position: absolute; left: 8px; top: 8px; background: var(--ink); color: var(--yellow); padding: 3px 8px; border-radius: 8px; font-size: 0.65rem; font-weight: 800; letter-spacing: 1px; z-index: 1; }
.pack:disabled { cursor: default; }
.settings-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.stepper { display: flex; align-items: center; gap: 4px; background: var(--surface-2); border-radius: 14px; padding: 4px; }
.stepper button { width: 36px; height: 36px; border: 0; border-radius: 10px; background: #fff; font-weight: 800; box-shadow: 0 2px 0 var(--line); }
.stepper b { min-width: 52px; text-align: center; font-family: var(--font-display); font-size: 0.9rem; }
.switch { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; cursor: pointer; }
.switch input { appearance: none; -webkit-appearance: none; width: 48px; height: 28px; border-radius: 14px; background: #e6dccf; position: relative; transition: background 0.2s; flex: 0 0 auto; cursor: pointer; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15); transition: transform 0.25s var(--spring); }
.switch input:checked { background: var(--mint); }
.switch input:checked::after { transform: translateX(20px); }
.lobby-links { display: flex; justify-content: center; gap: 4px; flex-wrap: wrap; }

/* закреплённая кнопка действия внизу */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 60%, rgba(255, 244, 230, 0));
}
.dock-inner { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 6px; }
.dock .hint { text-align: center; font-size: 0.85rem; color: var(--muted); }
.has-reactions .dock { bottom: calc(68px + env(safe-area-inset-bottom)); padding-bottom: 8px; background: none; }

/* ───── раунд ───── */
.play { display: flex; flex-direction: column; align-items: stretch; gap: 16px; }
.play.wait { text-align: center; align-items: center; padding-top: 12px; }
.title { margin: 0; text-align: center; font-size: clamp(1.35rem, 6vw, 1.75rem); font-weight: 800; line-height: 1.15; }
.sub { margin: -8px 0 0; text-align: center; color: var(--muted); }
.prompt {
  position: relative; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow);
  padding: 18px 20px; display: flex; align-items: center; gap: 14px; text-align: left; width: 100%;
}
.prompt-cover { flex: 0 0 auto; width: 58px; height: 58px; border-radius: 16px; overflow: hidden; display: grid; place-items: center; font-size: 1.8rem; }
.prompt-cover img { width: 100%; height: 100%; object-fit: cover; }
.prompt-label { display: block; color: var(--muted); font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.prompt b { font-size: 1.18rem; line-height: 1.25; }
.prompt.secret b { color: var(--muted); }

.listen {
  display: flex; align-items: center; gap: 14px; width: 100%;
  background: var(--surface); border: 0; border-radius: var(--r-lg); padding: 14px 18px 14px 14px;
  box-shadow: var(--shadow); text-align: left; transition: transform 0.2s var(--spring);
}
.listen:active:not(:disabled) { transform: scale(0.98); }
.listen:disabled { opacity: 0.55; }
.listen .play-ico { width: 52px; height: 52px; border-radius: 50%; background: var(--violet); color: #fff; display: grid; place-items: center; font-size: 1.2rem; box-shadow: 0 4px 0 var(--violet-d); flex: 0 0 auto; }
.listen.playing .play-ico { animation: pulse 0.6s infinite alternate; }
.listen b { display: block; font-size: 1.02rem; }
.listen small { color: var(--muted); }
.plays-left { display: flex; gap: 4px; margin-left: auto; }
.plays-left i { width: 10px; height: 10px; border-radius: 50%; background: var(--violet); }
.plays-left i.used { background: #e6dccf; }

/* запись */
.rec { display: flex; flex-direction: column; align-items: center; gap: 14px; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 28px 18px 22px; }
.rec-btn {
  --lvl: 0;
  position: relative; width: 148px; height: 148px; border-radius: 50%; border: 0;
  background: radial-gradient(circle at 35% 30%, #ff8a6e, var(--primary) 60%);
  color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 0.95rem;
  box-shadow: 0 8px 0 var(--primary-d), 0 20px 40px rgba(255, 90, 60, 0.35);
  transition: transform 0.15s var(--spring), box-shadow 0.15s;
}
.rec-btn:active:not(:disabled) { transform: translateY(6px); box-shadow: 0 2px 0 var(--primary-d), 0 10px 20px rgba(255, 90, 60, 0.3); }
.rec-btn:disabled { filter: grayscale(0.7); opacity: 0.45; cursor: default; }
.rec-btn .mic { display: block; font-size: 2.6rem; line-height: 1; margin-bottom: 4px; }
.rec-ring, .rec-ring2 { position: absolute; inset: -12px; border-radius: 50%; border: 4px solid var(--primary); opacity: 0; pointer-events: none; }
.rec-btn.on { background: radial-gradient(circle at 35% 30%, #ff6b6b, var(--bad) 60%); }
.rec-btn.on .rec-ring { opacity: calc(0.25 + var(--lvl)); transform: scale(calc(1 + var(--lvl) * 0.22)); transition: transform 0.06s; }
.rec-btn.on .rec-ring2 { animation: ripple 1.4s infinite; }
.rec-btn:not(:disabled):not(.on) { animation: breathe 2.4s ease-in-out infinite; }
.rec-hint { margin: 0; color: var(--muted); text-align: center; font-size: 0.92rem; min-height: 1.3em; }
.rec-progress { width: 100%; max-width: 260px; height: 8px; border-radius: 4px; background: #f3ece4; overflow: hidden; }
.rec-progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--primary), var(--pink)); border-radius: 4px; }
.rec-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; width: 100%; }
.rec-actions .btn.primary { flex: 1 1 100%; }
.wave { width: 100%; height: auto; background: var(--surface-2); border-radius: 16px; }
.waiting { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.wait-chip { display: flex; align-items: center; gap: 6px; background: var(--surface); box-shadow: var(--shadow); padding: 4px 12px 4px 4px; border-radius: 999px; font-size: 0.88rem; font-weight: 600; transition: background 0.3s; }
.wait-chip .ava { --s: 30px; }
.wait-chip.ok { background: #d6f6ec; }
.wait-art { position: relative; display: grid; place-items: center; }
.wait-art .ava { animation: floaty 2.6s ease-in-out infinite; }
.dots-typing { display: inline-flex; gap: 5px; margin-top: 8px; }
.dots-typing i { width: 9px; height: 9px; border-radius: 50%; background: var(--violet); animation: typing 1.2s infinite; }
.dots-typing i:nth-child(2) { animation-delay: 0.15s; }
.dots-typing i:nth-child(3) { animation-delay: 0.3s; }

.chain { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px; }
.chain .ava { --s: 40px; opacity: 0.4; transition: transform 0.3s var(--spring), opacity 0.3s; }
.chain .past .ava { opacity: 1; }
.chain .now .ava { opacity: 1; transform: scale(1.3); box-shadow: 0 0 0 4px var(--yellow); }
.chain .arrow { color: var(--muted); font-weight: 800; }

/* ───── шоу ───── */
.progress-dots { display: flex; gap: 6px; justify-content: center; }
.progress-dots i { width: 8px; height: 8px; border-radius: 4px; background: #e6dccf; transition: width 0.3s var(--spring), background 0.3s; }
.progress-dots i.past { background: var(--violet); opacity: 0.5; }
.progress-dots i.now { width: 26px; background: var(--violet); }
.spot {
  position: relative; border-radius: var(--r-lg); padding: 18px 16px 18px; overflow: hidden;
  background: radial-gradient(120% 80% at 50% 0%, #3b2d72 0%, #1f1a2e 70%); color: #fff;
  display: flex; flex-direction: column; align-items: center; gap: 14px; box-shadow: var(--shadow-lg);
}
.spot::before { content: ''; position: absolute; top: -40%; left: 50%; width: 120%; height: 120%; transform: translateX(-50%); background: radial-gradient(closest-side, rgba(255, 220, 140, 0.35), transparent); pointer-events: none; }
.spot .who { position: relative; display: grid; place-items: center; }
.spot .ava.xl { --s: 116px; }
.show .prompt { padding: 10px 14px; }
.show .prompt-cover { width: 40px; height: 40px; font-size: 1.3rem; border-radius: 12px; }
.show .prompt b { font-size: 1rem; }
.show .prompt-label { display: none; }
.eq { position: absolute; inset: -22px; pointer-events: none; }
.eq i { position: absolute; left: 50%; top: 50%; width: 6px; height: 18px; margin: -9px -3px; border-radius: 3px; background: var(--yellow); transform-origin: 50% 88px; opacity: 0; }
.singing .eq i { opacity: 0.9; animation: eq 0.5s ease-in-out infinite alternate; }
.spot h2 { margin: 0; font-size: 1.25rem; text-align: center; position: relative; }
.spot .kind { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--yellow); font-weight: 700; position: relative; }
.spot .wave { background: rgba(255, 255, 255, 0.07); position: relative; }
.score-box { position: relative; min-height: 150px; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.listening { display: flex; align-items: center; gap: 8px; color: rgba(255, 255, 255, 0.75); font-weight: 600; margin-top: 16px; }
.ring { position: relative; width: 116px; height: 116px; animation: pop 0.5s var(--spring); }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 12; }
.ring .track { stroke: rgba(255, 255, 255, 0.12); }
.ring .bar { stroke: url(#scoreGrad); stroke-linecap: round; transition: stroke-dashoffset 1s cubic-bezier(0.2, 0.8, 0.2, 1); }
.ring b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: 2.3rem; font-weight: 800; }
.ring b small { font-size: 0.45em; margin: 0.5em 0 0 2px; }
.sticker {
  display: flex; align-items: center; gap: 10px;
  background: #fff; color: var(--ink); border-radius: 18px; padding: 8px 16px 8px 8px;
  font-weight: 800; font-family: var(--font-display); font-size: 0.95rem;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.25); transform: rotate(-3deg);
  animation: stamp 0.55s var(--spring) both 0.5s;
}
.sticker img, .sticker .st-emoji { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; display: grid; place-items: center; font-size: 2rem; }
.parts { width: 100%; max-width: 320px; display: flex; flex-direction: column; gap: 6px; animation: rise 0.4s ease both 0.8s; }
.part { display: grid; grid-template-columns: 84px 1fr 30px; align-items: center; gap: 8px; font-size: 0.8rem; color: rgba(255, 255, 255, 0.8); }
.part i { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.12); position: relative; overflow: hidden; }
.part i::after { content: ''; position: absolute; inset: 0; width: var(--w); background: linear-gradient(90deg, var(--yellow), var(--primary)); border-radius: 4px; animation: grow 1s cubic-bezier(0.2, 0.8, 0.2, 1) both 0.9s; }
.part b { text-align: right; color: #fff; }

/* ───── голосование ───── */
.vgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.vcard {
  position: relative; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow);
  padding: 14px 12px 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  border: 3px solid transparent; transition: transform 0.25s var(--spring), border-color 0.2s;
}
.vcard .ava { --s: 72px; }
.vcard-name { font-weight: 700; font-size: 0.88rem; line-height: 1.2; }
.vcard-score { font-family: var(--font-display); font-size: 0.8rem; color: var(--primary); }
.vcard-score.orig { color: var(--muted); font-family: var(--font); }
.vcard .wave { height: 36px; }
.vcard-btns { display: flex; gap: 6px; width: 100%; }
.vcard-btns .btn { flex: 1; }
.vcard-btns .btn.icon { flex: 0 0 42px; width: 42px; }
.vcard.on { border-color: var(--pink); transform: translateY(-3px); }
.vcard.on::after { content: '❤️'; position: absolute; top: -12px; right: -8px; font-size: 1.8rem; animation: pop 0.4s var(--spring); }
.vote-count { text-align: center; color: var(--muted); font-size: 0.9rem; }

/* ───── итоги ───── */
.results { list-style: none; margin: 0; padding: 6px; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.results li { display: grid; grid-template-columns: 44px 1fr auto 56px 48px; align-items: center; gap: 10px; padding: 10px 8px; border-radius: 16px; animation: slidein 0.45s var(--spring) both; }
.results li:nth-child(odd) { background: var(--surface-2); }
.results li.head { animation: none; background: none; font-size: 0.72rem; color: var(--muted); padding-bottom: 2px; }
.results li .ava { --s: 40px; }
.r-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-votes { font-size: 0.85rem; color: var(--pink); font-weight: 700; }
.r-pts { font-family: var(--font-display); font-weight: 700; color: var(--mint-d); text-align: right; }
.r-total { font-family: var(--font-display); font-weight: 700; text-align: right; }
.results li.head span:nth-child(4), .results li.head span:nth-child(5) { text-align: right; }

/* ───── финал ───── */
.final-hero { position: relative; border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-lg); background: linear-gradient(160deg, #3b2d72, #1f1a2e); color: #fff; padding: 20px 14px 0; }
.final-hero video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.35; }
.final-hero h2 { position: relative; margin: 0 0 8px; text-align: center; font-size: 1.6rem; }
.podium { position: relative; display: flex; align-items: flex-end; justify-content: center; gap: 8px; }
.pod { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 31%; max-width: 160px; }
.pod b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.9rem; }
.pod .pts { font-family: var(--font-display); font-size: 0.85rem; color: var(--yellow); }
.pod .ava { --s: 64px; animation: hop 1.4s ease-in-out infinite; }
.pod1 .ava { --s: 92px; box-shadow: 0 0 0 4px var(--yellow), 0 0 40px rgba(255, 200, 61, 0.6); }
.pod2 .ava { animation-delay: 0.2s; }
.pod3 .ava { animation-delay: 0.4s; }
.pod .step-block { width: 100%; display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; font-size: 1.6rem; color: var(--ink); border-radius: 16px 16px 0 0; animation: growup 0.7s var(--spring) both; }
.pod1 .step-block { height: 120px; background: linear-gradient(var(--yellow), #ffb300); animation-delay: 0.3s; }
.pod2 .step-block { height: 86px; background: linear-gradient(#eef0f6, #c9cedb); animation-delay: 0.15s; }
.pod3 .step-block { height: 62px; background: linear-gradient(#ffcf9e, #e0995a); }
.titles { display: grid; gap: 10px; }
.title-card { display: flex; align-items: center; gap: 12px; background: var(--surface); border-radius: var(--r); padding: 12px 14px; box-shadow: var(--shadow); animation: slidein 0.5s var(--spring) both; }
.title-card:nth-child(2) { animation-delay: 0.1s; }
.title-card:nth-child(3) { animation-delay: 0.2s; }
.title-card:nth-child(4) { animation-delay: 0.3s; }
.t-emoji { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 1.6rem; background: #fff3d1; flex: 0 0 auto; }
.title-card div { display: flex; flex-direction: column; min-width: 0; }
.title-card b { font-size: 0.95rem; }
.title-card div > span { color: var(--muted); font-size: 0.85rem; display: flex; align-items: center; gap: 6px; }
.title-card .ava { --s: 22px; }
.rest { margin: 0; padding: 0 0 0 20px; color: var(--muted); }

/* ───── реакции, тосты, оверлеи ───── */
.reactions {
  position: fixed; left: 50%; bottom: calc(10px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 26;
  display: flex; gap: 2px; padding: 6px; border-radius: 999px;
  background: rgba(31, 26, 46, 0.92); backdrop-filter: blur(10px); box-shadow: var(--shadow-lg);
}
.reactions button { width: 50px; height: 50px; border: 0; border-radius: 50%; background: none; font-size: 1.6rem; transition: transform 0.2s var(--spring), background 0.2s; }
.reactions small { display: none; }
.reactions button:active { transform: scale(1.35); background: rgba(255, 255, 255, 0.12); }
.floaters { position: fixed; inset: 0; pointer-events: none; z-index: 30; overflow: hidden; }
.floater { position: absolute; bottom: 90px; font-size: 2.6rem; animation: float 2.6s ease-out forwards; display: flex; flex-direction: column; align-items: center; }
.floater .ava { --s: 26px; margin-top: -6px; }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 40; }
.toast {
  position: fixed; left: 50%; top: calc(16px + env(safe-area-inset-top)); transform: translate(-50%, -30px); z-index: 50;
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 16px; max-width: calc(100% - 32px);
  opacity: 0; pointer-events: none; transition: 0.3s var(--spring); text-align: center; font-weight: 600; box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--bad); }
.offline { position: fixed; top: 0; left: 0; right: 0; z-index: 60; background: var(--bad); color: #fff; text-align: center; padding: 8px; font-weight: 600; }
.unmute { position: fixed; top: 90px; left: 50%; transform: translateX(-50%); z-index: 45; }
.sheet-bg { position: fixed; inset: 0; z-index: 44; background: rgba(31, 26, 46, 0.35); animation: fade 0.2s; }
.mictest {
  position: fixed; left: 16px; right: 16px; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 45; max-width: 420px; margin: 0 auto;
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  padding: 22px; display: flex; flex-direction: column; gap: 14px; align-items: center; text-align: center; animation: rise 0.35s var(--spring);
}
.mictest p { margin: 0; font-weight: 600; }
.meter { width: 100%; height: 14px; border-radius: 7px; background: var(--surface-2); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--mint), var(--yellow), var(--primary)); transition: width 0.05s; border-radius: 7px; }

/* видео внутри аватаров и обложек ведут себя как картинки */
.ava video, .pack-cover video, .prompt-cover video, .inter-media video, .hero-media video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.pack-cover video { position: absolute; inset: 0; }

/* «кукла»: рот под звук и позы */
.puppet { --lvl: 0; transform: translateY(calc(var(--lvl) * -8px)) scale(calc(1 + var(--lvl) * 0.07), calc(1 - var(--lvl) * 0.04)); transition: transform 0.07s linear; }
.puppet .mf { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; }
.puppet[data-m="0"] .mf0, .puppet[data-m="1"] .mf1, .puppet[data-m="2"] .mf2 { opacity: 1; }
.puppet .pose { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.15s; }
.puppet.posed .pose { opacity: 1; }
.puppet.pose-win { animation: victory 0.9s var(--spring) 2; }
.puppet.pose-shrug { animation: shrug 1.1s ease-in-out 1; }
.puppet.pose-fail { animation: droop 1.2s ease-in-out forwards; }
@keyframes victory { 0% { transform: none; } 30% { transform: translateY(-26px) rotate(-8deg) scale(1.08); } 55% { transform: translateY(0) rotate(6deg) scale(0.96, 1.04); } 75% { transform: translateY(-10px) rotate(-3deg); } 100% { transform: none; } }
@keyframes shrug { 0%, 100% { transform: none; } 25% { transform: rotate(-9deg) translateY(-4px); } 50% { transform: rotate(8deg); } 75% { transform: rotate(-4deg); } }
@keyframes droop { 0% { transform: none; } 30% { transform: rotate(10deg) translateY(4px); } 60% { transform: rotate(-6deg) translateY(10px) scale(0.95, 1.02); } 100% { transform: rotate(4deg) translateY(10px) scale(0.94); filter: saturate(0.6); } }

/* заставка между раундами */
.inter {
  position: fixed; inset: 0; z-index: 48; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 40%, rgba(124, 92, 255, 0.92), rgba(31, 26, 46, 0.96));
  animation: fade 0.25s ease both; cursor: pointer;
}
.inter.out { animation: fadeout 0.35s ease forwards; }
.inter-card { display: flex; flex-direction: column; align-items: center; gap: 12px; color: #fff; text-align: center; padding: 24px; }
.inter-media {
  width: min(62vw, 260px); aspect-ratio: 1; border-radius: 50%; overflow: hidden; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 35%, #fff, #ffd9c4); font-size: 6rem;
  box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.15), 0 30px 80px rgba(0, 0, 0, 0.45);
  animation: zoomin 0.6s var(--spring) both;
}
.inter-media img { width: 100%; height: 100%; object-fit: cover; }
.inter h2 { margin: 6px 0 0; font-size: clamp(2rem, 10vw, 3rem); font-weight: 800; animation: zoomin 0.55s var(--spring) both 0.12s; text-shadow: 0 6px 0 rgba(0, 0, 0, 0.25); }
.inter p { margin: 0; font-size: 1.15rem; font-weight: 600; opacity: 0.9; animation: rise 0.45s var(--spring) both 0.25s; }

/* медленно плывущие пятна на фоне */
body::before, body::after {
  content: ''; position: fixed; z-index: -1; width: 60vmax; height: 60vmax; border-radius: 50%;
  filter: blur(60px); opacity: 0.35; pointer-events: none;
}
body::before { background: #ff9bc6; top: -25vmax; right: -20vmax; animation: drift 22s ease-in-out infinite alternate; }
body::after { background: #b6a4ff; bottom: -30vmax; left: -25vmax; animation: drift 28s ease-in-out infinite alternate-reverse; }

/* ───── анимации ───── */
@keyframes fadeout { to { opacity: 0; visibility: hidden; } }
@keyframes zoomin { 0% { transform: scale(0.2) rotate(-12deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes drift { from { transform: translate(0, 0) scale(1); } to { transform: translate(6vmax, 8vmax) scale(1.15); } }
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { 0% { transform: scale(0.3); opacity: 0; } 70% { transform: scale(1.1); opacity: 1; } 100% { transform: scale(1); } }
@keyframes stamp { 0% { transform: scale(2.2) rotate(-14deg); opacity: 0; } 60% { transform: scale(0.92) rotate(-2deg); opacity: 1; } 100% { transform: scale(1) rotate(-3deg); } }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.08); } }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@keyframes ripple { from { transform: scale(1); opacity: 0.6; } to { transform: scale(1.6); opacity: 0; } }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes wobble { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
@keyframes hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-12px); } 60% { transform: translateY(0); } }
@keyframes eq { from { height: 10px; margin-top: -5px; } to { height: 30px; margin-top: -15px; } }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-6px); opacity: 1; } }
@keyframes grow { from { width: 0; } }
@keyframes growup { from { transform: scaleY(0); transform-origin: bottom; } to { transform: scaleY(1); transform-origin: bottom; } }
@keyframes slidein { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: none; } }
@keyframes float { 0% { transform: translateY(0) scale(0.6); opacity: 0; } 15% { transform: translateY(-20px) scale(1.15); opacity: 1; } 100% { transform: translateY(-60vh) rotate(18deg); opacity: 0; } }

@media (max-width: 420px) {
  .av-grid { gap: 6px; }
  .invite-code { font-size: 2.6rem; letter-spacing: 9px; margin-right: -9px; }
  .seg { grid-template-columns: 1fr; }
  .results li { grid-template-columns: 38px 1fr auto 44px 40px; gap: 6px; }
  .results li .ava { --s: 34px; }
  .tb-round { display: none; }
}
@media (min-width: 700px) {
  .vgrid { grid-template-columns: repeat(3, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
