/* Drench Room - a plaster-and-ink page whose accent is the colour you are planning (--drench, set by app.js). */
:root {
  --bg: #f3efe7; --paper: #fbf9f4; --ink: #241f1a; --muted: #6f665b; --line: #ddd5c7; --line2: #cfc5b4;
  --drench: #8a9a7b; --drench-ink: #211d18; --drench-soft: #b8c4ac;
  --ok: #3d6b45; --warn: #9a5b14; --err: #9b2c2c; --info: #44607a;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r: 14px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #1b1916; --paper: #24211d; --ink: #efe9df; --muted: #a99f91; --line: #3a352e; --line2: #4a443b;
  --ok: #8fc79a; --warn: #e3b06a; --err: #f0948f; --info: #9dbad6;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.55 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em; background: color-mix(in srgb, var(--line) 55%, transparent); padding: 0.05em 0.35em; border-radius: 5px; }
.hidden { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.small { font-size: 0.86rem; } .muted { color: var(--muted); }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }

/* header */
.bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 10px 20px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.back { text-decoration: none; color: var(--muted); font-size: 0.9rem; white-space: nowrap; }
.brand { display: flex; align-items: center; gap: 9px; font-family: var(--serif); font-size: 1.15rem; flex: 1; min-width: 0; }
.logo { width: 22px; height: 22px; border-radius: 4px 4px 9px 9px; background: linear-gradient(180deg, var(--drench-soft) 0 38%, var(--drench) 38% 100%); box-shadow: inset 0 -3px 0 rgba(0,0,0,0.18); flex: none; }
.session { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.credits { font-size: 0.85rem; color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line2); background: var(--paper); border-radius: 999px; padding: 6px 14px; font-size: 0.9rem; text-decoration: none; line-height: 1.2; }
.pill:hover:not(:disabled) { border-color: var(--ink); }
.pill.solid { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.pill.solid:hover:not(:disabled) { background: color-mix(in srgb, var(--ink) 85%, var(--drench)); color: var(--bg); }
.pill.tiny { padding: 3px 10px; font-size: 0.8rem; }

/* hero */
.hero { max-width: 1120px; margin: 0 auto; padding: 46px 20px 18px; }
.kicker { text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.75rem; color: var(--muted); margin: 0 0 10px; }
.hero h1 { font-family: var(--serif); font-weight: 500; font-size: clamp(2.3rem, 6vw, 4.1rem); line-height: 1.02; margin: 0 0 16px; letter-spacing: -0.01em; }
.hero h1 em { font-style: italic; color: var(--drench); text-shadow: 0 1px 0 rgba(0,0,0,0.04); }
:root[data-theme="dark"] .hero h1 em { color: var(--drench-soft); }
.sub { max-width: 690px; font-size: 1.06rem; color: var(--muted); margin: 0 0 18px; }
.examples { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ex-label { font-size: 0.88rem; color: var(--muted); }
.chip { border: 1px solid var(--line2); background: var(--paper); border-radius: 999px; padding: 6px 14px; font-size: 0.9rem; }
.chip.on { background: var(--drench); color: var(--drench-ink); border-color: var(--drench); }

/* blocks */
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px 40px; }
.block { margin-top: 34px; }
.bhead { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 18px; margin-bottom: 12px; }
.bhead h2 { font-family: var(--serif); font-weight: 500; font-size: 1.6rem; margin: 0; display: flex; align-items: center; gap: 10px; }
.bhead p { margin: 0; color: var(--muted); font-size: 0.92rem; flex: 1 1 320px; }
.num { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--drench); color: var(--drench-ink); font: 600 0.9rem var(--sans); }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; min-width: 0; }
.panel h3 { font-family: var(--serif); font-weight: 500; font-size: 1.12rem; margin: 0 0 10px; }
.panel h3 + * { margin-top: 0; }
.panel h3:not(:first-child) { margin-top: 16px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--muted); min-width: 0; }
.field.inline { flex-direction: row; align-items: center; gap: 6px; }
.field.inline input { width: 80px; }
input[type="text"], input[type="number"], textarea, select { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line2); border-radius: 9px; padding: 8px 10px; min-width: 0; width: 100%; }
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus, button:focus-visible { outline: 2px solid var(--drench); outline-offset: 1px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 0.9rem; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.seg2, .segs { display: inline-flex; border: 1px solid var(--line2); border-radius: 999px; overflow: hidden; background: var(--bg); margin-top: 4px; }
.segbtn { border: 0; background: transparent; padding: 6px 13px; font-size: 0.88rem; }
.segbtn + .segbtn { border-left: 1px solid var(--line2); }
.segbtn.on { background: var(--ink); color: var(--bg); }
.incl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }

