/* Kind-Lie Meter - an instrument-room look: olive machine plate, brass trim, pale chart paper and ink colours by read. */
:root {
  --bg: #efeadb; --paper: #f8f5ea; --card: #fffdf6; --ink: #22261d; --muted: #5d6352; --line: #d6d0bb; --plate: #3f4a35; --plate-ink: #f3e9cc;
  --brass: #765612; --brass-soft: #f1e3bd; --accent: #3f4a35; --accent-ink: #f8f2de; --focus: #9a7426;
  --r-flattery: #b0142a; --r-pitch: #a5361f; --r-someday: #9a5313; --r-usually: #6c5810; --r-today: #2a6339; --r-past: #1f3f8a;
  --b-flattery: #fbe3e5; --b-pitch: #fbe6df; --b-someday: #fbecd9; --b-usually: #f4eccd; --b-today: #e0efe3; --b-past: #e2e9fb;
  --ok: #2a6339; --warn: #9a3412; --shadow: 0 1px 0 rgba(60, 50, 20, .08), 0 6px 18px rgba(60, 50, 20, .07);
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}
[data-theme="dark"] {
  --bg: #141811; --paper: #1b1f19; --card: #1f241c; --ink: #e6e9dc; --muted: #a8ae97; --line: #353d2d; --plate: #252c20; --plate-ink: #eadfbd;
  --brass: #d3ac58; --brass-soft: #3a3220; --accent: #c9a24f; --accent-ink: #1a1608; --focus: #d3ac58;
  --r-flattery: #ff8a98; --r-pitch: #ff9c80; --r-someday: #f4b469; --r-usually: #e0cb7a; --r-today: #95d6a8; --r-past: #a3bdff;
  --b-flattery: #3d1a1f; --b-pitch: #3d211a; --b-someday: #3a2a15; --b-usually: #332d14; --b-today: #1b3322; --b-past: #1c2742;
  --ok: #95d6a8; --warn: #ffb08a; --shadow: 0 1px 0 rgba(0, 0, 0, .4), 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.55 var(--sans); }
a { color: var(--brass); }
.hidden { display: none !important; }
.small { font-size: .9rem; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Header bar: the machine's name plate. */
.bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--plate); color: var(--plate-ink); border-bottom: 3px solid var(--brass); }
.back { color: var(--plate-ink); text-decoration: none; font-size: .95rem; white-space: nowrap; opacity: .9; }
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--mono); letter-spacing: .06em; min-width: 0; }
.brand strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo { width: 24px; height: 24px; flex: none; }
.logo .lg-p { fill: #f8f5ea; stroke: #b8913e; stroke-width: 1.5; }
.logo .lg-t { fill: none; stroke: #b0142a; stroke-width: 1.6; stroke-linejoin: round; }
.session { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.bar .pill { color: var(--plate-ink); border-color: rgba(243, 233, 204, .45); background: transparent; }
.bar .pill.solid { background: #d3ac58; border-color: #d3ac58; color: #1a1608; }
[data-theme="dark"] .bar .pill.solid { color: #1a1608; }
.bar .pill.ghost { border-style: dashed; }

/* Buttons and chips. */
.pill { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 6px 14px; border-radius: 6px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; text-decoration: none; font-size: .95rem; line-height: 1.2; }
.pill:hover:not(:disabled) { border-color: var(--brass); }
.pill.solid { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.pill.big { min-height: 46px; padding: 10px 22px; font-size: 1.05rem; }
.pill.tiny { min-height: 30px; padding: 4px 10px; font-size: .85rem; }
.pill:disabled { opacity: .5; cursor: not-allowed; }
.chip { border: 1.5px dashed var(--brass); background: var(--card); color: var(--ink); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: .9rem; }
.chip.on { border-style: solid; background: var(--brass-soft); font-weight: 600; }

main { max-width: 980px; margin: 0 auto; padding: 0 16px 40px; }
.hero { padding: 28px 0 8px; }
.kicker { margin: 0 0 6px; font-family: var(--mono); font-size: .8rem; letter-spacing: .18em; text-transform: uppercase; color: var(--brass); }
h1 { margin: 0; font-family: var(--serif); font-size: clamp(2rem, 6vw, 3rem); line-height: 1.08; }
.h1b { display: block; margin-top: 6px; font-size: clamp(1.05rem, 3.2vw, 1.35rem); font-style: italic; font-weight: 400; color: var(--muted); }
.lede { max-width: 62ch; font-size: 1.05rem; }
.samples { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }

/* Panels. */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin: 16px 0; box-shadow: var(--shadow); }
.ph { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; font-family: var(--serif); font-size: 1.3rem; }
.step-no { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--plate); color: var(--plate-ink); font-family: var(--mono); font-size: .9rem; border: 2px solid var(--brass); }
.free { font-family: var(--mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; padding: 2px 8px; border-radius: 4px; background: var(--b-today); color: var(--r-today); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fld { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; min-width: 0; }
.lab { font-size: .88rem; font-weight: 600; color: var(--muted); }
.lenshint { font-weight: 400; font-style: italic; }
.inp { width: 100%; border: 1.5px solid var(--line); border-radius: 6px; padding: 8px 10px; background: var(--paper); color: var(--ink); min-height: 40px; }
textarea.inp { resize: vertical; }
.cardrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.note { padding: 8px 10px; border-left: 3px solid var(--brass); background: var(--brass-soft); border-radius: 4px; }
.hint { color: var(--ink); }

/* Question rows: each sits on a strip of chart paper with an ink-coloured margin. */
.qs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.qrow { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: start; padding: 10px; border: 1px solid var(--line); border-left: 5px solid var(--line); border-radius: 6px; background: var(--paper); }
.qno { font-family: var(--mono); font-weight: 700; padding-top: 26px; }
.qgrid { display: grid; grid-template-columns: 1fr 270px; gap: 10px; min-width: 0; }
.qbtns { display: flex; flex-direction: column; gap: 4px; padding-top: 22px; }
.ib { width: 34px; min-height: 30px; padding: 0; }
.cue { display: block; margin-top: 2px; }
.cue.warn { color: var(--warn); font-weight: 600; }


/* The chart and the lamp. */
.board { border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--paper); }
.board svg { display: block; width: 100%; height: auto; }
.verdictline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0 4px; }
.callchip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .88rem; font-weight: 600; border: 1.5px solid var(--line); background: var(--paper); color: var(--ink); white-space: nowrap; }
.callchip.sm { font-size: .8rem; padding: 2px 8px; }
.callchip.v-straight { background: var(--b-past); border-color: var(--r-past); color: var(--r-past); }
.callchip.v-mixed { background: var(--b-someday); border-color: var(--r-someday); color: var(--r-someday); }
.callchip.v-fishing { background: var(--b-flattery); border-color: var(--r-flattery); color: var(--r-flattery); }
.callchip.r-flattery { background: var(--b-flattery); color: var(--r-flattery); border-color: var(--r-flattery); }
.callchip.r-pitch { background: var(--b-pitch); color: var(--r-pitch); border-color: var(--r-pitch); }
.callchip.r-someday { background: var(--b-someday); color: var(--r-someday); border-color: var(--r-someday); }
.callchip.r-usually { background: var(--b-usually); color: var(--r-usually); border-color: var(--r-usually); }
.callchip.r-today { background: var(--b-today); color: var(--r-today); border-color: var(--r-today); }
.callchip.r-past { background: var(--b-past); color: var(--r-past); border-color: var(--r-past); }
.callchip.after::before { content: "now: "; font-weight: 400; }

/* Run box and progress. */
.runrow { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.gate { margin: 10px 0 0; padding: 8px 10px; border-radius: 6px; background: var(--brass-soft); }
.steps { list-style: none; padding: 0; margin: 8px 0; }
.step { padding: 3px 0; color: var(--muted); font-family: var(--mono); font-size: .9rem; }
.step.active { color: var(--ink); font-weight: 700; }
.step.done { color: var(--ok); }
.step-ic { display: inline-block; width: 1.2em; }
.raw { white-space: pre-wrap; word-break: break-word; font-family: var(--mono); font-size: .85rem; background: var(--paper); padding: 10px; border-radius: 6px; }

/* The reading. */
.res-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.res-kick { margin: 0; color: var(--muted); }
.badge { font-family: var(--mono); font-size: .78rem; letter-spacing: .1em; padding: 4px 10px; border-radius: 4px; border: 1.5px solid var(--line); color: var(--muted); }
.badge.on.v-straight { border-color: var(--r-past); color: var(--r-past); background: var(--b-past); }
.badge.on.v-mixed { border-color: var(--r-someday); color: var(--r-someday); background: var(--b-someday); }
.badge.on.v-fishing { border-color: var(--r-flattery); color: var(--r-flattery); background: var(--b-flattery); }
.headline { font-family: var(--serif); font-size: 1.25rem; margin: 12px 0; }
.readings { list-style: none; padding: 0; margin: 10px 0; display: flex; flex-direction: column; gap: 10px; }
.reading { border: 1px solid var(--line); border-left: 5px solid var(--line); border-radius: 6px; padding: 10px 12px; background: var(--paper); }
.reading p { margin: 6px 0; }
.reading.none, .readings .none { color: var(--muted); font-style: italic; list-style: none; }
.rd-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.rd-no { font-family: var(--mono); font-weight: 700; }
.rd-q { flex: 1 1 220px; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.rewrite { margin-top: 6px; padding: 8px 10px; border-radius: 6px; background: var(--card); border: 1px dashed var(--r-past); }
.rw-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.qrow.r-flattery, .reading.r-flattery { border-left-color: var(--r-flattery); } .qrow.r-pitch, .reading.r-pitch { border-left-color: var(--r-pitch); }
.qrow.r-someday, .reading.r-someday { border-left-color: var(--r-someday); } .qrow.r-usually, .reading.r-usually { border-left-color: var(--r-usually); }
.qrow.r-today, .reading.r-today { border-left-color: var(--r-today); } .qrow.r-past, .reading.r-past { border-left-color: var(--r-past); } .qrow.r-none { border-left-color: var(--warn); }
.aside { margin: 14px 0; padding: 10px 12px; border-radius: 6px; background: var(--b-today); }
.aside p { margin: 2px 0; }
.ticket { margin: 14px 0; padding: 12px 14px; border: 2px dashed var(--brass); border-radius: 8px; background: var(--brass-soft); }
.tk-h { margin: 0; font-family: var(--mono); font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--brass); }
.tk-b { margin: 4px 0 0; font-family: var(--serif); font-size: 1.1rem; }
.recon { padding-left: 20px; }
.recon li.warn { color: var(--warn); }
.recon li.info { color: var(--muted); }
.recon li.none { color: var(--ok); list-style: none; margin-left: -20px; }
.exports { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.saved { list-style: none; padding: 0; margin: 10px 0 0; }
.hrow { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.hrow.none { color: var(--muted); font-style: italic; border-top: 0; }
.hinfo { display: flex; flex-direction: column; min-width: 0; }
.hbtns { display: flex; gap: 6px; }
.aboutbox p { max-width: 75ch; }
.foot { max-width: 980px; margin: 0 auto; padding: 8px 16px 40px; color: var(--muted); font-size: .9rem; }
.toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; z-index: 50; width: min(92vw, 460px); }
.toast { padding: 10px 14px; border-radius: 6px; background: var(--plate); color: var(--plate-ink); box-shadow: var(--shadow); transition: opacity .5s; }
.toast.err { background: #7a1f1f; color: #fff4f0; }
.toast a { color: inherit; font-weight: 700; }
.toast.gone { opacity: 0; }

@media (max-width: 640px) {
  .grid2 { grid-template-columns: 1fr; }
  .qrow { grid-template-columns: 1fr auto; }
  .qno { grid-column: 1 / -1; padding-top: 0; }
  .qgrid { grid-template-columns: 1fr; }
  .qbtns { padding-top: 0; }
  .back-t { display: none; }
  .bar { padding: 8px 10px; gap: 8px; }
  .brand strong { font-size: .92rem; }
  .bar .pill { min-height: 32px; padding: 4px 9px; font-size: .85rem; }
  .panel { padding: 14px; }
}
@media print {
  .bar, .askbox, .histbox, .exports, .samples, .cardrow, .qbtns, .toasts, #gate, #gateAct { display: none !important; }
  body { background: #fff; }
  .panel { box-shadow: none; border-color: #bbb; }
}
