html body { background-image: none; }
body::before { content: none; display: none; }

.scene .bg { display: none; }
.scene .store { left: 0; top: 0; z-index: 0; }
.scene .glow {
  inset: 0;
  background:
    radial-gradient(ellipse 70% 55% at 50% 0%, rgba(255, 214, 140, .30), transparent 70%),
    linear-gradient(180deg, rgba(255, 170, 80, .06), rgba(60, 20, 0, .14));
}
:root[data-theme="dark"] .scene .glow {
  background:
    radial-gradient(ellipse 70% 55% at 50% 0%, rgba(255, 214, 140, .16), transparent 70%),
    linear-gradient(180deg, rgba(16, 26, 60, .30), rgba(6, 10, 28, .40));
}

.scene .cashier       { left: var(--ox, 0px);                              top: calc(var(--oy, 0px) + 1 * var(--u)); }
.scene .pole          { left: calc(var(--ox, 0px) + 93 * var(--u));       top: calc(var(--oy, 0px) + 35 * var(--u)); }
.scene .pole-display  { left: calc(var(--ox, 0px) + 56 * var(--u));       top: calc(var(--oy, 0px) + 1 * var(--u)); }
.scene .scanner-glass { left: calc(var(--ox, 0px) + 41 * var(--u));       top: calc(var(--oy, 0px) + 66 * var(--u)); }
.scene .printer       { left: calc(var(--ox, 0px) + 1 * var(--u));        top: calc(var(--oy, 0px) + 48 * var(--u)); }
.scene .register      { left: calc(var(--ox, 0px) + 72 * var(--u));       top: calc(var(--oy, 0px) + 40 * var(--u)); }
.scene .product       { left: calc(var(--ox, 0px) + 38 * var(--u));       top: calc(var(--oy, 0px) + 35 * var(--u)); }
.scene .shelf-tag     { left: calc(var(--ox, 0px) + 21 * var(--u));       top: calc(var(--oy, 0px) + 71 * var(--u)); }
.scene .points-pop    { left: calc(var(--ox, 0px) + 30 * var(--u));       top: calc(var(--oy, 0px) + 26 * var(--u)); }
.scene .counter       { left: 0; width: 100%; top: calc(var(--oy, 0px) + 64 * var(--u)); bottom: 0; height: auto; }
.scene .counter-front { height: calc(100% - 7 * var(--u)); }

.stage-dim {
  display: block; position: fixed; inset: 0; z-index: 30;
  background: rgba(8, 10, 9, .5);
  opacity: 0; pointer-events: none;
  transition: opacity .3s steps(4);
}
body.day-done .stage-dim { opacity: 1; pointer-events: auto; }
body.day-done { overflow: hidden; }
.mode-tabs { position: relative; z-index: 45; }
.panel.done {
  position: fixed; z-index: 40;
  left: 50%; top: var(--modal-top, 12px);
  transform: translateX(-50%);
  width: min(440px, calc(100vw - 24px));
  max-height: calc(100vh - var(--modal-top, 12px) - 12px);
  max-height: calc(100dvh - var(--modal-top, 12px) - 12px);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: receiptUp .5s steps(8) both;
}
@keyframes receiptUp { from { transform: translate(-50%, 40vh); opacity: 0; } 30% { opacity: 1; } }
.panel.done > * { flex: none; }
.panel.done > .receipt-scroll { flex: 0 1 auto; min-height: 60px; overflow-y: auto; overscroll-behavior: contain; }
.panel.done .done-actions { position: static; padding-top: 10px; }
.panel.done .countdown { margin-top: 6px; }

@media (max-width: 899px) {
  .scene-wrap {
    align-self: stretch;
    width: auto;
    margin: 0 calc(-1 * var(--gutter));
    border-left: 0;
    border-right: 0;
    box-shadow: none;
  }
  .scene { width: 100%; height: calc(100 * var(--u)); }
}

