:root {
  --bg: #0d0d10;
  --panel: rgba(22, 18, 32, 0.92);
  --line: rgba(255, 255, 255, 0.09);
  --text: #ffffff;
  --muted: #a0a0a8;
  --accent: #a855f7;
  --accent-2: #c084fc;
  --radius-md: 12px;
  --radius-lg: 16px;
  --dur-fast: 180ms;
  --dur-mid: 260ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --page-tx-dur: 300ms;
  --page-tx-ease: cubic-bezier(0.25, 0.8, 0.25, 1);
  --focus-ring: 0 0 0 2px rgba(168, 85, 247, 0.45);
}

* {
  box-sizing: border-box;
}

/**
 * Тот же фон, что у страниц: между полной перезагрузками документа браузер иначе часто показывает белую вспышку.
 */
html {
  background-color: var(--bg);
  color-scheme: dark;
}

/** OBS Browser Source: прозрачный холст (чат, соцсети, виджеты) */
html.mode-obs,
body.mode-obs {
  background: transparent !important;
  background-color: transparent !important;
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", sans-serif;
  color: var(--text);
  opacity: 1;
  transform: translateX(0) scale(1);
}

/** Только уход: без «входной» анимации — иначе на новой странице сначала рисуется контент, потом opacity→0→1 и страница моргает. */
body.page-leave {
  transition:
    opacity var(--page-tx-dur) var(--page-tx-ease),
    transform var(--page-tx-dur) var(--page-tx-ease);
  opacity: 0;
  transform: translateX(-12px) scale(0.988);
}

/* --- Editor page --- */
.editor-body {
  background:
    radial-gradient(circle at 8% -10%, rgba(168, 85, 247, 0.34), transparent 42%),
    radial-gradient(circle at 92% 5%, rgba(139, 92, 246, 0.2), transparent 38%),
    radial-gradient(circle at 50% 100%, rgba(91, 33, 182, 0.16), transparent 48%),
    var(--bg);
  min-height: 100vh;
}

.editor-header {
  max-width: 1200px;
  margin: 0 auto;
  padding: 22px 22px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

/** Общая шапка: всегда сверху, при Turbo Drive не перерисовывается (data-turbo-permanent). */
.site-app-header {
  position: sticky;
  top: 0;
  z-index: 2000;
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 14px clamp(16px, 4vw, 28px);
  background: rgba(13, 13, 16, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}

.site-app-header__brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

.site-app-header__brand h1 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  line-height: 1;
}

body.site-shell-body.mode-obs #siteAppHeader,
body.mode-obs #siteAppHeader {
  display: none !important;
}

.editor-header .auth-toolbar > a.link.site-nav-active {
  border-color: rgba(192, 132, 252, 0.65);
  background: rgba(168, 85, 247, 0.28);
  color: #fff;
}

.auth-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 10px;
}

.editor-layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 22px 40px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 18px;
  align-items: start;
}

.editor-form {
  max-height: calc(100vh - 140px);
  overflow-y: auto;
}

.editor-sidebar {
  position: sticky;
  top: 12px;
}

.editor-section {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.editor-section:last-child {
  border-bottom: 0;
}

.editor-section h2 {
  margin: 0 0 12px;
  font-size: 16px;
}

.payout-preview {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin: -2px 0 12px;
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  background: rgba(24, 20, 36, 0.55);
  border: 1px solid var(--line);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.3;
}

.payout-preview.is-empty {
  display: none;
}

.payout-stake {
  color: #f8fafc;
}

.payout-arrow {
  color: #cbd5e1;
  font-weight: 600;
}

.payout-win {
  color: #22c55e;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  padding: 18px;
  transition:
    transform var(--dur-fast) ease,
    box-shadow var(--dur-fast) ease,
    border-color var(--dur-fast) ease;
}

.card:hover {
  border-color: rgba(168, 85, 247, 0.35);
  box-shadow:
    0 14px 40px rgba(0, 0, 0, 0.45),
    0 0 24px rgba(168, 85, 247, 0.12);
}

.kicker {
  margin: 0 0 8px;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 12px;
}

.muted {
  color: var(--muted);
}

h1 {
  margin: 0 0 8px;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
}

.field.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
}