/* colour */
.colrow { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.3fr); gap: 16px; }
.pickrow { display: grid; grid-template-columns: 76px 1fr; gap: 10px 12px; align-items: end; }
.pickrow .field:last-child { grid-column: 1 / -1; }
input[type="color"] { width: 76px; height: 76px; border: 1px solid var(--line2); border-radius: 12px; padding: 0; background: none; cursor: pointer; grid-row: span 1; }
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; } input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 11px; }
.facts { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 4px; font-size: 0.92rem; }
.facts li:first-child { font-family: var(--serif); font-size: 1.15rem; text-transform: capitalize; }
.ladder { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.rung { border: 0; border-radius: 10px; min-height: 104px; padding: 10px 8px; display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; text-align: left; gap: 1px; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08); transition: transform 0.12s; }
.rung b { font-size: 0.95rem; } .rung span { font-size: 0.74rem; opacity: 0.9; } .rung .rhex { font-family: ui-monospace, Menlo, monospace; font-size: 0.68rem; opacity: 0.8; }
.rung.base { box-shadow: inset 0 0 0 2px rgba(0,0,0,0.25); }
.rung.on { transform: translateY(-4px); box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--ink); }
.rung:hover { transform: translateY(-2px); }
.lightstrip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.lightsw { min-height: 58px; border-radius: 10px; padding: 8px; display: flex; align-items: flex-end; font-size: 0.78rem; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08); }

