/* Shape rule: panels and tiles 16px, controls 12px, page thumbnails 8px, tags full pill.
   One accent colour. Layers: header 10, mobile action bar 20. */

@font-face {
  font-family: "Geist";
  src: url("fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
/* Hangul only, so English visitors never download the 2 MB file. */
@font-face {
  font-family: "Pretendard Variable";
  src: url("fonts/PretendardVariable.woff2") format("woff2-variations");
  font-weight: 45 920;
  font-display: swap;
  unicode-range: U+1100-11FF, U+3130-318F, U+A960-A97F, U+AC00-D7AF, U+D7B0-D7FF;
}

:root {
  --bg: #f4f5f7;
  --surface: #fcfcfd;
  --surface-2: #eceef1;
  --text: #15181c;
  --muted: #5a626d;
  --line: #dfe3e8;
  --accent: #0b7a5f;
  --accent-ink: #fbfdfc;
  --accent-soft: #e1f2ec;
  --danger: #b3261e;
  --shadow: 0 1px 2px rgb(21 32 43 / .05), 0 10px 28px -14px rgb(21 32 43 / .18);
  --ease: cubic-bezier(.16, 1, .3, 1);
  --logo-ink: #1e5c47; --logo-paper: #fbfaf6; --logo-line: #b3c4bb;
  --g1: #0b7a5f; --g1s: #e1f2ec; --g2: #2f5fb3; --g2s: #e7eefa; --g3: #b0541a; --g3s: #fbeee3; --g4: #6a44b8; --g4s: #f0eafa;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1012; --surface: #16191c; --surface-2: #1f2327; --text: #e9ecef; --muted: #98a1ab;
    --line: #282d33; --accent: #41c99d; --accent-ink: #062a1f; --accent-soft: #11332a; --danger: #ff8a80;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 10px 28px -14px rgb(0 0 0 / .6);
    --logo-ink: #dceae4; --logo-paper: #1b2420; --logo-line: #5f7369;
    --g1: #41c99d; --g1s: #11332a; --g2: #7ea6ef; --g2s: #18243a; --g3: #f0a565; --g3s: #3a2614; --g4: #b79af0; --g4s: #2a2140;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1012; --surface: #16191c; --surface-2: #1f2327; --text: #e9ecef; --muted: #98a1ab;
  --line: #282d33; --accent: #41c99d; --accent-ink: #062a1f; --accent-soft: #11332a; --danger: #ff8a80;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 10px 28px -14px rgb(0 0 0 / .6);
  --logo-ink: #dceae4; --logo-paper: #1b2420; --logo-line: #5f7369;
  --g1: #41c99d; --g1s: #11332a; --g2: #7ea6ef; --g2s: #18243a; --g3: #f0a565; --g3s: #3a2614; --g4: #b79af0; --g4s: #2a2140;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 "Geist", "Pretendard Variable", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
}
h1, h2, h3, p, ul, fieldset { margin: 0; padding: 0; }
ul { list-style: none; }
fieldset { border: 0; min-width: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ic { width: 1.25em; height: 1.25em; fill: currentColor; flex: none; }
.wrap { max-width: 1120px; margin-inline: auto; padding-inline: 20px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 10; background: var(--bg); }
.top .wrap { height: 64px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -.01em; }
.brand .logo { height: 34px; width: auto; flex: none; }
.brand .word { font-weight: 450; font-size: 1.1875rem; letter-spacing: -.02em; color: var(--logo-ink); }
.top h1 { font-size: 1.0625rem; font-weight: 600; letter-spacing: -.01em; }
.spacer { flex: 1; }
.iconbtn {
  height: 40px; min-width: 40px; padding: 0 10px; border-radius: 12px; border: 1px solid transparent;
  background: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  color: var(--muted); font-size: .875rem; font-weight: 500;
  transition: background .2s, color .2s;
}
.iconbtn:hover { background: var(--surface-2); color: var(--text); }
.iconbtn:active { transform: scale(.97); }

/* ---------- buttons ---------- */
.btn {
  height: 46px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); font-weight: 550; white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .15s var(--ease), background .2s, border-color .2s, opacity .2s;
}
.btn:hover { border-color: color-mix(in srgb, var(--text) 30%, var(--line)); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 90%, var(--text)); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn.wide { width: 100%; }
.btn.small { height: 38px; padding: 0 12px; font-size: .875rem; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 550; font-size: .875rem; }
.link:hover { text-decoration: underline; }

/* ---------- home ---------- */
.hero { display: grid; grid-template-columns: 1.05fr .95fr; gap: 48px; align-items: center; padding-block: 36px 28px; }
.hero h2 { font-size: clamp(1.9rem, 4.2vw, 3rem); line-height: 1.08; letter-spacing: -.035em; font-weight: 620; text-wrap: balance; }
.hero p { margin-top: 14px; color: var(--muted); font-size: 1.0625rem; max-width: 34ch; }

.drop {
  min-height: 208px; border-radius: 16px; padding: 24px; text-align: center;
  background: var(--surface); border: 1.5px dashed color-mix(in srgb, var(--accent) 45%, var(--line));
  display: grid; place-content: center; justify-items: center; gap: 12px;
  transition: background .2s, border-color .2s, transform .25s var(--ease);
}
.drop .ic.big { width: 34px; height: 34px; color: var(--accent); }
.drop strong { font-weight: 600; font-size: 1.0625rem; }
.drop span { color: var(--muted); font-size: .875rem; }
body.dragging .drop { background: var(--accent-soft); border-color: var(--accent); transform: scale(1.01); }
.stage > .drop { min-height: 360px; }

.held {
  border-radius: 16px; padding: 16px; background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow); display: grid; grid-template-columns: 84px 1fr auto; gap: 16px; align-items: center;
}
.held .thumb { pointer-events: none; }
.held b { display: block; font-weight: 600; overflow-wrap: anywhere; word-break: break-all; }
.held small { color: var(--muted); font-size: .875rem; }
.held .next { margin-top: 8px; color: var(--accent); font-weight: 550; font-size: .9375rem; display: flex; align-items: center; gap: 6px; }

.facts { display: flex; flex-wrap: wrap; gap: 10px 28px; padding-block: 4px 28px; color: var(--muted); font-size: .9375rem; }
.facts li { display: flex; align-items: center; gap: 8px; }
.facts .ic { color: var(--accent); }

.block { padding-block: 14px; }
.block > header { display: flex; align-items: baseline; gap: 14px; margin-bottom: 12px; }
.block h3 { font-size: 1.0625rem; font-weight: 600; letter-spacing: -.01em; }
.block header .hint { color: var(--muted); font-size: .875rem; }
.block header .spacer + * { margin-left: 0; }

.presets { display: flex; flex-wrap: wrap; gap: 10px; }
.preset {
  display: inline-flex; align-items: center; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); overflow: hidden; transition: border-color .2s, transform .2s var(--ease);
}
.preset:hover { border-color: var(--accent); transform: translateY(-1px); }
.preset button { background: none; border: 0; min-height: 52px; display: inline-flex; align-items: center; gap: 10px; }
.preset .go { padding: 6px 8px 6px 14px; text-align: left; }
.preset .go > span { display: grid; line-height: 1.25; }
.preset .go b { font-weight: 600; }
.preset .go .ic { color: var(--accent); width: 22px; height: 22px; }
.preset .go small { color: var(--muted); font-weight: 400; font-size: .8125rem; }
.preset .go[disabled] { opacity: .5; cursor: progress; }
.preset .del, .preset .mini { padding: 0 9px; color: var(--muted); }
.preset .mini:hover { color: var(--text); }
.preset .del:hover { color: var(--danger); }
.preset.confirm { border-color: var(--danger); }
.preset.confirm .del { color: var(--danger); font-size: .8125rem; font-weight: 600; padding: 0 12px; }
.empty { color: var(--muted); font-size: .9375rem; padding: 14px 16px; border-radius: 16px; background: var(--surface-2); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 12px; }
.tile {
  position: relative; display: grid; grid-template-columns: 44px 1fr; gap: 14px; align-items: center;
  padding: 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line);
  transition: transform .25s var(--ease), border-color .2s, box-shadow .25s;
}
.tile .chip { font-style: normal; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.tile .chip .ic { width: 22px; height: 22px; }
.tile b { display: block; font-weight: 600; letter-spacing: -.01em; }
.tile span { display: block; color: var(--muted); font-size: .875rem; line-height: 1.35; margin-top: 2px; }
a.tile:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); box-shadow: var(--shadow); }
a.tile:active { transform: scale(.985); }
.tile.soon { background: none; border-style: dashed; }
.tile.soon .chip { background: var(--surface-2); color: var(--muted); }
.tile.soon b { color: var(--muted); }
.tag { font-style: normal; position: absolute; top: 12px; right: 12px; font-size: .75rem; font-weight: 550; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 2px 9px; }

