@import url("./race.css");
.party-game,
.party-final {
  border: 3px solid #20372f;
  background: #fffdf1;
  box-shadow: 6px 6px #20372f;
  overflow: hidden;
}
.party-hud {
  display: grid;
  gap: 6px;
  padding: 14px 18px;
  background: #20372f;
  color: #fff;
  font-size: 0.9rem;
  min-height: 70px;
}
.party-hud > span {
  font-size: 0.82rem;
}
.party-stage {
  width: 100%;
  aspect-ratio: 640/520;
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 45%, #d5eece, #a6d9d9);
}
.party-world {
  width: 640px;
  height: 520px;
  position: absolute;
  transform-origin: top left;
}
.party-actor {
  position: absolute;
  width: 74px;
  height: 116px;
  margin-left: -37px;
  margin-top: -112px;
  transform-origin: 50% 100%;
  transition: left 0.08s linear, top 0.08s linear, opacity 0.55s,
    transform 0.55s;
  pointer-events: none;
}
.party-actor > [data-slot="character"] {
  transform: scale(0.6);
  transform-origin: 50% 100%;
}
.party-actor > [data-slot="name"] {
  position: absolute;
  left: 50%;
  top: 34px;
  transform: translateX(-50%);
  white-space: nowrap;
  max-width: 125px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
  font-weight: 800;
  background: #fffbe9;
  border: 1px solid #20372f;
  padding: 2px 4px;
  border-radius: 4px;
}
.party-actor.is-you > [data-slot="name"] {
  background: #e4ff72;
}
.party-actor.is-fallen {
  opacity: 0;
  transform: translateY(75px) scale(0.35) rotate(15deg);
}
.mushroom-tile {
  position: absolute;
  width: 194px;
  height: 141px;
  margin-left: -97px;
  margin-top: -70px;
  transition: transform 0.45s, opacity 0.45s;
}
.mushroom-stem {
  position: absolute;
  top: 65px;
  left: 65px;
  width: 64px;
  height: 95px;
  background: #e9e2cb;
  border: 3px solid #3c5646;
  border-radius: 0 0 30px 30px;
  box-shadow: 0 14px 14px #274f4433;
}
.mushroom-cap {
  position: absolute;
  inset: 0;
  border: 4px solid #314b3c;
  border-radius: 50%;
  background: radial-gradient(
      circle at 25% 35%,
      #ffffff65 0 12px,
      transparent 13px
    ),
    radial-gradient(circle at 78% 55%, #ffffff65 0 16px, transparent 17px),
    var(--tile-color);
  box-shadow: 0 10px #45664f;
  display: grid;
  place-items: center;
}
.mushroom-cap strong {
  font-size: 35px;
  color: #20372f88;
}
.mushroom-tile.is-safe .mushroom-cap {
  outline: 4px solid #fff7b0;
  outline-offset: -9px;
}
.mushroom-tile.is-sunk {
  transform: translateY(70px);
  opacity: 0.12;
}
.mushroom-cue {
  padding: 10px;
  text-align: center;
  font-weight: 900;
  border-bottom: 3px solid #20372f;
  font-size: 1.1rem;
  min-height: 47px;
}
.memory-controls {
  padding: 18px;
  text-align: center;
  border-top: 2px solid #20372f;
}
.memory-controls [role="group"] {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 12px;
}
.memory-controls [data-lane] {
  padding: 12px;
  border: 2px solid #20372f;
  background: #f3eed9;
  font-weight: 800;
  cursor: pointer;
}
.memory-controls [aria-pressed="true"] {
  background: #e4ff72;
  box-shadow: 3px 3px #20372f;
}
.memory-controls button:disabled {
  opacity: 0.5;
  cursor: default;
}
.memory-controls p {
  font-size: 0.75rem;
}
.party-final {
  text-align: center;
  padding: 35px;
}
.party-final h2 {
  font-size: clamp(2rem, 5vw, 3rem);
  margin: 18px 0;
}
.party-winners {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 25px;
}
.party-final-scores {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin: 20px 0 30px;
}
.party-final-scores .player-badge {
  padding: 10px;
  background: #edf2d8;
}
body:has(.party-game) .masthead,
body:has(.party-final) .masthead {
  display: none;
}
@media (min-width: 700px) {
  .party-game {
    max-width: 660px;
    margin: auto;
  }
  .memory-stage {
    aspect-ratio: 640/490;
  }
}
@media (prefers-reduced-motion: reduce) {
  .party-actor,
  .mushroom-tile {
    transition: none;
  }
}
/* Trail Recall is one continuous world; only its camera moves between islands. */
.memory-camera {
  position: absolute;
  inset: 0;
  transition: transform 0.08s linear;
}
.memory-island {
  position: absolute;
  left: 65px;
  width: 510px;
  height: 105px;
  border: 4px solid #20372f;
  border-radius: 50%;
  background: var(--island-color);
  box-shadow: 0 18px #527257;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  color: #20372f;
}
.memory-island > span {
  font-size: 48px;
}
.memory-island > b {
  font-size: 15px;
  letter-spacing: 2px;
}
.memory-stone {
  position: absolute;
  width: 130px;
  height: 75px;
  border: 4px solid #20372f;
  border-radius: 50%;
  background: #e4d7a4;
  box-shadow: 0 14px #8a8261, 0 19px #20372f;
  display: grid;
  place-items: center;
  transition: opacity 0.45s, transform 0.45s;
}
.memory-stone[hidden] {
  display: none;
}
.memory-stone.is-safe {
  background: #e4ff9e;
}
.memory-stone.is-sunk {
  opacity: 0;
  transform: translateY(80px);
}
@media (prefers-reduced-motion: reduce) {
  .memory-camera,
  .memory-stone {
    transition: none;
  }
}
.cap-hop .party-actor > [data-slot="character"] {
  transform: scale(0.75);
}
.cap-hop .party-actor > [data-slot="name"] {
  top: 18px;
}
.cap-hop .mushroom-stem {
  left: calc(50% - 32px);
  top: 50%;
}

.party-hud:has(.party-sound) {
  position: relative;
  padding-right: 104px;
}
.party-sound {
  position: absolute;
  right: 12px;
  top: 14px;
  border: 1px solid #ffffff88;
  background: transparent;
  color: inherit;
  padding: 6px 9px;
  font-size: 12px;
  cursor: pointer;
  border-radius: 5px;
}


.party-actor {
    isolation: isolate;
  }
  
  .party-actor > [data-slot="name"] {
    position: absolute;
    z-index: 0;
  }
  
  .party-actor > [data-slot="character"] {
    position: relative;
    z-index: 1;
  }

/* Overlays stay anchored to the viewport while the course scrolls below. */
.memory-intro {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #20372f55;
  opacity: 0;
  transition: opacity .8s ease;
  pointer-events: none;
}
.memory-intro.is-visible { opacity: 1; }
.memory-intro strong {
  max-width: 480px;
  text-align: center;
  font-size: clamp(1.8rem, 6vw, 3.2rem);
  line-height: 1.1;
  color: #fffdf1;
  text-shadow: 0 3px #20372f;
}
.memory-timer {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 11;
  width: 52px;
  height: 52px;
  padding: 5px;
  border-radius: 50%;
  background: conic-gradient(#d94343 var(--remaining, 360deg), #efd3cc 0);
  box-shadow: 0 2px 8px #20372f33;
  pointer-events: none;
}
.memory-timer span {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #fffdf1;
  color: #b62b2b;
  font-size: 22px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
@media (prefers-reduced-motion: reduce) {
  .memory-intro { transition: none; }
}
