/* Wind-Up Stage — shared component styles (suite redo 2026-11-09)
   Implements WIND-UP-MAP.md §1–2 / STAGE-CONTRACT.md.
   One component, every surface. Sizes: band ~110px, finale ~240px,
   overlay = band-size moment layer. Ground line at 86% of stage height
   (package groundLine), character height ~78% of stage height in band. */
.wu-stage{
  --wu-paper:#f8f3e8; --wu-navy:#1d3557; --wu-red:#c1272d; --wu-brass:#b8862e;
  position:relative; overflow:hidden; box-sizing:border-box;
  background:linear-gradient(180deg,#fbf7ec 0%,var(--wu-paper) 78%,#efe6d0 100%);
  border:2px solid var(--wu-navy); border-radius:10px;
  font-family:Georgia,'Times New Roman',serif; color:#222;
  width:100%;
}
.wu-stage *{ box-sizing:border-box; }
.wu-mode-band{ height:110px; border-radius:6px; }
.wu-mode-finale{ height:240px; }
.wu-mode-overlay{ height:110px; border-radius:6px; opacity:0; visibility:hidden;
  transition:opacity .18s ease; pointer-events:none; }
.wu-mode-overlay.wu-on{ opacity:1; visibility:visible; }

/* --- scenery (per-surface hook: data-scenery on the stage root) --- */
.wu-horizon{ position:absolute; left:0; right:0; bottom:14%; height:26%;
  opacity:.35; pointer-events:none; }
.wu-stage[data-scenery="track"] .wu-horizon{ background:repeating-linear-gradient(90deg,#d8c9a3 0 26px,#c9b586 26px 52px); }
.wu-stage[data-scenery="road"] .wu-horizon{ background:linear-gradient(180deg,#e7dcc0,#dccfa9); }
.wu-stage[data-scenery="yard"] .wu-horizon,
.wu-stage[data-scenery="lot"] .wu-horizon{ background:repeating-linear-gradient(0deg,#e2d5b4 0 8px,#d9c9a2 8px 16px); }
.wu-stage[data-scenery="lane"] .wu-horizon{ background:repeating-linear-gradient(90deg,#e6dcc2 0 40px,#d8c9a4 40px 44px); }
.wu-stage[data-scenery="arc"] .wu-horizon{ background:radial-gradient(ellipse at 30% 110%,#e9dfc6 0 55%,#dccfa9 56% 100%); }

.wu-ground{ position:absolute; left:0; right:0; bottom:14%; height:3px;
  background:repeating-linear-gradient(90deg,#b9a888 0 14px,#a08d68 14px 28px); opacity:.75; }
.wu-stage[data-scenery="track"] .wu-ground{ height:5px;
  background:repeating-linear-gradient(90deg,#8a6f4d 0 18px,#6f573a 18px 20px); }
.wu-stage[data-scenery="lane"] .wu-ground{ background:repeating-linear-gradient(90deg,#c1272d 0 10px,#f8f3e8 10px 20px); opacity:.55; }

.wu-tracklabel{ position:absolute; right:8px; bottom:4%; font-size:10px;
  letter-spacing:.08em; text-transform:uppercase; color:#8a7a58; }

/* --- layers --- */
.wu-layer{ position:absolute; left:0; width:100%; bottom:14%; height:86%;
  display:none; align-items:flex-end; }
.wu-layer.wu-on{ display:flex; }
.wu-layer img{ object-fit:contain; user-select:none; -webkit-user-drag:none; }
.wu-idle{ justify-content:flex-start; padding-left:4%; gap:3%; }
.wu-idle .wu-char{ height:100%; }
.wu-mode-band .wu-idle .wu-char{ height:100%; } /* layer is 86% tall; char ~78% of stage via layer math + img cap below */
.wu-idle .wu-truck{ height:52%; }
/* Rest staging (Designer §2, fix lane 2026-11-09): in band mode the idle
   pair rests offset into the stage's open field, clear of the left-side
   furniture zone (pace/mode toggles conventionally sit top-left and were
   covering the figure's head and torso, and the count chip clipped the
   truck). Wind and finale staging are unchanged. */
.wu-mode-band .wu-idle{ justify-content:center; padding-left:46%; }
.wu-scene{ justify-content:center; }
.wu-scene img{ max-height:100%; max-width:97%; }
/* Band scene parity (Permit fix lane 2026-11-09): the composed scene
   frames carry wide empty margins, so at band height the figure read
   ~30% smaller than the idle figure and every wind opened with a
   visible shrink. A mild scale about the ground line brings the
   scene figure to near the idle figure's size; the scale is small
   enough that the composition's own top margin still covers it, so
   nothing clips. Finale sizing is untouched. */
.wu-mode-band .wu-scene{ transform:scale(1.12); transform-origin:50% 100%; }
.wu-roll{ justify-content:flex-start; }
.wu-roll img{ height:50%; will-change:transform; }
.wu-mode-band .wu-roll img{ height:48%; }
.wu-walk{ justify-content:flex-start; }
.wu-walk .wu-walkimg{ height:97%; margin-left:5%; will-change:transform; }
/* Gap-5 polish (fix lane 2026-11-09): the parked truck rides under the
   walk layer at the spot where it stopped, so the walk-off reads as
   walking away FROM the truck. JS sets its transform to the stop point. */
.wu-walk .wu-walktruck{ position:absolute; left:0; bottom:0; height:50%; will-change:transform; }
/* Settled short still (Game Quality Gate D3, fix lane 2026-11-09): when a
   short finale settles, the persistent frame is the stopped truck with the
   dejected figure standing beside it (a walk frame, head down), not the
   truck alone. JS positions both images at the stop point. */
.wu-settle{ justify-content:flex-start; }
.wu-settle img{ position:absolute; left:0; bottom:0; }
.wu-settle .wu-settletruck{ height:50%; will-change:transform; }
.wu-settle .wu-settlechar{ height:90%; will-change:transform; }

/* --- counter (band right edge / finale top right) --- */
.wu-counter{ position:absolute; top:6px; right:8px; z-index:5;
  background:#fffdf6; border:2px solid var(--wu-brass); color:#7a5a16;
  border-radius:999px; padding:2px 10px; font-size:13px; font-weight:bold;
  display:flex; gap:6px; align-items:center; }
.wu-counter .wu-keyglyph{ display:inline-block; font-size:14px; }
.wu-mode-band .wu-counter{ font-size:12px; padding:1px 8px; }

/* --- stop-point caption (finale short state) --- */
.wu-stop{ position:absolute; left:50%; transform:translateX(-50%); top:11%;
  z-index:6; background:#fffdf6; border:2px solid var(--wu-red); color:#7c1d20;
  border-radius:8px; padding:4px 12px; font-size:13px; text-align:center;
  max-width:88%; display:none; }
.wu-mode-band .wu-stop{ top:auto; bottom:5%; }
.wu-stop.wu-on{ display:block; }
.wu-stop b{ color:var(--wu-red); }
.wu-mode-band .wu-stop{ font-size:11px; }

/* --- state label (evidence/debug surfaces may hide) --- */
.wu-state{ position:absolute; left:8px; top:6px; z-index:5; font-size:11px;
  letter-spacing:.06em; text-transform:uppercase; color:#6b5c3e; }

/* --- motion --- */
@keyframes wu-shiver{ 0%{transform:translate(0,0) rotate(0deg);} 25%{transform:translate(1.5px,-.5px) rotate(.35deg);}
  50%{transform:translate(-1.5px,.5px) rotate(-.35deg);} 75%{transform:translate(1px,.5px) rotate(.2deg);} 100%{transform:translate(0,0);} }
.wu-shiver{ animation:wu-shiver .12s linear infinite; }
@keyframes wu-tremble{ 0%{transform:translate(0,0);} 20%{transform:translate(1px,-1px);} 40%{transform:translate(-1px,0);}
  60%{transform:translate(1px,1px);} 80%{transform:translate(-1px,-1px);} 100%{transform:translate(0,0);} }
.wu-tremble{ animation:wu-tremble .09s linear infinite; }

@media (prefers-reduced-motion: reduce){
  /* Special Educator ground 4 (fix lane 2026-11-09): reduced motion STILLS
     the stage shiver/tremble entirely — it does not merely slow it. */
  .wu-shiver,.wu-tremble{ animation:none; }
}
