/* dojo-game.css — Engine-driven Dojo composition (sibling of DojoRoom).
   Pairs with frontend/components/DojoGameRoom.tsx.

   Architecture (post jury 2026-04-24, 4–2 overturn of strip+scale):
   - Full-viewport BG-cover, single active room rendered. The prior 4000px
     .dojo-world strip + 800x450 clip box + transform:scale(1.9) pattern
     was fragile: compositor leak in some Chrome configs let neighbor
     rooms bleed past `overflow: hidden` at wide viewports, and the
     letterbox visually clashed with the Act 1 landing page.
   - .app-root is the visual target — fills 100% x 100dvh, BG cover,
     no letterbox. .dojo-game now matches.
   - .dojo-stage is the new logical 800x450 coordinate plane. It scales
     to viewport via --stage-scale (a `min(...)` of width/height ratios,
     so the stage always fits inside the viewport with letterbox padding
     in whichever dimension doesn't match the 16:9 logical aspect).
     Children retain
     their logical 0–800 / 0–450 coords; the engine and decor data stay
     untouched. Overflow:hidden on the room hides the cover-crop.
   - Only the [data-dojo-room="active"] room renders. 200ms opacity
     cross-fade on swap (transitions module flips the attribute and may
     also toggle `display` for accessibility / DOM cost). */

/* z-order scale (Wave 13-A). Decor floor < containers < Koro < scroll-pop
   < UI so a scroll emerging from a container always clears nearby clutter.
   Koro lands at 100 to match engine.css's .dojo-koro-player; scroll-pop
   stacks above him so reveals never render behind the character. */
.dojo-game {
  --z-decor: 10;
  --z-containers: 30;
  --z-koro: 100;
  --z-scroll-pop: 110;
  --z-ui: 200;
}

.dojo-game .dojo-deco-item { z-index: var(--z-decor); }
.dojo-game-room .dojo-container-scroll-pop { z-index: var(--z-scroll-pop); }
.dojo-game .dojo-controls-hint,
.dojo-game .dojo-gamepad,
.dojo-game .dojo-reveal-overlay,
.dojo-cheat-bar { z-index: var(--z-ui); }

/* Cheat bar — small persistent UI for typing cheat codes (zozen, zoyay).
   Sits bottom-left so it stays clear of the centered controls hint AND
   the HINTS-ON toggle that lives at bottom-right. */
.dojo-cheat-bar {
  position: fixed;
  bottom: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 10px;
}
.dojo-cheat-toggle {
  padding: 6px 12px;
  font-family: inherit;
  font-size: inherit;
  letter-spacing: 0.5px;
  color: var(--color-pixel-cream);
  background: rgba(15, 14, 23, 0.7);
  border: 2px solid var(--color-teal);
  border-radius: 4px;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.2s ease, background 0.2s ease;
}
.dojo-cheat-toggle:hover,
.dojo-cheat-toggle:focus-visible {
  opacity: 1;
  background: rgba(15, 14, 23, 0.92);
  outline: none;
}
.dojo-cheat-input {
  width: 160px;
  padding: 6px 10px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--color-pixel-cream);
  background: rgba(15, 14, 23, 0.92);
  border: 2px solid var(--color-gold);
  border-radius: 4px;
  outline: none;
}
.dojo-cheat-input::placeholder {
  color: rgba(254, 246, 228, 0.5);
}
.dojo-cheat-input[hidden] { display: none; }

/* Outer shell — fills viewport, mirrors .app-root presentation. No flex
   centering: the BG fills the viewport directly, there's nothing to center. */
.dojo-game {
  position: relative;
  width: 100%;
  height: 100svh;
  min-height: 100svh;
  overflow: hidden;
  background-color: var(--color-bg-deep);
  image-rendering: pixelated;
}

/* Atmospheric backdrop (.dojo-game::before / ::after) REMOVED. With the
   stage now covering the viewport, blurred neighbor-art fill is redundant
   — there's no letterbox area for it to occupy. */

/* Room container — full viewport. --stage-scale is contain-fit (min)
   so the logical 800x450 plane always lives entirely inside the
   viewport. Cover-fit (max) was tried first and looked great at 16:9
   but extended the stage off-screen at any other aspect, hiding Koro's
   feet, the path floor, and ground-anchored decor on ultrawide
   monitors. The room background still uses background-size:cover so
   the BG art fills the viewport beautifully — only the gameplay layer
   is contained. Mismatch between BG cover-fit and stage contain-fit
   means decor doesn't pixel-align to BG features at non-16:9 aspects,
   but everything stays playable and visible. */
