@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; }
