/* 同生零食铺 — one red/ivory interface, square pixel edges, transform-only entrances. */
:root{--shop-red:#bb343d;--shop-dark:#793039;--shop-ink:#35464c;--shop-muted:#727f7b;--shop-paper:#fffbee;--shop-line:#c9cec1;--shop-green:#557c66}
body{background:#e9ece3;color:var(--shop-ink);overflow-x:hidden}
.game-wrap{max-width:1280px;padding:0 24px;margin:auto}
.snack-game{font-family:"Microsoft YaHei","PingFang SC",sans-serif;padding:20px 0 44px;color:var(--shop-ink)}
.game-heading{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:18px 22px;background:var(--shop-paper);border:2px solid var(--shop-line);border-top:5px solid var(--shop-red);margin-bottom:18px;box-shadow:4px 4px 0 #d0d6ca}
.game-heading h1{margin:4px 0 7px;font-size:27px;letter-spacing:3px;color:var(--shop-red)}
.game-heading p{font-size:12px;margin:0;color:var(--shop-muted);line-height:1.7}
.game-heading .pixel-kicker{font:10px Consolas,monospace;letter-spacing:3px;color:var(--shop-red)}
.heading-actions{display:flex;align-items:center;justify-content:flex-end;gap:10px;flex-wrap:wrap;max-width:380px}
.save-status{font-size:11px;color:var(--shop-muted)}
.game-stage{position:relative;display:flex;flex-direction:column;margin:auto;max-width:1152px;background:var(--shop-paper);border:3px solid #62716d;box-shadow:6px 6px 0 #c2cbbd;isolation:isolate}
.game-stage canvas{display:block;width:100%;height:auto;aspect-ratio:3/2;image-rendering:pixelated;image-rendering:crisp-edges;touch-action:manipulation;cursor:pointer}
.stage-hud{order:-1;display:flex;align-items:center;gap:12px;padding:10px 12px;flex-wrap:wrap;background:var(--shop-paper);border-bottom:3px solid var(--shop-red)}
.game-stats{display:flex;gap:16px;flex-wrap:wrap}
.game-stats>div{display:flex;align-items:baseline;gap:7px;border-right:1px solid var(--shop-line);padding-right:14px}
.game-stats span{font-size:10px;color:var(--shop-muted)}
.game-stats strong{font:700 17px Consolas,monospace;color:var(--shop-dark)}
.hud-day{font-size:10px;margin-left:auto;color:var(--shop-muted);line-height:1.8;font-variant-numeric:tabular-nums}
.stage-message{font-size:11px;color:var(--shop-muted);padding:9px 14px;border-top:1px solid var(--shop-line);min-height:32px;background:var(--shop-paper)}
.stage-popovers{position:absolute;inset:0;pointer-events:none;z-index:5}
.popover{position:absolute;pointer-events:auto;width:310px;max-height:480px;overflow-y:auto;background:var(--shop-paper);border:2px solid var(--shop-red);box-shadow:4px 4px 0 #53615855;animation:panel-in .16s steps(4,end)}
.pixel-panel{padding:12px}
.panel-title{display:flex;align-items:center;justify-content:space-between;gap:8px;padding-bottom:9px;margin-bottom:9px;border-bottom:2px solid var(--shop-line);font-size:13px;font-weight:700}
.panel-title span:last-child{font-size:10px;padding:3px 6px;background:#f1ded0;color:var(--shop-dark)}
.product-list,.upgrade-list,.active-orders,.ledger-list{display:grid;gap:8px}
.shelf-row-card{border:1px solid var(--shop-line);background:#f5f5e9;padding:7px}
.shelf-row-top{display:flex;gap:8px;align-items:center}
.product-swatch{display:inline-block;position:relative;width:18px;height:22px;flex:none;border:2px solid #687a7055;box-shadow:inset 0 3px #ffffff77,inset 0 -3px #00000018}
.product-swatch:after{content:'';position:absolute;top:7px;left:3px;right:3px;height:5px;background:#fff4cfbb}
.row-select{min-width:0;flex:1;background:var(--shop-paper);border:1px solid #aeb9ab;padding:5px;font:12px inherit;color:var(--shop-ink)}
.shelf-row-foot{display:grid;gap:6px;margin-top:6px}
.shelf-row-foot small{font-size:10px;color:var(--shop-muted)}
.shelf-row-foot .row-actions{display:grid;grid-template-columns:repeat(3,1fr);gap:5px}
button,select{font-family:inherit}
button{cursor:pointer}
.pixel-button,.mini-button,.night-open,.nr-clear,.phone-back{border:1px solid var(--shop-dark);border-bottom-width:3px;padding:8px 13px;background:var(--shop-red);color:#fff8e5;font-size:12px;font-weight:700;border-radius:0;transition:transform .12s}
.mini-button{font-size:11px;min-height:30px;padding:5px 9px}
.pixel-button-light,.nr-clear,.phone-back{background:var(--shop-paper);color:var(--shop-dark);border-color:#b7bdb0}
button:hover:not(:disabled){filter:brightness(1.06)}
button:active:not(:disabled){transform:translateY(2px)}
button:disabled{cursor:not-allowed;opacity:.42}
button:focus-visible,select:focus-visible{outline:3px solid #d69d3f;outline-offset:3px}
.phone-button{position:absolute;z-index:8;right:14px;bottom:46px;display:flex;align-items:center;gap:8px;border:2px solid var(--shop-dark);padding:10px 12px;background:var(--shop-paper);color:var(--shop-dark);box-shadow:3px 3px 0 #54615d66;font-size:12px;font-weight:700}
.phone-button i{display:block;width:14px;height:21px;border:2px solid var(--shop-ink);background:#76958c;box-shadow:inset 0 -4px var(--shop-paper)}
.phone-button:after{content:'店长手机'}
.phone-button.is-active{background:var(--shop-red);color:var(--shop-paper)}
.phone-shell{position:absolute;right:14px;bottom:99px;width:344px;max-width:calc(100% - 28px);height:480px;max-height:calc(100% - 125px);display:flex;flex-direction:column;z-index:9;border:5px solid #35444c;background:var(--shop-paper);box-shadow:5px 5px 0 #35444c55;animation:panel-in .18s steps(4,end)}
.phone-statusbar{height:33px;display:flex;justify-content:space-between;align-items:center;padding:6px 42px 6px 12px;background:var(--shop-red);color:#fff4db;font:11px Consolas,monospace}
.phone-status-icons{display:flex;align-items:center;gap:5px}
.phone-close{position:absolute;right:5px;top:3px;width:26px;height:26px;border:1px solid #fff5d9;background:transparent;color:#fff5d9;font-size:18px;z-index:2}
.phone-island{display:none}
.phone-screen{overflow:auto;flex:1;padding:14px;min-height:0;scrollbar-width:thin;scrollbar-color:#acb8aa transparent}
.phone-homebar{height:8px;background:#35444c}
.phone-greeting{font-size:21px;font-weight:bold;line-height:1.7;margin:0 0 16px;color:var(--shop-dark)}
.phone-greeting small{font-size:11px;font-weight:normal;color:var(--shop-muted)}
.phone-apps{display:grid;grid-template-columns:repeat(3,1fr);gap:14px 8px}
.phone-app{border:0;background:none;display:flex;flex-direction:column;align-items:center;gap:7px;font-size:11px;color:var(--shop-ink)}
.phone-app i{font-style:normal;display:grid;place-items:center;width:52px;height:48px;background:#efe6c9;border:2px solid #8e9c8c;box-shadow:3px 3px 0 #cbd0be;font-size:21px;font-weight:bold;color:#69765c}
.app-supply i{background:#d9e7e6;color:#477b82}.app-upgrades i{background:#e9dabf;color:#a67437}.app-ledger i{background:#d6e2ce;color:#547454}.app-hq i{background:#edd1cb;color:var(--shop-red)}
.phone-widget{margin-top:22px;padding:12px;border:1px solid var(--shop-line);border-top:3px solid var(--shop-red);display:grid;grid-template-columns:1fr 75px;gap:12px;background:#f1f1e3}
.phone-widget span{display:block;font-size:10px;color:var(--shop-muted)}
.widget-main strong{display:block;font:700 25px Consolas,monospace;color:var(--shop-dark);padding:8px 0}
.widget-main em{font-style:normal}.widget-main small{font-size:12px;color:var(--shop-muted)}
.widget-side{display:grid;gap:8px}.widget-side>div{display:flex;justify-content:space-between;gap:5px;align-items:center}.widget-side strong{font-size:12px}
.widget-bar,.order-progress{height:6px;background:#d6decc}.widget-bar i,.order-progress i{display:block;height:100%;background:var(--shop-green)}
.phone-page-head{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-bottom:12px}.phone-page-head strong{font-size:15px}.phone-page-head span{font-size:10px;color:var(--shop-muted)}
.phone-back{font-size:10px;padding:5px 7px}.phone-cats{display:flex;gap:5px;overflow:auto;margin-bottom:12px;padding:2px 0 5px}
.phone-cat,.nr-bookmark{flex:none;background:#efefdf;border:1px solid var(--shop-line);padding:6px 9px;font-size:11px;color:var(--shop-muted)}
.phone-cat.is-active,.nr-bookmark.is-active{background:var(--shop-red);color:var(--shop-paper);border-color:var(--shop-red)}
.product-row,.upgrade-row,.order-row,.ledger-row{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:8px;background:#f3f3e6;border:1px solid var(--shop-line);padding:9px;font-size:11px}
.product-info,.upgrade-info{display:flex;gap:9px;align-items:center;min-width:0}.product-info b,.upgrade-info b{display:block;font-size:12px;line-height:1.8}.product-info small,.upgrade-info small,.ledger-row small{display:block;font-size:10px;line-height:1.7;color:var(--shop-muted)}
.row-actions{display:flex;gap:5px}.stock-value{font:700 17px Consolas,monospace;color:var(--shop-dark)}
.subsection-title{margin:16px 0 8px;font-size:12px;font-weight:bold;border-bottom:1px solid var(--shop-line);padding-bottom:7px}
.empty-panel{padding:12px;border:1px dashed var(--shop-line);font-size:11px;line-height:1.8;color:var(--shop-muted)}
.ledger-summary{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:12px;font-size:11px}.ledger-summary>div{display:flex;justify-content:space-between;padding:8px;background:#eeeedd}.ledger-row.income{border-left:3px solid var(--shop-green)}.ledger-row.expense{border-left:3px solid var(--shop-red)}
.text-button{border:0;background:none;color:var(--shop-red);text-decoration:underline;margin-top:15px;padding:5px}
.order-progress{margin-top:6px}.ledger-note-mark{color:var(--shop-muted)}
.scene-overlay{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;background:#ebeee5;z-index:10;font-size:14px}
.pixel-loader{width:12px;height:12px;background:var(--shop-red);box-shadow:18px 0 #d5ad56,36px 0 #659576;animation:pixel-hop .8s steps(2,end) infinite}
.is-hidden{display:none!important}
.compact-stage .stage-popovers{position:static;pointer-events:auto}
.compact-stage .popover{position:relative!important;left:auto!important;top:auto!important;width:auto;max-height:340px;margin:8px;box-shadow:none}
.game-toast{position:fixed;z-index:100;left:50%;bottom:24px;max-width:calc(100vw - 32px);padding:12px 18px;background:#35464c;color:var(--shop-paper);border:2px solid #c8d0b7;font:12px "Microsoft YaHei",sans-serif;pointer-events:none;visibility:hidden;transform:translate(-50%,16px);box-shadow:4px 4px 0 #35464c33}
.game-toast.is-visible{visibility:visible;transform:translate(-50%,0);transition:transform .15s}
.pixel-dialog{padding:20px;max-width:560px;width:calc(100% - 32px);border:3px solid var(--shop-red);background:var(--shop-paper);color:var(--shop-ink);font-family:"Microsoft YaHei",sans-serif}
.pixel-dialog::backdrop{background:#263a48aa}.pixel-dialog ol{padding-left:22px;font-size:12px;line-height:1.9}.pixel-dialog p{font-size:13px;line-height:1.8}
.dialog-title{display:flex;align-items:center;justify-content:space-between;border-bottom:2px solid var(--shop-red);padding-bottom:12px;color:var(--shop-dark)}.dialog-title button{border:1px solid var(--shop-line);background:none;padding:5px;color:var(--shop-muted)}.dialog-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:20px}
/* The closing book is mounted on body by game-ui; all selectors stand on their own. */
.night-overlay{position:fixed;inset:0;z-index:50;display:grid;place-items:center;padding:28px;background:#23394bea;font-family:"Microsoft YaHei",sans-serif;color:var(--shop-ink);overflow-y:auto}
.night-sky{position:absolute;inset:0;overflow:hidden;pointer-events:none;background:repeating-linear-gradient(0deg,transparent 0 63px,#edf3eb05 63px 64px)}
.night-moon{position:absolute;right:8%;top:7%;width:30px;height:30px;background:#f0e4b7;box-shadow:8px -6px 0 #23394b}.night-star{position:absolute;width:3px;height:3px;background:#cbd8dd}.star-1{left:8%;top:10%}.star-2{left:26%;top:7%}.star-3{left:44%;top:13%}.star-4{left:66%;top:8%}.star-5{left:83%;top:18%}.star-6{left:15%;top:87%}.star-7{left:71%;top:88%}.star-8{left:92%;top:78%}
.night-cloud,.night-skyline{display:none}
.night-book{position:relative;display:grid;grid-template-columns:.85fr 1.15fr;width:min(940px,96vw);max-height:calc(100dvh - 56px);background:#99313b;border:5px solid #87323b;padding:9px;box-shadow:9px 9px 0 #142a3b;animation:panel-in .2s steps(4,end);min-height:420px}
.nb-cover,.nb-spine{display:none}.nb-page{display:flex;min-height:0;min-width:0;background:var(--shop-paper)}.nb-page.left{border-right:2px solid #c5bfaa}.nb-paper{display:flex;flex:1;flex-direction:column;padding:24px;min-width:0;min-height:0}
.nb-page-head{display:flex;justify-content:space-between;align-items:center;gap:10px;border-bottom:3px solid var(--shop-red);padding-bottom:16px;margin-bottom:16px}
.nb-page-head h3{margin:0 0 7px;color:var(--shop-dark);font-size:22px;letter-spacing:2px}.nb-page-head-text>span{font:10px Consolas,monospace;color:var(--shop-muted)}
.night-stamp{color:var(--shop-red);border:2px solid var(--shop-red);padding:8px;font-size:13px;transform:rotate(-8deg);white-space:nowrap}
.nb-ledger{list-style:none;padding:0;margin:0;font-size:13px;display:grid;gap:15px}.nb-ledger li{display:flex;align-items:baseline;gap:8px}.nb-ledger i{flex:1;border-bottom:1px dotted #b9b9a7}.nb-ledger strong{font:700 19px Consolas,monospace}
.night-goal-bar{height:16px;background:#e3e6d6;position:relative;margin:20px 0 10px}.night-goal-bar i{display:block;height:100%;background:#7a9b70}.night-goal-bar b{position:absolute;inset:0;text-align:center;font:10px/16px Consolas;color:#324435}
.night-note{font-size:12px;line-height:1.8;padding:10px;background:#f0edda;border-left:3px solid #b7b694}.night-note.warn{border-color:var(--shop-red)}.night-note.ok{border-color:var(--shop-green)}
.night-divider{font-size:11px;color:var(--shop-muted);margin:12px 0 9px}.nb-foot{margin-top:auto;padding-top:18px;color:var(--shop-muted);font-size:11px;text-align:center}.night-orders{overflow:auto}
.nr-bookmarks{display:flex;gap:4px;flex-wrap:wrap;margin-bottom:12px}.nr-bookmark{padding:6px 8px}
.nb-scroll{overflow:auto;min-height:0;flex:1}.nr-row{display:grid;grid-template-columns:minmax(90px,1.4fr) .7fr .65fr .65fr 80px;gap:6px;align-items:center;padding:11px 0;border-bottom:1px solid #d9ddcb;font-size:11px}
.nr-head-row{font-size:10px;color:var(--shop-muted)}.nr-name{display:flex;gap:7px;align-items:center;min-width:0}.nr-dot{width:12px;height:16px;flex:none;box-shadow:inset 0 3px #ffffff66}.nr-stock,.nr-sold{text-align:center}.nr-price{font-family:Consolas,monospace}
.nr-stepper{display:flex;align-items:center;justify-content:flex-end;gap:5px}.nr-stepper button{width:24px;height:26px;border:1px solid #a5b3a0;background:#eeeede;color:var(--shop-dark);font-size:16px}.nr-stepper b{min-width:19px;text-align:center;font:13px Consolas,monospace}
.nr-foot{display:flex;align-items:center;gap:8px;flex-wrap:wrap;border-top:2px solid var(--shop-red);margin-top:12px;padding-top:12px}.nr-total{flex:1 0 100%;font-size:12px;color:var(--shop-muted)}.nr-total b{color:var(--shop-dark)}.night-open{flex:1}.nr-clear{font-size:11px}.night-open:hover{background:#a62e37}
@keyframes panel-in{from{transform:translateY(12px)}to{transform:translateY(0)}}
@keyframes pixel-hop{50%{transform:translateY(-6px)}}
@media(max-width:900px){.game-wrap{padding:0 14px}.game-heading{padding:14px}.heading-actions{max-width:250px}.game-stats{gap:8px}.game-stats>div{padding-right:8px}.hud-day{flex-basis:100%;margin:0}.phone-shell{height:420px;max-height:calc(100% - 115px)}}
@media(max-width:700px){.game-wrap{padding:0 8px}.snack-game{padding-top:8px}.game-heading{align-items:flex-start;flex-direction:column;gap:12px;margin-bottom:12px}.game-heading h1{font-size:23px}.heading-actions{max-width:none;justify-content:flex-start}.game-stage{border-width:2px}.stage-hud{padding:8px;gap:6px}.game-stats{justify-content:space-between;width:100%;gap:4px}.game-stats>div{padding-right:6px}.game-stats strong{font-size:15px}.hud-day{font-size:9px}.stage-message{padding-right:8px;font-size:10px}.stage-popovers{position:static;pointer-events:auto}.popover{position:relative!important;left:auto!important;top:auto!important;width:auto;max-height:340px;margin:8px;box-shadow:none}.phone-button{position:relative;right:auto;bottom:auto;align-self:flex-end;margin:7px;font-size:11px;padding:7px 10px}.phone-shell{position:fixed;right:8px;bottom:8px;width:min(360px,calc(100vw - 16px));height:min(520px,calc(100dvh - 32px));max-height:calc(100dvh - 32px);z-index:40}.night-overlay{padding:12px;place-items:start center}.night-book{display:block;width:100%;max-height:none;padding:5px}.nb-page.left{border-right:0;border-bottom:3px solid #c3bea7}.nb-paper{padding:16px}.nb-scroll{max-height:38dvh;min-height:130px}.nb-foot{padding:10px 0}.night-book .active-orders{max-height:90px;overflow:auto}.nr-row{grid-template-columns:minmax(70px,1.4fr) .7fr .6fr .6fr 80px;gap:3px;font-size:10px}.nr-name{gap:4px}.nr-bookmark{font-size:10px;padding:6px}.night-stamp{font-size:11px}.pixel-dialog{max-height:85dvh;overflow:auto}}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation:none!important;transition:none!important}}

/* Shared pixel packaging for inventory, orders and shelf controls. */
.product-image{width:32px;height:32px;object-fit:contain;image-rendering:pixelated;flex:none}
.nr-product{width:24px;height:24px;object-fit:contain;image-rendering:pixelated;flex:none}
