:root {
  --ink: #1d2b3a;
  --ink-2: #3c4a5a;
  --muted: #6d7682;
  --paper: #faf7f1;
  --paper-2: #f2ede3;
  --card: #ffffff;
  --line: #e3ddd1;
  --accent: #b5843a;
  --accent-2: #8f6527;
  --ok: #2f7d4f;
  --err: #b4412f;
  --radius: 10px;
  --serif: "EB Garamond", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--sans); font-size: 14px; color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: -.01em; }
h2 { font-size: 26px; margin: 0 0 4px; }
h3 { font-size: 18px; margin: 26px 0 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.muted { color: var(--muted); } .small { font-size: 12.5px; }
a { color: var(--accent-2); }

/* top bar */
.topbar { height: 54px; display: flex; align-items: center; gap: 18px; padding: 0 18px; border-bottom: 1px solid var(--line); background: var(--paper); position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 9px; font-family: var(--serif); font-size: 22px; color: var(--ink); text-decoration: none; }
.brand .mark { width: 28px; height: 28px; border-radius: 7px; background: var(--ink); color: var(--paper); display: grid; place-items: center; font-size: 18px; }
.project-title { flex: 1; font-family: var(--serif); font-size: 17px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.pill { font-size: 12px; padding: 3px 10px; border-radius: 99px; background: var(--paper-2); color: var(--muted); }
.pill.paid { background: #e3f1e8; color: var(--ok); }
.pill.timer { font-variant-numeric: tabular-nums; }
.pill.timer.soon { background: #fdecea; color: #a33; }
.private-link { display: flex; gap: 6px; margin: 8px 0; }
.private-link input { flex: 1; min-width: 0; font-size: 12px; }

/* buttons & forms */
.btn { font: inherit; font-weight: 500; border-radius: 8px; padding: 9px 16px; border: 1px solid var(--ink); background: var(--ink); color: #fff; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; justify-content: center; }
.btn:hover { background: #2a3b4e; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink-2); background: #fff; }
.btn.primary { background: var(--accent); border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.link { background: none; border: 0; color: var(--err); padding: 4px; }
.btn.small { padding: 6px 11px; font-size: 13px; }
.btn.wide { width: 100%; padding: 12px; font-size: 15px; }
label { display: block; font-size: 12.5px; font-weight: 500; color: var(--ink-2); margin-bottom: 12px; }
label output { float: right; font-weight: 400; color: var(--muted); }
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]), select, textarea { display: block; width: 100%; margin-top: 5px; font: inherit; font-size: 14px; font-weight: 400; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; }
textarea { resize: vertical; line-height: 1.45; font-family: var(--serif); font-size: 15px; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(181,132,58,.35); border-color: var(--accent); }
input[type=range] { width: 100%; accent-color: var(--accent); margin-top: 8px; }
input[type=color] { display: block; width: 100%; height: 36px; margin-top: 5px; border: 1px solid var(--line); border-radius: 7px; padding: 2px; background: #fff; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; color: var(--ink); }
label.check input { accent-color: var(--accent); width: 15px; height: 15px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
/* Menus side by side line up even when one label runs to two lines. */
.grid2 > label:has(> select) { display: flex; flex-direction: column; justify-content: flex-end; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 12px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 10px; }
.span2 { grid-column: span 2; }
.row { display: flex; gap: 10px; }
.error { color: var(--err); }
.warn { background: #fdf3e2; border: 1px solid #efd9b0; color: #7a5518; border-radius: 8px; padding: 10px 12px; font-size: 13px; margin: 12px 0; }

/* landing */
.landing { max-width: 1180px; margin: 0 auto; padding: 0 28px 80px; }
.hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 56px; align-items: center; padding: 64px 0 40px; }
.eyebrow { text-transform: uppercase; letter-spacing: .16em; font-size: 12px; color: var(--accent-2); font-weight: 600; margin: 0 0 14px; }
.hero h1 { font-size: 58px; line-height: 1.02; margin: 0 0 20px; font-weight: 500; }
.lede { font-size: 16.5px; line-height: 1.6; color: var(--ink-2); margin: 0 0 28px; max-width: 560px; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 30px; border: 1.5px dashed #cbbfa8; border-radius: 14px; background: #fff; cursor: pointer; font-size: 15px; font-weight: 400; color: var(--ink); transition: .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: #fffaf1; }
.dropzone .dz-icon { color: var(--accent); }
.dropzone.busy { pointer-events: none; opacity: .7; }
.resume { margin: 0 0 18px; display: grid; gap: 10px; }
.resume-card { display: flex; align-items: center; gap: 14px; background: #fff; border: 2px solid var(--accent); border-radius: 12px; padding: 14px 16px; box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.resume-card .info { flex: 1; min-width: 0; }
.resume-card .label { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--accent-2); font-weight: 600; }
.resume-card .title { font-family: var(--serif); font-size: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.resume-card .left { font-size: 13px; color: var(--muted); }
.resume-card .btn.primary { padding: 12px 20px; font-size: 15px; }
.btn.ghost.danger { color: var(--err); border-color: #e6c3bc; }
.btn.ghost.danger:hover { border-color: var(--err); background: #fdf1ee; }
.btn.danger-solid { background: var(--err); border-color: var(--err); color: #fff; }
.btn.danger-solid:hover { background: #962f20; border-color: #962f20; }
.confirm-delete { border: 0; border-radius: 14px; padding: 22px 24px; max-width: 460px; width: calc(100% - 32px); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.confirm-delete::backdrop { background: rgba(20,28,38,.55); }
.confirm-delete h3 { margin: 0 0 10px; font-family: var(--serif); font-size: 22px; }
.confirm-delete .warn-text { background: #fdecea; border: 1px solid #f1c4bc; color: #7d2a1d; border-radius: 8px; padding: 10px 12px; font-size: 14px; line-height: 1.5; }
.confirm-delete p { font-size: 14px; line-height: 1.5; }
.confirm-delete .row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.hero-art { display: flex; justify-content: center; }
.book-spread { display: flex; filter: drop-shadow(0 20px 40px rgba(29,43,58,.18)); transform: rotate(-2deg); }
.book-spread .page { width: 210px; height: 315px; background: #fffdf8; padding: 34px 26px; position: relative; font-family: var(--serif); }
.book-spread .left { border-right: 1px solid #eee5d5; border-radius: 4px 0 0 4px; }
.book-spread .right { border-radius: 0 4px 4px 0; }
.book-spread .rh { text-align: center; font-size: 8px; letter-spacing: .2em; text-transform: uppercase; color: #777; margin-bottom: 16px; }
.book-spread .folio { position: absolute; top: 34px; left: 26px; font-size: 8px; color: #777; }
.book-spread .lines i { display: block; height: 4px; background: #d9d2c4; margin: 0 0 8.5px; border-radius: 2px; }
.book-spread .lines i:nth-child(5n) { width: 70%; }
.book-spread .ch-l { text-align: center; font-size: 8px; letter-spacing: .3em; margin-top: 60px; color: #555; }
.book-spread .ch-t { text-align: center; font-size: 20px; font-style: italic; margin: 6px 0 2px; }
.book-spread .orn { text-align: center; font-size: 12px; margin-bottom: 20px; }
.book-spread .first { position: relative; padding-left: 26px; }
.book-spread .first b { position: absolute; left: 0; top: -6px; font-size: 34px; font-weight: 400; }
.how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; padding: 30px 0; border-top: 1px solid var(--line); }
.how .num { font-family: var(--serif); font-size: 15px; width: 28px; height: 28px; border: 1px solid var(--accent); color: var(--accent-2); border-radius: 50%; display: inline-grid; place-items: center; }
.how h3 { border: 0; padding: 0; margin: 10px 0 6px; font-size: 21px; }
.how p { color: var(--ink-2); line-height: 1.55; margin: 0; }
.platforms-wrap { padding-top: 22px; border-top: 1px solid var(--line); }
.platforms { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.platforms .pf { display: flex; gap: 12px; align-items: flex-start; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 14px; transition: border-color .15s, box-shadow .15s, transform .15s; }
.platforms .pf:hover { border-color: #cbbfa8; box-shadow: 0 6px 18px rgba(29,43,58,.08); transform: translateY(-1px); }
.platforms .pf strong { font-family: var(--serif); font-size: 17px; font-weight: 500; display: block; margin-bottom: 5px; }
.pf-badge { flex: none; border-radius: 9px; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.fmts { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.fmt { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--ink-2); background: var(--paper-2); border-radius: 99px; padding: 2px 8px 2px 5px; }
.fmt-icon { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tag { display: inline-block; font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; padding: 2px 7px; border-radius: 99px; background: #e3f1e8; color: var(--ok); margin-left: 6px; vertical-align: 2px; }

/* workspace */
.workspace { display: grid; grid-template-columns: 76px 400px 1fr; height: calc(100vh - 54px); }
.rail { border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 10px 0; gap: 2px; background: var(--paper); }
.rail button { background: none; border: 0; font: inherit; font-size: 11.5px; color: var(--muted); padding: 10px 4px; display: flex; flex-direction: column; align-items: center; gap: 5px; cursor: pointer; max-width: 100%; text-align: center; line-height: 1.2; hyphens: auto; overflow-wrap: anywhere; border-left: 2px solid transparent; }
.rail .build { margin-top: auto; padding: 8px 2px 0; font-size: 9.5px; color: var(--muted); text-align: center; overflow-wrap: anywhere; user-select: all; }
.rail button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.rail button:hover { color: var(--ink); }
.rail button.active { color: var(--ink); border-left-color: var(--accent); background: var(--paper-2); }
.panel { overflow-y: auto; padding: 22px 22px 60px; border-right: 1px solid var(--line); background: var(--paper); }
.preview { display: flex; flex-direction: column; min-width: 0; background: #e8e6e1; }
.ptools { display: flex; align-items: center; gap: 10px; padding: 9px 14px; background: var(--paper); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.ptools select { width: auto; margin: 0; padding: 6px 8px; font-size: 13px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; background: #fff; }
.seg button { font: inherit; font-size: 12.5px; border: 0; background: none; padding: 6px 10px; cursor: pointer; color: var(--ink-2); }
.seg button.on { background: var(--ink); color: #fff; }
.tcheck { display: flex; align-items: center; gap: 5px; margin: 0; font-weight: 400; font-size: 12.5px; }
.zoom { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; }
.zoom button { width: 26px; height: 26px; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; font-size: 15px; line-height: 1; }
.zoom span { min-width: 38px; text-align: center; }
.pframe iframe.count-frame { position: absolute; inset: auto; left: -10000px; top: 0; width: 1000px; height: 800px; visibility: hidden; pointer-events: none; border: 0; }
.zoom button.fit { width: auto; padding: 0 8px; font-size: 12px; margin-left: 2px; }
.zoom button.fit.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.pcount { margin-left: auto; font-size: 12.5px; color: var(--ink-2); }
.pframe { flex: 1; position: relative; }
.pframe iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #e8e6e1; }
.loading { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 2; background: var(--ink); color: #fff; padding: 7px 14px 7px 10px; border-radius: 99px; font-size: 12.5px; display: flex; align-items: center; gap: 8px; box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.spinner { width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* structure */
.stats { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); margin: 10px 0 14px; }
.stats b { color: var(--ink); font-weight: 600; }
.sections { list-style: none; margin: 0; padding: 0; }
.sections li { background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; margin-bottom: 7px; }
.sections li.part { background: var(--paper-2); }
.sections .srow { display: flex; gap: 7px; align-items: center; }
.sections .sno { font-family: var(--serif); color: var(--muted); width: 22px; text-align: right; flex: none; font-size: 13px; }
.sections input { margin: 0 !important; padding: 5px 8px !important; font-size: 13.5px !important; }
.sections select { width: 112px !important; flex: none; margin: 0 !important; padding: 5px 6px !important; font-size: 12.5px !important; }
.sections .smeta { display: flex; align-items: center; gap: 4px; margin: 6px 0 0 29px; font-size: 11.5px; color: var(--muted); }
.sections .smeta > span:first-child, .sections .icon-btn { white-space: nowrap; flex: none; }
.sections .srow input[data-act="title"] { min-width: 0; }
.sections .smeta .grow { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-family: var(--serif); font-size: 12.5px; font-style: italic; }
.icon-btn { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 3px 5px; border-radius: 5px; font-size: 12px; }
.icon-btn:hover { background: var(--paper-2); color: var(--ink); }
.icon-btn.danger:hover { color: var(--err); }

/* design */
.themes { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.theme { border: 1.5px solid var(--line); border-radius: 9px; padding: 12px 12px 10px; cursor: pointer; background: #fff; text-align: left; font: inherit; }
.theme:hover { border-color: #cbbfa8; }
.theme.on { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(181,132,58,.15); }
.theme .tl { font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.theme .tt { font-size: 21px; margin: 3px 0 4px; line-height: 1.1; }
.theme .td { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.theme.custom { border-style: dashed; background: var(--paper-2); }
.theme.custom.on { border-style: solid; background: #fff; }

/* ornaments */
.art-slots { display: grid; gap: 10px; }
.art-slot[hidden] { display: none; }
.art-slot { display: flex; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; }
.art-slot strong { font-size: 13px; }
.art-slot p { margin: 3px 0 8px; line-height: 1.45; }
.art-slot .row { align-items: center; }
.art-thumb { flex: none; width: 74px; height: 46px; border: 1px dashed #cbbfa8; border-radius: 6px; background: var(--paper) center / contain no-repeat; }
.art-thumb.has { border-style: solid; background-color: #fff; }
.orn-dialog { border: 0; border-radius: 14px; padding: 20px 22px; width: min(460px, calc(100% - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.orn-dialog::backdrop { background: rgba(20,28,38,.45); }
.orn-dialog h3 { margin: 0 0 12px; border: 0; padding: 0; font-size: 21px; }
.icon-btn.jump { color: var(--accent-2); }
.pay-dialog { width: min(560px, 96vw); max-height: 92vh; padding: 0; border: 0; border-radius: 14px; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.pay-dialog::backdrop { background: rgba(20, 28, 38, .55); }
.pay-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: #fff; border-bottom: 1px solid var(--line); }
.pay-head strong::before { content: "🔒 "; }
#payMount { min-height: 200px; }
#payDemo { padding: 18px 20px; }
.pay-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 260px; color: var(--muted); }
.pay-loading .spinner { width: 28px; height: 28px; border-color: rgba(0,0,0,.12); border-top-color: var(--accent); }
.pay-error { padding: 24px 20px; color: var(--err); }
.orn-scope { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; margin: -4px 0 12px; padding: 8px 10px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.orn-scope .check { margin: 0; }
.orn-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-bottom: 14px; }
.orn-opt { font: 20px/1 var(--serif); height: 52px; border: 1.5px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; color: var(--ink); }
.orn-opt:hover { border-color: #cbbfa8; }
.orn-opt.on { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(181,132,58,.15); }
.orn-opt.art { background: #fff center / 80% auto no-repeat; }
.orn-dialog .row input { margin-top: 0; }
.orn-upload { border-top: 1px solid var(--line); padding-top: 12px; }
.orn-upload p { line-height: 1.45; }
.row.end { justify-content: flex-end; }

/* cover designs */
.cover-layouts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cover-layout { font: inherit; text-align: left; background: #fff; border: 1.5px solid var(--line); border-radius: 9px; padding: 8px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.cover-layout:hover { border-color: #cbbfa8; }
.cover-layout.on { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(181,132,58,.15); }
.cl-name { font-weight: 600; font-size: 12.5px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 4px; }
.cl-desc { font-size: 11px; color: var(--muted); line-height: 1.35; }
.tag.premium { background: #fbf0dc; color: var(--accent-2); margin: 0; }
/* Tiny cover thumbnails: i = title, b = rule, u = author. */
.cl-mini { position: relative; display: block; aspect-ratio: 1 / 1.5; border-radius: 3px; background: var(--bg); overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.cl-mini i, .cl-mini b, .cl-mini u { position: absolute; left: 22%; right: 22%; border-radius: 2px; }
.cl-mini i { top: 36%; height: 9%; background: var(--fg); }
.cl-mini b { top: 50%; left: 42%; right: 42%; height: 2px; background: var(--ac); }
.cl-mini u { bottom: 9%; left: 32%; right: 32%; height: 4%; background: var(--fg); opacity: .8; }
.cl-classic::before { content: ""; position: absolute; inset: 5%; border: 1px solid var(--ac); opacity: .6; }
.cl-minimal i { top: 16%; left: 12%; right: 40%; } .cl-minimal b { top: 30%; left: 12%; right: 76%; } .cl-minimal u { left: 12%; right: 50%; }
.cl-band i { background: var(--bg); } .cl-band::before { content: ""; position: absolute; left: 0; right: 0; top: 30%; height: 26%; background: var(--ac); }
.cl-band b { background: var(--bg); }
.cl-ornate::before { content: ""; position: absolute; inset: 6%; border: 3px double var(--ac); }
.cl-ornate::after { content: "❦"; position: absolute; top: 20%; left: 0; right: 0; text-align: center; color: var(--ac); font-size: 11px; line-height: 1; }
.cl-deco { background: repeating-conic-gradient(from -90deg at 50% 100%, color-mix(in srgb, var(--ac) 30%, var(--bg)) 0deg 3deg, var(--bg) 3deg 9deg); }
.cl-deco::before { content: ""; position: absolute; inset: 5%; border: 1px solid var(--ac); }
.cl-deco i { top: 33%; height: 15%; left: 12%; right: 12%; background: var(--bg); border-top: 2px solid var(--ac); border-bottom: 2px solid var(--ac); box-shadow: inset 0 0 0 3px var(--bg), inset 0 0 0 20px var(--fg); }
.cl-gradient { background: radial-gradient(ellipse 70% 45% at 50% 42%, color-mix(in srgb, var(--ac) 55%, var(--bg)), transparent 70%), linear-gradient(165deg, var(--bg) 35%, color-mix(in srgb, var(--ac) 70%, var(--bg))); }
.cl-gradient i { height: 12%; box-shadow: 0 0 8px var(--ac); }
.geom { background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; font-size: 12.5px; color: var(--ink-2); line-height: 1.55; }
.geom b { font-weight: 600; }
.geom .adj { color: #7a5518; }

/* cover */
.art-row { display: flex; align-items: center; gap: 10px; margin-top: 4px; }

/* publish */
.pubs { display: flex; flex-direction: column; gap: 8px; margin: 14px 0 18px; }
.pub { display: flex; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 11px 12px; cursor: pointer; margin: 0; font-weight: 400; }
.pub input { accent-color: var(--accent); width: 16px; height: 16px; margin-top: 9px; flex: none; }
.pub:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(181,132,58,.12); }
.pub strong { font-family: var(--serif); font-size: 16.5px; font-weight: 500; display: block; margin-bottom: 4px; }
.pub .note { font-size: 11.5px; color: var(--muted); margin-top: 5px; line-height: 1.4; }
.paybox { background: var(--ink); color: #fff; border-radius: 12px; padding: 18px; margin-bottom: 16px; }
.paybox .price { font-family: var(--serif); font-size: 34px; }
.paybox p { color: #c9d1da; margin: 4px 0 14px; font-size: 13px; line-height: 1.5; }
.paybox.paid { background: #e3f1e8; color: var(--ok); }
.paybox.paid p { color: #3e6b50; margin-bottom: 0; }
.demo-note { font-size: 11.5px; color: #c9d1da; margin-top: 8px; }
.progress .bar { height: 6px; background: var(--paper-2); border-radius: 99px; overflow: hidden; margin: 14px 0 8px; }
.progress .bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .4s; }
.progress .log { font-size: 12px; color: var(--muted); max-height: 110px; overflow: auto; }
.downloads { list-style: none; padding: 0; margin: 14px 0; }
.downloads li a { display: flex; align-items: center; justify-content: space-between; text-decoration: none; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 6px; }
.downloads li a:hover { border-color: var(--accent); }
.downloads li.all a { background: var(--paper-2); font-weight: 600; }
.downloads .sz { color: var(--muted); font-size: 12px; }
.lulubox { background: #fff; border: 1px solid var(--accent); border-radius: 10px; padding: 2px 14px 14px; margin: -8px 0 18px; }
.lulubox h3 { border: 0; padding-top: 6px; margin-top: 10px; }
.premium-due { margin-top: 14px; padding-top: 12px; border-top: 1px solid #b9d8c4; }
.lulu-out { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 13px; margin: 10px 0; }
.lulu-out.err { background: #fdecea; border-color: #f1c4bc; color: #7d2a1d; }
.lulu-out .qhead { font-weight: 600; margin-bottom: 6px; }
.lulu-out .qrow { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
.lulu-out .qrow b { font-weight: 500; font-variant-numeric: tabular-nums; }
.lulu-out .qrow.total { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 6px; }
.lulu-out .qrow.total b { font-weight: 700; }
.lulu-out p { margin: 6px 0 0; }
label.invalid input, label.invalid select { border-color: var(--err); background: #fffafa; }
.field-err { display: block; color: var(--err); font-weight: 400; font-size: 12px; margin-top: 4px; }
.reimport { display: flex; align-items: center; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }

/* editor */
.editor { width: min(820px, 94vw); height: 86vh; border: 0; border-radius: 14px; padding: 0; box-shadow: 0 24px 80px rgba(0,0,0,.3); }
.editor::backdrop { background: rgba(29,43,58,.45); }
.editor[open] { display: flex; flex-direction: column; }
.ed-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--paper); }
.ed-head strong { font-family: var(--serif); font-size: 18px; font-weight: 500; flex: 1; }
.ed-tools { display: flex; gap: 4px; }
.ed-tools button { font: inherit; border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 4px 10px; cursor: pointer; }
.ed-body { flex: 1; overflow: auto; padding: 30px 60px; font-family: var(--serif); font-size: 18px; line-height: 1.6; outline: none; }
.ed-body p { margin: 0; text-indent: 1.5em; }
.ed-body hr { border: 0; text-align: center; margin: 14px 0; }
.ed-body hr::after { content: "⁂"; color: var(--muted); }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 13.5px; z-index: 100; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.toast.err { background: var(--err); }

@media (max-width: 1100px) {
  .workspace { grid-template-columns: 64px 340px 1fr; }
  .hero { grid-template-columns: 1fr; } .hero-art { display: none; }
  .platforms { grid-template-columns: repeat(2, 1fr); }
  .cover-layouts { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .workspace { grid-template-columns: 1fr; height: auto; }
  .rail { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .preview { height: 80vh; }
  .how { grid-template-columns: 1fr; }
  .platforms { grid-template-columns: 1fr; }
  .hero h1 { font-size: 40px; }
  .landing { padding: 0 16px 60px; }
}

/* language switch, privacy & expiry notes */
select.lang-switch { width: auto; margin: 0; padding: 5px 8px; font-size: 12.5px; }
.privacy { margin: 14px 0 0; padding: 12px 14px 12px 42px; background: #eef5f0; border: 1px solid #cfe3d6; border-radius: 10px; color: #285c3d; font-size: 13px; line-height: 1.5; position: relative; }
.privacy::before { content: "🔒"; position: absolute; left: 14px; top: 11px; font-size: 16px; }
.privacy strong { display: block; font-size: 14px; margin-bottom: 2px; }
.privacy p { margin: 4px 0 0; }
.privacy ul { margin: 4px 0 0; padding-left: 18px; }
.privacy li { margin: 3px 0 0; }
.expiry { background: #eef5f0; border: 1px solid #cfe3d6; color: #285c3d; border-radius: 8px; padding: 8px 12px; margin: 12px 0; }
.expiry:empty { display: none; }

/* arrange mode & page adjustments */
.tbtn { font: inherit; font-size: 12.5px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); border-radius: 7px; padding: 6px 10px; cursor: pointer; }
.tbtn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.arrange-hint { background: #fdf3e2; border-bottom: 1px solid #efd9b0; color: #7a5518; font-size: 12.5px; padding: 7px 14px; }
.adjust-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.queue-note { font-size: 13px; line-height: 1.45; color: #6b4a14; background: #fdf3e2; border: 1px solid #efd9b0; border-radius: 8px; padding: 8px 10px; margin: 6px 0 8px; animation: q-pulse 2s ease-in-out infinite; }
.queue-note b { display: block; }
@keyframes q-pulse { 50% { border-color: #d9a64e; } }

/* Custom design: chapter-opening layouts (i.n = number, i.t = title) */
.custom-design { background: #fff; border: 1.5px solid var(--accent); border-radius: 10px; padding: 0 14px 6px; margin-top: 12px; }
.custom-design h3 { border: 0; padding-top: 14px; margin-top: 0; }
.tips { list-style: none; margin: 16px 0 10px; padding: 12px 0 0; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.tips li { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.tips b { display: block; color: var(--ink); font-weight: 600; }
.tip-ic { flex: none; width: 26px; height: 26px; border-radius: 7px; background: var(--paper); border: 1px solid var(--line); display: grid; place-items: center; font-size: 12px; color: var(--ink-2); }
.tip-ic svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.openers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.opener-card { font: inherit; font-size: 11.5px; color: var(--ink-2); background: var(--paper); border: 1.5px solid var(--line); border-radius: 8px; padding: 8px 6px 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.opener-card:hover { border-color: #cbbfa8; }
.opener-card.on { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px rgba(181,132,58,.15); color: var(--ink); }
.om { position: relative; width: 64px; height: 44px; background: #fff; border: 1px solid var(--line); border-radius: 3px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.om i { display: block; background: var(--ink); border-radius: 1px; }
.om .n { width: 12px; height: 3px; opacity: .6; } .om .t { width: 34px; height: 5px; }
.om-side { flex-direction: row; gap: 5px; } .om-side .n { width: 8px; height: 14px; opacity: 1; border-right: 2px solid #fff; box-shadow: 2px 0 0 var(--ink); } .om-side .t { width: 28px; }
.om-watermark .n { position: absolute; width: 22px; height: 26px; background: #d9d9d9; opacity: 1; } .om-watermark .t { position: relative; }
.om-boxed { outline: 1px solid var(--ink); outline-offset: -7px; }
.om-banner .n { width: 22px; height: 7px; opacity: 1; }
.om-plaque .t { width: 42px; height: 12px; background: #d6d6d6; border: 1px solid var(--ink); border-radius: 3.5px; corner-shape: bevel; box-shadow: inset 0 0 0 1.5px #d6d6d6, inset 0 0 0 2px var(--ink); } .om-plaque .t::after { content: none; }
.om-framed::after { content: ""; position: absolute; inset: 4px; border: 1px solid var(--ink); border-radius: 4px; corner-shape: bevel; box-shadow: inset 0 0 0 1.5px #fff, inset 0 0 0 2.5px var(--ink); }
.orn-opt.icon { color: var(--ink); padding: 8px; } .orn-opt.icon svg { height: 100%; width: auto; max-width: 100%; }
.orn-opt.icon.wide { grid-column: span 2; }
.ed-body img { display: block; max-width: 45%; max-height: 260px; margin: 10px auto; border: 1px dashed var(--line); }
.ed-body img[data-pos="left"] { float: left; margin: 4px 16px 8px 0; } .ed-body img[data-pos="right"] { float: right; margin: 4px 0 8px 16px; }
.pic-pick { display: flex; align-items: center; gap: 12px; margin: 10px 0; }
.pic-pick img { width: 90px; height: 70px; object-fit: contain; background: #f6f3ec; border: 1px solid var(--line); border-radius: 6px; }

/* cover modes */
.cover-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 4px; }
.cover-modes button { font: inherit; text-align: left; background: #fff; border: 1.5px solid var(--line); border-radius: 9px; padding: 9px 10px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; }
.cover-modes button:hover { border-color: #cbbfa8; }
.cover-modes button.on { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(181,132,58,.15); }
.cover-modes strong { font-size: 13px; }
.cover-modes span { font-size: 11px; color: var(--muted); line-height: 1.3; }
.cover-modes em { font-style: normal; font-size: 11px; font-weight: 600; color: var(--accent-2); margin-top: auto; }
.rights { background: #fdf3e2; border: 1px solid #efd9b0; color: #7a5518; border-radius: 8px; padding: 10px 12px; margin: 8px 0 10px; }
.rights p { margin: 6px 0 0; line-height: 1.45; }
.rights label.check { margin: 0; color: #5e4112; font-weight: 500; align-items: flex-start; }
.rights label.check input { margin-top: 1px; flex: none; }
.rights.invalid { border-color: var(--err); box-shadow: 0 0 0 3px rgba(180,65,47,.15); }
/* cover designer: same geometry as the rendered cover (positions in %, sizes in cqw) */
.designer-stage { position: relative; width: 100%; aspect-ratio: 1 / 1.6; margin: 12px 0; border-radius: 4px; background: #2a2f36 center / cover no-repeat; container-type: size; overflow: hidden; box-shadow: 0 6px 20px rgba(0,0,0,.18); user-select: none; touch-action: none; }
.ds-safe { position: absolute; inset: 4.2%; border: 1px dashed rgba(255,255,255,.55); outline: 1px dashed rgba(0,0,0,.35); pointer-events: none; }
.ds-empty { position: absolute; inset: 0; display: grid; place-items: center; color: #c9d1da; font-size: 13px; text-align: center; padding: 20px; }
.designer-stage .dt { position: absolute; transform: translate(-50%, -50%); text-align: center; white-space: pre-line; line-height: 1.05; width: max-content; max-width: 94cqw; overflow-wrap: break-word; cursor: grab; padding: .05em .15em; border-radius: 3px; }
.designer-stage .dt:hover { outline: 1px dashed rgba(255,255,255,.8); }
.designer-stage .dt.on { outline: 1.5px solid #c8a35a; }
.ds-pick { margin-bottom: 10px; }
.qty-row { align-items: flex-end; }
.qty-row label { margin: 0; width: 110px; }

/* Recent books (this browser's own copies) */
.recent-wrap { position: relative; }
.recent-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 320px; max-height: 70vh; overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 34px rgba(0,0,0,.16); padding: 6px; }
.recent-head { font-size: 12px; font-weight: 600; color: var(--ink-2); padding: 6px 8px 8px; }
.recent-head span { font-weight: 400; color: var(--muted); }
.recent-item { display: flex; align-items: center; gap: 4px; border-radius: 8px; }
.recent-item:hover { background: var(--paper); }
.recent-open { flex: 1; min-width: 0; font: inherit; text-align: left; background: none; border: 0; padding: 8px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.recent-open strong { font-family: var(--serif); font-size: 16px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-open span { font-size: 12px; color: var(--muted); }
#downloadBtn { box-shadow: 0 0 0 3px rgba(181,132,58,.25); }

/* A paid book is finished and locked: the editing tabs are read-only. */
.lock-note { display: none; }
.locked .lock-note { display: flex; align-items: center; gap: 10px; background: #e3f1e8; border: 1px solid #b9d8c4; color: #285c3d; border-radius: 9px; padding: 10px 12px; margin: 0 0 14px; font-size: 13px; line-height: 1.45; }
.locked .lock-note span { flex: 1; }
.locked .tab:not([data-tab="publish"]) > :not(.lock-note) { pointer-events: none; opacity: .55; user-select: none; }
.locked .reimport { display: none; }

/* Opt-in boxes: nothing is uploaded, paid for or sent to a printer without one. */
.consent { display: flex; align-items: flex-start; gap: 9px; margin: 12px 0; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 9px; background: #fff; font-weight: 400; font-size: 13px; line-height: 1.45; color: var(--ink); cursor: pointer; }
.consent input { accent-color: var(--accent); width: 16px; height: 16px; margin-top: 1px; flex: none; }
.consent.invalid { border-color: var(--err); box-shadow: 0 0 0 3px rgba(180,65,47,.15); }
.paybox .consent { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.25); color: #e8edf2; }
.paybox .consent a { color: #f0c987; }
.paybox.paid .consent { background: #fff; color: var(--ink); border-color: #b9d8c4; }
.paybox.paid .consent a { color: var(--accent-2); }
.consent.big { margin: 16px 0 12px; padding: 16px 18px; gap: 14px; align-items: center; font-size: 16px; font-weight: 600; line-height: 1.4; border: 2px solid var(--accent); background: #fdf6ea; box-shadow: 0 2px 10px rgba(181,132,58,.12); }
.consent.big input { width: 26px; height: 26px; margin: 0; }
.consent.big.on { border-color: #3f7d58; background: #eef5f0; box-shadow: none; }
.consent-hint { margin: 0 0 4px; padding: 18px; border: 2px dashed var(--line); border-radius: 12px; text-align: center; color: var(--muted); font-size: 14px; }
.dropzone[hidden] { display: none; }
.privacy a, .consent a { color: var(--accent-2); }
.site-foot { text-align: center; padding: 28px 0 0; font-size: 13px; }
.site-foot a { color: var(--muted); }
.confirm-delete a { color: var(--accent-2); }

/* Structure: extra pages */
.sections li.extra { background: var(--paper); border-style: dashed; }
.sections li.extra .srow { gap: 8px; font-size: 13px; color: var(--ink-2); }
.sections li.extra .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sthumb { width: 30px; height: 40px; object-fit: cover; border: 1px solid var(--line); border-radius: 3px; background: #fff; }
.page-kinds { display: grid; gap: 6px; margin-bottom: 10px; }
#pagePicture .rights { margin-top: 4px; }
.page-kinds label.check { align-items: flex-start; }
.page-kinds input[type=radio] { accent-color: var(--accent); width: 15px; height: 15px; margin: 1px 0 0; flex: none; }

/* Popups over the preview: chapter heading, running head / page number, margins */
.pop { position: fixed; z-index: 60; width: 300px; max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(29, 43, 58, .18); padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.pop[hidden] { display: none; }
.pop-head { display: flex; align-items: center; gap: 8px; }
.pop-head b { flex: 1; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-x { border: 0; background: none; font-size: 18px; line-height: 1; cursor: pointer; color: var(--muted); padding: 2px 4px; }
.pop-x:hover { color: var(--ink); }
.pop .seg { display: flex; }
.pop .seg button { flex: 1; white-space: nowrap; padding: 6px 8px; }
.pop-label { font-size: 12px; color: var(--muted); margin-bottom: -4px; }
.pop-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pop label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); }
.pop label.pop-slider output { position: absolute; right: 12px; font-size: 11.5px; color: var(--muted); }
.pop label.pop-slider { position: relative; }
.pop select, .pop input[type="number"] { font: inherit; font-size: 13px; padding: 5px 6px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.pop .grid4 { gap: 0 6px; }
.pop .grid4 label.muted { color: var(--muted); }
.pop-note { margin: 0; }
.pop .btn.link { align-self: flex-start; padding: 0; }

.preview-as { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); white-space: nowrap; cursor: help; }
.preview-as select { cursor: pointer; }
.one-book { background: #f4efe4; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; color: var(--ink-2); }

input.invalid { border-color: #c0392b !important; background: #fff6f5; }
.field-err { display: block; color: #b03a2e; font-size: 11.5px; margin-top: 3px; }
.pic-warn { color: #8a4a12; background: #fdf3e2; border: 1px solid #efd9b0; border-radius: 6px; padding: 6px 8px; }
.isbn-note { margin: 4px 0 0; }
.hc-box { margin: 14px 0; padding: 4px 14px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.hc-row { padding: 10px 0; border-top: 1px solid var(--line); }
.hc-row:first-of-type { border-top: 0; }
.hc-row p { margin: 4px 0 8px; }
.hc-ok { color: #2f7a4a; font-size: 12px; margin-left: 6px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 8px; }
.pub-hc { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 12.5px; color: var(--ink-2); padding: 3px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); }
.hc-row details { margin-top: 4px; }
.hc-row summary { cursor: pointer; color: var(--accent); }
.checks-box { margin: 12px 0; padding: 4px 14px 12px; border: 1.5px solid #e2b866; border-radius: 10px; background: #fffaf0; transition: box-shadow .3s; }
.checks-box h3 { margin: 10px 0 6px; }
.checks-box ul { margin: 0 0 10px; padding-left: 18px; font-size: 13px; line-height: 1.45; }
.checks-box li { margin-bottom: 6px; }
.checks-box li b { display: block; font-size: 12px; color: var(--ink-2); }
.checks-box.flash { box-shadow: 0 0 0 4px rgba(226, 184, 102, .55); }
.downloads.locked a { opacity: .45; }
.isbn-box { margin: 14px 0; padding: 4px 14px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.isbn-box h3 { margin: 10px 0 4px; }
.isbn-help { line-height: 1.45; }
.isbn-gate { margin: 12px 0; padding: 10px 14px; border: 1.5px solid #e2b866; border-radius: 10px; background: #fffaf0; font-size: 13px; line-height: 1.45; }
.isbn-gate p { margin: 6px 0 8px; }
.isbn-gate.invalid { border-color: #c0392b; box-shadow: 0 0 0 3px rgba(192, 57, 43, .15); }
.reader-box { margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(40, 92, 61, .25); display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.reader-box p { margin: 0; }
.reader-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; margin-top: 4px; }
.reader-btn { display: flex; align-items: center; justify-content: flex-start; gap: 9px; text-align: left; line-height: 1.3; padding: 9px 12px; border-radius: 10px; background: #fff; white-space: normal; }
.reader-btn svg { flex: none; opacity: .85; }
.reader-btn span { display: flex; flex-direction: column; gap: 2px; }
.reader-btn b { font-weight: 600; }
.reader-btn small { font-size: 11.5px; opacity: .75; }
.paybox.paid .reader-btn { color: var(--ok); border-color: #b9d8c4; }
.paybox.paid .reader-btn:hover { border-color: var(--ok); background: #f4faf6; }
/* Before payment the box sits on the dark pay panel. */
.reader-box.sample { border-top-color: rgba(255, 255, 255, .18); color: #fff; }
.reader-box.sample p { color: #c9d1da; }
.reader-box.sample .reader-btn { background: rgba(255, 255, 255, .06); color: #fff; border-color: rgba(255, 255, 255, .3); }
.reader-box.sample .reader-btn:hover { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .6); }
.reader-box.sample #readerNote { color: #e8edf2; }
@media (max-width: 520px) { .reader-btns { grid-template-columns: 1fr; } }
.upload-needs-rights.locked { opacity: .5; }
.rights-hint { color: #8a5a12; margin-left: 8px; }

/* Cookie banner (Google Analytics only loads after "Accept"; see analytics.js). */
.cookie { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 1000; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; box-shadow: 0 12px 40px rgba(0,0,0,.2); font-family: var(--sans); }
.cookie[hidden] { display: none; }
.cookie p { margin: 0; flex: 1 1 260px; font-size: 14px; line-height: 1.5; }
.cookie a { color: var(--accent-2); }
.cookie div { display: flex; gap: 8px; }
@media (min-width: 700px) { .cookie { left: auto; max-width: 520px; } }
.linkish { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; }

#customMargins .margin-note { grid-column: 1 / -1; margin: 2px 0 0; }
