/* Presentation layers mirror the original slot's escalating visual beats. */
#slotFx {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 75;
}
#dialogFx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
}
#dialogBody,
.close {
  position: relative;
  z-index: 4;
}
.close {
  position: absolute;
}
.machine {
  position: relative;
  isolation: isolate;
  --cell-height: 135px;
}
.window {
  display: block;
  position: relative;
  height: var(--cell-height);
}
.window:before,
.window:after {
  z-index: 2;
  pointer-events: none;
  color: #b4d2bd44;
}
.strip {
  position: absolute;
  inset: 0;
  will-change: transform;
}
.slot-cell {
  height: var(--cell-height);
  display: grid;
  place-items: center;
  position: relative;
}
.slot-cell .gain {
  line-height: 1;
  white-space: nowrap;
}
.strip.rest {
  height: 300%;
  top: calc(var(--cell-height) * -1);
}
.slot-cell.ghost {
  opacity: 0.15;
}
.rolling .strip {
  height: 1200%;
  animation: reelRoll 0.34s linear infinite;
}
.rolling .gain {
  animation: none;
  filter: blur(0.5px);
}
.rolling.slow .strip {
  animation-duration: 0.8s;
}
.reel .window:after {
  inset: 0;
  content: "";
  z-index: 3;
  background: linear-gradient(#000a, transparent 30%, transparent 70%, #000a);
}
.reel .window:before {
  display: none;
}
.reel.landing .window {
  animation: reelLand 0.28s;
}
.window[data-t="4"] {
  border-color: #ff2e4d;
  box-shadow:
    0 0 20px #ff2e4d66,
    inset 0 0 20px #ff2e4d55;
}
.window[data-t="5"] {
  border-color: #ffc93c;
  box-shadow:
    0 0 30px #ffc93c77,
    inset 0 0 25px #ffc83c66;
}
.window[data-t="6"] {
  border-color: #fff;
  box-shadow:
    0 0 35px #ff5ec888,
    inset 0 0 25px #fff5;
  animation: reelRainbow 1s linear infinite;
}
.reach6 .window {
  box-shadow: 0 0 40px #ffb9f188;
}
.grade-up .reel-value {
  animation: gradeUp 0.7s;
}
.machine[data-edge="4"] {
  border-color: #ff637b;
  box-shadow: 0 0 30px #ff284833;
}
.machine[data-edge="5"],
.machine[data-aura="gold"] {
  border-color: #ffd270;
  box-shadow: 0 0 45px #ffc13b77;
}
.machine[data-edge="6"],
.machine[data-aura="rainbow"] {
  border-color: #ffc8f0;
  box-shadow: 0 0 60px #c080ff88;
}
.machine.focused {
  z-index: 22;
}
.focused .reel {
  opacity: 0.24;
  transition: opacity 0.15s;
}
.focused .reel.spotlit {
  opacity: 1;
  z-index: 3;
  transform: scale(1.04);
}
#focusDim {
  position: fixed;
  inset: 0;
  opacity: 0;
  background: #000a;
  z-index: 20;
  pointer-events: none;
  transition: opacity 0.12s;
}
#focusDim.on {
  opacity: 1;
}
.reel.dying {
  animation: dying 0.12s infinite;
}
.machine.fz-still {
  filter: grayscale(1) brightness(0.45);
}
.fz-still .strip {
  animation-play-state: paused;
}
.machine.drain {
  filter: grayscale(1);
  transition: filter 0.7s;
}
.shake {
  animation: shake 0.4s;
}
.shake-l {
  animation: shake 0.7s;
}
.shake-xl {
  animation: shake 0.12s 10;
}
#flash {
  z-index: 90;
}
#flash[data-color="rainbow"] {
  background: linear-gradient(120deg, #ff4489, #ffe6a4, #a8ffd9, #a3bfff);
}
#flash[data-color="pink"] {
  background: #ffc4db;
}
#flash[data-color="white"] {
  background: #fff;
}
#impact {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 65;
  display: none;
}
#impact.go {
  display: block;
  animation: impactFade 1s forwards;
}
#impact:before {
  content: "";
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 90vmax;
  height: 90vmax;
  transform: translate(-50%, -50%);
  background: repeating-conic-gradient(
    from 10deg,
    #ffe09e44 0 5deg,
    transparent 5deg 16deg
  );
  mask-image: radial-gradient(circle, #000, transparent 65%);
}
#impact[data-kind="rainbow"]:before {
  background: repeating-conic-gradient(
    #ff92d455 0 6deg,
    #8ad8ff55 6deg 12deg,
    transparent 12deg 25deg
  );
}
#effectWord {
  position: fixed;
  inset: 0;
  z-index: 85;
  pointer-events: none;
  display: none;
  place-content: center;
  text-align: center;
  gap: 14px;
  text-shadow:
    0 4px 25px #000,
    0 2px 8px #000;
}
#effectWord.go {
  display: grid;
  animation: wordPunch 1.85s forwards;
}
#effectWord strong {
  font:
    clamp(38px, 7vw, 90px)/1.25 Immortal,
    serif;
  background: linear-gradient(
    90deg,
    #ff91b7,
    #ffe7a0,
    #a3ffda,
    #a6ceff,
    #d6b9ff
  );
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 3px #000);
}
#effectWord[data-kind="gold"] strong {
  background-image: linear-gradient(#fff7dc, #ffd65e, #fff4b9);
}
#effectWord small {
  font-size: clamp(13px, 2vw, 24px);
  color: #fff0cc;
  letter-spacing: 3px;
}
#effectGain {
  position: fixed;
  left: var(--x);
  top: var(--y);
  z-index: 84;
  pointer-events: none;
  display: none;
  color: #fff6cc;
  font:
    bold 68px Georgia,
    serif;
  text-shadow:
    0 0 18px #ffd270,
    0 4px 5px #000;
}
#effectGain.go {
  display: block;
  animation: gainPunch 1.3s forwards;
}
#rushGate {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  display: none;
  overflow: hidden;
}
#rushGate.go {
  display: block;
}
#rushGate i {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  background: repeating-linear-gradient(
    90deg,
    #1b0c27,
    #512146 12%,
    #170b22 23%
  );
  border: 1px solid #dbb87e;
  animation: gateLeft 2.7s forwards;
}
#rushGate i:first-child {
  left: 0;
}
#rushGate i:nth-child(2) {
  right: 0;
  animation-name: gateRight;
}
#rushGate b {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: #fff1c8;
  box-shadow: 0 0 30px 8px #ff9adb;
  animation: gateLine 2.2s forwards;
}
#crtBlackout {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 80;
  display: none;
  pointer-events: none;
}
#crtBlackout.on {
  display: block;
}
#crtBlackout i {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 3px;
  background: #fff;
  animation: crt 0.5s forwards;
}
#cutIn {
  position: fixed;
  top: 25%;
  left: 0;
  width: 100%;
  height: 300px;
  z-index: 78;
  pointer-events: none;
  display: none;
  background: linear-gradient(90deg, #08272a, #7e4054, #07252b);
  border-block: 3px solid #ffcf8a;
  box-shadow: 0 0 60px #000;
  overflow: hidden;
}
#cutIn.go {
  display: flex;
  justify-content: center;
  align-items: center;
  animation: cutSweep 1.05s forwards;
}
#cutIn .portrait {
  height: 440px;
  width: 440px;
  flex-shrink: 0;
  mask-image: linear-gradient(
    90deg,
    transparent,
    #000 20%,
    #000 80%,
    transparent
  );
  border: 0;
}
#cutIn > div:last-child {
  display: grid;
  margin-left: -80px;
  z-index: 1;
  text-shadow: 0 3px 10px #000;
  gap: 6px;
}
#cutIn strong {
  font:
    clamp(32px, 5vw, 64px) Immortal,
    serif;
  color: #ffda89;
  white-space: nowrap;
}
#cutIn small {
  color: #ffeccc;
  letter-spacing: 8px;
}
#cutIn span {
  font:
    24px Immortal,
    serif;
}
.freeze-scene {
  display: none;
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  background: #000;
  overflow: hidden;
}
.freeze-scene.on {
  display: block;
}
.freeze-scene p {
  position: absolute;
  top: 25%;
  left: 0;
  right: 0;
  text-align: center;
  font:
    clamp(22px, 3vw, 40px) Immortal,
    serif;
  letter-spacing: 6px;
  opacity: 0;
  color: #e8d5a8;
  z-index: 3;
  transition: opacity 0.8s;
}
.freeze-scene.heartbeat {
  animation: heartbeat 1s;
}
.freeze-curtains {
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 0;
  background: repeating-linear-gradient(
    90deg,
    #180b25,
    #542643 8%,
    #170b24 16%
  );
  transition:
    opacity 0.8s,
    transform 2s;
}
.curtain .freeze-curtains,
.curtain p {
  opacity: 1;
}
.stage .freeze-curtains {
  transform: scaleX(0);
  opacity: 0;
}
.stage p {
  top: 12%;
  transition: top 1.6s;
}
.stage {
  background:
    radial-gradient(ellipse at 50% 20%, #ffe3a166, transparent 70%),
    url("art/immortal-mountain.png") center/cover;
}
.moon-arrival {
  position: absolute;
  width: min(60vh, 460px);
  height: min(60vh, 460px);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -42%) scale(0.85);
  opacity: 0;
  transition:
    opacity 1.5s,
    transform 2s;
  box-shadow: 0 0 80px #ffdc9277;
  mask-image: linear-gradient(#000 75%, transparent);
}
.stage .moon-arrival {
  opacity: 1;
  transform: translate(-50%, -42%) scale(1);
}
.arrival p {
  opacity: 0;
}
.whiteout {
  background: #fff;
  transition: background 0.5s;
}
.whiteout > * {
  opacity: 0 !important;
}
.freeze-scene.out {
  opacity: 0;
  transition: opacity 0.65s;
}
.event-list li.now {
  color: #fff2cd;
  box-shadow: inset 3px 0 #ffd578;
  background: #ffd57811;
  padding-left: 10px;
  animation: eventPulse 0.6s infinite;
}
.event-list li.off {
  opacity: 0.3;
}
.choice.sel {
  border-color: #ffdb92;
  box-shadow: 0 0 24px #ffc9a133;
  background: #d1a56f22;
}
.choice.un {
  opacity: 0.45;
}
.choice {
  transition:
    opacity 0.2s,
    box-shadow 0.2s;
}
.fork-confirm {
  margin-top: 18px;
  width: 100%;
}
.unlock-seal {
  font:
    80px Immortal,
    serif;
  text-align: center;
  color: #e7cb8c;
  padding: 30px;
  border: 1px solid #c0a36e;
  transition: box-shadow 1s;
}
.unlock-seal.open {
  box-shadow: 0 0 60px #ffabca66;
}
.unlock-value {
  font:
    30px Georgia,
    serif;
  text-align: center;
  color: #e9cd97;
  min-height: 55px;
}
.result-card.revealing .portrait,
.result-card.revealing h1,
.result-card.revealing h2,
.result-card.revealing blockquote {
  visibility: hidden;
}
.result-card {
  animation: resultAppear 0.7s;
}
@keyframes reelRoll {
  from {
    transform: translateY(-50%);
  }
  to {
    transform: translateY(0);
  }
}
@keyframes reelLand {
  30% {
    transform: scale(1.08);
  }
}
@keyframes reelRainbow {
  to {
    filter: hue-rotate(360deg);
  }
}
@keyframes dying {
  50% {
    filter: brightness(0.15);
  }
}
@keyframes gradeUp {
  40% {
    color: #fff;
    transform: scale(1.3);
    text-shadow: 0 0 20px #ffe1a1;
  }
}
@keyframes shake {
  0%,
  100% {
    transform: none;
  }
  20% {
    transform: translate(-1.2%, 0.6%);
  }
  40% {
    transform: translate(1.4%, -0.8%);
  }
  60% {
    transform: translate(-1%, 0.8%);
  }
  80% {
    transform: translate(0.8%, -0.4%);
  }
}
@keyframes wordPunch {
  0% {
    transform: scale(3.2);
    opacity: 0;
  }
  14% {
    transform: scale(1);
    opacity: 1;
  }
  82% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(1.06);
  }
}
@keyframes gainPunch {
  0% {
    transform: translate(-50%, -50%) scale(2.4);
    opacity: 0;
  }
  20% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  75% {
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -100%);
    opacity: 0;
  }
}
@keyframes impactFade {
  to {
    opacity: 0;
    transform: scale(1.2);
  }
}
@keyframes gateLeft {
  0% {
    transform: translateX(-100%);
  }
  23%,
  40% {
    transform: translateX(0);
  }
  65%,
  100% {
    transform: translateX(-105%);
  }
}
@keyframes gateRight {
  0% {
    transform: translateX(100%);
  }
  23%,
  40% {
    transform: translateX(0);
  }
  65%,
  100% {
    transform: translateX(105%);
  }
}
@keyframes gateLine {
  0%,
  28% {
    opacity: 0;
    transform: scaleX(0);
  }
  50% {
    opacity: 1;
    transform: scaleX(1);
  }
  100% {
    opacity: 0;
  }
}
@keyframes crt {
  to {
    left: 50%;
    right: 50%;
    opacity: 0;
  }
}
@keyframes cutSweep {
  0% {
    transform: translateX(-110%) skewX(-12deg);
  }
  16%,
  80% {
    transform: translateX(0) skewX(0);
  }
  100% {
    transform: translateX(110%) skewX(-12deg);
  }
}
@keyframes heartbeat {
  0%,
  100% {
    box-shadow: inset 0 0 0 #fff0;
  }
  25%,
  55% {
    box-shadow: inset 0 0 180px #c08a5c66;
  }
}
@keyframes eventPulse {
  50% {
    background: #ffd57828;
  }
}
@keyframes resultAppear {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (max-width: 650px) {
  .machine {
    --cell-height: 110px;
  }
  #cutIn {
    height: 230px;
  }
  #cutIn .portrait {
    width: 300px;
    height: 300px;
  }
  #cutIn > div:last-child {
    margin-left: -100px;
    padding-right: 20px;
  }
  #effectGain {
    font-size: 48px;
  }
  #effectWord small {
    letter-spacing: 1px;
    padding: 0 20px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .rolling .strip {
    animation-duration: 2s !important;
  }
  .shake,
  .shake-l,
  .shake-xl {
    animation: none !important;
  }
  #effectWord.go,
  #cutIn.go {
    animation: none !important;
    opacity: 1;
  }
}

