:root {
  --paper: #f2efe7;
  --paper-2: #e8e4d8;
  --paper-3: #ddd8ca;
  --ink: #16181b;
  --ink-2: #3b3e43;
  --muted: #7a776e;
  --line: #d3cdbe;
  --accent: #e0482f;
  --accent-ink: #b8341f;
  --have: #2d7a4b;
  --desk: #e0dbcf;
  --pagebg: #141517;
  --r: 4px;
  --ui: 'Schibsted Grotesk', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --serif: 'Instrument Serif', Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font: 14px/1.45 var(--ui); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-underline-offset: 3px; }
button, input, select { font: inherit; color: inherit; }
img { display: block; }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 28px; font-weight: 800; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: 0.92em; }
.center { text-align: center; }
.grow { flex: 1; }
.grow2 { flex: 2; }
.pad { padding: 4px 2px; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row3 { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; margin: 12px 0; }
.err { color: var(--accent-ink); margin: 0; }
.warn { background: #f6e2c6; border-left: 3px solid #c47f1b; padding: 8px 10px; margin: 8px 0 0; font-size: 13px; }
kbd { font: 11px var(--mono); border: 1px solid var(--line); border-bottom-width: 2px; padding: 0 4px; border-radius: 3px; background: #fff; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border: 1px solid var(--ink); background: var(--ink); color: var(--paper); border-radius: var(--r); font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .12s, transform .05s; }
.btn:hover { background: #000; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink); background: rgba(0,0,0,.03); }
.btn.danger { color: var(--accent-ink); }
.btn.danger:not(.ghost) { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.big { height: 44px; padding: 0 22px; font-size: 15px; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn.icon-only { width: 34px; padding: 0; font-size: 18px; }
.btn.have { background: var(--have); border-color: var(--have); }
.link { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 3px; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); padding: 2px; background: var(--paper); }
.seg button { border: 0; background: none; padding: 0 10px; height: 28px; border-radius: 2px; cursor: pointer; color: var(--ink-2); font-weight: 500; }
.seg button.on { background: var(--ink); color: var(--paper); }
.seg.sm button { height: 24px; padding: 0 8px; font-size: 12.5px; }

/* fields */
.field { display: flex; flex-direction: column; gap: 5px; margin: 0 0 12px; }
.field > span, .num > span { font-size: 12px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }
.field input:not([type=range]):not([type=checkbox]), .field select, input.search, .copyrow input {
  height: 38px; border: 1px solid var(--line); background: #fff; border-radius: var(--r); padding: 0 11px; outline: none; width: 100%;
}
.field input:focus, .field select:focus, input.search:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(22,24,27,.08); }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.field.inline input { width: 72px !important; height: 30px !important; }
.field.inline em { color: var(--muted); font-style: normal; }
input[type=range] { accent-color: var(--ink); width: 100%; }
.num { display: flex; flex-direction: column; gap: 5px; }
.num > div { display: flex; height: 38px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; overflow: hidden; width: 118px; }
.num button { width: 34px; border: 0; background: var(--paper); cursor: pointer; font-size: 16px; }
.num button:hover { background: var(--paper-2); }
.num input { width: 50px; border: 0; text-align: center; outline: none; font-family: var(--mono); }
.chk { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; margin: 10px 0; font-weight: 500; }
.switch input { display: none; }
.switch span { width: 34px; height: 20px; border-radius: 10px; background: var(--paper-3); position: relative; transition: background .15s; flex: none; }
.switch span::after { content: ''; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--ink); }
.switch input:checked + span::after { left: 16px; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatches button { width: 24px; height: 24px; border-radius: 3px; border: 1px solid rgba(0,0,0,.15); cursor: pointer; }
.swatches button.on { outline: 2px solid var(--ink); outline-offset: 2px; }

/* shell */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.app.bare .view { flex: 1; display: flex; flex-direction: column; }
.view { flex: 1; }
.top { height: 58px; display: flex; align-items: center; gap: 18px; padding: 0 28px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 17px; text-decoration: none; letter-spacing: -0.02em; }
.mark { width: 24px; height: 24px; color: var(--ink); }
.nav { text-decoration: none; font-weight: 500; color: var(--ink-2); }
.nav:hover { color: var(--ink); }
.pro { font: 600 10px var(--mono); font-style: normal; background: var(--accent); color: #fff; padding: 1px 4px; border-radius: 2px; vertical-align: 1px; }
.foot { display: flex; gap: 18px; flex-wrap: wrap; padding: 22px 28px; border-top: 1px solid var(--line); font-size: 12px; margin-top: 40px; }
.foot > span:first-child { font-weight: 700; }
.center-msg { min-height: 50vh; display: grid; place-content: center; gap: 10px; text-align: center; }
.spin { width: 22px; height: 22px; border: 2px solid var(--line); border-top-color: var(--ink); border-radius: 50%; animation: spin .7s linear infinite; margin: 20px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: var(--r); z-index: 200; font-weight: 500; animation: up .18s ease-out; box-shadow: 0 6px 24px rgba(0,0,0,.18); }
.toast.bad { background: var(--accent-ink); }
@keyframes up { from { opacity: 0; transform: translate(-50%, 8px); } }

/* landing */
.landing { max-width: 1240px; margin: 0 auto; padding: 0 28px; }
.hero { display: grid; grid-template-columns: minmax(320px, 5fr) 7fr; gap: 48px; align-items: center; padding: 64px 0 56px; }
.hero h1 { font: 400 clamp(44px, 5.6vw, 74px)/0.98 var(--serif); letter-spacing: -0.02em; }
.hero h1 em { color: var(--accent); }
.lede { font-size: 17px; color: var(--ink-2); max-width: 30em; margin: 22px 0 26px; }
.demo { transform: rotate(-1.2deg); }
.demo .spread { box-shadow: 0 30px 60px -20px rgba(0,0,0,.35); }
.demo-ph { aspect-ratio: 1.45; background: var(--paper-2); border-radius: 6px; }
.feat { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--ink); }
.feat > div { padding: 22px 22px 26px 0; border-bottom: 1px solid var(--line); }
.feat > div:not(:nth-child(3n+1)) { padding-left: 22px; border-left: 1px solid var(--line); }
.feat .n { color: var(--accent); }
.feat h3 { margin: 6px 0 4px; font-size: 18px; }
.feat p { margin: 0; color: var(--ink-2); }

/* auth */
.auth { display: grid; place-items: center; padding: 60px 20px; }
.card-form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 4px; }
.card-form h1 { margin-bottom: 18px; }
.card-form .forgot { align-self: flex-end; margin: -2px 0 8px; color: var(--muted); }

/* dashboard */
.dash { max-width: 1240px; margin: 0 auto; padding: 32px 28px; }
.dash-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 22px; }
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 26px 22px; margin-bottom: 30px; }
.bcard { position: relative; }
.bcard.new { aspect-ratio: .78; border: 1.5px dashed var(--line); background: none; border-radius: 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-weight: 600; color: var(--ink-2); }
.bcard.new span { font-size: 32px; font-weight: 300; line-height: 1; }
.bcard.new:hover { border-color: var(--ink); color: var(--ink); }
.cover { display: block; aspect-ratio: .78; background: var(--cover); border-radius: 4px 7px 7px 4px; padding: 14px 14px 14px 22px; position: relative; box-shadow: inset 6px 0 0 rgba(0,0,0,.25), 0 10px 22px -12px rgba(0,0,0,.5); transition: transform .15s; }
.cover:hover { transform: translateY(-3px); }
.cover::before { content: ''; position: absolute; inset: 8px 8px 8px 16px; border: 1px solid rgba(255,255,255,.12); border-radius: 3px; }
.mini { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 4px; height: 100%; align-content: center; }
.mini i { aspect-ratio: 63/88; background: rgba(255,255,255,.07); border-radius: 2px; overflow: hidden; }
.mini img { width: 100%; height: 100%; object-fit: cover; }
.meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; padding: 10px 26px 6px 0; position: relative; }
.meta .nm { font-weight: 700; text-decoration: none; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta .mono { font-size: 12px; }
.more { position: absolute; right: 0; top: 8px; border: 0; background: none; font-size: 18px; cursor: pointer; padding: 0 4px; color: var(--muted); }
.menu { position: absolute; right: 0; top: 34px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 8px 24px rgba(0,0,0,.12); z-index: 20; min-width: 130px; padding: 4px; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 7px 10px; cursor: pointer; border-radius: 3px; }
.menu button:hover { background: var(--paper); }
.menu .danger { color: var(--accent-ink); }
.bar { height: 6px; background: var(--paper-3); border-radius: 3px; overflow: hidden; }
.bar.thin { height: 3px; }
.bar i { display: block; height: 100%; background: var(--have); }

.presets { display: flex; gap: 8px; flex-wrap: wrap; }
.presets button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 12px 8px; border: 1px solid var(--line); background: #fff; border-radius: var(--r); cursor: pointer; font-size: 12.5px; font-weight: 500; min-width: 82px; }
.presets button.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.gridicon rect { fill: var(--paper-3); }
.presets button.on .gridicon rect { fill: var(--ink); }

/* account */
.account { max-width: 720px; margin: 0 auto; padding: 32px 28px; }
.account section { border-top: 1px solid var(--line); padding: 20px 0; }
.account h1 { margin-bottom: 18px; }
.account h2 { margin-bottom: 10px; }
.plan { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.plan p { margin: 4px 0 0; }
.plan.is-pro h2 { color: var(--accent); }

/* modal */
.scrim { position: fixed; inset: 0; background: rgba(22,24,27,.42); display: grid; place-items: center; z-index: 100; padding: 16px; animation: fade .12s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--paper); width: 100%; max-width: 440px; border-radius: 6px; box-shadow: 0 24px 60px -10px rgba(0,0,0,.4); max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.modal.wide { max-width: 640px; }
.modal header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 6px; }
.modal .x { border: 0; background: none; font-size: 24px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal .body { padding: 10px 20px 16px; overflow: auto; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); }
.copyrow { display: flex; gap: 8px; margin: 6px 0; }
table.list { width: 100%; border-collapse: collapse; }
table.list td { padding: 7px 6px; border-bottom: 1px solid var(--line); }
table.list tr { cursor: pointer; }
table.list tr:hover td { background: var(--paper-2); }

/* ---------- editor ---------- */
.editor { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.ed-top { height: 54px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--paper); flex: none; }
.back { font-size: 24px; text-decoration: none; width: 30px; text-align: center; color: var(--ink-2); }
.bname { border: 1px solid transparent; background: none; font-weight: 700; font-size: 16px; padding: 4px 8px; border-radius: var(--r); min-width: 80px; max-width: 280px; }
.bname:hover { border-color: var(--line); }
.bname:focus { border-color: var(--ink); outline: none; background: #fff; }
.savestate { font-size: 12px; color: var(--muted); }
.savestate.error { color: var(--accent-ink); }
.prog { display: flex; align-items: center; gap: 8px; margin-right: 8px; font: 500 13px var(--mono); }
.prog em { color: var(--muted); font-style: normal; }
.prog .bar { width: 90px; }

.ed-body { flex: 1; display: grid; grid-template-columns: 300px 1fr 270px; min-height: 0; }
aside { background: var(--paper); min-height: 0; display: flex; flex-direction: column; }
aside.left { border-right: 1px solid var(--line); }
aside.right { border-left: 1px solid var(--line); overflow: auto; }
.close-panel { display: none; }
.tabs { display: flex; border-bottom: 1px solid var(--line); flex: none; }
.tabs button { flex: 1; border: 0; background: none; padding: 12px 6px 10px; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.lang-row { display: flex; justify-content: space-between; padding: 10px 12px 0; gap: 8px; }
.tabbody { padding: 10px 12px; overflow: auto; flex: 1; min-height: 0; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 10px; }
.tile { border: 0; padding: 0; background: none; cursor: grab; position: relative; border-radius: 4px; }
.tile img, .tile .noimg { width: 100%; aspect-ratio: 63/88; object-fit: cover; border-radius: 4px; background: var(--paper-2); }
.tile:hover img { outline: 2px solid var(--ink); outline-offset: 1px; }
.tile span { position: absolute; right: 3px; bottom: 3px; font: 500 10px var(--mono); background: rgba(22,24,27,.82); color: #fff; padding: 0 4px; border-radius: 2px; }
.noimg { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 6px; font-size: 11px; background: var(--paper-2); color: var(--ink-2); gap: 2px; }
.sethead { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sethead b { display: block; line-height: 1.2; }
.sethead small { color: var(--muted); }
.setlist { margin-top: 8px; }
.serie { font: 600 11px var(--mono); text-transform: uppercase; color: var(--muted); padding: 12px 4px 4px; letter-spacing: .05em; }
.setrow { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; padding: 6px 4px; cursor: pointer; text-align: left; border-radius: 3px; }
.setrow:hover { background: var(--paper-2); }
.setrow .sym { width: 20px; height: 20px; flex: none; }
.setrow .sym img { width: 100%; height: 100%; object-fit: contain; }
.setrow .nm { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.setrow .ct { font: 12px var(--mono); color: var(--muted); }
.drop { border: 1.5px dashed var(--line); border-radius: var(--r); padding: 22px 10px; text-align: center; cursor: pointer; font-weight: 600; background: #fff; }
.drop:hover { border-color: var(--ink); }
.selinfo { font-size: 13px; padding: 8px 10px; background: var(--paper-2); border-radius: var(--r); margin: 6px 0 10px; }
.arts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-bottom: 14px; }
.art { position: relative; }
.art > button:first-child { border: 0; padding: 0; width: 100%; aspect-ratio: 1; cursor: pointer; border-radius: 4px; overflow: hidden; background: var(--paper-2); }
.art img { width: 100%; height: 100%; object-fit: cover; }
.art > button:first-child:hover { outline: 2px solid var(--ink); outline-offset: 1px; }
.art .del { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; cursor: pointer; line-height: 1; display: none; }
.art:hover .del { display: block; }

.canvas { background: var(--desk); display: flex; flex-direction: column; min-height: 0; min-width: 0; position: relative; }
.pager { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 12px; flex: none; }
.pager .pg { font: 500 14px var(--mono); min-width: 90px; text-align: center; }
.pager .pg em { color: var(--muted); font-style: normal; }
.pager .seg { margin-left: 12px; }
.stage { flex: 1; display: flex; align-items: center; justify-content: center; padding: 6px 24px 10px; min-height: 0; container-type: size; }
.dots { display: flex; justify-content: center; gap: 5px; padding: 10px 10px 16px; flex-wrap: wrap; flex: none; }
.dots button { width: 7px; height: 7px; border-radius: 50%; border: 0; background: rgba(0,0,0,.18); cursor: pointer; padding: 0; }
.dots button.on { background: var(--ink); width: 18px; border-radius: 4px; }
.dots input { width: min(400px, 80%); }
.mobile-bar { display: none; }

/* binder render */
.spread { --gap: 1.1cqmin; display: flex; gap: 0; background: var(--cover, #22262b); padding: 1.6cqmin; border-radius: 1.2cqmin; position: relative; box-shadow: 0 18px 40px -18px rgba(0,0,0,.55), inset 0 0 0 1px rgba(255,255,255,.06); max-width: 100%; max-height: 100%; }
.landing .spread, .shareview .spread { --gap: 7px; padding: 12px; border-radius: 9px; }
.page { background: var(--pagebg); padding: 2.2cqmin 2.4cqmin 3.4cqmin; position: relative; border-radius: .5cqmin; }
.landing .page, .shareview .page { padding: 14px 16px 22px; }
.page.left { border-radius: .5cqmin 0 0 .5cqmin; margin-right: 2.4cqmin; }
.page.right { border-radius: 0 .5cqmin .5cqmin 0; margin-left: 2.4cqmin; }
.page.blank { background: color-mix(in srgb, var(--cover) 70%, black); opacity: .55; }
.grid { display: grid; grid-template-columns: repeat(var(--cols), var(--cw)); grid-template-rows: repeat(var(--rows), calc(var(--cw) * 88 / 63)); gap: var(--gap); }
/* size pockets to fit the stage: width-limited or height-limited, whichever is tighter */
.stage .spread { --pairs: 2; }
.stage .spread:has(.page.solo) { --pairs: 1; }
.stage .page { --cw: min(calc((100cqw - 14cqmin) / (var(--pairs) * var(--cols)) - var(--gap)), calc((100cqh - 10cqmin) / var(--rows) * 63 / 88 - var(--gap))); }
.landing .page { --cw: min(calc((52vw - 120px) / (2 * var(--cols))), 84px); }
.shareview .stage .page { --cw: min(calc((100cqw - 14cqmin) / (var(--pairs) * var(--cols)) - var(--gap)), calc((100cqh - 10cqmin) / var(--rows) * 63 / 88 - var(--gap))); }
.pnum { position: absolute; bottom: .9cqmin; left: 0; right: 0; text-align: center; font: 500 1.3cqmin var(--mono); color: rgba(255,255,255,.3); }
.landing .pnum, .shareview .pnum { font-size: 10px; bottom: 5px; }
.rings { position: absolute; left: 50%; top: 0; bottom: 0; width: 0; display: flex; flex-direction: column; justify-content: space-around; padding: 12% 0; }
.rings i { width: 3.2cqmin; height: 1.3cqmin; margin-left: -1.6cqmin; background: linear-gradient(#d7d9dc, #8d9196 60%, #c5c8cc); border-radius: 1cqmin; box-shadow: 0 1px 2px rgba(0,0,0,.5); }
.landing .rings i, .shareview .rings i { width: 22px; height: 8px; margin-left: -11px; border-radius: 5px; }

.pocket { position: relative; border-radius: 3px; background: rgba(255,255,255,.035); box-shadow: inset 0 0 0 1px rgba(255,255,255,.07); overflow: hidden; user-select: none; }
.pocket::after { content: ''; position: absolute; inset: 0; background: linear-gradient(115deg, rgba(255,255,255,.07) 0%, rgba(255,255,255,0) 35%, rgba(255,255,255,0) 70%, rgba(255,255,255,.04)); pointer-events: none; }
.editor .pocket { cursor: pointer; }
.editor .pocket:hover { box-shadow: inset 0 0 0 1px rgba(255,255,255,.3); }
.pocket.sel { box-shadow: 0 0 0 2px var(--accent), 0 0 0 4px rgba(224,72,47,.3); z-index: 2; overflow: visible; }
.pocket.over { box-shadow: 0 0 0 2px #fff; }
.face, .face img, .face .noimg { width: 100%; height: 100%; }
.face img { object-fit: cover; border-radius: 3px; }
.face .noimg { background: #2a2c30; color: #c9c9c9; border-radius: 3px; }
.face.want img { filter: grayscale(1) contrast(.9); opacity: .38; }
.face.want .noimg { opacity: .5; }
.flag { position: absolute; left: 50%; bottom: 6%; transform: translateX(-50%); font: 600 max(8px, 1.1cqmin) var(--mono); font-style: normal; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.75); background: rgba(0,0,0,.55); padding: 1px 5px; border-radius: 2px; pointer-events: none; }
.landing .flag, .shareview .flag { font-size: 8px; }
.piece { position: absolute; inset: 0; overflow: hidden; }
.piece img { position: absolute; max-width: none; }

/* inspector */
.insp { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.insp .pos { font: 12px var(--mono); color: var(--muted); }
.insp .big { width: 100%; max-width: 240px; aspect-ratio: 63/88; margin: 0 auto; border-radius: 8px; overflow: hidden; box-shadow: 0 10px 24px -10px rgba(0,0,0,.4); }
.insp .big .face img { border-radius: 8px; }
.insp h3 { margin-top: 4px; }
.insp p { margin: 0; }
.insp .keys { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.empty-hint { aspect-ratio: 63/88; width: 140px; border: 1.5px dashed var(--line); border-radius: 6px; display: grid; place-items: center; color: var(--muted); font-size: 13px; margin: 6px auto; }
.statbox { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: var(--r); background: #fff; }
.statbox div { padding: 10px 8px; text-align: center; }
.statbox div + div { border-left: 1px solid var(--line); }
.statbox b { display: block; font: 600 18px var(--mono); }
.statbox span { font-size: 11.5px; color: var(--muted); }
.kv { display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 6px 0; }
.kv b { font-family: var(--mono); font-weight: 500; }

/* ads */
.ad { margin: 12px; border: 1px solid var(--line); border-radius: var(--r); padding: 6px; position: relative; min-height: 90px; background: #fff; }
.ad-l { position: absolute; top: 2px; right: 6px; font: 10px var(--mono); color: var(--muted); }
.ad.house { display: flex; flex-direction: column; justify-content: center; gap: 2px; text-decoration: none; min-height: 0; padding: 12px 14px; background: var(--paper-2); border-style: dashed; }
.ad.house span { font-size: 12.5px; color: var(--muted); }
.ad-banner { margin: 24px 0; }
aside .ad { margin-top: auto; }

/* scan */
.scan { display: grid; grid-template-columns: 200px 1fr; gap: 22px; align-items: start; }
.qr { background: #fff; padding: 8px; border-radius: var(--r); border: 1px solid var(--line); aspect-ratio: 1; }
.qr svg { width: 100%; height: 100%; display: block; }
.steps { margin: 0 0 14px; padding-left: 20px; }
.steps li { margin-bottom: 4px; }
.status { font-weight: 600; margin: 12px 0 4px; }
.status::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 8px; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.scanres { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 130px)); justify-content: center; gap: 12px; }
.sr { display: flex; flex-direction: column; gap: 4px; }
.sr img { width: 100%; aspect-ratio: 63/88; object-fit: cover; border-radius: 4px; background: var(--paper-2); }
.sr img.off { opacity: .25; }
.sr select { width: 100%; font-size: 11.5px; height: 28px; border: 1px solid var(--line); border-radius: 3px; background: #fff; }
.emptycell { aspect-ratio: 63/88; border: 1.5px dashed var(--line); border-radius: 4px; display: grid; place-items: center; color: var(--muted); font-size: 12px; }

/* tour */
.tour { position: fixed; inset: 0; z-index: 150; pointer-events: none; }
.tour-ring { position: fixed; border: 2px solid var(--accent); border-radius: 6px; box-shadow: 0 0 0 9999px rgba(22,24,27,.35); transition: all .25s; }
.tour-pop { position: fixed; background: var(--ink); color: var(--paper); padding: 14px 16px 12px; border-radius: 6px; pointer-events: auto; box-shadow: 0 14px 40px rgba(0,0,0,.3); animation: fade .2s; }
.tour-pop p { margin: 0 0 12px; font-size: 14.5px; line-height: 1.4; }
.tour-foot { display: flex; align-items: center; gap: 12px; }
.tour-foot .mono { color: rgba(255,255,255,.5); font-size: 12px; flex: 1; }
.tour-foot .link { color: rgba(255,255,255,.6); }
.tour-foot .btn { background: var(--paper); color: var(--ink); border-color: var(--paper); }

/* share view */
.shareview { max-width: 1240px; margin: 0 auto; padding: 28px; }
.sv-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.sv-head p { margin: 4px 0 0; }
.canvas.ro { border-radius: 8px; height: min(78vh, 760px); }
.needgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 16px; }
.needgrid img { width: 100%; aspect-ratio: 63/88; object-fit: cover; border-radius: 5px; background: var(--paper-2); margin-bottom: 6px; }
.needgrid b { display: block; font-size: 13px; }

/* print */
.printview { background: var(--paper-2); min-height: 100vh; }
.print-bar { position: sticky; top: 0; z-index: 10; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 16px; background: var(--paper); border-bottom: 1px solid var(--line); }
.print-hint { text-align: center; font-size: 13px; color: var(--ink-2); margin: 14px; }
.sheets { display: flex; flex-direction: column; align-items: center; gap: 24px; padding: 0 16px 40px; }
.sheet { background: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 20px rgba(0,0,0,.12); flex: none; }
.sgrid { display: grid; grid-template-columns: repeat(3, 63mm); grid-auto-rows: 88mm; align-content: center; }
.pcard { width: 63mm; height: 88mm; position: relative; overflow: hidden; background: #fff; }
.sgrid.cuts .pcard { outline: 0.2mm dashed #9a9a9a; outline-offset: -0.1mm; }
.pcard > img { width: 100%; height: 100%; object-fit: cover; }
.pcard.ph > img { filter: grayscale(1); }
.pcard.ph.light > img { filter: grayscale(1) brightness(1.22) contrast(.8); }
.pcard .ol { position: absolute; inset: 3mm; border: 0.3mm solid #222; border-radius: 2.5mm; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 2mm; padding: 4mm; color: #111; }
.pcard .ol b { font-size: 14pt; line-height: 1.1; }
.pcard .ol span { font-size: 9pt; color: #444; }
.pcard .tag { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; gap: 2mm; padding: 1mm 2mm; background: #fff; font-size: 6.5pt; color: #222; border-top: 0.2mm solid #bbb; }
.pcard .tag span:first-child { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
@media print {
  .noprint { display: none !important; }
  html, body, .printview { background: #fff; }
  .sheets { padding: 0; gap: 0; display: block; }
  .sheet { box-shadow: none; break-after: page; page-break-after: always; }
  .sheet:last-child { break-after: auto; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- small screens ---------- */
@media (max-width: 1100px) { .ed-body { grid-template-columns: 270px 1fr 240px; } .prog .bar { display: none; } }
@media (max-width: 900px) {
  .top { padding: 0 16px; }
  .hero { grid-template-columns: 1fr; padding: 36px 0; gap: 30px; }
  .landing .page { --cw: min(calc((100vw - 110px) / (2 * var(--cols))), 80px); }
  .feat { grid-template-columns: 1fr; }
  .feat > div:not(:nth-child(3n+1)) { padding-left: 0; border-left: 0; }
  .landing, .dash, .account, .shareview { padding-left: 16px; padding-right: 16px; }
  .shelf { grid-template-columns: repeat(2, 1fr); gap: 18px 14px; }
  .ed-body { grid-template-columns: 1fr; position: relative; }
  aside.left, aside.right { position: fixed; left: 0; right: 0; bottom: 0; height: 72vh; z-index: 60; border: 0; border-top: 1px solid var(--line); border-radius: 12px 12px 0 0; box-shadow: 0 -12px 40px rgba(0,0,0,.25); transform: translateY(105%); transition: transform .22s ease; }
  .p-left aside.left, .p-right aside.right { transform: none; }
  .close-panel { display: block; border: 0; background: none; font-size: 22px; padding: 0 14px; cursor: pointer; color: var(--muted); flex: 0 !important; }
  aside.right .close-panel { position: absolute; right: 4px; top: 8px; }
  .mobile-bar { display: flex; gap: 8px; padding: 0 12px 14px; justify-content: center; }
  .ed-top .btn.ghost.icon-only, .savestate { display: none; }
  .ed-top { gap: 6px; padding: 0 8px; }
  .ed-top .btn { padding: 0 10px; }
  .bname { max-width: 120px; }
  .prog { display: none; }
  .stage { padding: 4px 8px; }
  .scan { grid-template-columns: 1fr; }
  .qr { max-width: 220px; }
  .print-bar { gap: 6px; }
}