.field.checkbox input {
  width: auto;
}

input,
select,
button {
  font: inherit;
  border-radius: 10px;
}

input,
select {
  padding: 10px 11px;
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  transition:
    border-color var(--dur-fast) ease,
    box-shadow var(--dur-fast) ease,
    background var(--dur-fast) ease;
}

input:hover,
select:hover {
  border-color: rgba(168, 85, 247, 0.28);
  background: rgba(255, 255, 255, 0.045);
}

input:focus-visible,
select:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.px-slider {
  width: 100%;
  margin-top: 6px;
}

.color-swatch {
  width: 44px;
  height: 28px;
  margin-top: 6px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
  background: transparent;
}

select {
  min-height: auto;
}

select option {
  color: #111827;
  background: #ffffff;
}

.btn {
  border: 0;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #c084fc 0%, var(--accent) 42%, #6b21b8 100%);
  color: #fff;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow:
    0 4px 20px rgba(168, 85, 247, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition:
    transform var(--dur-fast) ease,
    box-shadow var(--dur-fast) ease,
    filter var(--dur-fast) ease;
}

.btn:hover {
  filter: brightness(1.06);
  box-shadow:
    0 6px 28px rgba(168, 85, 247, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.2);
}

.btn-secondary {
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.22);
}

.btn-secondary:active {
  transform: translateY(1px);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.file-btn input {
  display: none;
}

.preview-frame {
  background:
    radial-gradient(ellipse 120% 85% at 42% 28%, rgba(91, 33, 182, 0.38), transparent 55%),
    radial-gradient(ellipse 70% 55% at 82% 72%, rgba(168, 85, 247, 0.14), transparent 52%),
    #0a0a0f;
  border-radius: 14px;
  border: 1px solid rgba(168, 85, 247, 0.22);
  min-height: 280px;
  padding: 12px;
  overflow: hidden;
}

.overlay-preview {
  position: relative;
  min-height: 240px;
  align-items: flex-start !important;
}

.overlay-link-block {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.overlay-url-panel {
  display: grid;
  gap: 8px;
}

.overlay-url-placeholder {
  display: block;
  border: 1px solid rgba(234, 179, 8, 0.35);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.45;
  color: #fde68a;
  background: rgba(234, 179, 8, 0.08);
}

.overlay-url-placeholder strong {
  color: #fef3c7;
  font-weight: 700;
}

.overlay-url-code {
  margin: 0;
}

.overlay-url-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.overlay-url-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 13px;
}

.overlay-url-toggle__icon {
  flex-shrink: 0;
  opacity: 0.9;
}

.overlay-url-toggle-hint {
  font-size: 12px;
  max-width: 100%;
}

.live-sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #d8b4fe;
  vertical-align: middle;
}

.live-sync-badge__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.65);
  flex-shrink: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .live-sync-badge__dot {
    animation: live-sync-pulse 1.8s ease-in-out infinite;
  }
}

@keyframes live-sync-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.7); }
}

.live-sync-note {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

.overlay-link-block a.link {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: #f5f3ff !important;
  border: 1px solid rgba(168, 85, 247, 0.38);
  background: rgba(168, 85, 247, 0.14);
  margin-top: 4px;
  transition:
    background var(--dur-fast) ease,
    border-color var(--dur-fast) ease,
    transform var(--dur-fast) ease;
}

.overlay-link-block a.link:hover {
  background: rgba(168, 85, 247, 0.26);
  border-color: rgba(192, 132, 252, 0.55);
  transform: translateY(-1px);
}

code {
  display: block;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  overflow-x: auto;
  font-size: 11px;
  word-break: break-all;
}

.link {
  color: #e9d5ff;
  text-decoration: none;
}

.link:hover {
  color: #fff;
}

.editor-header #userBadge {
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  color: rgba(250, 245, 255, 0.92);
  background: rgba(18, 14, 28, 0.72);
  border: 1px solid rgba(168, 85, 247, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  letter-spacing: 0.015em;
  max-width: min(260px, 44vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .editor-header #userBadge {
    max-width: min(180px, 52vw);
  }
}

.editor-header .auth-toolbar > a.link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(246, 248, 255, 0.95);
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 2px 14px rgba(0, 0, 0, 0.18);
  transition:
    transform var(--dur-fast) ease,
    border-color var(--dur-fast) ease,
    background var(--dur-fast) ease,
    box-shadow var(--dur-fast) ease,
    color var(--dur-fast) ease;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }

  body,
  body.page-leave {
    opacity: 1 !important;
    transform: none !important;
  }
}