.dojo-game-room {
  --stage-scale: min(calc(100vw / 800px), calc(100svh / 450px));
  position: relative;
  width: 100%;
  height: 100svh;
  overflow: hidden;
}

/* Portrait dojo CSS removed: portrait gameplay is not an option per
   product decision. The PortraitGate at the App root forces rotation;
   the dojo never renders in portrait, so no portrait-specific layout
   is needed. */

/* Stylistic wrapper retained for selector continuity — no longer a
   4000px strip. Just an inset:0 layer holding the room panels. */
.dojo-world {
  position: absolute;
  inset: 0;
}

/* Room panel — only the active one renders. Background image is set
   inline by the component (per-room art). `display: none` on inactive
   panels keeps the engine from paying layout/paint costs for off-screen
   rooms; the active panel cross-fades opacity for the 200ms hand-off. */
.dojo-game .dojo-room {
  position: absolute;
  inset: 0;
  /* Defeat dojo.css's pre-game-engine .dojo-room rule (max-width:900px,
     height:calc(100dvh - 100px), margin:0 auto) which would otherwise
     leak in here and constrain each panel to 900x980 centered. The new
     architecture wants the active panel to fill the full game-room. */
  width: auto;
  height: auto;
  max-width: none;
  margin: 0;
  padding: 0;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  display: none;
  opacity: 0;
  transition: opacity 200ms ease-in-out;
}

.dojo-game .dojo-room[data-dojo-room="active"] {
  display: block;
  opacity: 1;
}

/* 3:2 source art (cubicle, open_road) anchored to the bottom edge so the
   floor plane Koro walks on is preserved; ceiling takes the cover-crop.
   Applies on all viewports — desktop crops the painted ceiling against
   its wider-than-16:9 cover-fit; portrait crops it against the 16:9
   frame's cover-fit. Same painted region visible everywhere. */
.dojo-game .dojo-room[data-room-id="cubicle"],
.dojo-game .dojo-room[data-room-id="open_road"] {
  background-position: center bottom;
}

/* Subtle bottom-edge darkening for depth. Kept — at full viewport the
   gradient grounds the floor plane and helps Koro/decor read against
   bright BG art. */
.dojo-game .dojo-room::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 18px;
  pointer-events: none;
  background: linear-gradient(to top, rgba(15, 14, 23, 0.35), transparent);
}

/* Stage — the logical 800x450 coordinate plane. All decor, objects, and
   Koro position themselves in 0–800 / 0–450 space inside this element.
   Scaled+centered via translate(-50%,-50%) and --stage-scale; pixel-art
   rendering preserved through the non-integer scale. */
.dojo-stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 800px;
  height: 450px;
  transform: translate(-50%, -50%) scale(var(--stage-scale));
  transform-origin: center center;
  image-rendering: pixelated;
}

/* Reduced-motion: disable the cross-fade. Room swap becomes an instant
   display flip — accessible and still readable. */
@media (prefers-reduced-motion: reduce) {
  .dojo-game .dojo-room { transition: none !important; }
}

/* Tier-2 invisible platform (the painted desk hitbox). No visual —
   painted BG provides it. pointer-events:none so the platform never
   intercepts clicks; the engine reads its rect via getBoundingClientRect
   only. The bare div carries data-platform="true" so dojo-game.ts can
   detect it during readHitboxesForRoom. */
.dojo-platform {
  background: transparent;
  pointer-events: none;
  border: 0;
}

/* Edge exit arrows — guide first-time players from room to room. Twin-
   chevron SVG with a gold gradient stroke, soft halo, and a slow drift +
   shimmer cycle. pointer-events:none so they never block gameplay. */
