:root {
  --paper: #fbf6ee;
  --card: #ffffff;
  --ink: #1f2a44;
  --muted: #586078;
  --line: #e6ddce;
  --line-strong: #cfc4b0;
  --primary: #c23e1b;
  --primary-hover: #a23214;
  --on-primary: #ffffff;
  --teal: #0c6f6e;
  --teal-soft: #e2f1ef;
  --sun: #f6c445;
  --sun-soft: #fdf1cf;
  --focus: #2456b8;
  --danger: #b3261e;
  --warn: #9a5b00;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(31, 42, 68, .06), 0 6px 20px rgba(31, 42, 68, .07);
  --font-head: 'Fredoka', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.5 var(--font-body); }
h1, h2, h3, legend { font-family: var(--font-head); font-weight: 600; line-height: 1.2; margin: 0; }
h1 { font-size: clamp(26px, 3.2vw, 36px); }
h2 { font-size: 22px; }
h3 { font-size: 16px; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--teal); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1.5px solid var(--line-strong); background: var(--card); font-weight: 700; transition: background .15s, border-color .15s, transform .1s; }
.btn:hover { border-color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(31, 42, 68, .07); }
.btn.danger { color: var(--danger); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; }
.icon-btn:hover { background: rgba(31, 42, 68, .08); }
.icon-btn[disabled] { opacity: .35; cursor: not-allowed; }
.icon-btn.on { background: var(--teal-soft); color: var(--teal); }

