/* Costcodle Unlimited — pixel-receipt look. */
:root {
  --gainsboro: #dcdcdc;
  --card: rgb(173, 173, 173);
  --input: rgb(94, 94, 94);
  --red: rgb(227, 42, 54);
  --blue: rgb(0, 96, 169);
  --paper: #f7f4ec;
  --ink: #34333a;
  --ink-soft: #6f6c66;
  --ink-faint: #a8a49a;
  --win: rgb(1, 154, 1);
  --near: rgb(255, 196, 37);
  --far: rgb(255, 37, 37);

  /* --p = art pixel size (keeps pixel art crisp), --ui = chrome multiplier */
  --p: 4;
  --ui: 1;
  --px: calc(var(--p) * 1px);
  --col1-max: calc(81 * var(--px));
  --col2: calc(48 * var(--px));
  --gap: calc(6 * var(--px));
  --board-max: calc(var(--col1-max) + var(--gap) + var(--col2));
  --board-top: calc(20px * var(--ui));
  --card-pad: calc(12px * var(--ui));
  --name-size: calc(24px * var(--ui));
  --status-h: calc(40px * var(--ui));
  --input-h: calc(46px * var(--ui));
  --rcpt-font: calc(18px * var(--ui));
  --rcpt-line: calc(20px * var(--ui));
  --lcd-font: calc(18px * var(--ui));
  --title-font: calc(54px * var(--ui));
  --title-small: calc(46px * var(--ui));
  --sub-font: calc(15px * var(--ui));
  --header-h: calc(72px * var(--ui));
  --tab-h: calc(30px * var(--ui));
  --tab-font: calc(22px * var(--ui));
  --hdr-btn: calc(38px * var(--ui));
  --hdr-icon: calc(24px * var(--ui));
  --hdr-group: calc(80px * var(--ui));
  --hdr-q: calc(50px * var(--ui));
  /* vertical space used by everything except the product image */
  --chrome: calc(458px * var(--ui));
  /* usable height for the full-screen game (minus the in-flow site logo on narrow screens) */
  --vh: 100dvh;
}
/* At <=1000px the EVERYTHINGLE home logo sits in flow above #page (about 35px tall). */
@media (max-width: 1000px) {
  :root { --vh: calc(100dvh - 35px); }
}

@media (min-width: 1500px) and (min-height: 900px) {
  :root { --p: 5; --ui: 1.25; }
}
@media (min-width: 1900px) and (min-height: 1050px) {
  :root { --p: 6; --ui: 1.5; }
}
@media (max-height: 700px) {
  :root { --board-top: 12px; }
}
@media (max-width: 559px) {
  :root {
    --p: 2;
    --ui: 1;
    --col1-max: 1000px;
    --gap: 10px;
    --board-max: 100%;
    --board-top: 12px;
    --card-pad: 8px;
    --name-size: 20px;
    --status-h: 32px;
    --input-h: 44px;
    --rcpt-font: 16px;
    --rcpt-line: 17px;
    --lcd-font: 12px;
    --title-font: 44px;
    --title-small: 36px;
    --sub-font: 13px;
    --header-h: 62px;
    --tab-h: 28px;
    --tab-font: 20px;
    --hdr-btn: 34px;
    --hdr-group: 72px;
    --hdr-q: 42px;
    --chrome: 408px;
  }
  #board { width: 100%; grid-template-columns: minmax(0, 1fr) var(--col2); }
  #header-row { width: 100%; }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
*:focus, *:focus-visible { outline: none; }
.pip:focus-visible, .hdr-btn:focus-visible, .tab:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
[hidden] { display: none !important; }

html, body { background: var(--gainsboro); }
body { font-family: "VT323", monospace; font-size: 30px; color: black; }
button, input { font-family: inherit; }
.red { color: var(--red); }
.blue { color: var(--blue); }

#page { display: flex; flex-direction: column; height: var(--vh); overflow: hidden; }

/* ---------- Header ---------- */
#site-header {
  position: relative; z-index: 10;
  display: flex; flex-direction: column; align-items: center;
  padding-inline: 8px; background: var(--gainsboro);
}
#header-row {
  display: flex; align-items: center; justify-content: space-between;
  width: min(100%, var(--board-max), 100% - 2 * var(--site-logo-space, 0px)); height: var(--header-h);
  border-bottom: 2px solid gray;
}
.hdr-group { display: flex; gap: 2px; width: var(--hdr-group); }
.hdr-group.right { justify-content: flex-end; }
.hdr-btn {
  display: grid; place-items: center;
  width: var(--hdr-btn); height: calc(44px * var(--ui));
  font-size: var(--hdr-q); line-height: 1; color: black;
  border: none; background: none; cursor: pointer;
}
.hdr-btn svg { width: var(--hdr-icon); height: var(--hdr-icon); fill: currentColor; }
.hdr-btn[aria-pressed="true"] { color: var(--blue); }
#logo { display: flex; flex-direction: column; align-items: center; line-height: 1; }
#title { font-size: var(--title-font); font-weight: normal; line-height: 0.95; white-space: nowrap; color: var(--red); }
#title.small { font-size: var(--title-small); }
#subtitle { font-size: var(--sub-font); letter-spacing: 0.42em; margin-right: -0.42em; color: #6f6f6f; }