.dojo-exit-arrow {
  position: absolute;
  top: 180px;
  width: 48px;
  height: 72px;
  pointer-events: none;
  z-index: 80;
  opacity: 0;
  transition: opacity 600ms ease-out;
  filter:
    drop-shadow(0 0 5px rgba(244, 197, 66, 0.45))
    drop-shadow(0 0 12px rgba(244, 197, 66, 0.22))
    drop-shadow(0 2px 2px rgba(0, 0, 0, 0.4));
  animation: dojo-exit-arrow-drift 2.4s ease-in-out infinite;
}
.dojo-room.is-stuck .dojo-exit-arrow { opacity: 0.7; }
.dojo-exit-arrow-left  { left: 6px;  --arrow-bob: -8px; }
.dojo-exit-arrow-right { right: 6px; --arrow-bob:  8px; }

.dojo-exit-arrow-svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}
.dojo-exit-arrow-chev {
  fill: none;
  stroke-width: 7;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.dojo-exit-arrow-left  .dojo-exit-arrow-chev { stroke: url(#exitGradLeft); }
.dojo-exit-arrow-right .dojo-exit-arrow-chev { stroke: url(#exitGradRight); }

/* Layer the back chevron softer + slightly translucent so the front one
   reads as the hero. Stagger their shimmer for a "leading edge" feel. */
.dojo-exit-arrow-chev-back {
  opacity: 0.45;
  animation: dojo-exit-chev-shimmer 2s ease-in-out infinite;
  animation-delay: -0.4s;
}
.dojo-exit-arrow-chev-front {
  opacity: 1;
  animation: dojo-exit-chev-shimmer 2s ease-in-out infinite;
}

@keyframes dojo-exit-arrow-drift {
  0%, 100% { transform: translateX(0); }
  50%      { transform: translateX(var(--arrow-bob, 0)); }
}
@keyframes dojo-exit-chev-shimmer {
  0%, 100% { stroke-width: 6; opacity: var(--chev-low, 0.6); }
  50%      { stroke-width: 8; opacity: var(--chev-high, 1); }
}
.dojo-exit-arrow-chev-back  { --chev-low: 0.25; --chev-high: 0.6; }
.dojo-exit-arrow-chev-front { --chev-low: 0.7;  --chev-high: 1; }

/* Tier-2 mount sparkle: gold burst rendered when Koro mounts a platform
   via Space. Anchored at platform top center; six radial sparks plus a
   center burst, all CSS-animated. Suppressed under prefers-reduced-motion. */
.dojo-mount-sparkle {
  position: absolute;
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: 200;
}
.dojo-mount-spark {
  position: absolute;
  left: 0;
  top: 0;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: var(--color-gold, #ffd166);
  box-shadow: 0 0 10px 3px rgba(255, 209, 102, 0.85);
  opacity: 0;
}
.dojo-mount-spark-0 {
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  background: radial-gradient(circle,
    rgba(255, 240, 200, 1) 0%,
    rgba(255, 209, 102, 0.85) 40%,
    rgba(255, 209, 102, 0) 75%);
  box-shadow: none;
  animation: dojoMountBurst 0.55s ease-out forwards;
}
.dojo-mount-spark-1 { animation: dojoMountSpark1 0.6s ease-out forwards; }
.dojo-mount-spark-2 { animation: dojoMountSpark2 0.6s ease-out forwards; }
.dojo-mount-spark-3 { animation: dojoMountSpark3 0.6s ease-out forwards; }
.dojo-mount-spark-4 { animation: dojoMountSpark4 0.6s ease-out forwards; }
.dojo-mount-spark-5 { animation: dojoMountSpark5 0.6s ease-out forwards; }
.dojo-mount-spark-6 { animation: dojoMountSpark6 0.6s ease-out forwards; }
@keyframes dojoMountBurst {
  0%   { opacity: 0; transform: scale(0.3); }
  35%  { opacity: 1; transform: scale(1.6); }
  100% { opacity: 0; transform: scale(2.4); }
}
@keyframes dojoMountSpark1 {
  0%   { opacity: 0; transform: translate(0, 0)     scale(0.4); }
  20%  { opacity: 1; }
  100% { opacity: 0; transform: translate(0, -38px) scale(0.3); }
}
@keyframes dojoMountSpark2 {
  0%   { opacity: 0; transform: translate(0, 0)        scale(0.4); }
  20%  { opacity: 1; }
  100% { opacity: 0; transform: translate(28px, -28px) scale(0.3); }
}
@keyframes dojoMountSpark3 {
  0%   { opacity: 0; transform: translate(0, 0)       scale(0.4); }
  20%  { opacity: 1; }
  100% { opacity: 0; transform: translate(38px, -8px) scale(0.3); }
}
@keyframes dojoMountSpark4 {
  0%   { opacity: 0; transform: translate(0, 0)        scale(0.4); }
  20%  { opacity: 1; }
  100% { opacity: 0; transform: translate(28px, 14px)  scale(0.3); }
}
@keyframes dojoMountSpark5 {
  0%   { opacity: 0; transform: translate(0, 0)         scale(0.4); }
  20%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-28px, -28px) scale(0.3); }
}
@keyframes dojoMountSpark6 {
  0%   { opacity: 0; transform: translate(0, 0)        scale(0.4); }
  20%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-38px, -8px) scale(0.3); }
}
@media (prefers-reduced-motion: reduce) {
  .dojo-mount-sparkle { display: none; }
}

/* Per-object container — engine.css owns base + glow + bump.
   Descendant selectors still match through the deeper DOM path
   (.dojo-game-room .dojo-world .dojo-room .dojo-stage .dojo-object). */
.dojo-game-room .dojo-object {
  position: absolute;
  display: block;
  padding: 0;
  margin: 0;
  background: transparent;
  border: 0;
  cursor: default;
}

.dojo-game-room .dojo-object-img {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;
  image-rendering: pixelated;
  pointer-events: none;
  user-select: none;
}

.dojo-game-room .dojo-object-glow {
  position: absolute;
  inset: -10px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: -1;
}

/* Ground shadow — anchors non-floating objects to the floor plane.
   Rendered only where data-floating != "true". */
.dojo-game-room .dojo-object-shadow {
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 88%;
  height: 10px;
  pointer-events: none;
  z-index: -1;
  background: radial-gradient(
    ellipse,
    rgba(0, 0, 0, 0.42) 0%,
    rgba(0, 0, 0, 0.18) 50%,
    transparent 75%
  );
  filter: blur(1px);
}

.dojo-game-room .dojo-object[data-object-id="bookshelf"] .dojo-object-shadow,
.dojo-game-room .dojo-object[data-object-id="file_cabinet"] .dojo-object-shadow,
.dojo-game-room .dojo-object[data-object-id="plant"] .dojo-object-shadow,
.dojo-game-room .dojo-object[data-object-id="telescope"] .dojo-object-shadow {
  height: 14px;
  background: radial-gradient(
    ellipse,
    rgba(0, 0, 0, 0.55) 0%,
    rgba(0, 0, 0, 0.25) 50%,
    transparent 75%
  );
}

/* Floating objects (window, scroll_rack, orb) get a soft halo instead
   of a ground shadow, hinting suspension rather than rest. */
.dojo-game-room .dojo-object[data-floating="true"] {
  filter: drop-shadow(0 4px 12px rgba(255, 209, 102, 0.18));
}

/* --- Container discovery: sealed / opening / open state visuals.
   Scroll-bearing DOJO_OBJECTS and RED_HERRINGS share this system. --- */

.dojo-container-seal {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  border-radius: 50%;
  background: radial-gradient(
    circle at center,
    rgba(255, 209, 102, 0.28) 0%,
    rgba(255, 209, 102, 0.12) 35%,
    transparent 58%
  );
  opacity: 0;
  transition: opacity 0.25s ease;
  animation: dojoSealHeartbeat 3.6s ease-in-out infinite;
}
.dojo-container[data-container-state="sealed"] .dojo-container-seal { opacity: 0.55; }
.dojo-container[data-container-state="sealed"].obj-nearby .dojo-container-seal { opacity: 1; }
.dojo-container[data-container-state="opening"] .dojo-container-seal {
  opacity: 0;
  animation: dojoSealCrack 0.45s ease-out forwards;
}
.dojo-container[data-container-state="open"] .dojo-container-seal { opacity: 0; }

.dojo-game-room .dojo-object[data-object-id="window"] .dojo-container-seal {
  inset: 32%;
}

.dojo-game-room .dojo-object[data-object-id="plant"] .dojo-object-img,
.dojo-game-room .dojo-object[data-object-id="file_cabinet"] .dojo-object-img {
  object-position: bottom;
}

/* Compass on the open road reads better when tilted, like a tool
   dropped on the path and left at that angle rather than perfectly
   level. */
.dojo-game-room .dojo-object[data-object-id="terminal"] .dojo-object-img {
  transform: rotate(25deg);
}

/* --- Orb dramatic-grab anime burst (advanced tier scroll #11). The
   orb is the hardest reach in the world (boulder staircase + final
   apex jump), and the last beat before the workshop. Its open state
   gets a special anime-style sequence: orb pulses + brightens to a
   blinding pop, gold speed-lines fan outward, and a brief screen
   flash punctuates the moment. Scoped via data-object-id="orb". */
.dojo-game-room .dojo-object[data-object-id="orb"][data-container-state="opening"] {
  z-index: 9000 !important;
}
.dojo-game-room .dojo-object[data-object-id="orb"][data-container-state="opening"] .dojo-object-img {
  animation: orbBurstOpen 1.1s cubic-bezier(0.55, 0.06, 0.45, 0.94) forwards;
}
.dojo-game-room .dojo-object[data-object-id="orb"][data-container-state="opening"]::before {
  content: "";
  position: absolute;
  inset: -260px;
  background: repeating-conic-gradient(
    from 0deg at 50% 50%,
    transparent 0deg 4deg,
    rgba(255, 209, 102, 0.75) 4deg 5deg,
    transparent 5deg 9deg
  );
  border-radius: 50%;
  animation: orbSpeedLines 1.1s ease-out forwards;
  pointer-events: none;
  mix-blend-mode: screen;
  z-index: -1;
}
.dojo-game-room .dojo-object[data-object-id="orb"][data-container-state="opening"]::after {
  content: "";
  position: fixed;
  inset: 0;
  background: #fff;
  opacity: 0;
  animation: orbFlash 0.55s ease-out forwards;
  pointer-events: none;
  z-index: 9999;
}

@keyframes orbBurstOpen {
  0%   { transform: scale(1);   filter: brightness(1) drop-shadow(0 0 0 transparent); }
  15%  { transform: scale(1.5); filter: brightness(2.2) drop-shadow(0 0 40px rgba(255,209,102,0.95)); }
  35%  { transform: scale(0.85); filter: brightness(1.6); }
  55%  { transform: scale(1.7); filter: brightness(3) drop-shadow(0 0 60px rgba(255,209,102,1)); }
  75%  { transform: scale(1.3); filter: brightness(2); }
  100% { transform: scale(0);   opacity: 0; filter: brightness(4); }
}
@keyframes orbSpeedLines {
  0%   { opacity: 0; transform: scale(0.3) rotate(0deg); }
  20%  { opacity: 1; transform: scale(1) rotate(20deg); }
  100% { opacity: 0; transform: scale(2.4) rotate(120deg); }
}
@keyframes orbFlash {
  0%, 100% { opacity: 0; }
  18%      { opacity: 0.85; }
}

@media (prefers-reduced-motion: reduce) {
  .dojo-game-room .dojo-object[data-object-id="orb"][data-container-state="opening"] .dojo-object-img,
  .dojo-game-room .dojo-object[data-object-id="orb"][data-container-state="opening"]::before,
  .dojo-game-room .dojo-object[data-object-id="orb"][data-container-state="opening"]::after {
    animation: none;
  }
}


@keyframes dojoSealHeartbeat {
  0%, 100% { filter: brightness(1); transform: scale(1); }
  50%      { filter: brightness(1.25); transform: scale(1.04); }
}
@keyframes dojoSealCrack {
  0%   { opacity: 0.95; filter: brightness(1.8) blur(0); transform: scale(1); }
  60%  { opacity: 0.8;  filter: brightness(2.6) blur(1px); transform: scale(1.25); }
  100% { opacity: 0;    filter: brightness(1)  blur(0);   transform: scale(1.45); }
}

.dojo-container[data-container-state="sealed"] .dojo-object-img {
  filter: brightness(0.88) saturate(0.82);
  transition: filter 0.25s ease;
}
.dojo-container[data-container-state="opening"] .dojo-object-img {
  animation: dojoContainerPop 0.4s ease-out;
}
.dojo-container[data-container-state="open"] .dojo-object-img {
  filter: none;
}
@keyframes dojoContainerPop {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.12) translateY(-2px); }
  100% { transform: scale(1); }
}

