/* Deep navy and violet visual system, inspired by the author's Bubble reference. */
:root {
  --ink: #f1f2fc;
  --ink-dark: #ffffff;
  --muted: #aeb7cf;
  --violet: #beaaff;
  --violet-dark: #9d82ed;
  --cream: #090d1c;
  --paper: #0e1629;
  --line: #2b354d;
  --surface: #151e32;
  --surface-raised: #1b2740;
  --input: #0d172a;
  --teal: #72d9d1;
}

body { background: var(--cream); color: var(--ink); }
::selection { background: #7654c8; color: #fff; }
:focus-visible { outline-color: #d8caff; }
.skip-link { background: #283459; color: #fff; }
.site-header, .site-footer { background: #090d1c; }
.site-header { box-shadow: 0 4px 25px #0002; }
.brand span span, em { color: var(--violet); }
.text-button { color: var(--ink); }
.button { background: #846ff1; border-color: #846ff1; color: #fff; box-shadow: 0 8px 22px #735beb55; }
.button:hover { background: #9a87ff; border-color: #9a87ff; }
.button-secondary { background: #1a2540; border-color: #4c5771; color: #f4f2ff; }
.button-secondary:hover { background: #263252; border-color: var(--teal); color: #fff; }
.button:disabled, .button-secondary:disabled { box-shadow: none; }
.header-nav a:not(.button):hover, .text-button:hover { color: #d1c4ff; }

/* Landing page: warm photographic books and a cinematic cover shelf. */
.hero { position: relative; min-height: 620px; }
.hero:before { content: ""; position: absolute; z-index: -1; width: 70%; height: 85%; left: -18%; top: 5%; background: radial-gradient(ellipse, #27265878, transparent 70%); pointer-events: none; }
.hero-copy h1 { color: #fff; font-family: var(--sans); font-weight: 700; letter-spacing: -.055em; line-height: 1.08; }
.hero-copy h1 em { color: #fff; font-family: inherit; font-style: normal; font-weight: inherit; }
.hero-copy > p, .hero-foot { color: #b6bed1; }
.eyebrow { color: #c6b3ff; }
.tiny-check { background: #344470; color: #d7f4eb; }
.hero-library-art { height: 470px; background: #192238; border: 1px solid #5f5b99; box-shadow: 12px 14px 0 -2px #276b7059, 0 30px 75px #0008; }
.hero-library-art img { display: block; width: 100%; height: 100%; object-fit: cover; }
.steps-section { background: #10182b; border-top: 1px solid var(--line); }
.steps-grid article { background: #1b2640; border-color: #3a4864; }
.step-number { color: #ccbaff; }
.cover-showcase { background: #0b1122; border-top: 1px solid var(--line); }
.cover-showcase h2, .section-heading h2 { font-family: var(--sans); font-weight: 700; letter-spacing: -.045em; }
.cover-showcase-grid, .cover-template-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; }
.cover-showcase-feature { position: relative; margin: 0 0 38px; height: clamp(260px, 38vw, 440px); overflow: hidden; border: 1px solid #394761; border-radius: 20px; background: #10182b; box-shadow: 0 24px 60px #0005; }
.cover-showcase-feature:after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, #0a1020 0%, #0a1020ed 22%, #0a102068 54%, transparent 78%); pointer-events: none; }
.cover-showcase-feature img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 45%; }
.cover-showcase-feature figcaption { position: absolute; z-index: 1; left: clamp(24px, 5%, 56px); bottom: clamp(24px, 8%, 50px); display: grid; gap: 15px; width: min(42%, 430px); color: #fff; }
.cover-showcase-feature figcaption strong { font: 400 clamp(1.55rem, 3vw, 2.5rem)/1.16 var(--serif); }
.cover-showcase-feature figcaption > span:last-child { max-width: 340px; color: #d8deeb; font-size: .91rem; line-height: 1.5; }
.cover-showcase-feature .eyebrow { color: var(--teal); }
.showcase-card, .cover-template-card { background: var(--surface); border-color: #35415d; box-shadow: 0 14px 32px #0004; }
.showcase-card:hover, .cover-template-card:hover { border-color: #8979c9; transform: translateY(-3px); transition: border-color .2s, transform .2s; }
.showcase-card strong, .cover-template-card h3 { color: #fff; }
.cover-sample { display: block; position: relative; overflow: hidden; aspect-ratio: 2 / 3; background: #222c42; padding: 0 !important; }
.cover-template-card > .cover-sample { display: block; padding: 0; }
.cover-sample img { display: block; width: 100%; height: 100%; aspect-ratio: 2 / 3; object-fit: cover; }
.cover-sample:after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(#0509189e, transparent 29%, transparent 40%, #030714e8); }
.cover-sample-type { position: absolute; z-index: 1; inset: 0; display: flex; flex-direction: column; justify-content: space-between; align-items: center; padding: 11% 6% 13% !important; color: #fff; text-align: center; text-shadow: 0 2px 7px #000d; pointer-events: none; }
.cover-sample-type > .cover-imprint { padding: 0 !important; color: #fff; font-size: clamp(.5rem,.7vw,.63rem); font-weight: 800; letter-spacing: .15em; line-height: 1.25; }
.cover-sample-type > .cover-sample-copy { display: grid; gap: 12px; justify-items: center; width: 100%; padding: 0 !important; }
.cover-sample-copy strong { color: #fff; font-family: var(--serif); font-size: clamp(1.2rem,2vw,1.85rem); line-height: 1.17; letter-spacing: -.045em; overflow-wrap: anywhere; }
.cover-sample-copy small { color: #f1ecff; font-size: clamp(.56rem,.9vw,.72rem); font-weight: 800; letter-spacing: .18em; line-height: 1.3; text-transform: uppercase; }
.showcase-card { overflow: visible; }
.showcase-card .cover-sample, .cover-template-card > .cover-sample { width: calc(100% - 38px); margin: 19px auto 10px; border-radius: 2px 5px 5px 2px; border-left: 6px solid #10111d; box-shadow: inset 4px 0 4px #0008, 4px 3px 0 #d2ccbe, 8px 5px 0 #8e90a0, 13px 16px 26px #000a; transform: perspective(750px) rotateY(-4deg); transform-origin: left center; }
.showcase-card .cover-sample:before, .cover-template-card > .cover-sample:before { content: ""; position: absolute; z-index: 2; inset: 0 auto 0 0; width: 9px; background: linear-gradient(90deg, #0009, #ffffff36 55%, transparent); pointer-events: none; }
.showcase-card figcaption { border-top: 1px solid #33405a; }
.creation-cover-option .cover-sample, .creation-cover-option .cover-sample-type { padding: 0; }
.creation-cover-option .cover-sample-type { display: flex; padding: 11% 6% 13%; }

/* Shared cards, forms and navigation throughout the application. */
.form-card, .book-card, .empty-state, .tool-card, .structure-intro > div,
.structure-card, .structure-add, .fact-card, .reference-box, .archived-facts,
.image-manage-card, .archived-images, .cover-version, .cover-focus-form,
.reader-index, .character-card, .creation-progress span, .creation-cover-option,
.relation-card, .creation-draft-card, .creation-help-dialog, .compare-title-card,
.compare-row, .compare-full details, .export-review-summary > div,
.export-review-section, .account-connect, .library-collections,
.book-collection-form, .suggestion-history-card, .ai-side .tool-card,
.ai-proposal, .ai-empty, .pagination a, .ai-compose, .ai-next-card {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
  box-shadow: none;
}
.book-card:hover { box-shadow: 0 16px 30px #0006; border-color: #665c96; }
.book-collection-form button, .collection-actions button {
  background: #302a58;
  border-color: #5b5289;
  color: #f3eeff;
}
.book-collection-form button:hover, .collection-actions button:hover:not(:disabled) { background: #433874; }
.move-controls button { background: #2d3150; border-color: #5a6381; color: #e4d9ff; }
.move-controls button:hover:not(:disabled) { background: #3d3a68; }
.move-controls button:disabled { opacity: .65; }
.status-pill, .count-badge, .book-label, .ai-character-result { background: #302a58; color: #e0d5ff; }
.book-ai-link, .download-link, .ai-accepted-actions a { background: #2d2855; border-color: #544b88; color: #e4dbff; }
.book-ai-link:hover, .ai-accepted-actions a:hover { background: #3b356a; }
.field input, .field textarea, .compact-form input, .compact-form textarea,
.compact-form select, .search-form input, .library-controls input,
.library-controls select, .creation-form .field select,
.relation-fields input, .relation-fields textarea, .ai-compose select,
.ai-compose textarea, .ai-decision input, .ai-plan-edit textarea,
.ai-memory input, .ai-memory select, .ai-memory textarea,
.collection-create input, .collection-item input, .book-collection-form select,
.import-chapter input, .review-checklist-form textarea,
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
textarea, select {
  background: var(--input);
  border-color: #4a5874;
  color: #f4f5fc;
}
input::placeholder, textarea::placeholder { color: #a0abc4; opacity: 1; }
input:focus, textarea:focus, select:focus { border-color: #bba7ff; }
.field-error, .save-error { color: #ff9cad; }
.flash { background: #183d36; color: #bbf4d8; }
.flash.error { background: #55283a; color: #ffd0d8; }
.search-form button { background: #694cc1; border-color: #694cc1; }
.auth-tabs a.active { color: #dbcfff; }
.google-auth-form .button-secondary:disabled { background: #202942; border-color: #3e4a66; color: #aeb7cf; }
.local-login-guide, .editor-recovery, .ai-studio-banner, .ai-memory,
.author-suggestion-panel, .suggestion-compare, .source-reference,
.continuity-alert, .structure-next, .ai-journey span, .ai-suggestion,
.ai-unavailable, .ai-stale, .ai-next-card {
  background: #252c4a;
  border-color: #554f84;
  color: var(--ink);
}
.local-login-guide p, .ai-studio-banner p { color: #c2c8da; }
.ai-studio-banner, .ai-memory summary, .ai-plan-edit summary { color: #e2d9ff; }
.ai-memory summary, .ai-plan-edit summary { color: #ded4ff; }
.ai-context-text, .ai-manuscript, .ai-plan-edit,
.ai-character-picks { background: #10192c; border-color: var(--line); color: var(--ink); }
.ai-text-compare h5 { color: #c6b7ff; }
.ai-stale { color: #ffe5ae; }
.ai-next-card { background: linear-gradient(120deg, #29234b, #172238); }
.ai-journey span { color: #ddd2ff; }
.source-focus-note, .review-done { background: #193c35; color: #bbf4d8; }
.source-focus-note.review-focus-error { background: #4a3624; color: #ffe0aa; }
.creation-draft-card .text-button { color: #ffc2cf; }
.version-compare-page h3 { color: #bdc5dc; }
.reference-item p { color: #c3cbe0; }
.structure-next a { color: #dfd3ff; }
.structure-next p { color: #c2cae0; }
.character-avatar { background: #352d60; color: #efe7ff; }
.export-advisory { color: #f3d49b; }
.export-ready { color: #9ae6bb; }

/* Editor and reader retain a quiet, light manuscript sheet for long reading. */
.studio-topline { background: #121b2d; }
.chapter-panel, .tools-panel { background: #131e32; }
.chapter-link { color: #c5cee1; }
.chapter-link.selected { background: #302956; color: #e5dcff; }
.panel-tip { border-color: var(--line); color: #aab5d0; }
.writing-panel { background: #f5f0e7; color: #232a3c; }
.writing-panel .chapter-title-input, .writing-panel .manuscript-input { background: transparent; color: #273048; border: 0; }
.writing-panel .editor-path, .writing-panel .editor-bottom { color: #58647a; }
.writing-panel .panel-label { color: #5a3b9c; }
.writing-panel .save-status { color: #176849; }
.writing-panel .save-error { color: #9b233e; }
.writing-panel .editor-bottom { border-color: #d8d4ce; }
.book-preview, .reader-manuscript { background: #f7f2e9; color: #263046; }
.book-preview p, .book-preview h3, .book-preview ol, .reader-manuscript p,
.reader-manuscript h2, .reader-manuscript h3 { color: #263046; }
.book-preview .preview-author { color: #58647a; }
.reader-manuscript .muted { color: #58647a; }
.reader-manuscript .reader-kicker,
.reader-manuscript .reader-chapter-heading span,
.reader-manuscript .reader-chapter-actions,
.reader-manuscript .reader-chapter-actions a,
.reader-manuscript .reader-end span,
.reader-manuscript .reader-end a { color: #5a3b9c; }
.reader-manuscript .reader-synopsis h2 { color: #263046; }
.reader-manuscript .reader-empty,
.reader-manuscript .reader-figure figcaption,
.reader-manuscript .reader-end { color: #58647a; }
.reader-index { background: #18243a; }

.cover-creator { margin: 28px 0 38px; }
.cover-page > .eyebrow { display: block; margin-top: 18px; }
.cover-creator h2, .cover-concepts h2 { margin: 8px 0 12px; font-family: var(--serif); font-size: clamp(1.8rem, 3vw, 2.5rem); font-weight: 400; }
.cover-creator .compact-form { display: grid; gap: 14px; margin-top: 20px; }
.cover-creator .compact-form label { margin-bottom: 6px; }
.cover-brief-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.cover-source { display: flex; flex-wrap: wrap; gap: 12px 24px; margin: 3px 0 0; padding: 16px; border: 1px solid var(--line); border-radius: 10px; }
.cover-source legend { padding: 0 6px; font-weight: 700; }
.cover-source label { display: inline-flex !important; align-items: center; gap: 7px; margin: 0 !important; }
.cover-source input[type=radio] { width: auto; accent-color: #9b83ff; }
.cover-creator .tool-help { margin: 0; }
.cover-concepts { margin: 38px 0; }
.cover-concepts > p { max-width: 740px; color: var(--muted); line-height: 1.6; }
.cover-context-preview { max-width: 850px; margin: 12px 0 18px; }
.cover-context-preview summary { cursor: pointer; color: #d9cbff; font-weight: 700; }
.cover-context-preview pre { white-space: pre-wrap; overflow-wrap: anywhere; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: #10192c; color: var(--ink); font: inherit; font-size: .84rem; line-height: 1.55; }
.cover-options-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 22px 0; }
.cover-option-card { min-width: 0; overflow: hidden; border: 1px solid #35415d; border-radius: 14px; background: var(--surface); }
.cover-option-preview { position: relative; aspect-ratio: 2 / 3; overflow: hidden; background: linear-gradient(150deg, #302751, #162139 58%, #7e6588); }
.cover-option-preview img, .cover-option-placeholder { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-option-preview:after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(#06102095, transparent 40%, #040717df); }
.cover-option-placeholder { display: grid; place-items: center; font-family: var(--serif); font-size: 4rem; color: #b8a7ee; }
.cover-option-card:nth-child(2) .cover-option-placeholder { background: linear-gradient(150deg, #494263, #82656f 58%, #d2a47b); }
.cover-option-card:nth-child(3) .cover-option-placeholder { background: linear-gradient(150deg, #172d3f, #405b56 60%, #c9b89a); }
.cover-option-card:nth-child(4) .cover-option-placeholder { background: linear-gradient(145deg, #703b56, #272a56 56%, #b9a17b); }
.cover-option-type { position: absolute; z-index: 1; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 9px; padding: 16px 9% 12%; color: #fff; text-align: center; text-shadow: 0 2px 8px #000e; pointer-events: none; }
.cover-option-type strong { color: #fff; font-family: var(--serif); font-size: clamp(1rem, 1.7vw, 1.6rem); line-height: 1.15; overflow-wrap: anywhere; }
.cover-option-type span { font-size: .72rem; }
.cover-option-type small { margin-top: 7px; text-transform: uppercase; letter-spacing: .14em; font-weight: 700; }
.cover-option-copy { display: grid; gap: 9px; padding: 17px; }
.cover-option-copy h3 { margin: 0; color: #fff; }
.cover-option-copy p { margin: 0 0 6px; color: var(--muted); font-size: .84rem; line-height: 1.5; }
.cover-option-copy .compact-form { display: grid; gap: 8px; }
.cover-option-copy .compact-form input { min-width: 0; }
.cover-option-copy .button, .cover-option-copy .button-secondary { width: 100%; justify-content: center; white-space: normal; }
.book-cover.has-cover, .reader-cover-frame, .current-cover-frame { position: relative; overflow: hidden; }
.book-cover.has-cover:before { content: none; }
.book-cover-lettering { position: absolute; z-index: 1; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 5px; padding: 18px 8% 12%; background: linear-gradient(transparent 15%, #050814c9 68%, #030511ee); color: #fff; text-align: center; text-shadow: 0 2px 7px #000e; pointer-events: none; }
.book-cover-lettering strong { color: #fff; font-family: var(--serif); font-size: clamp(1rem, 1.7vw, 1.45rem); line-height: 1.15; overflow-wrap: anywhere; }
.book-cover-lettering small { font-size: .68rem; line-height: 1.25; }
.book-cover-lettering span { margin-top: 5px; font-size: .66rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.reader-cover-frame { width: min(250px, 100%); aspect-ratio: 148 / 210; margin: 0 auto 45px; box-shadow: 0 12px 28px #18213b22; }
.reader-cover-frame .reader-cover { width: 100%; height: 100%; margin: 0; box-shadow: none; }
.reader-cover-frame .book-cover-lettering strong { font-size: 1.4rem; }
.current-cover-frame { width: min(260px, 100%); aspect-ratio: 210 / 297; margin-bottom: 16px; border-radius: 8px; box-shadow: 0 10px 28px #16213b1f; }
.current-cover-frame .current-cover { width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; border-radius: 0; box-shadow: none; }
.current-cover-frame .book-cover-lettering strong { font-size: 1.45rem; }
.cover-inspiration { margin: 36px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cover-inspiration > summary { padding: 20px 3px; cursor: pointer; color: #e2d9ff; font-weight: 700; }
.cover-inspiration .cover-template-section { margin-top: 6px; }

@media (max-width: 1050px) {
  .cover-showcase-grid, .cover-template-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cover-options-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .header-section-link { display: none !important; }
  .hero { min-height: 0; }
  .hero-library-art { order: 0; height: 280px; }
  .cover-showcase-feature { height: 390px; }
  .cover-showcase-feature:after { background: linear-gradient(0deg, #0a1020f7, #0a102068 48%, transparent 76%); }
  .cover-showcase-feature figcaption { left: 20px; right: 20px; bottom: 20px; width: auto; gap: 9px; }
  .cover-showcase-feature img { object-position: 50% 25%; }
  .showcase-card .cover-sample { width: calc(100% - 22px); margin-top: 11px; }
  .chapter-link { background: #1e2a43; }
  .cover-sample-copy strong { font-size: clamp(.88rem, 5vw, 1.35rem); }
  .cover-sample-type > .cover-imprint { font-size: .48rem; }
  .cover-sample-copy small { font-size: .52rem; }
  .cover-showcase-grid, .cover-template-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .cover-brief-grid, .cover-options-grid { grid-template-columns: 1fr; }
  .cover-option-type strong { font-size: clamp(1.4rem, 7vw, 2rem); }
  .reader-cover-frame { width: min(190px, 100%); margin-bottom: 32px; }
}

@media print {
  body { background: #fff; color: #111; }
  .writing-panel, .reader-manuscript, .book-preview { background: #fff; color: #111; }
}
