:root {
  --u: 2px;
  --ink: #2b1d1a;
  --ink-2: #4a3630;
  --paper: #fbf3e4;
  --paper-2: #f1e4c8;
  --red: #e0453c;
  --red-d: #9c2018;
  --teal: #2a9d8f;
  --teal-d: #1c6e65;
  --gold: #f2c14b;
  --gold-d: #b98a1c;
  --led-red: #ff4136;
  --led-green: #44ff86;
  --page: #241815;
  --t-green: #3fae5a;
  --t-yellow: #f2c14b;
  --t-orange: #f08a2c;
  --t-red: #e0453c;
  --gutter: 10px;
  --pixel: "Press Start 2P", ui-monospace, monospace;
  --vt: "VT323", ui-monospace, monospace;
  color-scheme: dark;
}
@media (min-width: 360px) { :root { --u: 3px; } }
@media (min-width: 400px) { :root { --gutter: 16px; } }
@media (min-width: 520px) { :root { --u: 4px; } }
@media (min-width: 1000px) { :root { --u: 5px; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--page);
  background-image:
    linear-gradient(45deg, rgba(255,255,255,.025) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.025) 75%),
    linear-gradient(45deg, rgba(255,255,255,.025) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.025) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
  color: var(--paper);
  font-family: var(--vt);
  font-size: 20px;
  line-height: 1.25;
}
button, input { font: inherit; color: inherit; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
canvas.px, .px {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
[hidden] { display: none !important; }

.notch {
  clip-path: polygon(0 var(--n), var(--n) var(--n), var(--n) 0, calc(100% - var(--n)) 0,
    calc(100% - var(--n)) var(--n), 100% var(--n), 100% calc(100% - var(--n)),
    calc(100% - var(--n)) calc(100% - var(--n)), calc(100% - var(--n)) 100%, var(--n) 100%,
    var(--n) calc(100% - var(--n)), 0 calc(100% - var(--n)));
}

.app {
  max-width: 1000px;
  margin: 0 auto;
  padding: 10px var(--gutter) 24px;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 8px;
}
.logo {
  margin: 0;
  font-family: var(--pixel);
  font-size: 18px;
  letter-spacing: 1px;
  color: var(--paper);
  text-shadow: 3px 3px 0 var(--red-d);
}
.logo span { color: var(--gold); }
.tagline { margin: 4px 0 0; color: #d9c096; font-size: 18px; }
.top-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px;
  font-family: var(--pixel); font-size: 14px;
  background: var(--ink-2); color: var(--paper);
  border: 3px solid #120c0a;
  box-shadow: inset -3px -3px 0 rgba(0,0,0,.35), inset 3px 3px 0 rgba(255,255,255,.12);
  cursor: pointer;
}
.icon-btn[aria-pressed="false"] { opacity: .5; text-decoration: line-through; }
.icon-btn:focus-visible, .btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.statusbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 10px;
  font-size: 20px;
  color: #d9c096;
}
.status-date { white-space: nowrap; }
.status-score { white-space: nowrap; font-family: var(--pixel); font-size: 12px; color: var(--gold); }
.status-score small { font-size: 9px; color: #d9c096; }
.pips { display: flex; gap: 5px; list-style: none; margin: 0; padding: 0; }
.pips li {
  width: 14px; height: 14px;
  background: #3a2a24;
  border: 2px solid #120c0a;
}
.pips li.current { background: var(--paper-2); animation: pip 1s steps(2) infinite; }
.pips li.t-green { background: var(--t-green); }
.pips li.t-yellow { background: var(--t-yellow); }
.pips li.t-orange { background: var(--t-orange); }
.pips li.t-red { background: var(--t-red); }
@keyframes pip { 50% { background: #8a7a66; } }

.layout {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.side { width: 100%; max-width: calc(112 * var(--u) + 4px); display: flex; flex-direction: column; gap: 12px; }
@media (min-width: 1000px) {
  .layout { flex-direction: row; align-items: flex-start; justify-content: center; gap: 24px; }
  .side { max-width: 380px; }
}

.scene-wrap {
  border: 2px solid #120c0a;
  background: var(--ink);
  box-shadow: 0 6px 0 rgba(0,0,0,.35);
}
.scene {
  position: relative;
  width: calc(112 * var(--u));
  height: calc(100 * var(--u));
  overflow: hidden;
  background: #f0dcb6;
}
.scene > * { position: absolute; }
.bg { left: 0; top: 0; width: calc(112 * var(--u)); height: calc(72 * var(--u)); z-index: 0; }
.glow {
  inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(ellipse calc(30 * var(--u)) calc(26 * var(--u)) at calc(12.5 * var(--u)) calc(12 * var(--u)), rgba(255, 214, 140, .45), transparent 70%),
    radial-gradient(ellipse calc(30 * var(--u)) calc(26 * var(--u)) at calc(48.5 * var(--u)) calc(12 * var(--u)), rgba(255, 214, 140, .4), transparent 70%),
    linear-gradient(180deg, rgba(255, 170, 80, .08), rgba(60, 20, 0, .18));
}

.cashier {
  left: 0; top: var(--u);
  width: calc(64 * var(--u)); height: calc(64 * var(--u));
  z-index: 2;
}
.cashier canvas { width: 100%; height: 100%; display: block; }
.cashier.hop { animation: hop .32s steps(2) 1; }
@keyframes hop { 50% { transform: translateY(calc(-2 * var(--u))); } }
.nametag {
  position: absolute;
  left: calc(19 * var(--u)); top: calc(50 * var(--u));
  width: calc(13 * var(--u)); height: calc(7 * var(--u));
  background: #fffdf7;
  border: var(--u) solid var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: var(--pixel);
  font-size: calc(var(--u) * 1.8);
  line-height: 1.2;
  color: var(--ink);
}

.pole {
  left: calc(93 * var(--u)); top: calc(35 * var(--u));
  width: calc(5 * var(--u)); height: calc(8 * var(--u));
  z-index: 3;
  background: linear-gradient(90deg, var(--ink) var(--u), #8a8494 var(--u), #b9b3c2 calc(2 * var(--u)), #6f6b79 calc(3 * var(--u)), #6f6b79 calc(4 * var(--u)), var(--ink) calc(4 * var(--u)));
}
.pole-display {
  --n: var(--u);
  left: calc(56 * var(--u)); top: var(--u);
  width: calc(56 * var(--u)); height: calc(35 * var(--u));
  z-index: 7;
  padding: calc(2 * var(--u));
  background: #4a4753;
  box-shadow:
    inset 0 0 0 var(--u) var(--ink),
    inset calc(2 * var(--u)) calc(2 * var(--u)) 0 0 #6f6b79,
    inset calc(-2 * var(--u)) calc(-2 * var(--u)) 0 0 #34313c;
  transition: transform .25s steps(3);
  transform-origin: 60% 100%;
}
.pole-display.big { transform: scale(1.04); }
.pd-screen {
  position: relative;
  height: 100%;
  background-color: #0c0a10;
  background-image: repeating-linear-gradient(0deg, rgba(255,255,255,.035) 0 1px, transparent 1px calc(var(--u)));
  box-shadow: inset 0 0 0 var(--u) #000;
  padding: calc(1.5 * var(--u)) calc(2 * var(--u));
  display: flex; flex-direction: column; justify-content: space-between;
  overflow: hidden;
}
.pd-top {
  display: flex; justify-content: space-between; align-items: baseline; gap: var(--u);
  font-family: var(--vt);
  font-size: calc(5.5 * var(--u));
  line-height: 1;
  letter-spacing: .04em;
  white-space: nowrap;
}
.pd-label { color: var(--led-red); text-shadow: 0 0 var(--u) currentColor; }
.pd-label.green { color: var(--led-green); }
.pd-guess { color: var(--led-red); text-shadow: 0 0 var(--u) currentColor; font-size: calc(4.8 * var(--u)); }
.pd-guess.green { color: var(--led-green); }
.pd-digits {
  display: flex; justify-content: flex-end; align-items: flex-end;
  gap: calc(1.2 * var(--u));
  color: var(--led-red);
  padding-bottom: calc(.5 * var(--u));
}
.pd-digits.green { color: var(--led-green); }
.pd-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.pd-screen.flicker .pd-digits, .pd-screen.flicker .pd-top { animation: flicker .7s steps(1) 1; }
.pd-screen.flicker .pd-flash { animation: flash .3s steps(3) 1; }
@keyframes flicker {
  0% { opacity: 1; } 10% { opacity: .15; } 20% { opacity: .9; } 30% { opacity: .05; }
  45% { opacity: .8; } 55% { opacity: .2; } 70% { opacity: 1; } 80% { opacity: .5; } 90%, 100% { opacity: 1; }
}
@keyframes flash { 0% { opacity: .75; } 100% { opacity: 0; } }

.seg {
  --t: var(--u);
  position: relative; flex: none;
  width: calc(5.6 * var(--u)); height: calc(13 * var(--u));
}
.seg.peso { width: calc(5 * var(--u)); margin-right: calc(.6 * var(--u)); }
.seg i { position: absolute; display: block; background: currentColor; opacity: .09; }
.seg i.on { opacity: 1; box-shadow: 0 0 calc(1.2 * var(--u)) currentColor; }
.seg .a { top: 0; left: var(--t); right: var(--t); height: var(--t); }
.seg .b { top: var(--t); right: 0; width: var(--t); height: calc(50% - 1.5 * var(--t)); }
.seg .c { bottom: var(--t); right: 0; width: var(--t); height: calc(50% - 1.5 * var(--t)); }
.seg .d { bottom: 0; left: var(--t); right: var(--t); height: var(--t); }
.seg .e { bottom: var(--t); left: 0; width: var(--t); height: calc(50% - 1.5 * var(--t)); }
.seg .f { top: var(--t); left: 0; width: var(--t); height: calc(50% - 1.5 * var(--t)); }
.seg .g { top: calc(50% - .5 * var(--t)); left: var(--t); right: var(--t); height: var(--t); }
.seg.has-dp { margin-right: var(--u); }
.seg .dp { bottom: 0; right: calc(-1.6 * var(--u)); width: var(--t); height: var(--t); }
.seg .x1, .seg .x2 { left: calc(-1 * var(--u)); right: calc(-.5 * var(--u)); height: calc(.75 * var(--t)); }
.seg .x1 { top: calc(2.1 * var(--u)); }
.seg .x2 { top: calc(3.9 * var(--u)); }

.counter { left: 0; top: calc(64 * var(--u)); width: 100%; height: calc(36 * var(--u)); z-index: 4; }
.counter-top {
  height: calc(7 * var(--u));
  background:
    linear-gradient(180deg, #fff3d6 0 var(--u), #ead3a6 var(--u) calc(5 * var(--u)), #c9a774 calc(5 * var(--u)) calc(6 * var(--u)), var(--ink) calc(6 * var(--u)));
  border-top: var(--u) solid var(--ink);
}
.counter-front {
  height: calc(29 * var(--u));
  background:
    linear-gradient(180deg, transparent 0 calc(21 * var(--u)), var(--ink) calc(21 * var(--u)) calc(22 * var(--u)), var(--teal) calc(22 * var(--u)) calc(25 * var(--u)), var(--teal-d) calc(25 * var(--u))),
    repeating-linear-gradient(90deg, #9b5f37 0 calc(13 * var(--u)), #8a5230 calc(13 * var(--u)) calc(14 * var(--u)), var(--ink) calc(14 * var(--u)) calc(15 * var(--u)), #a8693d calc(15 * var(--u)) calc(16 * var(--u)));
}
.scanner-glass {
  left: calc(41 * var(--u)); top: calc(66 * var(--u));
  width: calc(26 * var(--u)); height: calc(4 * var(--u));
  z-index: 4;
  background:
    linear-gradient(90deg, transparent calc(12.5 * var(--u)), rgba(255, 65, 54, .9) calc(12.5 * var(--u)) calc(13.5 * var(--u)), transparent calc(13.5 * var(--u))),
    linear-gradient(180deg, transparent calc(1.5 * var(--u)), rgba(255, 65, 54, .7) calc(1.5 * var(--u)) calc(2.5 * var(--u)), transparent calc(2.5 * var(--u))),
    #2d3440;
  box-shadow: 0 0 0 var(--u) var(--ink), inset 0 var(--u) 0 #4b5566;
}
.scanner-glass.beep { animation: beep .45s steps(3) 1; }
@keyframes beep {
  0% { background-color: #ff4136; box-shadow: 0 0 0 var(--u) var(--ink), 0 0 calc(6 * var(--u)) calc(2 * var(--u)) rgba(255, 65, 54, .8); }
  100% { background-color: #2d3440; }
}

.printer { left: var(--u); top: calc(48 * var(--u)); width: calc(20 * var(--u)); height: calc(18 * var(--u)); z-index: 5; }
.register { left: calc(72 * var(--u)); top: calc(40 * var(--u)); width: calc(40 * var(--u)); height: calc(28 * var(--u)); z-index: 6; }

.product {
  left: calc(38 * var(--u)); top: calc(35 * var(--u));
  width: calc(32 * var(--u)); height: calc(32 * var(--u));
  z-index: 5;
}
.product canvas { width: 100%; height: 100%; display: block; }
.stack-tag {
  position: absolute; z-index: 1;
  transform: translate(-100%, -100%);
  font-family: var(--pixel); font-size: max(8px, calc(2.4 * var(--u))); line-height: 1;
  color: var(--ink); background: #fffdf7;
  border: max(2px, calc(.75 * var(--u))) solid var(--ink);
  padding: max(2px, calc(.6 * var(--u))) max(2px, calc(.75 * var(--u)));
  white-space: nowrap; pointer-events: none;
}
.stack-tag[hidden] { display: none; }

.product { cursor: zoom-in; }
.product:focus-visible { outline: max(2px, calc(.5 * var(--u))) dashed var(--green, #00bf63); outline-offset: 2px; }
.zoom-hint {
  position: absolute; right: 0; top: 20%;
  z-index: 2; pointer-events: none; white-space: nowrap;
  font-family: var(--vt); font-size: max(13px, calc(2.2 * var(--u))); line-height: 1;
  color: #1a1208; background: #fffdf7; border: 2px solid #1a1208; padding: 2px 5px;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, .35);
  animation: hintBob 1.6s steps(2) infinite;
}
.zoom-hint[hidden] { display: none; }
.zoom-hint .zh-word { margin-left: 3px; }
@media (max-width: 600px) { .zoom-hint .zh-word { display: none; } }
@keyframes hintBob { 50% { transform: translateY(-2px); } }

.shelf-tag {
  left: calc(21 * var(--u)); top: calc(71 * var(--u));
  width: calc(66 * var(--u));
  z-index: 6;
  box-sizing: border-box;
  padding: max(3px, calc(.8 * var(--u))) max(5px, calc(1.2 * var(--u))) max(3px, calc(.7 * var(--u)));
  background: #fffdf7;
  border: max(2px, calc(.5 * var(--u))) solid var(--ink);
  border-top: max(4px, calc(1.2 * var(--u))) solid var(--green, #00bf63);
  box-shadow: 0 max(2px, calc(.5 * var(--u))) 0 rgba(0, 0, 0, .25);
  font-family: var(--vt); font-size: max(13px, calc(2.6 * var(--u))); line-height: 1;
  color: var(--ink); text-align: center;
  overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
}
.shelf-tag[hidden] { display: none; }
.shelf-tag .st-size { white-space: nowrap; color: #6b5a48; }
.shelf-tag::before {
  content: ''; position: absolute; left: 12%; right: 12%; top: calc(-1 * max(4px, calc(1.2 * var(--u))) - max(2px, calc(.5 * var(--u))));
  height: max(2px, calc(.5 * var(--u)));
  background: linear-gradient(90deg, var(--ink) 0 max(2px, calc(.5 * var(--u))), transparent 0 calc(100% - max(2px, calc(.5 * var(--u)))), var(--ink) 0);
}

.zoom-card { text-align: center; }
.zoom-body { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.zoom-img { image-rendering: pixelated; image-rendering: crisp-edges; display: block; margin: 4px auto 6px; }
.zoom-cat { margin: 0; font-size: 18px; color: #7a6450; text-transform: uppercase; letter-spacing: .05em; }
.zoom-name { margin: 0; font-family: var(--pixel); font-size: 14px; line-height: 1.5; color: var(--ink); overflow-wrap: anywhere; }
.zoom-size { margin: 0; font-size: 22px; color: var(--ink); }

.mode-intro { width: min(420px, calc(100vw - 24px)); }
.mode-intro .ix-kicker { margin: 0 0 4px; font-family: var(--pixel); font-size: 9px; color: #7a6450; letter-spacing: .08em; }
.mode-intro h2 { margin: 0 0 10px; }
.ix-steps { margin: 0 0 12px; padding-left: 24px; font-size: 21px; line-height: 1.15; }
.ix-steps li { margin-bottom: 6px; }
.ix-gt { color: #237a39; }
:root[data-theme="dark"] .ix-gt { color: #2fe08a; }
.ix-demo { margin: 0 0 14px; padding: 10px 8px; background: #fff8e8; border: 2px dashed #d8c7a6; }
.ix-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; }
.ix-chip { font-family: var(--vt); font-size: 19px; line-height: 1; padding: 4px 7px; border: 2px solid #1a1208; background: #fffdf7; color: #1a1208; white-space: nowrap; }
.ix-chip.ix-real { background: #2d3440; color: #ff9a90; }
.ix-chip.ix-g { background: #1f6e33; color: #fff; }
.ix-chip.ix-y { background: #e6b422; color: #1a1208; }
.ix-chip.ix-r { background: #c8382d; color: #fff; }
.ix-arrow { font-size: 20px; color: #7a6450; }
.btn-go { width: 100%; }

.mode-hint { margin: 6px 0 0; font-size: 16px; line-height: 1.15; color: #6b5644; }
:root[data-theme="dark"] .mode-hint { color: #c9cdc4; }
.product.enter { animation: slideIn .6s steps(8) both; }
.product.exit { animation: slideOut .35s steps(5) forwards; }
@keyframes slideIn { from { transform: translateX(calc(-44 * var(--u))); opacity: 0; } 30% { opacity: 1; } }
@keyframes slideOut { to { transform: translateX(calc(40 * var(--u))); } }
.scanline {
  position: absolute;
  left: calc(-2 * var(--u)); right: calc(-2 * var(--u)); top: 0;
  height: var(--u);
  background: #ff4136;
  box-shadow: 0 0 calc(2 * var(--u)) calc(.5 * var(--u)) rgba(255, 65, 54, .8);
  opacity: 0;
}
.product.scanning .scanline { animation: scan .7s steps(14) 1; }
@keyframes scan { 0% { top: 0; opacity: 1; } 100% { top: 100%; opacity: 1; } }

.points-pop {
  left: calc(30 * var(--u)); top: calc(26 * var(--u));
  width: calc(48 * var(--u));
  z-index: 8;
  text-align: center;
  font-family: var(--pixel);
  font-size: calc(5 * var(--u));
  color: var(--gold);
  text-shadow: var(--u) var(--u) 0 var(--ink), calc(-1 * var(--u)) var(--u) 0 var(--ink), var(--u) calc(-1 * var(--u)) 0 var(--ink), calc(-1 * var(--u)) calc(-1 * var(--u)) 0 var(--ink);
  opacity: 0;
  pointer-events: none;
}
.points-pop.show { animation: pop 1.4s steps(12) forwards; }
.points-pop.t-green { color: #7dff9e; }
.points-pop.t-yellow { color: var(--t-yellow); }
.points-pop.t-orange { color: var(--t-orange); }
.points-pop.t-red { color: #ff7a70; }
@keyframes pop {
  0% { opacity: 0; transform: translateY(calc(4 * var(--u))); }
  15% { opacity: 1; transform: translateY(0); }
  75% { opacity: 1; transform: translateY(calc(-4 * var(--u))); }
  100% { opacity: 0; transform: translateY(calc(-6 * var(--u))); }
}

.bubble {
  position: relative;
  background: var(--paper);
  color: var(--ink);
  border: 3px solid #120c0a;
  box-shadow: inset 0 -3px 0 var(--paper-2);
  padding: 10px 12px 10px;
  min-height: 70px;
}
.bubble::before, .bubble::after {
  content: ''; position: absolute; left: 34px; width: 0; height: 0;
  border-left: 10px solid transparent; border-right: 10px solid transparent;
}
.bubble::before { top: -15px; border-bottom: 12px solid #120c0a; }
.bubble::after { top: -10px; left: 37px; border-left-width: 7px; border-right-width: 7px; border-bottom: 9px solid var(--paper); }
@media (min-width: 1000px) {
  .bubble::before { top: 22px; left: -15px; border: 10px solid transparent; border-left: 0; border-right: 12px solid #120c0a; }
  .bubble::after { top: 25px; left: -9px; border: 7px solid transparent; border-left: 0; border-right: 9px solid var(--paper); }
}
.bubble-name {
  display: inline-block;
  font-family: var(--pixel); font-size: 9px;
  background: var(--teal); color: var(--paper);
  padding: 4px 6px 3px;
  margin-bottom: 6px;
}
.bubble-text { margin: 0; font-size: 24px; line-height: 1.1; display: grid; }
.bubble-text > span { grid-area: 1 / 1; }
.bt-size { visibility: hidden; }

.panel {
  background: var(--paper);
  color: var(--ink);
  border: 3px solid #120c0a;
  box-shadow: inset 0 -4px 0 var(--paper-2), 0 6px 0 rgba(0,0,0,.35);
  padding: 14px 14px 16px;
}
.item-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.item-count { font-family: var(--pixel); font-size: 10px; color: var(--red); }
.item-cat { font-size: 18px; color: #7a6450; text-transform: uppercase; letter-spacing: .05em; }
.item-name {
  --name-fs-base: 25px;
  margin: 6px 0 10px;
  font-family: var(--vt);
  font-size: var(--name-fs, var(--name-fs-base));
  line-height: 1.1;
  min-height: calc(var(--name-fs-base) * 2.2);
  color: var(--ink);
  overflow-wrap: anywhere;
}
.guess-form { display: flex; gap: 10px; align-items: stretch; }
.guess-field {
  flex: 1; min-width: 0;
  display: flex; align-items: center;
  background: #fffdf7;
  border: 3px solid var(--ink);
  box-shadow: inset 3px 3px 0 #e6d6b8;
  padding: 0 8px;
}
.guess-field:focus-within { border-color: var(--teal-d); box-shadow: inset 3px 3px 0 #e6d6b8, 0 0 0 3px rgba(42,157,143,.35); }
.guess-field.invalid { border-color: var(--red); }
.peso-prefix { font-size: 32px; color: #7a6450; margin-right: 4px; }
.guess-field input {
  width: 100%; min-width: 0;
  border: 0; outline: 0; background: transparent;
  font-family: var(--vt); font-size: 36px; line-height: 1;
  padding: 6px 0 4px;
  color: var(--ink);
}
.guess-field input::placeholder { color: #c9b89a; }
.guess-field input:disabled { color: #7a6450; }
.error { min-height: 22px; margin: 6px 0 0; color: var(--red-d); font-size: 19px; }

.btn {
  font-family: var(--pixel);
  font-size: 12px;
  line-height: 1;
  padding: 14px 16px 12px;
  border: 3px solid #120c0a;
  background: var(--teal);
  color: var(--paper);
  box-shadow: inset -3px -4px 0 rgba(0,0,0,.28), inset 3px 3px 0 rgba(255,255,255,.2);
  cursor: pointer;
  touch-action: manipulation;
}
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: inset -3px -2px 0 rgba(0,0,0,.28), inset 3px 3px 0 rgba(255,255,255,.2); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-pay { background: var(--red); min-width: 84px; font-size: 14px; }
.btn-next, .btn-share { width: 100%; margin-top: 4px; }
.btn-share { background: var(--red); }

.result { border-top: 3px dashed #d8c7a6; margin-top: 4px; padding-top: 12px; }
.result-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.result-diff { font-size: 22px; }
.result-pts { font-family: var(--pixel); font-size: 14px; white-space: nowrap; }
.result-pts.t-green { color: #2b8a43; }
.result-pts.t-yellow { color: #b98a1c; }
.result-pts.t-orange { color: #c9601a; }
.result-pts.t-red { color: var(--red-d); }

.panel.done { background: #3a2a24; color: var(--paper); box-shadow: 0 6px 0 rgba(0,0,0,.35); padding: 12px 14px 16px; }
.receipt-slot { height: 10px; margin: 0 6px; background: #120c0a; border: 2px solid #000; }
.receipt {
  position: relative;
  margin: -4px 16px 22px;
  padding: 16px 14px 12px;
  background: #fffdf7;
  color: #2b2622;
  font-family: var(--vt);
  font-size: 20px;
  line-height: 1.12;
  box-shadow: 0 2px 0 rgba(0,0,0,.15);
}
.receipt::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -10px; height: 10px;
  background:
    linear-gradient(135deg, #fffdf7 5px, transparent 0) 0 0 / 10px 10px repeat-x,
    linear-gradient(-135deg, #fffdf7 5px, transparent 0) 0 0 / 10px 10px repeat-x;
}
.rl { display: flex; justify-content: space-between; gap: 8px; min-height: 1.12em; white-space: pre; }
.rl.c { justify-content: center; text-align: center; }
.rl.sub { color: #6b625a; }
.rl.big { font-size: 28px; margin: 2px 0; }
.rl.rule { color: #9b938a; overflow: hidden; }
.rl.wrap { white-space: normal; }
.rl.name { white-space: normal; }
.pcs-tag {
  display: inline-block; vertical-align: .1em;
  font-family: var(--pixel); font-size: 8px; line-height: 1;
  color: var(--ink); background: #fffdf7; border: 2px solid var(--ink);
  padding: 2px 3px; white-space: nowrap;
}
.rl .t-green { color: #2b8a43; } .rl .t-yellow { color: #a87a10; } .rl .t-orange { color: #c9601a; } .rl .t-red { color: var(--red-d); }
.barcode {
  height: 34px; margin: 8px 10px 2px;
  background: repeating-linear-gradient(90deg, #2b2622 0 2px, transparent 2px 3px, #2b2622 3px 4px, transparent 4px 7px, #2b2622 7px 10px, transparent 10px 11px, #2b2622 11px 12px, transparent 12px 15px);
}
.receipt.printing .rl, .receipt.printing .barcode { animation: printLine .18s steps(2) both; animation-delay: calc(var(--i) * 110ms); }
@keyframes printLine { from { opacity: 0; transform: translateY(-6px); } }
.done-actions { padding: 0 2px; }
.share-fallback {
  display: block; width: 100%; margin-top: 8px; resize: none;
  background: #fffdf7; color: var(--ink); border: 3px solid var(--ink);
  font-family: var(--vt); font-size: 18px; padding: 6px;
}
.share-note { min-height: 22px; margin: 6px 0 0; text-align: center; color: var(--gold); font-size: 19px; }
.countdown {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  margin-top: 8px; padding: 10px 12px;
  background: #0c0a10; border: 3px solid #120c0a;
  color: var(--led-red); font-size: 20px;
}
.countdown strong { font-family: var(--pixel); font-size: 14px; font-weight: normal; text-shadow: 0 0 4px currentColor; }

.footer { margin-top: 22px; text-align: center; color: #bfa98a; font-size: 18px; }
.footer p { margin: 4px 0; }
.footer #priceNotice { color: var(--gold); }
.footer .fine { color: #8f7c66; font-size: 16px; }

.help {
  max-width: min(420px, calc(100vw - 24px));
  background: var(--paper); color: var(--ink);
  border: 3px solid #120c0a; padding: 18px;
  box-shadow: 0 8px 0 rgba(0,0,0,.4);
}
.help::backdrop { background: rgba(20, 12, 10, .7); }
.help h2 { margin: 0 0 10px; font-family: var(--pixel); font-size: 14px; color: var(--red); }
.help ol { margin: 0 0 12px; padding-left: 22px; font-size: 20px; }
.help li { margin-bottom: 4px; }
.score-table { width: 100%; border-collapse: collapse; margin-bottom: 14px; font-size: 20px; }
.score-table th, .score-table td { text-align: left; padding: 2px 6px; border-bottom: 2px dashed #d8c7a6; }
.score-table th { font-family: var(--pixel); font-size: 10px; }
.help .btn { width: 100%; }

@media (max-width: 600px) {
  body.typing .layout {
    position: fixed; left: 0; right: 0;
    top: var(--vvtop, 0px);
    height: var(--vvh, 100vh);
    z-index: 50;
    padding: 8px var(--gutter);
    gap: 8px;
    justify-content: flex-start;
    overflow: hidden;
    background-color: var(--page);
  }
  body.typing .side { gap: 0; }
  body.typing .bubble, body.typing .item-head, body.typing .result, body.typing .error:empty { display: none; }
  body.typing .panel.play { padding: 10px 12px; }
  body.typing .item-name, body.typing .mode-hint, body.typing .zoom-hint { display: none; }
  body.typing .scene { height: calc(var(--typing-rows, 70) * var(--u)); }
}

@media (prefers-reduced-motion: reduce) {
  .product.enter, .product.exit, .product.scanning .scanline,
  .pd-screen.flicker .pd-digits, .pd-screen.flicker .pd-top, .pd-screen.flicker .pd-flash,
  .scanner-glass.beep, .cashier.hop, .pips li.current,
  .receipt.printing .rl, .receipt.printing .barcode { animation: none !important; }
  .pole-display { transition: none; }
  .points-pop.show { animation: none; opacity: 1; }
}

.mode-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.mode-tab {
  flex: 1 1 auto;
  padding: 9px 8px 7px;
  font-family: var(--pixel); font-size: 9px; line-height: 1.3;
  background: var(--ink-2); color: var(--paper);
  border: 3px solid #120c0a;
  box-shadow: inset -3px -3px 0 rgba(0,0,0,.35), inset 3px 3px 0 rgba(255,255,255,.12);
  cursor: pointer;
}
.mode-tab[aria-selected="true"] { background: var(--green, var(--t-green)); color: #000; }
.mode-tab:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.mode-tab.dev-reset { flex: 0 0 auto; background: var(--red-d); color: #fff; }
@media (min-width: 520px) { .mode-tab { font-size: 10px; } }

.budget { display: none; white-space: nowrap; font-family: var(--pixel); font-size: 16px; color: var(--t-green); }
.budget::before { content: 'BUDGET '; font-size: 9px; color: inherit; opacity: .75; }
.budget.low { color: var(--t-red); animation: budgetLow 1s steps(2) infinite; }
@keyframes budgetLow { 50% { opacity: .55; } }
body[data-mode="spree"] .budget { display: inline; }
body[data-mode="spree"] .pips,
body[data-mode="spree"] .countdown { display: none; }

.guess-list { display: none; list-style: none; margin: 6px 0 4px; padding: 0; gap: 4px; }
body[data-mode="classic"] .guess-list { display: grid; }
.g-row {
  display: grid; grid-template-columns: 22px auto 1fr; align-items: center; gap: 8px;
  height: 28px; padding: 0 8px;
  border: 2px solid #120c0a;
  font-size: 20px; line-height: 1;
}
.g-row.empty { border-style: dashed; border-color: #8a7a66; opacity: .7; }
.g-n { font-family: var(--pixel); font-size: 9px; }
.g-price { white-space: nowrap; }
.g-hint { justify-self: end; white-space: nowrap; font-family: var(--pixel); font-size: 9px; }
.g-arrow { font-family: var(--vt); font-size: 20px; }
.g-row.g-win { background: var(--t-green); color: #000; }
.g-row.g-close { background: var(--t-yellow); color: #000; }
.g-row.g-far { background: var(--t-red); color: #fff; }

.pd-arrow { display: none; width: calc(4 * var(--u)); height: calc(4 * var(--u)); margin-left: auto; align-self: center; background: var(--led-red); }
.pd-arrow.show { display: block; }
.pd-arrow.up { clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.pd-arrow.down { clip-path: polygon(0 0, 100% 0, 50% 100%); }
.pd-arrow.close { background: #ffd23f; }
.pd-arrow.flash { animation: arrowFlash .5s steps(1) 3; }
@keyframes arrowFlash { 50% { opacity: .1; } }
.pd-guess.yellow { color: #ffd23f; }

.panel.done .done-actions { position: sticky; bottom: 0; z-index: 1; padding-top: 8px; padding-bottom: 4px; background: inherit; }
.btn-again { display: none; width: 100%; margin-top: 8px; background: var(--teal); }
body[data-mode="spree"] .btn-again { display: block; }
.rl.new-best { color: #2b8a43; }

.stats-body h3, .mode-help h3 { margin: 12px 0 6px; font-family: var(--pixel); font-size: 10px; }
.stats-body h3:first-child { margin-top: 0; }
.stats-body h4 { margin: 10px 0 4px; font-size: 18px; font-weight: normal; }
.stat-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; }
.stat b { display: block; font-family: var(--pixel); font-size: 18px; font-weight: normal; }
.stat span { font-size: 16px; line-height: 1; }
.dist { display: grid; gap: 3px; margin-bottom: 8px; }
.dist-row { display: grid; grid-template-columns: 16px 1fr; align-items: center; gap: 6px; font-size: 18px; }
.dist-bar {
  min-width: 22px; padding: 2px 5px 1px; text-align: right;
  font-family: var(--pixel); font-size: 9px; line-height: 1.4;
  background: #8a7a66; color: #fff;
}
.dist-bar.today { background: var(--t-green); color: #000; }
.stat-best { margin: 0 0 12px; font-size: 20px; }
.mode-help p { margin: 0 0 6px; font-size: 19px; line-height: 1.15; }
.mode-help { margin-bottom: 12px; }
.mh-g { color: #2b8a43; } .mh-y { color: #b98a1c; } .mh-r { color: var(--red-d); }

@media (max-width: 600px) {
  body.typing .guess-list { display: none; }
  body.typing[data-mode="classic"] .guess-list { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 6px; }
  body.typing .g-row { height: 22px; gap: 4px; padding: 0 5px; font-size: 16px; grid-template-columns: auto auto auto; }
  body.typing .g-row.empty, body.typing .g-word { display: none; }
  body.typing .g-arrow { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .pd-arrow.flash, .budget.low { animation: none !important; }
}

.modal-close {
  width: 44px; height: 44px; padding: 0; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -2px -2px 8px 2px; }
.modal-title { font-family: var(--pixel); font-size: 11px; letter-spacing: 1px; }
.help > .modal-close { position: sticky; top: 0; float: right; z-index: 2; margin: -10px -10px 4px 10px; }

.done-bar { display: none; flex-wrap: wrap; gap: 10px; align-items: stretch; }
.panel.play.finished .done-bar { display: flex; }
.panel.play.finished .guess-form,
.panel.play.finished .error,
.panel.play.finished .result { display: none; }
.done-bar .btn { width: auto; margin: 0; flex: 0 0 auto; min-height: 48px; padding-left: 16px; padding-right: 16px; }
.done-bar .bar-countdown { flex: 1 1 170px; margin: 0; padding: 8px 12px; }
.done-bar .bar-countdown span { font-size: 18px; }

.share-opts {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px;
  margin-top: 8px; font-size: 19px;
}
.share-toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; min-height: 32px; }
.share-toggle input { width: 20px; height: 20px; margin: 0; accent-color: var(--green, #3fae5a); }
.link-btn {
  background: none; border: 0; padding: 4px 0; cursor: pointer;
  font: inherit; color: inherit; text-decoration: underline; text-underline-offset: 3px;
}
.share-dialog { max-width: min(480px, calc(100vw - 24px)); width: 100%; }
.share-frame {
  clear: both;
  display: flex; justify-content: center;
  margin: 0 0 8px; min-height: 120px;
}
.share-img {
  display: block; width: auto; height: auto;
  max-width: 100%; max-height: min(58vh, 520px); aspect-ratio: 4 / 5;
  border: 3px solid var(--ink); background: var(--field-inset, #eee);
  -webkit-touch-callout: default;
}
.share-dialog.loading .share-img { opacity: .35; }
.share-hold { margin: 0 0 6px; text-align: center; font-size: 18px; font-weight: bold; }
.share-dialog .share-toggle { display: flex; justify-content: center; font-size: 20px; margin-bottom: 4px; }
.share-spoiler { margin: 0 0 6px; text-align: center; font-size: 17px; color: #c0362d; }
.share-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.share-actions .btn { flex: 1 1 40%; width: auto; text-align: center; text-decoration: none; padding-left: 8px; padding-right: 8px; }
.share-actions #shareNative { flex-basis: 100%; }
.share-status { min-height: 22px; margin: 8px 0 0; text-align: center; font-size: 19px; }
:root[data-theme="dark"] .share-spoiler { color: #ff7a70; }
