@font-face {
  font-family: "Season Mix";
  src: url("/fonts/SeasonMix-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Mallory Compact";
  src: url("/fonts/MalloryCmpct-Book.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Mallory Compact";
  src: url("/fonts/MalloryCmpct-Medium.otf") format("opentype");
  font-weight: 500 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Mallory Compact";
  src: url("/fonts/MalloryCmpct-Bold.otf") format("opentype");
  font-weight: 700 800;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --background: #000;
  --primary: #fff;
  --secondary: #b7bac0;
  --muted: #8a8d93;
  --frosted: rgba(119, 119, 119, 0.2);
  --frosted-hover: rgba(130, 130, 130, 0.25);
  --line: rgba(255, 255, 255, 0.13);
  --line-strong: rgba(255, 255, 255, 0.23);
  --accent: #bfefff;
  --display: "Season Mix", Devanagari, sans-serif;
  --body: "Mallory Compact", Devanagari, sans-serif;
}

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

html {
  min-width: 320px;
  background: var(--background);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--primary);
  background: var(--background);
  font-family: var(--body);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
}

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

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(191, 239, 255, 0.7);
  outline-offset: 2px;
}

.scene {
  position: fixed;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  background: #000;
}

.scene__image {
  position: absolute;
  inset: 0;
  opacity: 1;
  background-position: 50% 50%;
  background-size: cover;
}

.scene__veil {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(50% 50%, rgba(26, 26, 26, 0.56) 0%, rgb(0, 0, 0) 100%),
    radial-gradient(125% 40% at 50% 0%, rgba(11, 11, 11, 0.66) 0%, rgba(11, 11, 11, 0.22) 45%, rgba(11, 11, 11, 0) 80%);
}

.scene__stars { display: none; }

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: grid;
  min-height: 56px;
  padding: 8px 16px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border-bottom: 1px solid transparent;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.96), rgba(0, 0, 0, 0.76));
  transition: border-color 150ms ease, backdrop-filter 150ms ease;
}

.topbar--scrolled {
  border-bottom-color: rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.87);
  backdrop-filter: blur(20px);
}

.topbar__title { font-size: 16px; }
.topbar__actions {
  display: flex;
  justify-self: end;
  gap: 8px;
}

.topbar__actions .button { min-width: 92px; }

.app-frame {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: calc(100vh - 56px);
  grid-template-columns: clamp(320px, 35vw, 515px) minmax(0, 1fr);
  align-items: start;
}

.library-panel {
  position: sticky;
  z-index: 12;
  top: 56px;
  height: calc(100vh - 56px);
  overflow: hidden;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(4, 5, 8, 0.28);
  backdrop-filter: blur(8px);
}

.library-panel__inner {
  display: flex;
  height: 100%;
  padding: 30px 16px 16px;
  flex-direction: column;
  overflow-y: auto;
}

.library-panel__heading { max-width: 410px; }

.library-panel__heading h1 {
  margin: 8px 0 7px;
  font-family: var(--display);
  font-size: 30px;
  font-weight: 400;
  line-height: 36px;
}

.library-panel__heading > p:last-child {
  max-width: 360px;
  margin: 0;
  color: #aeb1b6;
  font-size: 13px;
  line-height: 18px;
}

.upload-control {
  display: flex;
  width: 100%;
  min-height: 84px;
  margin-top: 28px;
  padding: 16px;
  align-items: center;
  gap: 13px;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(198, 242, 255, 0.11), rgba(255, 255, 255, 0.035) 58%),
    rgba(255, 255, 255, 0.055);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.06);
  text-align: left;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.upload-control:hover {
  border-color: rgba(255, 255, 255, 0.28);
  background:
    linear-gradient(135deg, rgba(198, 242, 255, 0.15), rgba(255, 255, 255, 0.055) 58%),
    rgba(255, 255, 255, 0.075);
  transform: translateY(-1px);
}

.upload-control__icon {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  place-items: center;
  border-radius: 50%;
  color: #131517;
  background: #c6f2ff;
}

.upload-control__icon svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.upload-control strong,
.upload-control small { display: block; }
.upload-control strong { font-size: 14px; font-weight: 500; }
.upload-control small { margin-top: 4px; color: #9da0a5; font-size: 12px; }
.upload-control__copy { min-width: 0; flex: 1; }
.upload-control__cta {
  padding: 5px 8px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  color: #dfe1e4;
  background: rgba(0, 0, 0, 0.2);
  font-size: 10px;
  line-height: 13px;
}

.database-overview {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(4, 5, 8, 0.38);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.045);
}

