/* Mirror Reps - a magician's practice table: oxblood velvet, brass padlocks on a chain, a green close-up mat. */
:root {
  --bg: #f4eee3; --paper: #fffaf1; --felt: #e5efe7; --ink: #26181a; --muted: #6a5a55; --line: #dccfbb; --chip: #efe4d2;
  --velvet: #7c1f2c; --velvet-ink: #fff6ee; --velvet-soft: #f6e1e0; --brass: #7f5e19; --brass-hi: #d2ad5c; --brass-lo: #6f5218;
  --steel: #6d6a6f; --safe: #2f6b4f; --safe-bg: #dcefe3; --med: #9a5a06; --med-bg: #fbead2; --high: #a8231c; --high-bg: #f9dcd8;
  --good: #23704a; --good-bg: #dff1e6; --warn: #924606; --warn-bg: #fbe9d4; --info: #3d4f73; --info-bg: #e6ebf4;
  --shadow: 0 1px 2px rgba(38,24,26,.08), 0 4px 14px rgba(38,24,26,.07);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #140e0f; --paper: #1e1617; --felt: #16231c; --ink: #f2e7da; --muted: #b9a79c; --line: #3a2c2b; --chip: #2a1f1f;
  --velvet: #e48a93; --velvet-ink: #1d0d10; --velvet-soft: #3b1d21; --brass: #e0bd70; --brass-hi: #f3d896; --brass-lo: #9c7a32;
  --steel: #a9a3aa; --safe: #7fd0a5; --safe-bg: #17301f; --med: #f2b46a; --med-bg: #3a2914; --high: #ff978c; --high-bg: #3d1a17;
  --good: #82d7a6; --good-bg: #173326; --warn: #ffbb73; --warn-bg: #3a2814; --info: #b3c3e6; --info-bg: #1e2638;
  --shadow: 0 1px 2px rgba(0,0,0,.45), 0 6px 18px rgba(0,0,0,.35);
  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(--velvet); }
.hidden { display: none !important; }
.visually-hidden { position: absolute !important; 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: var(--mono); }
.note { color: var(--warn); background: var(--warn-bg); border-radius: 8px; padding: 6px 10px; }