.foot { padding-block: 36px 44px; color: var(--muted); font-size: .875rem; }
.foot p { margin: 0; }
.foot nav { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; }
.foot nav a { color: inherit; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }
.foot nav a:hover { color: var(--text); text-decoration-color: currentColor; }

/* ---------- workspace ---------- */
.back { margin-left: -8px; }
.work { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; align-items: start; padding-block: 12px 48px; }
.panel {
  position: sticky; top: 76px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 20px; display: grid; gap: 18px; box-shadow: var(--shadow);
}
/* Long settings scroll inside the panel; the run button and "Make preset" stay in view at its foot. */
.panel:not(.finished) {
  max-height: calc(100dvh - 92px); padding: 0; gap: 0; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden;
}
.panel:not(.finished) > .filebar { padding: 18px 20px 4px; }
.pbody { overflow-y: auto; overscroll-behavior: contain; padding: 14px 20px 18px; display: grid; gap: 18px; align-content: start; }
.pfoot { display: grid; gap: 10px; padding: 14px 20px 18px; border-top: 1px solid var(--line); background: var(--surface); }
.makep { justify-self: start; }
.btn.ghost { border-color: transparent; background: var(--surface-2); }
.btn.ghost .ic { color: var(--accent); }
.okline { display: flex; gap: 8px; align-items: flex-start; font-size: .875rem; color: var(--accent); font-weight: 550; }
.okline .ic { flex: none; margin-top: 1px; }
.namebox { display: grid; gap: 8px; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.namebox label { font-weight: 550; font-size: .9375rem; }
.namebox small { color: var(--muted); font-size: .8125rem; }
.namebox .link { justify-self: start; color: var(--muted); }
.namebox .input { background: var(--surface); }
.reset { justify-self: start; display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); font-size: .875rem; font-weight: 550;
}
.chip .ic { color: var(--accent); width: 1.1em; height: 1.1em; }
.chip:hover { border-color: var(--accent); }
.filebar { display: flex; align-items: center; gap: 10px; min-width: 0; }
.filebar .ic { color: var(--accent); }
.filebar b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filebar small { color: var(--muted); white-space: nowrap; }

.field { display: grid; gap: 8px; }
.field > label, .field > legend, .field > .lab { font-weight: 550; font-size: .9375rem; }
.rows { display: grid; gap: 8px; }
.rowf { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto auto; align-items: center; gap: 8px; }
.rowf .cnt { font-size: .8125rem; color: var(--accent); font-weight: 550; white-space: nowrap; min-width: 2.5em; text-align: right; }
.rowf .cnt:empty { min-width: 0; }
.eg { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .8125rem; color: var(--muted); }
.eg kbd { font: inherit; font-weight: 550; color: var(--text); background: var(--surface-2); border-radius: 6px; padding: 1px 7px; margin-right: 6px; }
.rowf .num {
  width: 28px; height: 28px; border-radius: 999px; display: grid; place-items: center; font-size: .8125rem; font-weight: 600;
  background: var(--surface-2); color: var(--muted); transition: background .2s, color .2s;
}
.rowf.active .num { background: var(--accent); color: var(--accent-ink); }
.addrow { justify-self: start; }
.field small { color: var(--muted); font-size: .8125rem; }
.field small.err { color: var(--danger); }
.input, select.input {
  height: 46px; width: 100%; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg); transition: border-color .2s, box-shadow .2s;
}
.input::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.row { display: flex; gap: 8px; }
.row > .input { flex: 1; min-width: 0; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-2); }
.seg label { position: relative; }
.seg input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.seg span {
  display: flex; align-items: center; justify-content: center; gap: 6px; height: 38px; border-radius: 9px;
  font-size: .875rem; font-weight: 550; color: var(--muted); transition: background .2s, color .2s, box-shadow .2s;
}
.seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgb(21 32 43 / .12); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

.check { display: flex; align-items: center; gap: 10px; font-size: .9375rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }


.cta { display: grid; gap: 10px; }
.sum { color: var(--muted); font-size: .875rem; min-height: 1.4em; }
.alert { display: flex; gap: 8px; align-items: flex-start; color: var(--danger); font-size: .9375rem; }

/* result */
.done { display: grid; gap: 14px; }
.done .ok { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 1.0625rem; }
.done .ok .ic { width: 26px; height: 26px; color: var(--accent); }
.outs { display: grid; gap: 6px; max-height: 280px; overflow: auto; }
.outs > div {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; column-gap: 2px; align-items: center; padding: 8px 6px 8px 12px;
  border-radius: 12px; background: var(--bg); font-size: .9375rem;
}
.namefield { grid-column: 1; display: flex; align-items: center; gap: 6px; min-width: 0; }
.namefield .input { height: 38px; padding: 0 10px; background: var(--surface); font-size: .9375rem; }
.namefield i { font-style: normal; color: var(--muted); font-size: .875rem; }
.outs small { grid-column: 1; color: var(--muted); font-size: .8125rem; padding: 4px 0 0 2px; }
.outs .iconbtn { grid-row: 1; color: var(--accent); }
.outs .iconbtn:first-of-type { grid-column: 2; }
.outs .iconbtn:last-of-type { grid-column: 3; }

.preview { display: grid; gap: 22px; }
.preview h2 { font-size: 1.0625rem; font-weight: 600; letter-spacing: -.01em; }
.preview section { display: grid; gap: 12px; padding: 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.preview header { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.preview header b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview header small { color: var(--muted); font-size: .8125rem; white-space: nowrap; }

/* large preview */
#viewer {
  width: min(1000px, calc(100vw - 16px)); height: calc(100dvh - 16px); max-width: none; max-height: none;
  padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--text); overflow: hidden;
}
#viewer[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
#viewer::backdrop { background: rgb(10 14 18 / .62); }
#viewer header, #viewer footer { display: flex; align-items: center; gap: 4px; padding: 8px 10px 8px 16px; }
#viewer header b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#viewer footer { justify-content: center; gap: 18px; padding-inline: 10px; font-variant-numeric: tabular-nums; color: var(--muted); }
#viewer .iconbtn[disabled] { opacity: .35; cursor: default; }
.vbody { display: flex; overflow: auto; padding: 12px; background: var(--surface-2); }
.vbody canvas { margin: auto; flex: none; background: #fff; border-radius: 8px; box-shadow: var(--shadow); }
.pg.zoom { cursor: zoom-in; }

/* page thumbnails */
.pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 18px 14px; }
.pg { background: none; border: 0; padding: 0; display: grid; gap: 6px; justify-items: center; align-content: start; transition: opacity .25s; }
.pg > small { font-size: .8125rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.thumb {
  position: relative; width: 100%; aspect-ratio: var(--ar, .707); border-radius: 8px; overflow: hidden;
  background: #fff linear-gradient(100deg, transparent 30%, rgb(21 32 43 / .05) 50%, transparent 70%) 0 0 / 200% 100%;
  box-shadow: 0 0 0 1px var(--line), 0 6px 14px -8px rgb(21 32 43 / .3);
  transition: box-shadow .2s, transform .25s var(--ease);
}
.thumb img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0;
  transform: rotate(var(--rot, 0deg)) scale(var(--sc, 1)); transition: opacity .3s, transform .35s var(--ease);
}
.thumb.ready { background: #fff; }
.thumb.ready img { opacity: 1; }
.pg:hover .thumb { transform: translateY(-2px); }
.pg.in .thumb { box-shadow: 0 0 0 2px var(--accent), 0 6px 14px -8px rgb(21 32 43 / .3); }
.pg.in > small { color: var(--accent); font-weight: 600; }
.pg.in.other .thumb { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, var(--line)), 0 6px 14px -8px rgb(21 32 43 / .3); }
.pg.other .badge { background: color-mix(in srgb, var(--accent) 55%, var(--surface-2)); }
.pg.dim { opacity: .38; }
.pg.cut .thumb { box-shadow: 0 0 0 2px var(--danger); }
.pg.cut .thumb img { opacity: .25; }
.pg.cut > small { color: var(--danger); text-decoration: line-through; }
.badge {
  position: absolute; top: 6px; left: 6px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-size: .75rem; font-weight: 600; display: none; place-items: center;
}
.pg[data-g] .badge { display: grid; }
.cutmark { position: absolute; inset: 0; display: none; place-items: center; color: var(--danger); }
.cutmark .ic { width: 28px; height: 28px; }
.pg.cut .cutmark { display: grid; }

