/* Дубль-Пати — мультяшный «кинотеатральный» стиль: толстые контуры, сплошные тени, пилюли-кнопки. */

:root {
  --bg1: #cfe0ff;
  --bg2: #b4c8f4;
  --paper: #f7f9ff;
  --doodle: rgba(31, 29, 43, 0.06);
  --ink: #1f1d2b;
  --ink-soft: #5d6380;
  --on-accent: #1f1d2b;
  --line: #1f1d2b;
  --card: #ffffff;
  --card-tint: #edf1ff;
  --row: #f3f6ff;
  --track: #dfe5f5;
  --muted: #b9c1da;
  --self: #e3e6ef;
  --yellow: #ffc233;
  --coral: #ff6b5b;
  --blue: #3d8bfd;
  --green: #5cc337;
  --green-dark: #3f8f22;
  --pink: #ff6fb1;
  --purple: #8f7ae6;
  --teal: #1fb5ad;
  --red-text: #d23a2e;
  --video-bg: #11132a;
  --font-h: 'Rubik', 'Arial Black', 'Segoe UI', sans-serif;
  --font-b: 'Nunito', 'Segoe UI', system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

[data-theme='dark'] {
  --bg1: #1d2040;
  --bg2: #12142b;
  --paper: #15172c;
  --doodle: rgba(255, 255, 255, 0.05);
  --ink: #f1f3ff;
  --ink-soft: #a5abcc;
  --line: #07080f;
  --card: #262a47;
  --card-tint: #30355b;
  --row: #30355b;
  --track: #3a3f66;
  --muted: #545b86;
  --self: #3a3f63;
  --red-text: #ff8a7d;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font-b);
  font-weight: 700;
  color: var(--ink);
  background: linear-gradient(180deg, var(--bg1), var(--bg2));
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  user-select: none;
  -webkit-user-select: none;
}
input, textarea { user-select: text; -webkit-user-select: text; }

/* Фон: каракули-иконки, медленно плывут по диагонали. */
#bg {
  position: fixed; inset: -200px; z-index: 0; pointer-events: none;
  background-image: var(--doodle-img);
  background-size: 168px 168px;
  animation: drift 40s linear infinite;
  opacity: 1;
}
@keyframes drift { from { transform: translate(0, 0); } to { transform: translate(168px, 168px); } }

#scroll {
  position: fixed; inset: 0; z-index: 1;
  overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
  padding: calc(10px + var(--safe-top)) 12px calc(16px + var(--safe-bottom));
}
#app { max-width: 1100px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; }

.screen { display: flex; flex-direction: column; gap: 14px; flex: 1; animation: pop-in 0.28s ease-out; }
@keyframes pop-in { from { opacity: 0; transform: translateY(10px) scale(0.99); } to { opacity: 1; transform: none; } }

h1, h2, h3, .h { font-family: var(--font-h); font-weight: 800; margin: 0; letter-spacing: 0.01em; }
.title { font-size: clamp(26px, 5.4vw, 46px); text-align: center; text-transform: uppercase; text-shadow: 0 3px 0 rgba(0, 0, 0, 0.08); }
.subtitle { font-size: clamp(18px, 3.4vw, 26px); text-transform: uppercase; }
.soft { color: var(--ink-soft); }
.small { font-size: 13px; }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.center { justify-content: center; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; }
.spacer { flex: 1; }
.hidden { display: none !important; }

/* ------------------------------------------------------------- кнопки */

