/* WM-WEB-ACT4-NINE-MEMORY-021 — isolated Act 4 candidate */
.scene-memory .scene-stage {
  grid-template-columns: minmax(360px, .72fr) minmax(560px, 1.28fr);
  gap: clamp(20px, 3vw, 48px);
  padding-right: clamp(34px, 5vw, 78px);
}

.scene-memory .story-step h2 { max-width: 10.8em; font-size: clamp(37px, 3vw, 49px); }
.scene-memory .story-step p { max-width: 43em; }
.scene-memory .act4-closing-line {
  display: block;
  max-width: 42em;
  margin-top: 18px;
  color: var(--gold);
  font-family: var(--font-serif);
  font-size: clamp(16px, 1.35vw, 20px);
  font-weight: 500;
  line-height: 1.65;
}

.scene-memory .memory-visual { isolation: isolate; }
.scene-memory .pain-ring { transition: opacity 600ms ease, transform 850ms var(--ease); }
.scene-memory:not([data-frame-current="0"]) .pain-ring { opacity: .12; transform: scale(.94); }

.scene-memory .memory-stack {
  top: 48%;
  width: min(78%, 520px);
  height: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  perspective: none;
}

.scene-memory .memory-stack button {
  position: relative;
  width: 100%;
  height: clamp(64px, 8.2svh, 72px);
  min-height: 64px;
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  color: var(--paper);
  text-align: left;
  background: rgba(11, 29, 43, .95);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .14);
  opacity: .08;
  pointer-events: none;
  transform: translateY(34px) scale(.96);
  transition: opacity 520ms ease, transform 720ms var(--ease), border-color 260ms ease, box-shadow 260ms ease;
}
.scene-memory .memory-stack button span { color: var(--cyan); font-family: var(--font-data); font-size: 10px; letter-spacing: .1em; }
.scene-memory .memory-stack button b { font-family: var(--font-serif); font-size: clamp(17px, 1.45vw, 21px); font-weight: 500; }
.scene-memory .memory-stack button small { color: rgba(243, 240, 232, .54); font-size: 10px; letter-spacing: .04em; }
.scene-memory .memory-stack button:focus-visible { outline: 2px solid var(--paper); outline-offset: 3px; }
.scene-memory .memory-stack button:not(:disabled) { cursor: pointer; pointer-events: auto; }
.scene-memory .memory-stack button:not(:disabled):hover { border-color: rgba(120, 217, 209, .72); }
.scene-memory .memory-stack button.is-selected {
  z-index: 2;
  border-color: rgba(120, 217, 209, .92);
  box-shadow: 0 14px 32px rgba(0, 0, 0, .18), 0 0 24px rgba(120, 217, 209, .14);
  transform: translateX(8px) scale(1.015);
}

