@font-face { font-family: "Montserrat"; src: url("fonts/Montserrat-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("fonts/Montserrat-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("fonts/Montserrat-ExtraBold.ttf") format("truetype"); font-weight: 800; font-display: swap; }

/* те же цвета, что на основном сайте */
:root {
  --ink: #1d1830;
  --ink-2: #2a2240;
  --line: #3a3058;
  --deep: #141020;
  --paper: #f4efff;
  --text-soft: #d8cdf0;
  --violet: #bf94ff;
  --violet-dark: #7a4fd6;
  --sun: #ffcf4a;
  --danger: #ff8a8a;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--ink);
  color: var(--paper);
  font-family: "Montserrat", system-ui, sans-serif;
  font-weight: 500;
  font-size: 17px;
  line-height: 1.55;
}
a { color: var(--violet); }
a:focus-visible, button:focus-visible, input:focus-visible + .switch-track, .swatch:focus-visible {
  outline: 3px solid var(--sun); outline-offset: 3px;
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* ---------- шапка ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-top: 24px; padding-bottom: 24px;
}
.logo {
  display: flex; align-items: center; gap: 12px;
  color: var(--paper); text-decoration: none; font-weight: 800; font-size: 24px;
}
.me { display: flex; align-items: center; gap: 12px; min-width: 0; }
.avatar { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--violet); background: var(--ink-2); }
.me-name { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 24px; border-radius: 999px;
  font: inherit; font-weight: 800; text-decoration: none; cursor: pointer;
  border: 2px solid transparent; background: none; color: var(--paper);
}
.btn-main { background: var(--violet); color: var(--ink); }
.btn-main:hover { background: #d4b6ff; color: var(--ink); }
.btn-main:disabled { background: var(--line); color: var(--text-soft); cursor: default; }
.btn-line { border-color: var(--violet); }
.btn-line:hover { background: var(--ink-2); }
.btn-ghost { color: var(--text-soft); padding: 0 14px; }
.btn-ghost:hover { color: var(--paper); background: var(--ink-2); }

/* ---------- сцена с человечком ---------- */
.stage {
  position: relative;
  min-height: 440px;
  border-radius: 28px;
  background:
    radial-gradient(120% 80% at 50% 0%, #3b2a66 0%, transparent 60%),
    var(--deep);
  overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding-bottom: 64px;
}
.floor {
  position: absolute; left: 0; right: 0; bottom: 0; height: 64px;
  background: repeating-linear-gradient(90deg, #241c3a 0 48px, #2b2246 48px 96px);
  border-top: 3px solid var(--line);
}
.dude { position: relative; z-index: 1; }
.dude .figure { zoom: 3; }
.nick {
  position: relative; z-index: 1;
  margin-bottom: 20px;
  padding: 4px 16px 5px; border-radius: 999px;
  background: var(--deep); border: 2px solid var(--violet);
  font-weight: 800; font-size: 20px;
  max-width: 90%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- гость ---------- */
.guest {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; align-items: center;
  padding: 24px 0 64px;
}
.kicker { margin: 0 0 8px; color: var(--violet); font-weight: 800; text-transform: uppercase; letter-spacing: .06em; font-size: 14px; }
h1 { margin: 0 0 16px; font-size: clamp(32px, 5vw, 52px); line-height: 1.08; font-weight: 800; }
.lead { margin: 0 0 28px; color: var(--text-soft); font-size: 19px; max-width: 32em; }
.btn-twitch { min-height: 56px; font-size: 18px; padding: 0 28px; }
.fine { margin: 16px 0 0; color: var(--text-soft); font-size: 14px; max-width: 30em; }
.alert {
  margin: 0 0 20px; padding: 12px 16px; border-radius: 14px;
  background: #3a1f2e; border: 2px solid var(--danger); color: #ffd6d6;
}
.stage-guest { flex-direction: row; align-items: flex-end; justify-content: center; gap: 12px; min-height: 380px; }
.stage-guest .figure { zoom: 1.6; }

/* ---------- редактор ---------- */
.editor {
  display: grid; grid-template-columns: 1fr 420px; gap: 32px; align-items: start;
  padding-bottom: 64px;
}
.editor .stage { position: sticky; top: 24px; }
.panel {
  background: var(--ink-2); border: 2px solid var(--line); border-radius: 28px;
  padding: 28px;
}
.panel-title { font-size: 28px; margin-bottom: 20px; }
.field { border: 0; margin: 0 0 24px; padding: 0; min-width: 0; }
.field legend {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  padding: 0; margin-bottom: 12px; font-weight: 800; font-size: 18px;
}
.field.off .swatches { opacity: .35; pointer-events: none; }

.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch {
  width: 40px; height: 40px; border-radius: 50%;
  border: 3px solid var(--deep); background: var(--c);
  box-shadow: 0 0 0 2px var(--line);
  cursor: pointer; padding: 0;
}
.swatch:hover { box-shadow: 0 0 0 2px var(--text-soft); }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--paper); }

/* свой цвет: кружок с радугой, внутри обычный <input type=color> */
.swatch-custom {
  position: relative; overflow: hidden;
  background: conic-gradient(#ff5d5d, #ffcf4a, #6ee26e, #4ac7ff, #9b6bff, #ff5dc8, #ff5d5d);
}
.swatch-custom[aria-pressed="true"] { background: var(--c); }
.swatch-custom input { position: absolute; inset: -8px; width: 60px; height: 60px; opacity: 0; cursor: pointer; }
.swatch-custom::after {
  content: '+'; position: absolute; inset: 0; display: grid; place-items: center;
  font-weight: 800; font-size: 20px; color: #fff; text-shadow: 0 1px 2px #000; pointer-events: none;
}
.swatch-custom[aria-pressed="true"]::after { content: ''; }

.switch { position: relative; display: inline-flex; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  width: 48px; height: 28px; border-radius: 999px; background: var(--line); position: relative;
  transition: background .15s;
}
.switch-track::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--paper); transition: transform .15s;
}
.switch input:checked + .switch-track { background: var(--violet); }
.switch input:checked + .switch-track::after { transform: translateX(20px); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.actions #save { flex: 1 1 100%; }
.status { margin: 14px 0 0; min-height: 1.55em; color: var(--text-soft); font-size: 15px; }
.status.ok { color: #9be89b; }
.status.err { color: var(--danger); }

.loading { color: var(--text-soft); text-align: center; padding: 80px 0; }

/* ---------- узкие экраны ---------- */
@media (max-width: 880px) {
  .guest, .editor { grid-template-columns: 1fr; gap: 24px; }
  .editor .stage { position: relative; top: 0; min-height: 360px; }
  .dude .figure { zoom: 2.4; }
  .stage-guest { min-height: 260px; }
  .stage-guest { gap: 4px; }
  .stage-guest .figure { zoom: 1.2; }
}
@media (max-width: 480px) {
  .wrap { padding: 0 16px; }
  .panel { padding: 20px; border-radius: 22px; }
  .stage { border-radius: 22px; }
  .me-name { display: none; }
  .swatch { width: 36px; height: 36px; }
}

.btn-line:disabled, .btn-ghost:disabled { opacity: .4; cursor: default; background: none; }

.lock-note {
  margin: 0; padding: 12px 16px; border-radius: 14px;
  background: #3a3216; border: 2px solid var(--sun); color: #ffe9a8; font-size: 15px;
}
.locked .swatch { cursor: default; }
.locked .swatch:hover { box-shadow: 0 0 0 2px var(--line); }
.locked .swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--paper); }
.locked .switch { cursor: default; opacity: .7; }

/* ---------- аватарка стримера и пульсирующая точка «в эфире» ---------- */
.s-ava {
  position: relative; flex: none; width: var(--size, 44px); height: var(--size, 44px);
  border-radius: 50%; background: var(--line); display: grid; place-items: center;
  font-weight: 800; color: var(--paper); border: 2px solid var(--line);
}
.s-ava img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.s-ava.is-live { border-color: #2ee07a; }
.live-dot {
  position: absolute; right: -2px; bottom: -2px; width: 14px; height: 14px; border-radius: 50%;
  background: #2ee07a; border: 3px solid var(--ink-2);
}
.live-dot::after {
  content: ''; position: absolute; inset: -3px; border-radius: 50%;
  border: 2px solid #2ee07a; animation: live-pulse 1.6s ease-out infinite;
}
@keyframes live-pulse { 0% { transform: scale(.8); opacity: 1; } 100% { transform: scale(2.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .live-dot::after { animation: none; } }

/* ---------- стримеры и команды ---------- */
.community {
  display: grid; grid-template-columns: 1fr 420px; gap: 32px; align-items: start;
  padding-bottom: 80px;
}
.community h2 { margin: 0 0 6px; font-size: 26px; line-height: 1.15; font-weight: 800; }
.box-head { margin-bottom: 18px; }
.box-sub { margin: 0; color: var(--text-soft); font-size: 15px; max-width: 36em; }
.box-empty { color: var(--text-soft); }

.streamers { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.streamer {
  display: flex; align-items: center; gap: 12px; cursor: pointer;
  background: var(--ink-2); border: 2px solid var(--line); border-radius: 18px; padding: 10px 8px 10px 12px;
  transition: border-color .15s, background .15s;
}
.streamer:hover { border-color: #5a4b86; }
.streamer[aria-pressed="true"] { border-color: var(--violet); background: #33295a; }
.streamer:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }
.streamer-info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.streamer-name { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.streamer-sub { font-size: 13px; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.streamer.live .streamer-sub { color: #6ff0a0; }
.streamer:not(.live) .s-ava { opacity: .75; }
.watch {
  flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  color: var(--text-soft);
}
.watch:hover { color: var(--paper); background: var(--line); }

.commands-box {
  background: var(--ink-2); border: 2px solid var(--line); border-radius: 28px; padding: 24px;
  scroll-margin-top: 16px;
}
.target {
  display: flex; align-items: center; gap: 8px; margin: 8px 0 12px; flex-wrap: wrap;
  font-size: 15px; color: var(--text-soft);
}
.target-who {
  display: inline-flex; align-items: center; gap: 8px; font-weight: 800; color: var(--paper);
  background: var(--deep); border: 2px solid var(--violet); border-radius: 999px; padding: 3px 12px 3px 4px;
}
.target-who .s-ava { border-width: 1px; }
.target-who .live-dot { width: 10px; height: 10px; border-width: 2px; right: -3px; bottom: -3px; }
.target-warn { margin: -4px 0 12px; font-size: 13px; color: var(--sun); }

.chat-perm {
  margin: 0 0 14px; padding: 14px 16px; border-radius: 16px;
  background: var(--deep); border: 2px solid var(--line); font-size: 14px; color: var(--text-soft);
}
.chat-perm p { margin: 0 0 12px; }
.chat-perm .btn { min-height: 42px; font-size: 15px; }
.chat-perm.nudge { border-color: var(--sun); animation: nudge .4s ease-in-out 2; }
@keyframes nudge { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.cmd-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cmd-btn {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; cursor: pointer;
  background: none; border: 2px solid transparent; border-radius: 14px; padding: 8px 10px;
  color: var(--paper); font: inherit;
}
.cmd-btn:hover { background: var(--deep); border-color: var(--line); }
.cmd-btn:active { transform: scale(.98); }
.cmd-btn:disabled { opacity: .5; cursor: default; }
.cmd-emoji { flex: none; width: 36px; height: 36px; display: grid; place-items: center; font-size: 22px; background: var(--deep); border-radius: 12px; }
.cmd-body { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.cmd-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.cmd-top code { font-family: inherit; font-weight: 800; color: var(--violet); }
.cmd-note { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--sun); }
.cmd-text { font-size: 13px; color: var(--text-soft); }
.cmd-target { display: flex; gap: 8px; padding: 4px 0 8px 58px; }
.cmd-target input {
  flex: 1; min-width: 0; height: 40px; padding: 0 14px; border-radius: 999px;
  background: var(--deep); border: 2px solid var(--line); color: var(--paper); font: inherit; font-size: 14px;
}
.cmd-target input:focus { outline: 0; border-color: var(--violet); }
.cmd-target .btn { min-height: 40px; padding: 0 16px; font-size: 14px; }
.link-btn {
  margin-top: 6px; background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--text-soft); font: inherit; font-size: 13px; text-decoration: underline;
}
.link-btn:hover { color: var(--paper); }

@media (max-width: 880px) {
  .community { grid-template-columns: 1fr; gap: 24px; }
}
@media (max-width: 480px) {
  .commands-box { padding: 18px; border-radius: 22px; }
  .cmd-target { padding-left: 0; }
}