.btn {
  --c: var(--card);
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 8px 24px 10px;
  font-family: var(--font-h); font-weight: 800; font-size: 18px; text-transform: uppercase; letter-spacing: 0.02em;
  color: var(--on-accent);
  background: var(--c);
  border: 3px solid var(--line); border-radius: 999px;
  box-shadow: 0 5px 0 0 var(--line);
  cursor: pointer; outline: none;
  transition: transform 0.08s, box-shadow 0.08s, filter 0.1s;
  white-space: nowrap;
}
.btn::before { /* блик */
  content: ''; position: absolute; left: 14px; top: 6px; width: 14px; height: 7px;
  border-top: 4px solid rgba(255, 255, 255, 0.75); border-radius: 50%; transform: rotate(-24deg); pointer-events: none;
}
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 6px 0 0 var(--line); }
.btn:active, .btn.pressed { transform: translateY(4px); box-shadow: 0 1px 0 0 var(--line); }
.btn:disabled, .btn.disabled {
  filter: saturate(0.25) opacity(0.55); box-shadow: none; transform: none; cursor: default;
}
.btn.white { --c: var(--card); color: var(--ink); }
.btn.ghost { --c: var(--card-tint); color: var(--ink); }
.btn.ghost::before, .btn.white::before { display: none; }
.btn.coral { --c: var(--coral); }
.btn.yellow { --c: var(--yellow); }
.btn.green { --c: var(--green); }
.btn.blue { --c: var(--blue); }
.btn.pink { --c: var(--pink); }
.btn.purple { --c: var(--purple); }
.btn.vk { --c: #2787f5; color: #fff; }
.btn.big { min-height: 72px; font-size: clamp(24px, 4.6vw, 36px); padding: 10px 40px 14px; border-width: 4px; box-shadow: 0 7px 0 0 var(--line); }
.btn.big:active { box-shadow: 0 2px 0 0 var(--line); transform: translateY(5px); }
.btn.sm { min-height: 38px; font-size: 14px; padding: 4px 14px 6px; box-shadow: 0 3px 0 0 var(--line); border-width: 2.5px; }
.btn.sm::before { display: none; }
.btn.sq { padding: 0; width: 48px; }
.btn.sm.sq { width: 38px; }
.btn.block { width: 100%; }
.btn .ico { font-size: 1.15em; line-height: 1; }
.tilt-l { transform: rotate(-1.5deg); }
.tilt-r { transform: rotate(1.5deg); }

/* ------------------------------------------------------------- карточки */

.card {
  background: var(--card);
  border: 3px solid var(--line); border-radius: 20px;
  box-shadow: 0 6px 0 0 var(--line);
  padding: 14px 16px;
}
.card.tint { background: var(--card-tint); }
.card h3 { font-size: 20px; text-transform: uppercase; margin-bottom: 10px; }
.panel-title { font-family: var(--font-h); font-weight: 800; text-transform: uppercase; font-size: 18px; margin: 0 0 8px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border: 2.5px solid var(--line); border-radius: 999px; background: var(--card);
  font-weight: 800; font-size: 14px; cursor: pointer; color: var(--ink);
  box-shadow: 0 3px 0 0 var(--line);
}
.chip.on { background: var(--yellow); color: var(--on-accent); }
.chip:active { transform: translateY(2px); box-shadow: 0 1px 0 0 var(--line); }
.chip:disabled { opacity: 0.55; cursor: default; }

.badge { display: inline-block; padding: 1px 8px; border: 2px solid var(--line); border-radius: 999px; font-size: 11px; font-weight: 900; background: var(--card-tint); color: var(--ink); text-transform: uppercase; }
.badge.green { background: var(--green); color: var(--on-accent); }
.badge.yellow { background: var(--yellow); color: var(--on-accent); }
.badge.coral { background: var(--coral); color: var(--on-accent); }

.input {
  width: 100%; min-height: 50px; padding: 8px 16px;
  font: 800 18px var(--font-b); color: var(--ink);
  background: var(--card); border: 3px solid var(--line); border-radius: 16px; outline: none;
}
.input:focus { border-color: var(--blue); }
.input.code { text-transform: uppercase; letter-spacing: 0.12em; text-align: center; font-family: var(--font-h); font-size: 22px; }

.avatar {
  --c: var(--yellow);
  width: 40px; height: 40px; flex: none; border-radius: 50%;
  border: 3px solid var(--line); background: var(--c) center/cover no-repeat;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-h); font-weight: 800; color: #fff; font-size: 18px; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}
.avatar.lg { width: 76px; height: 76px; font-size: 34px; }
.avatar.md { width: 56px; height: 56px; font-size: 24px; }

/* ------------------------------------------------------------- шапка, логотип */

.topbar { display: flex; align-items: center; gap: 10px; min-height: 48px; }
.topbar .title { flex: 1; font-size: clamp(22px, 4.4vw, 36px); }
.profile-chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 14px 4px 4px; border: 3px solid var(--line); border-radius: 999px; background: var(--card); box-shadow: 0 4px 0 0 var(--line); cursor: pointer; transform: rotate(1.5deg); }
.profile-chip .name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.logo { display: inline-flex; flex-direction: column; align-items: center; line-height: 0.86; transform: rotate(-3deg); user-select: none; }
.logo .l1, .logo .l2 {
  font-family: var(--font-h); font-weight: 900; text-transform: uppercase; letter-spacing: 0.02em;
  -webkit-text-stroke: 3px var(--line); paint-order: stroke fill;
  text-shadow: 0 6px 0 var(--line);
}
.logo .l1 { font-size: clamp(54px, 13vw, 104px); color: var(--yellow); }
.logo .l2 { font-size: clamp(40px, 10vw, 78px); color: var(--coral); transform: rotate(4deg) translateX(18%); }
.logo .clap { font-size: clamp(30px, 7vw, 54px); position: absolute; margin-left: -60%; margin-top: -8%; transform: rotate(-16deg); }
.logo.sm .l1 { font-size: 34px; -webkit-text-stroke-width: 2px; text-shadow: 0 3px 0 var(--line); }
.logo.sm .l2 { font-size: 26px; -webkit-text-stroke-width: 2px; text-shadow: 0 3px 0 var(--line); }