.scene-memory[data-frame-current="1"] .memory-stack button:nth-child(-n+1),
.scene-memory[data-frame-current="2"] .memory-stack button:nth-child(-n+2),
.scene-memory[data-frame-current="3"] .memory-stack button:nth-child(-n+3),
.scene-memory[data-frame-current="4"] .memory-stack button:nth-child(-n+4),
.scene-memory[data-frame-current="5"] .memory-stack button:nth-child(-n+5),
.scene-memory[data-frame-current="6"] .memory-stack button:nth-child(-n+5) {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.scene-memory[data-frame-current="6"] .memory-stack button.is-selected { transform: translateX(8px) scale(1.015); }
.scene-memory[data-frame-current="6"] .memory-stack {
  opacity: 1;
  transform: translate(-50%, -50%);
}
.scene-memory:is([data-frame-current="7"], [data-frame-current="8"], [data-frame-current="9"], [data-frame-current="10"], [data-frame-current="11"]) .memory-stack,
.scene-memory:is([data-frame-current="7"], [data-frame-current="8"], [data-frame-current="9"], [data-frame-current="10"], [data-frame-current="11"]) .layer-meter { opacity: 0; pointer-events: none; transform: translate(-50%, -50%) scale(.92); }
.scene-memory[data-frame-current="7"] .layer-meter em,
.scene-memory[data-frame-current="8"] .layer-meter em { transform: scaleX(1); }

.scene-memory .layer-meter { bottom: 0; transition: opacity 500ms ease, transform 700ms var(--ease); }
.scene-memory .layer-meter span { color: var(--cyan); letter-spacing: .06em; }

.memory-convergence {
  position: absolute;
  z-index: 7;
  inset: 5%;
  opacity: 0;
  pointer-events: none;
  transform: scale(1.04);
  transition: opacity 700ms ease, transform 900ms var(--ease);
}
.scene-memory[data-frame-current="7"] .memory-convergence { opacity: 1; transform: scale(1); }
.continuity-core {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: 50%;
  width: clamp(158px, 30%, 210px);
  aspect-ratio: 1;
  display: grid;
  place-content: center;
  gap: 5px;
  text-align: center;
  background: radial-gradient(circle at 36% 28%, rgba(120, 217, 209, .22), rgba(11, 29, 43, .98) 66%);
  border: 1px solid rgba(120, 217, 209, .72);
  border-radius: 50%;
  box-shadow: 0 0 60px rgba(120, 217, 209, .16), inset 0 0 32px rgba(120, 217, 209, .08);
  transform: translate(-50%, -50%);
}
.continuity-core small { color: var(--cyan); font-family: var(--font-data); font-size: 8px; letter-spacing: .14em; }
.continuity-core b { font-family: var(--font-serif); font-size: clamp(20px, 2.2vw, 28px); font-weight: 500; }
.continuity-core span { color: var(--paper-soft); font-size: 9px; }
.convergence-source {
  position: absolute;
  z-index: 4;
  min-width: 82px;
  padding: 10px 14px;
  color: var(--cyan);
  text-align: center;
  background: rgba(11, 29, 43, .92);
  border: 1px solid rgba(120, 217, 209, .34);
  border-radius: 999px;
  font-size: 11px;
}
.source-work { top: 10%; left: 13%; }
.source-learning { top: 10%; right: 13%; }
.source-life { left: 8%; bottom: 12%; }
.source-access { right: 8%; bottom: 12%; }
.convergence-line {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  width: 34%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(120, 217, 209, .64));
  transform-origin: right;
}
.line-work { transform: translate(-100%, -50%) rotate(42deg); }
.line-learning { transform: translate(0, -50%) rotate(-42deg); transform-origin: left; background: linear-gradient(90deg, rgba(120, 217, 209, .64), transparent); }
.line-life { transform: translate(-100%, -50%) rotate(-40deg); }
.line-access { transform: translate(0, -50%) rotate(40deg); transform-origin: left; background: linear-gradient(90deg, rgba(120, 217, 209, .64), transparent); }

.scene-memory .future-layers {
  inset: 4%;
  display: grid;
  grid-template-rows: 1fr auto auto auto 1fr;
  place-items: center;
  gap: 15px;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px) scale(.98);
}
.scene-memory:not([data-frame-current="8"]) .future-layers {
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px) scale(.98);
}
.scene-memory .future-layers::before { inset: 6%; border-radius: 28px; background: radial-gradient(circle, rgba(228, 184, 91, .09), transparent 64%); }
.scene-memory[data-frame-current="8"] .future-layers { opacity: 1; pointer-events: auto; transform: none; }
.future-core {
  position: relative;
  z-index: 2;
  align-self: end;
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 14px 22px;
  border: 1px solid rgba(120, 217, 209, .38);
  border-radius: 12px;
  background: rgba(11, 29, 43, .94);
}
.future-core small { color: var(--cyan); font-family: var(--font-data); font-size: 8px; }
.future-core b { position: static; font-family: var(--font-serif); font-size: 21px; font-weight: 500; transform: none; }
.future-core span { padding: 0; color: var(--paper-soft); border: 0; font-size: 8px; }
.future-track { position: relative; z-index: 2; display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; }
.future-track button {
  min-width: 76px;
  min-height: 64px;
  display: grid;
  place-content: center;
  gap: 3px;
  color: var(--gold);
  background: rgba(21, 27, 34, .95);
  border: 1px solid rgba(228, 184, 91, .42);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}
