:root {
  --bg: #17132a;
  --panel: #2b2648;
  --panel2: #37305c;
  --panel3: #221d3a;
  --line: #0f0c1d;
  --text: #f3eeff;
  --muted: #a59bc7;
  --red: #f96a5d;
  --yellow: #ffb52e;
  --blue: #3b9ff0;
  --green: #5cc93f;
  --ink: #1b1730;
  --head: 'Lilita One', 'Roboto Condensed', 'Arial Narrow', sans-serif;
  --body: 'M PLUS Rounded 1c', 'Nunito', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { font-size: clamp(9px, min(1.04vw, 1.85vh), 26px); height: 100%; }
body {
  margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text);
  font-family: var(--body); font-weight: 800; font-size: 1.1rem; -webkit-font-smoothing: antialiased;
  user-select: none;
}
#bg {
  position: fixed; inset: -42rem 0 0 -42rem; z-index: 0; pointer-events: none;
  background: url(/img/bg-pattern.svg) 0 0 / 42rem 42rem; animation: drift 90s linear infinite;
}
@keyframes drift { to { transform: translate(42rem, 42rem); } }
#app { position: fixed; inset: 0; z-index: 1; display: flex; }
.screen { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 0; position: relative; animation: fadein .25s ease; }
@keyframes fadein { from { opacity: 0; transform: scale(.985); } }
h1, h2, h3 { font-family: var(--head); font-weight: 900; margin: 0; text-transform: uppercase; letter-spacing: .02em; }
h1 { font-size: 5rem; line-height: 1; text-shadow: 0 .35rem 0 var(--line); }
.muted { color: var(--muted); }
.hide { display: none !important; }
img { -webkit-user-drag: none; }

/* ---------- кнопки ---------- */
.btn {
  --c: var(--panel2); --t: var(--text);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .6rem;
  font-family: var(--head); font-weight: 900; font-size: 1.35rem; text-transform: uppercase; letter-spacing: .03em;
  color: var(--t); background: var(--c); border: .25rem solid var(--line); border-radius: 99rem;
  padding: .75rem 1.9rem; cursor: pointer; white-space: nowrap; text-decoration: none;
  box-shadow: 0 .4rem 0 var(--line), inset 0 -.3rem 0 rgba(0, 0, 0, .16); transition: transform .08s, box-shadow .08s, filter .15s;
}
.btn::before {
  content: ''; position: absolute; left: .75rem; top: .4rem; width: .9rem; height: .7rem;
  border: .2rem solid rgba(255, 255, 255, .42); border-right: 0; border-bottom: 0; border-radius: 1rem 0 0 0; pointer-events: none;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-.08rem); }
