
:root {
  --counter: #c7cbc4;
  --counter-2: #b9bdb5;
  --paper: #fbfaf6;
  --paper-2: #f2f1ea;
  --ink: #1d1d1a;
  --ink-2: #57564f;
  --ink-3: #8a8980;
  --rule: #b7b5aa;
  --red: #b3261e;
  --red-bg: #f6e4e1;
  --key: #262927;
  --key-ink: #f3f2ec;
  --key-edge: #0f1110;
  --on-red: #ffffff;
  --shadow: 0 1px 0 rgba(0,0,0,.06), 0 10px 24px -14px rgba(0,0,0,.45);
  --sans: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --mono: ui-monospace, "D2Coding", "Consolas", "SF Mono", "Menlo", monospace;
  
  --px-bg: #f7f4ea; --px-line: #2b2621; --px-mid: #9a9284; --px-red: #d2493f; --px-shade: #e2dccd; --px-acc: #e8ae3c;
  --px-skin: #f9dcc0; --px-blush: #f3a39c; --px-wall: #fdfaf2; --px-glass: #e3e8e3; --px-hi: #ffffff; --px-night: 0;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --counter: #0d0e0e; --counter-2: #151716;
    --paper: #1b1c1a; --paper-2: #232421;
    --ink: #e8e6de; --ink-2: #aaa89f; --ink-3: #77766e;
    --rule: #45443e; --red: #ff7a6c; --red-bg: #3a1f1c;
    --key: #e8e6de; --key-ink: #141513; --key-edge: #8c8a82; --on-red: #1a0f0e;
    --shadow: 0 10px 24px -14px rgba(0,0,0,.9);
    --px-bg: #2b2f36; --px-line: #121211; --px-mid: #6f695f; --px-red: #e2574b; --px-shade: #3f3d39; --px-acc: #e8ae3c;
    --px-skin: #efcfae; --px-blush: #e88a82; --px-wall: #57534b; --px-glass: #f2d58e; --px-hi: #f4f0e4; --px-night: 1;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --counter: #0d0e0e; --counter-2: #151716;
  --paper: #1b1c1a; --paper-2: #232421;
  --ink: #e8e6de; --ink-2: #aaa89f; --ink-3: #77766e;
  --rule: #45443e; --red: #ff7a6c; --red-bg: #3a1f1c;
  --key: #e8e6de; --key-ink: #141513; --key-edge: #8c8a82; --on-red: #1a0f0e;
  --shadow: 0 10px 24px -14px rgba(0,0,0,.9);
  --px-bg: #2b2f36; --px-line: #121211; --px-mid: #6f695f; --px-red: #e2574b; --px-shade: #3f3d39; --px-acc: #e8ae3c;
  --px-skin: #efcfae; --px-blush: #e88a82; --px-wall: #57534b; --px-glass: #f2d58e; --px-hi: #f4f0e4; --px-night: 1;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--counter); color: var(--ink);
  font-family: var(--sans); font-size: 15px; line-height: 1.55;
  overflow-x: hidden; word-break: keep-all; overflow-wrap: anywhere;
}
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.mono, .ledger dd, output, .wk-num, .wk-of { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.counter { max-width: 1180px; margin: 0 auto; padding: 12px 16px 40px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0 14px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -0.02em; font-size: 18px; }
.brand-mark { font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .12em; padding: 3px 6px; border: 1.5px solid var(--ink); border-radius: 3px; }


.paper {
  position: relative; background: var(--paper); color: var(--ink);
  padding: 22px 22px 26px; margin: 14px 0 22px; box-shadow: var(--shadow);
}
.paper::before, .paper::after {
  content: ""; position: absolute; left: 0; right: 0; height: 10px;
  background: linear-gradient(135deg, var(--paper) 5px, transparent 0) 0 0 / 10px 10px repeat-x,
              linear-gradient(225deg, var(--paper) 5px, transparent 0) 0 0 / 10px 10px repeat-x;
}
.paper::before { top: -10px; transform: rotate(180deg); }
.paper::after { bottom: -10px; }
.paper-thin { padding: 14px 16px 16px; }

.r-head { border-bottom: 1px dashed var(--rule); padding-bottom: 14px; margin-bottom: 6px; }
.r-small { margin: 0 0 6px; font-family: var(--mono); font-size: 11.5px; letter-spacing: .06em; color: var(--ink-2); text-transform: uppercase; }
.r-title { margin: 4px 0 8px; font-size: 26px; line-height: 1.25; letter-spacing: -0.03em; font-weight: 800; }
.r-lead { margin: 0; color: var(--ink-2); max-width: 60ch; }
.r-note { margin: 6px 0 0; font-size: 13px; color: var(--ink-2); }
.r-sub { margin: 12px 0 6px; font-size: 13px; color: var(--ink-2); }
.r-warn { margin: 8px 0 0; padding: 6px 8px; font-size: 13px; color: var(--red); background: var(--red-bg); }
.rule-top { border-top: 1px dashed var(--rule); padding-top: 12px; margin-top: 10px; }

fieldset.r-block { border: 0; border-bottom: 1px dashed var(--rule); margin: 0; padding: 14px 0 16px; min-width: 0; }
fieldset.r-block legend { font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: .08em; padding: 0; margin-bottom: 8px; float: left; width: 100%; }
fieldset.r-block legend + * { clear: both; }


.opt-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; }
.opt {
  display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: 8px;
  padding: 7px 6px; border: 0; background: none; text-align: left; cursor: pointer; border-bottom: 1px dotted var(--rule);
}
.opt .o-name { font-weight: 700; }
.opt .o-lead { border-bottom: 1px dotted var(--ink-3); height: .7em; min-width: 12px; }
.opt .o-val { font-family: var(--mono); font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.opt .o-sub { grid-column: 1 / -1; font-size: 12px; color: var(--ink-3); margin-top: -2px; }
.opt[aria-checked="true"] { background: var(--ink); color: var(--paper); }
.opt[aria-checked="true"] .o-val, .opt[aria-checked="true"] .o-sub { color: var(--paper); opacity: .85; }
.opt[aria-checked="true"] .o-lead { border-color: var(--paper); opacity: .5; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1.5px solid var(--ink); background: transparent; padding: 6px 11px; border-radius: 2px; cursor: pointer;
  font-size: 14px; line-height: 1.2;
}
.chip small { display: block; font-size: 11px; color: var(--ink-2); margin-top: 2px; }
.chip[aria-checked="true"] { background: var(--ink); color: var(--paper); }
.chip[aria-checked="true"] small { color: var(--paper); opacity: .8; }

.money-row { display: grid; grid-template-columns: 76px 1fr 112px; gap: 10px; align-items: center; margin: 6px 0; }
.money-row output { text-align: right; font-weight: 700; }
input[type=range] { width: 100%; accent-color: var(--ink); }
.field-row { display: grid; grid-template-columns: 76px 1fr; gap: 10px; align-items: center; margin: 6px 0; }
select, input[type=text] {
  background: var(--paper-2); border: 1.5px solid var(--ink); border-radius: 2px; padding: 6px 8px; width: 100%; max-width: 260px;
}


.ledger { display: grid; grid-template-columns: 1fr auto; margin: 6px 0 0; row-gap: 2px; }
.ledger dt, .ledger dd { margin: 0; padding: 3px 0; }
.ledger dt { color: var(--ink-2); overflow-wrap: anywhere; }
.ledger dt small { color: var(--ink-3); font-size: 12px; }
.ledger dd { text-align: right; white-space: nowrap; padding-left: 12px; }
.ledger .sum { border-top: 1px dashed var(--rule); color: var(--ink); font-weight: 800; padding-top: 6px; margin-top: 3px; }
.ledger .big { font-size: 20px; }
.ledger .neg { color: var(--red); }
.ledger.small { font-size: 13.5px; }
.ledger .dim { color: var(--ink-3); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; padding-top: 18px; }


.key {
  appearance: none; border: 0; cursor: pointer; background: var(--key); color: var(--key-ink);
  padding: 10px 14px; min-height: 42px; border-radius: 4px; font-weight: 700; letter-spacing: -0.01em;
  box-shadow: inset 0 -3px 0 var(--key-edge);
}
.key:active { transform: translateY(1px); box-shadow: inset 0 -1px 0 var(--key-edge); }
.key[aria-pressed="true"] { background: var(--red); color: var(--on-red); box-shadow: inset 0 -3px 0 rgba(0,0,0,.35); }
.key-main { padding: 12px 22px; font-size: 16px; }
.key-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.key-ghost:active { box-shadow: inset 0 0 0 1.5px var(--ink); }
.key:disabled { opacity: .4; cursor: not-allowed; }
.key:focus-visible, .chip:focus-visible, .opt:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.r-aside { text-transform: none; letter-spacing: 0; color: var(--ink-3); font-family: var(--sans); font-size: 11.5px; margin-left: 6px; }


.play-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.col-main > .paper, .col-side > .paper { margin-top: 14px; }
.shop-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 10px; }
.shop-id { min-width: 0; }
.shop-name { margin: 0; font-size: 24px; letter-spacing: -0.03em; line-height: 1.2; overflow-wrap: anywhere; }
.week-box { text-align: right; white-space: nowrap; }
.wk-num { font-size: 26px; font-weight: 800; }
.wk-of { color: var(--ink-3); }
.wk-date { display: block; font-size: 12px; color: var(--ink-2); }