.editor-header .auth-toolbar > a.link:hover {
  color: #fff;
  border-color: rgba(168, 85, 247, 0.55);
  background: rgba(168, 85, 247, 0.2);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 6px 26px rgba(91, 33, 182, 0.38);
  transform: translateY(-2px);
}

.editor-header .auth-toolbar > a.link:active {
  transform: translateY(0);
}

.editor-header .auth-toolbar > a.link[target="_blank"]::after {
  content: "↗";
  font-size: 11px;
  opacity: 0.55;
  font-weight: 700;
  margin-left: 1px;
  transform: translateY(-1px);
}

.editor-header .auth-toolbar .btn-secondary {
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.secret-link-box a.link {
  display: inline-block;
  margin-top: 4px;
  max-width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  font-weight: 500;
  color: #ede9fe !important;
  background: rgba(22, 18, 34, 0.62);
  border: 1px solid rgba(168, 85, 247, 0.22);
  word-break: break-all;
}

.secret-link-box a.link:hover {
  border-color: rgba(168, 85, 247, 0.45);
  background: rgba(168, 85, 247, 0.12);
  color: #fff !important;
}

/* --- Login page (референс: две колонки, превью чата + форма) --- */
.login-body {
  --login-page-bg: #0a0a0c;
  --login-muted: #a0a0a8;
  --login-line: rgba(255, 255, 255, 0.09);
  --login-purple: #a855f7;
  --login-purple-mid: #9333ea;
  --login-purple-deep: #6b21b8;
  --login-input-bg: #16161a;

  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 5% 20%, rgba(168, 85, 247, 0.12), transparent 40%),
    radial-gradient(circle at 95% 80%, rgba(91, 33, 182, 0.14), transparent 42%),
    var(--login-page-bg);
  color: #fafafa;
  font-family: Inter, ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 2.5vw, 22px);
  padding: clamp(20px, 4vw, 40px);
  box-sizing: border-box;
}

.login-shell--split {
  display: flex;
  align-items: stretch;
  width: min(920px, 100%);
  gap: clamp(28px, 5vw, 56px);
}

@media (prefers-reduced-motion: no-preference) {
  .login-shell--split {
    animation: login-shell-in-ref var(--dur-mid) var(--ease-out) both;
  }
}

