:root {
  color-scheme: light;
  --ink: #211653;
  --muted: #5b5277;
  --purple: #4726a6;
  --yellow: #ffdc54;
  --line: #ded7ee;
  --paper: #f8f5ff;
  --white: #fff;
  font: 16px/1.5 system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
button, select, input { font: inherit; }
button, .button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, label:has(:focus-visible) {
  outline: 3px solid #7850d6; outline-offset: 4px;
}
:where(h1, h2, h3, p, figure) { margin: 0; }
h1, h2, h3 { line-height: 1.12; }
h1 { font-size: clamp(2rem, 5vw, 3.65rem); letter-spacing: -.045em; overflow-wrap: anywhere; }
h2 { font-size: clamp(1.3rem, 3vw, 1.8rem); letter-spacing: -.025em; }
p { color: var(--muted); }
.site-header, main, footer { width: min(1120px, calc(100% - 40px)); margin: auto; }
.site-header { min-height: 78px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.site-header nav { display: flex; gap: 6px; }
.brand { color: var(--ink); font-size: clamp(1.2rem, 4.5vw, 1.75rem); font-weight: 900; letter-spacing: -.055em; text-decoration: none; white-space: nowrap; }
.brand > span:first-child { color: var(--purple); margin-right: 2px; }
.brand-accent { color: var(--purple); }
button, .button {
  padding: 11px 17px; min-height: 44px; border-radius: 12px; border: 1px solid transparent;
  color: var(--ink); background: var(--yellow); font-weight: 750;
}
.quiet, .language, .secondary { background: #fff; border-color: var(--line); }
.quiet { border-color: transparent; background: transparent; }
.language { padding-inline: 10px; }
button:hover, .button:hover { filter: brightness(.96); }
main { min-height: 62vh; }
footer { padding: 27px 0; color: var(--muted); text-align: center; font-size: .875rem; }
.hero { display: grid; grid-template-columns: .95fr 1.05fr; align-items: stretch; border-radius: 27px; overflow: hidden; background: var(--ink); color: #fff; }
.hero-copy { display: grid; align-content: center; justify-items: start; gap: 18px; padding: clamp(26px, 5vw, 64px); }
.hero-copy p { color: #ebe2ff; font-size: 1.05rem; }
.hero-copy .eyebrow { font-size: .9rem; color: #ffdf63; font-weight: 750; }
.hero-copy h1 { font-size: clamp(2.25rem, 5vw, 4.05rem); }
.hero-image { width: 100%; height: 100%; min-height: 260px; object-fit: cover; display: block; }
.home-topics { margin: 24px 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.home-topics div { background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; font-weight: 700; }
.home-topics span { margin-right: 6px; }
.wizard, .standalone { max-width: 930px; margin: 4px auto 0; }
.step-bar { display: grid; gap: 8px; margin-bottom: 18px; font-weight: 700; color: var(--purple); }
.step-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.step-meter span { height: 5px; border-radius: 10px; background: #e4dcf4; }
.step-meter .active { background: var(--purple); }
.stage { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .82fr); gap: clamp(22px, 5vw, 55px); align-items: start; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 23px; padding: clamp(18px, 4vw, 32px); }
.stack { display: grid; gap: 15px; }
.stack-lg { display: grid; gap: 22px; }
.field { display: grid; gap: 6px; font-weight: 700; }
input:not([type="radio"], [type="file"]), select {
  width: 100%; min-height: 48px; padding: 10px 13px; border: 1px solid #9c90b7;
  border-radius: 11px; color: var(--ink); background: #fff;
}
.controls { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.controls button:last-child { margin-left: auto; }
.cover { position: relative; border-radius: 20px; overflow: hidden; background: #241756; color: #fff; min-height: 220px; aspect-ratio: 1.15; isolation: isolate; border: 1px solid #302469; }
.cover img.cover-art { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; z-index: -2; }
.cover::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(0deg, #170e39 0%, #170e39df 16%, transparent 65%); }
.cover-art.alt { display: grid; place-items: center; position: absolute; inset: 0; z-index: -2; font-size: clamp(58px, 10vw, 116px); background: radial-gradient(circle at 70% 28%, #fddb6b, #6654ae 38%, #211653 75%); }
.cover figcaption { position: absolute; bottom: 0; inset-inline: 0; padding: 30px 16px 17px; }
.cover-brand { color: #ffde58; font-size: .85rem; font-weight: 800; }
.cover-title { font-size: clamp(1.35rem, 4vw, 2.2rem); font-weight: 900; line-height: 1.08; text-wrap: balance; overflow-wrap: anywhere; margin-top: 4px; }
.file-input { max-width: 100%; padding: 10px; border: 1px dashed #9c90b7; border-radius: 12px; }
.photo { width: 100%; max-width: 220px; aspect-ratio: 1; object-fit: contain; background: #efeafa; border-radius: 13px; }
.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 145px), 1fr)); gap: 10px; padding: 0; margin: 0; border: 0; min-width: 0; }
.options legend { font-size: 1.18rem; font-weight: 750; margin-bottom: 10px; }
.option { display: grid; align-content: start; gap: 5px; min-height: 74px; padding: 12px; background: #fff; border: 1px solid #a599bb; border-radius: 13px; cursor: pointer; font-weight: 700; overflow-wrap: anywhere; }
.option input { position: absolute; opacity: 0; }
.option:has(input:checked) { border-color: var(--purple); background: #f0eaff; box-shadow: inset 0 0 0 1px var(--purple); }
.option small { font-size: .9rem; color: var(--muted); font-weight: 500; }
.option-icon { font-size: 1.65rem; }
.comic-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.comic-panel { display: grid; grid-template-rows: auto 1fr; border: 2px solid var(--ink); border-radius: 10px; overflow: hidden; }
.comic-scene { display: grid; place-items: center; min-height: 84px; background: #e7dcff; font-size: 2rem; }
.comic-panel p { padding: 10px; color: var(--ink); overflow-wrap: anywhere; }
.notice { font-size: .9rem; }
.error { color: #a51a36; }
.error:empty, [hidden] { display: none; }
.order-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.order-list li { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 8px; justify-items: start; }
@media (max-width: 690px) {
  .site-header, main, footer { width: calc(100% - 28px); }
  .site-header { min-height: 62px; }
  .site-header button { font-size: .9rem; padding-inline: 8px; }
  .hero, .stage { grid-template-columns: 1fr; }
  .hero-copy { gap: 13px; padding: 23px; }
  .hero-image { height: auto; min-height: 0; aspect-ratio: 1.65; object-position: 50% 46%; }
  .home-topics { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
  .home-topics div { font-size: .875rem; padding: 8px; overflow-wrap: anywhere; }
  .home-topics span { display: block; }
  .preview-cover { grid-row: 1; }
  .preview-cover .cover { min-height: 0; aspect-ratio: 1.55; }
}

.portrait-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.portrait-pair figure:only-child { grid-column: span 2; }
.portrait-pair .photo { display: block; }
.portrait-pair figcaption { margin-top: 4px; color: var(--muted); font-size: .9rem; }
.cover img.generated-art { object-position: center 36%; }
button:disabled { cursor: wait; opacity: .65; }

.issue-book { display: grid; gap: 18px; max-width: 800px; margin-inline: auto; width: 100%; }
.issue-cover .cover { max-height: 460px; }
.issue-pages { display: grid; gap: 13px; }
.issue-page { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.issue-panel { display: grid; grid-template-rows: auto 1fr; border: 2px solid var(--ink); border-radius: 15px; overflow: hidden; background: #fff; }
.issue-panel figcaption { padding: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.issue-art { position: relative; aspect-ratio: 1.35; min-width: 0; overflow: hidden; }
.strip-art { background: #211653 url("./space-issue.webp") no-repeat; background-size: 300% 200%; }
.symbol-art { display: flex; justify-content: center; align-items: center; gap: 10px; background: radial-gradient(ellipse, #ffecad, #e5d6ff 75%); font-size: clamp(2.8rem, 8vw, 5.2rem); }
.panel-hero { width: 46%; aspect-ratio: 1; object-fit: cover; border: 2px solid var(--ink); border-radius: 50%; }
.issue-end { text-align: center; color: var(--ink); font-weight: 800; }
.story-test summary { cursor: pointer; color: var(--purple); font-weight: 700; }
.story-test form { margin-top: 12px; max-width: 450px; }
.issue-actions button:last-child { margin-left: 0; }
@media (max-width: 540px) {
  .issue-page { grid-template-columns: 1fr; }
  .issue-cover .cover { aspect-ratio: 1.12; }
}
@page { size: A5 portrait; margin: 8mm; }
@media print {
  html, body { background: white; margin: 0; }
  body { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .site-header, footer, .step-bar, .issue-controls { display: none !important; }
  main, .wizard, .standalone, .issue-book { width: 100%; margin: 0; max-width: none; }
  .issue-book, .issue-pages { display: block; }
  .issue-cover { break-after: page; }
  .issue-cover .cover { height: 186mm; min-height: 0; max-height: none; }
  .issue-page { display: grid; grid-template-columns: 1fr; gap: 4mm; }
  .issue-page + .issue-page { break-before: page; }
  .issue-panel { break-inside: avoid; }
  .issue-art { height: 63mm; aspect-ratio: auto; }
  .issue-panel figcaption { padding: 2mm 3mm; font-size: 11pt; }
  .issue-end { margin-top: 3mm; }
}
.strip-art { aspect-ratio: 1; }
@media print {
  .issue-panel { grid-template-columns: 63mm minmax(0, 1fr); grid-template-rows: 1fr; align-items: center; }
  .issue-art { width: 63mm; height: 63mm; }
  .panel-hero { width: 46%; }
}

.issue-edit-field { padding: 12px; }
.issue-edit-field textarea {
  width: 100%; min-height: 108px; resize: vertical; padding: 9px 10px; font: inherit; font-weight: 400;
  color: var(--ink); background: #fff; border: 1px solid #9c90b7; border-radius: 9px;
}
.issue-edit-field textarea:focus-visible { outline: 3px solid #7850d6; outline-offset: 3px; }