.stage { padding-bottom: 16px; }
.scene-wrap { position: relative; border: 2px solid var(--ink); background: var(--paper-2); line-height: 0; }
.scene { display: block; width: 100%; height: auto; aspect-ratio: 48 / 31; image-rendering: pixelated; image-rendering: crisp-edges; }
.day-tag { position: absolute; left: 6px; top: 6px; line-height: 1.2; font-size: 11px; font-weight: 700; padding: 1px 5px; background: var(--paper); color: var(--ink); border: 1px solid var(--ink); }
.day-tag:empty { display: none; }
.week-run { height: 3px; background: var(--paper-2); margin-top: 4px; }
.week-run i { display: block; height: 100%; width: 0; background: var(--red); }
.caption { margin: 8px 0 0; font-size: 13.5px; color: var(--ink-2); line-height: 1.45; }

.day-ticker { margin: 6px 0 0; min-height: 1.4em; font-size: 13px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tape li.k-l .tt { color: var(--ink-2); }


.controls { margin: 14px 0 0; display: grid; gap: 6px; }
.ctl-row { display: flex; gap: 6px; }
.ctl-row > .key { flex: 1 1 0; }
.speeds { display: flex; gap: 4px; flex: 2.4 1 0; }
.speeds .key { flex: 1 1 0; padding: 9px 4px; min-width: 0; }
.key[aria-checked="true"] { background: var(--red); color: var(--on-red); box-shadow: inset 0 -3px 0 rgba(0,0,0,.35); }
#autoBtn[aria-pressed="false"] { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.hint { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-2); min-height: 1.4em; }


.bars { display: grid; gap: 7px; }
.bar-row { display: grid; grid-template-columns: 64px 1fr auto; grid-template-areas: "l b v" "l n n"; column-gap: 10px; align-items: center; }
.bar-row .bl { grid-area: l; font-weight: 700; font-size: 13.5px; align-self: start; padding-top: 1px; }
.bar-row .bar { grid-area: b; }
.bar-row .bv { grid-area: v; font-size: 13px; text-align: right; white-space: nowrap; min-width: 54px; }
.bar-row .bn { grid-area: n; font-size: 11.5px; color: var(--ink-3); line-height: 1.35; }
.stars { color: var(--red); letter-spacing: -1px; }
.bar { height: 10px; background: var(--paper-2); outline: 1px solid var(--rule); outline-offset: -1px; }
.bar i { display: block; height: 100%; background: var(--ink); width: 0; transition: width calc(.4s * var(--tk, 1)); }
.bar i.warn { background: var(--red); }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
.kcard { border: 1px dashed var(--rule); padding: 7px 8px; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.kcard .kl { font-size: 11.5px; color: var(--ink-2); }
.kcard .kv { font-size: 16px; font-weight: 800; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.kcard .kv.neg { color: var(--red); }
.kcard small { font-size: 11px; color: var(--ink-3); overflow-wrap: anywhere; }


.focus-list { gap: 5px; }
.chip.focus { padding: 7px 10px; }
.chip:disabled { opacity: .38; cursor: not-allowed; }


.grid52 { display: grid; grid-template-columns: repeat(13, minmax(0, 1fr)); gap: 3px; margin-top: 4px; }
.gc { position: relative; aspect-ratio: 1.5 / 1; outline: 1px solid var(--rule); outline-offset: -1px; background: var(--paper); }
.gc i { position: absolute; inset: 0; background: var(--ink); opacity: 0; }
.gc.neg i { background: var(--red); }
.gc.future { outline-style: dashed; }
.gc.now { outline: 2px solid var(--red); outline-offset: -2px; }
.gc.shut { background: repeating-linear-gradient(45deg, transparent 0 3px, var(--rule) 3px 4px); }
.grid-sub { margin-top: 12px; }
#curve { width: 100%; height: 110px; display: block; }
#curve .zero { stroke: var(--ink-3); stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
#curve .limit { stroke: var(--red); stroke-dasharray: 2 4; vector-effect: non-scaling-stroke; }
#curve .area { fill: var(--ink); opacity: .08; }
#curve .line { fill: none; stroke: var(--ink); stroke-width: 2; vector-effect: non-scaling-stroke; }
#curve .dot { fill: var(--red); }
.curve-lab { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--ink-3); margin-top: 2px; }


.tape-wrap { padding-bottom: 8px; }
.tape { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow-y: auto; font-size: 14px; }
.tape li { border-bottom: 1px dotted var(--rule); }
.tape .tl { display: grid; grid-template-columns: 52px 1fr 16px; gap: 6px; width: 100%; padding: 6px 0; background: none; border: 0; text-align: left; cursor: pointer; line-height: 1.5; }
.tape .tl:focus-visible { outline: 2px solid var(--red); outline-offset: -2px; }
.tape .tw { font-size: 11.5px; color: var(--ink-3); padding-top: 2px; }
.tape .ts { color: var(--ink-3); font-size: 13px; text-align: right; }
.tape li.starred .ts { color: var(--red); }
.tape li.starred { background: var(--red-bg); }
.tape li.k-d .tt { font-weight: 700; }
.tape li.k-f .tt { color: var(--ink-2); font-style: italic; }
.tape li.k-t .tt { font-weight: 600; }
.tape li.bad .tt { color: var(--red); }
.tape .amt { font-size: 12.5px; white-space: nowrap; }
.tape .amt-out { color: var(--red); font-weight: 800; }
.tape .amt-in { font-weight: 800; }
.tape .tag { display: inline-block; font-size: 10.5px; font-weight: 700; line-height: 1.3; color: var(--ink-2); border: 1px solid var(--ink-3); padding: 0 4px; margin-left: 2px; vertical-align: 1px; font-style: normal; }
.tape li:first-child { animation: print calc(.45s * var(--tk, 1)) ease-out; }
@keyframes print { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.ledger-box summary { cursor: pointer; margin: 0; }
.ledger-box[open] summary { margin-bottom: 4px; }
.ledger-box .ledger.small { border-top: 1px dashed var(--rule); margin-top: 10px; padding-top: 6px; }

.rivals { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rv { position: relative; border: 1px solid var(--rule); padding: 8px 9px 7px; min-width: 0; background: var(--paper); }
.rv-name { font-weight: 700; font-size: 14px; line-height: 1.25; overflow-wrap: anywhere; }
.rv-meta { font-size: 11.5px; color: var(--ink-2); }
.rv-cash { font-family: var(--mono); font-size: 12.5px; margin-top: 2px; }
.rv svg { width: 100%; height: 22px; display: block; margin-top: 4px; }
.rv svg polyline { fill: none; stroke: var(--ink-2); stroke-width: 1.3; vector-effect: non-scaling-stroke; }
.rv.closed { color: var(--ink-3); }
.rv.closed .rv-name { text-decoration: line-through; text-decoration-color: var(--red); }
.stamp {
  position: absolute; right: 6px; top: 6px; font-family: var(--mono); font-size: 10.5px; font-weight: 800; letter-spacing: .05em;
  color: var(--red); border: 1.5px solid var(--red); padding: 1px 4px; transform: rotate(-6deg); background: var(--paper);
}
.parked { position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; z-index: 15; max-width: calc(100% - 32px); background: var(--red); color: var(--on-red); box-shadow: 0 10px 24px -10px rgba(0,0,0,.6); }


.modal { position: fixed; inset: 0; background: rgba(10,10,9,.6); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 30; }
.slip { background: var(--paper); color: var(--ink); width: min(480px, 100%); padding: 20px 20px 16px; box-shadow: 0 20px 50px -20px rgba(0,0,0,.7); border-top: 6px solid var(--ink); max-height: 92vh; overflow-y: auto; }
.slip-title { margin: 2px 0 8px; font-size: 21px; letter-spacing: -0.03em; }
.slip-body { margin: 0 0 8px; color: var(--ink-2); font-size: 14.5px; }
.slip-stat { margin: 0 0 14px; font-size: 12px; color: var(--ink-2); border-left: 3px solid var(--red); padding: 2px 0 2px 8px; }
.slip-stat:empty { display: none; }
.slip-opts { display: grid; gap: 8px; }
.slip-opts .key { text-align: left; display: grid; grid-template-columns: 22px 1fr; column-gap: 8px; align-items: center; }
.opt-key .ok-n { grid-row: span 2; font-size: 12px; opacity: .7; border: 1px solid currentColor; text-align: center; border-radius: 2px; line-height: 18px; }
.opt-key small { grid-column: 2; font-weight: 500; opacity: .78; font-size: 12.5px; }
.slip-opts .key { position: relative; }
.slip-opts .key.suggest::after { content: "자동"; position: absolute; right: 8px; top: 8px; font-size: 10.5px; font-weight: 800; line-height: 1; padding: 3px 5px; background: var(--red); color: var(--on-red); border-radius: 2px; }
.slip:focus { outline: none; }
.slip-opts .key.picked { background: var(--red); color: var(--on-red); }
.countdown { margin-top: 12px; }
.cd-bar { height: 6px; background: var(--paper-2); outline: 1px solid var(--rule); outline-offset: -1px; }
.cd-bar i { display: block; height: 100%; width: 0; background: var(--red); }
.cd-text { margin: 6px 0 0; font-size: 12.5px; color: var(--ink-2); }
.slip-foot { display: flex; gap: 8px; justify-content: space-between; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--rule); }
.slip-foot .key { flex: 1 1 0; padding: 8px 8px; min-height: 38px; font-size: 13.5px; }


.cert { max-width: 640px; margin-left: auto; margin-right: auto; }
.cf-top { margin: 0 0 6px; font-size: 11px; color: var(--ink-3); letter-spacing: .06em; }
.cf-title { margin: 6px 0 14px; text-align: center; font-size: 28px; letter-spacing: .3em; font-weight: 800; }
.cf-table { width: 100%; border-collapse: collapse; font-size: 13.5px; border: 2px solid var(--ink); table-layout: fixed; }
.cf-table th, .cf-table td { border: 1px solid var(--ink-3); padding: 7px 8px; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.cf-table th { background: var(--paper-2); font-weight: 700; width: 19%; font-size: 12.5px; }
.cf-table td.neg { color: var(--red); }
.cf-table small { color: var(--ink-3); font-family: var(--sans); }
.cf-sign { text-align: right; margin: 14px 0 0; font-size: 14px; line-height: 1.8; }
.cf-seal { display: inline-grid; place-items: center; width: 46px; height: 46px; border: 2.5px solid var(--red); color: var(--red); border-radius: 50%; font-weight: 800; font-size: 13px; transform: rotate(-12deg); margin-left: 6px; vertical-align: middle; line-height: 1; }
.cert-receipt { text-align: center; }
.cr-title { margin: 6px 0 2px; font-size: 26px; letter-spacing: -0.03em; }
.cr-meta { margin: 0 0 12px; color: var(--ink-2); font-size: 13.5px; }
.cr-table { width: 100%; border-collapse: collapse; font-size: 14px; text-align: left; }
.cr-table td { padding: 5px 2px; border-bottom: 1px dotted var(--rule); }
.cr-table td:last-child { text-align: right; white-space: nowrap; }
.cr-table tr.sum td { font-weight: 800; border-top: 2px solid var(--ink); border-bottom: 0; }
.cr-table tr.neg td:last-child { color: var(--red); }
.cr-barcode { display: flex; gap: 2px; justify-content: center; height: 40px; margin: 14px 0 6px; overflow: hidden; }
.cr-barcode i { display: block; background: var(--ink); height: 100%; flex: 0 0 auto; }
.cert-line { margin: 18px 0 0; text-align: center; font-size: 22px; font-weight: 800; letter-spacing: -0.03em; }
.cert-actions { justify-content: center; }

.paper-end { max-width: 760px; margin-left: auto; margin-right: auto; }
.end-stamp {
  display: inline-block; font-family: var(--mono); font-weight: 800; font-size: 15px; letter-spacing: .08em;
  border: 2.5px solid currentColor; padding: 3px 10px; transform: rotate(-4deg); margin: 4px 0 10px;
}
.end-stamp.dead { color: var(--red); }
.end-big { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border-top: 1px dashed var(--rule); border-bottom: 1px dashed var(--rule); margin: 14px 0; }
.end-big > div { padding: 12px 8px; border-right: 1px dashed var(--rule); min-width: 0; }
.end-big > div:last-child { border-right: 0; }
.end-big .lab { font-size: 12px; color: var(--ink-2); }
.end-big .num { font-family: var(--mono); font-weight: 800; font-size: 22px; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.end-big .num.neg { color: var(--red); }
.cmp { margin: 12px 0 4px; }
.cmp-row { display: grid; grid-template-columns: 110px 1fr 92px; gap: 8px; align-items: center; margin: 6px 0; font-size: 13.5px; }
.cmp-row .bar { height: 14px; }
.cmp-row .bar i.mw { background: var(--ink-3); }
.cmp-row .v { text-align: right; font-family: var(--mono); }
.end-list { margin: 6px 0 0; padding-left: 0; list-style: none; }
.end-list li { padding: 5px 0; border-bottom: 1px dotted var(--rule); font-size: 14px; }
.end-sec { border-top: 1px dashed var(--rule); margin-top: 16px; padding-top: 12px; }
.end-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.end-table th, .end-table td { padding: 5px 4px; border-bottom: 1px dotted var(--rule); text-align: right; }
.end-table th:first-child, .end-table td:first-child { text-align: left; color: var(--ink-2); font-weight: 500; }
.end-table td { font-family: var(--mono); }
.end-table td:first-child { font-family: var(--sans); }
#setup .paper { max-width: 880px; margin-left: auto; margin-right: auto; }
.punch { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; margin: 10px 0 0; }
.verdict { font-size: 15px; font-weight: 700; margin: 8px 0 0; padding: 8px 10px; border: 1px dashed var(--rule, currentColor); }
.verdict.neg { color: var(--red); border-color: var(--red); }
.money-table td:last-child { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.money-table tr.neg td:last-child { color: var(--red); }
.money-table tr.sum td { font-weight: 700; border-top: 2px solid currentColor; }
.money-table tr.sum.neg td:last-child { color: var(--red); }
.copy-ok { font-size: 13px; color: var(--ink-2); margin-left: 6px; }
.keep { background: var(--paper-2); padding: 12px 12px 14px; border-top: 0; }
.keep label { display: block; }
.note-row { display: flex; gap: 8px; }
.note-row input { flex: 1 1 auto; max-width: none; min-width: 0; }
.keep-actions { justify-content: flex-start; padding-top: 12px; }
.png-preview { display: block; width: min(240px, 60%); margin-top: 10px; border: 1px solid var(--rule); }

.hist-list { margin: 0; padding: 0; list-style: none; font-size: 13.5px; }
.hist-list li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px dotted var(--rule); }
.hist-list li > span:last-child { font-family: var(--mono); white-space: nowrap; color: var(--ink-2); }
.hist-list .h-note { display: block; color: var(--ink-2); font-size: 12.5px; }


body.rp-open { overflow: hidden; }
.replay { position: fixed; inset: 0; z-index: 40; background: var(--counter); color: var(--ink); display: flex; flex-direction: column; padding: max(12px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); }
.rp-top { display: flex; align-items: center; gap: 10px; max-width: 820px; width: 100%; margin: 0 auto; }
.rp-prog { display: flex; gap: 4px; flex: 1 1 auto; }
.rp-prog span { flex: 1 1 0; height: 4px; background: var(--counter-2); overflow: hidden; }
.rp-prog span i { display: block; height: 100%; width: 0; background: var(--ink); }
.rp-prog span.done i { width: 100%; }
.rp-prog span.on i { width: 100%; animation: rpfill var(--slide, 2.6s) linear; }
@keyframes rpfill { from { width: 0; } to { width: 100%; } }
.rp-skip { padding: 6px 12px; min-height: 36px; font-size: 13.5px; }
.rp-body { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; max-width: 820px; width: 100%; margin: 0 auto; cursor: pointer; user-select: none; }
.rp-body.in .rp-scene, .rp-body.in .rp-cap { animation: rpin .5s ease-out; }
@keyframes rpin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.rp-scene { border: 3px solid var(--ink); background: var(--paper); line-height: 0; }
.rp-week { margin: 14px 0 4px; font-size: 13px; color: var(--ink-2); letter-spacing: .04em; }
.rp-cap { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.45; min-height: 3em; }
.rp-tap { margin: 12px 0 0; font-size: 12px; color: var(--ink-3); }
.rp-title { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; max-width: 720px; width: 100%; margin: 0 auto; text-align: left; }
.rp-t-small { margin: 0 0 18px; font-size: 13px; color: var(--ink-2); }
.rp-t-big { margin: 0; font-size: clamp(32px, 9vw, 64px); font-weight: 900; letter-spacing: -0.04em; line-height: 1.15; }
.rp-t-sub { margin: 18px 0 0; font-size: 16px; color: var(--ink-2); }
.rp-t-line { margin: 8px 0 0; font-size: 16px; font-weight: 700; }
.rp-t-actions { margin-top: 28px; display: flex; gap: 10px; }


.sources { margin-top: 18px; font-size: 13px; color: var(--ink-2); }
.sources details { background: var(--paper); color: var(--ink); padding: 12px 16px; box-shadow: var(--shadow); }
.sources summary { cursor: pointer; font-weight: 700; font-size: 14px; }
.src-lead { margin: 10px 0; color: var(--ink-2); }
.src-list { margin: 0; padding-left: 20px; }
.src-list li { margin: 4px 0; color: var(--ink-2); }
.src-list .yr { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.src-list .est { font-size: 11px; font-weight: 700; color: var(--red); border: 1px solid var(--red); padding: 0 3px; margin-left: 4px; }


@media (max-width: 860px) {
  .play-grid { grid-template-columns: 1fr; gap: 0; }
  body.playing .counter { padding-bottom: 128px; }
  .controls {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; margin: 0;
    padding: 8px 16px calc(6px + env(safe-area-inset-bottom)); background: var(--counter);
    border-top: 1px solid var(--counter-2); box-shadow: 0 -8px 20px -14px rgba(0,0,0,.5);
  }
  .controls .key { min-height: 38px; padding: 7px 6px; font-size: 14px; }
  .hint { font-size: 11.5px; min-height: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .parked { bottom: 136px; }
  .opt-list { grid-template-columns: 1fr; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  body { font-size: 14.5px; }
  .counter { padding: 8px 16px 32px; }
  .paper { padding: 18px 14px 22px; }
  .paper-thin { padding: 12px 12px 14px; }
  .r-title { font-size: 22px; }
  .money-row { grid-template-columns: 64px 1fr 92px; gap: 8px; }
  .money-row output { font-size: 13px; }
  .field-row { grid-template-columns: 64px 1fr; }
  .shop-name { font-size: 19px; }
  .wk-num { font-size: 22px; }
  .end-big { grid-template-columns: 1fr; }
  .end-big > div { border-right: 0; border-bottom: 1px dashed var(--rule); }
  .end-big > div:last-child { border-bottom: 0; }
  .cmp-row { grid-template-columns: 82px 1fr 80px; }
  .rivals { grid-template-columns: 1fr 1fr; gap: 6px; }
  .key { padding: 9px 10px; }
  .speeds .key { font-size: 13px; padding: 7px 2px; }
  .bar-row { grid-template-columns: 58px 1fr auto; column-gap: 8px; }
  .cf-title { font-size: 22px; letter-spacing: .2em; }
  .cf-table { font-size: 12.5px; }
  .cf-table th, .cf-table td { padding: 6px 5px; }
  .cert-line { font-size: 19px; }
  .rp-cap { font-size: 18px; }
  .grid52 { gap: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  .tape li:first-child { animation: none; }
  .bar i { transition: none; }
  .rp-body.in .rp-scene, .rp-body.in .rp-cap { animation: none; }
  .rp-prog span.on i { animation: none; }
}


.focus-tip { margin: 10px 0 2px; padding: 8px 10px; border: 1.5px dashed var(--red); font-size: 13.5px; line-height: 1.5; color: var(--ink); display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.focus-tip .key { padding: 5px 10px; min-height: 34px; font-size: 13px; }

@media (max-width: 860px) {
  .rp-body { justify-content: flex-start; padding-top: 20px; }
  .rp-scene { margin: 0; }
}


.runs { margin-top: 6px; display: grid; gap: 3px; }
.run-row { display: grid; grid-template-columns: 40px 1fr; align-items: center; gap: 6px; }
.run-lab { font-size: 10.5px; color: var(--ink-3); letter-spacing: .02em; }
.week-run, .year-run { position: relative; height: 5px; background: var(--paper-2); margin: 0; overflow: hidden; }
.week-run i, .year-run i { display: block; height: 100%; width: 0; background: var(--red); }
.year-run i { background: var(--ink); }

.week-run::after, .year-run::after { content: ''; position: absolute; inset: 0; pointer-events: none; }
.week-run::after { background: repeating-linear-gradient(90deg, transparent 0 calc(100% / 7 - 1px), var(--paper) calc(100% / 7 - 1px) calc(100% / 7)); }
.year-run::after { background: repeating-linear-gradient(90deg, transparent 0 calc(20% - 2px), var(--paper) calc(20% - 2px) 20%); }
.pace { color: var(--ink); font-weight: 700; }

.slip-imp { display: inline-block; margin: 0 0 6px; padding: 2px 8px; font-size: 12px; font-weight: 800; color: var(--paper); background: var(--red); letter-spacing: .02em; }
.slip.important { border-top: 6px solid var(--red); }
.slip.important .suggest::after { display: none; }

.tape { overflow-anchor: none; min-height: 160px; }


.top-keys { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.music-slot:empty, .music-tip:empty, .net-slot:empty { display: none; }
.music-slot .lm-toggle { min-height: 36px; font-size: 13px; }
.music-tip { margin: 12px 0 0; font-size: 13px; color: var(--ink-2, inherit); text-align: right; }
.net-slot { margin: 0 0 12px; }
#end .net-slot { max-width: 760px; margin: 0 auto 22px; }
@supports selector(:has(*)) { .net-slot:not(:has(> :not([hidden]))) { display: none; } }


.grid5y { display: grid; grid-template-columns: 2.6em repeat(52, minmax(0, 1fr)); gap: 1px; margin-top: 4px; align-items: center; }
.grid5y .gy { font-size: 10.5px; color: var(--ink-3); font-family: var(--mono); line-height: 1; padding-right: 3px; white-space: nowrap; }
.grid5y .gy.cur { color: var(--red); font-weight: 800; }
.grid5y .gc { aspect-ratio: auto; height: 12px; }
.grid5y .gc.now { outline-width: 1.5px; outline-offset: -1px; }
.week-box .wk-num { white-space: nowrap; }
.wk-of { font-size: 12px; }
@media (max-width: 560px) {
  .shop-head { flex-wrap: wrap; align-items: flex-start; gap: 4px 12px; }
  .shop-id { flex: 1 1 100%; }
  .week-box { flex: 1 1 100%; text-align: left; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
  .week-box .wk-date { display: inline; }
}
@media (max-width: 480px) {
  .grid5y { grid-template-columns: 2.2em repeat(52, minmax(0, 1fr)); gap: 0; column-gap: 1px; row-gap: 2px; }
  .grid5y .gc { height: 10px; outline: 0; background: var(--paper-2); }
  .grid5y .gc.future { background: var(--paper-2); }
  .wk-num { font-size: 19px; }
  .tape .tl { grid-template-columns: 46px 1fr 14px; }
}


.ver-badge { float: right; text-transform: none; margin-left: 8px; padding: 1px 7px; border: 1px solid var(--rule); border-radius: 999px; font-size: 11px; letter-spacing: .02em; color: var(--ink-2); line-height: 1.5; }
.bug-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 0 0 10px; color: var(--ink-2); }
.bug-row[hidden] { display: none; }
.ver-tag { font-size: 12px; }
.bug-slot { color: var(--ink); }
.bug-slot .lb-open { font-size: 12.5px; min-height: 32px; padding: 6px 10px; }

.site-links{display:flex;flex-wrap:wrap;gap:6px 16px;margin:20px 0 4px;font-size:13px;opacity:.85}
.site-links a{color:inherit;text-decoration:underline;text-underline-offset:3px}
