/* If They Say - a rehearsal room with a game screen on the table: chalk-blue paper, an ink-navy dialogue box with a
 * double frame, and four tone colours (warm coral, direct teal, playful marigold, exit slate) shared by the wheel, the
 * choice buttons and the route beads. Every colour is a token; dark mode redefines the tokens. */
:root {
  --bg: #eef2f7; --panel: #ffffff; --ink: #18202e; --muted: #556074; --line: #d5dce7; --accent: #2b3f8f; --accent-ink: #ffffff; --soft: #e5ebf7;
  --screen: #141a33; --screen2: #1d2546; --screen-ink: #f3f0e4; --screen-dim: #a9b0cc; --frame: #c9b98a;
  --warm: #c4472f; --warm-soft: #fbe3dc; --warm-ink: #8a2a17;
  --direct: #127272; --direct-soft: #d6efee; --direct-ink: #0b5050;
  --playful: #a86a00; --playful-soft: #fbeccb; --playful-ink: #6e4500;
  --exit: #5b6474; --exit-soft: #e4e7ec; --exit-ink: #394150;
  --wedge-off: #e7ebf2; --wedge-off-ink: #8c95a6;
  --say: #1d6b44; --say-ink: #ffffff; --sharpen: #9a5a00; --sharpen-ink: #ffffff; --shrink: #5b3a99; --shrink-ink: #ffffff;
  --warn: #9a3412; --warn-soft: #fdebe3; --ok: #1d6b44; --ok-soft: #e1f3e8; --info-soft: #e8edf8;
  --shadow: 0 1px 2px rgba(20, 30, 60, .07), 0 6px 18px rgba(20, 30, 60, .06);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f1320; --panel: #171c2c; --ink: #e9edf5; --muted: #a8b1c4; --line: #2d3550; --accent: #9fb2ff; --accent-ink: #0d1430; --soft: #1f2740;
  --screen: #0a0e1f; --screen2: #121937; --screen-ink: #f3f0e4; --screen-dim: #a9b0cc; --frame: #8d7f57;
  --warm: #ff8a70; --warm-soft: #3d1f19; --warm-ink: #ffc2b3;
  --direct: #4fd0cc; --direct-soft: #12302f; --direct-ink: #a6eeea;
  --playful: #f2b84b; --playful-soft: #3a2b0d; --playful-ink: #ffdc94;
  --exit: #a3adbf; --exit-soft: #262c3a; --exit-ink: #d3d9e4;
  --wedge-off: #222a40; --wedge-off-ink: #6d7891;
  --say: #57d18f; --say-ink: #062514; --sharpen: #f2b84b; --sharpen-ink: #2b1a00; --shrink: #c3a6ff; --shrink-ink: #1c0e3d;
  --warn: #ffb38a; --warn-soft: #3a2116; --ok: #7fe0a8; --ok-soft: #14301f; --info-soft: #1d2540;
  --shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 6px 18px rgba(0, 0, 0, .3);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background-image: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--accent) 14%, transparent) 1px, transparent 1.5px); background-size: 22px 22px; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.small { font-size: .88rem; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .84rem; }
.note { background: var(--soft); border-left: 4px solid var(--accent); padding: 6px 10px; border-radius: 6px; }

