:root {
  color-scheme: dark;
  --studio-background: #190f22;
  --studio-halo: #352045;
  --studio-surface: #261831;
  --studio-raised: #382546;
  --studio-selected: #49315a;
  --studio-text: #faf2ff;
  --studio-muted: #c5b5d0;
  --studio-rule: #594363;
  --studio-action: #c9ee91;
  --studio-action-hover: #ddf8b6;
  --studio-action-text: #17220e;
  --studio-accent: #c9ee91;
  --studio-violet: #b391e7;
  --studio-warning: #ffadbb;
  --studio-shadow: #10071965;
  --studio-overlay-accent: #e2ffb8;
  --studio-media: #1c1126;
  --studio-glass: color-mix(in srgb, var(--studio-surface) 95%, transparent);
  --bg-deep: var(--studio-background);
  --brand-accent-text: var(--studio-accent);
  --brand-ink: var(--studio-action-text);
  --brand-action: var(--studio-action);
  --brand-action-hover: var(--studio-action-hover);
  --rd-text: var(--studio-text);
  --rd-muted: var(--studio-muted);
  --rd-rule: var(--studio-rule);
  --rd-green: var(--studio-accent);
}

:root[data-studio-theme="light"] {
  color-scheme: light;
  --studio-background: #f7f0fa;
  --studio-halo: #e9d9f4;
  --studio-surface: #fff9ff;
  --studio-raised: #efe3f6;
  --studio-selected: #e3d0f0;
  --studio-text: #291635;
  --studio-muted: #634e70;
  --studio-rule: #cfbbd9;
  --studio-action: #365920;
  --studio-action-hover: #284418;
  --studio-action-text: #fff;
  --studio-accent: #3b5e27;
  --studio-violet: #714b99;
  --studio-warning: #a62d4b;
  --studio-shadow: #41235b24;
}

html {
  background: var(--studio-background);
  accent-color: var(--studio-accent);
}

body {
  color: var(--studio-text);
  background: radial-gradient(ellipse at 52% 6%, var(--studio-halo), transparent 72%) no-repeat 0 0 / 100% 100svh, var(--studio-background);
}

body ::selection {
  background: var(--studio-action);
  color: var(--studio-action-text);
}

:is(button, a, summary, select):focus-visible,
#heroCompareBox:has(#heroSliderInput:focus-visible) .compare-handle {
  outline: 2px solid var(--studio-violet);
  outline-offset: 3px;
}

.rd-page-dots {
  fill: color-mix(in srgb, var(--studio-violet) 32%, transparent);
}

#headerWrap {
  max-width: min(880px, 100% - 24px);
}

#headerWrap header {
  min-height: 54px;
}

.studio-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.studio-theme {
  isolation: isolate;
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  align-items: center;
  justify-items: center;
  width: 64px;
  min-height: 44px;
  border: 1px solid var(--studio-rule);
  border-radius: 999px;
  background: var(--studio-raised);
  color: var(--studio-muted);
}

.studio-theme::before {
  position: absolute;
  z-index: -1;
  top: 6px;
  bottom: 6px;
  left: 4px;
  width: calc(50% - 4px);
  content: "";
  border-radius: 999px;
  background: var(--studio-surface);
  box-shadow: 0 2px 5px var(--studio-shadow);
  transition: transform .18s ease-out;
}

.studio-theme[aria-pressed="true"]::before {
  transform: translateX(100%);
}

.studio-theme-sun {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 -7px 0 -3.5px, 0 7px 0 -3.5px, -7px 0 0 -3.5px, 7px 0 0 -3.5px,
    -5px -5px 0 -3.5px, 5px 5px 0 -3.5px, -5px 5px 0 -3.5px, 5px -5px 0 -3.5px;
}

.studio-theme-moon {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  box-shadow: -4px 2px 0 0 currentColor;
  transform: translate(2px, -1px);
}

.studio-theme[aria-pressed="false"] .studio-theme-sun,
.studio-theme[aria-pressed="true"] .studio-theme-moon {
  color: var(--studio-accent);
}

.lg,
html.lg-refract [data-refract].lg,
html.lg-refract [data-refract].lg-dense,
#studioModesButton {
  color: var(--studio-text);
  background: var(--studio-glass);
  box-shadow: inset 0 0 0 1px var(--studio-rule), 0 6px 18px var(--studio-shadow);
}

.lg::before,
.lg-lime::before {
  display: none;
}

.lg-well, #sheet-pay #authSeg {
  background: var(--studio-raised);
  box-shadow: none;
}