/* ------------------------------------------------------------- главное меню */

.home { align-items: center; justify-content: center; gap: 22px; padding: 10px 0 20px; }
.home-hero { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 8px; }
.home-mascots { display: flex; gap: 6px; font-size: 44px; animation: bob 2.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-5px); } }
.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; width: min(560px, 100%); }
.home-grid .btn { min-height: 64px; font-size: 18px; }
.home-grid .btn:last-child:nth-child(odd) { grid-column: 1 / -1; }
.home-grid .btn:nth-child(4n + 1), .home-grid .btn:nth-child(4n + 4) { transform: rotate(-1.2deg); }
.home-grid .btn:nth-child(4n + 2), .home-grid .btn:nth-child(4n + 3) { transform: rotate(1.2deg); }
.home-panel { width: min(560px, 100%); display: flex; flex-direction: column; gap: 14px; align-items: stretch; animation: slide-in 0.3s ease-out; }
@keyframes slide-in { from { opacity: 0; transform: translateX(60px); } to { opacity: 1; transform: none; } }
.pop { animation: pop 0.38s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
.err { color: var(--red-text); font-weight: 800; text-align: center; min-height: 1.2em; }

/* ------------------------------------------------------------- лобби */

.lobby { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 16px; align-items: start; }
@media (max-width: 760px) { .lobby { grid-template-columns: 1fr; } }
.players { display: flex; flex-direction: column; gap: 8px; }
.player-row { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 10px; background: var(--row); border: 2.5px solid var(--line); border-radius: 14px; }
.player-row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 900; }
.player-row.empty { opacity: 0.5; border-style: dashed; justify-content: center; font-family: var(--font-h); text-transform: uppercase; color: var(--ink-soft); }
.player-row.off { opacity: 0.55; }
.crown { font-size: 18px; }
.code-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.code-box .code { font-family: var(--font-h); font-weight: 900; font-size: 30px; letter-spacing: 0.1em; padding: 2px 14px; background: var(--card); border: 3px dashed var(--line); border-radius: 12px; }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mode-card { position: relative; padding: 12px 8px 10px; text-align: center; background: var(--card); border: 3px solid var(--line); border-radius: 18px; box-shadow: 0 5px 0 0 var(--line); cursor: pointer; transition: transform 0.12s; }
.mode-card:hover { transform: scale(1.03); }
.mode-card.on { background: var(--yellow); color: var(--on-accent); }
.mode-card .ico { font-size: 38px; line-height: 1.1; }
.mode-card .name { font-family: var(--font-h); font-weight: 800; text-transform: uppercase; font-size: 15px; margin-top: 4px; }
.mode-card .desc { font-size: 12px; color: inherit; opacity: 0.8; margin-top: 2px; }
.mode-card.disabled { opacity: 0.6; cursor: default; }
.pack-pick { display: flex; gap: 12px; align-items: center; padding: 8px; background: var(--row); border: 2.5px solid var(--line); border-radius: 14px; cursor: pointer; }
.pack-pick img { width: 112px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; border: 2px solid var(--line); background: var(--video-bg); }
.pack-pick .t { font-family: var(--font-h); font-weight: 800; font-size: 18px; }
.setting { display: flex; flex-direction: column; gap: 6px; }
.setting .lbl { font-family: var(--font-h); font-weight: 800; text-transform: uppercase; font-size: 13px; color: var(--ink-soft); }
.hint { text-align: center; color: var(--ink-soft); font-weight: 800; }
.hint.warn { color: var(--red-text); }

