/* 売り場: 木の棚3段、背面の板、棚の縁に差した値札 */
#shelf { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(3, minmax(0, 212px)); gap: 8px 8px; padding: 10px 8px 4px; align-content: space-evenly; position: relative;
  background: radial-gradient(circle at 50% 0, rgba(255,240,200,.1), transparent 60%), radial-gradient(circle, rgba(0,0,0,.28) 1.2px, transparent 1.6px) 0 0 / 14px 14px, linear-gradient(#6d5a48, #594839); }
.cell { position: relative; min-height: 0; border-radius: 4px 4px 0 0; overflow: visible;
  background: linear-gradient(180deg, rgba(0,0,0,.28), rgba(0,0,0,.04) 30%, rgba(255,255,255,.04) 80%), repeating-linear-gradient(90deg, rgba(255,255,255,.03) 0 3px, transparent 3px 8px), #73604e; box-shadow: inset 0 6px 10px rgba(0,0,0,.35), inset 4px 0 8px rgba(0,0,0,.2); }
.cell::before { content: ""; position: absolute; left: -4px; right: -4px; bottom: -9px; height: 14px; z-index: 1; border-radius: 2px;
  background: repeating-linear-gradient(90deg, rgba(0,0,0,.08) 0 2px, transparent 2px 9px), linear-gradient(#d6a566 0 22%, #b98a56 22% 70%, #7d5a30 70%); box-shadow: 0 5px 8px rgba(0,0,0,.45); }
.cell[data-status="empty"] > * { visibility: hidden; }
.restock { display: none; position: absolute; inset: 0 0 52px 0; flex-direction: column; align-items: center; justify-content: flex-end; gap: 2px; pointer-events: none; color: #f3e6cc; font-size: 12px; font-weight: 800; text-shadow: 0 1px 2px #000; }
.restock svg { height: 60%; width: auto; filter: drop-shadow(0 2px 2px rgba(0,0,0,.4)); }
.cell[data-status="empty"] > .restock { display: flex; visibility: visible; }
.cell .item { position: absolute; left: 0; right: 0; top: 0; bottom: calc(46px + var(--tagh, 84px) - 8px); z-index: 1; touch-action: none; }
.cell .art { position: absolute; left: 0; right: 8px; top: 0; bottom: 6px; display: flex; justify-content: flex-end; align-items: flex-end; pointer-events: none; }
.cell .art svg { height: 100%; width: auto; max-width: 100%; filter: drop-shadow(0 3px 2px rgba(0,0,0,.35)); }
.cell .art .fc { position: absolute; right: 0; bottom: 0; height: 100%; display: flex; transform-origin: 100% 100%; pointer-events: none; }
.cell .art .fc svg { height: 100%; filter: none; }
.cell .art .fc.f1 { transform: translate(-24%, -3%) scale(.84); filter: brightness(.62) saturate(.8) drop-shadow(0 2px 1px rgba(0,0,0,.4)); }
.cell .art .fc.f2 { transform: translate(-46%, -6%) scale(.7); filter: brightness(.46) saturate(.7); }
.cell .art > svg { position: relative; z-index: 1; }
/* 値札は棚の縁のレールに差す: 細い灰色の帯と光の筋 */
.cell::after { content: ""; position: absolute; left: -2px; right: -2px; bottom: calc(46px + var(--tagh, 84px) - 5px); height: 7px; z-index: 1; border-radius: 1px; pointer-events: none;
  background: linear-gradient(#e4e7ea 0 18%, #9aa1a8 18% 62%, #4f565d 62%); box-shadow: 0 2px 3px rgba(0,0,0,.5); }
.cell[data-status="empty"]::after { display: none; }
.cell .item .nm { position: absolute; top: 3px; left: 5px; right: 5px; font-size: 11px; font-weight: 800; color: #fff7e0; text-shadow: 0 1px 2px #000, 0 0 3px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.cell .item .today { position: absolute; top: 19px; left: 4px; font-size: 14px; font-weight: 900; color: #2a2a2a; background: var(--yellow); padding: 1px 7px 1px 6px; border-radius: 3px 8px 8px 3px; box-shadow: 0 2px 0 rgba(0,0,0,.35); pointer-events: none; transform: rotate(-2deg); }
.cell[data-status="bought"] .art, .cell[data-status="bought"] .item .today { opacity: .18; filter: grayscale(1); }
.cell[data-status="taken"] .art, .cell[data-status="taken"] .item .today { opacity: 0; }
.cell[data-status="taken"] .item .nm { opacity: .5; }
.cell .sold { display: none; position: absolute; left: -6px; right: -6px; top: 26%; z-index: 7; text-align: center; padding: 6px 0; background: var(--red); color: #fff; font-weight: 900; font-size: 22px; letter-spacing: 3px; transform: rotate(-8deg); border-top: 3px solid #fff; border-bottom: 3px solid #fff; box-shadow: 0 3px 6px rgba(0,0,0,.5); pointer-events: none; }
.cell[data-status="taken"] .sold { display: block; animation: slam .25s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes slam { from { transform: rotate(-8deg) scale(1.8); opacity: 0; } }
.cell[data-status="taken"] .tagbox { opacity: .85; }
.tagbox { position: absolute; left: 50%; bottom: 46px; transform: translateX(-50%); z-index: 2; touch-action: none; }
.tagbox canvas.tag { position: absolute; pointer-events: none; z-index: 1; touch-action: none; }
.tagbox .face { position: absolute; inset: 0; z-index: 2; touch-action: none; }
.tagbox.nudge { animation: nudge .3s ease-out; }
@keyframes nudge { 0% { transform: translateX(-50%) rotate(0); } 25% { transform: translateX(calc(-50% + 3px)) rotate(1.2deg); } 60% { transform: translateX(calc(-50% - 2px)) rotate(-.8deg); } 100% { transform: translateX(-50%); } }
.cell.peeling { z-index: 20; }
.cell.peeling .tagbox { z-index: 5; }
.corner { position: absolute; top: 0; width: 44px; height: 44px; z-index: 4; touch-action: none; display: block; visibility: hidden; cursor: grab; }
.corner.l { left: 0; } .corner.r { right: 0; }
.corner.on { visibility: visible; }
.cell .buy { position: absolute; left: 0; right: 0; bottom: 0; height: 44px; z-index: 3; border: 0; border-radius: 0 0 6px 6px; background: linear-gradient(#e33a2f, #c71f17); color: #fff; font-weight: 900; font-size: 15px; line-height: 1.1; touch-action: none; box-shadow: 0 3px 0 #7a0d08, 0 5px 8px rgba(0,0,0,.4); overflow: hidden; }
.cell .buy:active { transform: translateY(2px); box-shadow: 0 1px 0 #7a0d08; }
.cell .buy.no { background: #8b8b8b; box-shadow: 0 3px 0 #5b5b5b; font-size: 12px; }
.cell .buy.undo { background: #345; box-shadow: 0 3px 0 #1a2433; }
.cell .buy.undo::after { content: ""; position: absolute; left: 0; bottom: 0; height: 4px; width: calc(var(--u, 1) * 100%); background: var(--yellow); }
.cell .buy.done { background: #4d5a55; box-shadow: none; font-size: 12px; }

/* 客: 前ぶれ（手の影と輪の時計）、腕が入る、持っていく */
.cust { position: absolute; inset: 0; pointer-events: none; z-index: 6; display: none; }
.cell[data-warn="1"] .cust, .cell[data-cust] .cust { display: block; }
.cell:not([data-warn="1"]):not([data-cust="grab"]):not([data-cust="leave"]):not([data-cust="warn"]) .cust { display: none; }
.cust .shadowhand { position: absolute; top: 20%; bottom: 20%; left: -30%; width: 70%; background: radial-gradient(ellipse at 20% 50%, rgba(0,0,0,.5), transparent 70%); opacity: .8; transform: translateX(calc(var(--cp, 0) * 20%)); }
.cust .hand { position: absolute; top: 8%; left: 0; width: 70%; transform: translateX(calc(-110% + var(--cp, 0) * 110%)); transition: transform .1s linear; filter: drop-shadow(0 5px 3px rgba(0,0,0,.45)); }
.cell[data-cust="leave"] .hand { transform: translateX(-120%); transition: transform .3s ease-in; }
.cust .hand svg { width: 100%; display: block; }
.cust .ring { position: absolute; right: 6px; top: 8px; width: 34px; height: 34px; border-radius: 50%; background: conic-gradient(var(--red) calc(var(--ring, 1) * 360deg), rgba(255,255,255,.3) 0); border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.5); }
.cust .ring::after { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: #fff; }
.cell:not([data-warn="1"]) .cust .ring { display: none; }
/* 客を出し抜いた時（先に買った。客が手ぶらで去る）の「あっ」 */
.cell .aw { display: none; position: absolute; right: 8px; top: 40px; padding: 2px 9px; pointer-events: none; background: #fff; color: #222; font-weight: 900; font-size: 15px; border-radius: 12px; box-shadow: 0 2px 5px rgba(0,0,0,.5); animation: pop .3s cubic-bezier(.3, 1.6, .5, 1); z-index: 8; }
.cell .aw::after { content: ""; position: absolute; right: 14px; bottom: -6px; border: 6px solid transparent; border-top-color: #fff; border-bottom: 0; }
.cell[data-aw="1"] .aw { display: block; }

/* 手ほどきの指の手本 */
.finger { position: absolute; top: -6px; width: 40px; height: 52px; z-index: 6; pointer-events: none; animation: demo 2.2s ease-in-out infinite; opacity: 0; }
.finger[data-side="r"] { right: -6px; --dx: -34px; } .finger[data-side="l"] { left: -6px; --dx: 34px; }
.finger svg { width: 100%; height: 100%; filter: drop-shadow(0 2px 2px rgba(0,0,0,.55)); }
.finger::before { content: ""; position: absolute; left: 4px; top: -10px; width: 30px; height: 30px; border-radius: 50%; border: 3px solid #ffe14a; box-shadow: 0 0 8px #ffe14a; animation: tapring 2.2s ease-out infinite; }
@keyframes tapring { 0% { transform: scale(1.5); opacity: 0; } 12% { transform: scale(.8); opacity: 1; } 30% { transform: scale(1.1); opacity: .6; } 40%, 100% { opacity: 0; } }
@keyframes demo { 0% { opacity: 0; transform: translate(0, 0) scale(1.15); } 12% { opacity: 1; transform: translate(0, 0) scale(1); } 70% { opacity: 1; transform: translate(var(--dx), 62px) scale(1); } 85% { opacity: 0; transform: translate(var(--dx), 62px) scale(1.1); } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .finger { animation: none; opacity: .9; } }
@media (max-height: 700px) { .cell .buy { font-size: 14px; } .cell .item .nm { top: 1px; font-size: 11px; } .cell .item .today { font-size: 12px; top: 14px; line-height: 1.15; padding: 0 6px 0 5px; } }
/* 客の手: 袖と影。時計の輪は残り時間（赤が減っていく。針が1周する） */
.cust .hand { width: 78%; filter: drop-shadow(0 6px 3px rgba(0,0,0,.5)); }
.cust .ring::before { content: ""; position: absolute; z-index: 1; left: 50%; top: 50%; width: 2.5px; height: 11px; margin-left: -1.25px; margin-top: -10px; background: #222; border-radius: 2px; transform-origin: 50% 90%; transform: rotate(calc((1 - var(--ring, 1)) * 360deg)); }
.cust .ring { box-shadow: 0 0 0 2px rgba(0,0,0,.35), 0 2px 6px rgba(0,0,0,.5); }
/* はがれ続けている値札があって、ほかの値札を引いた時: 引いた値札が小さく首を振る、はがれ続けている値札が光る */
.tagbox.shake { animation: shake .32s ease-out; }
@keyframes shake { 0%, 100% { transform: translateX(-50%); } 20% { transform: translateX(calc(-50% - 5px)) rotate(-1.6deg); } 50% { transform: translateX(calc(-50% + 5px)) rotate(1.6deg); } 80% { transform: translateX(calc(-50% - 2px)); } }
.cell.peeling .tagbox.glow { filter: drop-shadow(0 0 5px rgba(255,230,120,.95)) drop-shadow(0 0 2px #fff); }
/* PC: 売り場の左右に店の床と隣の棚の暗い絵（中央の売り場は変えない） */
@media (min-width: 440px) {
  html, body { background:
    linear-gradient(90deg, rgba(0,0,0,.55), rgba(0,0,0,.15) 35%, rgba(0,0,0,.15) 65%, rgba(0,0,0,.55)),
    repeating-linear-gradient(0deg, transparent 0 118px, #0b0e16 118px 124px, #2a2f3d 124px 126px, transparent 126px 240px) 0 40px / 100% 100%,
    linear-gradient(180deg, #141a28 0, #141a28 70%, #2b2620 70%, #1b1814 100%),
    repeating-linear-gradient(90deg, #151a26 0 14px, #1a2030 14px 28px); }
}

/* ===== 周回2: 店ごとの色（general は今のまま。変数がない時は元の色） ===== */
.sign { background: var(--sign, var(--red)); border-color: var(--accent, var(--yellow)); }
.sign .mark { color: var(--sign, var(--red)); border-color: var(--sign, var(--red)); }
.sign b { color: var(--signText, #fff); }
.sign small { color: var(--accent, var(--yellow)); }
.bunting { background: linear-gradient(135deg, var(--b1, var(--red)) 25%, transparent 25%) 0 0 / 22px 12px, linear-gradient(225deg, var(--b2, var(--yellow)) 25%, transparent 25%) 11px 0 / 22px 12px; }
#shelf { background: radial-gradient(circle at 50% 0, rgba(255,240,200,.1), transparent 60%), radial-gradient(circle, rgba(0,0,0,.28) 1.2px, transparent 1.6px) 0 0 / 14px 14px, linear-gradient(var(--wallA, #6d5a48), var(--wallB, #594839)); }
.cell { background: linear-gradient(180deg, rgba(0,0,0,.28), rgba(0,0,0,.04) 30%, rgba(255,255,255,.04) 80%), repeating-linear-gradient(90deg, rgba(255,255,255,.03) 0 3px, transparent 3px 8px), var(--cellbg, #73604e); }
.cell::before { background: repeating-linear-gradient(90deg, rgba(0,0,0,.08) 0 2px, transparent 2px 9px), linear-gradient(var(--shelfA, #d6a566) 0 22%, var(--shelf, #b98a56) 22% 70%, var(--shelfC, #7d5a30) 70%); }
#app[data-store="denki"] #shelf { background-image: radial-gradient(circle at 50% 0, rgba(180,220,255,.14), transparent 60%), linear-gradient(90deg, rgba(255,255,255,.05) 0 1px, transparent 1px) 0 0 / 24px 24px, linear-gradient(var(--wallA), var(--wallB)); }
#app[data-store="kurashi"] #shelf { background-image: radial-gradient(circle at 50% 0, rgba(255,240,200,.12), transparent 60%), repeating-linear-gradient(0deg, rgba(255,255,255,.04) 0 2px, transparent 2px 10px), linear-gradient(var(--wallA), var(--wallB)); }
#app[data-store="fuku"] #shelf { background-image: radial-gradient(circle at 50% 0, rgba(255,235,210,.16), transparent 60%), radial-gradient(circle, rgba(255,255,255,.05) 1.5px, transparent 2px) 0 0 / 18px 18px, linear-gradient(var(--wallA), var(--wallB)); }
.cell .item .today { background: var(--accent, var(--yellow)); }
#goal b { color: var(--accent, var(--yellow)); }

/* ===== 看板の下の細い帯（電光の字幕）。手ほどきの文と放送はここに出す。カゴ、升、「カゴへ」には重ならない ===== */
#ticker { flex: none; position: relative; height: 22px; z-index: 7; overflow: hidden; background: #0b0f18; border-bottom: 2px solid #05070c; box-shadow: inset 0 -6px 8px -6px rgba(255,200,80,.18); }
#ticker::before { content: attr(data-idle); position: absolute; inset: 0; display: flex; align-items: center; padding: 0 10px; font: 700 11px/1 ui-monospace, Menlo, "Courier New", monospace; letter-spacing: 1.5px; color: #c79a3a; white-space: nowrap; overflow: hidden; opacity: .75; }
#ticker .tut, #ticker .announce { position: absolute; inset: 0; left: 0; right: 0; top: 0; bottom: 0; height: auto; width: auto; margin: 0; border-radius: 0; box-shadow: none; animation: none; transform: none; font-size: 12px; line-height: 22px; padding: 0 10px; white-space: nowrap; overflow: hidden; text-wrap: nowrap; justify-content: center; }
#ticker .tut { background: var(--accent, var(--yellow)); color: #2a2a2a; }
#ticker .tut::after { display: none; }
#ticker .tut.mini { left: auto; right: 6px; top: 1px; bottom: 1px; width: 20px; height: 20px; padding: 0; border-radius: 50%; font-size: 0; justify-content: center; display: flex; }
#ticker .tut.mini::before { content: "?"; font-size: 13px; line-height: 20px; font-weight: 900; }
#ticker .announce { background: #0b0f18 none; color: #ffd36a; text-shadow: 0 0 6px rgba(255,190,60,.7); font-family: ui-monospace, Menlo, "Courier New", monospace; font-weight: 800; justify-content: flex-start; padding: 0; text-align: left; display: block; }
#ticker .announce > span { display: inline-block; padding: 0 10px; line-height: 22px; }
#ticker .announce > span.run { animation: tk 4.4s linear .5s 1 forwards; }
@keyframes tk { to { transform: translateX(var(--ov)); } }
#bar[data-tut="1"] #basket, #bar[data-tut="1"] #left { margin-top: 0 !important; }
#bar[data-tut="1"] #goalRule { display: inline !important; }

/* ===== PC: 売り場の両側に、ぼかした隣の棚（升の絵を暗く縮めて並べる） ===== */
@media (min-width: 640px) {
  body::before, body::after { content: ""; position: fixed; top: 0; bottom: 0; width: calc(50vw - 200px); pointer-events: none; z-index: 0; filter: blur(2.5px) brightness(.55) saturate(.8);
    background:
      repeating-linear-gradient(0deg, transparent 0 176px, var(--shelf, #b98a56) 176px 190px, rgba(0,0,0,.5) 190px 200px),
      radial-gradient(ellipse 22px 28px at 30px 150px, #7b5bd0 0 70%, transparent 72%) 0 0 / 120px 200px,
      radial-gradient(ellipse 26px 22px at 80px 154px, #e5483a 0 70%, transparent 72%) 0 0 / 120px 200px,
      radial-gradient(ellipse 18px 30px at 104px 146px, #ffd45c 0 70%, transparent 72%) 0 0 / 120px 200px,
      linear-gradient(var(--wallA, #6d5a48), var(--wallB, #594839)); }
  body::before { left: 0; } body::after { right: 0; }
  #app { z-index: 1; }
}

/* ===== 周回3: 品を大きく（黄色い「今日 X円」の札をやめ、値札の今日の値段だけにする）。名前は升の上に1行（長い名前は縮める） ===== */
.cell .item .today { display: none !important; }
.cell .item { bottom: calc(46px + var(--tagh, 84px) - 4px); }
.cell .item .nm { top: 2px; left: 5px; right: 5px; font-size: 12px; line-height: 14px; max-width: calc(100% - 10px); text-overflow: clip; }
.cell .art { top: 15px; bottom: 0; right: 6px; transform: scale(var(--artk, 1.25)); transform-origin: 100% 100%; }
@media (max-height: 700px) { .cell .item .nm { top: 1px; font-size: 11px; } .cell .art { top: 13px; } }
.cell .item { bottom: calc(46px + var(--tagh, 84px) - 12px); }       /* 品の足は棚の縁と値札の後ろに入る */
.cell .art { top: 14px; bottom: -4px; }
@media (min-height: 701px) { #bar { height: 116px; } }
.cell .item .nm { top: 0; left: 0; right: 0; max-width: none; padding: 1px 6px; height: 16px; box-sizing: border-box; z-index: 3; background: linear-gradient(rgba(20,12,6,.72), rgba(20,12,6,.5)); border-radius: 4px 4px 0 0; }
.cell .art { transform: scale(var(--artk, 1.2)); }
/* 品出し中: 箱から品が顔を出して上下し、店員の手が1つ並べている */
.restock svg { height: 72%; overflow: visible; }
.restock .pk { animation: peekup 1.6s ease-in-out infinite; }
.restock .p2 { animation-delay: .35s; } .restock .p3 { animation-delay: .7s; }
@keyframes peekup { 0%, 100% { transform: translateY(5px); } 50% { transform: translateY(-3px); } }
.restock .clerk { animation: place 1.6s ease-in-out infinite; }
@keyframes place { 0%, 100% { transform: translate(8px, 4px); } 50% { transform: translate(-4px, -2px); } }
@media (prefers-reduced-motion: reduce) { .restock .pk, .restock .clerk { animation: none; } }
/* 客の時計: 手と一緒に出る。赤い扇が減っていく（残り時間）。初めの2回だけ小さな字 */
.cust .hint { display: none; position: absolute; right: 2px; top: 46px; max-width: 96%; padding: 1px 6px; border-radius: 8px; background: rgba(0,0,0,.72); color: #fff; font-size: 10px; font-weight: 800; white-space: nowrap; }
.cell[data-hint="1"][data-warn="1"] .cust .hint { display: block; }
.cust .ring { width: 38px; height: 38px; right: 4px; }
@media (max-height: 700px) { .cell .art .plate { transform: scale(.66); transform-origin: 40px 51px; } .cell .art { --artk: 1.12; } .cell .item .nm { height: 14px; font-size: 11px; line-height: 12px; } }
@media (max-height: 700px) { .cell .art { top: 4px; bottom: -6px; --artk: 1.04; } .cell .item .nm { background: linear-gradient(rgba(20,12,6,.6), rgba(20,12,6,.2)); } .cell .art .plate { transform: scale(.58); } }
@media (max-height: 700px) { .cell .art .plate { transform: translateY(-9px) scale(.72); } }