@keyframes login-shell-in-ref {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-showcase {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.login-preview-card {
  width: min(400px, 100%);
  border-radius: 8px;
  background: #18181b;
  border: 1px solid #303032;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  font-family: "Inter", "Helvetica Neue", Helvetica, ui-sans-serif, system-ui, sans-serif;
}

.login-preview-card__chrome {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid #303032;
  background: #0e0e10;
}

.login-preview-card__twitch-mark {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: linear-gradient(180deg, #9147ff 0%, #6441a5 100%);
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12) inset;
}

/* Twitch-like chat column */
.login-chat--twitch {
  list-style: none;
  margin: 0;
  padding: 8px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: #18181b;
  min-height: 220px;
}

.login-tw-msg {
  display: block;
  padding: 4px 2px;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.42;
}

.login-tw-msg:hover {
  background: rgba(255, 255, 255, 0.04);
}

.login-tw-msg__main {
  min-width: 0;
  color: #efeff1;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.login-tw-msg__prefix {
  display: inline;
  vertical-align: baseline;
}

.login-tw-badges {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-right: 4px;
  vertical-align: -3px;
}

.login-tw-badge-slot {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.login-tw-badges--pair {
  gap: 3px;
}

.login-tw-badge-img {
  display: inline-block;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  object-fit: contain;
  vertical-align: -4px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
}

/* Превью чата: не больше одного бейджа на ник (скрывает лишние img, если их случайно добавят). */
.login-tw-badges .login-tw-badge-img ~ .login-tw-badge-img {
  display: none !important;
}

.login-tw-msg__name {
  font-weight: 700;
  display: inline;
}

.login-tw-msg__name--green {
  color: #00f593;
}

.login-tw-msg__name--caps-light {
  font-weight: 700;
  text-transform: uppercase;
  color: #efeff1;
}

.login-tw-msg__name--purple {
  color: #b39ddb;
}

.login-tw-msg__name--pink {
  color: #ff74b8;
}

.login-tw-msg__name--cyan {
  color: #38e4ff;
}

.login-tw-msg__name--bot {
  color: #af92ff;
}

.login-tw-msg__name--gold {
  color: #ffd700;
}

.login-tw-msg__colon {
  color: #efeff1;
  font-weight: 700;
  margin-right: 4px;
}

.login-tw-msg__text {
  color: #efeff1;
  font-weight: 400;
}

.login-tw-msg__text--multiline {
  display: inline;
}

.login-tw-msg--reply .login-tw-msg__main {
  display: block;
}

.login-tw-msg__reply-bar {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 0 0 4px;
  padding-left: 2px;
  font-size: 12px;
  line-height: 1.35;
  color: #adadb8;
}

.login-tw-msg__reply-arrow {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #adadb8;
  margin-top: 5px;
  flex-shrink: 0;
  opacity: 0.85;
}

.login-tw-msg__reply-to {
  flex: 1;
  min-width: 0;
}

.login-tw-msg__reply-at {
  color: #00f593;
  font-weight: 600;
}

.login-tw-msg--bot .login-tw-msg__text {
  color: #dedee3;
}

.login-divider {
  width: 1px;
  align-self: stretch;
  margin: clamp(12px, 3vh, 32px) 0;
  background: linear-gradient(
    to bottom,
    transparent,
    var(--login-line) 12%,
    var(--login-line) 88%,
    transparent
  );
}

.login-form-panel {
  flex: 1;
  min-width: min(340px, 100%);
  max-width: 400px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-block: clamp(8px, 2vh, 24px);
}

.login-form-panel__head {
  margin-bottom: clamp(26px, 5vh, 36px);
}

.login-form-panel__title {
  margin: 0;
  font-size: clamp(2.15rem, 5vw, 2.65rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  color: #fff;
}

.login-form-panel__subtitle {
  margin: 8px 0 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--login-muted);
  letter-spacing: 0.06em;
  text-transform: lowercase;
}

.login-with-label {
  margin: 20px 0 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--login-muted);
}

.login-twitch-wrap:empty {
  display: none;
}

.login-twitch-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 18px 0 6px;
}

.login-btn-twitch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  background: linear-gradient(180deg, #9147ff 0%, #6441a5 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.15) inset,
    0 6px 20px rgba(100, 65, 165, 0.45);
  transition: filter var(--dur-fast) ease, transform var(--dur-fast) ease;
}

.login-btn-twitch:hover {
  filter: brightness(1.08);
  color: #fff;
}

.login-btn-twitch:active {
  transform: translateY(1px);
}

.login-btn-twitch__mark {
  flex-shrink: 0;
  opacity: 0.95;
}

.login-btn-twitch__text {
  font-weight: 800;
  letter-spacing: 0.04em;
}

.login-or-divider {
  margin: 0;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--login-muted);
}

.login-form--ref {
  display: grid;
  gap: 18px;
}

.login-field-ref {
  display: grid;
  gap: 8px;
  margin: 0;
}

.login-field-ref__label {
  font-size: 13px;
  color: var(--login-muted);
  font-weight: 500;
}