/* ------------------------------------------------------------- каталог */

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.pack-card { overflow: hidden; padding: 0; cursor: pointer; transition: transform 0.12s; }
.pack-card:hover { transform: translateY(-2px) rotate(-0.4deg); }
.pack-card .poster { position: relative; aspect-ratio: 16 / 9; background: var(--video-bg) center/cover no-repeat; border-bottom: 3px solid var(--line); }
.pack-card .dur { position: absolute; right: 8px; bottom: 8px; padding: 1px 8px; border-radius: 8px; background: rgba(0, 0, 0, 0.7); color: #fff; font-size: 12px; }
.pack-card .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
.pack-card .t { font-family: var(--font-h); font-weight: 800; font-size: 17px; }
.pack-card .meta { display: flex; gap: 10px; color: var(--ink-soft); font-size: 13px; flex-wrap: wrap; }
.pack-card.sel { outline: 4px solid var(--yellow); }
.lines-list { max-height: 240px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.lines-list .l { display: flex; gap: 8px; font-size: 14px; padding: 4px 8px; background: var(--row); border-radius: 8px; }
.lines-list .l b { color: var(--green-dark); min-width: 70px; }

/* ------------------------------------------------------------- видео и запись */

.video-card { position: relative; background: var(--video-bg); border: 3px solid var(--line); border-radius: 18px; box-shadow: 0 6px 0 0 var(--line); overflow: hidden; }
.video-card video { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }
.video-wrap { aspect-ratio: var(--ar, 16 / 9); max-height: 46vh; margin: 0 auto; width: min(100%, calc(46vh * var(--arn, 1.7778))); }
.video-over { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 8px; color: #fff; text-align: center; padding: 16px; font-family: var(--font-h); font-weight: 800; font-size: 22px; background: rgba(10, 10, 30, 0.55); }
.rec-dot { position: absolute; top: 10px; left: 12px; padding: 2px 10px; border-radius: 999px; background: var(--coral); color: #fff; font-family: var(--font-h); font-size: 14px; border: 2px solid var(--line); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.45; } }
.rec-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rec-head .t { font-family: var(--font-h); font-weight: 800; font-size: 20px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timer { font-family: var(--font-h); font-weight: 900; font-size: 22px; padding: 2px 12px; border: 3px solid var(--line); border-radius: 12px; background: var(--card); }
.timer.low { background: var(--coral); color: #fff; animation: blink 1s steps(2) infinite; }
.dots { display: flex; gap: 5px; flex-wrap: wrap; justify-content: center; }
.dots i { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--line); background: var(--muted); opacity: 0.6; cursor: pointer; }
.dots i.done { background: var(--green); opacity: 1; }
.dots i.cur { outline: 3px solid var(--yellow); outline-offset: 1px; opacity: 1; }
.dots i.other { opacity: 0.25; cursor: default; }
.char-name { font-family: var(--font-h); font-weight: 800; text-transform: uppercase; color: var(--green-dark); font-size: 15px; text-align: center; }
[data-theme='dark'] .char-name { color: var(--green); }
.caption { font-family: var(--font-h); font-weight: 700; font-size: clamp(18px, 3.6vw, 26px); text-align: center; line-height: 1.2; }
.wave { width: 100%; height: 92px; display: block; background: var(--card); border: 3px solid var(--line); border-radius: 14px; }
.status { text-align: center; min-height: 24px; font-weight: 900; }
.status.rec { color: var(--coral); }
.ctrl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ctrl .btn { min-width: 0; }
.ctrl .btn span:last-child { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 520px) { .ctrl { gap: 6px; } .ctrl .btn { font-size: 13px; gap: 4px; padding-left: 6px; padding-right: 6px; } .ctrl .btn::before { display: none; } .wave { height: 70px; } }
.fx-row { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.theme-banner { align-self: center; max-width: 100%; padding: 6px 16px 8px; background: var(--pink); color: var(--on-accent); border: 3px solid var(--line); border-radius: 14px; box-shadow: 0 4px 0 0 var(--line); transform: rotate(-1.2deg); text-align: center; font-family: var(--font-h); font-weight: 800; }
.theme-banner small { display: block; font-family: var(--font-b); font-size: 12px; opacity: 0.8; }

.overlay { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(20, 22, 40, 0.6); animation: fade 0.2s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(600px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; animation: pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 14px; }

.wait-cards { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.wait-card { width: 138px; padding: 10px 8px; text-align: center; background: var(--card); border: 3px solid var(--line); border-radius: 16px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.wait-card .n { font-weight: 900; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wait-card .s { font-size: 13px; }
.wait-card .s.ok { color: var(--green-dark); }
[data-theme='dark'] .wait-card .s.ok { color: var(--green); }

.meter { position: relative; height: 22px; border: 3px solid var(--line); border-radius: 999px; background: var(--track); overflow: hidden; }
.meter .zone { position: absolute; top: 0; bottom: 0; left: 38%; width: 34%; background: rgba(92, 195, 55, 0.22); }
.meter .fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--yellow); transition: width 0.05s; }
.meter .fill.good { background: var(--green); }
.meter .fill.loud { background: var(--coral); }

/* ------------------------------------------------------------- просмотр, голосование, пьедестал */

.stage-intro { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; flex: 1; text-align: center; }
.popcorn { font-size: 80px; animation: bob 1.4s ease-in-out infinite; }
.vote-grid { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.vote-card { width: 200px; min-height: 200px; padding: 14px 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; background: var(--card); border: 3px solid var(--line); border-radius: 20px; box-shadow: 0 6px 0 0 var(--line); cursor: pointer; transition: transform 0.12s; }
.vote-card:hover:not(.dis) { transform: scale(1.05); border-color: var(--green); }
.vote-card.dis { cursor: default; }
.vote-card.self { background: var(--self); }
.vote-card.mine { background: var(--green); color: var(--on-accent); }
.vote-card .n { font-family: var(--font-h); font-weight: 800; font-size: 18px; }
.vote-card .th { font-size: 13px; color: var(--ink-soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.podium { display: flex; align-items: flex-end; justify-content: center; gap: 10px; margin-top: 10px; }
.pod { width: min(210px, 31vw); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pod .n { font-family: var(--font-h); font-weight: 800; font-size: 17px; text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod .v { color: var(--green-dark); font-weight: 900; }
[data-theme='dark'] .pod .v { color: var(--green); }
.pod .block { width: 100%; display: flex; align-items: flex-start; justify-content: center; padding-top: 8px; background: var(--card-tint); border: 3px solid var(--line); border-radius: 14px 14px 0 0; box-shadow: 0 6px 0 0 var(--line); font-family: var(--font-h); font-weight: 900; font-size: 46px; color: var(--muted); }
.pod.p1 .block { height: 190px; background: var(--card); }
.pod.p2 .block { height: 130px; }
.pod.p3 .block { height: 96px; }
.pod .crownbig { font-size: 40px; animation: bob 1.6s ease-in-out infinite; }
.rest { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.rest .player-row { width: 260px; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; }

.dub-card { display: flex; flex-direction: column; gap: 10px; }
.dub-card .top { display: flex; gap: 12px; align-items: center; }
.dub-card img { width: 120px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; border: 2px solid var(--line); background: var(--video-bg); }

/* ------------------------------------------------------------- кастинг, тема, барабан */

.roles { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.role-card { width: 180px; min-height: 210px; padding: 14px 10px; display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 6px; text-align: center; background: var(--card); border: 3px solid var(--line); border-radius: 20px; box-shadow: 0 6px 0 0 var(--line); cursor: pointer; transition: transform 0.12s; }
.role-card:hover { transform: scale(1.04); }
.role-card.mine { background: var(--yellow); color: var(--on-accent); }
.role-card.taken { background: var(--card-tint); cursor: default; }
.role-card .rn { font-family: var(--font-h); font-weight: 800; font-size: 22px; text-transform: uppercase; }
.thema-input { font-size: 22px; min-height: 64px; }
.wheel-box { position: relative; margin: 10px auto; width: min(760px, 100%); padding: 18px; background: var(--blue); border: 4px solid var(--line); border-radius: 30px; box-shadow: 0 8px 0 0 var(--line); transform: rotate(-1.5deg); }
.wheel-window { position: relative; height: 216px; overflow: hidden; background: var(--paper); border: 3px solid var(--line); border-radius: 18px; }
.wheel-window::before, .wheel-window::after { content: ''; position: absolute; left: 0; right: 0; height: 72px; z-index: 2; pointer-events: none; }
.wheel-window::before { top: 0; background: linear-gradient(var(--paper), transparent); }
.wheel-window::after { bottom: 0; background: linear-gradient(transparent, var(--paper)); }
.wheel-strip { position: absolute; left: 0; right: 0; top: 0; will-change: transform; }
.wheel-item { height: 72px; display: flex; align-items: center; justify-content: center; text-align: center; padding: 0 16px; font-family: var(--font-h); font-weight: 800; font-size: clamp(16px, 3.4vw, 26px); line-height: 1.1; }
.wheel-mark { position: absolute; left: 6px; right: 6px; top: 72px; height: 72px; z-index: 1; border: 3px solid var(--coral); border-radius: 14px; }
.wheel-box.done .wheel-mark { background: rgba(255, 194, 51, 0.35); animation: slap 0.3s; }
@keyframes slap { 50% { transform: scale(1.06); } }
.countdown { font-family: var(--font-h); font-weight: 900; font-size: 22px; }
.countdown.low { color: var(--red-text); }

/* ------------------------------------------------------------- тосты, занавес */

#toasts { position: fixed; left: 50%; bottom: calc(18px + var(--safe-bottom)); transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(520px, 92vw); }
.toast { padding: 10px 18px; background: var(--card); color: var(--ink); border: 3px solid var(--line); border-radius: 16px; box-shadow: 0 4px 0 0 var(--line); font-weight: 800; text-align: center; animation: pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }
.toast.bad { background: var(--coral); color: #fff; }

#curtain { position: fixed; inset: 0; z-index: 80; pointer-events: none; }
#curtain .half {
  position: absolute; top: 0; bottom: 0; width: 56%;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.22) 0 6px, rgba(255, 255, 255, 0.05) 14px, rgba(0, 0, 0, 0.2) 30px, rgba(0, 0, 0, 0.32) 44px),
    linear-gradient(180deg, #d4313d, #9c1426);
  border: 4px solid var(--line);
  transition: transform 0.7s cubic-bezier(0.65, 0, 0.35, 1);
}
#curtain .half::after { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 46px; background: repeating-linear-gradient(90deg, #ffc233 0 22px, #e09b12 22px 44px); border-bottom: 4px solid var(--line); }
#curtain .l { left: -2%; transform: translateX(-102%); border-radius: 0 0 40px 0; }
#curtain .r { right: -2%; transform: translateX(102%); border-radius: 0 0 0 40px; }
#curtain.closed .l, #curtain.closed .r { transform: translateX(0); }

.loading { margin: auto; text-align: center; font-family: var(--font-h); font-weight: 800; font-size: 22px; }
.spinner { width: 46px; height: 46px; margin: 10px auto; border: 6px solid var(--card-tint); border-top-color: var(--coral); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.boot-errors { position: fixed; left: 8px; right: 8px; top: 8px; z-index: 100; padding: 10px; background: #fff2f0; color: #8a1d14; border: 3px solid #8a1d14; border-radius: 12px; font: 13px monospace; max-height: 40vh; overflow: auto; }
.mock-banner { position: fixed; right: 8px; bottom: 8px; z-index: 70; padding: 2px 10px; border: 2px solid var(--line); border-radius: 999px; background: var(--yellow); color: var(--on-accent); font-size: 11px; font-weight: 900; opacity: 0.85; pointer-events: none; }
.steps { display: flex; flex-direction: column; gap: 10px; }
.step { display: flex; gap: 12px; align-items: flex-start; }
.step .num { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--line); display: flex; align-items: center; justify-content: center; font-family: var(--font-h); font-weight: 900; color: var(--on-accent); }
.slider { width: 100%; accent-color: var(--yellow); height: 28px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { width: 26px; height: 26px; accent-color: var(--green); }

[data-theme='dark'] #bg { filter: invert(1); }

/* ---------- свои ролики и редактор ---------- */
.avatar.xs { width: 22px; height: 22px; font-size: 11px; border-width: 2px; }
.pack-card .author, .row.author { display: flex; align-items: center; gap: 6px; }
.pack-card .author { color: var(--ink-soft); font-weight: 800; }
.spinner.inline { display: inline-block; width: 14px; height: 14px; margin: 0 4px -2px 0; border-width: 3px; }
.progress { height: 14px; border: 2.5px solid var(--line); border-radius: 999px; background: var(--card-tint); overflow: hidden; }
.progress .fill { height: 100%; width: 0; background: var(--green); transition: width 0.2s; }
.ugc-row { display: flex; gap: 12px; align-items: flex-start; }
.ugc-thumb { position: relative; flex: none; width: 150px; aspect-ratio: 16 / 9; border: 3px solid var(--line); border-radius: 12px; background: var(--video-bg) center/cover no-repeat; }
.ugc-thumb .dur { position: absolute; right: 6px; bottom: 6px; padding: 0 6px; border-radius: 6px; background: rgba(0, 0, 0, 0.7); color: #fff; font-size: 11px; }
.ugc-row b { font-family: var(--font-h); font-size: 18px; overflow-wrap: anywhere; }
@media (max-width: 560px) { .ugc-thumb { width: 96px; } .ugc-row b { font-size: 16px; } }

.editor { max-width: 1280px; }
.ed-head { flex-wrap: wrap; align-items: flex-start; }
.ed-title { font-family: var(--font-h); font-size: 22px; padding: 6px 12px; }
.ed-actions { flex-wrap: nowrap; }
.ed-save { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-main { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr); gap: 14px; align-items: start; }
.ed-video { width: 100%; max-height: 52vh; }
.ed-video video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.ed-transport, .ed-transport2 { align-items: center; gap: 10px; }
.ed-time { font: 800 18px var(--font-h); font-variant-numeric: tabular-nums; }
.ed-speed { width: auto; padding: 2px 8px; font-size: 14px; border-width: 2.5px; border-radius: 10px; }
.btn.pressed { transform: translateY(4px); box-shadow: 0 1px 0 0 var(--line); filter: brightness(1.1); }
.ed-side { gap: 12px; }
.ed-lines-card { min-height: 0; }
.ed-lines { display: flex; flex-direction: column; gap: 4px; max-height: 38vh; overflow-y: auto; }
.ed-line { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 10px; background: var(--row, var(--card-tint)); cursor: pointer; border: 2px solid transparent; }
.ed-line.on { border-color: var(--line); background: var(--card-tint); }
.ed-line .n { min-width: 22px; text-align: right; font-family: var(--font-h); }
.ed-line .cap { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-line .cap.empty { color: var(--coral); font-style: italic; }
.dot { flex: none; display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line); }
.ed-roles { display: flex; flex-wrap: wrap; gap: 6px; }
.role-chip { display: inline-flex; align-items: center; gap: 6px; }
.chip.on.role-chip { background: var(--yellow); color: var(--on-accent); }
.ed-tl-tools { align-items: center; gap: 8px; }
.tl { position: relative; height: 168px; border: 3px solid var(--line); border-radius: 18px; box-shadow: 0 6px 0 0 var(--line); overflow: hidden; background: var(--card); margin-bottom: 6px; }
.tl-canvas { position: absolute; left: 0; top: 0; z-index: 2; touch-action: none; display: block; }
.tl-scroll { position: absolute; inset: 0; overflow-x: auto; overflow-y: hidden; z-index: 1; }
.tl-inner { height: 100%; }
.ed-sel { gap: 10px; display: flex; flex-direction: column; }
.ed-sel-head, .ed-nudge { align-items: center; gap: 8px; flex-wrap: wrap; }
.ed-sel-roles { gap: 6px; flex-wrap: wrap; }
.ed-help summary { cursor: pointer; font-weight: 800; }
.ed-help ul { margin: 6px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 860px) {
  .ed-main { grid-template-columns: minmax(0, 1fr); }
  .ed-lines { max-height: 30vh; }
  .ed-actions { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ed-actions .btn { min-width: 0; }
  .ed-actions .btn span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ed-transport { flex-wrap: wrap; }
}
@media (max-width: 560px) {
  .ed-title { font-size: 18px; }
  .ed-time { font-size: 15px; }
  .ed-transport .btn.sm { padding: 4px 10px 6px; }
  .ed-actions .btn { font-size: 15px; padding-left: 8px; padding-right: 8px; }
  .ed-transport .grow { display: none; }
  .ed-nudge .grow { flex-basis: 100%; height: 0; }
  .tl { height: 150px; }
}