/* fields */
label.field { display: grid; gap: 6px; font-weight: 700; font-size: 14px; }
label.field .hint, .hint { font-weight: 500; color: var(--muted); font-size: 13px; }
input[type=text], input[type=number], select, textarea { width: 100%; min-height: 44px; padding: 9px 12px; border: 1.5px solid var(--line-strong); border-radius: 10px; background: #fff; }
textarea { resize: vertical; min-height: 84px; line-height: 1.45; }
input[type=range] { width: 100%; accent-color: var(--teal); }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--teal); flex: none; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; font-size: 14px; cursor: pointer; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; height: 60px; padding: 0 16px; background: rgba(251, 246, 238, .94); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font: 600 20px var(--font-head); color: var(--ink); text-decoration: none; }
.brand .mark { width: 32px; height: 32px; border-radius: 9px; background: var(--primary); color: #fff; display: grid; place-items: center; }
.topbar .spacer { flex: 1; }
.title-input { flex: 1; min-width: 80px; max-width: 520px; min-height: 40px; font: 600 18px var(--font-head); border-color: transparent; background: transparent; }
.title-input:hover, .title-input:focus { border-color: var(--line-strong); background: #fff; }
.save-state { font-size: 13px; color: var(--muted); white-space: nowrap; }

/* home */
.home { max-width: 1080px; margin: 0 auto; padding: 28px 20px 80px; display: grid; gap: 40px; }
.banner { padding: 12px 16px; border-radius: 12px; background: var(--sun-soft); border: 1px solid #ecd58f; font-weight: 600; }
.banner.error { background: #fde9e7; border-color: #f2b8b3; color: #7a1b15; }
.maker { background: var(--card); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); padding: clamp(18px, 3vw, 32px); display: grid; gap: 26px; }
.maker .lede { color: var(--muted); margin-top: 6px; }
.topic { min-height: 96px; font-size: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line-strong); background: #fff; font-size: 14px; font-weight: 600; transition: background .15s, border-color .15s; }
.chip:hover { border-color: var(--teal); background: var(--teal-soft); }
fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 12px; min-width: 0; }
legend { font-size: 18px; padding: 0; margin-bottom: 4px; }
.seg { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.seg label, .cards label { position: relative; cursor: pointer; }
.seg input, .cards input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg .opt { display: grid; gap: 1px; padding: 10px 12px; min-height: 60px; border: 1.5px solid var(--line-strong); border-radius: 12px; background: #fff; text-align: center; transition: background .15s, border-color .15s; }
.seg .opt b { font: 600 18px var(--font-head); }
.seg .opt span { font-size: 12.5px; color: var(--muted); }
.seg input:checked + .opt, .cards input:checked + .card { border-color: var(--teal); background: var(--teal-soft); box-shadow: 0 0 0 2px var(--teal) inset; }
.seg input:focus-visible + .opt, .cards input:focus-visible + .card { outline: 3px solid var(--focus); outline-offset: 2px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.card { display: grid; gap: 4px; padding: 8px 8px 12px; border: 1.5px solid var(--line-strong); border-radius: 14px; background: #fff; height: 100%; transition: border-color .15s, background .15s; }
.card:hover { border-color: var(--teal); }
.card .swatch { aspect-ratio: 1; border-radius: 9px; background: #f1eadc center/cover; display: grid; place-items: center; color: var(--muted); overflow: hidden; }
.card .swatch img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card b { font: 600 15px var(--font-head); padding: 4px 4px 0; }
.card span { font-size: 12.5px; color: var(--muted); padding: 0 4px; line-height: 1.35; }
.refs { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ref { position: relative; width: 72px; height: 72px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line-strong); }
.ref img { width: 100%; height: 100%; object-fit: cover; }
.ref button { position: absolute; top: 2px; right: 2px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(31, 42, 68, .8); color: #fff; display: grid; place-items: center; }
.ref button svg { width: 12px; height: 12px; }
details.more { border-top: 1px solid var(--line); padding-top: 18px; }
details.more > summary { cursor: pointer; font: 600 17px var(--font-head); list-style: none; display: flex; align-items: center; gap: 8px; min-height: 44px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary .ic { transition: transform .2s; }
details.more[open] > summary .ic { transform: rotate(90deg); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin-top: 12px; align-items: start; }
.grid2 .wide { grid-column: 1 / -1; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.cta-row .btn.primary { min-height: 52px; padding: 0 26px; font-size: 18px; }
.estimate { color: var(--muted); font-size: 14px; }
.library h2 { margin-bottom: 14px; }
.books { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.book-card { position: relative; display: grid; gap: 8px; padding: 10px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); text-decoration: none; color: inherit; transition: transform .15s, border-color .15s; }
.book-card:hover { transform: translateY(-2px); border-color: var(--teal); }
.book-card .thumb { aspect-ratio: 1; border-radius: 10px; background: #f1eadc center/cover; display: grid; place-items: center; color: var(--muted); font-size: 13px; overflow: hidden; }
.book-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.book-card b { font: 600 15px var(--font-head); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.book-card small { color: var(--muted); }
.book-card .del { position: absolute; top: 14px; right: 14px; background: rgba(255, 255, 255, .92); opacity: 0; transition: opacity .15s; }
.book-card:hover .del, .book-card .del:focus-visible { opacity: 1; }
.empty { color: var(--muted); padding: 18px; border: 1.5px dashed var(--line-strong); border-radius: 14px; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--sun-soft); color: #6b4a00; }
.tag.err { background: #fde9e7; color: #7a1b15; }

/* progress */
.progress { max-width: 980px; margin: 0 auto; padding: 28px 20px 80px; display: grid; gap: 22px; }
.steps { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }
.steps li { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; border: 1.5px solid var(--line-strong); font-size: 14px; font-weight: 700; color: var(--muted); background: #fff; }
.steps li.done { border-color: var(--teal); color: var(--teal); background: var(--teal-soft); }
.steps li.now { border-color: var(--primary); color: var(--primary); }
.steps li.now::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--primary); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.bar { height: 10px; border-radius: 999px; background: #ece4d5; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--teal); border-radius: 999px; transition: width .5s ease; }
.live { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.live .pg { border-radius: 10px; box-shadow: var(--shadow); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* outline */
.outline { max-width: 1180px; margin: 0 auto; padding: 22px 20px 80px; display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 24px; align-items: start; }
.outline .col { display: grid; gap: 14px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 12px; box-shadow: var(--shadow); }
.opage { display: grid; gap: 10px; }
.opage header { display: flex; align-items: center; gap: 6px; }
.opage header b { font: 600 16px var(--font-head); flex: 1; }
.lint { font-size: 13px; color: var(--muted); }
.lint.warn { color: var(--warn); font-weight: 700; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatches i { width: 26px; height: 26px; border-radius: 7px; border: 1px solid rgba(0, 0, 0, .15); }
.facts { margin: 0; padding-left: 18px; font-size: 14px; display: grid; gap: 6px; }
.facts a { word-break: break-all; }

/* editor */
.editor { display: grid; grid-template-columns: 148px minmax(0, 1fr) 340px; height: calc(100vh - 60px); }
.rail { overflow-y: auto; padding: 12px 10px 24px; border-right: 1px solid var(--line); display: grid; gap: 10px; align-content: start; background: #f6efe3; }
.rail-item { position: relative; display: grid; gap: 3px; padding: 5px; border-radius: 10px; border: 2px solid transparent; background: transparent; text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); }
.rail-item .pg { border-radius: 6px; box-shadow: 0 1px 4px rgba(31, 42, 68, .18); pointer-events: none; }
.rail-item.sel { border-color: var(--teal); background: #fff; color: var(--ink); }
.rail-item.drop { box-shadow: 0 -3px 0 var(--primary); }
.rail-item .dot { position: absolute; top: 8px; right: 8px; width: 12px; height: 12px; border-radius: 50%; background: #e09b17; border: 2px solid #fff; }
.rail-item .dot.err { background: var(--danger); }
.rail-add { min-height: 44px; border: 1.5px dashed var(--line-strong); border-radius: 10px; background: transparent; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 6px; }
.rail-add:hover { border-color: var(--teal); background: var(--teal-soft); }
.stage { position: relative; display: grid; grid-template-rows: minmax(0, 1fr) auto; overflow: hidden; background: #ebe3d4; }
.canvas-wrap { display: grid; place-items: center; padding: 20px; min-height: 0; container-type: size; }
.canvas { width: min(100cqw, 100cqh); box-shadow: 0 10px 40px rgba(31, 42, 68, .25); position: relative; }
.canvas .pg { border-radius: 4px; }
.stage-bar { display: flex; align-items: center; gap: 4px; padding: 8px 14px; background: var(--paper); border-top: 1px solid var(--line); flex-wrap: wrap; }
.stage-bar .count { font-weight: 700; font-size: 14px; min-width: 96px; text-align: center; }
.stage-bar .spacer { flex: 1; }
.canvas .tb { cursor: grab; touch-action: none; user-select: none; }
.canvas .tb:hover { outline: 2px dashed rgba(36, 86, 184, .55); outline-offset: 1px; }
.canvas .tb.sel { outline: 2px solid var(--focus); outline-offset: 1px; }
.canvas .tb.dragging { cursor: grabbing; }
.canvas .tb.editing { cursor: text; user-select: text; outline: 2px solid var(--primary); }
.canvas .tb.editing .tb-text { user-select: text; }
.handle { position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2.5px solid var(--focus); z-index: 3; font-size: 0; }
.handle.w { right: -9px; top: 50%; margin-top: -8px; cursor: ew-resize; }
.handle.s { right: -9px; bottom: -9px; cursor: nwse-resize; border-radius: 4px; }
.guide-v { position: absolute; top: 0; bottom: 0; left: 50%; width: 0; border-left: 1.5px dashed var(--primary); pointer-events: none; display: none; z-index: 4; }
.guide-v.on { display: block; }
.busy-veil { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(251, 246, 238, .6); font: 600 18px var(--font-head); z-index: 5; pointer-events: none; }
.spin { width: 20px; height: 20px; border-radius: 50%; border: 3px solid rgba(31, 42, 68, .2); border-top-color: var(--teal); animation: spin .8s linear infinite; display: inline-block; vertical-align: -4px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

.insp { border-left: 1px solid var(--line); background: var(--card); display: grid; grid-template-rows: auto minmax(0, 1fr); min-height: 0; }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.tabs button { min-height: 48px; border: 0; background: transparent; font: 600 15px var(--font-head); color: var(--muted); border-bottom: 3px solid transparent; display: flex; align-items: center; justify-content: center; gap: 6px; }
.tabs button[aria-selected=true] { color: var(--ink); border-bottom-color: var(--primary); }
.tabs button:hover { background: rgba(31, 42, 68, .04); }
.insp-body { overflow-y: auto; padding: 16px; display: grid; gap: 18px; align-content: start; }
.group { display: grid; gap: 10px; }
.group > h3 { display: flex; align-items: center; gap: 6px; }
.versions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.versions button { padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; background: #f1eadc; aspect-ratio: 1; position: relative; }
.versions button img { width: 100%; height: 100%; object-fit: cover; display: block; }
.versions button.cur { border-color: var(--teal); box-shadow: 0 0 0 2px var(--teal); }
.versions button .flag { position: absolute; left: 3px; bottom: 3px; width: 10px; height: 10px; border-radius: 50%; background: #e09b17; border: 1.5px solid #fff; }
.seg-btns { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1.5px solid var(--line-strong); border-radius: 10px; overflow: hidden; }
.seg-btns button { min-height: 40px; border: 0; background: #fff; font-weight: 700; font-size: 14px; display: grid; place-items: center; border-right: 1px solid var(--line); }
.seg-btns button:last-child { border-right: 0; }
.seg-btns button[aria-pressed=true] { background: var(--teal-soft); color: var(--teal); }
.colors { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.colors button { width: 30px; height: 30px; border-radius: 8px; border: 1.5px solid rgba(0, 0, 0, .2); padding: 0; }
.colors button[aria-pressed=true] { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--focus); }
.colors input[type=color] { width: 34px; height: 32px; padding: 0; border: 1.5px solid var(--line-strong); border-radius: 8px; background: #fff; min-height: 0; }
.slider-row { display: grid; grid-template-columns: 1fr 64px; gap: 10px; align-items: center; }
.slider-row input[type=number] { min-height: 38px; padding: 4px 8px; }
.note { font-size: 13.5px; color: var(--muted); }
.note.warn { color: var(--warn); font-weight: 600; }
.note.err { color: var(--danger); font-weight: 600; }
.readtable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.readtable th, .readtable td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.readtable tr.clicky { cursor: pointer; }
.readtable tr.clicky:hover { background: var(--teal-soft); }
.castrow { display: grid; grid-template-columns: 56px 1fr; gap: 10px; align-items: start; font-size: 13.5px; }
.castrow { padding: 10px 0; border-top: 1px solid var(--line); }
.castbody { display: grid; gap: 6px; min-width: 0; }
.castbody textarea { min-height: 64px; font-size: 13.5px; }
.castbody .row { gap: 6px; }
.castrow img, .castrow .ph { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; background: #f1eadc; }
.menu { position: relative; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); min-width: 280px; background: #fff; border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: 0 12px 36px rgba(31, 42, 68, .2); padding: 6px; z-index: 30; display: grid; }
.menu-pop button { text-align: left; border: 0; background: transparent; padding: 10px 12px; border-radius: 8px; display: grid; gap: 1px; }
.menu-pop button:hover { background: var(--teal-soft); }
.menu-pop button small { color: var(--muted); }

/* preview */
.preview { position: fixed; inset: 0; z-index: 50; background: rgba(22, 26, 40, .93); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; color: #fff; }
.preview header, .preview footer { display: flex; align-items: center; gap: 12px; padding: 12px 18px; justify-content: space-between; }
.preview .spread { display: flex; justify-content: center; align-items: center; gap: 0; padding: 0 12px; min-height: 0; container-type: size; }
.preview .spread .pg { width: min(49cqw, 96cqh); flex: none; box-shadow: 0 12px 50px rgba(0, 0, 0, .5); }
.preview .spread.single .pg { width: min(96cqw, 96cqh); }
.preview .icon-btn { color: #fff; }
.preview .icon-btn:hover { background: rgba(255, 255, 255, .15); }

#toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 80; width: min(92vw, 460px); }
.toast { padding: 12px 16px; border-radius: 12px; background: var(--ink); color: #fff; font-weight: 600; box-shadow: 0 8px 30px rgba(0, 0, 0, .25); animation: rise .2s ease-out; }
.toast.err { background: #8c1d18; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 980px) {
  .editor { grid-template-columns: 1fr; grid-template-rows: auto minmax(360px, 62vh) auto; height: auto; }
  .rail { display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; }
  .rail-item { width: 84px; flex: none; }
  .rail-add { width: 84px; flex: none; }
  .insp { border-left: 0; border-top: 1px solid var(--line); }
  .outline { grid-template-columns: 1fr; }
  .save-state { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
@media (max-width: 560px) {
  .topbar { gap: 4px; padding: 0 8px; }
  .editor-top .btn.small:has(svg) { font-size: 0; gap: 0; padding: 0 11px; }
  .title-input { min-width: 0; flex: 1 1 40px; padding: 6px 8px; font-size: 16px; }
  .brand span:last-child { font-size: 17px; }
}

/* ---- shop: navigation ---- */
.navwrap { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.mainnav { display: flex; gap: 4px; margin-left: 12px; }
.mainnav a { padding: 8px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 15px; }
.mainnav a:hover { background: rgba(31, 42, 68, .07); }
.navright { display: flex; align-items: center; gap: 8px; }
.credits-pill { padding: 6px 12px; border-radius: 999px; background: var(--sun-soft); color: #6b4a00; text-decoration: none; font-size: 14px; white-space: nowrap; }
.cart-btn { position: relative; color: var(--ink); }
.badge { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; border-radius: 9px; background: var(--primary); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; padding: 0 4px; }
.menu-pop a { display: block; padding: 10px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.menu-pop a:hover { background: var(--teal-soft); }
.menu-head { padding: 8px 12px 10px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 4px; display: flex; gap: 6px; align-items: center; }
/* ---- shop: pages ---- */
.shop { max-width: 1120px; margin: 0 auto; padding: 24px 20px 80px; display: grid; gap: 22px; }
.shop h1 { font-size: clamp(24px, 3vw, 32px); }
.panel.narrow { max-width: 520px; margin: 30px auto; padding: 28px; }
.stack { display: grid; gap: 14px; }
.hero { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(260px, 1fr); gap: 28px; align-items: end; padding: 32px; border-radius: 24px; background: linear-gradient(135deg, #fff3d6, #e3f2ee); border: 1px solid var(--line); }
.hero h1 { font-size: clamp(28px, 4vw, 44px); margin-bottom: 10px; }
.hero .lede { font-size: 18px; color: var(--muted); margin-bottom: 18px; }
.btn.big { min-height: 52px; padding: 0 24px; font-size: 18px; }
.searchbar { display: flex; gap: 8px; }
.searchbar input { flex: 1; }
.sections { display: grid; gap: 30px; }
.shelf-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.shelf-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(170px, 190px); gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.book-card .stats { color: var(--ink); font-weight: 700; }
.filters { gap: 16px; }
.field.inline { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.field.inline select { width: auto; min-height: 40px; }
.listing { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(300px, 1fr); gap: 28px; align-items: start; }
.viewer { display: grid; gap: 10px; }
.viewer .pg { border-radius: 8px; box-shadow: 0 10px 40px rgba(31, 42, 68, .2); }
.row.center { justify-content: center; }
.buybox { gap: 14px; position: sticky; top: 80px; }
.price { display: flex; align-items: baseline; gap: 8px; }
.price b { font: 700 30px var(--font-head); }
.qty { width: 80px !important; }
.cartline { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto auto auto; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cartline .thumb { width: 64px; height: 64px; border-radius: 8px; overflow: hidden; background: #f1eadc; }
.cartline .thumb img { width: 100%; height: 100%; object-fit: cover; }
.cartline .amount { text-align: right; font-weight: 700; min-width: 80px; }
.grow { flex: 1; min-width: 0; }
.carttotal { display: flex; justify-content: space-between; padding: 10px 0; font-size: 18px; }
.orderrow { display: flex; gap: 16px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; flex-wrap: wrap; }
.orderrow:hover { background: #fffaf2; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.plan ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.plan.current { border-color: var(--teal); box-shadow: 0 0 0 2px var(--teal); }
.meter { display: grid; gap: 8px; max-width: 520px; }
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { gap: 4px; }
.stat b { font: 700 24px var(--font-head); }
.modal { position: fixed; inset: 0; z-index: 70; background: rgba(22, 26, 40, .5); display: grid; place-items: center; padding: 16px; }
.modal .panel { max-width: 460px; }
@media (max-width: 860px) {
  .mainnav { display: none; }
  .hero, .listing { grid-template-columns: 1fr; }
  .buybox { position: static; }
  .cartline { grid-template-columns: 48px minmax(0, 1fr) auto; }
  .brand-name { display: none; }
}
input[type=search], input[type=email] { width: 100%; min-height: 44px; padding: 9px 12px; border: 1.5px solid var(--line-strong); border-radius: 10px; background: #fff; }
.buybox hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; width: 100%; }
.shop > *, .sections, .shelf { min-width: 0; }
.shelf-row { max-width: 100%; }
@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; height: auto; min-height: 60px; padding-top: 8px; padding-bottom: 6px; row-gap: 4px; }
  .navwrap { flex-wrap: wrap; }
  .mainnav { display: flex; order: 3; width: 100%; margin: 0; overflow-x: auto; }
  .mainnav a { padding: 6px 10px; font-size: 14px; white-space: nowrap; }
  .hero { padding: 22px 18px; }
  .hero .row { flex-wrap: wrap; }
  .searchbar { flex-wrap: nowrap; }
}

.linklike { background: none; border: 0; padding: 4px 0; color: var(--muted); text-decoration: underline; font-size: 14px; justify-self: start; }
.banner.invite { background: var(--teal-soft); border-color: #b5ddd6; }
.carttotal.reward { color: var(--teal); font-size: 16px; }

.consent { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 90; max-width: 560px; margin: 0 auto; background: #fff;
  border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: 0 12px 40px rgba(31, 42, 68, .2); padding: 14px 16px;
  display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; font-size: 14px; }
.consent p { margin: 0; flex: 1 1 260px; }

/* ---- UX pass (2026-11-22) ---- */
/* 2. phone cart: thumbnail and title on one row, quantity, price and remove on the next */
@media (max-width: 860px) {
  .cartline { grid-template-columns: 88px minmax(0, 1fr) auto; grid-template-areas: "thumb title title" "qty amount remove"; row-gap: 8px; }
  .cartline > :nth-child(1) { grid-area: thumb; } .cartline > :nth-child(2) { grid-area: title; }
  .cartline > :nth-child(3) { grid-area: qty; } .cartline > :nth-child(4) { grid-area: amount; text-align: left; }
  .cartline > :nth-child(5) { grid-area: remove; justify-self: end; }
  .consent { padding: 10px 12px; font-size: 13px; gap: 8px; }
  .consent p { flex-basis: 100%; }
}
/* 4. how it works */
.how { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.how .step { display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: start; padding: 16px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); }
.how .num { width: 44px; height: 44px; border-radius: 50%; background: var(--sun-soft); color: #6b4a00; display: grid; place-items: center; font: 700 20px var(--font-head); }
.how b { font: 600 17px var(--font-head); display: block; margin-bottom: 2px; }
.how p { color: var(--muted); font-size: 14.5px; }
/* 6. progress page */
.progress .wait { display: grid; gap: 6px; padding: 18px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); }
.progress .wait b { font: 600 18px var(--font-head); }
/* 3. editor first-run tip and order button */
.tip { pointer-events: none; position: absolute; left: 16px; right: 16px; top: 12px; z-index: 6; margin: 0 auto; max-width: 620px; background: var(--ink); color: #fff;
  border-radius: 14px; padding: 12px 16px; display: flex; gap: 12px; align-items: flex-start; box-shadow: 0 10px 30px rgba(0,0,0,.25); font-size: 14.5px; }
.tip ol { margin: 4px 0 0; padding-left: 18px; display: grid; gap: 2px; }
.tip button { pointer-events: auto; flex: none; background: rgba(255,255,255,.15); color: #fff; border: 0; border-radius: 8px; padding: 6px 10px; font-weight: 700; }
/* 7. order timeline */
.timeline { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 10px; }
.timeline li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; color: var(--muted); }
.timeline li::before { content: ""; width: 14px; height: 14px; margin-top: 4px; border-radius: 50%; border: 2px solid var(--line-strong); background: #fff; }
.timeline li.done { color: var(--ink); } .timeline li.done::before { background: var(--teal); border-color: var(--teal); }
.timeline li.now { color: var(--ink); font-weight: 700; } .timeline li.now::before { border-color: var(--primary); background: var(--sun-soft); }
/* 8. checkout reassurance */
.assure { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: 13.5px; }
/* 9. footer */
.sitefoot { max-width: 1120px; margin: 0 auto; padding: 24px 20px 40px; display: flex; flex-wrap: wrap; gap: 8px 22px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); }
.sitefoot a { color: var(--muted); }
.sitefoot .maker { flex-basis: 100%; font-size: 13px; }
.orderline { display: flex; gap: 14px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--line); }
.grid2.tight { margin-top: 0; gap: 12px 16px; }
.order-dlg { display: grid; gap: 12px; }
.stepper { align-items: center; gap: 10px; flex-wrap: wrap; }
.stepper .count-out { min-width: 2ch; text-align: center; font: 700 20px var(--font-head); }
.stepper b { margin-left: auto; }
.fit-tag { justify-self: start; background: var(--sun-soft); color: #6b4a00; border-radius: 999px; padding: 2px 8px; font-size: 12px; font-weight: 700; }
.banner.good { background: #e4f4ee; border-color: #a8d6c5; }
@media (max-width: 600px) {
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .cards .card { padding: 6px; gap: 4px; }
  .cards .card > span:not(.swatch):not(.fit-tag) { display: none; }
  .cards .card b { font-size: 13px; line-height: 1.2; }
}
@media (max-width: 600px) {
  .editor-top { flex-wrap: wrap; height: auto; padding: 6px 8px; row-gap: 6px; }
  .editor-top .title-input { order: 10; flex: 1 1 100%; max-width: none; height: 40px; font-size: 17px; }
  .editor-top .save-state { display: none; }
}
@media (max-width: 600px) {
  .books { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}
@media (max-width: 600px) { .canvas-wrap { scroll-margin-top: 112px; } }
.banner.missing { position: absolute; left: 16px; right: 16px; top: 12px; z-index: 6; margin: 0 auto; max-width: 560px;
  display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