.btn:active { transform: translateY(.25rem); box-shadow: 0 .15rem 0 var(--line), inset 0 -.15rem 0 rgba(0, 0, 0, .16); }
.btn:disabled, .btn.disabled { opacity: .5; filter: saturate(.55); cursor: default; pointer-events: none; }
.btn.red { --c: var(--red); --t: var(--ink); }
.btn.yellow { --c: var(--yellow); --t: var(--ink); }
.btn.blue { --c: var(--blue); --t: var(--ink); }
.btn.green { --c: var(--green); --t: var(--ink); }
.btn.discord { --c: #5865f2; --t: #fff; }
.btn.big { font-size: 2.6rem; padding: 1.3rem 3.4rem; min-width: 28rem; }
.btn.mid { font-size: 1.7rem; padding: 1rem 2.4rem; }
.btn.small { font-size: 1.05rem; padding: .5rem 1.2rem; }
.btn.wide { width: 100%; }
.btn svg { width: 1.4em; height: 1.4em; flex: none; }
.iconbtn { padding: .7rem 1.4rem; }
.iconbtn svg { width: 1.9rem; height: 1.9rem; }

.panel { background: var(--panel); border: .25rem solid var(--line); border-radius: 1.4rem; box-shadow: 0 .5rem 0 var(--line); }
input[type=text], select {
  font: inherit; color: var(--text); background: var(--panel3); border: .22rem solid var(--line); border-radius: .8rem;
  padding: .75rem 1rem; outline: none; min-width: 0; user-select: text;
}
input[type=text]:focus, select:focus { border-color: var(--blue); }
input::placeholder { color: #7f76a3; }
select { cursor: pointer; }
select:disabled { opacity: .75; cursor: default; }
label.lbl { font-family: var(--head); font-weight: 900; text-transform: uppercase; color: var(--muted); font-size: 1.15rem; letter-spacing: .03em; }

/* ---------- логотип ---------- */
.logo { display: inline-flex; flex-direction: column; align-items: center; font-family: 'Lilita One', var(--head); line-height: .8; filter: drop-shadow(0 .45rem 0 var(--line)); }
.logo .top { display: flex; align-items: center; gap: 1.1rem; }
.logo .dub, .logo .tog { color: var(--ink); -webkit-text-stroke: 1.5rem #fff; paint-order: stroke fill; letter-spacing: .02em; }
.logo .dub { font-size: 13rem; }
.logo .tog { font-size: 8.2rem; margin-top: -.6rem; }
.logo .bars { display: flex; align-items: center; gap: .55rem; }
.logo .bars i { display: block; width: 1.05rem; border-radius: 1rem; background: var(--red); animation: bar 1.1s ease-in-out infinite alternate; }
.logo .bars i:nth-child(1) { height: 3.6rem; }
.logo .bars i:nth-child(2) { height: 6.4rem; animation-delay: -.4s; }
.logo .bars i:nth-child(3) { height: 3.9rem; animation-delay: -.8s; }
@keyframes bar { from { transform: scaleY(.7); } to { transform: scaleY(1.08); } }
.logo.small { font-size: .5rem; }
.logo.small .dub { font-size: 7rem; -webkit-text-stroke-width: .85rem; }
.logo.small .tog { font-size: 4.4rem; -webkit-text-stroke-width: .85rem; margin-top: -.3rem; }
.logo.small .bars i { width: .6rem; }
.logo.small .bars i:nth-child(1) { height: 2rem; }
.logo.small .bars i:nth-child(2) { height: 3.5rem; }
.logo.small .bars i:nth-child(3) { height: 2.1rem; }

/* ---------- вход, меню ---------- */
.split { flex-direction: row; gap: 4rem; padding: 0 6rem; }
.split .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2rem; min-width: 0; }
.split .art { flex: 1; display: flex; align-items: flex-end; justify-content: center; align-self: stretch; min-width: 0; }
.split .art img { max-height: 92vh; max-width: 100%; }
.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem 1.6rem; width: 33rem; }
.menu-grid .btn { width: 100%; }
.profile { position: absolute; top: 2rem; right: 2rem; display: flex; align-items: center; gap: .8rem; padding: .5rem 1.6rem .5rem .6rem; border-radius: 99rem; font-family: var(--head); font-size: 1.3rem; }
.ava { width: 2.6rem; height: 2.6rem; border-radius: 50%; border: .18rem solid var(--line); background: var(--panel2) center/cover; flex: none; display: inline-flex; align-items: center; justify-content: center; font-family: var(--head); color: var(--muted); overflow: hidden; }
.ava img { width: 100%; height: 100%; object-fit: cover; }
.or { font-family: var(--head); color: var(--muted); font-size: 1.1rem; text-transform: uppercase; }
.joinrow { display: flex; gap: 1rem; align-items: center; }
.joinrow input { width: 21rem; font-size: 1.3rem; text-transform: uppercase; }
.login-box { display: flex; flex-direction: column; gap: 1.3rem; align-items: center; margin-top: 1rem; }
.login-box .devrow { display: flex; gap: .8rem; }

/* ---------- лобби ---------- */
.lobby { justify-content: flex-start; padding: 1.1rem 2rem 1rem; gap: 1rem; }
.lobby > .logo { zoom: .82; }
.lobby-body { display: flex; gap: 1.4rem; width: min(78rem, 100%); flex: 1; min-height: 0; }
.players { width: 21rem; padding: 1rem; display: flex; flex-direction: column; gap: .7rem; min-height: 0; }
.players h3 { font-size: 1.5rem; padding: .1rem .3rem; }
.plist { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: .5rem; min-height: 5rem; padding-right: .2rem; }
.prow { display: flex; align-items: center; gap: .7rem; background: var(--panel2); border: .2rem solid var(--line); border-radius: .8rem; padding: .35rem .7rem; height: 3.3rem; flex: none; font-family: var(--head); font-size: 1.35rem; }
.prow .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow.off { opacity: .45; }
.prow .crown { width: 1.9rem; height: 1.9rem; }
.prow .you { background: #6cc41f; color: var(--ink); border: .18rem solid var(--line); border-radius: 99rem; font-size: .85rem; padding: .35rem .5rem; }
.prow.free { justify-content: center; color: #5b5380; background: #262141; font-size: 1.05rem; border-color: #1b1730; }
.players .btnrow { flex-wrap: nowrap; gap: .6rem; }
.codeline { text-align: center; font-size: .95rem; color: var(--muted); }
.codeline b { font-family: var(--head); color: var(--text); letter-spacing: .08em; font-size: 1.15rem; }
.lobby-right { flex: 1; display: flex; flex-direction: column; gap: 1rem; min-width: 0; min-height: 0; }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.mode { height: 7.2rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; font-family: var(--head); font-size: 1.4rem; text-transform: uppercase; position: relative; }
.mode img { height: 4rem; }
.mode.on { background: var(--yellow); color: var(--ink); }
.mode.soon { opacity: .45; }
.mode.soon::after { content: 'скоро'; position: absolute; top: .5rem; right: .7rem; font-size: .8rem; background: var(--line); color: var(--muted); padding: .15rem .5rem; border-radius: 1rem; }
.lsettings { flex: 1; padding: 1rem 1.2rem; display: flex; flex-direction: column; gap: .8rem; min-height: 0; }
.lsettings h3 { font-size: 1.5rem; }
.srow { display: flex; align-items: center; gap: 1rem; }
.srow select, .srow input { flex: 1; }
.packlist { flex: 1; overflow-y: auto; min-height: 6rem; display: flex; flex-direction: column; gap: .25rem; padding-right: .3rem; }
.pack { display: flex; align-items: center; gap: .8rem; padding: .45rem .7rem; border-radius: .5rem; cursor: pointer; flex: none; }
.pack img, .pack .noicon { width: 3.2rem; height: 1.8rem; object-fit: cover; border-radius: .2rem; background: var(--panel3); flex: none; }
.pack .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pack .n { color: var(--muted); font-size: .92em; white-space: nowrap; }
.pack:hover { background: var(--panel2); }
.pack.on { background: var(--yellow); color: #fff8e6; text-shadow: 0 .08rem 0 rgba(0, 0, 0, .25); }
.pack.on .n { color: #fff0cc; }
.pack.busy { opacity: .5; cursor: default; }
.ro .pack { cursor: default; }
.ro .pack:not(.on):hover { background: none; }
.lobby-foot { display: flex; flex-direction: column; align-items: center; gap: .3rem; }
.lobby-foot .hintline { min-height: 0; font-size: .95rem; }
.lobby-foot .row { display: flex; gap: 1.2rem; align-items: center; }
::-webkit-scrollbar { width: .55rem; }
::-webkit-scrollbar-thumb { background: #554c80; border-radius: 1rem; }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, .25); border-radius: 1rem; }
.corner { position: absolute; top: 1.6rem; z-index: 5; }
.corner.l { left: 1.8rem; } .corner.r { right: 1.8rem; }

/* ---------- роли ---------- */
.roles { gap: 2rem; padding: 2rem; }
.rgrid { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem; max-width: 86rem; max-height: 60vh; overflow-y: auto; padding: .3rem .3rem .8rem; }
.rcard { width: 12.2rem; height: 14.4rem; padding: 1rem .6rem; display: flex; flex-direction: column; align-items: center; gap: .2rem; cursor: pointer; text-align: center; transition: transform .1s; }
.rgrid.dense .rcard { width: 10rem; height: 11.4rem; }
.rgrid.dense .rcard .ava { width: 3rem; height: 3rem; }
.rcard:hover { transform: translateY(-.25rem); }
.rcard .rn { font-family: var(--head); font-size: 1.45rem; line-height: 1.05; max-height: 3.2rem; overflow: hidden; word-break: break-word; }
.rcard .rc { color: var(--muted); font-family: var(--head); font-size: 1rem; }
.rcard .own { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; font-family: var(--head); font-size: 1.2rem; }
.rcard .own.orig { color: var(--muted); font-family: var(--body); font-size: .95rem; }
.rcard .ava { width: 3.8rem; height: 3.8rem; border-width: .22rem; }
.rcard.taken { background: var(--panel2); cursor: default; }
.rcard.mine { background: var(--yellow); color: var(--ink); cursor: pointer; }
.rcard.mine .rc { color: #7a5a17; }
.hintline { color: var(--muted); font-size: 1.05rem; text-align: center; min-height: 1.4em; }
.btnrow { display: flex; gap: 1.2rem; align-items: center; justify-content: center; flex-wrap: wrap; }

/* ---------- запись ---------- */
.rec { justify-content: flex-start; padding: 1.4rem 2rem 1.2rem; gap: .7rem; }
.rec-head { text-align: center; }
.rec-head .ttl { font-family: var(--head); font-size: 1.6rem; }
.dots { display: flex; gap: .45rem; justify-content: center; margin-top: .6rem; height: .7rem; }
.dots i { width: .55rem; height: .55rem; border-radius: 50%; background: #4a4370; }
.dots i.rec { background: var(--green); }
.dots i.cur { box-shadow: 0 0 0 .16rem var(--yellow); background: var(--yellow); }
.dots i.cur.rec { background: var(--green); }
.linecount { position: absolute; top: 1.6rem; right: 2rem; font-family: var(--head); text-transform: uppercase; font-size: 2.1rem; text-align: right; line-height: 1.1; }
.linecount small { display: block; font-size: 1.2rem; color: var(--yellow); }
.stage { flex: 1; min-height: 0; width: 100%; display: flex; align-items: center; justify-content: center; padding: .8rem; position: relative; background: #1b1733; overflow: hidden; }
.stage video { max-width: 100%; max-height: 100%; height: 100%; background: #000; }
.stage .cd { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--head); font-size: 11rem; color: #fff; text-shadow: 0 .5rem 0 var(--line), 0 0 2rem rgba(0, 0, 0, .6); pointer-events: none; }
.stage .recbadge { position: absolute; top: 1.2rem; left: 1.4rem; background: var(--red); color: var(--ink); font-family: var(--head); padding: .3rem 1rem; border-radius: 99rem; border: .2rem solid var(--line); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .35; } }
.stage.recording { box-shadow: 0 .5rem 0 var(--line), inset 0 0 0 .35rem var(--red); }
.who { font-family: var(--head); text-transform: uppercase; color: #2fd08c; font-size: 1.15rem; letter-spacing: .04em; }
.caption { font-family: var(--head); font-size: 1.9rem; text-align: center; max-width: 80rem; line-height: 1.15; max-height: 4.5rem; overflow-y: auto; user-select: text; }
.wave { width: 100%; height: 8.5rem; flex: none; padding: .6rem; position: relative; background: #29243f; }
.wave canvas { width: 100%; height: 100%; display: block; }
.status { font-size: 1.1rem; color: var(--muted); min-height: 1.5em; text-align: center; }
.status.warn { color: var(--yellow); }
.status.live { color: var(--red); }
.rec-bottom { width: 100%; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; }
.rec-bottom .l { display: flex; gap: 1rem; }
.rec-bottom .c { display: flex; gap: 1rem; }

/* ---------- ожидание, шоу ---------- */
.wait { gap: 1.2rem; }
.wait img.pop { height: 12rem; animation: bob 1.6s ease-in-out infinite alternate; }
@keyframes bob { to { transform: translateY(-.8rem) rotate(2deg); } }
.wait h1.red { color: var(--red); font-size: 5.4rem; }
.wait .sub { font-family: var(--head); color: #b9aef0; font-size: 1.9rem; }
.wcards { display: flex; gap: 1.2rem; flex-wrap: wrap; justify-content: center; max-width: 80rem; margin-top: 1.2rem; }
.wcard { width: 11.5rem; padding: 1rem .6rem; display: flex; flex-direction: column; align-items: center; gap: .5rem; background: var(--panel2); font-family: var(--head); font-size: 1.3rem; text-align: center; }
.wcard .ava { width: 4.2rem; height: 4.2rem; border-width: .22rem; }
.wcard .st { font-size: 1rem; color: var(--red); }
.wcard .st.ok { color: var(--green); }
.wcard.off { opacity: .5; }

.show { justify-content: flex-start; padding: 1.6rem 2rem 1.6rem; gap: 1.4rem; }
.show .frame { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; width: 100%; }
.show .frame .panel { padding: 1rem; max-height: 100%; height: 100%; display: flex; background: #1b1733; }
.show video { max-height: 100%; max-width: 100%; background: #000; }
.curtains { position: fixed; inset: 0; z-index: 55; pointer-events: none; overflow: hidden; }
.curtains .c { position: absolute; top: 0; bottom: 0; width: 51%; background: #c5121a url(/img/curtain.svg) center / 100% 100% no-repeat; transition: transform 2.8s cubic-bezier(.6, .02, .3, 1); filter: drop-shadow(0 0 1.5rem rgba(0, 0, 0, .6)); }
.curtains .c.l { left: 0; }
.curtains .c.r { right: 0; transform: scaleX(-1); }
.curtains.open .c.l { transform: translateX(-102%); }
.curtains.open .c.r { transform: scaleX(-1) translateX(-102%); }
.results { gap: 1.2rem; }
.results .frame.panel { padding: .9rem; background: #1b1733; }
.results video { height: 44vh; max-width: 80vw; display: block; background: #000; }
.results .pt { font-family: var(--head); font-size: 1.6rem; }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }

/* ---------- окна ---------- */
.modal-back { position: fixed; inset: 0; z-index: 60; background: rgba(12, 9, 24, .72); display: flex; align-items: center; justify-content: center; animation: fadein .15s; }
.modal { padding: 1.4rem 2rem; max-width: min(64rem, 94vw); max-height: 94vh; overflow-y: auto; display: flex; flex-direction: column; gap: .75rem; }
.modal h2 { font-size: 2rem; text-align: center; }
.modal p { margin: 0; color: var(--muted); text-align: center; }
.modal .btnrow { margin-top: .6rem; }
.set { width: 46rem; }
.set .f { display: flex; flex-direction: column; gap: .45rem; }
.set .f .top { display: flex; justify-content: space-between; align-items: baseline; }
.set .f .val { font-family: var(--head); font-size: 1.15rem; }
.set .f small, .set small { color: var(--muted); font-size: .9rem; font-weight: 700; }
.set .inline { display: flex; gap: .8rem; align-items: center; }
.set .inline select { flex: 1; }
.set hr { border: 0; border-top: .12rem solid #4a4370; width: 100%; margin: .2rem 0; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: .8rem; border-radius: 1rem; background: linear-gradient(90deg, var(--yellow) var(--p, 50%), #221d3a var(--p, 50%)); outline: none; margin: .5rem 0; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: #2b2648; border: .28rem solid var(--line); cursor: pointer; }
input[type=range]::-moz-range-thumb { width: 1.3rem; height: 1.3rem; border-radius: 50%; background: #2b2648; border: .28rem solid var(--line); cursor: pointer; }
.meter { flex: 1; height: 1.9rem; border-radius: 99rem; background: #221d3a; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; font-size: .85rem; color: var(--muted); }
.meter .zone { position: absolute; top: 0; bottom: 0; left: 55%; width: 27%; background: rgba(92, 201, 63, .28); }
.meter .bar { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--yellow); border-radius: 99rem; transition: width .06s linear; }
.meter span { position: relative; }
.toggle { width: 4.4rem; height: 2.3rem; border-radius: 99rem; background: var(--panel2); border: .22rem solid var(--line); position: relative; cursor: pointer; flex: none; }
.toggle::after { content: ''; position: absolute; top: .22rem; left: .25rem; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: #fff; transition: left .15s; }
.toggle.on { background: var(--green); }
.toggle.on::after { left: 2.25rem; }
.how ol { margin: 0; padding-left: 1.4rem; display: flex; flex-direction: column; gap: .6rem; font-size: 1.1rem; max-width: 40rem; }
.preview video { max-width: 80vw; max-height: 70vh; background: #000; border-radius: .6rem; }

/* ---------- чат ---------- */
#chat-root { position: fixed; right: 1.8rem; bottom: 1.5rem; z-index: 50; display: flex; flex-direction: column; align-items: flex-end; gap: .8rem; }
.chatbtn { position: relative; }
.chatbtn .badge { position: absolute; top: -.5rem; right: -.3rem; background: var(--red); color: var(--ink); border: .18rem solid var(--line); border-radius: 99rem; font-size: .85rem; min-width: 1.6rem; padding: .05rem .3rem; text-align: center; font-family: var(--head); }
.chat { width: 24rem; height: 30rem; padding: 1rem; display: flex; flex-direction: column; gap: .7rem; }
.chat .hd { display: flex; align-items: center; justify-content: space-between; }
.chat .hd h3 { font-size: 1.5rem; }
.chat .msgs { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: .4rem; font-size: 1rem; user-select: text; padding-right: .3rem; }
.chat .msgs .sys { color: var(--muted); text-align: center; font-size: .88rem; }
.chat .msgs b { color: var(--yellow); }
.chat .inp { display: flex; gap: .6rem; }
.chat .inp input { flex: 1; font-size: 1rem; padding: .6rem .8rem; }
.chat .send { padding: .5rem .8rem; }

#toasts { position: fixed; left: 50%; top: 1.4rem; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: .5rem; align-items: center; pointer-events: none; }
.toast { background: var(--panel2); border: .22rem solid var(--line); border-radius: 99rem; padding: .6rem 1.6rem; box-shadow: 0 .35rem 0 var(--line); animation: fadein .2s; }
.toast.err { background: var(--red); color: var(--ink); }
.loader { font-family: var(--head); font-size: 1.6rem; color: var(--muted); }

@media (max-aspect-ratio: 1/1) {
  html { font-size: clamp(8px, 1.9vw, 18px); }
  .split { flex-direction: column; padding: 2rem; }
  .split .art { display: none; }
}