#mode-tabs { display: flex; align-items: flex-end; gap: calc(28px * var(--ui)); height: var(--tab-h); }
.tab {
  padding: 0 6px 1px; font-size: var(--tab-font); letter-spacing: 1px; color: #6f6f6f;
  border: none; border-bottom: 2px solid transparent; background: none; cursor: pointer;
}
.tab[aria-selected="true"] { color: var(--blue); border-bottom-color: var(--blue); }

/* ---------- Views ---------- */
#center {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  width: 100%; min-height: 0; overflow: hidden;
}
.view { flex: 1 1 auto; display: flex; justify-content: center; width: 100%; min-height: 0; padding-inline: 8px; }
.view[data-view="game"] { align-items: center; }
.view[data-view="about"], .view[data-view="stats"] { align-items: flex-start; }

/* ---------- Shared card ---------- */
.info-card {
  display: flex; flex-direction: column; align-items: center;
  padding: var(--card-pad); border-radius: 8px;
  background: var(--card); box-shadow: 0 3px 10px;
}
.image-box {
  position: relative; display: grid; place-items: center;
  width: 100%; aspect-ratio: 1; overflow: hidden;
  border-radius: 8px; background: white;
  container-type: size;
}
.product-image { width: 100%; height: 100%; object-fit: contain; }
.product-image.pop { animation: art-pop 0.35s steps(4, end); }
@keyframes art-pop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.image-box.img-missing .product-image { visibility: hidden; }
.image-box.img-missing::after {
  content: "PRODUCT PHOTO"; position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 22px; color: #9a9a9a; background: repeating-linear-gradient(45deg, #f1f1f1 0 10px, #fff 10px 20px);
}
/* Site watermark, sits right above the product card so it's in every clip. */
.watermark {
  align-self: center; margin-bottom: calc(6px * var(--ui));
  font-size: calc(22px * var(--ui)); letter-spacing: 1px;
  line-height: 1; color: #6f6f6f; user-select: all;
}

.product-name {
  width: 100%; min-height: 2em; margin-top: 8px;
  font-size: var(--name-size); line-height: 1; text-align: center;
}

/* ---------- Checkout board ---------- */
#board {
  display: grid; grid-template-columns: minmax(0, var(--col1-max)) var(--col2);
  justify-content: center; align-items: stretch; column-gap: var(--gap);
  width: min(100%, var(--board-max)); margin: var(--board-top) 0;
}
#col-play { display: flex; flex-direction: column; min-width: 0; }
#co-card .image-box { max-height: max(130px, var(--vh) - var(--chrome)); }