/* Scroll that pops out of real containers when opening. */
.dojo-container-scroll-pop {
  position: absolute;
  left: 50%;
  top: 0;
  width: 32px;
  height: 32px;
  transform: translate(-50%, 0) scale(0.3);
  opacity: 0;
  pointer-events: none;
  z-index: var(--z-scroll-pop);
}
.dojo-container-scroll-pop img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}
.dojo-container[data-container-state="opening"] .dojo-container-scroll-pop {
  animation: dojoScrollEmerge 0.55s ease-out forwards;
}
@keyframes dojoScrollEmerge {
  0%   { opacity: 0; transform: translate(-50%, 0) scale(0.3); }
  55%  { opacity: 1; transform: translate(-50%, -36px) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -52px) scale(1.0); }
}

/* Sparks — pseudo-elements on the pop container, no extra markup. */
.dojo-container-scroll-pop::before,
.dojo-container-scroll-pop::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: var(--color-gold);
  box-shadow: 0 0 6px 2px rgba(255, 209, 102, 0.8);
  opacity: 0;
  pointer-events: none;
}
.dojo-container[data-container-state="opening"] .dojo-container-scroll-pop::before {
  animation: dojoSparkLeft 0.55s ease-out forwards;
}
.dojo-container[data-container-state="opening"] .dojo-container-scroll-pop::after {
  animation: dojoSparkRight 0.55s ease-out forwards;
}
@keyframes dojoSparkLeft {
  0%   { opacity: 0; transform: translate(0, 0) scale(0.4); }
  30%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-22px, -18px) scale(0.2); }
}
@keyframes dojoSparkRight {
  0%   { opacity: 0; transform: translate(0, 0) scale(0.4); }
  30%  { opacity: 1; }
  100% { opacity: 0; transform: translate(22px, -18px) scale(0.2); }
}

