/* Pocket Mascots - toy-shop cream, plum ink and tomato red in light mode; a plum-black shelf at night. The figure box
 * and the figures keep their own printed colours in both themes. */
:root { --bg: #fff6ea; --panel: #fffdf8; --ink: #2a2230; --muted: #5d5262; --line: #ead9c3; --acc: #b8361f; --acc-ink: #ffffff; --acc-soft: #fde4dc;
  --butter: #f6c945; --butter-soft: #fff1c2; --shadow: #2a2230; --free-bg: #dff1e6; --free-ink: #1d5432;
  --warn-bg: #fbe3dc; --warn-ink: #7a1d10; --info-bg: #ece6f4; --info-ink: #3b2f63;
  --v-ok: #dff1e6; --v-ok-ink: #1d5432; --v-declined: #f1e4f1; --v-declined-ink: #5b245c;
  --t-rare: #b8361f; --t-rare-ink: #ffffff; --t-pick: #2a2230; --t-pick-ink: #fff4dc; color-scheme: light; }
:root[data-theme="dark"] { --bg: #17131d; --panel: #221c2a; --ink: #f4ece0; --muted: #c4b8c6; --line: #3e3448; --acc: #ff9478; --acc-ink: #1d0f0b; --acc-soft: #3f231e;
  --butter: #f6c945; --butter-soft: #3a3016; --shadow: #000000; --free-bg: #1c3a27; --free-ink: #b9f0cb;
  --warn-bg: #44201a; --warn-ink: #ffc8bc; --info-bg: #2b2440; --info-ink: #d9cff8;
  --v-ok: #1c3a27; --v-ok-ink: #b9f0cb; --v-declined: #3a2140; --v-declined-ink: #f2cdf3;
  --t-rare: #ff9478; --t-rare-ink: #1d0f0b; --t-pick: #f4ece0; --t-pick-ink: #221c2a; color-scheme: dark; }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.55 ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow-x: hidden; }
a { color: var(--acc); }
h1, h2, h3, h4 { line-height: 1.2; overflow-wrap: anywhere; font-weight: 800; }
.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: 0.88rem; } .muted { color: var(--muted); } .mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.center { text-align: center; justify-content: center; }
.none { color: var(--muted); font-style: italic; }

/* Header */
.bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--panel); border-bottom: 3px solid var(--ink); flex-wrap: wrap; }
.back { text-decoration: none; font-weight: 700; white-space: nowrap; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 1.08rem; min-width: 0; }
.brand strong { white-space: nowrap; font-weight: 800; }
.logo { width: 28px; height: 28px; flex: none; }
.lg-box { fill: #fff1b8; stroke: #2a2230; stroke-width: 1.6; } .lg-fig { fill: #e5533d; } .lg-eye { fill: #2a2230; } .lg-mouth { fill: none; stroke: #2a2230; stroke-width: 1.2; stroke-linecap: round; }
.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; min-height: 36px; padding: 6px 14px; border-radius: 12px; border: 2px solid var(--ink); background: var(--panel); color: var(--ink); font: 700 0.9rem/1 inherit; font-family: inherit; cursor: pointer; text-decoration: none; white-space: nowrap; box-shadow: 0 2px 0 var(--shadow); }
.pill:hover:not(:disabled) { background: var(--butter-soft); }
.pill:active:not(:disabled) { transform: translateY(1px); box-shadow: 0 1px 0 var(--shadow); }
.pill.solid { background: var(--acc); color: var(--acc-ink); border-color: var(--acc); }
.pill.solid:hover:not(:disabled) { filter: brightness(1.06); background: var(--acc); }
.pill.ghost { border-color: var(--line); cursor: default; box-shadow: none; }
.pill.tiny { min-height: 30px; padding: 4px 10px; font-size: 0.8rem; border-radius: 10px; }
.pill.big { min-height: 48px; padding: 10px 22px; font-size: 1.02rem; border-radius: 14px; }
.pill:disabled { opacity: 0.5; cursor: not-allowed; }
.pill:focus-visible, .chip:focus-visible, .tile:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid var(--butter); outline-offset: 2px; }