.price-tag {
  position: absolute; z-index: 1; right: 6px; bottom: 6px;
  padding: 3px 8px 5px; line-height: 1; text-align: right;
  border: 3px solid #111; background: white; box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.25);
  animation: tag-in 0.3s steps(3, end);
}
@keyframes tag-in { from { transform: translateY(30%) rotate(-4deg); opacity: 0; } }
.price-tag .big { font-size: calc(42px * var(--ui)); }
.price-tag .small { font-size: calc(18px * var(--ui)); color: #555; }
.price-tag .off { color: var(--red); }

#round-status {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--status-h); padding: 0 4px; font-size: calc(24px * var(--ui));
}
#pips { display: flex; gap: 5px; }
.pip { display: block; width: 12px; height: 12px; border: 0; padding: 0; background: #b9b9b9; box-shadow: inset 0 0 0 2px #8f8f8f; }
button.pip { cursor: pointer; appearance: none; }
.pip.done { background: var(--blue); box-shadow: none; }
.pip.current { background: none; box-shadow: inset 0 0 0 2px var(--red); }
.pip.viewing { background: var(--blue); box-shadow: inset 0 0 0 2px var(--red); }

.input-row { display: flex; width: 100%; height: var(--input-h); gap: 5px; }
.text-input {
  display: flex; flex: 2; min-width: 0; overflow: hidden;
  border: 1px solid black; border-radius: 8px; background: gray;
}
.input-label {
  display: flex; flex: 0 0 calc(40px * var(--ui)); align-items: center; justify-content: center;
  font-size: calc(28px * var(--ui)); border-right: 2px solid black; background: var(--card);
}
.guess-input {
  flex: 1; min-width: 0; padding-left: 6px;
  font-size: calc(24px * var(--ui)); color: gainsboro;
  border: none; border-radius: 0; background: var(--input); appearance: none;
}
.guess-input::placeholder { color: gainsboro; }
.guess-input:disabled { opacity: 0.75; }
.button-wrap { flex: 1; max-width: 110px; overflow: hidden; border-radius: 8px; box-shadow: inset 0 0 5px; }
.guess-button {
  width: 100%; height: 100%; font-size: calc(24px * var(--ui)); color: var(--red);
  border: none; background: var(--card); cursor: pointer;
}
.guess-button:not(:disabled):hover { background: rgba(0, 96, 169, 0.5); }
.guess-button:disabled { color: #777; cursor: default; }

.pill {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; height: 100%; min-height: calc(44px * var(--ui));
  font-size: calc(26px * var(--ui)); color: white;
  border: none; border-radius: 32px; background: var(--red); cursor: pointer;
}
.pill:hover { background: rgba(227, 42, 54, 0.8); }
.pill.blue { background: var(--blue); }
.pill.blue:hover { background: rgba(0, 96, 169, 0.8); }
.pill svg { height: 0.9em; width: 0.9em; fill: currentColor; }

/* ---------- Printer ---------- */
#col-printer { position: relative; align-self: stretch; min-height: calc(24 * var(--px)); }
#printer { position: absolute; left: 0; bottom: 0; width: calc(48 * var(--px)); height: calc(24 * var(--px)); }
.printer-layer { position: absolute; inset: 0; }
.printer-layer svg { display: block; width: 100%; height: 100%; }
#printer-back { z-index: 4; }
#printer-front { z-index: 6; }
#lcd {
  position: absolute; z-index: 7;
  left: calc(5 * var(--px)); top: calc(8 * var(--px));
  width: calc(26 * var(--px)); height: calc(10 * var(--px));
  padding: 1px var(--px) 0;
  display: flex; flex-direction: column; justify-content: center; overflow: hidden;
  font-size: var(--lcd-font); line-height: 1; white-space: nowrap; color: #1e2b17;
}
#lcd-round, #lcd-label { font-size: 0.72em; letter-spacing: 0.04em; opacity: 0.75; }
#lcd-sum { display: flex; align-items: baseline; justify-content: space-between; gap: 0.25em; }
#lcd-label { flex: none; }
#lcd-total { flex: 1 1 auto; min-width: 0; overflow: hidden; text-align: right; font-variant-numeric: tabular-nums; }
#printer-led {
  position: absolute; z-index: 8;
  left: calc(36 * var(--px)); top: calc(16 * var(--px));
  width: calc(2 * var(--px)); height: calc(2 * var(--px));
  background: #6be06b; box-shadow: 0 0 calc(0.6 * var(--px)) rgba(107, 224, 107, 0.55);
}
#printer.printing { animation: shake 0.22s steps(2, end) infinite; transform-origin: 50% 100%; }
#printer.printing #printer-led { animation: flicker 0.18s steps(2, end) infinite; }
#printer.yank { animation: yank 0.28s steps(2, end); transform-origin: 50% 100%; }
@keyframes shake {
  0%, 100% { transform: none; }
  25% { transform: translate(0.6px, -0.4px) rotate(-0.35deg); }
  50% { transform: translate(-0.7px, 0.3px) rotate(0.4deg); }
  75% { transform: translate(0.5px, 0.5px) rotate(-0.25deg); }
}
@keyframes flicker { 0%, 100% { opacity: 1; } 45% { opacity: 0.35; } 75% { opacity: 0.85; } }
@keyframes yank {
  35% { transform: translate(-1.5px, 1px) rotate(-1.1deg); }
  70% { transform: translate(1.2px, -0.5px) rotate(0.8deg); }
}
@media (max-width: 559px) {
  #lcd { padding: 0 1px; justify-content: space-evenly; }
  #lcd-label { display: none; }
  #lcd-total { text-align: left; font-size: 1em; letter-spacing: -0.03em; }
}