/* Header */
.bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.back { text-decoration: none; font-weight: 700; color: var(--accent); white-space: nowrap; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; min-width: 0; }
.brand strong { white-space: nowrap; }
.logo { width: 30px; height: 30px; flex: none; }
.lg-tile { fill: var(--screen); } .lg-w1 { fill: #ff8a70; } .lg-w2 { fill: #4fd0cc; } .lg-w3 { fill: #a3adbf; } .lg-w4 { fill: #f2b84b; }
.session { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.pill { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 36px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel);
  color: var(--ink); font-weight: 600; font-size: .88rem; cursor: pointer; text-decoration: none; }
.pill:hover:not(:disabled) { border-color: var(--accent); }
.pill.solid { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.pill.ghost { background: transparent; cursor: default; }
.pill.big { min-height: 46px; padding: 10px 22px; font-size: 1rem; }
.pill.tiny { min-height: 30px; padding: 3px 10px; font-size: .8rem; }
.pill:disabled { opacity: .55; cursor: not-allowed; }

main { max-width: 1120px; margin: 0 auto; padding: 0 16px 30px; }
.hero { padding: 26px 0 8px; }
.kicker { margin: 0 0 8px; font-size: .9rem; color: var(--muted); max-width: 760px; }
h1 { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: clamp(2rem, 6vw, 3.1rem); line-height: 1.05; margin: 0 0 10px; color: var(--accent); letter-spacing: -.02em; overflow-wrap: anywhere; }
.h1b { display: block; font-size: clamp(1.05rem, 2.8vw, 1.4rem); color: var(--ink); font-family: system-ui, sans-serif; font-weight: 600; margin-top: 6px; letter-spacing: 0; }
.lede { max-width: 760px; margin: 0 0 12px; }
.samples { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip { border: 1px dashed var(--accent); background: var(--panel); color: var(--ink); border-radius: 999px; padding: 5px 12px; min-height: 34px; font-size: .86rem; cursor: pointer; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-style: solid; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 14px 0; box-shadow: var(--shadow); }
.ph { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 1.2rem; overflow-wrap: anywhere; }
.step-no { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--screen); color: var(--screen-ink); font: 700 .95rem ui-monospace, Menlo, monospace; flex: none; box-shadow: inset 0 0 0 2px var(--frame); }
.mini-h { font-size: .95rem; margin: 14px 0 6px; }
.lbl { display: block; font-size: .82rem; font-weight: 600; color: var(--muted); margin-bottom: 3px; }
input[type=text], select, textarea { width: 100%; min-height: 40px; padding: 7px 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg); }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.span2 { grid-column: 1 / -1; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; min-height: 40px; }
.seg-b { flex: 1; border: 0; background: var(--bg); cursor: pointer; font-weight: 600; font-size: .88rem; padding: 6px 4px; }
.seg-b + .seg-b { border-left: 1px solid var(--line); }
.seg-b.on { background: var(--accent); color: var(--accent-ink); }

/* The page's read */
.readrow { display: flex; gap: 12px; align-items: flex-start; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.readrow p { margin: 0 0 6px; }
.badge { display: inline-flex; align-items: center; white-space: nowrap; padding: 4px 12px; border-radius: 6px; font: 700 .82rem ui-monospace, Menlo, monospace; text-transform: uppercase; letter-spacing: .04em;
  background: var(--exit-soft); color: var(--exit-ink); flex: none; }
.badge.v-say_it { background: var(--say); color: var(--say-ink); }
.badge.v-sharpen { background: var(--sharpen); color: var(--sharpen-ink); }
.badge.v-shrink { background: var(--shrink); color: var(--shrink-ink); }
.signals { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.sig { font-size: .82rem; padding: 2px 9px; border-radius: 999px; background: var(--soft); }
.sig-k { font-weight: 700; text-transform: uppercase; font-size: .7rem; letter-spacing: .05em; }
.sig.sg-vague { background: var(--playful-soft); color: var(--playful-ink); }
.sig.sg-big { background: var(--warm-soft); color: var(--warm-ink); }
.sig.none { color: var(--muted); }

/* The stage: the dialogue box, the wheel, the choices */
.stage { background: var(--soft); border-radius: 14px; padding: 14px; }
.dbox { position: relative; background: linear-gradient(180deg, var(--screen2), var(--screen)); color: var(--screen-ink); border-radius: 10px; padding: 22px 16px 14px; min-height: 96px;
  box-shadow: inset 0 0 0 2px var(--frame), inset 0 0 0 5px var(--screen), inset 0 0 0 6px var(--frame); }
.speaker { position: absolute; top: -12px; left: 14px; padding: 2px 12px; border-radius: 6px; font: 700 .78rem ui-monospace, Menlo, monospace; letter-spacing: .08em; text-transform: uppercase;
  background: var(--frame); color: #1a1406; }
.speaker.sp-them { background: #e6d7a8; }
.speaker.sp-end { background: #c8d3f0; }
.dline { margin: 0; font: 1.02rem/1.55 ui-monospace, Menlo, Consolas, monospace; min-height: 3.1em; overflow-wrap: anywhere; }
.dread { display: inline-block; margin-top: 8px; padding: 2px 9px; border-radius: 999px; font-size: .74rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: #ff8a70; color: #2a0a03; }
.pickrow { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 16px; align-items: center; margin-top: 14px; }
.wheel-host { width: 100%; max-width: 230px; margin: 0 auto; }
.wheel { width: 100%; height: auto; display: block; }
.wh-rim { fill: var(--panel); stroke: var(--line); stroke-width: 2; }
.wh-wedge { stroke: var(--panel); stroke-width: 3; transition: opacity .15s; }
.wh-slot.on { cursor: pointer; }
.wh-slot.off .wh-wedge { fill: var(--wedge-off); }
.wh-slot.on .wf-warm, .wf-warm { fill: var(--warm); } .wh-slot.on .wf-direct, .wf-direct { fill: var(--direct); }
.wh-slot.on .wf-playful, .wf-playful { fill: var(--playful); } .wh-slot.on .wf-exit, .wf-exit { fill: var(--exit); }
.wh-slot.off .wh-wedge { fill: var(--wedge-off); }
.wh-slot.on:hover .wh-wedge { opacity: .85; }
.wh-label { font: 700 13px ui-monospace, Menlo, monospace; }
.wh-num { font: 700 15px ui-monospace, Menlo, monospace; }
.wh-slot.on .wh-label, .wh-slot.on .wh-num { fill: #ffffff; }
:root[data-theme="dark"] .wh-slot.on .wh-label, :root[data-theme="dark"] .wh-slot.on .wh-num { fill: #0d1220; }
.wh-slot.off .wh-label, .wh-slot.off .wh-num { fill: var(--wedge-off-ink); }
.wh-hub { fill: var(--screen); stroke: var(--frame); stroke-width: 3; }
.wh-hubt { fill: var(--screen-ink); font: 700 13px ui-monospace, Menlo, monospace; text-transform: uppercase; letter-spacing: .06em; }
.choices { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.choice { width: 100%; display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 8px; align-items: baseline; text-align: left; padding: 10px 12px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); border-left: 6px solid var(--exit); background: var(--panel); color: var(--ink); }
.choice:hover { background: var(--bg); }
.c-key { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: var(--screen); color: var(--screen-ink); font-size: .78rem; }
.c-tone { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
.c-say { overflow-wrap: anywhere; }
.choice.mine { box-shadow: inset 0 0 0 2px var(--accent); }
.c-mine { grid-column: 3; font-size: .72rem; }
.ct-warm { border-left-color: var(--warm); } .ct-warm .c-tone { color: var(--warm-ink); }
.ct-direct { border-left-color: var(--direct); } .ct-direct .c-tone { color: var(--direct-ink); }
.ct-playful { border-left-color: var(--playful); } .ct-playful .c-tone { color: var(--playful-ink); }
.ct-exit { border-left-color: var(--exit); } .ct-exit .c-tone { color: var(--exit-ink); }
.endbox { margin-top: 12px; padding: 12px 14px; border-radius: 10px; background: var(--panel); border: 2px solid var(--line); display: grid; gap: 2px; }
.endbox b { font-size: 1.05rem; }
.endbox p { margin: 0; }
.end-kind { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.ek-yes { border-color: var(--say); } .ek-yes .end-kind { color: var(--ok); }
.ek-partial { border-color: var(--playful); } .ek-partial .end-kind { color: var(--playful-ink); }
.ek-no { border-color: var(--exit); } .ek-no .end-kind { color: var(--exit-ink); }
.stagebtns { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.stagebtns .mono { margin-left: auto; }
.beads { display: flex; align-items: center; flex-wrap: wrap; gap: 0; margin-top: 10px; min-height: 28px; }
.bead { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font: 700 .72rem ui-monospace, Menlo, monospace; color: #fff; background: var(--exit); }
:root[data-theme="dark"] .bead { color: #0d1220; }
.bd-warm { background: var(--warm); } .bd-direct { background: var(--direct); } .bd-playful { background: var(--playful); } .bd-exit { background: var(--exit); }
.bead-link { width: 14px; height: 3px; background: var(--line); }
.gallery { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.end-card { border-radius: 12px; padding: 10px 12px; display: grid; gap: 3px; border: 2px solid var(--line); background: var(--panel); min-height: 96px; }
.end-card.sealed { border-style: dashed; background: repeating-linear-gradient(135deg, var(--bg) 0 8px, var(--panel) 8px 16px); }
.end-card.sealed .end-title { color: var(--muted); }
.end-title { font-size: .98rem; }
.end-line { color: var(--muted); }
.end-card.got.ek-yes { background: var(--ok-soft); } .end-card.got.ek-partial { background: var(--playful-soft); } .end-card.got.ek-no { background: var(--exit-soft); }

/* Ask, progress, result */
.runrow { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.gate { background: var(--warn-soft); border-radius: 8px; padding: 8px 10px; }
.progress h3 { margin: 0 0 8px; }
.steps { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 4px; }
.step { color: var(--muted); } .step.active { color: var(--ink); font-weight: 700; } .step.done { color: var(--ok); }
.step-ic { display: inline-block; width: 1.2em; font-family: ui-monospace, monospace; }
.raw { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 360px; overflow: auto; background: var(--bg); padding: 10px; border-radius: 8px; font-size: .8rem; }
.res-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.res-head h2 { margin: 0; font-size: 1.3rem; overflow-wrap: anywhere; }
.askcard { margin: 12px 0; padding: 14px; border-radius: 12px; background: var(--screen); color: var(--screen-ink); box-shadow: inset 0 0 0 2px var(--frame); }
.askcard-k { font: 700 .74rem ui-monospace, Menlo, monospace; text-transform: uppercase; letter-spacing: .08em; color: #e6d7a8; }
.askcard-t { font: 1.08rem/1.5 ui-monospace, Menlo, Consolas, monospace; margin: 6px 0 10px; overflow-wrap: anywhere; }
.askcard .pill { background: transparent; color: var(--screen-ink); border-color: var(--frame); }
.cardrow { display: flex; gap: 8px; flex-wrap: wrap; }
.tips { margin: 0; padding-left: 1.3em; display: grid; gap: 4px; }
.recon { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.recon li { padding: 6px 10px; border-radius: 8px; background: var(--info-soft); font-size: .9rem; }
.recon li.warn { background: var(--warn-soft); color: var(--warn); }
.recon li.ok { background: var(--ok-soft); color: var(--ok); }
.recon li.none, .tips li.none { background: transparent; color: var(--muted); list-style: none; }
.exports { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.none { color: var(--muted); }

/* History */
.saved { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.hrow { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
.hmark { width: 28px; height: 28px; flex: none; }
.hm-off { fill: var(--wedge-off); }
.hinfo { display: grid; min-width: 0; flex: 1; }
.hinfo b { overflow-wrap: anywhere; }
.hbtns { display: flex; gap: 6px; flex: none; }

/* Footer and toasts */
.foot { max-width: 1120px; margin: 0 auto; padding: 10px 16px 40px; color: var(--muted); font-size: .86rem; }
.toasts { position: fixed; right: 14px; bottom: 14px; display: grid; gap: 8px; z-index: 50; max-width: min(380px, calc(100vw - 28px)); }
.toast { padding: 10px 14px; border-radius: 10px; background: var(--screen); color: var(--screen-ink); box-shadow: var(--shadow); font-size: .9rem; transition: opacity .5s; }
.toast.err { background: #8a1f11; color: #fff; }
.toast a { color: #ffd88a; }
.toast.gone { opacity: 0; }

@media (max-width: 760px) {
  .grid2, .two { grid-template-columns: 1fr; }
  .pickrow { grid-template-columns: 1fr; }
  .wheel-host { max-width: 190px; }
  .stagebtns .mono { margin-left: 0; width: 100%; }
  .readrow { flex-direction: column; gap: 8px; }
}
@media (max-width: 480px) {
  .bar { padding: 8px 12px; gap: 6px; }
  .back-t { display: none; }
  .brand { font-size: .98rem; }
  .pill { padding: 5px 10px; }
  main { padding: 0 12px 24px; }
  .panel { padding: 12px; }
  .stage { padding: 10px; }
  .hrow { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