/* merge list */
.mlist { display: grid; gap: 10px; }
.mitem {
  display: grid; grid-template-columns: auto 52px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line);
}
.mitem b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mitem small { display: block; color: var(--muted); font-size: .8125rem; }
.mitem .input { height: 38px; margin-top: 8px; max-width: 220px; font-size: .875rem; }
.mitem .acts { display: flex; }
.addmore { margin-top: 4px; justify-self: start; }

@media (prefers-reduced-motion: no-preference) {
  .thumb:not(.ready) { animation: shimmer 1.4s linear infinite; }
  @keyframes shimmer { to { background-position: -200% 0; } }
  .done { animation: rise .4s var(--ease); }
  @keyframes rise { from { opacity: 0; transform: translateY(8px); } }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: .22s; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 22px; padding-block: 16px 22px; }
  .work { grid-template-columns: minmax(0, 1fr); gap: 20px; padding-bottom: 150px; }
  .panel { position: static; order: -1; box-shadow: none; }
  .cta {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--line);
  }
  .panel.finished .cta { position: static; padding: 0; border: 0; }
  .stage > .drop { min-height: 240px; }
}
@media (max-width: 560px) {
  .wrap { padding-inline: 16px; }
  .tiles { grid-template-columns: 1fr; gap: 8px; }
  .tile { padding: 12px 14px; }
  .pages { grid-template-columns: repeat(3, 1fr); gap: 14px 10px; }
  .held { grid-template-columns: 64px 1fr auto; gap: 12px; }
  .facts { gap: 8px 20px; font-size: .875rem; }
  .mitem { grid-template-columns: 44px minmax(0, 1fr); }
  .mitem .acts { grid-column: 1 / -1; justify-content: flex-end; margin-top: -6px; }
}

/* ---------- tools added 2026-10-08 ---------- */
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row.end { justify-content: flex-end; }
.dot { width: 10px; height: 10px; border-radius: 999px; background: var(--c); flex: none; }
.resnote { font-size: .9375rem; color: var(--text); background: var(--accent-soft); border-radius: 12px; padding: 10px 12px; }
.textout {
  margin: 0; max-height: 70vh; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere;
  font: .875rem/1.6 ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: var(--text);
}
.pages.still .pg { cursor: default; }
.pages.still .pg:hover .thumb { transform: none; }