@media (min-width: 900px) {
  html, body { height: 100%; overflow: hidden; }
  .app { max-width: none; padding: 0; }
  .layout { display: block; }
  .side { display: contents; }

  .scene-wrap {
    position: fixed; inset: 0; z-index: 0;
    border: 0; box-shadow: none;
    background: #f0dcb6;
  }
  .scene { width: 100vw; height: 100vh; --u: var(--s, 6px); }

  .topbar {
    position: fixed; top: 12px; left: 12px; right: 12px; z-index: 20;
    margin: 0;
    align-items: flex-start;
    pointer-events: none;
  }
  .topbar > * { pointer-events: auto; }
  .brand {
    background: var(--panel);
    border: var(--line);
    box-shadow: var(--shadow);
    padding: 10px 16px 10px 10px;
  }
  .top-actions { transform: translate(calc(-1 * var(--hud-right, 0px)), var(--hud-top, 0px)); }
  .statusbar {
    position: fixed; top: calc(64px + var(--hud-top, 0px)); right: calc(12px + var(--hud-right, 0px)); z-index: 20;
    margin: 0;
    gap: 16px;
    padding: 8px 12px;
    background: var(--panel);
    border: var(--line);
    box-shadow: var(--shadow);
  }

  .bubble {
    position: fixed; z-index: 12;
    top: max(calc(var(--oy) + 9 * var(--s)), var(--modal-top, 0px));
    right: calc(100vw - var(--ox) - 15 * var(--s));
    width: min(380px, calc(var(--ox) + 15 * var(--s) - 24px));
    min-height: 0;
  }
  .bubble::before { top: 22px; left: auto; right: -15px; border: 10px solid transparent; border-right: 0; border-left: 12px solid var(--ink); }
  .bubble::after  { top: 25px; left: auto; right: -9px;  border: 7px solid transparent;  border-right: 0; border-left: 9px solid var(--panel); }

  .panel.play {
    position: fixed; z-index: 15;
    left: 50%; bottom: calc(var(--footer-h, 36px) + 12px);
    transform: translateX(-50%);
    width: min(880px, calc(100vw - 32px));
    padding: 12px 16px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
    grid-template-areas: "head form" "name form" "name hint" "name error" "result result";
    column-gap: 20px;
    align-items: center;
  }
  .item-head { grid-area: head; justify-content: flex-start; gap: 14px; }
  .item-name { grid-area: name; margin: 4px 0 0; align-self: start; --name-fs-base: 33px; }
  .mode-hint { grid-area: hint; margin: 4px 0 0; }
  .panel.play:has(.result:not([hidden])) .mode-hint { display: none; }
  .guess-form { grid-area: form; }
  .error { grid-area: error; margin: 4px 0 0; min-height: 0; }
  .result {
    grid-area: result;
    display: flex; align-items: center; gap: 18px;
    margin-top: 10px; padding-top: 10px;
  }
  .result-row { flex: 1; margin: 0; justify-content: flex-start; gap: 24px; }
  .btn-next { width: auto; margin: 0; padding: 14px 26px 12px; }
  .panel.play:has(.result:not([hidden])) { grid-template-areas: "head result" "name result" "name error"; }
  .panel.play:has(.result:not([hidden])) .guess-form { display: none; }
  .panel.play:has(.result:not([hidden])) .result {
    flex-direction: column; align-items: stretch; gap: 8px;
    margin: 0; padding: 0; border-top: 0;
  }
  .panel.play:has(.result:not([hidden])) .result-row { justify-content: space-between; }
  .panel.play:has(.result:not([hidden])) .btn-next { width: 100%; }

  body.day-done .stage-dim { background: rgba(8, 10, 9, .32); }
  .panel.done {
    left: 12px;
    transform: none;
    width: clamp(300px, calc(var(--ox) + 6 * var(--s) - 24px), 420px);
    max-height: calc(100vh - var(--modal-top, 12px) - var(--footer-h, 36px) - 24px);
    animation-name: receiptUpLeft;
  }
  @keyframes receiptUpLeft { from { transform: translateY(40vh); opacity: 0; } 30% { opacity: 1; } }
  body.day-done .bubble {
    z-index: 35;
    top: calc(var(--oy) + 38 * var(--s));
    left: calc(var(--ox) + 58 * var(--s));
    right: auto;
    width: min(380px, calc(100vw - var(--ox) - 58 * var(--s) - 16px));
  }
  body.day-done .bubble::before { left: -15px; right: auto; border: 10px solid transparent; border-left: 0; border-right: 12px solid var(--ink); }
  body.day-done .bubble::after  { left: -9px;  right: auto; border: 7px solid transparent;  border-left: 0; border-right: 9px solid var(--panel); }
  .panel.play.finished .done-bar { grid-area: form; }

  .footer {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 14;
    margin: 0;
    padding: 5px 16px 6px;
    display: flex; flex-wrap: wrap; justify-content: center; column-gap: 18px;
    background: var(--panel);
    border-top: 3px solid var(--tan);
    font-size: 15px;
    line-height: 1.2;
  }
  .footer p { margin: 0; }
}