.seg-thumb, #sheet-pay #authSeg .seg-thumb {
  background: var(--studio-selected);
  box-shadow: none;
}

.seg-thumb::before, .seg-thumb::after {
  display: none;
}

.seg-btn, .rd-header-tagline {
  color: var(--studio-muted);
}

.seg-btn.on, .seg-btn:hover, #headerWrap .rd-header-wordmark {
  color: var(--studio-text);
}

#headerWrap .lg-lime {
  background: var(--studio-raised) !important;
  color: var(--studio-accent) !important;
  box-shadow: none;
}

#accountBtn {
  background: var(--studio-selected);
  color: var(--studio-text);
  box-shadow: none;
}

#heroCompareBox {
  background-color: var(--studio-media);
  border-color: color-mix(in srgb, var(--studio-violet) 50%, transparent);
  box-shadow: 0 20px 52px var(--studio-shadow);
}

#heroCompareBox[data-mode="example"] #heroOverlay {
  background:
    linear-gradient(90deg, #1c1126df 0%, #1c112695 28%, transparent 64%),
    linear-gradient(0deg, #1c1126ef 0%, transparent 48%);
}

#heroCompareBox #heroTitle,
#heroCompareBox .hero-top {
  color: #fff9ff;
}

#heroCompareBox #heroSub {
  color: #ede0f3;
}

#heroSliderLine {
  background: var(--studio-overlay-accent);
  box-shadow: 0 0 0 1px #1c11268c;
}

#heroSliderLine .compare-handle.lg-lime {
  color: #17220e !important;
  background: var(--studio-overlay-accent) !important;
}

#heroCompareBox .chip-accent, #mobileHeroMeta .chip-accent {
  background: var(--studio-action);
  color: var(--studio-action-text);
}

#heroCompareBox .chip-glass, #mobileHeroMeta .chip-glass {
  border-color: #c7b0d194;
  background: #2d193de8;
  color: #fff9ff;
}

#bottomFade {
  background: linear-gradient(to top, var(--studio-background), transparent);
}

.craft-card, .toast, #assetsHintBar, .movie-work form {
  color: var(--studio-text);
  background: var(--studio-surface);
  border-color: var(--studio-rule);
  box-shadow: 0 10px 24px var(--studio-shadow);
}

:where(#headerWrap, #floatingLiquidDock, #resultsSection, #assetsViewWrapper, #batchActionBar, .sheet) .text-white {
  color: var(--studio-text);
}

:where(#headerWrap, #floatingLiquidDock, #resultsSection, #assetsViewWrapper, #batchActionBar, .sheet) :is(.text-zinc-200, .text-zinc-300, .text-zinc-400, .text-zinc-500) {
  color: var(--studio-muted);
}

.text-\[\#ffbe0b\] { color: var(--studio-accent); }
.bg-\[\#ffbe0b\] { background-color: var(--studio-action); }
.bg-\[\#ffbe0b\]\/10 { background-color: var(--studio-raised); }
:is(.border-\[\#ffbe0b\], .border-\[\#ffbe0b\]\/25, .border-\[\#ffbe0b\]\/30) { border-color: var(--studio-accent); }
:is(.bg-white\/5, .bg-white\/10, .bg-white\/15, .bg-zinc-900) { background-color: var(--studio-raised); }
:is(.border-white\/10, .border-zinc-800) { border-color: var(--studio-rule); }

:is(.scene-active-check, .other-scene-card.is-selected .other-scene-pick) {
  color: var(--studio-action-text);
  background: var(--studio-action);
  border-color: var(--studio-accent);
  box-shadow: none;
}

.other-scene-card.is-selected {
  border-color: var(--studio-accent);
  box-shadow: 0 0 0 2px var(--studio-accent);
}

.other-scene-title small {
  color: var(--studio-overlay-accent);
}

#landing {
  --rd-muted: var(--studio-muted);
  color: var(--studio-text);
}

#landing :is(p, .rd-lead, .rd-small, .rd-fan-note, .rd-process-note, .rd-process-counter, .rd-notice b, .rd-chips span, .rd-footer-label, .rd-footer-note p, .rd-prose p:nth-child(3)) {
  color: var(--studio-muted);
}

#landing :is(.rd-chips span, .rd-copyright) { border-color: var(--studio-rule); }
#landing .rd-prose p { color: var(--studio-text); }
#landing .rd-prose p:nth-child(2) { color: var(--studio-accent); }
#landing .rd-video :is(h2, .rd-lead) { color: #f8effb; }
#landing .rd-chips span:first-child { color: var(--studio-accent); }
#showMoreContainer .rd-more {
  color: var(--studio-text);
  background: var(--studio-surface);
  border-color: var(--studio-rule);
}

#showMoreContainer .rd-more:hover {
  background: var(--studio-raised);
}

#showMoreContainer .rd-results-button:focus-visible,
#selectAllAssetsBtn:focus-visible {
  outline-color: var(--studio-violet);
}

