/* ---------- Stage / belt ---------- */
#stage{position:relative; width:100%; margin:0; border-radius:0;
  /* the upper game area is the reference's share of the scene — 488 of its
     800 units (61%) — now taken as 61% of the SCREEN, however tall or wide
     that screen is. The scene layers stretch to this box
     (preserveAspectRatio="none" on the SVGs, percentages on everything
     else): the ceiling beam is drawn at the scene's very top and the
     counter's front face at its very bottom, so the shop always fills the
     stage completely and no empty wood or blank band can show. */
  flex:0 0 61%; min-height:0;
  /* the full shop scene (wall, ceiling beam, counter top) is painted by the
     .stage-decor SVG in reference coordinates; this is only its base colour */
  background:#5D3D26;
}
/* the reference scene's background layer, drawn in its own 450x488 space:
   wall with the ceiling beam, pillars, noren, shoji, lanterns, the back shelf
   and — as part of the same background layer — the wooden menu plaques.
   Because the plaques live in this layer, the back guests (a later layer)
   always pass IN FRONT of them, exactly as in the reference. */
.stage-decor{position:absolute; left:0; right:0; top:0; bottom:0; z-index:0; pointer-events:none}
.stage-decor svg{width:100%; height:100%; display:block}
.stage-decor .menu-kanji{font-family:"M PLUS Rounded 1c",sans-serif; font-weight:800; fill:#3D2312; text-anchor:middle}
.stage-decor .menu-price{font-family:"Fredoka",sans-serif; font-weight:700; fill:#5A351C; text-anchor:middle}
/* the counter's own surface, in a layer of its own ABOVE the back guests:
   their bodies run down behind it and are covered by it, exactly as a guest
   seated at the far side of a real counter is hidden by it */
.counter-layer{position:absolute; inset:0; z-index:2; pointer-events:none}
.counter-layer svg{width:100%; height:100%; display:block}
/* the back guests' place settings (soy bottle, teacup, a horizontal towel
   roll and horizontal chopsticks), one setting per back guest, standing on
   the counter ledge BEHIND the lane. The layer sits above the counter
   surface but BELOW the belt track, so each setting's lower edge tucks
   behind the lane's wooden frame — the items read as placed on the far
   counter, never as riding on the lane itself */
.props-back{position:absolute; inset:0; z-index:2; pointer-events:none}
.props-back svg{width:100%; height:100%; display:block}
/* the front counter's props (soy dishes, teacups, towels, chopstick rests,
   the centre condiment tray) in one full-stage layer */
.props-layer{position:absolute; inset:0; z-index:8; pointer-events:none}
.props-layer svg{width:100%; height:100%; display:block}
#beltTrack{
  /* the lane block in reference coordinates: x 0..450, y 182..406 of
     450x488 — the wooden rim around the belt keeps its earlier width;
     the shop goods stand on the counter top's surface outboard of the
     frame (see DECOR_ITEMS) */
  position:absolute; left:0; top:37.3%; width:100%; height:45.9%;
  filter:drop-shadow(0 6px 7px rgba(90,50,10,.4));
}
#beltSvg{position:absolute; inset:0; width:100%; height:100%}
/* the kitchen pit layer: refrigerated neta case and the side trays, all
   placed in reference stage coordinates. The chef himself is NOT in this
   layer: he stands in his own layer above the belt's plates (see
   #chefGame), so a passing sushi can never cover him — and the front geta
   tray is not here either: it has its own layer (see #caseFrontLayer)
   below the belt's plates, so the display sushi reads BEHIND the sushi
   flowing on the lane */
#pitLayer{position:absolute; inset:0; z-index:4; pointer-events:none}
.case-back{position:absolute; left:26.2%; top:46.2%; width:47.6%; z-index:1}
#chefGame{position:absolute; left:34.4%; top:38.9%; width:31.1%; z-index:7}
.pit-props{position:absolute; left:24.9%; top:60.7%; width:49.3%; z-index:3}
/* the front geta tray (display sushi) lives in its own layer BELOW the
   belt's plates (.plate, z6) and the chef (z7): the sushi flowing on the
   lane — and the chef — always pass IN FRONT of the display sushi, which
   reads as set back on the counter behind the lane. It still sits above
   the pit layer (z4) and the belt track (z3), so the tray itself stays
   fully drawn over the pit. Its top is set so the tray's bottom edge
   (viewBox y40 of 62, i.e. 59.1 scene units below the element's top at
   this width) lands exactly on the lane's inner edge — the pit's bottom
   line, scene y365 — and never rides on the lane itself:
   top 62.7% of 488 = y306, +59 = y365 */
#caseFrontLayer{position:absolute; inset:0; z-index:5; pointer-events:none}
.case-front{position:absolute; left:18.9%; top:62.7%; width:62.2%; z-index:4}
.plate{
  /* a shallow elliptical plate seen from slightly above, at the reference's
     proportions (64x38 against the 450-wide scene); neighbouring plates may
     overlap a little, as on a real conveyor — the sushi rides centred on top,
     sized at about four fifths of the plate's width as in the reference */
  position:absolute; width:14.2%; aspect-ratio:100/62; margin:-4.4% 0 0 -7.1%;
  z-index:6; pointer-events:none;
  filter:drop-shadow(0 2px 2px rgba(0,0,0,.25));
}
.plate svg{width:100%;height:100%;display:block}
.plate.serving{animation:servePop .3s ease}
@keyframes servePop{40%{transform:scale(1.25)}}
.plate.sweepable{pointer-events:auto; cursor:pointer; animation:wobble .5s infinite alternate}
@keyframes wobble{from{transform:rotate(-5deg)}to{transform:rotate(5deg)}}
/* (the yellow dashed input ring from the reference mock is intentionally not
   used anywhere in this build) */
/* seats */
/* figure scale from the reference: every guest is a 100x110 figure in the
   450-wide scene, the chef a 140x150 one. The seats run a touch larger than
   the reference's nominal 100 units (24% of the stage width) and are
   anchored so they can never float: the back guests' torsos end BELOW the
   counter's back edge (shelf line), and the front guests' bodies run past
   the stage's bottom edge, overlapping the puzzle board's top frame —
   exactly the grounding the reference gets from its layer order. */
.seat{position:absolute; width:24%; z-index:9; text-align:center;}
/* layer order follows the reference scene: back guests sit in front of the
   wall, the menu plaques and the shelf, but BEHIND the counter layer (z2)
   and the lane — the counter surface covers their lower bodies, so they
   read as seated at the far side of the counter, never in front of it;
   front guests sit in front of everything on the counter */
.seat.top{z-index:1}
.seat.bottom{z-index:9}
.seat .face{width:100%; margin:0 auto; animation:seatBob 3.2s ease-in-out infinite}
.seat .face svg{width:100%; height:auto; display:block}
@keyframes seatBob{0%,100%{transform:translateY(0)}50%{transform:translateY(2px)}}
.seat .eye{transform-box:fill-box; transform-origin:center; animation:custBlink 5.4s infinite}
@keyframes custBlink{0%,92%,100%{transform:scaleY(1)}95.5%{transform:scaleY(.1)}}
.seat.cheer .face{animation:seatCheer .55s ease}
@keyframes seatCheer{30%{transform:translateY(-6px) scale(1.07)}60%{transform:translateY(1px)}}
.seat.leave{animation:leaveA .5s ease forwards}
.seat.enter{animation:enterA .5s ease}
@keyframes leaveA{to{opacity:0; transform:translateY(-8px) scale(.85)}}
@keyframes enterA{from{opacity:0; transform:scale(.7)}}
/* round speech bubble, faithful to the reference: a cream circle with a warm gold rim,
   and the classic triangle tail on its underside pointing down at the guest's face.
   The remaining count is NOT a badge: the bare number is overlaid in front of the
   sushi, bottom-right inside the circle, in dark brown with a cream outline. */
.bubble{
  position:absolute; top:-4.9cqw; width:17.5cqw; height:17.5cqw; z-index:3;
  background:#FFFDF7; color:#2B2118; border:3px solid #C79A3B;
  border-radius:50%; display:flex; align-items:center; justify-content:center;
  box-shadow:0 0 0 2px #2C180C, 0 4px 10px rgba(20,10,4,.4);
}
.seat.bottom .bubble{top:-7.1cqw}
/* the tail sits dead-centre under the circle: anywhere off-centre the circle's
   curved rim slices the rotated square diagonally and it reads as a trapezoid.
   Centred, only the square's tip escapes the rim — a clean triangle. */
.bubble::after{
  content:""; position:absolute; left:50%; bottom:-7.5px; width:13px; height:13px; background:#FFFDF7;
  transform:translateX(-50%) rotate(45deg);
  border-right:3px solid #C79A3B; border-bottom:3px solid #C79A3B;
  border-bottom-right-radius:3px;
}
.seat.side-l .bubble{left:-10.9cqw}
.seat.side-r .bubble{right:-10.5cqw}
.bubble svg{width:12.4cqw;height:12.4cqw}
.bubble .cnt{
  position:absolute; right:0.4cqw; bottom:-0.9cqw; z-index:2;
  background:none; border:none; box-shadow:none; padding:0; border-radius:0;
  color:#6B3F10; font-weight:900; font-size:4.7cqw; line-height:1;
  /* the count faces the viewer square-on (the reference's badge-num is an
     upright SVG text) — no tilt, ever */
  text-shadow:
    2px 0 0 #FFFDF6, -2px 0 0 #FFFDF6, 0 2px 0 #FFFDF6, 0 -2px 0 #FFFDF6,
    1.6px 1.6px 0 #FFFDF6, -1.6px 1.6px 0 #FFFDF6, 1.6px -1.6px 0 #FFFDF6, -1.6px -1.6px 0 #FFFDF6,
    0 3px 3px rgba(90,50,10,.35);
}
.seat .face{position:relative; z-index:1}
.bubble.pop{animation:bump .3s ease}
.seat.empty{opacity:.35; filter:grayscale(.6)}
/* charge bar: the served count lives here now (it used to be the top-left
   pill) — a dark wooden trough with a glossy green fill and the count centred
   on top in outlined cream numerals, exactly as in the reference board.
   The old segmented "current stage" bar that sat here is gone. */
/* the puzzle board is the reference's bottom board: a dark wooden outer frame
   bleeding to the screen edges, an inner #8F5D38 panel, and — contained INSIDE
   the board at its top — the progress bar, with the five slots below it */
#board{
  /* the lower puzzle area is exactly the reference's share of the scene:
     312 of the 800-unit frame (39%), flush under the stage with no gap and
     no bleed margins — the front guests overlap its top edge, grounded */
  flex:1 1 auto; min-height:0; width:100%; margin:0; position:relative;
  background:linear-gradient(180deg,#9E6B43,#7C4F2D);
  border-top:2.5px solid #2C180C;
  padding:0.9cqw 1.3cqw;
  box-shadow:0 -4px 12px rgba(10,5,2,.35);
  display:flex;
}
.board-inner{
  flex:1 1 auto; min-height:0; display:flex; flex-direction:column;
  background:#8F5D38; border:2px solid #4A2B16; border-radius:10px;
  padding:1.6cqw 2.2cqw 2cqw;
  box-shadow:inset 0 2px 0 rgba(255,230,180,.25);
}
.stage-bar{flex:none; height:4.9cqw; background:#3A2010; border:2.5px solid #241207; border-radius:999px; overflow:hidden; box-shadow:inset 0 2px 5px rgba(0,0,0,.55), 0 3px 6px rgba(10,5,2,.35); position:relative}
.stage-bar i{display:block; height:100%; width:0%; background:linear-gradient(180deg,#7BE84B 0%,#45C425 50%,#2E9616 100%); box-shadow:inset 0 2px 0 rgba(255,255,255,.45); transition:width .45s ease}
.stage-bar span{
  position:absolute; inset:0; display:flex; align-items:center; justify-content:center;
  font-family:"Fredoka","M PLUS Rounded 1c",sans-serif; font-weight:700; font-size:3.6cqw; letter-spacing:.08em; color:#FFF8EB;
  text-shadow:2px 0 0 #2A1408, -2px 0 0 #2A1408, 0 2px 0 #2A1408, 0 -2px 0 #2A1408, 1.4px 1.4px 0 #2A1408, -1.4px 1.4px 0 #2A1408, 1.4px -1.4px 0 #2A1408, -1.4px -1.4px 0 #2A1408;
}
