:root {
  --ink: #221018;
  --plum: #2c0f26;
  --wine: #722343;
  --rose: #d5a0ad;
  --blush: #f1d9da;
  --paper: #f6eee3;
  --cream: #fffaf3;
  --gold: #d4b06a;
  --line: rgba(44, 15, 38, 0.16);
  --sans: "DM Sans", sans-serif;
  --serif: "Playfair Display", Georgia, serif;
}

* { box-sizing: border-box; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; }
[hidden] { display: none !important; }
body { background: var(--plum); color: var(--ink); font-family: var(--sans); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.95' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.45'/%3E%3C/svg%3E");
}

.minimal-page {
  height: 100svh;
  min-height: 620px;
  display: grid;
  grid-template-rows: 76px 1fr 64px;
  color: var(--cream);
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 52%, rgba(129, 51, 83, 0.82), transparent 36%),
    linear-gradient(145deg, #160b12 0%, #2c0f26 48%, #45162f 100%);
}

.minimal-header,
.minimal-footer {
  position: relative;
  z-index: 5;
  padding-inline: clamp(24px, 5vw, 76px);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.minimal-header { padding-top: 4px; }
.wordmark { font: 600 29px/1 var(--serif); letter-spacing: -1.2px; }
.star { color: var(--gold); font: 13px/1 var(--sans); margin-left: 7px; vertical-align: top; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.library-link { min-height: 38px; border: 1px solid rgba(255,255,255,.2); border-radius: 999px; background: rgba(255,255,255,.06); color: rgba(255,250,243,.82); padding: 7px 13px; font-size: 10px; }
.library-link:hover { border-color: rgba(255,255,255,.38); background: rgba(255,255,255,.1); }
.age-mark { font-size: 10px; letter-spacing: 1.8px; color: rgba(255, 250, 243, 0.52); border: 1px solid rgba(255,255,255,.2); border-radius: 999px; padding: 7px 9px; }

.minimal-main { position: relative; display: grid; place-items: center; isolation: isolate; }
.ambient { position: absolute; border-radius: 50%; filter: blur(2px); z-index: -2; }
.ambient-one { width: min(56vw, 740px); aspect-ratio: 1; background: radial-gradient(circle at 38% 28%, rgba(199, 113, 139, .7), rgba(90, 27, 59, .35) 54%, transparent 72%); transform-origin: center; animation: sphere-breathe 10s cubic-bezier(.45, 0, .55, 1) infinite; will-change: transform, opacity; }
.ambient-two { width: min(42vw, 560px); aspect-ratio: 1; right: -12%; bottom: -35%; background: radial-gradient(circle, rgba(153, 64, 94, .48), transparent 68%); }
.gold-thread { position: absolute; inset: 0; width: 100%; height: 100%; fill: none; stroke: var(--gold); stroke-width: 1.15; opacity: .5; z-index: -1; }
.gold-thread path { animation: thread-glow 8s cubic-bezier(.45, 0, .55, 1) infinite; }

@keyframes sphere-breathe {
  0%, 100% { transform: scale(.965); opacity: .86; }
  50% { transform: scale(1.045); opacity: 1; }
}

@keyframes thread-glow {
  0%, 100% { opacity: .72; }
  50% { opacity: 1; }
}

.minimal-copy { text-align: center; width: min(880px, calc(100% - 48px)); margin-top: -14px; }
.minimal-kicker { margin: 0 0 22px; color: var(--rose); font-size: 10px; font-weight: 600; letter-spacing: 2.8px; text-transform: uppercase; }
.minimal-copy h1 { margin: 0; font: 500 clamp(55px, 7vw, 96px)/.96 var(--serif); letter-spacing: -4px; }
.minimal-copy h1 em { color: #efb9c5; font-weight: 500; }
.minimal-lede { margin: 25px auto 31px; color: rgba(255,250,243,.7); font-size: clamp(15px, 1.5vw, 18px); line-height: 1.65; }
.primary-action { border: 0; border-radius: 999px; padding: 16px 24px; background: var(--gold); color: #251217; font-weight: 600; box-shadow: 0 14px 42px rgba(0,0,0,.25); transition: transform .2s ease, background .2s ease; }
.primary-action span { margin-left: 24px; }
.primary-action:hover { background: #e1c17e; transform: translateY(-2px); }
.input-hint { margin: 18px 0 0; color: rgba(255,250,243,.4); font-size: 9px; letter-spacing: 1.3px; text-transform: uppercase; }

.floating-note { position: absolute; z-index: 1; max-width: 220px; padding: 12px 15px; border: 1px solid rgba(255,255,255,.13); border-radius: 17px; background: rgba(255,255,255,.1); box-shadow: 0 16px 38px rgba(0,0,0,.18); backdrop-filter: blur(12px); color: rgba(255,250,243,.82); font-size: 11px; }
.floating-note small, .floating-note span { display: block; }
.floating-note small { color: rgba(255,255,255,.42); font-size: 7px; margin-bottom: 4px; }
.note-one { left: 9%; top: 23%; transform: rotate(-3deg); }
.note-two { right: 8%; bottom: 20%; transform: rotate(3deg); background: rgba(114,35,67,.68); }
.note-two small { text-align: right; margin: 4px 0 0; }

.minimal-footer { color: rgba(255,250,243,.44); font-size: 9px; letter-spacing: .8px; text-transform: uppercase; }
.minimal-footer nav { display: flex; gap: 26px; }
.minimal-footer button { border: 0; background: transparent; color: rgba(255,250,243,.62); padding: 8px 0; font-size: 10px; }
.minimal-footer button:hover { color: var(--cream); }

.app-page {
  min-height: 100svh;
  color: var(--cream);
  background:
    radial-gradient(circle at 86% 0%, rgba(126, 45, 80, .35), transparent 32%),
    linear-gradient(150deg, #160b12 0%, #240d1e 54%, #321027 100%);
}
.app-header {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 clamp(22px, 5vw, 72px);
  border-bottom: 1px solid rgba(255,255,255,.1);
  background: rgba(22, 11, 18, .55);
  backdrop-filter: blur(16px);
}
.app-header-actions { display: flex; align-items: center; gap: 12px; }
.app-header .button { min-height: 42px; padding: 11px 17px; font-size: 11px; }
.app-header .button span { margin-left: 12px; }
.app-account { border: 0; background: transparent; color: rgba(255,247,237,.58); padding: 10px; font-size: 10px; }
.app-account:hover { color: var(--cream); }
.app-main { width: min(1180px, calc(100% - 44px)); margin: 0 auto; padding: clamp(52px, 8vw, 96px) 0 80px; }
.app-welcome { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(260px, .6fr); gap: clamp(32px, 8vw, 110px); align-items: end; }
.app-welcome h1 { margin: 0; font: 500 clamp(50px, 7vw, 86px)/.98 var(--serif); letter-spacing: -3.6px; }
.app-welcome > p { max-width: 390px; margin: 0 0 8px; color: rgba(255,247,237,.62); font-size: 14px; line-height: 1.75; }
.app-library { margin-top: clamp(60px, 9vw, 104px); }
.app-library-heading { display: flex; justify-content: space-between; gap: 20px; align-items: end; padding-bottom: 18px; border-bottom: 1px solid rgba(255,255,255,.12); }
.app-section-label { margin: 0 0 9px; color: var(--rose); font-size: 9px; font-weight: 600; letter-spacing: 1.8px; text-transform: uppercase; }
.app-library h2 { margin: 0; font: 500 clamp(32px, 5vw, 48px)/1 var(--serif); }
.app-library .story-library-list { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 22px; }
.app-library .story-card { min-height: 210px; background: linear-gradient(145deg, rgba(255,255,255,.07), rgba(255,255,255,.035)); }
.app-library .story-card b { font-size: clamp(22px, 2.5vw, 29px); }
.app-library .story-library-empty { min-height: 260px; display: grid; place-items: center; align-content: center; gap: 12px; padding: 36px; }
.story-library-empty b { font: 500 clamp(26px, 4vw, 38px)/1.1 var(--serif); color: #fff7ed; }
.story-library-empty p { max-width: 430px; margin: 0 0 10px; line-height: 1.65; }

.kicker { color: var(--wine); margin: 0 0 17px; text-transform: uppercase; letter-spacing: 2.5px; font-size: 10px; font-weight: 600; }
.button { border: 0; border-radius: 999px; padding: 16px 24px; font-weight: 600; }
.button span { margin-left: 22px; }
.button-gold { background: var(--gold); color: #251217; }
.button-dark { background: var(--plum); color: white; }
.generate-story.is-loading { display: inline-flex; align-items: center; justify-content: center; }
.button .loading-dots { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; }
.loading-dots i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: .35; animation: loadingDot 1.05s ease-in-out infinite; }
.loading-dots i:nth-child(2) { animation-delay: .14s; }
.loading-dots i:nth-child(3) { animation-delay: .28s; }

@keyframes loadingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: .35; }
  30% { transform: translateY(-5px); opacity: 1; }
}

.info-dialog { width: min(570px, calc(100% - 32px)); max-height: calc(100svh - 32px); border: 1px solid rgba(255,255,255,.14); padding: clamp(34px, 6vw, 60px); background: var(--cream); color: var(--ink); box-shadow: 0 35px 90px rgba(0,0,0,.4); }
.info-dialog::backdrop { background: rgba(18,7,13,.78); backdrop-filter: blur(9px); }
.close-info { position: absolute; right: 21px; top: 17px; border: 0; background: transparent; font-size: 28px; color: #755d66; }
.info-dialog h2 { margin: 0 0 26px; font: 500 clamp(37px, 5vw, 50px)/1.08 var(--serif); letter-spacing: -2px; }
.info-dialog > p:not(.minimal-kicker, .fiction-note) { color: #705a62; font-size: 13px; line-height: 1.75; }
.info-dialog ol { margin: 8px 0 30px; padding: 0; list-style: none; }
.info-dialog li { display: grid; grid-template-columns: 34px 1fr; gap: 14px; padding: 16px 0; border-top: 1px solid var(--line); }
.info-dialog li > span { color: var(--wine); font-size: 9px; padding-top: 4px; }
.info-dialog li p { margin: 0; color: #715b63; font-size: 12px; line-height: 1.55; }
.info-dialog li b { color: var(--ink); }
.fiction-note { margin-top: 25px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--wine); font: italic 15px/1.5 var(--serif); }
.info-start { display: block; margin: 0 auto; }

.story-flow { width: 100vw; height: 100vh; max-width: none; max-height: none; border: 0; padding: 0; background: rgba(16,7,12,.8); color: var(--ink); }
.story-flow::backdrop { background: rgba(16,7,12,.78); backdrop-filter: blur(8px); }
.flow-shell { min-height: 100vh; width: min(100%, 930px); margin-left: auto; background: var(--cream); position: relative; }
.flow-header { height: 78px; padding: 0 36px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.flow-progress { display: flex; gap: 6px; }
.flow-progress span { width: 38px; height: 2px; background: #decfd0; }
.flow-progress span.active { background: var(--wine); }
.close-flow { width: 44px; height: 44px; border: 0; background: transparent; font-size: 30px; font-weight: 300; }
.flow-step { display: none; max-width: 690px; margin: 0 auto; padding: 62px 32px 50px; }
.flow-step.active { display: block; animation: stepIn .36s ease; }
@keyframes stepIn { from { opacity: 0; transform: translateY(8px); } }
.flow-copy h2 { font: 500 clamp(39px, 5vw, 59px)/1.05 var(--serif); margin: 0; }
.flow-copy > p:last-child { color: #826d73; line-height: 1.6; }
.import-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; margin-top: 30px; }
.import-option { min-height: 88px; border: 1px solid var(--line); background: white; padding: 17px; display: grid; grid-template-columns: 37px 1fr 22px; align-items: center; text-align: left; gap: 12px; }
.import-option.selected { border-color: var(--wine); box-shadow: 0 0 0 1px var(--wine); }
.import-icon { width: 35px; height: 35px; background: var(--paper); display: grid; place-items: center; font-family: var(--serif); color: var(--wine); }
.import-option b, .import-option small { display: block; }
.import-option b { font-size: 13px; }
.import-option small { color: #8e777e; margin-top: 5px; font-size: 10px; }
.import-option i { color: var(--wine); font-style: normal; opacity: 0; }
.import-option.selected i { opacity: 1; }
.demo-chat-label { display: block; margin: 27px 0 9px; font-size: 11px; font-weight: 600; }
#demoChat { width: 100%; resize: vertical; border: 1px solid var(--line); background: #fbf4ed; padding: 16px; line-height: 1.65; color: var(--ink); }
.input-panel { margin-top: 24px; }
.input-panel[hidden] { display: none; }
.file-drop { min-height: 150px; border: 1px dashed #b99ba4; background: #fbf4ed; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; cursor: pointer; }
.file-drop:hover { border-color: var(--wine); background: #f8ede7; }
.file-drop input { position: absolute; inline-size: 1px; block-size: 1px; opacity: 0; }
.file-drop-icon { min-width: 38px; height: 38px; padding: 0 8px; display: grid; place-items: center; background: var(--plum); color: white; font: 600 10px var(--sans); margin-bottom: 13px; }
.file-drop b { font-size: 13px; }
.file-drop small { color: #8e777e; margin-top: 6px; font-size: 10px; }
.screenshot-toolbar { margin-top: 14px; display: flex; align-items: center; justify-content: space-between; }
.screenshot-toolbar[hidden] { display: none; }
.screenshot-toolbar span { color: #6f5961; font-size: 10px; }
.screenshot-toolbar button { border: 0; background: transparent; color: var(--wine); padding: 5px 0; font-size: 10px; font-weight: 600; }
.screenshot-preview { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.screenshot-preview:empty { display: none; }
.screenshot-thumb { aspect-ratio: 3 / 4; position: relative; overflow: hidden; background: var(--paper); border: 1px solid var(--line); }
.screenshot-open { width: 100%; height: 100%; border: 0; padding: 0; background: transparent; color: white; }
.screenshot-open img { width: 100%; height: 100%; object-fit: cover; }
.screenshot-open span { position: absolute; left: 6px; bottom: 6px; min-width: 20px; height: 20px; padding: 0 5px; display: grid; place-items: center; background: rgba(22,9,19,.88); color: white; font-size: 8px; }
.screenshot-open small { position: absolute; right: 7px; bottom: 8px; color: white; font-size: 8px; text-shadow: 0 1px 7px rgba(0,0,0,.8); }
.screenshot-remove { position: absolute; right: 6px; top: 6px; width: 44px; height: 44px; min-width: 44px; min-height: 44px; border: 1px solid rgba(255,255,255,.28); border-radius: 50%; background: rgba(22,9,19,.82); color: white; line-height: 1; }
.screenshot-status { min-height: 15px; margin: 9px 0 0; color: #7b676e; font-size: 9px; }
.screenshot-names { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0 0; padding: 14px; border: 1px solid rgba(255,255,255,.13); }
.screenshot-names legend { padding: 0 5px; color: #fff7ed; font-size: 10px; font-weight: 600; }
.screenshot-names label { color: rgba(255,247,237,.6); font-size: 9px; }
.screenshot-names input { width: 100%; min-height: 44px; margin-top: 6px; border: 1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.05); color: #fff7ed; padding: 10px; }
.screenshot-names small { grid-column: 1 / -1; color: rgba(255,247,237,.5); font-size: 9px; line-height: 1.4; }
.screenshot-lightbox { position: fixed; inset: 0; z-index: 20; display: grid; grid-template-rows: 1fr auto; gap: 18px; padding: 48px clamp(20px, 5vw, 64px) 28px; background: rgba(12, 4, 10, .96); backdrop-filter: blur(14px); }
.screenshot-lightbox[hidden] { display: none; }
.lightbox-close { position: absolute; right: 22px; top: 15px; border: 0; background: transparent; color: white; font-size: 32px; }
.lightbox-stage { min-height: 0; display: grid; place-items: center; }
.lightbox-stage img { display: block; max-width: 100%; max-height: calc(100vh - 150px); object-fit: contain; box-shadow: 0 25px 70px rgba(0,0,0,.45); }
.lightbox-controls { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto 42px; gap: 12px; align-items: center; width: min(760px, 100%); margin: 0 auto; }
.lightbox-nav { width: 42px; height: 42px; border: 1px solid rgba(255,255,255,.18); border-radius: 50%; background: rgba(255,255,255,.06); color: white; }
.lightbox-details { min-width: 0; }
.lightbox-details b, .lightbox-details span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox-details b { color: #fff7ed; font-size: 11px; }
.lightbox-details span { margin-top: 4px; color: rgba(255,247,237,.48); font-size: 9px; }
.lightbox-delete { border: 0; background: transparent; color: #efb9c5; padding: 10px; font-size: 10px; }
.txt-preview { margin-top: 12px; max-height: 145px; overflow: auto; padding: 14px; background: var(--paper); color: #6f5961; font: 11px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; }
.txt-preview:empty { display: none; }
.analysis-status { min-height: 18px; margin: 15px 0 -10px; color: rgba(255,247,237,.58); font-size: 10px; line-height: 1.5; }
.analysis-status:empty { margin-top: 0; }
.analysis-status.error { color: #ffbdc8; }
.analyze-chat.analyzing { position: relative; padding-left: 48px; }
.analyze-chat.analyzing::before { content: ""; position: absolute; left: 22px; top: 50%; width: 14px; height: 14px; margin-top: -8px; border: 2px solid rgba(44,15,38,.25); border-top-color: var(--plum); border-radius: 50%; animation: analysisSpin .8s linear infinite; }
@keyframes analysisSpin { to { transform: rotate(360deg); } }
.flow-actions { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.flow-actions > span { color: #917a81; font-size: 10px; }
.back-step { border: 0; background: transparent; color: #7d686f; }
.character-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 30px; }
.analysis-summary { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 25px; padding: 13px 15px; border: 1px solid rgba(239,185,197,.24); background: rgba(239,185,197,.08); }
.analysis-summary strong, .analysis-summary span { display: block; }
.analysis-summary strong { color: #fff7ed; font-size: 11px; }
.analysis-summary span { margin-top: 4px; color: rgba(255,247,237,.58); font-size: 9px; }
.analysis-summary button { flex: 0 0 auto; min-height: 36px; border: 1px solid rgba(239,185,197,.32); border-radius: 999px; background: transparent; color: #ffd8e0; padding: 7px 12px; font-size: 9px; }
.participant-picker { display: grid; grid-template-columns: minmax(180px, 1.3fr) 1fr 1fr; gap: 12px; align-items: end; margin-top: 12px; padding: 15px; border: 1px solid rgba(239,185,197,.24); background: rgba(255,255,255,.045); }
.participant-picker[hidden] { display: none; }
.participant-picker strong, .participant-picker span { display: block; }
.participant-picker strong { color: #fff7ed; font-size: 11px; }
.participant-picker span { margin-top: 5px; color: rgba(255,247,237,.58); font-size: 9px; line-height: 1.45; }
.participant-picker label { color: var(--rose); font-size: 8px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; }
.participant-picker select { width: 100%; margin-top: 7px; border: 1px solid rgba(255,255,255,.18); border-radius: 0; background: #351128; color: #fff7ed; padding: 10px 34px 10px 10px; font-size: 11px; }
.character-card { position: relative; border: 1px solid var(--line); background: white; padding: 21px; }
.character-number { position: absolute; right: 18px; top: 17px; color: #b99ea5; font-size: 9px; }
.character-card label { display: block; color: var(--wine); font-size: 9px; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; }
.character-card input { width: calc(100% - 28px); margin-top: 5px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); font: 500 25px/1.4 var(--serif); }
.character-card .pronoun-label { margin-top: 15px; color: rgba(255,247,237,.46); font-size: 8px; }
.pronoun-select { width: 100%; margin-top: 5px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; color: #fff7ed; padding: 7px 0; font-size: 11px; }
.pronoun-select option { color: #251217; }
.character-card ul { margin: 17px 0 0; padding-left: 17px; color: #746067; font-size: 11px; line-height: 1.8; }
.shared-details { margin-top: 25px; }
.shared-details > label { display: block; font-size: 11px; font-weight: 600; margin-bottom: 11px; }
.fact-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.fact-tag { display: inline-flex; align-items: center; gap: 7px; border: 1px solid #caa0aa; border-radius: 999px; background: #f2dfe0; padding: 7px 8px 7px 13px; color: var(--wine); font-size: 10px; }
.fact-tag button { width: 44px; height: 44px; min-width: 44px; min-height: 44px; border: 0; border-radius: 50%; background: rgba(114,35,67,.1); color: inherit; line-height: 1; }
.add-detail-form { display: flex; gap: 8px; margin-top: 13px; }
.add-detail-form input { flex: 1; min-width: 0; border: 1px solid var(--line); background: transparent; padding: 10px 12px; color: var(--ink); font-size: 11px; }
.add-detail-form button { border: 0; border-radius: 999px; background: var(--wine); color: white; padding: 10px 15px; font-size: 10px; font-weight: 600; }
.context-note { margin-top: 27px; padding: 16px; border-left: 2px solid var(--gold); background: var(--paper); }
.context-note span { color: var(--wine); font-size: 9px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; }
.context-note p { margin: 6px 0 0; color: #725d64; font-size: 11px; line-height: 1.55; }
.choice-group { margin-top: 28px; }
.choice-group label { display: block; font-size: 11px; font-weight: 600; margin-bottom: 11px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips button { border: 1px solid #d5c4c5; background: transparent; border-radius: 999px; padding: 11px 17px; font-size: 12px; }
.chips button.selected { background: var(--wine); border-color: var(--wine); color: white; }
.custom-choice-input { width: 100%; margin-top: 11px; border: 1px solid var(--line); background: transparent; color: var(--ink); padding: 12px 14px; font-size: 12px; }
.persona-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.persona-choice { padding: 18px; border: 1px solid var(--line); background: var(--paper); }
.persona-choice > small { display: block; margin: -4px 0 13px; color: #7b676e; font-size: 9px; line-height: 1.45; }
.persona-choice .chips button { padding: 9px 12px; font-size: 10px; }
.boundary-box { margin-top: 32px; padding: 16px; background: var(--paper); display: flex; gap: 14px; align-items: flex-start; }
.boundary-box span { background: var(--plum); color: white; padding: 4px 6px; font-size: 9px; }
.boundary-box p { margin: 0; color: #725d64; font-size: 11px; line-height: 1.55; }
.seed-list { display: grid; gap: 11px; margin-top: 30px; }
.seed { border: 1px solid var(--line); background: white; padding: 20px; display: grid; grid-template-columns: 35px 1fr 20px; gap: 15px; text-align: left; }
.seed.selected { border-color: var(--wine); box-shadow: 0 0 0 1px var(--wine); }
.seed > span { color: var(--wine); font-size: 10px; }
.seed b { font: 500 19px var(--serif); }
.seed p { color: #7b676e; font-size: 12px; line-height: 1.5; margin: 8px 0; }
.seed small { color: var(--wine); text-transform: uppercase; letter-spacing: 1px; font-size: 8px; }
.seed i { opacity: 0; color: var(--wine); font-style: normal; }
.seed.selected i { opacity: 1; }
.custom-scenario { display: block; margin-top: 17px; padding: 18px; border: 1px solid var(--line); background: #fbf4ed; transition: border-color .2s ease, box-shadow .2s ease; }
.custom-scenario.active { border-color: var(--wine); box-shadow: 0 0 0 1px var(--wine); }
.custom-scenario > span { display: block; margin-bottom: 10px; color: var(--wine); font-size: 10px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; }
.custom-scenario textarea { width: 100%; resize: vertical; border: 0; background: transparent; color: var(--ink); font: 13px/1.55 var(--sans); }
.custom-scenario textarea:focus { outline: 0; }
.chapter-step { max-width: 740px; padding-top: 35px; }
.chapter-page { position: relative; background: #f8efe4; padding: 55px clamp(32px, 7vw, 80px); min-height: 900px; box-shadow: 0 20px 60px rgba(44,15,38,.12); }
.chapter-label { text-align: center; text-transform: uppercase; letter-spacing: 2px; color: var(--wine); font-size: 9px; }
.chapter-page h2 { text-align: center; font: 500 45px/1.1 var(--serif); margin: 19px auto; }
.chapter-ornament { text-align: center; color: var(--gold); margin-bottom: 26px; }
.narration-player { display: grid; grid-template-columns: auto minmax(105px, 1fr) minmax(150px, .9fr) 74px auto; gap: 12px; align-items: center; margin: 0 0 34px; padding: 12px; border: 1px solid rgba(255,255,255,.12); border-radius: 16px; background: rgba(255,255,255,.055); }
.narration-player[hidden] { display: none; }
.narration-toggle { min-width: 92px; min-height: 44px; border: 0; border-radius: 999px; background: var(--gold); color: #251217; font-size: 11px; font-weight: 700; }
.narration-icon { display: inline-block; margin-right: 7px; font-size: 9px; }
.narration-meta { min-width: 0; }
.narration-meta b, .narration-meta span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.narration-meta b { color: #fff7ed; font-size: 10px; }
.narration-meta span { margin-top: 4px; color: rgba(255,247,237,.5); font-size: 8px; }
.narration-select { display: grid; gap: 4px; color: rgba(255,247,237,.45); font-size: 8px; text-transform: uppercase; letter-spacing: .7px; }
.narration-select select { width: 100%; min-height: 44px; border: 0; border-bottom: 1px solid rgba(255,255,255,.16); border-radius: 0; background: transparent; color: #fff7ed; font-size: 10px; text-transform: none; letter-spacing: 0; }
.narration-select select option { color: #251217; }
.narration-restart { width: 44px; height: 44px; border: 1px solid rgba(255,255,255,.14); border-radius: 50%; background: transparent; color: rgba(255,247,237,.72); font-size: 18px; }
.narration-support { margin: 0 0 28px; text-align: center; color: rgba(255,247,237,.5); font-size: 10px; }
.chapter-pages { min-height: 540px; }
.chapter-page-copy { max-width: 560px; margin-inline: auto; animation: pageTurn .35s ease; }
.chapter-page-copy p { border-radius: 8px; font: 16.5px/1.78 var(--serif); color: #4f3e44; margin: 0 0 27px; transition: color .25s ease, background .25s ease, box-shadow .25s ease; }
.chapter-page-copy p.speaking { color: #fff7ed; background: rgba(212,176,106,.1); box-shadow: 0 0 0 7px rgba(212,176,106,.1); }
.chapter-page-copy p:last-child { margin-bottom: 0; }
@keyframes pageTurn { from { opacity: 0; transform: translateY(6px); } }
.dropcap::first-letter { float: left; font: 600 62px/.78 var(--serif); margin: 10px 9px 0 0; color: var(--wine); }
.chapter-pagination { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: center; margin-top: 34px; padding-top: 20px; border-top: 1px solid var(--line); }
.chapter-pagination button { border: 0; background: transparent; color: var(--wine); padding: 9px 0; font-size: 10px; font-weight: 600; }
.chapter-pagination button:last-child { text-align: right; }
.chapter-pagination button:disabled { opacity: .3; cursor: default; }
.chapter-pagination span { color: #8c747b; font-size: 9px; letter-spacing: 1px; text-transform: uppercase; }
.cliffhanger-fade { height: 80px; margin-top: -62px; position: relative; background: linear-gradient(transparent, #f8efe4); }
.unlock-card { position: relative; text-align: center; padding: 36px 32px; background: var(--plum); color: white; }
.unlock-card > span { color: var(--gold); }
.unlock-card h3 { font: 500 26px/1.25 var(--serif); margin: 14px 0; }
.unlock-card p { color: rgba(255,255,255,.66); font-size: 12px; line-height: 1.6; max-width: 440px; margin: 0 auto 21px; }
.unlock-card .button { display: block; margin: 0 auto 11px; }
.unlock-card small { color: rgba(255,255,255,.4); font-size: 9px; }
.restart-flow { display: block; min-height: 44px; border: 0; background: transparent; color: #7a666d; margin: 20px auto; padding: 10px 14px; }
.toast { position: fixed; left: 50%; bottom: 25px; transform: translate(-50%, 120px); background: #1e0f16; color: white; border: 1px solid rgba(255,255,255,.1); padding: 13px 19px; font-size: 11px; z-index: 60; transition: transform .3s ease; box-shadow: 0 15px 40px rgba(0,0,0,.25); }
.toast.show { transform: translate(-50%, 0); }

/* Nellora dark theme */
.story-flow,
.info-dialog {
  --ink: #fff7ed;
  --wine: #efb9c5;
  --paper: rgba(255, 255, 255, .055);
  --cream: #2c0f26;
  --line: rgba(255, 255, 255, .14);
}

.info-dialog {
  background: linear-gradient(150deg, #230d1e 0%, #36102b 100%);
  color: #fff7ed;
}
.close-info,
.info-dialog > p:not(.minimal-kicker, .fiction-note),
.info-dialog li p { color: rgba(255, 247, 237, .66); }
.info-dialog li b { color: #fff7ed; }
.info-dialog .minimal-kicker,
.info-dialog .fiction-note { color: var(--rose); }

.story-flow { color: #fff7ed; }
.story-flow button,
.story-flow input,
.story-flow textarea { color: inherit; }
.flow-shell {
  background:
    radial-gradient(circle at 75% 18%, rgba(126, 45, 80, .32), transparent 34%),
    linear-gradient(145deg, #1d0b18 0%, #2c0f26 54%, #391129 100%);
}
.flow-header { border-color: rgba(255, 255, 255, .12); }
.flow-progress span { background: rgba(255, 255, 255, .18); }
.flow-progress span.active { background: var(--rose); }
.close-flow { color: #fff7ed; }
.kicker { color: var(--rose); }
.flow-copy > p:last-child,
.import-option small,
.file-drop small,
.flow-actions > span,
.back-step,
.character-card ul,
.context-note p,
.seed p,
.boundary-box p { color: rgba(255, 247, 237, .72); }
.import-option b,
.file-drop b,
.demo-chat-label,
.character-card input,
.shared-details > label,
.choice-group label,
.seed b { color: #fff7ed; }
.import-option,
.character-card,
.seed { background: rgba(255, 255, 255, .07); }
.import-option.selected,
.seed.selected { border-color: var(--rose); box-shadow: 0 0 0 1px var(--rose); }
.import-icon { background: rgba(255, 255, 255, .1); color: #ffd8e0; }
#demoChat,
.file-drop,
.custom-scenario { background: rgba(255, 255, 255, .045); color: #fff7ed; }
.file-drop:hover { background: rgba(255, 255, 255, .075); border-color: var(--rose); }
.file-drop-icon { background: var(--gold); color: var(--plum); }
.txt-preview { background: rgba(255, 255, 255, .06); color: rgba(255, 247, 237, .68); }
.screenshot-toolbar span,
.screenshot-status { color: rgba(255, 247, 237, .56); }
.screenshot-toolbar button { color: var(--rose); }
.character-number { color: rgba(255, 247, 237, .4); }
.character-card label,
.context-note span,
.custom-scenario > span { color: var(--rose); }
.character-card input { color: #fff7ed; }
.chips button { border-color: rgba(255, 255, 255, .22); color: rgba(255, 247, 237, .76); }
.fact-tag { border-color: rgba(239, 185, 197, .55); background: rgba(239, 185, 197, .16); color: #ffd8e0; }
.fact-tag button { background: rgba(255,255,255,.08); }
.add-detail-form input { border-color: rgba(255,255,255,.18); color: #fff7ed; }
.add-detail-form input::placeholder { color: rgba(255,247,237,.38); }
.add-detail-form button { background: var(--rose); color: var(--plum); }
.context-note,
.boundary-box { background: rgba(255, 255, 255, .055); }
.chips button.selected { background: var(--rose); border-color: var(--rose); color: var(--plum); }
.boundary-box span { background: var(--gold); color: var(--plum); }
.seed small { color: var(--rose); }
.custom-scenario.active { border-color: var(--rose); box-shadow: 0 0 0 1px var(--rose); }
.custom-scenario textarea { color: #fff7ed; }
.custom-scenario textarea::placeholder { color: rgba(255, 247, 237, .34); }
.custom-choice-input { border-color: rgba(255,255,255,.18); background: rgba(255,255,255,.045); color: #fff7ed; }
.custom-choice-input::placeholder { color: rgba(255,247,237,.34); }
.persona-choice { border-color: rgba(255,255,255,.14); background: rgba(255,255,255,.055); }
.persona-choice > small { color: rgba(255,247,237,.5); }
.scenario-status { min-height: 17px; margin: 9px 0 0; color: var(--rose); font-size: 10px; }
.fantasy-suggestion-status { min-height: 18px; margin: 15px 0 -8px; color: var(--rose); font-size: 11px; }
.auth-dialog { width: min(92vw, 480px); border: 1px solid rgba(239,185,197,.35); background: #240d1e; color: #fff7ed; padding: 36px; box-shadow: 0 30px 90px rgba(0,0,0,.55); }
.auth-dialog::backdrop { background: rgba(12,3,10,.82); backdrop-filter: blur(8px); }
.auth-dialog h2 { margin: 8px 0 14px; font-family: var(--serif); font-size: clamp(32px, 6vw, 46px); line-height: 1.02; }
.auth-dialog > p:not(.minimal-kicker):not(.auth-status) { color: rgba(255,247,237,.7); line-height: 1.6; }
.auth-dialog form { display: grid; gap: 10px; margin-top: 24px; }
.auth-step { display: grid; gap: 10px; }
.auth-dialog form label { color: var(--rose); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.auth-dialog input { min-height: 50px; border: 1px solid rgba(255,255,255,.24); background: rgba(255,255,255,.06); color: #fff7ed; padding: 0 14px; font-size: 16px; }
.auth-dialog #authCode { font-size: 24px; letter-spacing: .28em; text-align: center; }
.auth-dialog form .button { width: 100%; margin-top: 4px; }
.auth-change-email { justify-self: center; border: 0; background: transparent; color: var(--rose); padding: 6px; font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.auth-dialog small { display: block; margin-top: 18px; color: rgba(255,247,237,.45); line-height: 1.5; }
.auth-close { position: absolute; top: 14px; right: 16px; border: 0; background: transparent; color: rgba(255,247,237,.7); font-size: 24px; }
.auth-status { min-height: 20px; margin: 14px 0 0; color: var(--rose); font-size: 11px; line-height: 1.5; }
.library-dialog { width: min(92vw, 760px); max-height: min(86vh, 760px); overflow: auto; border: 1px solid rgba(239,185,197,.35); background: linear-gradient(150deg, #230d1e, #35102b); color: #fff7ed; padding: clamp(28px, 5vw, 48px); box-shadow: 0 30px 90px rgba(0,0,0,.55); }
.library-dialog::backdrop { background: rgba(12,3,10,.82); backdrop-filter: blur(8px); }
.library-dialog h2 { margin: 8px 0 10px; font: 500 clamp(38px, 7vw, 58px)/1 var(--serif); }
.library-close { position: absolute; top: 14px; right: 16px; border: 0; background: transparent; color: rgba(255,247,237,.7); font-size: 24px; }
.library-intro { margin: 0 0 24px; color: rgba(255,247,237,.62); font-size: 12px; }
.library-status { min-height: 18px; color: var(--rose); font-size: 11px; }
.story-library-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 12px 0 24px; }
.story-card { min-height: 150px; display: flex; flex-direction: column; align-items: flex-start; border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.055); color: #fff7ed; padding: 20px; text-align: left; }
.story-card:hover { border-color: var(--rose); }
.story-card small { color: var(--rose); font-size: 8px; letter-spacing: 1px; text-transform: uppercase; }
.story-card b { margin: 12px 0 8px; font: 500 22px/1.2 var(--serif); }
.story-card span { color: rgba(255,247,237,.58); font-size: 10px; line-height: 1.5; }
.story-card time { margin-top: auto; padding-top: 16px; color: rgba(255,247,237,.38); font-size: 8px; }
.story-library-empty { grid-column: 1 / -1; padding: 32px 20px; border: 1px dashed rgba(255,255,255,.16); color: rgba(255,247,237,.58); text-align: center; font-size: 12px; }
.library-new { display: block; margin-left: auto; }
.boundaries-field { display: grid; gap: 8px; margin-top: 26px; color: #fff7ed; font-size: 11px; font-weight: 600; }
.boundaries-field textarea { width: 100%; resize: vertical; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.045); color: #fff7ed; padding: 13px; line-height: 1.5; }
.adult-confirmation { display: grid; grid-template-columns: 22px 1fr; gap: 11px; align-items: start; margin-top: 16px; padding: 16px; border: 1px solid rgba(239,185,197,.28); background: rgba(255,255,255,.055); color: rgba(255,247,237,.72); font-size: 10px; line-height: 1.5; }
.adult-confirmation input { width: 20px; height: 20px; margin: 0; accent-color: var(--gold); }
.adult-confirmation b { display: block; color: #fff7ed; }
.generation-status { min-height: 18px; margin: 11px 0 -12px; color: var(--rose); font-size: 10px; line-height: 1.5; }
.chapter-label span { margin-left: 7px; color: rgba(255,247,237,.46); font-size: 8px; letter-spacing: .08em; }
.button-dark { background: var(--gold); color: var(--plum); }
.chapter-page {
  background:
    radial-gradient(circle at 50% 6%, rgba(126, 45, 80, .24), transparent 32%),
    #240d1e;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .32);
}
.chapter-page h2 { color: #fff7ed; }
.chapter-page-copy p { color: rgba(255, 247, 237, .82); }
.chapter-pagination { border-color: rgba(255,255,255,.12); }
.chapter-pagination button { color: var(--rose); }
.chapter-pagination span { color: rgba(255,247,237,.46); }
.chapter-label,
.dropcap::first-letter { color: var(--rose); }
.cliffhanger-fade { background: linear-gradient(transparent, #240d1e); }
.unlock-card { background: #160913; border: 1px solid rgba(255, 255, 255, .1); }
.restart-flow { color: rgba(255, 247, 237, .56); }

@media (max-width: 760px) {
  .minimal-page { height: 100svh; min-height: 560px; grid-template-rows: calc(64px + env(safe-area-inset-top)) 1fr calc(80px + env(safe-area-inset-bottom)); }
  .minimal-header, .minimal-footer { padding-inline: 20px; }
  .minimal-header { padding-top: env(safe-area-inset-top); }
  .minimal-copy { margin-top: -4px; }
  .minimal-copy h1 { font-size: clamp(44px, 14vw, 66px); letter-spacing: -2.6px; }
  .minimal-kicker { margin-bottom: 16px; }
  .minimal-lede { max-width: 330px; margin-block: 20px 25px; font-size: 15px; }
  .primary-action { min-height: 50px; padding-inline: 25px; }
  .floating-note { display: none; }
  .ambient-one { width: 120vw; }
  .minimal-footer { justify-content: center; gap: 22px; flex-wrap: wrap; padding-top: 8px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  .minimal-footer > span:first-child { display: none; }
  .minimal-footer > span:last-child { width: 100%; text-align: center; }
  .story-flow { width: 100%; height: 100dvh; overscroll-behavior: contain; }
  .flow-shell { width: 100%; min-height: 100dvh; }
  .flow-header { position: sticky; top: 0; z-index: 12; height: calc(64px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 18px 0; background: rgba(29,11,24,.9); backdrop-filter: blur(16px); }
  .flow-progress span { width: 24px; }
  .flow-step { padding: 34px 18px calc(42px + env(safe-area-inset-bottom)); }
  .flow-copy h2 { font-size: clamp(38px, 11vw, 49px); }
  .import-options { grid-template-columns: 1fr; }
  .import-option { min-height: 82px; }
  .character-grid { grid-template-columns: 1fr; }
  .persona-grid { grid-template-columns: 1fr; gap: 0; }
  .story-library-list,
  .app-library .story-library-list { grid-template-columns: 1fr; }
  .app-header { min-height: calc(70px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 18px 0; }
  .app-header .wordmark { font-size: 24px; }
  .app-header-actions { gap: 5px; }
  .app-account { padding-inline: 7px; }
  .app-main { width: calc(100% - 36px); padding-top: 48px; }
  .app-welcome { grid-template-columns: 1fr; gap: 24px; }
  .app-welcome h1 { font-size: clamp(46px, 14vw, 64px); letter-spacing: -2.6px; }
  .app-welcome > p { font-size: 13px; }
  .app-library { margin-top: 58px; }
  .app-library-heading { align-items: start; flex-direction: column; }
  .app-library .story-card { min-height: 170px; }
  .analysis-summary { align-items: flex-start; }
  .participant-picker { grid-template-columns: 1fr; }
  .screenshot-preview { grid-template-columns: repeat(3, 1fr); }
  .screenshot-names { grid-template-columns: 1fr; }
  .screenshot-names small { grid-column: auto; }
  .screenshot-lightbox { padding-inline: 14px; }
  .lightbox-controls { grid-template-columns: 38px minmax(0, 1fr) auto 38px; gap: 7px; }
  .flow-actions { gap: 12px; }
  .flow-actions > span { display: none; }
  .flow-actions .button { min-height: 48px; }
  .back-step { min-height: 44px; }
  .chapter-step { max-width: none; padding: 0; }
  .chapter-page { min-height: calc(100dvh - 64px); padding: 34px 20px calc(38px + env(safe-area-inset-bottom)); box-shadow: none; }
  .chapter-page h2 { font-size: clamp(34px, 10vw, 43px); letter-spacing: -1.3px; }
  .chapter-ornament { margin-bottom: 22px; }
  .narration-player { grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; margin-bottom: 28px; padding: 11px; }
  .narration-toggle { min-width: 86px; }
  .narration-meta { padding-right: 2px; }
  .narration-select { grid-row: 2; }
  .narration-voice { grid-column: 1 / 3; }
  .narration-select:not(.narration-voice) { grid-column: 3; }
  .narration-restart { grid-column: 3; grid-row: 1; }
  .chapter-pages { min-height: 0; }
  .chapter-page-copy p { font-size: 16px; line-height: 1.74; margin-bottom: 25px; }
  .chapter-pagination { gap: 8px; }
  .chapter-pagination button { min-height: 44px; }
  .unlock-card { padding: 34px 20px; }
}

@media (max-width: 420px) {
  .minimal-copy { width: calc(100% - 28px); }
  .minimal-footer > span:last-child { display: none; }
  .minimal-footer { align-content: center; }
  .flow-progress span { width: 18px; }
  .flow-copy h2 { letter-spacing: -1.8px; }
  .seed { grid-template-columns: 26px 1fr 16px; gap: 10px; padding: 16px; }
  .chips button { min-height: 42px; }
  .chapter-page { padding-inline: 17px; }
  .chapter-pagination span { font-size: 8px; }
  .narration-meta b { font-size: 9px; }
  .narration-meta span { font-size: 7px; }
  .auth-dialog { padding: 30px 20px; }
}

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