#selectAllAssetsBtn { color: var(--studio-text); }
#batchActionBar .text-rose-300 { color: var(--studio-warning); }

#landing .rd-feature:hover { background: var(--studio-surface); }
#landing .rd-process-track i { background: var(--studio-raised); }
#landing .rd-process-track i.is-active { background: var(--studio-selected); }
#landing .rd-video-card:nth-child(1) { background: #ccedaa; color: #203017; }
#landing .rd-video-card:nth-child(2) { background: #53386a; color: #fff6ff; }
#landing .rd-video-card:nth-child(3) { background: #e4cdef; color: #301a42; }

#landing .rd-button,
#landing .rd-telegram {
  background: var(--studio-action);
  color: var(--studio-action-text);
}

#landing .rd-button:hover,
#landing .rd-telegram:hover {
  background: var(--studio-action-hover);
  color: var(--studio-action-text);
}

:is(#sheet-pay,#sheet-login,#sheet-save,#sheet-account).rd-modal :is(.sheet-panel, .sheet-footer),
.rd-modal .sheet-panel {
  color: var(--studio-text);
  background: var(--studio-surface);
  border: 1px solid var(--studio-rule);
}

:is(#sheet-pay,#sheet-login,#sheet-save,#sheet-account).rd-modal .sheet-footer {
  border: 0;
}

.rd-modal .sheet-backdrop, #studioModesDialog::backdrop {
  background: #180e20a6;
}

:is(#sheet-pay,#sheet-login,#sheet-save,#sheet-account,#sheet-scenes,#sheet-video-scenes).rd-modal
:is(.sheet-title, .rd-modal-field-label, .btn-sheet:not(.lg-lime), .rd-account-close, .rd-account-email, .rd-current-email, #accSheetCredits, #accSheetCreditsHint, #saveTelegramBtn, .rd-pay-login, #payBalanceActionTitle, #loginMergedNote) {
  color: var(--studio-text);
}

:is(#sheet-pay,#sheet-login,#sheet-save,#sheet-account,#sheet-scenes,#sheet-video-scenes).rd-modal
:is(.sheet-text, .rd-pay-note, .rd-pay-balance-intro, .rd-pay-balance-remaining, .pay-option-outcome, .sheet-actions > p) {
  color: var(--studio-muted);
}

:is(#sheet-pay,#sheet-login,#sheet-save,#sheet-account).rd-modal :is(.field, .otp-cell),
#sheet-pay #payOptions .pay-option,
#sheet-pay .rd-pay-balance-action,
#sheet-login #loginMergedNote,
#sheet-login #loginStep-success .sheet-section > div {
  background: var(--studio-raised);
  color: var(--studio-text);
}

:is(#sheet-pay,#sheet-login,#sheet-save,#sheet-account).rd-modal .field::placeholder {
  color: var(--studio-muted);
}

:is(#sheet-pay,#sheet-login,#sheet-save,#sheet-account).rd-modal :is(.field, .otp-cell):focus,
:is(#sheet-pay,#sheet-login,#sheet-save,#sheet-account).rd-modal button:focus-visible {
  outline-color: var(--studio-violet);
}

:is(#sheet-pay,#sheet-login,#sheet-save,#sheet-account).rd-modal .field[aria-invalid="true"] {
  outline-color: var(--studio-warning);
}

:is(#sheet-pay,#sheet-login,#sheet-save,#sheet-account).rd-modal :is(.rd-modal-error, .rd-modal-pending) {
  color: var(--studio-warning);
}

#sheet-pay #payOptions .pay-option.selected {
  background: var(--studio-selected);
  border-color: var(--studio-accent);
}

#sheet-pay :is(#payBalanceCost, .rd-pay-login span),
.movie-work a,
.mode-options button {
  color: var(--studio-accent);
}

.other-scenes-sticky-action {
  background: linear-gradient(0deg, var(--studio-surface) 72%, transparent);
}

#studioModesDialog {
  color: var(--studio-text);
}

#studioModesDialog::before {
  border-color: var(--studio-rule);
  background: radial-gradient(ellipse at 90% 0%, var(--studio-selected), transparent 58%), var(--studio-surface);
}

