:root {
  color-scheme: dark;
  --bg: #070807;
  --panel: #121211;
  --panel-2: #191715;
  --line: #312a27;
  --text: #f3eee7;
  --muted: #a9a099;
  --red: #b9272d;
  --amber: #c98932;
  --moss: #6f8c69;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 8%, rgba(185, 39, 45, 0.14), transparent 30%),
    radial-gradient(circle at 88% 22%, rgba(111, 140, 105, 0.12), transparent 30%),
    linear-gradient(140deg, #070807 0%, #0f0e0d 42%, #090807 100%);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

.dashboard-page {
  background:
    linear-gradient(180deg, rgba(3, 4, 4, 0.25), rgba(3, 4, 4, 0.92)),
    linear-gradient(145deg, #050606 0%, #15100f 44%, #071714 100%);
}

.mist-dashboard {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.mist-nav {
  border-right: 1px solid rgba(226, 196, 131, 0.18);
  background:
    linear-gradient(180deg, rgba(14, 13, 12, 0.96), rgba(4, 5, 5, 0.98)),
    linear-gradient(135deg, rgba(99, 15, 21, 0.18), transparent);
  padding: 22px;
  display: grid;
  align-content: start;
  gap: 18px;
}

.tabs {
  display: grid;
  gap: 8px;
}

.tabs button {
  min-height: 44px;
  border: 1px solid #332a27;
  border-radius: 7px;
  color: #d8d0c8;
  background: #0d0d0c;
  text-align: left;
  padding: 0 13px;
}

.tabs button.active {
  color: #f7f1e5;
  border-color: rgba(185, 39, 45, 0.8);
  background: linear-gradient(135deg, rgba(94, 18, 23, 0.72), rgba(18, 18, 17, 0.96));
}

.mist-main {
  min-width: 0;
  padding: 24px;
}

.mist-header {
  min-height: 190px;
  border-bottom: 1px solid rgba(226, 196, 131, 0.18);
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0 22px;
  position: relative;
  overflow: hidden;
}

.mist-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(7, 8, 7, 0.98), rgba(7, 8, 7, 0.4)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1100' height='360' viewBox='0 0 1100 360'%3E%3Crect width='1100' height='360' fill='%23070807'/%3E%3Ccircle cx='890' cy='92' r='64' fill='%23bb883b' opacity='.48'/%3E%3Cpath d='M0 295 C170 230 310 302 480 230 C640 162 810 245 1100 155 L1100 360 L0 360 Z' fill='%2315211c'/%3E%3Cpath d='M660 80 L975 125 L950 320 L640 320 Z' fill='%23120e0d'/%3E%3Cpath d='M700 130 L795 145 L787 250 L695 240 Z' fill='%23212622'/%3E%3Cpath d='M150 348 C220 250 318 250 380 348' stroke='%235d3d2b' stroke-width='20' fill='none'/%3E%3Ccircle cx='265' cy='348' r='90' fill='%23070807'/%3E%3C/svg%3E");
  background-size: cover;
  background-position: center right;
  opacity: 0.78;
  pointer-events: none;
}

.mist-header > * {
  position: relative;
  z-index: 1;
}

.mist-header h2 {
  font-size: 44px;
  line-height: 1;
}

.hero-subtitle {
  color: #d8d0c8;
  font-size: 17px;
  line-height: 1.45;
  margin-top: 10px;
  max-width: 760px;
}

.status-lamps {
  display: flex;
  gap: 8px;
}

.status-lamps span {
  border: 1px solid #4b3e38;
  border-radius: 7px;
  background: #120f0e;
  color: #8f8580;
  padding: 8px 10px;
  font-size: 12px;
}

.status-lamps span.ok {
  color: #d7f2cf;
  border-color: rgba(111, 140, 105, 0.8);
}

.status-lamps span.bad {
  color: #e0a09d;
  border-color: rgba(185, 39, 45, 0.55);
}

.tab-panel {
  display: none;
  padding-top: 18px;
}

.tab-panel.active {
  display: block;
}

.split-panel {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 16px;
  margin-top: 14px;
}

.submission-list.large {
  max-height: 680px;
}

.episode-history {
  max-height: 420px;
}

.empty-state {
  border: 1px dashed #463b35;
  border-radius: 8px;
  color: var(--muted);
  padding: 18px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.settings-grid p,
.settings-grid a {
  color: #d8d0c8;
  line-height: 1.5;
}

.pin-gate {
  position: fixed;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.9)),
    #070807;
  display: grid;
  place-items: center;
  z-index: 20;
  padding: 18px;
}

.pin-gate.hidden {
  display: none;
}

.pin-box {
  width: min(360px, 100%);
  padding: 20px;
  display: grid;
  gap: 13px;
}

.pin-box h2 {
  font-size: 24px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(12, 12, 11, 0.82);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 2px 10px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 7px;
  background:
    linear-gradient(135deg, rgba(185, 39, 45, 0.95), rgba(201, 137, 50, 0.85)),
    linear-gradient(#111, #111);
  box-shadow: 0 0 26px rgba(185, 39, 45, 0.28);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 19px;
}

h2 {
  font-size: 15px;
}

.brand p,
.eyebrow,
.metric span,
label span,
.pill,
.story-list button span,
.scene-card small {
  color: var(--muted);
  font-size: 12px;
}

.panel {
  background: linear-gradient(180deg, rgba(25, 23, 21, 0.96), rgba(16, 16, 15, 0.96));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.form-panel {
  padding: 16px;
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
}

.collapsible-field {
  border: 1px solid #342d29;
  border-radius: 7px;
  background: #0e0e0d;
  padding: 0;
}

.collapsible-field summary,
.scene-more summary {
  cursor: pointer;
  color: #e0c07f;
  font-size: 12px;
  list-style-position: inside;
}

.collapsible-field summary {
  padding: 10px 12px;
}

.collapsible-field label {
  border-top: 1px solid #342d29;
  padding: 11px;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid #3c332f;
  background: #0d0d0c;
  color: var(--text);
  border-radius: 7px;
  padding: 11px 12px;
  outline: none;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(201, 137, 50, 0.14);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.form-actions {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 10px;
}

.primary,
.secondary {
  min-height: 42px;
  border-radius: 7px;
  padding: 0 15px;
  color: #fff;
  transition: transform 0.12s ease, opacity 0.12s ease, background 0.12s ease;
}

.primary {
  background: linear-gradient(135deg, #b9272d, #9f311d);
}

.secondary {
  background: #24201e;
  border: 1px solid #3d332e;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

button:not(:disabled):hover {
  transform: translateY(-1px);
}

.compact {
  padding: 14px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pill {
  border: 1px solid #403833;
  background: #0e0e0d;
  border-radius: 999px;
  padding: 4px 8px;
  white-space: nowrap;
}

.platforms {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 13px;
}

.fan-link {
  border: 1px solid #3a312d;
  border-radius: 7px;
  color: #f0c170;
  display: block;
  padding: 10px 12px;
  text-decoration: none;
  background: #0e0e0d;
}

.platforms span {
  border: 1px solid #3a312d;
  border-radius: 7px;
  padding: 8px 7px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

.story-list,
.submission-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  max-height: 220px;
  overflow: auto;
}

.story-list button,
.submission-list button {
  background: #0e0e0d;
  border: 1px solid #332c28;
  border-radius: 7px;
  color: var(--text);
  text-align: left;
  padding: 10px;
  display: grid;
  gap: 4px;
}

.submission-detail {
  margin-top: 14px;
  color: #d8d0c8;
  line-height: 1.5;
}

.submission-card {
  display: grid;
  gap: 12px;
}

.submission-card p,
.submission-card small {
  color: var(--muted);
}

.submission-card pre {
  white-space: pre-wrap;
  margin: 0;
  background: #0e0e0d;
  border: 1px solid #352d29;
  border-radius: 7px;
  padding: 12px;
  max-height: 260px;
  overflow: auto;
  color: #d8d0c8;
}

.submission-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.fan-page {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.02), rgba(0, 0, 0, 0.82)),
    linear-gradient(145deg, #070807, #19120f 42%, #101b17 74%, #080807);
}

.fan-shell {
  width: min(1080px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 34px 0 56px;
  display: grid;
  gap: 18px;
}

.fan-hero {
  min-height: 260px;
  display: grid;
  align-content: end;
  gap: 10px;
}

.fan-hero-immersive {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid rgba(226, 196, 131, 0.28);
  padding: 40px 0 24px;
}

.fan-hero-immersive::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(7, 8, 7, 0.92), rgba(7, 8, 7, 0.35)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='520' viewBox='0 0 900 520'%3E%3Crect width='900' height='520' fill='%230b0c0b'/%3E%3Cpath d='M0 380 C160 320 260 405 410 335 C570 260 660 330 900 240 L900 520 L0 520 Z' fill='%23182018'/%3E%3Cpath d='M520 120 L820 170 L800 430 L500 430 Z' fill='%2314100e'/%3E%3Cpath d='M565 170 L660 185 L650 300 L558 292 Z' fill='%23202220'/%3E%3Ccircle cx='735' cy='108' r='54' fill='%23b68b45' opacity='.54'/%3E%3Cpath d='M120 455 C180 365 250 365 305 455' stroke='%23674a31' stroke-width='18' fill='none'/%3E%3Ccircle cx='213' cy='452' r='82' fill='%23070807'/%3E%3C/svg%3E");
  background-size: cover;
  background-position: center right;
  opacity: 0.95;
}

.fan-hero-copy,
.fan-steps {
  position: relative;
  z-index: 1;
}

.fan-hero-copy {
  max-width: 720px;
}

.fan-hero h1 {
  font-size: 64px;
  line-height: 0.98;
  max-width: 720px;
}

.fan-hero p:not(.eyebrow) {
  color: #d8d0c8;
  max-width: 620px;
  line-height: 1.5;
}

.fan-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}

.fan-steps span {
  border: 1px solid rgba(226, 196, 131, 0.34);
  background: rgba(14, 14, 13, 0.82);
  border-radius: 7px;
  color: #f0d69a;
  font-size: 12px;
  padding: 8px 10px;
}

.fan-proof-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.fan-proof-grid div {
  min-height: 104px;
  border: 1px solid rgba(226, 196, 131, 0.2);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(29, 24, 21, 0.88), rgba(12, 13, 12, 0.94));
  display: grid;
  align-content: start;
  gap: 7px;
  padding: 14px;
}

.fan-proof-grid strong {
  color: #f0d69a;
}

.fan-proof-grid span {
  color: #bdb2a9;
  font-size: 13px;
  line-height: 1.45;
}

.fan-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}

.fan-form {
  padding: 18px;
  display: grid;
  gap: 14px;
}

.fan-form-featured {
  border-color: rgba(226, 196, 131, 0.28);
}

.fan-form-head {
  display: grid;
  gap: 4px;
}

.fan-form-head strong {
  font-size: 20px;
}

.fan-form-head span {
  color: var(--muted);
  font-size: 13px;
}

.consent-row {
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
}

.consent-row input {
  width: 18px;
  margin-top: 3px;
}

.consent-row span {
  color: #d8d0c8;
  line-height: 1.45;
}

.fan-submit {
  min-height: 48px;
}

.fan-side {
  padding: 18px;
  display: grid;
  gap: 16px;
}

.fan-side h2 {
  font-size: 18px;
}

.fan-info-list {
  display: grid;
  gap: 10px;
}

.fan-info-list div {
  border: 1px solid #332c28;
  border-radius: 7px;
  background: #0e0e0d;
  padding: 12px;
  display: grid;
  gap: 5px;
}

.fan-info-list span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.fan-alert {
  padding: 13px 15px;
  color: #f3eee7;
}

.fan-alert.success {
  border-color: rgba(111, 140, 105, 0.8);
}

.fan-alert.error {
  border-color: rgba(185, 39, 45, 0.85);
}

.workspace {
  padding: 24px;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.topbar h2 {
  font-size: 28px;
  margin-top: 3px;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric {
  background: rgba(25, 23, 21, 0.84);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 6px;
}

.metric strong {
  font-size: 21px;
}

.preview-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.phone-preview,
.story-panel,
.scene-section {
  background: rgba(17, 17, 16, 0.86);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.phone-preview {
  padding: 14px;
}

.phone-frame {
  aspect-ratio: 9 / 16;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.76)),
    linear-gradient(135deg, #17120f, #0a1413 48%, #42161b);
}

.film-layer {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 6px),
    radial-gradient(circle at 50% 32%, rgba(201, 137, 50, 0.18), transparent 36%);
  mix-blend-mode: screen;
}

.phone-copy {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 80px;
  display: grid;
  gap: 12px;
}

.phone-copy span {
  color: #f0c170;
  text-transform: uppercase;
  font-size: 12px;
}

.phone-copy strong {
  font-size: 36px;
  line-height: 1.02;
}

.story-panel {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.logline {
  color: #d8d0c8;
  line-height: 1.55;
}

.asset-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.asset-strip span {
  border: 1px solid #3a312d;
  border-radius: 7px;
  color: #d8d0c8;
  background: #0e0e0d;
  font-size: 12px;
  padding: 7px 9px;
}

.flow-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.flow-step {
  border: 1px solid #3a312d;
  border-radius: 7px;
  background: #0e0e0d;
  padding: 9px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 2px 8px;
  align-items: center;
}

.flow-step span {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #241f1c;
  color: var(--muted);
  font-size: 11px;
  grid-row: span 2;
}

.flow-step strong {
  font-size: 13px;
}

.flow-step small {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.flow-step.done {
  border-color: rgba(111, 140, 105, 0.8);
}

.flow-step.done span {
  background: rgba(111, 140, 105, 0.24);
  color: #d7f2cf;
}

.video-slot {
  min-height: 280px;
  border: 1px dashed #463b35;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--muted);
  overflow: hidden;
}

.video-slot video {
  width: 100%;
  max-height: 560px;
  background: #000;
}

.scene-section {
  margin-top: 16px;
  padding: 18px;
}

.episode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.part-card {
  min-height: 128px;
  background: #11100f;
  border: 1px solid #352d29;
  border-radius: 8px;
  color: var(--text);
  display: grid;
  gap: 7px;
  padding: 12px;
  text-align: left;
}

.part-card span {
  color: var(--amber);
  font-size: 11px;
  text-transform: uppercase;
}

.part-card strong {
  line-height: 1.25;
}

.part-card small {
  color: var(--muted);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.part-card.done {
  border-color: rgba(111, 140, 105, 0.85);
  background: linear-gradient(180deg, rgba(29, 44, 33, 0.9), #11100f);
}

.part-card.current {
  border-color: rgba(201, 137, 50, 0.9);
}

.scene-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.scene-card {
  border: 1px solid #352d29;
  border-radius: 8px;
  background: #11100f;
  overflow: hidden;
}

.scene-thumb {
  height: 150px;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.72)),
    linear-gradient(135deg, #291014, #121d19 58%, #5e3d17);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: end;
  padding: 13px;
}

.scene-thumb strong {
  font-size: 23px;
  line-height: 1.05;
}

.scene-body {
  padding: 12px;
  display: grid;
  gap: 9px;
}

.scene-body p {
  color: #d8d0c8;
  font-size: 13px;
  line-height: 1.45;
}

.prompt {
  color: #bdb2a9;
  font-size: 12px;
  line-height: 1.45;
  padding-top: 8px;
  border-top: 1px solid #302824;
}

.scene-more {
  border-top: 1px solid #302824;
  padding-top: 8px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 6px 9px;
  margin: 10px 0 8px;
}

.detail-grid span {
  color: var(--muted);
  font-size: 12px;
}

.detail-grid strong {
  color: #d8d0c8;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: 360px;
  background: #171513;
  border: 1px solid #4b3e38;
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  color: var(--text);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1080px) {
  .mist-dashboard {
    grid-template-columns: 1fr;
  }

  .mist-nav {
    border-right: 0;
    border-bottom: 1px solid rgba(226, 196, 131, 0.18);
  }

  .split-panel {
    grid-template-columns: 1fr;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .preview-grid {
    grid-template-columns: 1fr;
  }

  .fan-grid {
    grid-template-columns: 1fr;
  }

  .fan-proof-grid {
    grid-template-columns: 1fr;
  }

  .phone-preview {
    max-width: 420px;
  }
}

@media (max-width: 720px) {
  .mist-main,
  .mist-nav {
    padding: 15px;
  }

  .mist-header {
    min-height: 160px;
    align-items: stretch;
    flex-direction: column;
    justify-content: end;
  }

  .mist-header h2 {
    font-size: 32px;
  }

  .workspace,
  .sidebar {
    padding: 15px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .metric-grid,
  .flow-steps,
  .field-grid,
  .form-actions {
    grid-template-columns: 1fr;
  }

  .fan-hero h1 {
    font-size: 38px;
  }
}