main { max-width: 1020px; margin: 0 auto; padding: 0 16px 40px; }
.hero { padding: 26px 0 8px; }
.kicker { display: inline-block; margin: 0 0 12px; padding: 6px 12px; border: 2px dashed var(--ink); background: var(--butter-soft); color: var(--ink); font-size: 0.88rem; border-radius: 12px; }
.hero h1 { font-size: clamp(2.1rem, 8vw, 3.3rem); margin: 6px 0 10px; letter-spacing: -0.01em; }
.h1b { display: block; font-size: clamp(1.02rem, 3.6vw, 1.32rem); font-weight: 600; color: var(--muted); margin-top: 6px; letter-spacing: 0; }
.lede { max-width: 68ch; font-size: 1.04rem; }
.samples { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.chip { min-height: 36px; padding: 6px 14px; border-radius: 999px; border: 2px solid var(--line); background: var(--panel); color: var(--ink); font: 700 0.88rem inherit; font-family: inherit; cursor: pointer; }
.chip.on { border-color: var(--ink); background: var(--butter-soft); }

.panel { background: var(--panel); border: 2px solid var(--ink); border-radius: 18px; padding: 16px 18px; margin: 18px 0; box-shadow: 0 4px 0 var(--shadow); }
.ph { margin: 0 0 10px; font-size: 1.32rem; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.step-no { display: inline-flex; width: 32px; height: 32px; border-radius: 10px; align-items: center; justify-content: center; background: var(--butter); color: #2a2230; border: 2px solid var(--ink); font-weight: 800; font-size: 0.98rem; flex: none; }
.free { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; background: var(--free-bg); color: var(--free-ink); }
.lbl { display: block; font-weight: 700; margin: 12px 0 4px; }
.lbl .muted { font-weight: 500; font-size: 0.86rem; }
.count { font-weight: 700; font-size: 0.82rem; color: var(--acc); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.two.tight { gap: 0 10px; }
input[type=text], textarea, select { width: 100%; padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink); font: 1rem/1.45 inherit; font-family: inherit; }
select { min-height: 44px; }
textarea { resize: vertical; min-height: 110px; }
textarea.drop { border-color: var(--acc); border-style: dashed; }
.filerow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 34px; }
.note { margin: 10px 0 0; padding: 8px 12px; background: var(--warn-bg); color: var(--warn-ink); border-radius: 10px; }
.sub { font-size: 1.06rem; margin: 18px 0 8px; }

/* The figure box and the editor */
.boxgrid { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 22px; align-items: start; }
.boxwrap { max-width: 340px; margin: 0 auto; }
.boxwrap svg.box { display: block; width: 100%; height: auto; font-family: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", Arial, sans-serif; filter: drop-shadow(0 6px 0 rgba(42, 34, 48, 0.22)); }
.boxcol .cardrow { margin-top: 6px; }
:root[data-theme="dark"] .boxwrap { background: #4a3f2a; border-radius: 28px; padding: 10px; }
:root[data-theme="dark"] .tile svg.mini { box-shadow: 0 0 0 2px #4a3f2a; }
.edgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 10px; }
.edgrid .lbl { margin-top: 8px; font-size: 0.86rem; }
.edgrid select, .edgrid input[type=text] { padding: 8px 10px; min-height: 40px; font-size: 0.94rem; }
.cardrow { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.freelist { margin: 0; padding-left: 20px; }
.freelist li { margin: 4px 0; }

/* Ask */
.runrow { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 10px; }
.gate { margin: 12px 0 0; padding: 10px 12px; background: var(--info-bg); color: var(--info-ink); border-radius: 10px; }
.gate .pill { margin-left: 4px; }
.progress h3 { margin: 0 0 8px; }
.steps { list-style: none; padding: 0; margin: 0; }
.step { padding: 3px 0; color: var(--muted); }
.step.done { color: var(--ink); } .step.active { color: var(--acc); font-weight: 700; }
.step-ic { display: inline-block; width: 1.2em; font-family: ui-monospace, Menlo, monospace; }
.raw { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bg); padding: 10px; border-radius: 10px; max-height: 320px; overflow: auto; font-size: 0.82rem; }

/* The series */
.res-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.res-kick { margin: 0; color: var(--muted); font-weight: 600; }
.badge { display: inline-flex; padding: 6px 12px; border-radius: 10px; border: 2px solid var(--ink); font-weight: 800; font-size: 0.86rem; letter-spacing: 0.06em; background: var(--bg); color: var(--ink); }
.badge.v-ok { background: var(--v-ok); color: var(--v-ok-ink); }
.badge.v-declined { background: var(--v-declined); color: var(--v-declined-ink); }
.series { font-size: 1.6rem; margin: 10px 0 6px; }
.reason { font-size: 1.04rem; padding: 10px 12px; background: var(--v-declined); color: var(--v-declined-ink); border-radius: 12px; }
.dirs { list-style: none; padding: 0; margin: 10px 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.dirs li.none { grid-column: 1 / -1; }
.dir { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 2px solid var(--line); border-radius: 14px; background: var(--bg); }
.dl { flex: none; display: inline-flex; width: 30px; height: 30px; border-radius: 50%; align-items: center; justify-content: center; background: var(--ink); color: var(--panel); font-weight: 800; }
.dt { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.grid6 { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.grid6 li.none { grid-column: 1 / -1; }
.tile { width: 100%; display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 6px; border: 2px solid var(--line); border-radius: 14px; background: var(--bg); color: var(--ink); cursor: pointer; font-family: inherit; text-align: left; }
.tile:hover { border-color: var(--muted); }
.tile.sel { border-color: var(--ink); box-shadow: 0 3px 0 var(--shadow); background: var(--butter-soft); }
.tile svg.mini { display: block; width: 100%; height: auto; border-radius: 10px; }
.tcap { display: flex; flex-direction: column; min-width: 0; }
.tno { font-size: 0.74rem; color: var(--muted); font-weight: 700; }
.tname { font-size: 0.92rem; overflow-wrap: anywhere; line-height: 1.2; }
.ttags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; min-height: 0; }
.tag { font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; padding: 2px 6px; border-radius: 6px; }
.t-rare { background: var(--t-rare); color: var(--t-rare-ink); }
.t-pick { background: var(--t-pick); color: var(--t-pick-ink); }
.figcard { margin: 14px 0 0; padding: 12px 14px; border: 2px dashed var(--line); border-radius: 14px; }
.figcard h4 { margin: 2px 0 6px; font-size: 1.24rem; }
.figcard p { margin: 4px 0; }
.qlabel { font-weight: 700; color: var(--muted); }
.says { font-weight: 700; font-size: 1.04rem; }
.pick { margin: 14px 0 0; padding: 10px 12px; background: var(--butter-soft); color: var(--ink); border-radius: 12px; font-weight: 600; }
.closing { font-style: italic; }
.recon { margin: 6px 0; padding-left: 0; list-style: none; }
.recon li { margin: 4px 0; padding: 6px 10px; border-radius: 8px; background: var(--free-bg); color: var(--free-ink); }
.recon li.warn { background: var(--warn-bg); color: var(--warn-ink); }
.recon li.info { background: var(--info-bg); color: var(--info-ink); }
.recon li.none { font-style: normal; }
.exports { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.result.empty .exports, .result.empty #rFig { display: none; }

/* Saved */
.saved { list-style: none; padding: 0; margin: 12px 0 0; }
.hrow { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.hrow.none { color: var(--muted); font-style: italic; }
.hdot { width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--line); border: 2px solid var(--ink); }
.hdot.v-ok { background: #7fd1ae; } .hdot.v-declined { background: #f48fb1; }
.hinfo { display: flex; flex-direction: column; min-width: 0; flex: 1; overflow-wrap: anywhere; }
.hbtns { display: flex; gap: 6px; flex: none; }

.foot { max-width: 1020px; margin: 0 auto; padding: 8px 16px 40px; color: var(--muted); font-size: 0.86rem; }
.foot p { color: var(--muted); }
.toasts { position: fixed; right: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 8px; z-index: 20; max-width: min(380px, calc(100vw - 24px)); }
.toast { padding: 10px 14px; border-radius: 12px; border: 2px solid var(--ink); box-shadow: 0 3px 0 var(--shadow); transition: opacity .5s; }
.toast.ok { background: var(--free-bg); color: var(--free-ink); }
.toast.err { background: var(--warn-bg); color: var(--warn-ink); }
.toast a { color: inherit; font-weight: 700; }
.toast.gone { opacity: 0; }

@media (max-width: 860px) {
  .grid6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .boxgrid { grid-template-columns: minmax(0, 1fr); }
  .dirs { grid-template-columns: minmax(0, 1fr); }
  .two { grid-template-columns: minmax(0, 1fr); }
  .filerow { margin-top: 12px; }
  .edgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 460px) {
  .bar { padding: 6px 10px; gap: 6px; }
  .back-t { display: none; }
  .brand { font-size: 1rem; }
  .pill { padding: 6px 10px; }
  .panel { padding: 14px 12px; border-radius: 16px; }
  .grid6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media print {
  .bar, .samples, .askbox, .histbox, .aboutbox, .exports, .cardrow, .edcol, .toasts, #progressPanel { display: none !important; }
  .panel { box-shadow: none; }
}
