/* Type Case - a letterpress shop: cream stock, black ink, a walnut type case with brass plates, proofreader's red. */
:root {
  --bg: #f3ede1; --paper: #fbf8f1; --card: #fffdf8; --ink: #1d1a16; --muted: #62594b; --line: #d8cdb9;
  --wood: #7a4b2a; --wood-dark: #4c2e18; --wood-hi: #9c6a40; --cell: #ecdfc7; --cell-ink: #2a2118;
  --brass: #c9a24d; --brass-ink: #2b1f08; --red: #b0341c; --red-soft: #f6e0d8; --blue: #24527a; --blue-soft: #dde8f1;
  --ok: #2f6b3a; --ok-soft: #e1eedf; --warn: #8a4b00; --warn-soft: #f7e7cf; --shadow: 0 1px 0 rgba(0,0,0,.04), 0 6px 18px rgba(60,40,10,.08);
  --ui: "TC Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --disp: "TC Young Serif", Georgia, "Times New Roman", serif;
  --head: "TC Bricolage Grotesque", system-ui, sans-serif;
}
:root[data-theme="dark"] {
  --bg: #14110d; --paper: #1d1914; --card: #221d17; --ink: #efe6d5; --muted: #b8ab94; --line: #3d342a;
  --wood: #6b4226; --wood-dark: #3a2312; --wood-hi: #8a5b36; --cell: #2b241c; --cell-ink: #f1e6d2;
  --brass: #d8b45e; --brass-ink: #241a06; --red: #ff9479; --red-soft: #3d2019; --blue: #9cc6ec; --blue-soft: #1b2b3a;
  --ok: #9bd3a4; --ok-soft: #1c2e1f; --warn: #f2c27a; --warn-soft: #3a2a12; --shadow: 0 1px 0 rgba(0,0,0,.3), 0 6px 18px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--ui); }
a { color: var(--blue); }
.hidden { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.small { font-size: .88rem; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
button, input, select, textarea { font: inherit; color: inherit; }

/* Header */
.bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--wood-dark); color: #f6ecd8; flex-wrap: wrap; }
.bar .back { color: #f6ecd8; text-decoration: none; font-size: .9rem; opacity: .9; }
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--disp); font-size: 1.2rem; }
.brand strong { font-weight: 400; }
.logo { width: 28px; height: 28px; }
.lg-wood { fill: var(--wood-hi); }
.lg-face { fill: var(--brass); }
.lg-ink { stroke: #fff6e4; stroke-width: 3; stroke-linecap: round; fill: none; }
.session { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.bar .pill { border-color: rgba(246,236,216,.5); color: #f6ecd8; background: transparent; }
.bar .pill.solid { background: var(--brass); color: var(--brass-ink); border-color: var(--brass); }

/* Buttons */
.pill { display: inline-flex; align-items: center; gap: 4px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 6px 14px; cursor: pointer; text-decoration: none; font-size: .92rem; line-height: 1.2; }
.pill:hover:not(:disabled) { border-color: var(--wood-hi); }
.pill.solid { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.pill.ghost { cursor: default; }
.pill.tiny { padding: 4px 10px; font-size: .82rem; }
.pill.big { padding: 10px 20px; font-size: 1rem; font-weight: 600; }
.pill:disabled { opacity: .5; cursor: not-allowed; }
.chip { border: 1.5px dashed var(--wood-hi); background: transparent; color: var(--ink); border-radius: 6px; padding: 4px 10px; cursor: pointer; font-size: .86rem; }
.chip.on { background: var(--wood); color: #fff8ea; border-style: solid; border-color: var(--wood); }

main { max-width: 1180px; margin: 0 auto; padding: 0 16px 40px; }
.hero { padding: 26px 0 8px; }
.kicker { font-size: .86rem; color: var(--red); margin: 0 0 8px; max-width: 760px; }
h1 { font-family: var(--disp); font-weight: 400; font-size: clamp(1.9rem, 5.2vw, 3.2rem); line-height: 1.08; margin: 0 0 10px; overflow-wrap: break-word; }
.lede { max-width: 760px; margin: 0 0 14px; }
.samples { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr); gap: 16px; align-items: start; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-top: 16px; box-shadow: var(--shadow); min-width: 0; }
.ph { font-family: var(--head); font-weight: 700; font-size: 1.2rem; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.num-badge { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 4px; background: var(--wood); color: #fff8ea; font-size: .9rem; font-family: var(--ui); }
.sub { font-family: var(--head); font-size: 1rem; margin: 16px 0 8px; }
.lbl { display: block; font-weight: 600; font-size: .9rem; margin: 10px 0 4px; }
input[type=text], select, textarea { width: 100%; border: 1.5px solid var(--line); background: var(--card); border-radius: 8px; padding: 8px 10px; }
input[type=text]:focus, select:focus, textarea:focus { outline: 2px solid var(--wood-hi); outline-offset: 1px; }
textarea { resize: vertical; }
.drop { border: 1.5px dashed var(--line); border-radius: 8px; padding: 8px 10px; margin-top: 6px; }
.drop.over { border-color: var(--wood-hi); background: var(--cell); }
.filelbl { color: var(--blue); text-decoration: underline; cursor: pointer; }

/* The case: a walnut drawer with recessed compartments and brass plates */
.drawer { background: var(--wood-dark); border-radius: 10px; padding: 18px 10px 10px; position: relative; box-shadow: inset 0 0 0 3px var(--wood), 0 4px 12px rgba(40,20,5,.25); }
.pull { position: absolute; top: 5px; left: 50%; width: 70px; height: 8px; margin-left: -35px; border-radius: 0 0 8px 8px; background: var(--brass); box-shadow: inset 0 -2px 0 rgba(0,0,0,.2); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; background: var(--wood); padding: 6px; border-radius: 4px; }
.cell { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 6px 8px; min-height: 108px; background: var(--cell); color: var(--cell-ink); border: 0; border-radius: 2px; cursor: pointer; box-shadow: inset 0 3px 6px rgba(60,35,10,.28), inset 0 -1px 0 rgba(255,255,255,.25); text-align: center; }
.cell:hover { box-shadow: inset 0 3px 6px rgba(60,35,10,.28), inset 0 0 0 2px var(--brass); }
.cell:focus-visible { outline: 3px solid var(--brass); outline-offset: -3px; }
.cell.picked { box-shadow: inset 0 3px 6px rgba(60,35,10,.28), inset 0 0 0 3px var(--red); }
.glyph { font-size: 2.3rem; line-height: 1.05; }
.plate { background: var(--brass); color: var(--brass-ink); font-size: .72rem; font-weight: 600; padding: 1px 6px; border-radius: 2px; line-height: 1.35; max-width: 100%; }
.kind { display: flex; gap: 4px; align-items: center; font-size: .72rem; color: var(--cell-ink); opacity: .9; flex-wrap: wrap; justify-content: center; }
.kchip { display: inline-block; font-size: .7rem; padding: 0 5px; border-radius: 3px; font-weight: 700; line-height: 1.5; }
.k-text { background: var(--ok-soft); color: var(--ok); }
.k-display { background: var(--warn-soft); color: var(--warn); }
.marks { position: absolute; top: 4px; right: 4px; display: flex; gap: 2px; }
.mark { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 3px; font-size: .74rem; font-weight: 800; }
.m-H { background: var(--red); color: var(--card); }
.m-B { background: var(--blue); color: var(--card); }

/* The composing stick */
.stick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; background: var(--cell); border-radius: 8px; padding: 10px; border: 1px solid var(--line); }
.slot { min-width: 0; }
.slotbtn { width: 100%; display: flex; align-items: center; gap: 6px; border: 1.5px solid var(--line); background: var(--card); border-radius: 6px; padding: 6px 8px; cursor: pointer; text-align: left; font-weight: 600; font-size: .9rem; color: var(--ink); }
.slotbtn.on { border-color: var(--red); box-shadow: 0 0 0 2px var(--red-soft); }
.slotrow { display: grid; grid-template-columns: auto 1fr auto 64px auto; gap: 6px; align-items: center; margin-top: 6px; }
.slotrow select, .slotrow input { padding: 5px 6px; }
#clearStick { margin-top: 8px; }

/* Proofs: cream stock with crop marks */
.proofhost { margin-top: 12px; }
.proofs { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-top: 10px; }
.proof { position: relative; background: #fffdf6; color: #1d1a16; border: 1px solid #e3d9c5; border-radius: 2px; padding: 26px 24px 18px; box-shadow: 0 2px 0 #e9e0cd, 0 10px 24px rgba(60,40,10,.12); min-width: 0; }
:root[data-theme="dark"] .proof { box-shadow: 0 10px 24px rgba(0,0,0,.5); border-color: #4a3f31; }
.crop { position: absolute; width: 14px; height: 14px; border-color: #9a8f7c; border-style: solid; border-width: 0; }
.crop.tl { top: 6px; left: 6px; border-top-width: 1px; border-left-width: 1px; }
.crop.tr { top: 6px; right: 6px; border-top-width: 1px; border-right-width: 1px; }
.crop.bl { bottom: 6px; left: 6px; border-bottom-width: 1px; border-left-width: 1px; }
.crop.br { bottom: 6px; right: 6px; border-bottom-width: 1px; border-right-width: 1px; }
.ptag { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; margin-bottom: 12px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .74rem; color: #5b5244; }
.plabel { font-family: var(--ui); font-size: .78rem; padding: 2px 8px; border-radius: 3px; background: #1d1a16; color: #fffdf6; letter-spacing: .02em; }
.l-safe { background: #2f5f3a; } .l-character { background: #8a3a1c; } .l-wild-card { background: #5a2f6e; } .l-stick { background: #6b4a26; }
.l-swap { background: #8a3a1c; } .l-tweak { background: #24527a; }
.spec { overflow-wrap: anywhere; }
.pset { border-top: 1px solid #e8dfcc; border-bottom: 1px solid #e8dfcc; padding: 12px 0; }
.phead { margin: 0 0 10px; line-height: 1.08; overflow-wrap: break-word; color: #1d1a16; }
.pbody { margin: 0; line-height: 1.5; color: #2a251e; overflow-wrap: break-word; }
.pbody.standin { color: #7a705f; font-style: italic; }
.pscale { font-size: .78rem; color: #5b5244; margin: 6px 0 0; }
.pnote { font-size: .9rem; margin: 10px 0 0; color: #2a251e; }
.pnote.watch { border-left: 3px solid #b0341c; padding-left: 8px; }
.pnote.watch b { color: #9a2c16; }
.plint { margin: 8px 0 0; padding-left: 18px; font-size: .84rem; color: #8a2a12; }
.pacts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.proof .pill { background: #fffdf6; color: #1d1a16; border-color: #d8cdb9; }

/* Flags (proof marks) */
.flags { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.flags li { display: flex; gap: 8px; align-items: baseline; font-size: .9rem; }
.flags li.none { color: var(--muted); }
.lv { flex: none; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; padding: 1px 6px; border-radius: 3px; }
.lv-fix .lv { background: var(--red); color: var(--card); }
.lv-warn .lv { background: var(--warn-soft); color: var(--warn); }
.lv-info .lv { background: var(--blue-soft); color: var(--blue); }

/* Press */
.lanes { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.lane { border: 1.5px solid var(--line); background: var(--card); color: var(--ink); border-radius: 6px; padding: 8px 14px; cursor: pointer; font-weight: 600; }
.lane.on { background: var(--wood); border-color: var(--wood); color: #fff8ea; }
.note { background: var(--warn-soft); color: var(--warn); padding: 6px 10px; border-radius: 6px; }
.runrow { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.gate { background: var(--blue-soft); color: var(--ink); padding: 8px 10px; border-radius: 6px; margin: 10px 0 0; }
.gate .pill { margin-left: 4px; }
.steps { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 4px; }
.step { color: var(--muted); }
.step.done { color: var(--ok); }
.step.active { color: var(--ink); font-weight: 600; }
.step-ic { display: inline-block; width: 14px; font-family: ui-monospace, Menlo, monospace; }
.raw { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--card); padding: 10px; border-radius: 6px; font-size: .82rem; }

/* Result */
.res-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.res-head h2 { font-family: var(--disp); font-weight: 400; font-size: clamp(1.35rem, 3.6vw, 2rem); margin: 0; line-height: 1.15; overflow-wrap: break-word; min-width: 0; flex: 1 1 240px; }
.stamp { display: inline-block; border: 2.5px solid currentColor; border-radius: 4px; padding: 3px 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; font-size: .86rem; transform: rotate(-2deg); background: var(--card); }
.v-pairs, .v-keep { color: var(--ok); }
.v-ask-first, .v-tweak { color: var(--blue); }
.v-swap { color: var(--red); }
.v-none { color: var(--muted); }
.summary { font-size: 1.02rem; }
.plain { padding-left: 20px; }
.issues { list-style: none; padding: 0; display: grid; gap: 8px; }
.issues li { background: var(--red-soft); color: var(--ink); padding: 8px 10px; border-radius: 6px; border-left: 4px solid var(--red); }
.issues li.none { background: var(--ok-soft); border-left-color: var(--ok); }
.issues li b { display: inline-block; margin-right: 6px; color: var(--red); text-transform: uppercase; font-size: .74rem; letter-spacing: .04em; }
.cardrow { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.lands { font-style: italic; }
.recon { list-style: none; padding: 0; display: grid; gap: 4px; }
.recon li { font-size: .9rem; padding: 6px 10px; border-radius: 6px; background: var(--card); border: 1px solid var(--line); }
.recon li.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.recon li.none { color: var(--muted); }
.exports { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.hist { list-style: none; padding: 0; display: grid; gap: 6px; }
.hrow { display: flex; gap: 6px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.hinfo { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hist li.none { color: var(--muted); }

.foot { max-width: 1180px; margin: 0 auto; padding: 16px 16px 40px; font-size: .86rem; color: var(--muted); }
.toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); display: grid; gap: 6px; z-index: 50; width: min(92vw, 520px); }
.toast { background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); font-size: .9rem; transition: opacity .5s; }
.toast.err { background: var(--red); color: var(--card); }
.toast a { color: inherit; font-weight: 700; }
.toast.gone { opacity: 0; }

@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .stick { grid-template-columns: minmax(0, 1fr); }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; padding: 5px; }
  .cell { min-height: 86px; padding: 8px 3px 6px; }
  .glyph { font-size: 1.75rem; }
  .plate { font-size: .64rem; padding: 1px 4px; }
  .kind { font-size: .62rem; }
  .proofs { grid-template-columns: minmax(0, 1fr); }
  .proof { padding: 24px 16px 16px; }
  .session .pill { padding: 5px 10px; }
}
@media print {
  .bar, .hero, .layout, .press, .progress, .histbox, .exports, .foot, .toasts, .pacts, #rRecon, #rMeta { display: none !important; }
  body { background: #fff; } .panel { box-shadow: none; border: 0; }
}
.phrow { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.phrow .ph { margin: 0 0 10px; }
#fixSizes { margin-top: 8px; }
.pget { font-size: .84rem; margin: 8px 0 0; color: #4a4237; }
.pget a { color: #1f4f8a; }
#rPrev { margin-top: 10px; }
@media print { .pget a { color: #1d1a16; } }