.event-totals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 20px 0;
  clear: both;
}
.event-totals > div {
  border: 1px solid #bfaa7066;
  text-align: center;
  padding: 12px;
}
.event-totals small {
  display: block;
  color: #9caf9f;
  font-size: 11px;
}
.event-totals b {
  font:
    32px Georgia,
    serif;
  color: #f4d997;
}
.event-portrait-reveal {
  display: flow-root;
  border-top: 1px solid #c5ab7044;
  padding-top: 18px;
  margin-top: 18px;
  animation: resultAppear 0.7s;
}

#effectWord strong {
  text-shadow: none;
}

body.story-active #game {
  visibility: hidden;
}
dialog.story-stage {
  width: min(760px, calc(100vw - 32px));
  min-height: 570px;
  padding: 36px 48px;
  background:
    linear-gradient(#09272bed, #0c2529f5),
    url("art/immortal-mountain.png") center/cover;
}
.story-stage .choices {
  grid-template-columns: 1fr 1fr;
  clear: both;
  padding-top: 20px;
}
.story-stage .choice {
  min-height: 130px;
  align-content: center;
}
.story-stage .event-list li {
  padding-top: 12px;
  padding-bottom: 12px;
}
.story-stage #endingIdentity > .portrait {
  width: 240px;
  margin: 18px auto;
}
.story-stage #endingIdentity h2,
.story-stage #endingIdentity p {
  text-align: center;
}
.story-stage #continue {
  margin-top: 20px;
  width: 100%;
}
@media (max-width: 650px) {
  dialog.story-stage {
    width: 100vw;
    max-width: 100vw;
    min-height: 100svh;
    max-height: 100svh;
    margin: 0;
    border: 0;
    padding: 36px 22px;
  }
  .story-stage .choices {
    gap: 12px;
  }
  .story-stage .choice {
    padding: 14px;
    min-height: 150px;
  }
  .story-stage .choice strong {
    font-size: 18px;
  }
  .story-stage .vow-portrait {
    width: 145px;
  }
}