.future-track button:hover { border-color: rgba(228, 184, 91, .82); transform: translateY(-3px); box-shadow: 0 0 24px rgba(228, 184, 91, .12); }
.future-track button:focus-visible { outline: 2px solid var(--paper); outline-offset: 3px; }
.future-track button span { padding: 0; color: rgba(228, 184, 91, .7); border: 0; font-family: var(--font-data); font-size: 8px; }
.future-track button b { position: static; font-family: var(--font-serif); font-size: 17px; font-weight: 500; transform: none; }
.future-track > i { width: clamp(12px, 2vw, 28px); height: 1px; background: linear-gradient(90deg, rgba(228, 184, 91, .18), rgba(228, 184, 91, .72)); }
.scene-memory .future-layers > p { position: relative; z-index: 2; max-width: 46em; margin: 0; color: rgba(228, 184, 91, .66); font-size: 9px; letter-spacing: .04em; text-align: center; }
.scene-memory .future-layers > strong {
  position: relative;
  z-index: 2;
  width: min(16em, calc(88% - 48px));
  max-width: calc(88% - 48px);
  margin: 0 auto;
  color: var(--paper);
  font-family: var(--font-serif);
  font-size: clamp(24px, 2.45vw, 36px);
  font-weight: 500;
  line-height: 1.24;
  text-align: center;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.act4-value-bridge {
  position: absolute;
  z-index: 9;
  inset: 5%;
  display: grid;
  grid-template-rows: 1fr auto auto 1fr;
  place-items: center;
  gap: 18px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(22px) scale(.98);
  transition: opacity 650ms ease, transform 900ms var(--ease);
}

.act4-value-bridge::before {
  content: "";
  position: absolute;
  inset: 5%;
  background: radial-gradient(circle, rgba(120, 217, 209, .1), transparent 55%), radial-gradient(circle at 70% 62%, rgba(228, 184, 91, .08), transparent 44%);
  border: 1px solid rgba(120, 217, 209, .16);
  border-radius: 28px;
}

.scene-memory:is([data-frame-current="9"], [data-frame-current="10"], [data-frame-current="11"]) .act4-value-bridge {
  opacity: 1;
  transform: none;
}

.scene-memory:is([data-frame-current="9"], [data-frame-current="10"], [data-frame-current="11"]) :is(.future-layers, .memory-convergence) {
  opacity: 0;
  pointer-events: none;
}

.act4-value-core {
  position: relative;
  z-index: 2;
  align-self: end;
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 15px 22px;
  text-align: center;
  background: rgba(11, 29, 43, .94);
  border: 1px solid rgba(120, 217, 209, .42);
  border-radius: 14px;
  box-shadow: 0 0 36px rgba(120, 217, 209, .09);
}
.act4-value-core small { color: var(--cyan); font-family: var(--font-data); font-size: 8px; letter-spacing: .14em; }
.act4-value-core b { font-family: var(--font-serif); font-size: clamp(20px, 2vw, 27px); font-weight: 500; }
.act4-value-core span { color: var(--paper-soft); font-size: 9px; }

.act4-value-track {
  position: relative;
  z-index: 2;
  width: min(94%, 760px);
  display: grid;
  grid-template-columns: repeat(3, minmax(92px, 1fr) 22px) minmax(92px, 1fr);
  align-items: center;
  gap: 7px;
}
.act4-value-track > span {
  min-height: 82px;
  display: grid;
  place-content: center;
  gap: 5px;
  text-align: center;
  color: rgba(243, 240, 232, .34);
  background: rgba(11, 29, 43, .9);
  border: 1px solid rgba(120, 217, 209, .12);
  border-radius: 50%;
  transform: scale(.94);
  transition: color 400ms ease, border-color 400ms ease, box-shadow 500ms ease, transform 650ms var(--ease);
}
.act4-value-track small { color: inherit; font-family: var(--font-data); font-size: 8px; }
.act4-value-track b { font-family: var(--font-serif); font-size: clamp(15px, 1.4vw, 19px); font-weight: 500; }
.act4-value-track > i { height: 1px; background: linear-gradient(90deg, rgba(120, 217, 209, .14), rgba(120, 217, 209, .5)); }
.scene-memory[data-frame-current="9"] .act4-value-track span:nth-of-type(-n+2),
.scene-memory[data-frame-current="10"] .act4-value-track span:nth-of-type(-n+3),
.scene-memory[data-frame-current="11"] .act4-value-track span {
  color: var(--paper);
  border-color: rgba(120, 217, 209, .62);
  box-shadow: 0 0 30px rgba(120, 217, 209, .1);
  transform: scale(1);
}
.scene-memory[data-frame-current="11"] .act4-value-track span:last-of-type {
  color: var(--gold);
  border-color: rgba(228, 184, 91, .72);
  box-shadow: 0 0 34px rgba(228, 184, 91, .12);
}
.act4-value-bridge > p {
  position: relative;
  z-index: 2;
  max-width: 48em;
  margin: 0;
  color: rgba(243, 240, 232, .58);
  font-size: 10px;
  line-height: 1.6;
  text-align: center;
}

.act4-detail-trigger[hidden] { display: none; }
.act4-detail-dialog {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow: hidden;
  padding: 0;
  color: var(--paper);
  background: var(--ink-1);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 26px 80px rgba(0, 8, 14, .52);
}
.act4-detail-dialog[open] { display: flex; flex-direction: column; }
.act4-detail-dialog::backdrop { background: rgba(0, 8, 14, .76); }
.act4-detail-dialog header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 22px 26px 18px; border-bottom: 1px solid var(--line); }
.act4-detail-dialog header h2 { margin: 0; font-family: var(--font-serif); font-size: 21px; font-weight: 400; }
.act4-detail-dialog button { min-height: 44px; padding: 8px 12px; color: var(--paper); background: transparent; border: 1px solid var(--line); border-radius: 20px; cursor: pointer; }
.act4-detail-dialog button:focus-visible { outline: 2px solid var(--paper); outline-offset: 3px; }
.act4-detail-body { min-height: 0; padding: 0 26px 28px; overflow: auto; overflow-wrap: anywhere; }
.act4-persona-intro { margin: 0; padding: 16px 0; color: var(--paper-soft); border-bottom: 1px solid rgba(255,255,255,.08); font-size: 13px; line-height: 1.75; }
.act4-brand-name { color: var(--cyan); }
.act4-persona-name { color: var(--gold); }
.act4-detail-dialog h3 { margin: 22px 0; color: var(--cyan); font-family: var(--font-serif); font-size: 34px; font-weight: 400; }
.act4-detail-sections { display: grid; gap: 18px; }
.act4-detail-sections section { padding-top: 17px; border-top: 1px solid rgba(255,255,255,.08); }
.act4-detail-sections section:first-child { padding-top: 0; border-top: 0; }
.act4-detail-sections h4 { margin: 0 0 7px; color: var(--cyan); font-size: 11px; font-weight: 500; letter-spacing: .1em; }
.act4-detail-sections p { margin: 0; color: var(--paper-soft); font-size: 13px; line-height: 1.75; }

