/* Two Ways Out - night-blue ink, exit-sign green, ember for the things to fix. Light is a warm plaster wall; dark is
 * the house at night. */
:root {
  --bg: #f6f3ec; --panel: #fffdf8; --ink: #18202e; --muted: #5a6272; --line: #ddd6c8; --soft: #efe9dc;
  --green: #0a6b42; --green-bg: #dcf2e6; --ember: #b4400b; --ember-bg: #fde6d8; --amber: #8a5a00; --amber-bg: #fbefcc;
  --red: #a61b1b; --red-bg: #fbe0e0; --blue: #24406e; --blue-bg: #e2e9f6; --focus: #2563eb;
  --sky: #e7edf6; --roof: #6b4b3a; --wall: #fffaf0; --hall: #e9e2d2; --earth: #d9cdb6; --lawn: #cfe5c6; --stroke: #2b3445;
  --child: #f2c14e; --help: #b48ae6; --solo: #9fb3c8;
  --bg-2: var(--soft); --card: var(--panel); --ink-2: var(--muted); --accent: var(--green); --accent-ink: #fff; --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0e131d; --panel: #161d2b; --ink: #e7ebf2; --muted: #a3acbd; --line: #2b3549; --soft: #1d2638;
  --green: #5be39a; --green-bg: #0f3324; --ember: #ff9d66; --ember-bg: #3a1d10; --amber: #f5c451; --amber-bg: #3a2c08; --red: #ff8a8a; --red-bg: #3d1414;
  --blue: #9fb9ef; --blue-bg: #1b2a47; --focus: #8ab4ff;
  --sky: #121a2a; --roof: #8a6a58; --wall: #1b2333; --hall: #232c3f; --earth: #2a241b; --lawn: #183021; --stroke: #9aa7bf;
  --child: #d9a632; --help: #9b74d4; --solo: #6f86a3;
  --accent-ink: #08130d;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow-x: hidden; }
a { color: var(--blue); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.hidden { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.small { font-size: .875rem; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }

.bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 5; }
.back { text-decoration: none; font-size: .9rem; color: var(--muted); }
.brand { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; margin-right: auto; }
.logo { width: 28px; height: 28px; }
.lg-roof { fill: none; stroke: var(--ink); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.lg-wall { fill: var(--panel); stroke: var(--ink); stroke-width: 2; }
.lg-run { fill: none; stroke: var(--ink); stroke-width: 2; }
.lg-arrow { fill: none; stroke: var(--green); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.session { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

.pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 999px; padding: 6px 14px; font: inherit; font-size: .9rem; cursor: pointer; text-decoration: none; min-height: 34px; }
.pill:hover:not(:disabled) { border-color: var(--stroke); }
.pill:disabled { opacity: .5; cursor: not-allowed; }
.pill.solid { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
:root[data-theme="dark"] .pill.solid { color: #08130d; }
.pill.ghost { background: transparent; cursor: default; }
.pill.tiny { padding: 3px 10px; font-size: .8rem; min-height: 28px; }
.pill.big { padding: 10px 22px; font-size: 1rem; }

main { max-width: 1180px; margin: 0 auto; padding: 16px; }
.hero { padding: 8px 0 12px; }
.kicker { margin: 0 0 8px; font-size: .9rem; color: var(--muted); border-left: 3px solid var(--ember); padding-left: 10px; }
.note-src { font-style: italic; }
h1 { font-size: clamp(1.5rem, 4.4vw, 2.3rem); line-height: 1.18; margin: 4px 0 10px; letter-spacing: -.01em; overflow-wrap: break-word; }
.lede { max-width: 760px; margin: 0 0 12px; }
.samples { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip { border: 1px dashed var(--green); background: transparent; color: var(--green); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: .88rem; cursor: pointer; min-height: 32px; }
.chip.on { background: var(--green-bg); border-style: solid; font-weight: 600; }

.layout { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.planner { display: grid; gap: 16px; min-width: 0; }
@media (max-width: 900px) { .layout { grid-template-columns: minmax(0, 1fr); } }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; min-width: 0; }
.planner .panel { margin-bottom: 0; }
.ph { font-size: 1.12rem; margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.step-no { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; background: var(--green); color: #fff; font-size: .85rem; flex: none; }
:root[data-theme="dark"] .step-no { color: #08130d; }
h3 { font-size: 1rem; margin: 16px 0 6px; }
h3.sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lbl { display: block; font-size: .85rem; font-weight: 600; margin: 10px 0 4px; }
input[type="text"], select, textarea { width: 100%; font: inherit; font-size: .92rem; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; min-height: 36px; }
textarea { resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid2 .lbl { min-height: 2.6em; display: flex; align-items: flex-end; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } .grid2 .lbl { min-height: 0; } }

/* plan rows */
.rows { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 8px; }
.row { display: grid; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.room-row, .person-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
.room-row .rm { grid-column: 3; grid-row: 1 / span 3; }
.person-row .rm { grid-column: 3; grid-row: 1 / span 2; }
.row select, .row input[type="text"] { min-width: 0; font-size: .88rem; padding: 6px 7px; }
.row .rm { align-self: center; }
@media (max-width: 520px) { .room-row, .person-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .room-row .rm, .person-row .rm { grid-column: 1 / -1; grid-row: auto; justify-self: end; } .row select { padding: 6px 4px; } }
.rows .none, .plain .none, .recon .none { list-style: none; color: var(--muted); font-size: .9rem; }
.drop { margin-top: 10px; border: 1px dashed var(--line); border-radius: 8px; padding: 8px 10px; }
.drop.over { border-color: var(--green); background: var(--green-bg); }
.filelbl { color: var(--blue); text-decoration: underline; cursor: pointer; }
.note { background: var(--amber-bg); color: var(--ink); border-radius: 8px; padding: 6px 10px; }

/* the cutaway */
.house-host { width: 100%; overflow: hidden; border-radius: 10px; border: 1px solid var(--line); }
.house { display: block; width: 100%; height: auto; }
.h-sky { fill: var(--sky); } .h-earth { fill: var(--earth); } .h-lawn { fill: var(--lawn); }
.h-roof { fill: var(--roof); } .h-ground { stroke: var(--stroke); stroke-width: 2; }
.h-hall { fill: var(--hall); stroke: var(--stroke); stroke-width: 1; } .h-stair { stroke: var(--muted); stroke-width: 1.4; }
.h-lvl { font-size: 10px; font-weight: 700; fill: var(--muted); }
.h-room { fill: var(--wall); stroke: var(--stroke); stroke-width: 1.2; }
.h-emptyfloor { fill: var(--wall); opacity: .6; }
.h-gap .h-room { stroke: var(--amber); stroke-width: 2.4; }
.h-blocker .h-room { stroke: var(--red); stroke-width: 3; stroke-dasharray: 6 3; }
.h-name { font-size: 12px; font-weight: 700; fill: var(--ink); }
.h-alarm { fill: var(--panel); stroke: var(--green); stroke-width: 2; } .h-alarm-dot { fill: var(--green); }
.h-noalarm { fill: none; stroke: var(--ember); stroke-width: 1.6; stroke-dasharray: 2.5 2; }
.h-p { stroke: var(--stroke); stroke-width: 1; } .h-p-none { fill: var(--solo); } .h-p-child { fill: var(--child); } .h-p-help { fill: var(--help); }
.h-pflag { stroke: var(--red); stroke-width: 2.4; }
.h-pi { font-size: 9px; font-weight: 700; fill: #10151f; }
.h-ways { font-size: 11px; font-weight: 700; } .h-ways-2 { fill: var(--green); } .h-ways-1 { fill: var(--amber); } .h-ways-0 { fill: var(--red); }
.h-win { fill: var(--sky); stroke: var(--stroke); stroke-width: 1.2; } .h-win-ground, .h-win-ladder { stroke: var(--green); stroke-width: 1.8; }
.h-ladder { stroke: var(--green); stroke-width: 1.4; } .h-x { stroke: var(--red); stroke-width: 1.8; fill: none; }
.h-door { fill: none; stroke: var(--green); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; } .h-door-no { stroke: var(--red); stroke-dasharray: 2 2; }
.h-frontdoor { fill: var(--green); }
.h-path { fill: none; stroke: var(--green); stroke-width: 2.4; stroke-dasharray: 5 4; } .h-path-missing { stroke: var(--ember); }
.h-pole { stroke: var(--stroke); stroke-width: 2; } .h-flag { fill: var(--green); } .h-flag-missing { fill: none; stroke: var(--ember); stroke-width: 1.6; stroke-dasharray: 3 2; }
.h-meet { font-size: 11px; font-weight: 600; fill: var(--ink); }
.empty { padding: 24px; text-align: center; color: var(--muted); }
.legend { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.key { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--stroke); }
.k-p { background: var(--solo); } .k-child { background: var(--child); } .k-help { background: var(--help); }
.k-alarm { background: var(--panel); border: 2px solid var(--green); } .k-win { border-radius: 2px; background: var(--sky); border: 2px solid var(--green); }
.k-bad { border-radius: 3px; border: 2px dashed var(--red); } .k-gap { border-radius: 3px; border: 2px solid var(--amber); }

/* the escape clock */
.dial-host { display: flex; flex-direction: column; align-items: center; }
.dial { display: block; max-width: 100%; height: auto; }
.d-case { fill: var(--soft); stroke: var(--stroke); stroke-width: 2; } .d-face { fill: var(--panel); stroke: var(--line); }
.d-crown { fill: var(--stroke); } .d-late { fill: var(--ember-bg); }
.d-tick { stroke: var(--muted); stroke-width: 1.2; } .d-num { font-size: 10px; fill: var(--muted); }
.d-mark { stroke: var(--green); stroke-width: 2.4; } .d-mark-late { stroke: var(--red); }
.d-who { font-size: 10px; font-weight: 700; fill: var(--ink); }
.d-hand { stroke: var(--ink); stroke-width: 2.6; stroke-linecap: round; } .d-pin { fill: var(--ink); }
.dial-cap { text-align: center; max-width: 360px; margin: 4px 0 0; }

/* tags, badges, findings */
.tag { display: inline-block; font-size: .74rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.tag.est { color: var(--amber); background: var(--amber-bg); }
.t-blocker { color: var(--red); background: var(--red-bg); } .t-gap { color: var(--amber); background: var(--amber-bg); }
.facts { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.fact { display: flex; gap: 8px; align-items: flex-start; font-size: .9rem; }
.fact .tag { flex: none; margin-top: 2px; }
.t-note { color: var(--muted); background: var(--soft); }
.rules { margin: 0; padding-left: 1.2em; display: grid; gap: 2px; }
.facts .clear { color: var(--green); font-weight: 600; font-size: .9rem; }
.badge { display: inline-block; font-size: .8rem; font-weight: 700; padding: 2px 10px; border-radius: 6px; border: 1px solid currentColor; }
.v-rework { color: var(--red); background: var(--red-bg); } .v-patch { color: var(--amber); background: var(--amber-bg); } .v-drill { color: var(--green); background: var(--green-bg); } .v-none { color: var(--muted); }

/* run, progress, result */
.runrow { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.gate { background: var(--blue-bg); border-radius: 8px; padding: 8px 10px; 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); font-size: .9rem; } .step.active { color: var(--ink); font-weight: 600; } .step.done { color: var(--green); }
.step-ic { display: inline-block; width: 1.2em; font-family: ui-monospace, Menlo, monospace; }
.raw { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .8rem; background: var(--soft); padding: 10px; border-radius: 8px; max-height: 360px; overflow: auto; }
.res-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.res-head h2 { margin: 0; font-size: 1.25rem; overflow-wrap: anywhere; }
.summary { font-size: 1.02rem; }
.fails { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; counter-reset: f; }
.fail { position: relative; border: 1px solid var(--line); border-left: 6px solid var(--muted); border-radius: 10px; padding: 10px 12px 10px 14px; background: var(--soft); }
.fail.sev-high { border-left-color: var(--red); } .fail.sev-medium { border-left-color: var(--amber); } .fail.sev-low { border-left-color: var(--blue); }
.fail-head { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.fail-who { font-weight: 700; margin-right: 4px; }
.sev-t-high { color: var(--red); background: var(--red-bg); } .sev-t-medium { color: var(--amber); background: var(--amber-bg); } .sev-t-low, .sev-t-none { color: var(--blue); background: var(--blue-bg); }
.tag.src { color: var(--muted); background: transparent; border-style: dashed; }
.story { margin: 6px 0 4px; } .fix { margin: 0; color: var(--green); } .fix b { color: var(--ink); }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
@media (max-width: 700px) { .cols { grid-template-columns: 1fr; } }
.drill { padding-left: 1.4em; margin: 0; } .drill li { margin: 4px 0; }
.plain { padding-left: 1.1em; margin: 0; } .plain li { margin: 4px 0; }
.keep { margin: 0; padding: 8px 10px; background: var(--green-bg); border-radius: 8px; }
.recon { padding-left: 1.1em; margin: 0; font-size: .9rem; } .recon li.warn { color: var(--red); } .recon li.note { color: var(--muted); }

/* exports, kept plans, about, footer */
.exports, .cardrow { display: flex; gap: 8px; flex-wrap: wrap; }
.hist { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.hrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 6px; }
.hinfo { display: flex; flex-direction: column; margin-right: auto; min-width: 0; }
.hist .none { color: var(--muted); font-size: .9rem; }
.aboutbox p { max-width: 900px; }
.foot { max-width: 1180px; margin: 0 auto; padding: 8px 16px 40px; color: var(--muted); font-size: .85rem; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 20; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: 8px; padding: 8px 12px; font-size: .9rem; box-shadow: 0 4px 16px rgba(0,0,0,.15); transition: opacity .5s; }
.toast.err { border-left-color: var(--red); } .toast.gone { opacity: 0; }

/* the fridge card - printed on its own */
.fridge { display: none; }
@media print {
  body.printing-card > *:not(main), body.printing-card main > *:not(.fridge) { display: none !important; }
  body.printing-card main { padding: 0; }
  body.printing-card .fridge { display: block; color: #000; background: #fff; border: 3px solid #0a6b42; border-radius: 12px; padding: 18px 22px; font-size: 13pt; }
  .fridge h2 { margin: 0 0 8px; font-size: 22pt; color: #0a6b42; }
  .fc-meet { font-size: 15pt; } .fc-rooms li, .fc-rules li { margin: 4px 0; } .fc-foot { font-size: 10pt; color: #333; }
}