.database-overview__heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.database-overview__heading > div > span {
  display: block;
  margin-top: 3px;
  color: #85898f;
  font-size: 10px;
}

.database-overview__live {
  display: inline-flex;
  padding: 4px 7px;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(159, 220, 201, 0.18);
  border-radius: 999px;
  color: #bde9dc;
  background: rgba(80, 145, 123, 0.11);
  font-size: 9px;
  line-height: 11px;
  text-transform: uppercase;
}

.database-overview__live i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #9fdcc9;
  box-shadow: 0 0 8px rgba(159, 220, 201, 0.6);
}

.database-overview__count {
  display: flex;
  margin-top: 14px;
  padding: 12px 0;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.database-overview__count span { color: #a8abb0; font-size: 11px; }
.database-overview__count strong {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 400;
  line-height: 28px;
  font-variant-numeric: tabular-nums;
}

.database-overview__times { margin: 0; }
.database-overview__times > div {
  display: grid;
  padding-top: 10px;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 10px;
}
.database-overview__times dt { color: #777b81; font-size: 10px; }
.database-overview__times dd {
  margin: 0;
  color: #d0d2d5;
  font-size: 10px;
  line-height: 14px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.import-status {
  display: flex;
  min-height: 38px;
  padding: 10px 4px;
  align-items: center;
  gap: 8px;
  color: #aeb1b6;
  font-size: 12px;
  line-height: 16px;
}

.import-status__dot {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 50%;
  background: #74777c;
}

.import-status[data-state="ready"] .import-status__dot { background: #9fdcc9; }
.import-status[data-state="loading"] .import-status__dot { background: #c6f2ff; box-shadow: 0 0 12px rgba(198, 242, 255, 0.55); }
.import-status[data-state="error"] { color: #ffc1c1; }
.import-status[data-state="error"] .import-status__dot { background: #ff8e8e; }

.import-progress {
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.import-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #c6f2ff;
  transition: width 180ms ease;
}

.project-search {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.project-search label {
  display: block;
  margin-bottom: 8px;
  color: #bfc2c6;
  font-size: 12px;
}

.project-search__row { display: flex; gap: 8px; }

.project-search input {
  min-width: 0;
  height: 36px;
  padding: 0 11px;
  flex: 1;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 9px;
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.project-search .button { min-height: 36px; padding: 0 16px; }

.project-summary {
  display: flex;
  margin-top: 20px;
  padding: 14px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.055);
}

.project-summary div { min-width: 0; }
.project-summary div span { display: block; color: #85888d; font-size: 10px; text-transform: uppercase; }
.project-summary strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  font-size: 11px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pill {
  padding: 2px 5px;
  flex: 0 0 auto;
  border-radius: 2px;
  color: #fff;
  background: #36383b;
  font-size: 9px;
  line-height: 12px;
  text-transform: uppercase;
}

.library-nav {
  margin-top: auto;
  padding-top: 22px;
}

.library-nav p {
  margin: 0 0 10px;
  color: #aeb1b6;
  font-size: 12px;
  text-align: center;
}

.library-nav__buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.library-nav .button { min-height: 40px; }

button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
  transform: none !important;
}

.icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  cursor: pointer;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  transition: background 140ms ease;
}

.icon-button:hover { background: rgba(255, 255, 255, 0.15); }

.icon-button svg,
.button svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.button {
  display: inline-flex;
  min-height: 28px;
  padding: 0 19px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  border: 0;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  transition: transform 140ms ease, background 140ms ease;
}

.button:hover { transform: translateY(-1px); }
.button--primary { color: #1d1d1d; background: #fff; }
.button--primary:hover { background: #eceeef; }
.button--secondary { border: 1px solid var(--line-strong); background: rgba(255, 255, 255, 0.07); }
.button--large { min-height: 44px; padding: 0 24px; font-size: 16px; }

.page-shell { position: relative; z-index: 1; min-width: 0; min-height: calc(100vh - 56px); }

.dashboard {
  display: flex;
  width: min(955px, 100%);
  margin: 0 auto;
  padding: 32px 16px 16px;
  flex-direction: column;
  gap: 32px;
}

.dashboard[aria-busy="true"] {
  opacity: 0.56;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.story-heading {
  position: relative;
  display: flex;
  min-height: 190px;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  text-align: center;
}

.story-language {
  position: absolute;
  top: 0;
  left: 0;
  padding: 4px 9px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  color: #e9ebee;
  background: rgba(20, 22, 26, 0.58);
  backdrop-filter: blur(16px);
  font-size: 11px;
  font-weight: 500;
  line-height: 16px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.story-heading__status {
  margin: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.story-heading h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 40px;
  font-weight: 400;
  line-height: 46px;
}

.story-heading__premise {
  max-width: 570px;
  margin: 0;
  color: #b7bac0;
  font-size: 14px;
  line-height: 18px;
}

.tags {
  display: flex;
  margin: 0;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.tag {
  padding: 2px 5px;
  border-radius: 2px;
  color: #f1f2f3;
  background: rgba(100, 105, 110, 0.36);
  font-size: 11px;
  line-height: 14px;
  text-transform: uppercase;
}

.story-heading .button {
  min-height: 44px;
  margin-top: 18px;
  padding: 0 25px;
  font-size: 16px;
}

.trailer-card,
.field-card,
.character-card {
  background: var(--frosted);
  backdrop-filter: blur(64px);
}

.trailer-card {
  position: relative;
  display: flex;
  width: 100%;
  height: 248px;
  padding: 16px;
  align-items: flex-start;
  gap: 20px;
  overflow: hidden;
  border-radius: 16px;
}

.trailer-card__art {
  position: relative;
  width: 216px;
  height: 216px;
  flex: 0 0 216px;
  overflow: hidden;
  border-radius: 9px;
  background: #191b1f;
}

.trailer-card__art img { width: 100%; height: 100%; display: block; object-fit: cover; }
.trailer-card__placeholder {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  color: rgba(255, 255, 255, 0.82);
  background: radial-gradient(circle at 35% 25%, rgba(161, 219, 255, 0.36), transparent 40%), linear-gradient(145deg, #26313d, #101318 65%);
  font-family: var(--display);
  font-size: 40px;
}
.trailer-card__caption { display: none; }

.trailer-card__content {
  display: flex;
  min-width: 0;
  height: 216px;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

.trailer-card__heading {
  display: flex;
  height: 32px;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.trailer-card .eyebrow { display: none; }

.trailer-card h2,
.characters-section h2,
.modal h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
}

.trailer-card h2 { font-size: 16px; line-height: 24px; }

.share-button {
  width: auto;
  height: 32px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.14);
  font-size: 12px;
}

.share-button::after { content: "Share trailer"; }
.share-button svg { width: 14px; }

.trailer-card__script {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: #aeb1b6;
  font-size: 12px;
  line-height: 16px;
  white-space: pre-line;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 6;
}

.trailer-card__details { display: none; }

.player {
  display: grid;
  margin-top: auto;
  grid-template-columns: 24px auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.player__button { width: 24px; height: 24px; color: #16181a; background: #c6f2ff; }
.player__button svg { width: 11px; fill: currentColor; stroke: none; }
.player--disabled { opacity: 0.46; }
.player__track-wrap { display: contents; }

.player__track {
  position: relative;
  height: 16px;
  cursor: pointer;
  grid-column: 3;
}

.player__track::before,
.player__progress {
  position: absolute;
  top: 7px;
  left: 0;
  height: 3px;
  border-radius: 999px;
  content: "";
}

.player__track::before { right: 0; background: rgba(255, 255, 255, 0.23); }
.player__progress { width: 0; background: #c6f2ff; }

.player__progress::after {
  position: absolute;
  top: -2px;
  right: -3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c6f2ff;
  content: "";
}

.player__meta { display: contents; color: #c5c7ca; font-size: 11px; font-variant-numeric: tabular-nums; }
.player__meta span:first-child { grid-column: 2; grid-row: 1; }
.player__meta span:last-child { display: none; }
.player__duration { display: none; }

.trailer-speaker {
  width: 128px;
  height: 216px;
  flex: 0 0 128px;
  border-radius: 8px;
  opacity: 0.64;
  background-image: radial-gradient(circle, rgba(0, 0, 0, 0.83) 2px, rgba(255, 255, 255, 0.055) 2.5px, transparent 3px);
  background-size: 9px 9px;
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.45);
}

.story-fields, .characters-section { margin: 0; }

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

.field-card {
  position: relative;
  height: 192px;
  padding: 12px;
  overflow: hidden;
  border-radius: 16px;
  transition: background 150ms ease;
}

.field-card:hover, .character-card:hover { background: var(--frosted-hover); }

.field-card__top {
  display: flex;
  height: 32px;
  margin-bottom: 8px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.field-card__title-wrap { display: flex; align-items: center; }
.field-card__icon { display: none; }

.field-card h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 16px;
  font-weight: 400;
  line-height: 24px;
}

.field-card__body,
.field-card__body--themes {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: #b3b6bb;
  font-size: 12px;
  line-height: 16px;
  white-space: pre-line;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 8;
}

.field-card__body--themes { white-space: normal; }
.theme-chip { display: inline; }
.theme-chip:not(:last-child)::after { content: ", "; }

.card-actions {
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 140ms ease;
}

.field-card:hover .card-actions,
.character-card:hover .card-actions,
.card-actions:focus-within { opacity: 1; }

.card-action {
  display: inline-flex;
  height: 28px;
  padding: 0 9px;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  border: 0;
  border-radius: 999px;
  color: #e0e2e4;
  background: rgba(20, 20, 20, 0.72);
  font-size: 11px;
}

.card-action:hover { background: rgba(35, 35, 35, 0.92); }

.card-action svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.characters-section { display: flex; flex-direction: column; gap: 16px; }
.characters-section h2 { font-size: 16px; line-height: 24px; }

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

.character-card {
  position: relative;
  display: flex;
  width: 100%;
  height: 346px;
  padding: 4px;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
  border-radius: 16px;
  cursor: pointer;
  transition: background 150ms ease;
}

.character-portrait {
  position: relative;
  width: 100%;
  height: 220px;
  flex: 0 0 220px;
  overflow: hidden;
  border-radius: 12px;
  background: #151719;
}

.character-portrait img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: 50% 0%;
}
.character-figure { display: none; }

.character-monogram {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  color: rgba(255, 255, 255, 0.86);
  background: radial-gradient(circle at 34% 22%, rgba(182, 224, 255, 0.24), transparent 35%), linear-gradient(150deg, #293342, #13161b 68%);
  font-family: var(--display);
  font-size: 38px;
}

.character-portrait--2 .character-monogram { background: radial-gradient(circle at 65% 20%, rgba(246, 197, 148, 0.22), transparent 34%), linear-gradient(150deg, #3a2d2b, #171416 68%); }
.character-portrait--3 .character-monogram { background: radial-gradient(circle at 34% 22%, rgba(187, 158, 255, 0.23), transparent 35%), linear-gradient(150deg, #302d42, #14141b 68%); }
.character-portrait--4 .character-monogram { background: radial-gradient(circle at 65% 24%, rgba(160, 229, 196, 0.22), transparent 35%), linear-gradient(150deg, #263832, #131817 68%); }
.character-portrait--5 .character-monogram { background: radial-gradient(circle at 30% 24%, rgba(255, 184, 200, 0.2), transparent 35%), linear-gradient(150deg, #3a2931, #171316 68%); }
.character-portrait--6 .character-monogram { background: radial-gradient(circle at 62% 20%, rgba(255, 224, 150, 0.2), transparent 35%), linear-gradient(150deg, #393329, #171612 68%); }

.characters-empty {
  margin: 0;
  padding: 28px;
  border-radius: 16px;
  color: #aeb1b6;
  background: var(--frosted);
  font-size: 13px;
}

.character-card__content {
  display: flex;
  padding: 0 12px 12px;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}

.character-card__meta { display: flex; align-items: flex-start; flex-direction: column; gap: 8px; }

.character-card h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 16px;
  font-weight: 400;
  line-height: 24px;
}

.role-pill {
  padding: 1px 4px;
  border-radius: 2px;
  color: #fff;
  background: #36383b;
  font-size: 9px;
  line-height: 12px;
  text-transform: uppercase;
}

.character-card__bio {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: #b3b6bb;
  font-size: 12px;
  line-height: 16px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.character-card .card-actions { position: absolute; z-index: 3; top: 12px; right: 12px; }

.loading-state,
.error-state {
  display: flex;
  min-height: 65vh;
  padding: 30px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.loading-state__orb {
  width: 34px;
  height: 34px;
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

.loading-state p, .error-state p { color: var(--secondary); }
.error-state__icon { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; }
.error-state h1 { margin: 16px 0 0; font-family: var(--display); font-weight: 400; }

.modal {
  width: min(626px, calc(100% - 28px));
  max-height: min(84vh, 800px);
  padding: 0;
  overflow: visible;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  color: #fff;
  background: rgba(30, 30, 32, 0.94);
  backdrop-filter: blur(32px);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.72);
}

.modal::backdrop { background: rgba(0, 0, 0, 0.76); backdrop-filter: blur(10px); }
.modal__panel { max-height: min(84vh, 800px); overflow-y: auto; }
.modal__close { position: absolute; z-index: 2; top: 14px; right: 20px; }
.modal > .modal__panel > .eyebrow { margin: 22px 24px 0; }
.modal h2 {
  max-width: none;
  margin: 0;
  padding: 18px 58px 18px 24px;
  border-bottom: 1px solid var(--line);
  font-size: 21px;
  line-height: 26px;
}
.modal > .modal__panel > .eyebrow:not([hidden]) + h2 { padding-top: 8px; }

.modal__body {
  padding: 24px;
  color: #c0c2c6;
  font-size: 14px;
  line-height: 20px;
  white-space: pre-line;
}

.character-detail-layout {
  display: grid;
  grid-template-columns: 243px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
  white-space: normal;
}
.character-detail-layout__identity { display: flex; min-width: 0; flex-direction: column; gap: 16px; }
.character-detail-layout__portrait {
  width: 100%;
  height: 182px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #111214;
  mix-blend-mode: luminosity;
}
.character-detail-layout__portrait img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 0;
}
.character-detail-layout__details {
  display: flex;
  max-height: 60vh;
  padding-right: 8px;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.character-detail-block { display: flex; width: 100%; flex-direction: column; gap: 10px; }
.character-detail-block--divider {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.modal__body .character-detail-block h3 {
  margin: 0;
  color: #aeb1b6;
  font-family: var(--body);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 13px;
  text-transform: uppercase;
}
.modal__body .character-detail-block p {
  margin: 0 0 6px;
  color: #f0f1f2;
  font-size: 13px;
  line-height: 18px;
  letter-spacing: 0.01em;
}
.modal__body .character-detail-block p:last-child { margin-bottom: 0; }
.character-detail-got-it { width: 100%; margin-top: 28px; }

.import-dialog { width: min(560px, calc(100% - 28px)); }
.import-dialog__panel { padding: 24px; }
.import-dialog__heading { padding-right: 14px; }
.import-dialog__heading h2 {
  margin: 8px 0 0;
  padding: 0;
  border: 0;
  font-size: 25px;
  line-height: 30px;
}
.import-dialog__heading > p:last-child {
  margin: 10px 0 0;
  color: #aeb1b6;
  font-size: 13px;
  line-height: 18px;
}
.import-dialog code {
  padding: 1px 4px;
  border-radius: 4px;
  color: #dff8ff;
  background: rgba(191, 239, 255, 0.09);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

.import-mode-list {
  display: grid;
  margin-top: 22px;
  gap: 10px;
}

.import-mode-card {
  position: relative;
  display: grid;
  min-height: 96px;
  padding: 16px;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.045);
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  transition: border-color 140ms ease, background 140ms ease;
}
.import-mode-card:hover { border-color: rgba(255, 255, 255, 0.24); background: rgba(255, 255, 255, 0.065); }
.import-mode-card:has(input:checked) {
  border-color: rgba(191, 239, 255, 0.52);
  background: linear-gradient(135deg, rgba(191, 239, 255, 0.11), rgba(255, 255, 255, 0.045));
  box-shadow: inset 0 0 0 1px rgba(191, 239, 255, 0.05);
}
.import-mode-card input { position: absolute; opacity: 0; pointer-events: none; }
.import-mode-card__indicator {
  position: relative;
  width: 17px;
  height: 17px;
  margin-top: 1px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
}
.import-mode-card input:checked + .import-mode-card__indicator { border-color: #c6f2ff; }
.import-mode-card input:checked + .import-mode-card__indicator::after {
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: #c6f2ff;
  content: "";
}
.import-mode-card strong, .import-mode-card small { display: block; }
.import-mode-card strong { color: #f1f2f3; font-size: 14px; font-weight: 500; }
.import-mode-card small { margin-top: 5px; color: #a2a5aa; font-size: 12px; line-height: 16px; }
.import-mode-card em {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 6px;
  border-radius: 999px;
  color: #bceee0;
  background: rgba(92, 162, 139, 0.13);
  font-size: 9px;
  font-style: normal;
  line-height: 11px;
  text-transform: uppercase;
}
.import-dialog__actions {
  display: flex;
  margin-top: 22px;
  justify-content: flex-end;
  gap: 8px;
}
.import-dialog__actions .button { min-height: 38px; }

.toast {
  position: fixed;
  z-index: 100;
  bottom: 22px;
  left: 50%;
  padding: 9px 14px;
  pointer-events: none;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  opacity: 0;
  color: #eceef0;
  background: rgba(28, 28, 30, 0.96);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  font-size: 12px;
  transform: translate(-50%, 10px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast--visible { opacity: 1; transform: translate(-50%, 0); }

.reveal { opacity: 0; transform: translateY(10px); animation: reveal 550ms ease forwards; }
.trailer-section { animation-delay: 80ms; }
.story-fields { animation-delay: 130ms; }
.characters-section { animation-delay: 180ms; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes reveal { to { opacity: 1; transform: translateY(0); } }

@media (max-width: 820px) {
  .topbar { padding: 8px 12px; }
  .app-frame { display: block; }
  .library-panel {
    position: relative;
    top: auto;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  }
  .library-panel__inner { height: auto; padding: 22px 16px 18px; overflow: visible; }
  .library-panel__heading h1 { font-size: 26px; line-height: 32px; }
  .upload-control { margin-top: 20px; }
  .library-nav { margin-top: 20px; }
  .dashboard { padding-top: 56px; }
  .story-heading { min-height: 0; margin-bottom: 8px; }
  .trailer-card { height: auto; flex-wrap: wrap; }
  .trailer-card__art { width: 180px; height: 180px; flex-basis: 180px; order: 1; }
  .trailer-speaker { display: block; width: 130px; height: 180px; flex-basis: 130px; order: 2; }
  .trailer-card__content { height: 216px; flex-basis: 100%; order: 3; }
}

@media (max-width: 640px) {
  .dashboard { padding: 52px 14px 24px; gap: 24px; }
  .story-heading h1 { font-size: 36px; line-height: 42px; }
  .story-heading__premise { max-width: 520px; font-size: 13px; line-height: 17px; }
  .story-language { position: static; align-self: flex-start; margin-bottom: -4px; }
  .trailer-card { gap: 16px; }
  .share-button { width: 30px; padding: 0; justify-content: center; }
  .share-button::after { display: none; }
  .trailer-card__script { -webkit-line-clamp: 5; }
  .field-grid { grid-template-columns: 1fr; }
  .character-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .character-card { height: 310px; }
  .character-portrait { height: 190px; flex-basis: 190px; }
  .character-card .card-actions, .field-card .card-actions { opacity: 1; }
  .card-action span { display: none; }
  .card-action { width: 28px; padding: 0; justify-content: center; }
  .modal__body { padding: 20px; }
  .character-detail-layout { grid-template-columns: 1fr; gap: 22px; }
  .character-detail-layout__portrait { height: 230px; }
  .character-detail-layout__details { max-height: none; padding-right: 0; }
}

@media (max-width: 420px) {
  .topbar__actions .button { min-width: 0; padding: 0 14px; }
  .upload-control__cta { display: none; }
  .database-overview__times > div { grid-template-columns: 1fr; gap: 3px; }
  .database-overview__times dd { text-align: left; }
  .import-dialog__panel { padding: 20px; }
  .import-dialog__heading h2 { font-size: 22px; line-height: 27px; }
  .import-dialog__actions { display: grid; grid-template-columns: 1fr 1fr; }
  .character-grid { gap: 10px; }
  .character-card { height: 282px; gap: 12px; }
  .character-portrait { height: 164px; flex-basis: 164px; }
  .character-card__content { padding: 0 9px 9px; }
  .character-card h3 { font-size: 14px; line-height: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