/* ---------- Receipt tape ---------- */
#paper {
  position: absolute; z-index: 5;
  left: calc(4 * var(--px)); bottom: calc(20 * var(--px)); width: calc(40 * var(--px));
  display: flex; flex-direction: column; overflow: hidden;
}
#paper.torn { opacity: 0; }
#paper.overflow::before {
  content: ""; position: absolute; z-index: 3; left: 0; right: 0; top: 0;
  height: calc(12 * var(--px)); pointer-events: none;
  background: linear-gradient(to bottom, var(--gainsboro), rgba(220, 220, 220, 0));
}
.roll {
  flex: none; display: flex; flex-direction: column;
  filter: drop-shadow(calc(0.5 * var(--px)) 0 calc(0.5 * var(--px)) rgba(0, 0, 0, 0.18));
}
.edge {
  flex: none; height: calc(2 * var(--px));
  background-repeat: repeat-x; background-size: calc(4 * var(--px)) calc(2 * var(--px));
  image-rendering: pixelated;
}
.edge.top { background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='4' height='2' shape-rendering='crispEdges' fill='%23f7f4ec'><rect x='1' width='2' height='1'/><rect y='1' width='4' height='1'/></svg>"); }
.edge.bottom { background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='4' height='2' shape-rendering='crispEdges' fill='%23f7f4ec'><rect width='4' height='1'/><rect x='1' y='1' width='2' height='1'/></svg>"); }
.rsheet { font-size: var(--rcpt-font); line-height: var(--rcpt-line); color: var(--ink); background: var(--paper); }
.rstub { padding: 2px calc(2 * var(--px)) 0; text-align: center; }
.rlogo { font-size: calc(var(--rcpt-font) * 1.35); line-height: 1; letter-spacing: 1px; color: var(--red); }
.rlogo span { color: var(--blue); }
.rmeta { display: flex; justify-content: space-between; font-size: calc(var(--rcpt-font) * 0.85); line-height: 1.1; color: var(--ink-soft); }
.rdash {
  height: 2px; margin: 3px calc(2 * var(--px));
  background: repeating-linear-gradient(to right, var(--ink-faint) 0 4px, transparent 4px 8px);
}
.rline { display: flex; align-items: baseline; gap: 0.35em; padding: 0 calc(2 * var(--px)); white-space: nowrap; }
.rline .n, .rline .amt { flex: none; }
.rline .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; text-transform: uppercase; }
.rline .lead { display: none; flex: 1; min-width: 4px; border-bottom: 2px dotted var(--ink-faint); }
.rtotal { font-size: calc(var(--rcpt-font) * 1.15); }
.rtotal .lead { display: block; }
.lbl-short { display: none; }
.feed { position: relative; flex: none; }
.feed::before, .feed::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: calc(2 * var(--px));
  background-image: linear-gradient(to bottom, transparent calc(var(--period, 100px) - 2px), var(--ink-faint) 0);
  background-size: 100% var(--period, 100px);
  background-position: left 0 bottom var(--shift, 0px);
}
.feed::before { left: 0; }
.feed::after { right: 0; }
.feed .mark {
  position: absolute; left: 0; right: 0; transform: translateY(50%);
  font-size: calc(var(--rcpt-font) * 0.8); line-height: 1; text-align: center; color: var(--ink-faint);
}
@media (max-width: 559px) {
  .rlogo { font-size: calc(var(--rcpt-font) * 1.1); }
  .rline { gap: 0.25em; }
  .rtotal { font-size: var(--rcpt-font); }
  .rline .name, .lbl-long { display: none; }
  .rline .lead, .lbl-short { display: block; }
  .rmeta { justify-content: center; }
  .rmeta span + span { display: none; }
}