/* Gold flash on the sprite at the moment the scroll bursts out. */
.dojo-container[data-container-state="opening"] .dojo-object-img {
  animation: dojoContainerPop 0.4s ease-out, dojoContainerFlash 0.5s ease-out;
}
@keyframes dojoContainerFlash {
  0%   { filter: brightness(1) saturate(1); }
  30%  { filter: brightness(1.6) saturate(1.3) drop-shadow(0 0 10px rgba(255, 209, 102, 0.9)); }
  100% { filter: brightness(1) saturate(1); }
}

/* Seed herring sits tilted as if dropped, not standing upright.
   transform-origin near the bottom keeps the base on the ground while
   the top leans. Wobble animation during interaction briefly resets
   to 0deg — a 0.45s flicker is acceptable given the deliberate
   interaction beat. */
#dojo-game-obj-seed .dojo-object-img {
  transform: rotate(-22deg);
  transform-origin: 50% 80%;
}

/* Red herring: softer, cooler, shorter-lived than a real container. */
.dojo-container-herring .dojo-container-seal {
  display: none;
}
.dojo-container-herring .dojo-object-glow {
  opacity: 0;
}
.dojo-container-herring[data-container-state="sealed"].obj-nearby .dojo-object-glow {
  opacity: 0.45;
  background: radial-gradient(circle at center, rgba(254, 246, 228, 0.35) 0%, transparent 60%);
}
.dojo-container-herring[data-container-state="opening"] .dojo-object-img {
  animation: dojoHerringWobble 0.45s ease-out;
}
.dojo-container-herring[data-container-state="sealed"] .dojo-object-img {
  filter: none;
}
@keyframes dojoHerringWobble {
  0%   { transform: translateX(0) rotate(0); }
  25%  { transform: translateX(-2px) rotate(-4deg); }
  55%  { transform: translateX(2px) rotate(3deg); }
  100% { transform: translateX(0) rotate(0); }
}