.login-input-ref {
  width: 100%;
  margin: 0;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--login-input-bg);
  color: #fafafa;
  font-size: 15px;
  box-sizing: border-box;
  transition:
    border-color var(--dur-fast) ease,
    box-shadow var(--dur-fast) ease;
}

.login-input-ref:hover {
  border-color: rgba(255, 255, 255, 0.16);
}

.login-input-ref:focus {
  outline: none;
  border-color: rgba(124, 58, 237, 0.55);
  box-shadow:
    0 0 0 3px rgba(124, 58, 237, 0.22),
    0 0 20px rgba(124, 58, 237, 0.12);
}

.login-input-ref:focus-visible {
  outline: none;
}

.login-input-ref:-webkit-autofill,
.login-input-ref:-webkit-autofill:hover,
.login-input-ref:-webkit-autofill:focus {
  -webkit-text-fill-color: #fafafa !important;
  caret-color: #fafafa;
  transition: background-color 99999s ease-out 0s;
  box-shadow: 0 0 0 1000px #16161a inset !important;
  border-color: rgba(124, 58, 237, 0.35);
}

.login-submit-ref {
  width: 100%;
  margin-top: 4px;
  padding: 13px 18px;
  border: none;
  border-radius: 10px;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(180deg, #8b5cf6 0%, var(--login-purple) 40%, var(--login-purple-deep) 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.12) inset,
    0 8px 24px rgba(91, 33, 182, 0.45);
  transition:
    transform var(--dur-fast) ease,
    filter var(--dur-fast) ease,
    box-shadow var(--dur-fast) ease;
}

.login-submit-ref:hover {
  filter: brightness(1.06);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.14) inset,
    0 10px 30px rgba(91, 33, 182, 0.5);
}

.login-submit-ref:active {
  transform: translateY(1px);
}

.login-submit-ref:focus-visible {
  outline: none;
  box-shadow:
    var(--focus-ring),
    0 1px 0 rgba(255, 255, 255, 0.12) inset,
    0 8px 24px rgba(91, 33, 182, 0.45);
}

.login-error--ref:not(:empty) {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.38);
}

.login-access-line {
  margin: 24px 0 0;
  font-size: 14px;
  color: var(--login-muted);
  text-align: center;
}

.login-access-link {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: #e9d5ff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.login-access-link:hover {
  color: #faf5ff;
}

.login-access-link:focus-visible {
  outline: none;
  border-radius: 4px;
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.55);
}

@media (max-width: 840px) {
  .login-shell--split {
    flex-direction: column;
    align-items: center;
    gap: 0;
  }

  .login-divider {
    width: min(260px, 70%);
    height: 1px;
    margin: 28px 0;
    background: linear-gradient(
      to right,
      transparent,
      var(--login-line),
      transparent
    );
    align-self: center;
  }

  .login-form-panel {
    max-width: min(380px, 100%);
    width: 100%;
  }

  .login-showcase {
    width: 100%;
    justify-content: center;
  }
}

.form-stack {
  display: grid;
  gap: 10px;
}

.error-text {
  color: #ff8f8f;
  min-height: 20px;
  margin: 0;
}

.login-error:not(:empty) {
  margin-top: 4px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fecaca;
  font-size: 13px;
  line-height: 1.45;
}

.access-modal[hidden] {
  display: none;
}

.access-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
}

.access-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 3, 12, 0.76);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.access-modal__card {
  position: relative;
  z-index: 1;
  width: min(400px, calc(100% - 24px));
}

