:root {
  color-scheme: light;
  --ink: #20212b;
  --muted-ink: #686a7b;
  --paper: #f6f6fa;
  --surface: #ffffff;
  --lavender: #6965d8;
  --lavender-dark: #514db2;
  --lavender-pale: #e9e8ff;
  --gold: #b57a2d;
  --gold-pale: #fff1d9;
  --rose: #a23954;
  --rose-pale: #fff0f3;
  --line: #e1e2eb;
  --shadow: 0 18px 50px rgb(35 35 49 / 8%);
  font-family: ui-rounded, "SF Pro Rounded", "Avenir Next", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--paper); color: var(--ink); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid rgb(105 101 216 / 35%); outline-offset: 2px; }
.app-shell { min-height: 100svh; }
.auth-view { width: min(560px, calc(100% - 40px)); min-height: 100svh; margin: auto; display: grid; align-content: center; justify-items: start; gap: 18px; }
.auth-mark, .brand-star, .empty-star { color: var(--lavender); font-family: Georgia, serif; }
.auth-mark { font-size: 58px; line-height: 1; }
.auth-view h1, .topbar h1, .editor h2, .story-rail h2, .section-heading h3 { margin: 0; letter-spacing: -0.045em; }
.auth-view h1 { font-size: clamp(3rem, 9vw, 5rem); }
.auth-copy { max-width: 48ch; margin: 0; color: var(--muted-ink); font-size: 1.1rem; line-height: 1.6; }
.auth-note { max-width: 48ch; margin: 8px 0 0; color: var(--muted-ink); font-size: .8rem; line-height: 1.5; }
.auth-note code { color: var(--ink); }
.eyebrow { margin: 0; color: var(--lavender-dark); font-size: .71rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.button { border: 1px solid transparent; border-radius: 999px; min-height: 40px; padding: 0 17px; font-weight: 750; transition: transform .16s ease, background-color .16s ease, border-color .16s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--lavender); color: #fff; box-shadow: 0 6px 18px rgb(105 101 216 / 25%); }
.button-primary:hover { background: var(--lavender-dark); }
.button-quiet { background: transparent; border-color: var(--line); color: var(--ink); }
.button-quiet:hover { background: var(--lavender-pale); border-color: var(--lavender-pale); }
.button-danger { background: var(--rose-pale); color: var(--rose); }
.button-publish { background: var(--gold); color: #fff; box-shadow: 0 6px 18px rgb(181 122 45 / 24%); }
.form-error { margin: 0; border-left: 3px solid var(--rose); padding: 10px 12px; background: var(--rose-pale); color: var(--rose); line-height: 1.45; }

.studio-view { min-height: 100svh; }
.topbar { min-height: 82px; padding: 14px 28px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); background: rgb(255 255 255 / 88%); backdrop-filter: blur(20px); position: sticky; top: 0; z-index: 10; }
.brand-lockup { display: flex; align-items: center; gap: 11px; }
.brand-star { font-size: 30px; }
.topbar h1 { font-size: 1.35rem; }
.topbar-actions, .editor-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.studio-layout { display: grid; grid-template-columns: 272px minmax(0, 1fr) minmax(275px, 340px); min-height: calc(100svh - 82px); }
.story-rail { border-right: 1px solid var(--line); padding: 24px 16px; background: #fafaff; }
.rail-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 14px; }
.story-rail h2 { font-size: 1.55rem; }
.icon-button { width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--lavender); color: #fff; font-size: 1.4rem; line-height: 1; }
.search-field input { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface); }
.filter-row { display: flex; gap: 4px; overflow-x: auto; margin: 13px 0; }
.filter-button { border: 0; border-radius: 8px; padding: 6px 8px; color: var(--muted-ink); background: transparent; font-size: .76rem; font-weight: 700; white-space: nowrap; }
.filter-button.is-selected { background: var(--lavender-pale); color: var(--lavender-dark); }
.story-list { display: grid; gap: 4px; }
.story-row { width: 100%; border: 1px solid transparent; border-radius: 12px; padding: 11px 10px; text-align: left; background: transparent; color: inherit; }
.story-row:hover { background: var(--surface); }
.story-row.is-selected { border-color: #d9d7ff; background: var(--surface); box-shadow: 0 4px 16px rgb(35 35 49 / 5%); }
.story-row-title { display: block; overflow: hidden; font-size: .91rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.story-row-meta { display: flex; align-items: center; justify-content: space-between; gap: 5px; margin-top: 5px; color: var(--muted-ink); font-size: .72rem; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: var(--muted-ink); }
.status-dot.draft { background: var(--gold); }.status-dot.published { background: #2c9b69; }.status-dot.archived { background: #8a8b98; }

.editor { min-width: 0; padding: 36px clamp(24px, 4vw, 68px) 72px; background: var(--surface); }
.empty-state { min-height: 60svh; display: grid; place-content: center start; gap: 12px; }
.empty-star { font-size: 38px; }.empty-state h2 { font-size: 2.2rem; }.empty-state p { max-width: 30ch; margin: 0 0 8px; color: var(--muted-ink); line-height: 1.5; }
.editor-header { display: grid; grid-template-columns: minmax(180px, 1fr) auto minmax(150px, 1fr); align-items: center; gap: 20px; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.editor-header h2 { max-width: 12ch; font-size: clamp(1.8rem, 4vw, 3rem); }
.publish-rail { display: flex; align-items: center; justify-content: center; color: var(--muted-ink); font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.publish-step { white-space: nowrap; }.publish-step.is-active { color: var(--lavender-dark); }.publish-step.is-live { color: #17764e; }.publish-line { width: 28px; height: 1px; margin: 0 6px; background: var(--line); }
.editor-section { padding: 34px 0; border-bottom: 1px solid var(--line); }
.section-heading { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(200px, .8fr); gap: 20px; margin-bottom: 20px; }
.section-heading h3 { margin-top: 5px; font-size: 1.45rem; }.section-heading > p { margin: 0; color: var(--muted-ink); font-size: .88rem; line-height: 1.55; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }.field-wide { grid-column: 1 / -1; }
.field, .inline-field { display: grid; gap: 7px; color: var(--ink); font-size: .81rem; font-weight: 780; }.field span { color: var(--muted-ink); font-size: .72rem; font-weight: 500; line-height: 1.4; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 11px; color: var(--ink); background: #fff; }
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }.locale-tabs { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 12px; }.locale-tab { border: 1px solid var(--line); border-radius: 999px; padding: 8px 11px; background: #fff; color: var(--muted-ink); font-size: .78rem; font-weight: 800; }.locale-tab.is-active { border-color: var(--lavender); background: var(--lavender-pale); color: var(--lavender-dark); }
.locale-actions { display: flex; align-items: end; gap: 8px; margin-bottom: 24px; }.locale-actions .inline-field { width: 115px; }.locale-actions input { padding: 8px 10px; }
.edition-form { display: grid; gap: 18px; }.edition-form h4 { margin: 0; font-size: 1rem; }.edition-form .field-grid { gap: 14px; }.chapter-list { display: grid; gap: 12px; }.chapter-card { border: 1px solid var(--line); border-radius: 14px; padding: 15px; background: #fcfcff; }.chapter-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 13px; }.chapter-header h5 { margin: 0; font-size: .9rem; }.chapter-fields { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 12px; }.chapter-fields .field-wide { grid-column: 1 / -1; }.remove-chapter { border: 0; background: transparent; color: var(--rose); font-size: .78rem; font-weight: 800; }
.publish-locales { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 16px; }.publish-choice { display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 999px; padding: 8px 11px; font-size: .78rem; font-weight: 750; }.publish-choice input { width: auto; accent-color: var(--gold); }

.reader-preview { padding: 29px 24px; border-left: 1px solid var(--line); background: linear-gradient(160deg, #f1f0ff 0%, #faf9f5 60%, #fff 100%); }.preview-topline { display: flex; align-items: center; justify-content: space-between; gap: 8px; }.locale-pill { border-radius: 999px; padding: 4px 8px; background: var(--surface); color: var(--lavender-dark); font-size: .71rem; font-weight: 800; }.preview-content { margin-top: 26px; }.preview-placeholder { color: var(--muted-ink); line-height: 1.55; }.preview-cover { width: 100%; aspect-ratio: 3 / 4; margin-bottom: 22px; border-radius: 18px; object-fit: cover; box-shadow: var(--shadow); }.preview-content h2 { margin: 0; font-family: Iowan Old Style, Georgia, serif; font-size: 2rem; line-height: 1.1; }.preview-subtitle { margin: 8px 0 18px; color: var(--muted-ink); font-family: Iowan Old Style, Georgia, serif; font-size: 1.07rem; font-style: italic; line-height: 1.4; }.preview-summary { color: var(--muted-ink); line-height: 1.6; }.preview-chapter { margin-top: 27px; padding-top: 18px; border-top: 1px solid rgb(32 33 43 / 12%); }.preview-chapter h3 { margin: 0 0 8px; font-family: Iowan Old Style, Georgia, serif; font-size: 1.25rem; }.preview-chapter p { margin: 0; color: #424351; font-family: Iowan Old Style, Georgia, serif; line-height: 1.75; white-space: pre-wrap; }
.toast { position: fixed; right: 20px; bottom: 20px; max-width: min(390px, calc(100vw - 40px)); border-radius: 12px; padding: 13px 15px; background: var(--ink); color: #fff; box-shadow: var(--shadow); font-size: .87rem; line-height: 1.4; z-index: 30; }.toast.is-error { background: var(--rose); }.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 1120px) { .studio-layout { grid-template-columns: 235px minmax(0, 1fr); }.reader-preview { display: none; }.editor-header { grid-template-columns: 1fr auto; }.publish-rail { display: none; } }
@media (max-width: 760px) { .topbar { padding: 13px 16px; align-items: flex-start; }.topbar-actions { justify-content: flex-start; }.studio-layout { display: block; }.story-rail { border-right: 0; border-bottom: 1px solid var(--line); }.story-list { display: flex; overflow-x: auto; }.story-row { min-width: 180px; }.editor { padding: 28px 20px 58px; }.editor-header, .section-heading, .field-grid { grid-template-columns: 1fr; }.editor-actions { justify-content: flex-start; }.field-wide { grid-column: auto; }.chapter-fields { grid-template-columns: 1fr; }.locale-actions { align-items: end; }.topbar h1 { font-size: 1.1rem; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; } }
