.ending-host { position:absolute; inset:0; z-index:20; }
.ending-host[hidden], .ending-scene [hidden], #preview-menu[hidden] { display:none !important; }
.ending-scene { position:absolute; inset:0; overflow:hidden; container-type:inline-size; background:#17142e; color:#fff4de; font-family:system-ui,sans-serif; }
#stage .ending-scene .ending-backdrop { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
#stage .ending-scene .ending-actor { position:absolute; bottom:auto; object-fit:contain; object-position:center bottom; transform-origin:center bottom; }
#stage .ending-scene .ending-luggage { z-index:3; top:15%; width:16%; height:23%; }
#stage .ending-scene .ending-wizard { z-index:2; top:1%; width:20%; height:37%; }
#stage .ending-scene[data-location="death"] .ending-luggage { top:65%; width:18%; height:25%; }
#stage .ending-scene[data-location="university"] .ending-luggage { top:65%; width:19%; height:26%; }
#stage .ending-scene[data-location="university"] .ending-wizard { top:45%; width:20%; height:46%; }
#stage .ending-scene[data-location="university"] .ending-wizard.seated { top:62%; width:22%; height:30%; }
.ending-bubble { position:absolute; z-index:5; top:3%; left:37%; width:25%; margin:0; padding:.7em 1em; border:2px solid #58412e; border-radius:50%; color:#35251b; background:#fff4de; font-size:clamp(7px,1.8cqw,20px); font-weight:750; line-height:1.25; text-align:center; }
.ending-bubble::after { content:""; position:absolute; right:-.65em; top:68%; width:1em; height:.8em; background:inherit; clip-path:polygon(0 0,100% 100%,0 75%); }
.ending-scene[data-location="university"] .ending-bubble { top:40%; left:55%; width:19%; }
.ending-scene[data-location="university"] .ending-bubble::after { right:42%; top:auto; bottom:-.65em; clip-path:polygon(0 0,100% 0,30% 100%); }
.ending-caption { position:absolute; z-index:6; bottom:2%; left:3%; right:3%; margin:0; padding:.35em .7em; border-radius:.6em; background:#101523d9; font-family:"Comic Sans MS","Comic Sans","Chalkboard SE",system-ui,sans-serif; font-size:clamp(7px,1.5cqw,17px); text-align:center; }
.ending-caption:empty { display:none; }
.ending-controls { position:absolute; z-index:8; left:2%; top:2%; display:flex; gap:.35em; }
.ending-scene button { color:#fff4de; background:#273447; border:1px solid #c9b58b; border-radius:.5em; font:600 clamp(7px,1.3cqw,15px)/1.2 system-ui,sans-serif; padding:.55em .7em; min-height:28px; cursor:pointer; }
.ending-scene button:focus-visible { outline:3px solid #ffdf90; outline-offset:2px; }
.ending-impact { position:absolute; z-index:5; left:58%; top:87%; color:#fff2bc; text-shadow:2px 2px #4a2d20; font-size:clamp(12px,3cqw,34px); font-weight:900; transform:rotate(-8deg); }
.ending-veil { position:absolute; z-index:7; inset:0; pointer-events:none; opacity:0; }
.ending-veil.shimmer { background:radial-gradient(circle at 20% 30%,#fffbe5 0,transparent 28%), repeating-conic-gradient(from 30deg,#b59dffc9 0deg,#7ae5f2b0 12deg,#ffe2ffbd 24deg); animation:ending-shimmer 1.7s ease-in-out both; }
@keyframes ending-shimmer { 0% { opacity:0; filter:blur(12px); } 35% { opacity:.5; } 80%,100% { opacity:1; filter:blur(2px); } }
.ending-veil.fade-out { background:#080b16; animation:ending-fade 1.8s ease-in forwards; }
@keyframes ending-fade { from { opacity:0; } to { opacity:1; } }
.ending-panel { position:absolute; z-index:9; inset:0; padding:5% 15%; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; background:#0b1025eb; }
.ending-panel h2 { margin:0 0 .6em; color:#ffe0a0; font:clamp(16px,3.5cqw,38px)/1.15 Georgia,serif; }
.ending-panel p { margin:0 0 1em; white-space:pre-line; font-size:clamp(8px,1.6cqw,18px); line-height:1.3; }
@media (prefers-reduced-motion:reduce) {
  .ending-veil.shimmer { animation:none; background:#cebded; opacity:.75; }
  .ending-veil.fade-out { animation:none; opacity:1; }
}