@media (min-width: 821px) and (max-width: 1180px) {
  .scene-memory .scene-stage { grid-template-columns: minmax(290px, .72fr) minmax(0, 1.28fr); gap: 16px; padding: 84px 28px 34px 42px; }
  .scene-memory .story-step h2 { font-size: clamp(32px, 4vw, 42px); }
  .scene-memory .story-step p { font-size: 13px; }
  .scene-memory .memory-stack { width: 84%; }
  .scene-memory .memory-stack button { height: 62px; min-height: 62px; }
}

@media (max-width: 820px), (max-width: 900px) and (orientation: landscape) and (max-height: 600px) {
  .scene-memory .scene-stage {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(196px, .82fr) minmax(284px, 1.18fr);
    gap: 8px;
    padding: 104px 18px 44px;
  }
  .scene-memory:is([data-frame-current="8"], [data-frame-current="9"], [data-frame-current="10"], [data-frame-current="11"]) .scene-stage {
    grid-template-rows: minmax(300px, .94fr) minmax(300px, 1.06fr);
  }
  .scene-memory .story-step h2 { max-width: 17ch; font-size: clamp(27px, 7.5vw, 34px); }
  .scene-memory .story-step p { font-size: clamp(12px, 3.35vw, 14px); line-height: 1.55; }
  /* The grid row owns compact-stage height; a 430px floor clips phone frames 8–11. */
  .scene-memory .memory-visual { min-height: 0; }
  .scene-memory .memory-stack { top: 48%; width: 96%; gap: 6px; }
  .scene-memory .memory-stack button { height: 52px; min-height: 52px; grid-template-columns: 27px 1fr auto; gap: 6px; padding: 0 10px; border-radius: 9px; }
  .scene-memory .memory-stack button span { font-size: 8px; }
  .scene-memory .memory-stack button b { font-size: 14px; }
  .scene-memory .memory-stack button small { font-size: 8px; }
  .scene-memory .memory-stack button.is-selected { transform: translateX(4px) scale(1.01); }
  .scene-memory .layer-meter { width: 90%; font-size: 8px; }
  .continuity-core { width: 132px; }
  .continuity-core b { font-size: 19px; }
  .convergence-source { min-width: 62px; padding: 7px 9px; font-size: 9px; }
  .source-work { top: 8%; left: 2%; }
  .source-learning { top: 8%; right: 2%; }
  .source-life { left: 0; bottom: 10%; }
  .source-access { right: 0; bottom: 10%; }
  .scene-memory .future-layers { inset: 0; gap: 10px; }
  .future-track { gap: 4px; }
  .future-track button { min-width: 58px; min-height: 58px; }
  .future-track button b { font-size: 14px; }
  .future-track > i { width: 7px; }
  .scene-memory .future-layers > p { max-width: 32em; font-size: 8px; }
  .scene-memory .future-layers > strong {
    width: min(15em, calc(100% - 32px));
    max-width: 100%;
    font-size: clamp(18px, 5.6vw, 24px);
    line-height: 1.28;
    text-align: center;
    text-wrap: balance;
    overflow-wrap: anywhere;
  }
  .act4-value-bridge { inset: 0; gap: 10px; }
  .act4-value-bridge::before { inset: 2%; border-radius: 20px; }
  .act4-value-core { padding: 11px 15px; }
  .act4-value-core b { font-size: 19px; }
  .act4-value-core span { max-width: 22em; font-size: 8px; }
  .act4-value-track { width: 98%; grid-template-columns: repeat(3, minmax(58px, 1fr) 7px) minmax(58px, 1fr); gap: 3px; }
  .act4-value-track > span { min-height: 62px; }
  .act4-value-track b { font-size: clamp(11px, 3.3vw, 14px); }
  .act4-value-bridge > p { max-width: 30em; padding: 0 12px; font-size: 8px; }
  .act4-detail-dialog header { padding: 16px 18px 13px; }
  .act4-detail-body { padding: 0 18px 22px; }
  .act4-detail-dialog h3 { margin: 18px 0; font-size: 28px; }
  .act4-detail-sections { gap: 14px; }
}

/* Expanded touch screens retain the split composition and readable previews.
   Disabled layers remain disabled; later frames still reveal active layers. */
@media (min-width: 821px) and (min-height: 601px) and (any-pointer: coarse),
       (min-width: 901px) and (any-pointer: coarse) {
  .scene-memory[data-frame-current="0"] .memory-stack button { opacity: .6; }
  .scene-memory[data-frame-current="6"] .layer-meter { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  body.is-mobile-story .scene-memory .memory-visual { min-height: 430px; }
  .scene-memory .pain-ring,
  .scene-memory .memory-stack button,
  .scene-memory .layer-meter,
  .memory-convergence,
  .scene-memory .future-layers,
  .act4-value-bridge,
  .act4-value-track > span,
  .future-track button { transition-duration: .001ms !important; transition-delay: 0ms !important; }
}