/* Header */
.bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 3px double var(--brass); background: var(--paper); flex-wrap: wrap; }
.back { text-decoration: none; font-size: .9rem; color: var(--muted); }
.brand { display: flex; align-items: center; gap: 8px; font: 600 1.15rem var(--serif); margin-right: auto; letter-spacing: .02em; }
.logo { width: 30px; height: 30px; }
.lg-mirror { fill: var(--felt); stroke: var(--brass); stroke-width: 2; }
.lg-shine { fill: none; stroke: var(--paper); stroke-width: 1.6; stroke-linecap: round; }
.lg-lock { fill: var(--brass); }
.lg-shackle { fill: none; stroke: var(--steel); stroke-width: 2; }
.session { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pill { font: inherit; font-size: .875rem; border: 1px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 999px; padding: 6px 14px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.pill:hover { border-color: var(--velvet); }
.pill.solid { background: var(--velvet); color: var(--velvet-ink); border-color: var(--velvet); }
.pill.ghost { cursor: default; background: transparent; }
.pill.big { font-size: 1rem; padding: 10px 20px; font-weight: 600; }
.pill.tiny { font-size: .8rem; padding: 3px 10px; }
.pill:disabled { opacity: .5; cursor: not-allowed; }

/* Layout */
main { max-width: 1180px; margin: 0 auto; padding: 0 16px 40px; }
.hero { padding: 28px 0 8px; max-width: 880px; }
.kicker { font-size: .9rem; color: var(--muted); margin: 0 0 8px; font-style: italic; }
h1 { font: 600 clamp(1.7rem, 4.6vw, 2.6rem)/1.12 var(--serif); margin: 0 0 10px; letter-spacing: -.005em; overflow-wrap: break-word; text-wrap: balance; }
.lede { font-size: 1.05rem; margin: 0 0 14px; }
.lanes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0 10px; }
.lane { font: inherit; text-align: left; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink); padding: 10px 14px; cursor: pointer; display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; font-weight: 600; }
.lane .lane-no { grid-row: span 2; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--brass); color: var(--brass); font-weight: 700; }
.lane .lane-sub { font-weight: 400; font-size: .82rem; color: var(--muted); }
.lane.on { border-color: var(--velvet); box-shadow: inset 0 0 0 1px var(--velvet); background: var(--velvet-soft); }
.lane.on .lane-no { background: var(--velvet); border-color: var(--velvet); color: var(--velvet-ink); }
.samples { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chipset { display: contents; }
.chip { font: inherit; font-size: .875rem; border: 1px dashed var(--line); background: var(--chip); color: var(--ink); border-radius: 8px; padding: 5px 12px; cursor: pointer; }
.chip.on { border-style: solid; border-color: var(--velvet); box-shadow: inset 0 0 0 1px var(--velvet); }
.layout { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: 16px; margin-top: 16px; align-items: start; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-top: 16px; box-shadow: var(--shadow); min-width: 0; }
.layout .panel { margin-top: 0; }
.ph { font: 600 1.15rem var(--serif); margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.step-no { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--brass); color: var(--brass); font: 700 .85rem system-ui, sans-serif; flex: none; }
h3 { font-size: 1rem; margin: 18px 0 8px; }
.lbl { display: block; font-size: .85rem; font-weight: 600; margin: 10px 0 4px; }
input[type=text], input[type=number], select, textarea { width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
textarea { resize: vertical; }
#steps { line-height: 1.6; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--velvet); outline-offset: 2px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.three { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 10px; }
.fmt { margin: 6px 0; }
.drop { border: 1px dashed var(--line); border-radius: 8px; padding: 8px 10px; margin-top: 8px; }
.drop.over { border-color: var(--velvet); background: var(--velvet-soft); }
.filelbl { color: var(--velvet); text-decoration: underline; cursor: pointer; }

/* What the page sees: sorted steps, the time gauge, the sightline fan */
.stepread { list-style: none; margin: 0; padding: 0; counter-reset: st; }
.sr { counter-increment: st; display: grid; grid-template-columns: 26px auto 1fr; gap: 4px 8px; align-items: baseline; padding: 6px 0; border-bottom: 1px dotted var(--line); }
.sr::before { content: counter(st); font: 700 .8rem var(--mono); color: var(--muted); text-align: right; }
.sr-text { overflow-wrap: anywhere; font-size: .92rem; }
.kchip { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; border-radius: 6px; padding: 1px 7px; white-space: nowrap; border: 1px solid transparent; }
.kchip.k-sleight { background: var(--velvet); color: var(--velvet-ink); }
.kchip.k-setup { background: var(--chip); color: var(--muted); border-color: var(--line); }
.kchip.k-handling { background: var(--info-bg); color: var(--info); }
.kchip.k-patter { background: var(--med-bg); color: var(--med); }
.kchip.k-reveal { background: var(--safe-bg); color: var(--safe); }
.anglechip { grid-column: 3; justify-self: start; font-size: .72rem; font-weight: 700; color: var(--high); background: var(--high-bg); border-radius: 6px; padding: 1px 7px; }
.gauge { margin-top: 12px; }
.g-head { margin: 0 0 6px; }
.g-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 8px; align-items: center; margin: 4px 0; }
.g-track { height: 12px; border-radius: 6px; background: var(--chip); overflow: hidden; }
.g-bar { height: 100%; border-radius: 6px; }
.g-need { background: repeating-linear-gradient(45deg, var(--steel) 0 6px, transparent 6px 10px); opacity: .7; }
.g-have.fit-fits { background: var(--safe); } .g-have.fit-tight { background: var(--med); } .g-have.fit-short { background: var(--high); }
.fanwrap { margin-top: 12px; }
.fan-host svg { width: 100%; max-width: 360px; height: auto; display: block; margin: 0 auto; }
.fan-safe { fill: var(--safe-bg); stroke: none; }
.fan-risk { stroke: none; opacity: .9; }
.fan-risk.r-low { fill: var(--safe-bg); } .fan-risk.r-medium { fill: var(--med-bg); } .fan-risk.r-high { fill: var(--high-bg); }
.fan-edge { stroke: var(--line); stroke-width: 1.5; stroke-dasharray: 4 4; }
.fan-table { fill: var(--brass-lo); opacity: .35; }
.fan-mat { fill: var(--safe); opacity: .55; }
.fan-you { fill: var(--velvet); }
.fan-seat { fill: var(--paper); stroke: var(--ink); stroke-width: 2; }
.fan-seat.exposed { stroke: var(--high); fill: var(--high-bg); }
.fan-lbl { font: 600 12px system-ui, sans-serif; fill: var(--muted); }

/* The padlock chain */
.chain { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px 18px; }
.link { position: relative; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 12px; }
.link + .link::before { content: ""; position: absolute; left: -19px; top: 34px; width: 20px; height: 10px; border: 3px solid var(--steel); border-radius: 8px; box-sizing: border-box; }
.link.is-next { border-color: var(--velvet); box-shadow: inset 0 0 0 1px var(--velvet); }
.link.is-open { background: var(--safe-bg); }
.lockbtn { border: 0; background: none; padding: 0; cursor: pointer; border-radius: 10px; }
.padlock { width: 48px; height: 56px; display: block; }
.shackle { fill: none; stroke: var(--steel); stroke-width: 5; stroke-linecap: round; }
.lbody { fill: var(--brass); stroke: var(--brass-lo); stroke-width: 1.5; }
.lrivet { fill: var(--brass-hi); }
.lhole { fill: var(--brass-lo); }
.lmark { fill: none; stroke: var(--paper); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.lnum { font: 700 10px system-ui, sans-serif; fill: var(--muted); }
.padlock.open .lbody { fill: var(--safe); stroke: var(--safe); }
.tag { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tag-k { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.tag-name { font: 600 1rem var(--serif); overflow-wrap: anywhere; }
.tag-steps { color: var(--muted); }
.tag-drill, .tag-pass { overflow-wrap: anywhere; }
.upnext { align-self: start; font-size: .72rem; font-weight: 700; color: var(--velvet-ink); background: var(--velvet); border-radius: 6px; padding: 1px 8px; }
.chain.draft .link { border-style: dashed; }
.chain-empty { margin: 0; }

/* Ask, progress */
.runrow { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 10px; }
.gate { margin: 10px 0 0; }
.cues { color: var(--muted); }
.progress h3 { margin-top: 0; }
.steps { list-style: none; padding: 0; margin: 0; }
.step { padding: 3px 0; color: var(--muted); }
.step.done { color: var(--good); } .step.active { color: var(--ink); font-weight: 600; }
.step-ic { display: inline-block; width: 1.2em; font-family: var(--mono); }
.raw { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 360px; overflow: auto; font-size: .8rem; background: var(--bg); padding: 10px; border-radius: 8px; }

/* Results */
.res-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.res-head h2 { font: 600 1.35rem/1.2 var(--serif); margin: 0; overflow-wrap: break-word; min-width: 0; flex: 1 1 260px; }
.badge { display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; border-radius: 8px; padding: 4px 10px; border: 1px solid transparent; }
.badge.v-ready_in_time, .badge.v-perform_again { background: var(--safe-bg); color: var(--safe); border-color: var(--safe); }
.badge.v-tight, .badge.v-drop_back { background: var(--med-bg); color: var(--med); border-color: var(--med); }
.badge.v-swap_trick, .badge.v-rebuild { background: var(--high-bg); color: var(--high); border-color: var(--high); }
.badge.v-none { background: var(--chip); color: var(--muted); }
.summary { font-size: 1.02rem; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: 6px 0; border-bottom: 1px dotted var(--line); overflow-wrap: anywhere; }
.risk { font-size: .72rem; font-weight: 700; text-transform: uppercase; border-radius: 6px; padding: 1px 7px; margin-right: 4px; }
.risk.r-low { background: var(--safe-bg); color: var(--safe); } .risk.r-medium { background: var(--med-bg); color: var(--med); } .risk.r-high { background: var(--high-bg); color: var(--high); }
q.say { font-style: italic; }
.days { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.day { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 2px 10px; padding: 6px 10px; border-left: 4px solid var(--brass); background: var(--bg); border-radius: 0 8px 8px 0; }
.day-k { font-weight: 700; grid-row: span 2; }
.day-f { color: var(--muted); }
.swapbox { margin-top: 14px; border: 1px solid var(--high); border-radius: 10px; padding: 4px 14px; background: var(--high-bg); }
.finds { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.find { border: 1px solid var(--line); border-left: 5px solid var(--steel); border-radius: 0 10px 10px 0; padding: 8px 12px; background: var(--bg); }
.find.f-caught { border-left-color: var(--high); } .find.f-flash, .find.f-fumble { border-left-color: var(--med); } .find.f-praise, .find.f-reaction { border-left-color: var(--safe); }
.fkind { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-right: 6px; }
.fkind.f-caught { color: var(--high); } .fkind.f-flash, .fkind.f-fumble { color: var(--med); } .fkind.f-praise, .fkind.f-reaction { color: var(--safe); } .fkind.f-pace, .fkind.f-patter { color: var(--info); }
.fquote { font-style: italic; overflow-wrap: anywhere; }
.fref { display: block; }
.fmean { margin: 4px 0 0; }
.backto { margin: 12px 0 0; padding: 8px 12px; border-radius: 8px; background: var(--chip); }
.backto.on { background: var(--velvet-soft); border: 1px solid var(--velvet); }
.nextrun { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 0; }
.nextrun dt { font-weight: 700; } .nextrun dd { margin: 0; overflow-wrap: anywhere; }
.recon { padding-left: 18px; margin: 0; }
.recon li { margin: 3px 0; } .recon li.warn { color: var(--warn); } .recon li.ok { color: var(--good); } .recon li.info { color: var(--muted); }
.none { color: var(--muted); font-style: italic; list-style: none; }
.cardrow, .exports { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.exportbox .exports { margin-top: 0; }

/* Kept tricks */
.hist { list-style: none; padding: 0; margin: 12px 0 0; }
.hrow { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px dotted var(--line); flex-wrap: wrap; }
.hinfo { display: flex; flex-direction: column; flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; }

/* Footer, toasts */
.foot { max-width: 1180px; margin: 0 auto; padding: 16px 16px 40px; font-size: .85rem; color: var(--muted); border-top: 3px double var(--brass); }
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 30; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: var(--paper); border-radius: 10px; padding: 10px 14px; font-size: .9rem; box-shadow: var(--shadow); transition: opacity .4s; }
.toast.err { background: var(--high); color: #fff; }
:root[data-theme="dark"] .toast.err { color: #1d0d10; }
.toast a { color: inherit; font-weight: 700; }
.toast.gone { opacity: 0; }

@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .cols { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .lanes { grid-template-columns: minmax(0, 1fr); }
  .three { grid-template-columns: 1fr 1fr; }
  .three > div:last-child { grid-column: span 2; }
  .chain { grid-template-columns: minmax(0, 1fr); }
  .link { flex-direction: row; gap: 12px; }
  .padlock { width: 40px; height: 47px; }
  .link + .link::before { left: 26px; top: -17px; width: 10px; height: 20px; }
  .g-row { grid-template-columns: minmax(0, 1fr); }
}
@media print {
  .bar, .lanes, .samples, .askbox, .histbox, .exportbox, .toasts, .cardrow, .aboutbox { display: none !important; }
  body { background: #fff; } .panel { box-shadow: none; break-inside: avoid; }
}