@media (min-width: 900px) and (max-height: 820px) {
  .panel.play { padding: 8px 14px; }
  .guess-field input { font-size: 30px; }
  .result { margin-top: 6px; padding-top: 6px; }
  .btn-next { padding: 11px 22px 9px; }
}
@media (min-width: 900px) and (min-height: 1200px) {
  .logo { font-size: 60px; }
  .tagline { font-size: 22px; }
  .bubble-text { font-size: 32px; }
  .bubble-name, .item-count { font-size: 12px; }
  .mode-hint { font-size: 20px; }
  .item-cat { font-size: 22px; }
  .guess-field input { font-size: 46px; }
  .btn { font-size: 15px; }
  .result-diff { font-size: 28px; }
  .result-pts { font-size: 17px; }
  .statusbar { font-size: 24px; }
  .footer { font-size: 18px; }
  .panel.play { width: min(1100px, calc(100vw - 32px)); grid-template-columns: minmax(0, 1fr) minmax(360px, 460px); }
  .bubble { width: min(480px, calc(var(--ox) + 15 * var(--s) - 24px)); }
}

@media (prefers-reduced-motion: reduce) {
  .panel.done { animation: none; }
  .stage-dim { transition: none; }
}

@media (min-width: 900px) {
  .mode-tabs {
    position: fixed; z-index: 45;
    left: 12px; top: var(--tabs-top, 132px);
    margin: 0;
    flex-wrap: nowrap;
  }
  .mode-tab { flex: 0 0 auto; font-size: 10px; padding: 9px 12px 7px; }

  .budget { font-size: 20px; }
  .budget::before { font-size: 10px; }

  body[data-mode="classic"] .panel.play {
    width: min(1060px, calc(100vw - 32px));
    grid-template-columns: minmax(0, 1fr) minmax(220px, 270px) minmax(280px, 360px);
    grid-template-areas: "head list form" "name list form" "name list hint" "name list error" "result result result";
  }
  body[data-mode="classic"] .panel.play:has(.result:not([hidden])) {
    grid-template-areas: "head list result" "name list result" "name list error";
  }
  body[data-mode="classic"] .guess-list { grid-area: list; align-self: center; margin: 0; gap: 3px; }
  body[data-mode="classic"] .g-row { height: 20px; font-size: 18px; padding: 0 6px; }
  body[data-mode="classic"] .g-arrow { font-size: 18px; }
}
@media (min-width: 900px) and (max-width: 1279px) {
  body[data-mode="classic"] .panel.play {
    width: min(880px, calc(100vw - 32px));
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
    grid-template-areas: "head form" "name form" "name hint" "name error" "list list" "result result";
  }
  body[data-mode="classic"] .panel.play:has(.result:not([hidden])) {
    grid-template-areas: "head result" "name result" "name error" "list list";
  }
  body[data-mode="classic"] .guess-list {
    margin-top: 8px; column-gap: 10px;
    grid-template-columns: 1fr 1fr; grid-template-rows: repeat(3, auto); grid-auto-flow: column;
  }
}
@media (min-width: 900px) and (max-height: 820px) {
  .mode-tab { padding: 7px 10px 5px; }
  body[data-mode="classic"] .guess-list { gap: 2px; }
  body[data-mode="classic"] .g-row { height: 17px; font-size: 16px; }
  body[data-mode="classic"] .g-arrow { font-size: 16px; }
}
@media (min-width: 900px) and (min-height: 1200px) {
  .mode-tab { font-size: 12px; padding: 11px 14px 9px; }
  .budget { font-size: 26px; }
  body[data-mode="classic"] .g-row { height: 26px; font-size: 22px; }
  body[data-mode="classic"] .g-arrow { font-size: 22px; }
  .g-n, .g-hint { font-size: 11px; }
}
@media (min-width: 1280px) and (min-height: 1200px) {
  body[data-mode="classic"] .panel.play { width: min(1300px, calc(100vw - 32px)); grid-template-columns: minmax(0, 1fr) minmax(260px, 320px) minmax(360px, 460px); }
}
@media (min-width: 900px) and (max-width: 1279px) and (min-height: 1200px) {
  body[data-mode="classic"] .panel.play { width: min(1100px, calc(100vw - 32px)); grid-template-columns: minmax(0, 1fr) minmax(360px, 460px); }
}
.offline-help {
  border-block: 1px solid currentColor;
  margin: 1rem 0;
  padding: .75rem 0;
}
.offline-help h3 { margin: 0; }
.offline-help p { margin: .25rem 0; }
.offline-help p:empty { margin: 0; }
.offline-help button { max-width: 100%; }
.offline-help progress {
  width: 100%;
  accent-color: var(--green);
}