/* Resumed / Friend-View containers — fade in, no animation, no seal. */
.dojo-container-resumed .dojo-container-seal,
.dojo-container-resumed .dojo-container-scroll-pop {
  display: none;
}
.dojo-container-resumed {
  animation: dojoContainerFadeIn 0.35s ease-out;
}
@keyframes dojoContainerFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .dojo-container-seal,
  .dojo-container[data-container-state="opening"] .dojo-object-img,
  .dojo-container[data-container-state="opening"] .dojo-container-scroll-pop,
  .dojo-container[data-container-state="opening"] .dojo-container-scroll-pop::before,
  .dojo-container[data-container-state="opening"] .dojo-container-scroll-pop::after,
  .dojo-container-herring[data-container-state="opening"] .dojo-object-img {
    animation: none !important;
  }
}

/* --- Wave 9: Try-in-Zo CTA chip (used on scroll modal + blueprint cards). --- */
.try-zo-cta {
  display: inline-block;
  margin-top: 12px;
  padding: 8px 14px;
  font-family: var(--font-display);
  font-size: 10px;
  line-height: 1.2;
  color: var(--color-bg-deep);
  background: var(--color-teal);
  border: 2px solid var(--color-bg-deep);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}
.try-zo-cta:hover,
.try-zo-cta:focus-visible {
  background: var(--color-gold);
  transform: translateY(-1px);
  outline: none;
}