.mode-card, #modesClose {
  color: var(--studio-text);
  border-color: var(--studio-rule);
  background: var(--studio-raised);
}

.mode-summary small, .mode-options p {
  color: var(--studio-muted);
}

button.mode-summary::after {
  color: var(--studio-accent);
}

@media (max-width: 767px), (max-height: 500px) and (pointer: coarse) {
  #heroCompareBox[data-mode="example"] { --compare-handle-y: 38%; }
  #heroCompareBox[data-mode="example"] #heroOverlay {
    justify-content: flex-end;
    background: linear-gradient(0deg, #1c1126f5 1%, #1c11269c 25%, transparent 60%);
  }

  #heroCompareBox[data-mode="example"] #heroSliderLine {
    background: linear-gradient(var(--studio-overlay-accent) 42%, transparent 52%);
    box-shadow: none;
  }

  .studio-header-actions { gap: 5px; }
  .studio-theme { width: 44px; }
  .studio-theme::before { top: 5px; right: 4px; bottom: 5px; width: auto; }
  .studio-theme[aria-pressed="true"]::before { transform: none; }
  .studio-theme > span { grid-area: 1 / 1; justify-self: center; }
  .studio-theme { grid-template-columns: 1fr; }
  .studio-theme[aria-pressed="false"] .studio-theme-moon,
  .studio-theme[aria-pressed="true"] .studio-theme-sun { display: none; }
}

@media (max-width: 359px) {
  #headerWrap #navSeg {
    --nav-start-width: 43px;
    grid-template-columns: var(--nav-start-width) 68px;
  }

  #navSeg .seg-thumb {
    width: var(--nav-start-width);
    transform: translateX(calc(var(--i, 0) * var(--nav-start-width)));
    transition: width .18s, transform .18s;
  }

  #navSeg:has(#navBtn-assets.on) .seg-thumb { width: 68px; }
  #navSeg .seg-btn { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .studio-theme::before, #navSeg .seg-thumb { transition: none; }
}

html[data-studio-theme="light"] #headerWrap header,
html[data-studio-theme="light"] body.rd-reading #headerWrap header {
  background: var(--studio-glass);
  color: var(--studio-text);
  border-color: var(--studio-rule);
}
html[data-studio-theme="light"] #accountBtn { background: var(--studio-selected); color: var(--studio-text); }
html[data-studio-theme="light"] #landing .rd-model-posters { filter: contrast(1.15) saturate(1.18) brightness(.85); }
.provider-styles li button { cursor:pointer; touch-action:manipulation; }
.provider-styles li button:hover, .provider-styles li button:focus-visible {background:var(--studio-selected); color:var(--studio-text);}
.provider-styles li button[data-connected=true] { box-shadow:inset 0 -2px var(--studio-accent); }

html[data-studio-theme="light"] #heroCompareBox button.hero-change-photo,
html[data-studio-theme="light"] #heroCompareBox button.lg[onclick*="loadDemoPhoto"] {
  background: #fff8ff;
  color: #372142;
  border: 1px solid #cdb8d6;
  box-shadow: 0 2px 8px #26123230;
}
html[data-studio-theme="light"] #headerWrap #accountBtn > span:first-child {
  background: #e4d2ed;
  color: #49275c;
}
html[data-studio-theme="light"] #floatingLiquidDock #scenesHorizontalStrip:not(.hidden) {
  background: #fffaff;
  color: var(--studio-text);
  border-radius: 24px;
  border: 1px solid var(--studio-rule);
  box-shadow: 0 10px 32px var(--studio-shadow);
}
html[data-studio-theme="light"] .provider-styles li {
  background: #f7effa;
  border-color: var(--studio-rule);
}
html[data-studio-theme="light"] .provider-styles input[type=search] {
  background: white;
  border-color: var(--studio-rule);
}
html[data-studio-theme="light"] .provider-styles input::placeholder {color: var(--studio-muted);}
html[data-studio-theme="light"] body ::selection {background:#e0c7ef;color:#30203e;}

html[data-studio-theme="light"] #assetsEmptyTitle { color: var(--studio-text); }
html[data-studio-theme="light"] #assetsEmptyDescription { color: var(--studio-muted); }

#heroCtaRow .hero-remove-upload {
  grid-column: 1 / -1;
  padding: 0 14px;
  min-height: 40px;
  border-radius: 999px;
  background: var(--studio-surface);
  border: 1px solid var(--studio-rule);
  color: var(--studio-text);
  font-weight: 700;
  white-space: nowrap;
}
#heroCtaRow .hero-remove-upload:disabled { opacity: .6; }
