/* ===== The rival's remains: a cutscene after the dragon dies or flees (src/ui/cutscenes/rival-remains.js) ===== */
.modal.rr-modal { position: fixed; inset: 0; width: auto; max-width: none; margin: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; background: #0b0807; animation: none; overflow: hidden; z-index: 140; }
.rr { position: absolute; inset: 0; overflow: hidden; font-family: var(--font-body); }
.rr-stage { position: absolute; inset: 0; background: #1a1210 center bottom / cover no-repeat; }
.rr-s1 .rr-stage, .rr-s2 .rr-stage { filter: blur(3px) brightness(.4) sepia(.3); transform: scale(1.06); }

/* step 0: out of the dark, the hero walks out of the den... */
.rr-s0::before { content: ""; position: absolute; inset: 0; z-index: 5; background: #000; pointer-events: none; animation: rrFromBlack 1.9s ease forwards; }
@keyframes rrFromBlack { 0%, 45% { opacity: 1; } 100% { opacity: 0; } }
.rr-hero, .rr-heap { position: absolute; bottom: 8%; width: 40vh; height: 52vh; min-width: 200px; min-height: 260px; }
.rr-hero .hero-live { position: absolute; inset: 0; } .rr-hero .hero-live .sprite { position: absolute; inset: 0; }
.rr-hero { left: 40%; transform: translateX(-50%); animation: rrWalk 3.3s cubic-bezier(.25,.6,.45,1) both; z-index: 2; }
@keyframes rrWalk { from { left: -20%; } to { left: 40%; } }
.rr-walk { position: absolute; inset: 0; transform-origin: 70% 100%; animation: rrBob .34s ease-in-out 9 alternate, rrTrip 1.4s 3.25s ease-out forwards; }
@keyframes rrBob { from { transform: translateY(0); } to { transform: translateY(-7px); } }
/* ...and catches a toe on the heap: pitch forward, windmill, catch the balance */
@keyframes rrTrip { 0% { transform: rotate(0); } 18% { transform: translate(12px, 4px) rotate(28deg); } 32% { transform: translate(18px, 4px) rotate(30deg); } 52% { transform: translate(20px, 0) rotate(-10deg); } 74% { transform: translate(18px, 0) rotate(5deg); } 100% { transform: translate(18px, 0) rotate(0); } }
.rr-dust i { position: absolute; bottom: 2%; left: 66%; width: 30px; height: 30px; border-radius: 50%; background: rgba(214,196,160,.75); opacity: 0; animation: rrDust .9s 3.3s ease-out both; }
.rr-dust i:nth-child(2) { left: 74%; animation-delay: 3.36s; } .rr-dust i:nth-child(3) { left: 58%; animation-delay: 3.42s; } .rr-dust i:nth-child(4) { left: 82%; animation-delay: 3.3s; width: 22px; height: 22px; } .rr-dust i:nth-child(5) { left: 64%; animation-delay: 3.5s; width: 40px; height: 40px; }
@keyframes rrDust { 0% { opacity: .9; transform: scale(.3); } 100% { opacity: 0; transform: translate(var(--dx, 18px), -26px) scale(1.6); } }
.rr-dust i:nth-child(odd) { --dx: -20px; }
/* the heap: the rival's own figure, charred, crumbled on the floor, still smoking */
.rr-heap { left: calc(40% + 3vh); bottom: 7%; width: 44vh; height: 18vh; min-width: 200px; min-height: 82px; z-index: 3; }
.rr-pile { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.rr-smoke, .rr-embers { position: absolute; inset: 0; pointer-events: none; }
.rr-smoke i { position: absolute; bottom: 6%; left: 45%; width: 46px; height: 46px; border-radius: 50%; background: radial-gradient(circle, rgba(200,190,172,.6), rgba(200,190,172,0) 70%); animation: rrSmoke 4.2s linear infinite; opacity: 0; }
.rr-smoke i:nth-child(2) { left: 30%; animation-delay: .7s; } .rr-smoke i:nth-child(3) { left: 58%; animation-delay: 1.4s; } .rr-smoke i:nth-child(4) { left: 38%; animation-delay: 2.1s; } .rr-smoke i:nth-child(5) { left: 52%; animation-delay: 2.8s; } .rr-smoke i:nth-child(6) { left: 24%; animation-delay: 3.5s; }
@keyframes rrSmoke { 0% { opacity: 0; transform: translate(0, 0) scale(.6); } 15% { opacity: .9; } 100% { opacity: 0; transform: translate(-30px, -220px) scale(3); } }
.rr-embers i { position: absolute; bottom: 8%; left: 50%; width: 4px; height: 4px; border-radius: 50%; background: #ffb05a; box-shadow: 0 0 6px #ff7a2a; opacity: 0; animation: rrEmber 2.6s ease-out infinite; }
.rr-embers i:nth-child(2n) { left: 35%; animation-delay: .4s; } .rr-embers i:nth-child(3n) { left: 62%; animation-delay: .9s; } .rr-embers i:nth-child(4n) { left: 44%; animation-delay: 1.5s; } .rr-embers i:nth-child(5n) { left: 55%; animation-delay: 2s; }
@keyframes rrEmber { 0% { opacity: 0; transform: translate(0, 0); } 10% { opacity: 1; } 100% { opacity: 0; transform: translate(12px, -140px); } }

/* steps 1 and 2: a close look at what is left */
.rr-close { position: absolute; left: 50%; top: 9%; width: min(620px, 86vw); aspect-ratio: 480 / 188; transform: translateX(-50%); border: 3px solid #17110c; box-shadow: 0 0 0 3px #b48a3c, 0 24px 60px rgba(0,0,0,.7); overflow: hidden; z-index: 2; }
.rr-s1 .rr-close { animation: rrZoom 1s cubic-bezier(.2,.7,.3,1) both; }
@keyframes rrZoom { from { opacity: 0; transform: translateX(-50%) scale(.55) translateY(40%); } to { opacity: 1; transform: translateX(-50%) scale(1); } }
.rr-close img { width: 100%; height: 100%; object-fit: cover; display: block; filter: sepia(.25) contrast(1.05); }
.rr-close .rr-smoke i { bottom: 10%; width: 70px; height: 70px; }

/* the words: a parchment slip along the bottom */
.rr-box { position: absolute; left: 50%; bottom: 4%; width: min(760px, 92vw); transform: translateX(-50%); z-index: 3; text-align: left;
  background: #e8dcc0; color: #17110c; border: 3px solid #17110c; box-shadow: 0 0 0 3px #b48a3c, 0 20px 50px rgba(0,0,0,.6); padding: 16px 22px 14px; animation: rrBox .6s ease both; }
.rr-s0 .rr-box { top: 6%; bottom: auto; animation-delay: 4.2s; } .rr-s1 .rr-box { animation-delay: .8s; }
/* hidden AND unclickable until it fades in, so the walk-out can't be skipped */
@keyframes rrBox { from { opacity: 0; visibility: hidden; transform: translate(-50%, 16px); } to { opacity: 1; visibility: visible; transform: translate(-50%, 0); } }
.rr-name b { display: block; font: 700 24px var(--font-head, serif); } .rr-name small { color: #5e1a14; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: 11.5px; }
.rr-line { font: italic 500 17px/1.5 var(--font-head, serif); margin: 6px 0 12px; }
.rr-line .rv-note { font-style: normal; }
.rr-acts { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 600px) { .rr-line { font-size: 15px; } .rr-name b { font-size: 20px; } .rr-box { padding: 12px 14px; } .rr-close { top: 6%; } }
body.no-fx .rr *, body.no-fx .rr::before { animation-duration: .01s !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; }
.rr-acts .btn { background: #8a2a1f !important; color: #eadfc4 !important; border: 2px solid #17110c !important; box-shadow: 2px 2px 0 #17110c; }
.rr-acts .btn:not(.primary) { background: #3e3020 !important; }

/* Codex: the Cutscenes tab and replays */
.codex-scene .cs-art img { width: 100%; max-height: none; height: 92px; object-fit: cover; border-radius: 6px; }
.beast.codex-scene.unseen .cs-art img { filter: blur(5px) brightness(.35) grayscale(.6); }
.codex-scene .btn { align-self: flex-start; margin-top: auto; }
.modal.rr-modal.codex-replay { z-index: 160; }
/* once the dragon has been slain: no waiting, the text and choices show at once */
.rr-skip.rr-s0::before { animation-duration: .3s; }
.rr-skip .rr-box { animation-delay: 0s !important; animation-duration: .3s !important; }