/* --- Wave 9-B: Friend View chrome --- */
.dojo-friend-badge {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: var(--z-overlay);
  padding: 8px 12px;
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--color-gold);
  background: rgba(15, 14, 23, 0.85);
  border: 2px solid var(--color-gold);
  pointer-events: none;
}

.dojo-walk-own-path-cta {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-overlay);
  padding: 12px 20px;
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--color-bg-deep);
  background: var(--color-pixel-warm);
  border: 2px solid var(--color-bg-deep);
  cursor: pointer;
}
.dojo-walk-own-path-cta:hover,
.dojo-walk-own-path-cta:focus-visible {
  background: var(--color-gold);
  outline: none;
}

/* Per-archetype friend glow — applied to objects whose scrolls the friend found. */
.dojo-object.friend-glow-flow_keeper    .dojo-object-glow,
.dojo-object.friend-glow-signal_builder .dojo-object-glow,
.dojo-object.friend-glow-pattern_seeker .dojo-object-glow,
.dojo-object.friend-glow-bridge_maker   .dojo-object-glow,
.dojo-object.friend-glow-wanderer  .dojo-object-glow {
  opacity: 1;
}
.dojo-object.friend-glow-flow_keeper    .dojo-object-glow { box-shadow: 0 0 24px 6px var(--color-gold); }
.dojo-object.friend-glow-signal_builder .dojo-object-glow { box-shadow: 0 0 24px 6px var(--color-sakura); }
.dojo-object.friend-glow-pattern_seeker .dojo-object-glow { box-shadow: 0 0 24px 6px var(--color-teal); }
.dojo-object.friend-glow-bridge_maker   .dojo-object-glow { box-shadow: 0 0 24px 6px var(--color-moss); }
.dojo-object.friend-glow-wanderer  .dojo-object-glow { box-shadow: 0 0 24px 6px var(--color-pixel-warm); }

/* --- Toasts (Friend Mode share + persistent welcome) --- */
.dojo-share-toast,
.dojo-welcome-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-overlay);
  padding: 10px 16px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--color-pixel-cream);
  background: rgba(15, 14, 23, 0.92);
  border: 2px solid var(--color-teal);
  pointer-events: none;
  animation: dojoToastIn 0.25s ease-out;
}
.dojo-welcome-toast { border-color: var(--color-gold); }

@keyframes dojoToastIn {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* --- Share my Dojo button on in-Dojo reveal overlay --- */
.reveal-friend-share {
  margin-top: 16px;
  text-align: center;
}
.share-dojo-btn {
  background: var(--color-teal);
  color: var(--color-bg-deep);
}
.share-dojo-hint {
  margin-top: 6px;
  font-family: var(--font-body);
  font-size: 12px;
  color: rgba(254, 246, 228, 0.7);
}

/* Idle-hint glow — Wave B sets data-koro-hint="true" on the nearest
   unopened container after 30s of no progress. */
.dojo-object[data-koro-hint="true"]::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 12px;
  pointer-events: none;
  box-shadow: 0 0 18px 4px var(--color-gold);
  animation: dojoHintPulse 1.6s ease-in-out infinite;
}
@keyframes dojoHintPulse {
  0%, 100% { opacity: 0.35; }
  50%      { opacity: 0.85; }
}
@media (prefers-reduced-motion: reduce) {
  .dojo-object[data-koro-hint="true"]::after { animation: none; opacity: 0.5; }
}