/* ---------- Classic ---------- */
#classic {
  --img: clamp(96px, calc(var(--vh) - var(--header-h) - var(--tab-h) - 476px), 300px);
  display: flex; flex-direction: column; align-items: center;
  width: 100%; max-width: 340px; margin: 0 auto;
}
#cl-card { margin: 0 0 12px; }
#classic > .watermark { margin-top: 12px; }
#cl-card .image-box { width: var(--img); height: var(--img); }
#cl-card .product-name { width: var(--img); font-size: clamp(16px, calc(var(--img) * 0.08), 24px); margin-top: 10px; min-height: 0; }
#cl-status { min-height: 1.1em; margin-bottom: 8px; font-size: clamp(18px, 2.4vh, 24px); line-height: 1.1; text-align: center; }
#cl-rows { display: flex; flex-direction: column; gap: 5px; width: min(324px, 100%); padding: 3px; }
.row { display: flex; gap: 5px; height: 34px; border-radius: 8px; background: gray; box-shadow: inset 0 0 5px; }
.row.filled { background: transparent; box-shadow: none; }
.row .val, .row .dir {
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  border-radius: 8px; box-shadow: inset 0 0 5px; font-size: clamp(22px, 2.8vh, 28px);
}
.row .val { flex: 2; background: gray; }
.row .dir { flex: 1; font-weight: bold; color: rgba(0, 0, 0, 0.5); }
.dir.win { background: var(--win); }
.dir.near { background: var(--near); }
.dir.far { background: var(--far); }
#cl-input { height: 42px; margin-top: 0; }
#cl-input .text-input { align-self: center; height: 40px; }
#cl-input .input-label { flex: 0 0 30px; font-size: 28px; }
#cl-input .guess-input, #cl-input .guess-button { font-size: 24px; }
#cl-input .button-wrap { max-width: none; height: 40px; align-self: center; }
#cl-input .pill { min-height: 0; font-size: 26px; }
@media (max-height: 760px) {
  .row { height: 30px; }
  #cl-card { margin: 0 0 8px; padding: 8px; }
  #classic > .watermark { margin-top: 8px; }
}

/* ---------- About / stats panels ---------- */
.panel {
  width: min(100%, 380px); margin: var(--board-top) 0;
  max-height: calc(var(--vh) - var(--header-h) - var(--tab-h) - 24px);
  padding-right: 10px; overflow: auto; overscroll-behavior: contain;
}
.info { font-size: 20px; line-height: 1.15; }
.info-section { margin-top: 8px; padding-bottom: 8px; border-bottom: 2px solid gray; }
.info-section:last-child { border-bottom: none; }
.info-section h3 { margin-bottom: 6px; font-weight: normal; text-decoration: underline; }
.info-section p { margin: 4px 0; }
.info-section ul { margin: 6px 0 6px 1.1rem; list-style: square; }
.info .row { height: 36px; margin: 8px 0 4px; max-width: 320px; }
.info .pill { height: 44px; margin-top: 10px; font-size: 24px; }
.mini-receipt {
  margin: 8px auto; width: 230px; padding: 6px 10px;
  font-size: 18px; line-height: 1.1; color: var(--ink);
  background: var(--paper); box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.15);
}
.lead-row { display: flex; align-items: baseline; gap: 0.35em; }
.lead-row i { flex: 1; border-bottom: 2px dotted var(--ink-faint); }

