/* Retained steps, card flights and the original R4 chapter/card motion. */
.site-header {isolation:isolate}
.site-header .header-right {display:none}
.r4-memory-progress {position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);display:flex;align-items:center;gap:12px}
.r4-memory-step {display:flex;align-items:center;gap:7px;color:var(--muted)}
.r4-step-art {display:flex;align-items:center;justify-content:center;width:34px;height:34px;border:1px solid #6d78692a;border-radius:11px;overflow:hidden;font:11px/1 var(--ui);background:#fbf7ee4a;transition:border-color .25s var(--ease),background .25s var(--ease)}
.r4-memory-step.current .r4-step-art {border-color:#42664f85;background:var(--cream)}
.r4-memory-step.complete .r4-step-art {border-color:#42664f45}
.r4-step-name {font-size:10px;letter-spacing:.5px;white-space:nowrap}
.r4-memory-step.current .r4-step-name {color:var(--forest)}
.r4-step-art img {width:100%;height:100%;object-fit:cover}
.r4-step-link {width:22px;height:1px;background:#6d78692e}
.r4-mini-palette {display:flex;width:100%;height:100%;overflow:hidden}
.r4-mini-palette i {display:block;flex:1}
.r4-mini-pair {display:flex;width:100%;height:100%}
.r4-mini-pair>.r4-mini-palette,.r4-mini-pair>img {width:50%;flex:1;min-width:0}
#stage :is(.visual-card,.palette-card,.choice,.p2-action,.n2-choice) {transition:transform .24s var(--spring),box-shadow .24s var(--ease),background-color .24s var(--ease)}
#stage :is(.visual-card,.palette-card,.n2-choice):active {transform:scale(.986)}
#stage :is(.visual-card,.palette-card).selected:after {animation:r4-check-in .3s var(--spring) both}
#stage :is(h1,h2,strong)[tabindex="-1"]:focus {outline:none}
@keyframes r4-check-in {from{opacity:0;transform:scale(.6)}to{opacity:1;transform:scale(1)}}
#stage .p2-scene[data-action="c"] .p2-books {transform:none}
#stage .p2-books {transition:opacity .28s var(--ease)}
#stage .p2-shelf-row {transition:background-color .3s var(--ease)}
.r4-chapter-mode,.r4-chapter-mode .site-shell {background:radial-gradient(ellipse at 55% 40%,#ffffff18,transparent 75%),var(--clay)}
.r4-chapter-mode .site-header {background:transparent}
.r4-chapter {max-width:1130px;min-height:calc(100svh - 88px);margin:0 auto;padding:16px 35px 80px;display:grid;grid-template-columns:minmax(0,1.16fr) minmax(0,1fr);gap:60px;align-items:center}
.r4-chapter-kicker {font:11px/1.8 var(--ui);letter-spacing:1.6px;color:#52694f;margin:0 0 30px}
.r4-chapter h1 {font:400 clamp(30px,3.25vw,48px)/1.5 var(--editorial);letter-spacing:.03em;color:var(--deep);margin:0 0 24px;text-wrap:balance}
.r4-chapter-description {font:13px/1.95 var(--ui);color:#52694f;max-width:440px}
.r4-chapter-description p {margin:0 0 6px}
.r4-chapter-continue {display:flex;justify-content:space-between;align-items:center;gap:35px;width:230px;min-height:60px;padding:0 24px;margin-top:32px;border:1px solid #ffffff30;border-radius:20px;background:linear-gradient(135deg,#426b55,#294d40);color:var(--cream);font:14px/1.5 var(--ui);box-shadow:inset 0 1px #ffffff18,0 3px 0 #61775b80,0 12px 25px #673c2515;cursor:pointer;transition:transform .2s var(--spring),box-shadow .2s var(--ease)}
.r4-chapter-continue:hover {transform:translateY(-2px);box-shadow:inset 0 1px #ffffff18,0 4px 0 #61775b80,0 16px 28px #673c2520}
.r4-chapter-continue:active {transform:translateY(2px)}
.r4-chapter-continue span {font-size:20px}
.r4-chapter-back {display:block;min-height:44px;margin-top:14px;padding:8px 0;border:0;background:none;color:#52694f;font:11px/1.5 var(--ui);text-decoration:underline;text-underline-offset:4px;cursor:pointer}
.r4-memory-stack {position:relative;height:410px;perspective:1000px}
.r4-memory-card {position:absolute;top:50%;left:50%;width:250px;height:317px;padding:11px 11px 0;border:1px solid #ffffff80;border-radius:19px;background:var(--cream);box-shadow:0 14px 27px #673c2525;transform-origin:center;transition:transform .5s var(--spring)}
.r4-memory-back {z-index:1;--card-turn:13deg;--card-x:36px;--card-y:13px;background:#e0e1cb;transform:translate(calc(-50% + var(--card-x)),calc(-50% + var(--card-y))) rotate(var(--card-turn));animation:r4-memory-enter .65s var(--ease) backwards}
.r4-memory-front {z-index:2;--card-turn:-5deg;--card-x:-13px;--card-y:-5px;transform:translate(calc(-50% + var(--card-x)),calc(-50% + var(--card-y))) rotate(var(--card-turn));animation:r4-memory-enter .65s var(--ease) backwards}
.r4-memory-picture {width:100%;height:260px;border-radius:11px;overflow:hidden;background:#ece6d7;display:grid;place-items:center}
.r4-memory-picture img {display:block;width:100%;height:100%;object-fit:cover}
.r4-memory-front .r4-memory-picture img {object-fit:contain}
.r4-no-image {font-size:12px;color:var(--muted)}
.r4-memory-card p {font:11px/1.6 var(--ui);color:var(--muted);margin:13px 7px}
@keyframes r4-memory-enter {from{opacity:.2;transform:translate(-50%,calc(-50% + 35px)) rotate(0)}to{opacity:1;transform:translate(calc(-50% + var(--card-x)),calc(-50% + var(--card-y))) rotate(var(--card-turn))}}
@media(hover:hover) {
  .r4-memory-stack:hover .r4-memory-back {transform:translate(calc(-50% + 52px),calc(-50% + 9px)) rotate(19deg)}
  .r4-memory-stack:hover .r4-memory-front {transform:translate(calc(-50% - 22px),calc(-50% - 8px)) rotate(-10deg)}
}
@media(max-width:980px) {
  .r4-step-name {display:none}
  .r4-chapter {gap:28px;padding-inline:40px}
  .r4-chapter h1 {font-size:34px}
  .r4-memory-card {width:215px;height:285px}
  .r4-memory-picture {height:228px}
  .r4-memory-back {--card-x:24px;--card-y:10px}
}
@media(hover:hover) and (max-width:980px) {
  .r4-memory-stack:hover .r4-memory-back {transform:translate(calc(-50% + 30px),calc(-50% + 9px)) rotate(15deg)}
  .r4-memory-stack:hover .r4-memory-front {transform:translate(calc(-50% - 18px),calc(-50% - 8px)) rotate(-8deg)}
}
@media(max-width:700px) {
  .site-header .header-caption {display:none}
  .r4-memory-progress {position:static;margin-left:auto;transform:none;gap:8px}
  .r4-step-art {width:29px;height:29px;border-radius:9px;font-size:10px}
  .r4-step-link {width:15px}
  .r4-chapter {min-height:calc(100svh - 48px);padding:27px 25px 32px;grid-template-columns:minmax(0,1fr);gap:5px;align-content:start}
  .r4-chapter-copy {grid-row:2}
  .r4-chapter h1 {font-size:clamp(25px,6.4vw,34px);line-height:1.5;margin-bottom:16px}
  .r4-chapter-kicker {margin-bottom:14px;font-size:10px}
  .r4-chapter-description {font-size:12px;line-height:1.8}
  .r4-wide-break {display:none}
  .r4-chapter-continue {width:100%;max-width:310px;margin-top:22px;min-height:54px;border-radius:17px}
  .r4-chapter-back {margin-top:9px}
  .r4-memory-stack {height:250px;width:100%;margin-bottom:20px}
  .r4-memory-card {width:164px;height:218px;padding:8px 8px 0;border-radius:14px}
  .r4-memory-picture {height:172px;border-radius:8px}
  .r4-memory-card p {font-size:9px;margin:10px 4px}
}
@media(prefers-reduced-motion:reduce) {
  .r4-memory-card,.r4-memory-step,.r4-chapter-continue,#stage * {animation:none!important;transition:none!important}
  .r4-memory-stack:hover .r4-memory-card {transform:translate(calc(-50% + var(--card-x)),calc(-50% + var(--card-y))) rotate(var(--card-turn))}
}
@media(max-width:700px) and (max-height:700px) {
  .r4-chapter {padding:18px 25px 20px}
  .r4-memory-stack {height:188px;margin-bottom:12px}
  .r4-memory-card {width:135px;height:180px;padding:7px 7px 0;border-radius:12px}
  .r4-memory-picture {height:140px}
  .r4-memory-card p {font-size:8px;margin:9px 3px}
  .r4-chapter-kicker {margin-bottom:10px}
  .r4-chapter h1 {font-size:25px;line-height:1.4;margin-bottom:12px}
  .r4-chapter-description {line-height:1.7}
  .r4-chapter-continue {margin-top:16px}
  .r4-chapter-back {margin-top:3px}
}