.access-modal-card {
  padding: 22px 20px 20px;
  border-radius: calc(var(--radius-lg) + 2px);
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.07) 0%, transparent 40%),
    var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow:
    0 4px 0 rgba(255, 255, 255, 0.04) inset,
    0 20px 50px rgba(5, 8, 18, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.access-modal__title {
  margin: 0 0 8px;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.access-modal__lead {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.5;
}

.access-modal__handle {
  margin: 0 0 18px;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
  color: var(--accent-2);
}

.access-modal__actions {
  display: flex;
  justify-content: stretch;
}

.access-modal__close {
  flex: 1;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.users-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.users-item {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.emoji-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.03);
  display: grid;
  gap: 8px;
}

.emoji-grid {
  max-height: 180px;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 6px;
}

.emoji-item {
  font-size: 20px;
  line-height: 1;
  padding: 6px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.emoji-item:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* --- Overlay page / preview root: CSS variables driven by JS --- */
/**
 * OBS Browser Source: прозрачный холст — иначе html { background: var(--bg) } даёт тёмную подложку.
 * В OBS: свойства источника → «Ширина/высота» и при необходимости «Пользовательский CSS» не перекрывают фон.
 */
html.overlay-page-html {
  background: transparent !important;
  background-color: transparent !important;
}

.overlay-page {
  background: transparent !important;
  background-color: transparent !important;
  margin: 0;
  overflow: hidden;
}

/**
 * OBS Browser Source: часто document/body имеют нулевую или «рваную» высоту до первого reflow.
 * Родитель с position:relative + align-items:flex-end тогда уводит карточку за пределы видимости.
 * Фиксируем корень на весь внутренний прямоугольник источника (перебиваем .overlay { position:relative }).
 */
body.overlay-page {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: transparent !important;
  background-color: transparent !important;
}

body.overlay-page .overlay.overlay-root {
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  min-height: 100%;
  max-height: none;
}

.overlay-root {
  --oval-border-color: #f37721;
  --oval-border-width: 4px;
  --oval-radius: 22px;
  --oval-bg-a: rgba(56, 26, 11, 0.94);
  --oval-bg-b: rgba(28, 18, 12, 0.9);
  --overlay-text: #ffffff;
  --overlay-muted: #a8b4ce;
  --odds-cell-bg: rgba(243, 119, 33, 0.23);
  --font-overlay: Inter, "Segoe UI", sans-serif;
  --fw-overlay: 700;
  --ls-overlay: 0px;
  --fs-brand: 28px;
  --fs-market: 36px;
  --fs-odds: 38px;
  --fs-amount: 24px;
  --oval-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  --overlay-max-w: 540px;

  background: transparent;
  display: flex;
  width: 100%;
  min-height: 100vh;
  box-sizing: border-box;
  font-family: var(--font-overlay);
}

.overlay {
  position: relative;
}

.safe-area-guide {
  display: none;
  position: absolute;
  inset: 24px;
  border: 1px dashed rgba(255, 255, 255, 0.25);
  border-radius: 12px;
  pointer-events: none;
  z-index: 0;
}

.overlay-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
}

.overlay-brand {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-weight: var(--fw-overlay);
  letter-spacing: var(--ls-overlay);
}

.overlay-brand img {
  width: calc(var(--fs-brand) * 1.15);
  height: calc(var(--fs-brand) * 1.15);
  border-radius: 10px;
  object-fit: contain;
}

.overlay-brand strong {
  font-size: var(--fs-brand);
  color: var(--overlay-text);
}

.output-table {
  border: var(--oval-border-width) solid var(--oval-border-color);
  border-radius: var(--oval-radius);
  background: linear-gradient(132deg, var(--oval-bg-a), var(--oval-bg-b));
  box-shadow: var(--oval-shadow);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0;
  overflow: hidden;
}

.overlay-multi-list {
  display: grid;
  gap: 10px;
}

.overlay-item {
  display: grid;
  gap: 4px;
}

.output-cell {
  padding: 14px 16px;
  font-weight: var(--fw-overlay);
  letter-spacing: var(--ls-overlay);
  color: var(--overlay-text);
}

.output-market {
  font-size: var(--fs-market);
}

.output-odds {
  min-width: 96px;
  text-align: center;
  font-size: var(--fs-odds);
  background: var(--odds-cell-bg);
}

.overlay-amount-row {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  color: var(--overlay-muted);
}

.overlay-amount-row span {
  font-size: calc(var(--fs-amount) * 0.85);
}

.overlay-amount-row strong {
  color: var(--overlay-text);
  font-size: var(--fs-amount);
}

.overlay-payout-row {
  margin-top: 4px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-size: calc(var(--fs-amount) * 0.95);
  font-weight: 900;
  color: var(--overlay-text);
}

.overlay-payout-row [data-ov="payoutStake"] {
  color: inherit;
}

.overlay-payout-arrow {
  color: inherit;
  font-weight: inherit;
}

.overlay-payout-row [data-ov="payoutWin"] {
  color: inherit;
  font-weight: inherit;
}

/* Animations */
.overlay-inner.anim-none {
  animation: none;
}

.overlay-inner.anim-fade {
  animation: overlayFade var(--anim-dur, 450ms) ease-out both;
}

.overlay-inner.anim-slide {
  animation: overlaySlide var(--anim-dur, 450ms) ease-out both;
}

.overlay-inner.anim-scale {
  animation: overlayScale var(--anim-dur, 450ms) ease-out both;
}

/**
 * OBS Browser Source (Chromium Embedded Framework) часто не отрабатывает keyframes с opacity:
 * карточка остаётся на opacity:0 и «ничего не видно». Превью в редакторе (index.html) не задаёт
 * body.overlay-page — там анимации по-прежнему работают.
 */
body.overlay-page .overlay-inner.anim-fade,
body.overlay-page .overlay-inner.anim-slide,
body.overlay-page .overlay-inner.anim-scale {
  animation: none !important;
  opacity: 1 !important;
  transform: none !important;
}

@keyframes overlayFade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes overlaySlide {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes overlayScale {
  from {
    opacity: 0;
    transform: scale(0.94);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

body.agg-winline {
  --brand-ref: #f37721;
}

body.agg-fonbet {
  --brand-ref: #ef1f26;
}

body.agg-betboom {
  --brand-ref: #f5cb44;
}

@media (max-width: 1020px) {
  .editor-layout {
    grid-template-columns: 1fr;
  }

  .editor-form {
    max-height: none;
  }
}

/* --- Секретный код --- */
.secret-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.08);
}

.secret-badge--on {
  background: rgba(34, 197, 94, 0.25);
  color: #bbf7d0;
}

.secret-link-box {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  word-break: break-all;
}

.secret-subtitle {
  margin: 14px 0 8px;
  font-size: 15px;
}

.secret-hints,
.secret-winners {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.secret-overlay-page {
  background: transparent;
  margin: 0;
  overflow: hidden;
}

.secret-ov-card {
  font-family: var(--font, Inter, "Segoe UI", sans-serif);
  color: #f8fafc;
  background: rgba(22, 18, 34, 0.88);
  border: 1px solid rgba(168, 85, 247, 0.18);
  border-radius: 14px;
  padding: 14px 16px;
  max-width: 420px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.secret-ov-title {
  font-weight: 800;
  font-size: 15px;
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.secret-ov-solved {
  color: #bbf7d0;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 8px;
}

.secret-ov-hint {
  font-size: 13px;
  line-height: 1.35;
  margin-bottom: 6px;
}

.secret-ov-hint-n {
  color: #94a3b8;
  margin-right: 4px;
}

.secret-ov-winners {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.secret-ov-winner {
  font-weight: 700;
  font-size: 14px;
  color: #fde68a;
}

.secret-ov-muted {
  color: #94a3b8;
  font-size: 13px;
}

.secret-ov-muted.small {
  font-size: 12px;
}

/* --- Giveaways (VelRoll-like, own look: amber / ink) --- */
.giveaways-body {
  background: radial-gradient(1200px 600px at 10% -10%, rgba(234, 88, 12, 0.12), transparent),
    var(--bg, #0d0d10);
}

.gv-header {
  border-bottom: 1px solid rgba(251, 146, 60, 0.25);
}

.gv-nav-active {
  color: #fb923c !important;
  font-weight: 700;
}

.giveaways-body .editor-header .auth-toolbar > a.link.gv-nav-active {
  border-color: rgba(251, 146, 60, 0.5) !important;
  background: rgba(251, 146, 60, 0.12) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 237, 213, 0.08),
    0 4px 20px rgba(234, 88, 12, 0.22) !important;
}

.gv-main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

.gv-hero {
  margin-bottom: 20px;
  border: 1px solid rgba(251, 146, 60, 0.2);
  background: linear-gradient(135deg, rgba(22, 18, 30, 0.96), rgba(10, 8, 14, 0.99));
}

.gv-title {
  margin: 0 0 8px;
  font-size: 1.65rem;
  letter-spacing: 0.02em;
}

.gv-lead {
  margin: 0;
  line-height: 1.45;
}

.gv-logo {
  margin: 0;
  filter: drop-shadow(0 0 12px rgba(251, 146, 60, 0.35));
}

.gv-grid {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(300px, 1.1fr);
  gap: 20px;
  align-items: start;
}

@media (max-width: 900px) {
  .gv-grid {
    grid-template-columns: 1fr;
  }
}

.gv-panel {
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(22, 18, 32, 0.58);
}

.gv-section-title {
  margin: 0 0 14px;
  font-size: 1.05rem;
  color: #fed7aa;
}

.gv-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gv-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.gv-btn-primary {
  background: linear-gradient(180deg, #fb923c, #ea580c);
  border: 1px solid rgba(254, 215, 170, 0.35);
  color: #0f172a;
  font-weight: 700;
}

.gv-btn-primary:disabled {
  opacity: 0.45;
}

.gv-hint {
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.4;
}

.gv-stats {
  display: flex;
  gap: 12px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(148, 163, 184, 0.15);
}

.gv-stat {
  flex: 1;
  text-align: center;
  padding: 12px 8px;
  border-radius: 12px;
  background: rgba(2, 6, 23, 0.45);
  border: 1px solid rgba(251, 146, 60, 0.12);
}

.gv-stat-value {
  display: block;
  font-size: 1.75rem;
  font-weight: 800;
  color: #ffedd5;
  font-variant-numeric: tabular-nums;
}

.gv-stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
}

.gv-actions-pick {
  margin-top: 16px;
}

.gv-btn-pick {
  width: 100%;
}

.gv-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.gv-panel-tall {
  min-height: 220px;
}

.gv-participants {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 360px;
  overflow: auto;
}

.gv-participant {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 8px;
  background: rgba(2, 6, 23, 0.35);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.gv-p-name {
  font-weight: 700;
  color: #e2e8f0;
}

.gv-p-meta {
  font-size: 12px;
}

.gv-empty {
  margin: 0;
  font-size: 14px;
}

/* Не задавать display:flex на корне с [hidden] — иначе перекрывает страницу и блокирует ввод */
.gv-modal-root[hidden] {
  display: none !important;
  pointer-events: none !important;
}

.gv-modal-root:not([hidden]) {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.gv-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(10px);
}

.gv-modal {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  max-height: min(92vh, 720px);
  overflow: auto;
  padding: 22px 22px 18px;
  border: 1px solid rgba(251, 146, 60, 0.35);
  background: linear-gradient(160deg, #16101e, #0a0810);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.gv-modal-wide {
  width: min(720px, 100%);
}

.gv-modal-title {
  margin: 0 0 6px;
  color: #ffedd5;
}

.gv-modal-sub {
  margin: 0 0 18px;
  font-size: 14px;
}

.gv-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.gv-wheel-wrap {
  position: relative;
  width: 160px;
  height: 160px;
  margin: 16px auto;
}

.gv-wheel {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 4px solid rgba(254, 215, 170, 0.5);
  box-shadow: 0 0 0 6px rgba(18, 14, 26, 0.95), 0 12px 40px rgba(0, 0, 0, 0.45);
  transition: transform 0s;
}

.gv-wheel-pointer {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-bottom: 18px solid #fed7aa;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.gv-result {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(251, 146, 60, 0.25);
}

.gv-result-title {
  margin: 0 0 6px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #fdba74;
}

.gv-result-name {
  margin: 0 0 8px;
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff7ed;
}
