.ending-scene{position:fixed;inset:0;z-index:1100;overflow:hidden;isolation:isolate;color:#fff9ef;background:#395c80;font-family:inherit}
.ending-scene *{box-sizing:border-box}
.ending-atmosphere{position:absolute;inset:0;background:linear-gradient(180deg,#22244c90 0%,#304d7860 43%,#152d5688 100%),url('assets/ending/sea-dawn-v1.png') center/cover no-repeat;transform:scale(1.04);transition:filter 2s,transform 11s}
.ending-scene[data-act="descent"] .ending-atmosphere,.ending-scene[data-act="gather"] .ending-atmosphere,.ending-scene[data-act="final"] .ending-atmosphere{filter:saturate(1.08) brightness(1.07);transform:scale(1)}
.ending-scene:after{content:'';position:absolute;inset:0;z-index:0;pointer-events:none;background:linear-gradient(90deg,#1b2d4b52,transparent 29%,transparent 71%,#1b2d4b52)}
.ending-crests{position:absolute;z-index:3;top:7%;left:50%;display:flex;gap:clamp(15px,4vw,60px);align-items:center;transform:translateX(-50%);filter:drop-shadow(0 4px 13px #1d214b88)}
.ending-crests img{width:clamp(44px,7vw,92px);height:clamp(44px,7vw,92px);object-fit:contain;animation:endingCrestQuiet 2.2s ease-in both}
.ending-crests img:nth-child(2){animation-delay:.16s}.ending-crests img:nth-child(3){animation-delay:.32s}
.ending-scene[data-act="descent"] .ending-crests,.ending-scene[data-act="gather"] .ending-crests,.ending-scene[data-act="final"] .ending-crests{opacity:0;transition:opacity .8s}
.ending-map{position:absolute;z-index:2;left:50%;top:31%;width:min(95vw,1050px);aspect-ratio:3/2;opacity:0;transform:translate(-50%,-105%) scale(.62) rotateX(18deg);transform-origin:50% 65%;filter:drop-shadow(0 18px 10px #30445980) drop-shadow(0 42px 32px #162b4ca0);pointer-events:none}
.ending-map svg{display:block;width:100%;height:100%;overflow:visible}
.ending-map .conquest-cloth{animation:conquestFlutter 1.5s ease-in-out infinite}
.ending-scene[data-act="descent"] .ending-map{opacity:1;animation:endingLandDescend 5.5s cubic-bezier(.18,.64,.25,1) forwards}
.ending-scene[data-act="gather"] .ending-map,.ending-scene[data-act="final"] .ending-map{opacity:1;transform:translate(-50%,-38%) scale(.68) rotateX(0);transition:transform 1.4s}
.ending-scene[data-act="final"] .ending-map{left:32%}
.ending-story{position:absolute;z-index:5;left:50%;bottom:9%;width:min(90%,650px);transform:translateX(-50%);padding:20px 30px;text-align:center;border:1px solid #fff8e899;border-radius:22px;background:#26334a9e;box-shadow:0 14px 42px #152a4c66;backdrop-filter:blur(11px);text-shadow:0 2px 9px #10254d}
.ending-story[hidden]{display:none}
.ending-story small,.ending-kicker{display:block;font-size:clamp(12px,1.6vw,15px);font-weight:700;letter-spacing:.1em;color:#ffe4ad}
.ending-story h2{margin:9px 0 8px;color:#fff9ee;font-size:clamp(26px,4.3vw,51px);line-height:1.2}
.ending-story p{margin:0;color:#fffaf0;font-size:clamp(14px,1.8vw,18px);line-height:1.5}
.ending-parade{position:absolute;z-index:4;left:3%;bottom:0;width:31%;height:42%;opacity:0;transform:translateY(30%);pointer-events:none}
.ending-scene[data-act="gather"] .ending-parade,.ending-scene[data-act="final"] .ending-parade{opacity:1;transform:translateY(0);transition:opacity 1.2s,transform 1.2s}
.ending-main-hero{position:absolute;z-index:2;left:14%;bottom:0;width:49%;height:100%;filter:drop-shadow(0 15px 16px #1c2f4fac)}
.ending-main-hero .hero-sprite,.ending-main-hero .kana-farmer{height:100%;width:100%;display:block}
.ending-main-hero svg,.ending-main-hero img{width:100%;height:100%;object-fit:contain;object-position:bottom}
.ending-companions{position:absolute;left:45%;right:0;bottom:9%;display:flex;align-items:flex-end;justify-content:flex-start;flex-wrap:wrap;gap:0}
.ending-companions>span{display:block;width:32%;height:115px;margin-left:-8%;filter:drop-shadow(0 7px 6px #223457b0)}
.ending-companions svg,.ending-companions img{width:100%;height:100%;object-fit:contain;object-position:bottom}
.ending-petals{position:absolute;inset:0;z-index:4;pointer-events:none;overflow:hidden}
.ending-petals i{position:absolute;left:var(--left);top:-10%;width:11px;height:7px;border-radius:90% 0 90% 0;background:#ffd0d5e0;box-shadow:0 0 10px #fff5eda6;transform:rotate(25deg);animation:endingPetalFall var(--dur) linear infinite;animation-delay:var(--delay)}
.ending-petals i:nth-child(1){--left:9%;--dur:13s;--delay:-2s}.ending-petals i:nth-child(2){--left:21%;--dur:11s;--delay:-7s}.ending-petals i:nth-child(3){--left:37%;--dur:15s;--delay:-4s}.ending-petals i:nth-child(4){--left:49%;--dur:12s;--delay:-8s}.ending-petals i:nth-child(5){--left:58%;--dur:17s;--delay:-5s}.ending-petals i:nth-child(6){--left:71%;--dur:13s;--delay:-10s}.ending-petals i:nth-child(7){--left:82%;--dur:16s;--delay:-6s}.ending-petals i:nth-child(8){--left:94%;--dur:12s;--delay:-3s}
.ending-skip{position:absolute;z-index:10;right:22px;top:20px;border:1px solid #fffaf0b3;background:#263950bb;color:white;backdrop-filter:blur(8px)}
.ending-skip[hidden]{display:none}
.ending-finale{position:absolute;z-index:6;right:clamp(22px,6vw,110px);top:50%;transform:translateY(-50%);width:min(530px,54vw);max-height:calc(100vh - 32px);overflow:auto;padding:clamp(24px,3vw,42px);background:linear-gradient(152deg,#fffcf4f5,#f7f0e9ef);border:2px solid #ffe3ad;border-radius:30px;box-shadow:0 20px 70px #1527438a;color:#3d3f55;animation:endingFinaleIn .9s ease-out both}
.ending-finale[hidden]{display:none}
.ending-mobile-hero{display:none}
.ending-finale h2{margin:10px 0 12px;color:#574063;font-size:clamp(29px,3.3vw,44px);letter-spacing:-.04em}
.ending-finale>p{font-size:16px;line-height:1.65;margin:0 0 19px;color:#62566b}
.ending-kicker{color:#a67458}
.ending-record{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;padding:15px 0;border-top:1px solid #d4c3c0;border-bottom:1px solid #d4c3c0}
.ending-record span{display:flex;flex-direction:column;align-items:center;text-align:center;gap:2px;font-size:13px;color:#756576}
.ending-record b{font-size:27px;color:#b75756}
.ending-reward{display:flex;align-items:center;gap:16px;margin:20px 0;padding:10px 15px;border-radius:18px;background:#efe2eb;border:1px solid #dfc8d2}
.ending-reward-portrait{width:76px;height:92px;flex:none}
.ending-reward-portrait svg,.ending-reward-portrait img{width:100%;height:100%;object-fit:contain}
.ending-reward small{display:block;color:#965b71;font-size:12px;font-weight:700}
.ending-reward strong{display:block;color:#533d59;font-size:21px}.ending-reward p{margin:3px 0 0;color:#685a65;font-size:13px;line-height:1.4}
.ending-actions{display:flex;flex-wrap:wrap;gap:10px}.ending-actions button{flex:1;min-width:180px;padding:13px 15px;border-radius:12px}
@keyframes endingCrestQuiet{0%{opacity:1;transform:scale(1.35);filter:brightness(2)}80%{opacity:.8;transform:scale(1)}100%{opacity:.5;transform:scale(.95);filter:brightness(.7)}}
@keyframes endingLandDescend{0%{transform:translate(-50%,-105%) scale(.62) rotateX(18deg);opacity:0}18%{opacity:1}76%{transform:translate(-50%,-40%) scale(.78) rotateX(3deg)}100%{transform:translate(-50%,-38%) scale(.68) rotateX(0)}}
@keyframes endingPetalFall{to{translate:75px 125vh;rotate:350deg}}
@keyframes endingFinaleIn{from{opacity:0;transform:translate(25px,-47%)}to{opacity:1;transform:translate(0,-50%)}}
@media(max-width:700px){.ending-map{top:30%;width:112vw}.ending-story{bottom:8%;width:calc(100% - 28px);padding:15px}.ending-parade{left:-2%;bottom:11%;width:58%;height:35%}.ending-companions>span{height:70px}.ending-finale{left:12px;right:12px;top:auto;bottom:12px;transform:none;width:auto;max-height:76vh;padding:22px;animation:endingFinaleMobile .8s ease-out both}.ending-scene[data-act="final"] .ending-map{left:50%;top:12%;transform:translate(-50%,-37%) scale(.47)}.ending-scene[data-act="final"] .ending-parade{display:none}.ending-mobile-hero{display:block;position:absolute;right:15px;top:12px;width:72px;height:107px;pointer-events:none;filter:drop-shadow(0 5px 5px #a1919b55)}.ending-mobile-hero svg,.ending-mobile-hero img{width:100%;height:100%;object-fit:contain}.ending-finale h2{padding-right:70px}.ending-record b{font-size:22px}.ending-actions button{min-width:100%}}
@keyframes endingFinaleMobile{from{opacity:0;translate:0 24px}to{opacity:1;translate:0 0}}
@media(prefers-reduced-motion:reduce){.ending-scene *,.ending-scene *:before,.ending-scene *:after{animation-duration:.001ms!important;animation-iteration-count:1!important;transition-duration:.001ms!important}.ending-petals{display:none}}