/* live preview of page numbers and watermarks on the thumbnails */
.thumb { container-type: inline-size; }
.ov { position: absolute; inset: 0; pointer-events: none; font-family: Helvetica, Arial, sans-serif; line-height: 1; }
.ov.num { font-size: calc(var(--fs, .02) * 100cqw); color: #1f1f1f; }
.ov.num i { position: absolute; font-style: normal; white-space: nowrap; line-height: 1; }
.ov.wm { overflow: hidden; }
.ov.wm span {
  position: absolute; font-family: var(--wf, inherit); font-weight: var(--ww, 700); white-space: nowrap; line-height: 1; font-size: calc(var(--fs, .08) * 100cqw);
  color: var(--wc, #777); opacity: var(--op, .25); transform: translate(-50%, -50%) rotate(var(--wa, -45deg));
}

/* password box */
#ask {
  width: min(420px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 16px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
#ask::backdrop, #sigpad::backdrop { background: rgb(10 14 18 / .62); }
.askform { display: grid; gap: 14px; padding: 20px; }
.askform h2 { display: flex; align-items: center; gap: 10px; font-size: 1.0625rem; font-weight: 600; }
.askform h2 .ic { color: var(--accent); }
.askform p { color: var(--muted); font-size: .9375rem; overflow-wrap: anywhere; }
.askform .alert { color: var(--danger); }

/* page editor (annotate, sign and fill) */
.tools { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.toolbtn {
  display: grid; justify-items: center; gap: 3px; padding: 8px 2px 6px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); font-size: .75rem; font-weight: 550; color: var(--muted); transition: background .2s, color .2s, border-color .2s;
}
.toolbtn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.toolbtn .ic { width: 22px; height: 22px; }
.toolbtn:hover { color: var(--text); }
.toolbtn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.swatches { display: flex; gap: 10px; }
.sw {
  width: 34px; height: 34px; border-radius: 999px; border: 2px solid var(--surface); background: var(--c);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--text) 28%, transparent); transition: box-shadow .2s, transform .15s var(--ease);
}
.sw.on { box-shadow: 0 0 0 2px var(--accent); }
.sw:active { transform: scale(.94); }
.sigbox img { max-width: 100%; max-height: 90px; background: #fff; border-radius: 8px; padding: 6px; box-shadow: 0 0 0 1px var(--line); justify-self: start; }
.formlist { display: grid; gap: 10px; max-height: 360px; overflow: auto; padding-right: 2px; }
.fl { display: grid; gap: 4px; }
.fname { font-size: .8125rem; color: var(--muted); overflow-wrap: anywhere; }
.fl .input { height: 40px; }

.editor { display: grid; gap: 10px; justify-items: center; }
.edbar { display: flex; align-items: center; gap: 4px; width: 100%; }
.edbar .pnum { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .9375rem; min-width: 4.5em; text-align: center; }
.edbar .iconbtn[disabled] { opacity: .35; cursor: default; }
.sheet { position: relative; background: #fff; border-radius: 8px; box-shadow: 0 0 0 1px var(--line), var(--shadow); touch-action: none; user-select: none; -webkit-user-select: none; }
.sheet.tool-move { touch-action: pan-x pan-y; }
/* With "Select", a finger on an item drags it; a finger on empty paper still scrolls. */
.sheet.tool-move svg [data-k], .sheet svg .handle { touch-action: none; }
.sheet canvas { position: absolute; inset: 0; border-radius: 8px; }
.sheet svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; cursor: crosshair; }
.sheet.tool-move svg { cursor: default; }
.sheet.tool-move svg [data-k], .sheet svg [data-k]:has(image), .sheet svg [data-k]:has(text) { cursor: move; }
.sheet.tool-erase svg { cursor: not-allowed; }
.sheet svg .hl { mix-blend-mode: multiply; }
.sheet svg .hit { stroke: transparent; fill: transparent; }
.sheet svg rect.hit { stroke: none; }
.sheet svg .selbox { fill: none; stroke: var(--accent); stroke-width: .8; stroke-dasharray: 3 2; vector-effect: non-scaling-stroke; pointer-events: none; }
.sheet svg .handle { fill: var(--surface); stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; cursor: nwse-resize; }
.textin {
  position: absolute; z-index: 2; min-width: 120px; border: 1px dashed var(--accent); background: rgb(255 255 255 / .9);
  padding: 0 4px; line-height: 1.2; font-family: Helvetica, Arial, "Pretendard Variable", sans-serif; outline: none; border-radius: 4px;
}

/* signature pad */
#sigpad {
  width: min(640px, calc(100vw - 16px)); padding: 0; border: 1px solid var(--line); border-radius: 16px;
  background: var(--surface); color: var(--text); overflow: hidden;
}
#sigpad header, #sigpad footer { display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 16px; }
#sigpad header b { font-weight: 600; }
#sigpad footer small { color: var(--muted); font-size: .8125rem; }
.padwrap { position: relative; margin: 0 12px; height: 220px; background: #fff; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--line); }
.padwrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.padline { position: absolute; left: 24px; right: 24px; bottom: 54px; border-bottom: 1.5px dashed #c8cdd3; pointer-events: none; }
.vbody img { margin: auto; flex: none; background: #fff; border-radius: 8px; box-shadow: var(--shadow); object-fit: contain; }

@media (max-width: 860px) {
  .work.editing { padding-bottom: 150px; }
  .tools { grid-template-columns: repeat(5, 1fr); }
}
@media (max-width: 560px) {
  .two { grid-template-columns: 1fr; }
  #sigpad footer { flex-wrap: wrap; }
  #sigpad footer small { flex-basis: 100%; }
}

/* presets: running, backup, chain so far */
.runbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 12px 14px; margin-bottom: 12px;
  border-radius: 12px; background: var(--accent-soft); font-size: .9375rem;
}
.runbar #runstate { color: var(--muted); }
.spin { width: 16px; height: 16px; border-radius: 999px; border: 2px solid var(--accent); border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.spin { display: inline-block; flex: none; vertical-align: -3px; }
.spin.big { width: 34px; height: 34px; border-width: 3px; }
.btn .spin, #loadpill .spin { border-color: currentColor; border-right-color: transparent; }
.btn .spin + span { margin-left: 2px; }
#loadpill { display: flex; align-items: center; gap: 10px; }
#loadpill[hidden] { display: none; }
.sum.busy::before { content: ''; display: inline-block; width: 12px; height: 12px; margin-right: 8px; vertical-align: -1px; border-radius: 999px;
  border: 2px solid var(--accent); border-right-color: transparent; animation: spin .8s linear infinite; }
#presets .alert { margin-bottom: 12px; }
#presets .okline { margin-top: 10px; }
.backup { margin-top: 14px; font-size: .875rem; color: var(--muted); }
.backup summary { cursor: pointer; width: fit-content; }
.backup p { margin: 8px 0 10px; max-width: 60ch; }
.held .chain { margin-top: 8px; display: flex; gap: 6px; align-items: center; font-size: .875rem; color: var(--text); }
.held .chain .ic { color: var(--accent); }

/* page numbers: position grid, fonts, size, details */
.posgrid {
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: auto 18px auto; gap: 4px; padding: 6px;
  border-radius: 12px; background: var(--surface-2); max-width: 260px;
}
.posgrid .rowgap { grid-column: 1 / -1; }
.posgrid.three { grid-template-rows: auto auto auto; }
.chips.quick { margin-top: -8px; }
.chips.quick .chip { height: 32px; font-size: .8125rem; }
.colorpick { display: inline-flex; align-items: center; gap: 10px; font-size: .875rem; color: var(--muted); cursor: pointer; }
.colorpick input { width: 40px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: none; cursor: pointer; }
.pos { position: relative; }
.pos input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.pos span {
  display: flex; align-items: center; height: 34px; padding: 0 10px; border-radius: 8px; font: 600 .8125rem/1 Helvetica, Arial, sans-serif;
  color: color-mix(in srgb, var(--muted) 70%, transparent); background: var(--surface); transition: background .2s, color .2s;
}
.pos.center span { justify-content: center; }
.pos.right span { justify-content: flex-end; }
.pos input:checked + span { background: var(--accent); color: var(--accent-ink); }
.pos input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.fonts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.fonttile { position: relative; }
.fonttile input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.fonttile span {
  display: grid; justify-items: center; gap: 2px; padding: 8px 2px 6px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  transition: border-color .2s, background .2s;
}
.fonttile b { font-size: 1.25rem; line-height: 1.1; color: var(--text); }
.fonttile small { font-size: .6875rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.fonttile input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.fonttile input:checked + span small { color: var(--accent); font-weight: 600; }
.fonttile input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper .iconbtn { border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.unitbox { position: relative; display: inline-flex; align-items: center; justify-self: start; }
.unitbox .input { width: 96px; padding-right: 30px; text-align: right; font-variant-numeric: tabular-nums; }
.unitbox i { position: absolute; right: 10px; font-style: normal; font-size: .8125rem; color: var(--muted); pointer-events: none; }
.input.short { max-width: 120px; }
.adv { border-top: 1px solid var(--line); padding-top: 12px; }
.adv summary { cursor: pointer; font-weight: 550; font-size: .9375rem; width: fit-content; }
.advbody { display: grid; gap: 16px; padding-top: 14px; }
.xy { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; }
.xy label { grid-column: 1 / -1; font-size: .875rem; font-weight: 550; }
.xy input[type="range"] { width: 100%; accent-color: var(--accent); }
.bigprev { display: grid; gap: 8px; justify-items: center; margin-bottom: 20px; }
.bphead { display: flex; align-items: center; gap: 4px; width: min(100%, 460px); }
.bphead b { font-weight: 600; font-size: .9375rem; }
.bphead .iconbtn[disabled] { opacity: .35; cursor: default; }
.bpsheet {
  position: relative; width: min(100%, 460px); aspect-ratio: var(--ar, .707); border-radius: 8px; overflow: hidden; container-type: inline-size;
  background: #fff linear-gradient(100deg, transparent 30%, rgb(21 32 43 / .05) 50%, transparent 70%) 0 0 / 200% 100%;
  box-shadow: 0 0 0 1px var(--line), var(--shadow);
}
.bpsheet img { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity .3s; }
.bpsheet.ready img { opacity: 1; }
@media (max-width: 860px) {
  .panel:not(.finished) { max-height: none; overflow: visible; }
  .pbody { overflow: visible; }
  .pfoot { border-top: 0; padding-top: 0; }
  .bpsheet { width: min(100%, 360px); }
}
@media (max-width: 560px) {
  .fonts { grid-template-columns: repeat(3, 1fr); }
}

/* colour swatches: six colours + the system colour picker */
.swatches { flex-wrap: wrap; }
.sw.pick { position: relative; display: inline-block; overflow: hidden; cursor: pointer;
  background: conic-gradient(#f43f5e, #f59e0b, #84cc16, #06b6d4, #6366f1, #d946ef, #f43f5e); }
.sw.pick::after { content: ""; position: absolute; inset: 7px; border-radius: 999px; background: var(--c); }
.sw.pick input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.myfont { display: grid; gap: 8px; margin-top: 8px; }
.myfont .btn { justify-self: start; }

/* editor: zoom scrolls inside, tool strip stays on screen on phones and tablets */
.editor { overflow-x: auto; justify-items: stretch; }
.editor .sheet { margin-inline: auto; }
.edtools { display: none; }
.hintm { display: none; }
@media (max-width: 860px) {
  .edhead { position: sticky; top: 64px; z-index: 6; background: var(--bg); padding-bottom: 6px; display: grid; gap: 4px; }
  .edtools { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0; scrollbar-width: none; }
  .edtools .toolbtn { flex: none; min-width: 58px; padding: 6px 4px 4px; }
  .work.editing .panel .toolfield { display: none; }
  .work.editing .hintm { display: block; }
}

/* signature box */
#sigpad header { flex-wrap: wrap; }
.padtabs { flex: 1 1 220px; max-width: 320px; }
.padtype, .padfile { display: grid; gap: 10px; padding: 0 12px 10px; }
.padtype .row select { flex: 1; }
.inkrow { align-items: center; gap: 8px; padding: 0 12px 8px; }
.padtype .inkrow, .padfile .inkrow { padding: 0; }
.inkrow .lab { font-size: .875rem; color: var(--muted); margin-right: 4px; }
.inkrow .sw { width: 28px; height: 28px; }
.padwrap.drop { margin: 0; display: grid; place-items: center; border: 1.5px dashed var(--line); color: var(--muted); font-size: .9375rem; }
.padwrap.drop img { max-width: 92%; max-height: 92%; }
.padfile .btn input { display: none; }

/* merge list: drag handle */
.grip { background: none; border: 0; padding: 6px 2px; color: var(--muted); cursor: grab; touch-action: none; border-radius: 8px; display: grid; place-items: center; }
.grip:hover { color: var(--text); background: var(--surface-2); }
.mitem { transition: transform .18s var(--ease), box-shadow .2s; }
.mitem.dragging { transition: none; z-index: 2; position: relative; box-shadow: var(--shadow); cursor: grabbing; }
.chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.unitbox.wide .input { width: 140px; }
@media (max-width: 560px) {
  .mitem { grid-template-columns: auto 44px minmax(0, 1fr); }
}

/* page numbers: cover and counting */
.covers { padding: 12px; border-radius: 12px; background: var(--surface-2); gap: 12px; }
.covers .seg { background: var(--surface); }
.covers .seg input:checked + span { background: var(--accent-soft); color: var(--accent); box-shadow: none; }
.field.inline { display: flex; align-items: center; gap: 10px; }
.countex { font-size: .875rem; font-weight: 550; color: var(--accent); }

/* merge: files on top, every page below */
.mhead { display: flex; align-items: baseline; gap: 12px; margin: 4px 0 10px; }
.mhead h3 { font-size: 1rem; font-weight: 600; }
.mhead + .mlist { margin-bottom: 22px; }
.mlist.compact { gap: 6px; }
.mlist.compact .mitem { grid-template-columns: auto auto minmax(0, 1fr) auto; padding: 6px 8px; border-radius: 12px; }
.ftag {
  font-style: normal; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px; display: grid; place-items: center;
  font-size: .75rem; font-weight: 700; color: #fff; background: var(--fc, var(--accent));
}
.mhint { color: var(--muted); font-size: .875rem; margin: -4px 0 12px; }
.mboard .mp { position: relative; touch-action: manipulation; }
.mboard .mp .thumb { box-shadow: 0 0 0 2px color-mix(in srgb, var(--fc) 55%, transparent), 0 6px 14px -8px rgb(21 32 43 / .3); }
.mboard .mp .ftag { position: absolute; top: 6px; left: 6px; z-index: 1; }
.mboard img { -webkit-user-drag: none; user-select: none; }
.mboard .mp.cut .thumb { box-shadow: 0 0 0 2px var(--danger); }
.mgrip {
  position: absolute; top: 4px; right: 4px; z-index: 1; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: rgb(255 255 255 / .9); color: #444; box-shadow: 0 1px 3px rgb(0 0 0 / .2); touch-action: none; cursor: grab;
}
.mzoom {
  position: absolute; bottom: 4px; right: 4px; z-index: 1; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: rgb(255 255 255 / .9); color: #444; box-shadow: 0 1px 3px rgb(0 0 0 / .2); cursor: zoom-in;
}
@media (pointer: fine) { .mgrip, .mzoom { opacity: 0; transition: opacity .15s; } .mboard .mp:hover .mgrip, .mboard .mp:hover .mzoom { opacity: 1; } .mboard .mp { cursor: grab; } }
.mboard .mp.lifting { opacity: .35; }
.mboard .mp.drop-b .thumb::before, .mboard .mp.drop-a .thumb::after {
  content: ""; position: absolute; top: -4px; bottom: -4px; width: 4px; border-radius: 4px; background: var(--accent); z-index: 2;
}
.mboard .mp.drop-b .thumb::before { left: -9px; }
.mboard .mp.drop-a .thumb::after { right: -9px; }
.mboard .mp .thumb { overflow: visible; }
.mboard .mp .thumb img { border-radius: 8px; }

/* merge: blank pages */
.mboard .mp.blank .thumb { display: grid; place-items: center; background: #fff; box-shadow: 0 0 0 1.5px var(--line); border: 1.5px dashed #b8c0c8; }
.mboard .mp.blank .thumb b { color: #8a939c; font-weight: 600; font-size: .8125rem; }
.mboard .mp.blank.fresh .thumb { animation: freshb 1.2s var(--ease); }
@keyframes freshb { 0%, 40% { box-shadow: 0 0 0 4px var(--accent); } }
.mhead .btn.small { height: 32px; }

/* split: ways to split, what will be made, cut markers */
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.modetile { position: relative; }
.modetile input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.modetile span { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); height: 100%; transition: border-color .2s, background .2s; }
.modetile .ic { grid-row: span 2; color: var(--muted); }
.modetile b { font-size: .875rem; font-weight: 600; }
.modetile small { font-size: .75rem; color: var(--muted); line-height: 1.3; }
.modetile input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.modetile input:checked + span .ic, .modetile input:checked + span b { color: var(--accent); }
.modetile input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.willmake { margin-bottom: 18px; padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.willmake h3 { font-size: .9375rem; font-weight: 600; margin-bottom: 8px; }
.willmake ol { margin: 0; padding-left: 1.4em; display: grid; gap: 4px; max-height: 190px; overflow: auto; font-size: .875rem; }
.willmake li:has(.gnum) { list-style: none; margin-left: -1.4em; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.gnum { flex: none; align-self: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; display: grid; place-items: center;
  background: var(--gc); color: #fff; font-style: normal; font-size: .6875rem; font-weight: 700; }
.willmake li b { font-weight: 550; margin-right: 8px; overflow-wrap: anywhere; }
.willmake li small { color: var(--muted); }
.willmake li.wnote { list-style: none; margin: 4px 0 0 -1.4em; color: var(--muted); }
/* split into files (cut where tapped, every N pages, by size, by chapter): each new file's pages share a colour */
.pages.grouped .pg.in .thumb { box-shadow: 0 0 0 2px var(--gc, var(--accent)), 0 6px 14px -8px rgb(21 32 43 / .3); }
.pages.grouped .pg.in > small { color: var(--gc, var(--accent)); }
.pages.grouped .pg[data-g] .badge { background: var(--gc, var(--accent)); color: #fff; }
/* where a new file starts: a thick line with scissors in front of the page */
.pg.cutstart .thumb::before { content: ""; position: absolute; left: -10px; top: -6px; bottom: -6px; width: 4px; border-radius: 4px; background: var(--gc, var(--danger)); }
.snip { position: absolute; left: -21px; top: 50%; transform: translateY(-50%); z-index: 2; width: 26px; height: 26px; border-radius: 999px; display: none; place-items: center;
  background: var(--gc, var(--danger)); color: #fff; box-shadow: 0 2px 6px rgb(0 0 0 / .25); pointer-events: none; }
.snip .ic { width: 15px; height: 15px; }
.pg.cutstart .snip { display: grid; }
/* «tap where to cut», on a computer: hovering a page shows the cut a tap would make (or undo) */
@media (hover: hover) {
  .pages.cutting .pg:not(.cutstart):hover .thumb { overflow: visible; }
  .pages.cutting .pg:not(.cutstart):hover .thumb::before { content: ""; position: absolute; left: -10px; top: -6px; bottom: -6px; width: 0; border-left: 3px dashed var(--muted); }
  .pages.cutting .pg:not(.cutstart):hover .snip { display: grid; background: var(--muted); opacity: .85; }
  .pages.cutting .pg:first-child:hover .thumb::before, .pages.cutting .pg:first-child:hover .snip { display: none; }
  .pages.cutting .pg.cutstart:hover .snip { background: var(--danger); }
}
.pg.cutstart .thumb { overflow: visible; }
.pg.cutstart .thumb img { border-radius: 8px; }
@media (max-width: 560px) { .modetile span { padding: 8px; column-gap: 6px; } .modetile small { font-size: .6875rem; } }

/* rotate / remove: note under the quick picks */
.panel .hint { color: var(--muted); font-size: .8125rem; line-height: 1.45; margin: -6px 0 4px; }
.filebar .link + .link { margin-left: 4px; }

/* bookmarks: list of rows (page, title, level, delete) and the title shown on each page */
.bmlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 46vh; overflow: auto; }
.bmrow { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto auto; gap: 6px; align-items: center; padding: 3px; border-radius: 12px; }
.bmrow.sub { padding-left: 22px; position: relative; }
.bmrow.sub::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 50%; width: 8px; border-left: 2px solid var(--line); border-bottom: 2px solid var(--line); border-bottom-left-radius: 6px; }
.bmrow.active { background: var(--accent-soft); }
.bmrow .bmp { text-align: center; padding-left: 6px; padding-right: 6px; }
.field textarea.input { height: auto; min-height: 120px; padding: 10px 12px; line-height: 1.5; resize: vertical; font-family: inherit; }
.bmtag { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 6px; font-size: .6875rem; font-weight: 600; line-height: 1.25; color: #fff;
  background: color-mix(in srgb, var(--accent) 88%, transparent); border-radius: 0 0 8px 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bmtag:empty { display: none; }
.pg.marked .thumb { box-shadow: 0 0 0 2px var(--accent), 0 6px 14px -8px rgb(21 32 43 / .3); }

/* split with several files: a section per file, stacked or side by side */
.fsechead { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin: -6px 0 12px; }
.seg.mini { padding: 3px; border-radius: 10px; }
.seg.mini span { height: 32px; padding: 0 12px; font-size: .8125rem; white-space: nowrap; }
.fsecs { --tw: 118px; display: grid; gap: 22px; }
.fsecs[data-ts="1"] { --tw: 84px; }
.fsecs[data-ts="3"] { --tw: 180px; }
.fsecs .pages { grid-template-columns: repeat(auto-fill, minmax(var(--tw), 1fr)); }
.fsec header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; min-width: 0; }
.fsec header b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.fsec header small { color: var(--muted); white-space: nowrap; }
.fsec header .iconbtn { height: 34px; min-width: 34px; }
.fsec.folded header { margin-bottom: 0; }
/* one below another: the file's name stays in view (under the top bar) while its pages scroll by */
.fsecs:not(.side) .fsec header { position: sticky; top: 64px; z-index: 3; padding: 8px 0; background: var(--bg); border-bottom: 2px solid var(--fc); }
/* side by side: a column per file, each scrolling on its own, its name always at the top; more files scroll sideways */
.fsecs.side { --colw: 210px; display: flex; gap: 14px; align-items: flex-start; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity; }
.fsecs.side[data-ts="1"] { --colw: 170px; --tw: 64px; }
.fsecs.side[data-ts="2"] { --tw: 86px; }
.fsecs.side[data-ts="3"] { --colw: 300px; --tw: 120px; }
.fsecs.side .fsec {
  flex: 1 0 var(--colw); min-width: var(--colw); max-height: calc(100dvh - 96px); overflow-y: auto; overscroll-behavior: contain;
  padding: 0 12px 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--fc); scroll-snap-align: start;
}
.fsecs.side .fsec header { position: sticky; top: 0; z-index: 3; margin: 0 -12px 10px; padding: 10px 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
.fsecs.side .fsec header { flex-wrap: wrap; row-gap: 2px; }
.fsecs.side .fsec header b { flex: 1 1 calc(100% - 32px); white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }
.fsecs.side .fsec header small { margin-left: 30px; }
.fsecs.side .fsec header .iconbtn { height: 30px; min-width: 30px; padding: 0 4px; }
.fsecs.side .fsec.folded { flex: 0 0 auto; min-width: 0; padding-bottom: 0; }
.fsecs.side .fsec.folded header { margin-bottom: 0; border-bottom: 0; }
.fsecs.side .pages { gap: 14px 10px; }
.willmake li.warn { color: var(--danger); }
.willmake li.wnote .btn { margin-top: 4px; }
@media (max-width: 720px) {
  .fsecs .pages { grid-template-columns: repeat(auto-fill, minmax(var(--tw), 1fr)); }
  .fsecs { --tw: 96px; }
  .fsecs[data-ts="1"] { --tw: 70px; }
  .fsecs[data-ts="3"] { --tw: 150px; }
  .fsecs.side { --colw: 168px; margin-inline: -16px; padding-inline: 16px; scroll-padding-inline: 16px; }
  .fsecs.side[data-ts="1"] { --colw: 130px; --tw: 52px; }
  .fsecs.side[data-ts="2"] { --tw: 120px; }
  .fsecs.side[data-ts="3"] { --colw: 240px; --tw: 200px; }
  .fsecs.side .fsec { max-height: calc(100dvh - 230px); }
}
.bmin { position: absolute; z-index: 30; height: 38px; font-size: .875rem; font-weight: 600; box-shadow: 0 0 0 2px var(--accent), 0 8px 20px -6px rgb(0 0 0 / .35); background: var(--surface); }

/* ---------- policy pages (privacy.html, terms.html) ---------- */
.doc { max-width: 720px; padding-block: 8px 72px; }
.doc h1 { font-size: 1.75rem; font-weight: 650; letter-spacing: -.02em; margin-bottom: 4px; }
.doc .date { color: var(--muted); font-size: .875rem; margin-bottom: 28px; }
.doc h2 { font-size: 1.0625rem; font-weight: 620; margin: 28px 0 8px; }
.doc p, .doc li { color: var(--text); max-width: 68ch; }
.doc p + p { margin-top: 10px; }
.doc ul { list-style: disc; padding-left: 1.25em; display: grid; gap: 6px; margin-top: 8px; }
.doc a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.doc table { border-collapse: collapse; width: 100%; margin-top: 10px; font-size: .9375rem; }
.doc th, .doc td { text-align: left; vertical-align: top; padding: 8px 10px; border-top: 1px solid var(--line); }
.doc th { color: var(--muted); font-weight: 560; }
.doc .tablewrap { overflow-x: auto; }
.doc .lang-jump { display: inline-block; margin-bottom: 20px; font-size: .9375rem; }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 56px 0 40px; }

/* home: questions and the site footer */
.sitefoot { border-top: 1px solid var(--line); margin-top: 28px; padding-block: 28px 40px; color: var(--muted); font-size: .875rem; }
.sitefoot .wrap { display: grid; gap: 10px; }
.sitefoot .foot { padding: 0; display: flex; align-items: center; gap: 8px; color: var(--text); }
.sitefoot .foot .ic { color: var(--accent); flex: none; }
.sitefoot a { color: var(--accent); text-decoration: none; }
.sitefoot a:hover { text-decoration: underline; }
.sitefoot nav { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 4px; }
.sitefoot nav a { color: inherit; font-weight: 550; }
.doc section { margin-top: 36px; }
.doc pre { white-space: pre-wrap; font: .8125rem/1.55 ui-monospace, Menlo, Consolas, monospace; color: var(--muted); background: var(--surface-2); border-radius: 12px; padding: 14px; margin-top: 10px; }

/* ---------- home, second version (design review 2026-10-09) ---------- */
.top.home { background: var(--surface); border-bottom: 1px solid var(--line); }
.hnav { display: flex; gap: 2px; margin-left: 18px; }
.hnav button { background: none; border: 0; padding: 8px 12px; border-radius: 10px; color: var(--muted); font-weight: 550; font-size: .9375rem; }
.hnav button:hover { background: var(--surface-2); color: var(--text); }
.heroband { background: var(--surface); border-bottom: 1px solid var(--line); }
.heroband .hero { padding-block: 44px 44px; gap: 56px; }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: .8125rem; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 5px 11px; border-radius: 999px; margin-bottom: 16px; }
.eyebrow .ic { width: 14px; height: 14px; }
.heroband .facts { flex-direction: column; gap: 10px; padding: 26px 0 0; color: var(--text); }
.heroband .facts .ic { flex: none; }
.drop.home { min-height: 300px; padding: 34px 24px 20px; background: color-mix(in srgb, var(--accent-soft) 55%, var(--surface)); border: 2px dashed color-mix(in srgb, var(--accent) 40%, var(--line)); border-radius: 22px; gap: 10px; }
.drop.home:hover { border-color: var(--accent); }
.drop .dropic { width: 60px; height: 60px; border-radius: 18px; background: var(--surface); display: grid; place-items: center; box-shadow: 0 2px 10px -2px color-mix(in srgb, var(--accent) 30%, transparent); margin-bottom: 6px; }
.drop.home strong { font-size: 1.25rem; font-weight: 650; letter-spacing: -.01em; }
.drop.home .btn { margin-top: 8px; min-width: 160px; }
.quick { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 18px; padding-top: 16px; border-top: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line)); width: 100%; }
.quick small { width: 100%; color: var(--muted); font-size: .8125rem; margin-bottom: 2px; }
.quick a { font-size: .875rem; color: var(--text); background: var(--surface); border: 1px solid var(--line); padding: 6px 12px; border-radius: 999px; transition: border-color .2s; }
.quick a:hover { border-color: var(--accent); color: var(--accent); }
main.home { padding-top: 22px; }
main.home .block { padding-block: 26px; scroll-margin-top: 76px; }
main.home .block > header { margin-bottom: 16px; }
main.home .block h3 { font-size: 1.375rem; font-weight: 650; letter-spacing: -.02em; }
.g-organize { --tc: var(--g1); --tcs: var(--g1s); }
.g-edit { --tc: var(--g2); --tcs: var(--g2s); }
.g-protect { --tc: var(--g3); --tcs: var(--g3s); }
.g-convert { --tc: var(--g4); --tcs: var(--g4s); }
.ti { font-style: normal; display: grid; place-items: center; flex: none; background: var(--tcs); color: var(--tc); }
.feat { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.fcard { display: grid; gap: 4px; align-content: start; padding: 22px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); transition: transform .25s var(--ease), border-color .2s, box-shadow .25s; }
.fcard .ti { width: 46px; height: 46px; border-radius: 13px; margin-bottom: 12px; }
.fcard .ti .ic { width: 23px; height: 23px; }
.fcard b { font-size: 1.0625rem; font-weight: 650; letter-spacing: -.01em; }
.fcard span { color: var(--muted); font-size: .875rem; line-height: 1.45; }
.fcard:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--tc) 50%, var(--line)); box-shadow: var(--shadow); }
.cats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: start; }
.cat { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px 8px 8px; }
.cat h4 { font-size: .8125rem; font-weight: 650; color: var(--tc); letter-spacing: .01em; padding: 0 10px 8px; }
.trow { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 12px; }
.trow:hover { background: var(--surface-2); }
.trow .ti { width: 36px; height: 36px; border-radius: 10px; }
.trow .ti .ic { width: 19px; height: 19px; }
.trow b { display: block; font-weight: 600; font-size: .9375rem; }
.trow small { display: block; color: var(--muted); font-size: .8125rem; line-height: 1.35; margin-top: 1px; }
.faq { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 48px; align-items: start; }
.faq .side p { color: var(--muted); margin-top: 8px; font-size: .9375rem; }
.faq .side a { display: inline-block; margin-top: 12px; color: var(--accent); font-weight: 600; font-size: .9375rem; }
.faq details { border-bottom: 1px solid var(--line); }
.faq details:first-of-type { border-top: 1px solid var(--line); }
.faq summary { cursor: pointer; list-style: none; padding: 17px 4px; font-weight: 600; font-size: 1rem; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--muted); font-weight: 400; font-size: 1.25em; line-height: 1; transition: transform .2s, color .2s; }
.faq details[open] summary::after { transform: rotate(45deg); color: var(--accent); }
.faq details p { padding: 0 4px 18px; color: var(--muted); line-height: 1.7; max-width: 640px; white-space: pre-line; }
@media (max-width: 1000px) {
  .feat { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .faq { grid-template-columns: 1fr; gap: 14px; }
}
@media (max-width: 860px) {
  .hnav { display: none; }
  .heroband .hero { padding-block: 24px 28px; gap: 24px; }
  .heroband .facts { padding-top: 18px; }
  .drop.home { min-height: 0; padding: 26px 18px 16px; }
}
@media (max-width: 520px) {
  .feat { gap: 10px; }
  .fcard { padding: 16px; }
  .cats { grid-template-columns: 1fr; }
}
.heroband h2, .heroband p, .fcard span, .trow small, .faq summary { word-break: keep-all; overflow-wrap: anywhere; }

/* result screen: what was made, save, what to do next */
.donehead { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; }
.donehead > .ic { width: 34px; height: 34px; color: var(--accent); }
.donehead .ok { font-size: 1.1875rem; font-weight: 650; letter-spacing: -.01em; }
.donehead small { display: block; color: var(--muted); font-size: .8125rem; line-height: 1.45; margin-top: 2px; }
.nextup { display: grid; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.nextup .lab { font-weight: 600; font-size: .9375rem; }
.nexttools { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.nexttools .trow { border: 1px solid var(--line); background: var(--surface); text-align: left; padding: 8px 10px; }
.nexttools .trow .ti { width: 32px; height: 32px; border-radius: 9px; }
.nexttools .trow .ti .ic { width: 17px; height: 17px; }
.nexttools .trow b { font-size: .875rem; }
.nexttools .more .ti { background: var(--surface-2); color: var(--muted); }
.link.again { display: inline-flex; align-items: center; gap: 6px; justify-self: center; color: var(--muted); margin-top: 2px; }
.link.again .ic { width: 16px; height: 16px; }
.link.again:hover { color: var(--text); }
.iconbtn.install { color: var(--accent); font-weight: 600; white-space: nowrap; }
.installhint { display: grid; grid-template-columns: auto 1fr; gap: 8px 10px; align-items: center; padding: 12px; border-radius: 12px; background: var(--accent-soft); font-size: .875rem; line-height: 1.45; }
.installhint .ic { color: var(--accent); width: 20px; height: 20px; }
.installhint .btn { grid-column: 2; justify-self: start; }
.installhint[hidden] { display: none; }
/* split spreads: where each sheet will be cut (--at: the cut, --gp: the strip dropped around it) */
.pg.halved .thumb::after { content: ""; position: absolute; top: 6%; bottom: 6%; left: var(--at, 50%); border-left: 2px dashed var(--danger); transform: translateX(-1px); pointer-events: none; }
.pg.halved.hv-h .thumb::after { top: var(--at, 50%); bottom: auto; left: 6%; right: 6%; border-left: 0; border-top: 2px dashed var(--danger); transform: translateY(-1px); }
.pg.halved .thumb::before { content: ""; position: absolute; top: 0; bottom: 0; left: calc(var(--at, 50%) - var(--gp, 0%) / 2); width: var(--gp, 0%); background: rgb(179 38 30 / .3); pointer-events: none; z-index: 1; }
.pg.halved.hv-h .thumb::before { top: calc(var(--at, 50%) - var(--gp, 0%) / 2); bottom: auto; left: 0; right: 0; width: auto; height: var(--gp, 0%); }
.ov.hv { position: absolute; inset: 0; cursor: ew-resize; touch-action: none; }
.hv-h .ov.hv { cursor: ns-resize; }
.ov.hv .band { position: absolute; top: 0; bottom: 0; left: calc(var(--at) - var(--gp) / 2); width: var(--gp); background: rgb(179 38 30 / .18); }
.ov.hv .cut { position: absolute; top: 0; bottom: 0; left: var(--at); width: 0; border-left: 2px solid var(--danger); transform: translateX(-1px); }
.ov.hv .cut b { position: absolute; top: 50%; left: -13px; width: 24px; height: 40px; margin-top: -20px; border-radius: 12px; background: var(--danger); box-shadow: 0 2px 8px rgb(0 0 0 / .3); }
.ov.hv .cut b::before { content: ""; position: absolute; inset: 12px 9px; border-left: 2px solid #fff; border-right: 2px solid #fff; }
.hv-h .ov.hv .band { top: calc(var(--at) - var(--gp) / 2); bottom: auto; left: 0; right: 0; width: auto; height: var(--gp); }
.hv-h .ov.hv .cut { top: var(--at); bottom: auto; left: 0; right: 0; width: auto; height: 0; border-left: 0; border-top: 2px solid var(--danger); transform: translateY(-1px); }
.hv-h .ov.hv .cut b { top: -13px; left: 50%; width: 40px; height: 24px; margin: 0 0 0 -20px; }
.hv-h .ov.hv .cut b::before { inset: 9px 12px; border: 0; border-top: 2px solid #fff; border-bottom: 2px solid #fff; }
.bigprev[hidden] { display: none; }
.pg.halved .thumb { box-shadow: 0 0 0 2px color-mix(in srgb, var(--danger) 45%, var(--line)), 0 6px 14px -8px rgb(21 32 43 / .3); }

/* phones: the settings come first, so a link in the bottom bar jumps to the page pictures */
.sumrow { display: flex; align-items: baseline; gap: 10px; }
.sumrow .sum { flex: 1; min-width: 0; }
.jumpstage { display: none; flex: none; align-items: center; gap: 4px; }
.jumpstage .ic { width: 15px; height: 15px; }
.stage { scroll-margin-top: 72px; min-width: 0; }
@media (max-width: 860px) { .jumpstage { display: inline-flex; } }

/* ad places (C113): hidden until an ad unit is set; warm beige with a label, so an ad is never mistaken for a tool */
.adslot { display: none; }
.adslot.on { display: block; position: relative; min-height: 120px; margin: 28px 0 8px; padding: 22px 12px 12px; border-radius: 14px; background: #faf7f0; border: 1px solid #e9e1cf; }
.adslot.on::before { content: attr(data-label); position: absolute; top: 5px; right: 10px; font-size: .6875rem; font-weight: 600; color: #8a7a5a; }
.done .adslot.on { margin-top: 24px; min-height: 270px; }
:root[data-theme="dark"] .adslot.on { background: #1d1b17; border-color: #3a342a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .adslot.on { background: #1d1b17; border-color: #3a342a; } }

/* presets: manage one (name, steps, change a step, delete) and the bar shown while changing a step */
.preset .mini.on { color: var(--accent); background: var(--accent-soft); }
.pmanage { display: grid; gap: 10px; margin-top: 12px; padding: 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); max-width: 640px; }
.pmanage .row { display: flex; gap: 8px; align-items: center; }
.pmanage .row .input { flex: 1; min-width: 0; }
.pmname label, .pmanage .lab { font-weight: 600; font-size: .875rem; }
.psteps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; counter-reset: step; }
.psteps li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; background: var(--bg); }
.psteps .ti { width: 32px; height: 32px; border-radius: 9px; }
.psteps .ti .ic { width: 17px; height: 17px; }
.psteps b { display: block; font-weight: 600; font-size: .9375rem; }
.psteps small { display: block; color: var(--muted); font-size: .8125rem; }
.psteps .noedit { color: var(--muted); padding: 0 8px; }
.pmfoot { padding-top: 4px; }
.link.danger { color: var(--danger); display: inline-flex; align-items: center; gap: 6px; }
.link.danger .ic { width: 16px; height: 16px; }
.editbar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; margin: -2px 0 12px; border-radius: 12px; background: var(--accent-soft); color: var(--text); font-size: .875rem; font-weight: 550; }
.editbar .ic { color: var(--accent); width: 18px; height: 18px; flex: none; }
.editbar span { flex: 1; min-width: 0; }

/* several files held: the list on the home screen, the file chips in single-file tools, «all files» */
.held.many { grid-template-columns: 1fr; gap: 10px; }
.heldtop { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.heldlist { display: grid; gap: 2px; max-height: 232px; overflow-y: auto; margin-inline: -6px; }
.heldlist li { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px; padding: 4px 6px; border-radius: 10px; }
.heldlist li:hover { background: var(--surface-2); }
.heldlist b { font-weight: 550; font-size: .9375rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; word-break: normal; }
.heldlist small { white-space: nowrap; }
.heldlist .iconbtn { height: 32px; min-width: 32px; }
.held.many .next { margin-top: 0; }
.ftag { font-style: normal; }
.heldlist .ftag, .fchip .ftag {
  width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; flex: none;
  background: var(--fc); color: #fff; font-size: .75rem; font-weight: 700;
}
.fswitch { display: flex; gap: 6px; overflow-x: auto; padding: 8px 20px 4px; scrollbar-width: thin; }
.fchip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 180px; flex: none; height: 34px; padding: 0 10px 0 6px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: .8125rem;
}
.fchip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fchip.on { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.batchrow { display: grid; gap: 4px; padding: 10px 12px; margin-bottom: 10px; border-radius: 12px; background: var(--accent-soft); }
.batchrow .check { font-weight: 550; }
.batchrow small { color: var(--muted); font-size: .8125rem; }
#loadpill {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; padding: 10px 16px; border-radius: 999px;
  background: var(--text); color: var(--bg); font-size: .875rem; font-weight: 550; box-shadow: var(--shadow);
}

/* recent work on the home screen: tick jobs, make them one preset */
.hist { margin-top: 18px; padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); display: grid; gap: 10px; }
.hist header { display: grid; gap: 2px; }
.hist header > * { margin: 0; }
.hist h4 { display: flex; align-items: center; gap: 8px; font-size: 1rem; font-weight: 600; }
.hist h4 .ic { color: var(--accent); }
.hist header small, .hist footer small { color: var(--muted); font-size: .8125rem; }
.hlist { display: grid; gap: 4px; list-style: none; margin: 0; padding: 0; }
.hlist li { border-radius: 12px; border: 1px solid transparent; }
.hlist li.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.hlist .check { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; cursor: pointer; }
.hlist .check input { margin-top: 3px; }
.hlist .check span { display: grid; gap: 2px; min-width: 0; }
.hlist b { font-weight: 550; font-size: .9375rem; overflow-wrap: anywhere; }
.hlist small { color: var(--muted); font-size: .8125rem; }
.histgo { display: grid; gap: 8px; justify-items: start; padding-top: 4px; }
.histgo .hint { color: var(--muted); font-size: .875rem; }
.histgo .namebox { width: 100%; }
.hist footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 12px; padding-top: 6px; border-top: 1px solid var(--line); }
.histlink { justify-self: center; display: inline-flex; align-items: center; gap: 6px; }
.held .addmore { margin-top: 6px; display: inline-flex; align-items: center; gap: 4px; }

/* several files: a button per file to go straight to it — a row above the pages, or in the empty left margin on wide screens */
.fjump { position: sticky; top: 64px; z-index: 6; display: flex; gap: 6px; overflow-x: auto; margin: -6px 0 10px; padding: 6px 0; background: var(--bg); scrollbar-width: none; }
.fj {
  position: relative; flex: none; display: inline-flex; align-items: center; gap: 6px; height: 36px; max-width: 190px; padding: 0 10px 0 5px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: .8125rem;
}
.fj i { flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--fc); color: #fff; font-style: normal; font-weight: 700; font-size: .75rem; }
.fj span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fj.on { border-color: var(--fc); box-shadow: inset 0 0 0 1px var(--fc); font-weight: 600; }
.fj:hover { background: var(--surface-2); }
.stage:has(> .fjump) .fsecs:not(.side) .fsec header { top: 112px; }
.stage:has(> .fjump) :is(.fsec, [data-rsec], .mp) { scroll-margin-top: 124px; }
@media (min-width: 1240px) {
  .fjump {
    position: fixed; top: 50%; transform: translateY(-50%); left: max(8px, calc(50vw - 560px - 58px)); z-index: 6;
    flex-direction: column; gap: 8px; margin: 0; padding: 0; background: none; overflow: visible; max-height: 80vh;
  }
  .fj { width: 46px; height: 46px; max-width: none; padding: 0; justify-content: center; border-radius: 14px; box-shadow: var(--shadow); }
  .fj i { width: 32px; height: 32px; border-radius: 10px; font-size: .875rem; }
  .fj span { position: absolute; left: 54px; top: 50%; transform: translateY(-50%); max-width: 260px; padding: 6px 10px; border-radius: 8px;
    background: var(--text); color: var(--bg); font-size: .8125rem; font-weight: 550; opacity: 0; pointer-events: none; transition: opacity .15s; }
  .fj:hover span, .fj:focus-visible span { opacity: 1; }
  .stage:has(> .fjump) .fsecs:not(.side) .fsec header { top: 64px; }
  .stage:has(> .fjump) :is(.fsec, [data-rsec], .mp) { scroll-margin-top: 76px; }
}
.mp.flash .thumb { animation: mflash 1.4s ease-out; }
@keyframes mflash { 0%, 50% { box-shadow: 0 0 0 4px var(--fc), 0 6px 14px -8px rgb(21 32 43 / .3); } }

/* side by side: which files to show (tick) and go to (name), with the sideways scrollbar on top */
.sidetop { position: sticky; top: 64px; z-index: 6; display: grid; gap: 6px; margin: -4px 0 10px; padding: 6px 0 4px; background: var(--bg); }
.vfiles { display: flex; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.vfiles .lab { flex: none; font-size: .8125rem; font-weight: 600; color: var(--muted); margin-right: 2px; }
.vfiles[data-warn]::after { content: attr(data-warn); flex: none; font-size: .8125rem; color: var(--danger); }
.vchip { flex: none; display: inline-flex; align-items: center; gap: 2px; height: 36px; padding-left: 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }
.vchip input { width: 16px; height: 16px; accent-color: var(--fc); cursor: pointer; }
.vchip button { display: inline-flex; align-items: center; gap: 6px; height: 100%; max-width: 170px; padding: 0 10px 0 6px; border: 0; background: none; color: var(--text); font-size: .8125rem; border-radius: 0 10px 10px 0; }
.vchip button:hover { background: var(--surface-2); }
.vchip .ftag { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; flex: none; background: var(--fc); color: #fff; font-size: .75rem; font-weight: 700; position: static; }
.vchip button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vchip.off { background: var(--surface-2); }
.vchip.off button { color: var(--muted); }
.vchip.off .ftag { opacity: .45; }
.hscroll { position: relative; height: 14px; border-radius: 999px; background: var(--surface-2); cursor: pointer; touch-action: none; }
.hscroll[hidden] { display: none; }
.hthumb { position: absolute; left: 0; top: 2px; bottom: 2px; border-radius: 999px; background: color-mix(in srgb, var(--muted) 75%, transparent); cursor: grab; }
.hscroll:hover .hthumb, .hthumb:active { background: var(--accent); }
.fsecs.side { scrollbar-width: none; }
.fsecs.side::-webkit-scrollbar { display: none; }
.fsec.flash { animation: colflash 1.4s ease-out; }
@keyframes colflash { 0%, 50% { box-shadow: 0 0 0 3px var(--fc); } }

.gohelp { color: var(--muted); font-size: .8125rem; text-align: center; margin-top: -2px; }
.namebox .pwhat { color: var(--text); }
.namebox .pwarn { display: flex; gap: 6px; align-items: flex-start; color: #9a3412; }
:root[data-theme="dark"] .namebox .pwarn { color: #f0a565; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .namebox .pwarn { color: #f0a565; } }
.namebox .pwarn .ic { flex: none; margin-top: 1px; }