#stats { width: 100%; display: flex; justify-content: center; }
.cl-stats { width: min(100%, 360px); margin: var(--board-top) 0; text-align: center; }
.cl-stats > p { margin: 6px 0 14px; }
.stat-row { display: flex; justify-content: space-evenly; margin-bottom: 22px; }
.stat-row b { display: block; font-size: 60px; font-weight: normal; line-height: 1; }
.stat-row span { font-size: 22px; }
.graph-row { display: flex; align-items: center; height: 26px; margin-bottom: 10px; font-size: 24px; }
.graph-row .gl { width: 1ch; margin-right: 8px; }
.graph-row .gb { min-width: 22px; padding-right: 5px; text-align: right; color: white; background: var(--blue); }
.graph-row .gb.zero { background: gray; }

/* ---------- Paper cards (receipts) ---------- */
.paper-card {
  --mpx: 4px;
  position: relative; display: flex; flex-direction: column;
  width: min(100% - 16px, 360px); margin: var(--board-top) 0;
  filter: drop-shadow(0 5px 8px rgba(0, 0, 0, 0.28));
}
.tear {
  flex: none; height: calc(3 * var(--mpx));
  background-repeat: repeat-x; background-size: calc(12 * var(--mpx)) calc(3 * var(--mpx));
  image-rendering: pixelated;
}
.tear.top { background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 3' shape-rendering='crispEdges' fill='%23f7f4ec'><rect x='2' width='2' height='1'/><rect x='7' width='3' height='1'/><rect y='1' width='5' height='1'/><rect x='6' y='1' width='5' height='1'/><rect y='2' width='12' height='1'/></svg>"); }
.tear.bottom { background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 3' shape-rendering='crispEdges' fill='%23f7f4ec'><rect width='12' height='1'/><rect y='1' width='5' height='1'/><rect x='6' y='1' width='5' height='1'/><rect x='2' y='2' width='2' height='1'/><rect x='7' y='2' width='3' height='1'/></svg>"); }
.sheet {
  position: relative; min-height: 0; padding: 6px 18px 14px;
  font-size: 20px; line-height: 1.1; color: var(--ink); background: var(--paper);
}
.stats-card { max-height: calc(var(--vh) - var(--header-h) - var(--tab-h) - 24px); }
.stats-card .sheet { overflow: auto; }
.f-logo { font-size: 40px; line-height: 1; text-align: center; color: var(--red); }
.f-logo span { color: var(--blue); }
.f-center { text-align: center; }
.f-faint { color: var(--ink-soft); }
.f-dash { height: 2px; margin: 8px 0; background: repeating-linear-gradient(to right, var(--ink-faint) 0 6px, transparent 6px 10px); }
.f-dash.double {
  height: 6px;
  background:
    repeating-linear-gradient(to right, var(--ink) 0 6px, transparent 6px 10px) top / 100% 2px no-repeat,
    repeating-linear-gradient(to right, var(--ink) 0 6px, transparent 6px 10px) bottom / 100% 2px no-repeat;
}
.f-grid { display: grid; grid-template-columns: 1.6ch repeat(3, minmax(0, 1fr)); column-gap: 6px; text-align: right; white-space: nowrap; }
.f-grid > :first-child { text-align: left; }
.f-head { font-size: 16px; color: var(--ink-soft); }
.f-item { display: grid; grid-template-columns: 1.6ch minmax(0, 1fr); column-gap: 6px; margin-top: 4px; }
.f-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.f-total { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 24px; }
.f-amt { font-size: 40px; line-height: 1; white-space: nowrap; }
.f-amt.long { font-size: 30px; }
.f-rating { display: flex; flex-direction: column; align-items: center; font-size: 28px; line-height: 1; }
.f-rating span:first-child { font-size: 16px; }
.f-row { display: flex; justify-content: space-between; margin: 8px 0; }
.f-btns { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.f-btns .pill { height: 46px; }
.f-close {
  position: absolute; top: 2px; right: 8px; font-size: 34px; line-height: 1;
  color: var(--ink-soft); border: none; background: none; cursor: pointer;
}
.barcode {
  height: 36px; margin: 10px 12px 4px;
  background: repeating-linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 4px, var(--ink) 4px 5px, transparent 5px 8px, var(--ink) 8px 11px, transparent 11px 12px);
}
.s-grid { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; }
.s-grid b { display: block; font-size: 32px; font-weight: normal; line-height: 1; white-space: nowrap; }
.s-bar:empty { padding: 0; }
@media (max-width: 559px) { .s-grid b { font-size: 26px; } }
.s-grid span { display: block; font-size: 15px; line-height: 1; color: var(--ink-soft); }
.s-bar-row { display: grid; grid-template-columns: 6ch 1fr; align-items: center; gap: 6px; margin: 6px 0; font-size: 18px; }
.s-bar { height: 18px; padding-right: 4px; line-height: 18px; text-align: right; color: var(--paper); background: var(--ink); }
@media (max-width: 559px) {
  .paper-card { --mpx: 3px; }
  .sheet { padding: 6px 12px 12px; font-size: 18px; }
}

/* ---------- End modal + tear-off flight ---------- */
#end-modal {
  position: fixed; inset: 0; z-index: 20; display: grid; place-items: center;
  padding: 16px 12px; background: rgba(40, 40, 40, 0.45);
}
#end-modal.tearing { background: rgba(40, 40, 40, 0); pointer-events: none; }
#end-modal.tearing .paper-card { opacity: 0; }
#end-modal.tearing.flying { transition: background 0.55s ease; background: rgba(40, 40, 40, 0.45); }
.paper-card.final { width: min(360px, 100%); max-height: calc(100dvh - 32px); margin: 0; }
.final .sheet { overflow-y: auto; }
.flyer {
  position: fixed; z-index: 30; overflow: hidden; pointer-events: none; transform-origin: 50% 100%;
  filter: drop-shadow(calc(0.5 * var(--px)) 0 calc(0.5 * var(--px)) rgba(0, 0, 0, 0.18));
  transition: left 0.58s cubic-bezier(0.2, 0.85, 0.25, 1), top 0.58s cubic-bezier(0.2, 0.85, 0.25, 1),
    width 0.58s cubic-bezier(0.2, 0.85, 0.25, 1), height 0.58s cubic-bezier(0.2, 0.85, 0.25, 1), filter 0.58s ease;
}
.flyer.ripping { animation: rip 0.3s steps(2, end) forwards; }
.flyer.flying { filter: drop-shadow(0 5px 8px rgba(0, 0, 0, 0.28)); }
.flyer > * { position: absolute; inset: 0; transition: opacity 0.4s ease 0.12s; }
.flyer .f-modal { display: flex; flex-direction: column; width: 100% !important; margin: 0 !important; max-height: none !important; opacity: 0; filter: none; }
.flyer .f-modal .sheet { flex: 1 1 auto; overflow: hidden; }
.flyer.flying .f-tape { opacity: 0; }
.flyer.flying .f-modal { opacity: 1; }
@keyframes rip {
  20% { transform: translate(-3px, -2px) rotate(-1.8deg) scale(1.01); }
  45% { transform: translate(4px, -12px) rotate(1.6deg) scale(1.02); }
  70% { transform: translate(-2px, -20px) rotate(-0.8deg) scale(1.03); }
  100% { transform: translate(0, -26px) rotate(0.3deg) scale(1.04); }
}

/* ---------- Toast ---------- */
#toast-anchor { position: fixed; z-index: 40; transform: translate(-50%, -50%); pointer-events: none; }
#toast-anchor.hide { display: none; }
.toast {
  padding: 8px 16px; font-size: 22px; white-space: nowrap; color: white;
  border-radius: 6px; background: #333; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