/* the drench */
.drenchrow { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; }
.stage { padding: 10px; background: linear-gradient(180deg, color-mix(in srgb, var(--paper) 70%, var(--drench-soft)) 0%, var(--paper) 70%); }
.roomsvg { display: block; width: 100%; height: auto; max-height: 470px; }
.roomsvg .surf { stroke: rgba(0,0,0,0.22); stroke-width: 0.05; cursor: pointer; transition: filter 0.15s; }
.roomsvg .surf:hover { filter: brightness(1.06); }
.roomsvg .surf.off { stroke-dasharray: 0.3 0.2; stroke: rgba(0,0,0,0.35); }
.roomsvg .surf.sel { stroke: var(--ink); stroke-width: 0.16; }
.roomsvg .surf.lit { stroke: #e0a100; stroke-width: 0.22; }
.roomsvg .guide { stroke: var(--muted); stroke-width: 0.06; stroke-dasharray: 0.35 0.3; fill: none; }
.roomsvg .glass { stroke: rgba(0,0,0,0.2); stroke-width: 0.05; }
.roomsvg .svglab { fill: var(--ink); opacity: 0.55; font-family: var(--sans); }
.roomsvg .svgnote { fill: var(--muted); font-size: 4px; }
.surftable { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin-bottom: 10px; }
.surftable th { text-align: left; font-weight: 500; color: var(--muted); font-size: 0.78rem; padding: 4px 4px 6px; border-bottom: 1px solid var(--line); }
.surftable td { padding: 5px 4px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.surftable td.area { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 0.82rem; }
.surftable tr.on td { background: color-mix(in srgb, var(--drench) 12%, transparent); }
.surftable tr.lit td { background: rgba(224, 161, 0, 0.18); }
.surftable select { padding: 5px 6px; font-size: 0.84rem; }
.surfname { border: 0; background: none; padding: 0; display: inline-flex; align-items: center; gap: 7px; font-weight: 600; text-align: left; }
.dot { display: inline-block; width: 14px; height: 14px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.18); flex: none; vertical-align: -2px; }
.takeoffrow { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; }
.cans { display: flex; flex-wrap: wrap; gap: 12px; }
.tin { position: relative; width: 112px; padding: 14px 8px 8px; border-radius: 6px 6px 12px 12px; background: linear-gradient(90deg, #d9d6cf, #f4f2ee 35%, #c9c5bc); color: #2b2722; text-align: center; display: flex; flex-direction: column; gap: 2px; box-shadow: 0 2px 0 rgba(0,0,0,0.12); }
.tin .lid { position: absolute; left: -3px; right: -3px; top: -5px; height: 9px; border-radius: 5px; background: linear-gradient(90deg, #b9b5ac, #e9e6df 40%, #a9a59b); }
.tin .band { height: 34px; border-radius: 4px; margin: 2px 0 4px; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.12); }
.tin b { font-size: 0.86rem; } .tin .tsub { font-size: 0.7rem; color: #5e574d; line-height: 1.25; }
.tin.lit { outline: 3px solid #e0a100; outline-offset: 2px; }
.hours { list-style: none; margin: 0; padding: 0; font-size: 0.9rem; }
.hours li { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.hours li.total { font-weight: 600; border-bottom: 0; }
.hours li.muted { border: 0; font-size: 0.82rem; }
.hours li.lit, .notes li.lit, .facts li.lit, #costLine.lit { background: rgba(224, 161, 0, 0.18); border-radius: 6px; }
.lightsw.lit, .rung.lit { outline: 3px solid #e0a100; outline-offset: 2px; }
.notes { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; font-size: 0.88rem; }
.notes li { padding: 6px 10px; border-radius: 8px; background: var(--bg); border-left: 3px solid var(--line2); }
.notes li.warn { border-left-color: var(--warn); } .notes li.error { border-left-color: var(--err); } .notes li.ok { border-left-color: var(--ok); } .notes li.info { border-left-color: var(--info); }
.notes li.none { color: var(--muted); }

/* ask */
.lanes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.lane { border: 1px solid var(--line2); background: var(--paper); border-radius: var(--r); padding: 12px 14px; text-align: left; display: flex; flex-direction: column; gap: 2px; }
.lane b { font-family: var(--serif); font-size: 1.1rem; font-weight: 500; } .lane span { font-size: 0.84rem; color: var(--muted); }
.lane.on { border-color: var(--ink); box-shadow: inset 0 -4px 0 var(--drench); }
.ask { display: flex; flex-direction: column; gap: 8px; }
.meter { margin: 4px 0 0; font-size: 0.9rem; color: var(--muted); }
.gate { margin: 0; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--warn) 12%, var(--paper)); font-size: 0.9rem; }
#gateAct { align-self: flex-start; }
.run { align-self: flex-start; border: 0; border-radius: 999px; padding: 12px 24px; font-size: 1rem; font-weight: 600; background: var(--drench); color: var(--drench-ink); box-shadow: inset 0 -3px 0 rgba(0,0,0,0.18); }
.run:hover:not(:disabled) { filter: brightness(1.05); }
.progress { margin-top: 12px; padding: 14px 16px; border-radius: var(--r); border: 1px dashed var(--line2); background: var(--paper); }
.ptitle { margin: 0 0 6px; font-weight: 600; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; font-size: 0.9rem; }
.step { color: var(--muted); } .step.active { color: var(--ink); font-weight: 600; } .step.done { color: var(--ok); }
.step-ic { display: inline-block; width: 14px; font-family: ui-monospace, Menlo, monospace; }
.raw { white-space: pre-wrap; word-break: break-word; font-size: 0.8rem; max-height: 360px; overflow: auto; }
.partial { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--warn) 14%, var(--paper)); font-size: 0.9rem; }
.how { margin-top: 12px; }
.result { margin-top: 14px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; border-top: 6px solid var(--drench); }
.rhead { display: flex; gap: 14px; align-items: flex-start; }
.rhead h3 { font-family: var(--serif); font-weight: 500; font-size: 1.35rem; margin: 0 0 4px; }
.rhead p { margin: 0; }
.stamp { flex: none; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.72rem; font-weight: 700; padding: 8px 10px; border-radius: 8px; border: 2px solid currentColor; transform: rotate(-3deg); margin-top: 4px; white-space: nowrap; }
.v-full, .v-diy_weekend { color: var(--ok); } .v-tonal, .v-diy_multi_day { color: var(--info); } .v-partial, .v-hire_pro { color: var(--warn); } .v-none { color: var(--muted); }
.result h4 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 18px 0 6px; font-weight: 600; }
.readline { margin: 12px 0 0; padding: 10px 12px; background: var(--bg); border-radius: 10px; font-size: 0.95rem; }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; }
.claims, .plain, .moves, .surflist { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 0.93rem; }
.surflist, .moves { list-style: none; padding-left: 0; }
.surfline, .move { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 7px 10px; background: var(--bg); border-radius: 9px; }
.why { flex-basis: 100%; color: var(--muted); font-size: 0.86rem; }
li.none { color: var(--muted); list-style: none; }
.jobsteps { margin: 0; padding-left: 0; list-style: none; counter-reset: js; display: grid; gap: 6px; font-size: 0.93rem; }
.jstep { counter-increment: js; display: grid; grid-template-columns: 30px 52px 1fr; gap: 8px; align-items: baseline; padding: 6px 10px; background: var(--bg); border-radius: 9px; }
.jstep::before { content: counter(js); font-family: var(--serif); font-size: 1.1rem; color: var(--drench); }
:root[data-theme="dark"] .jstep::before { color: var(--drench-soft); }
.jh { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 0.85rem; }
.cites { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-left: 4px; }
.cite { border: 1px solid var(--line2); background: var(--paper); border-radius: 6px; padding: 0 6px; font: 600 0.72rem ui-monospace, Menlo, monospace; line-height: 1.6; }
.cite:hover { border-color: var(--ink); } .cite.bad { color: var(--err); border-color: var(--err); text-decoration: line-through; cursor: help; }
.handoff { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.recon { margin-top: 12px; }
.recon h4 { margin: 0 0 4px; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }

/* export + history */
.exports { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.history { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.hrow { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; }
.hglyph { width: 34px; height: 34px; border-radius: 8px; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.15); }
.hinfo { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hinfo .small { overflow-wrap: anywhere; }

/* toasts, footer, docs */
.toasts { position: fixed; bottom: 16px; right: 16px; left: 16px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; z-index: 50; pointer-events: none; }
.toast { pointer-events: auto; max-width: 420px; padding: 10px 14px; border-radius: 10px; background: var(--ink); color: var(--bg); font-size: 0.9rem; box-shadow: 0 6px 24px rgba(0,0,0,0.18); transition: opacity 0.5s; }
.toast.err { background: var(--err); color: #fff; } .toast.gone { opacity: 0; } .toast a { color: inherit; font-weight: 600; }
.foot { max-width: 1120px; margin: 0 auto; padding: 22px 20px 50px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.86rem; }
.foot p { margin: 0 0 8px; }
.doc { max-width: 900px; margin: 0 auto; padding: 30px 20px 60px; }
.doc h1, .doc h2 { font-family: var(--serif); font-weight: 500; }
.doc pre { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 12px; overflow-x: auto; font-size: 0.82rem; }
.doc pre code { background: none; padding: 0; }
.doc table { border-collapse: collapse; width: 100%; font-size: 0.88rem; display: block; overflow-x: auto; }
.doc th, .doc td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.langtabs, .tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.langtabs button, .tabs button, .tab { border: 1px solid var(--line2); background: var(--paper); border-radius: 999px; padding: 4px 12px; font-size: 0.84rem; }
.langtabs button.on, .tabs button.on, .tab.on, .tab.active, .tab[aria-selected="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.statebox { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); margin: 14px 0; }
.tokenrow { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.tokenbox { font-family: ui-monospace, Menlo, monospace; word-break: break-all; }
.printsheet { display: none; }
.codegroup { margin: 10px 0 16px; }
.codegroup pre { margin-top: 6px; }
.mono { font-family: ui-monospace, Menlo, monospace; overflow-wrap: anywhere; }
.doc table { max-width: 100%; }

@media (max-width: 900px) {
  .colrow, .drenchrow { grid-template-columns: 1fr; }
  .takeoffrow { grid-template-columns: 1fr 1fr; }
  .takeoffrow .panel:first-child { grid-column: 1 / -1; }
  .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .bar { padding: 8px 12px; gap: 8px; flex-wrap: wrap; }
  .back { font-size: 0.82rem; }
  .brand { font-size: 1rem; white-space: nowrap; }
  .session .pill { padding: 5px 11px; font-size: 0.84rem; }
  .toast { max-width: 100%; font-size: 0.84rem; }
  .hero { padding: 28px 16px 10px; }
  .wrap { padding: 0 16px 30px; }
  .takeoffrow, .row2, .cols2, .lanes { grid-template-columns: 1fr; }
  .ladder { gap: 4px; }
  .rung { min-height: 86px; padding: 8px 5px; }
  .rung span:not(.rhex) { font-size: 0.66rem; }
  .rung .rhex { display: none; }
  .lightsw { font-size: 0.7rem; }
  .surftable th:last-child, .surftable td.area { display: none; }
  .surftable select { font-size: 0.8rem; padding: 4px; }
  .segbtn { padding: 6px 10px; }
  .tin { width: calc(50% - 6px); }
  .jstep { grid-template-columns: 24px 46px 1fr; }
  .rhead { flex-direction: column; gap: 8px; }
}
@media print {
  body > *:not(.printsheet) { display: none !important; }
  .printsheet { display: block; color: #000; font: 12pt/1.4 Georgia, serif; }
  .printsheet table { border-collapse: collapse; width: 100%; margin: 10px 0; }
  .printsheet th, .printsheet td { border: 1px solid #999; padding: 4px 6px; text-align: left; }
  .pswatch { display: inline-block; padding: 6px 8px; margin: 0 4px 4px 0; border-radius: 4px; font-size: 9pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
