/* Result screens own their palette so light-theme tokens cannot leak in. */
html{background:#141026}
body[data-screen=result]{overflow:hidden}
#screen-result.active{height:100dvh;min-height:0;padding-bottom:0;overflow:hidden;--paper:#fff4e5;--muted:#d5c4e3;--accent:#ffda85;--danger:#ffb5c4;--line:#725987}
#screen-result>.bar{flex-shrink:0;min-height:56px;margin-bottom:4px;padding:8px 0}
#screen-result>.flow-steps{flex-shrink:0;margin:4px 0 10px}
#screen-result .result-scroll{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;padding:0 2px 20px;scrollbar-width:thin;scrollbar-color:#9474b0 transparent;overscroll-behavior:contain}
#screen-result .result-actions{position:relative;flex-shrink:0;bottom:auto;padding:12px 0 calc(12px + env(safe-area-inset-bottom));background:#211537;gap:7px}
#screen-result .result-actions .btn{font-size:15px;min-width:0;padding:10px 5px;min-height:48px}
#screen-result [hidden]{display:none!important}
.fortune-pages{display:flex;gap:6px;background:#150d26;padding:5px;border-radius:16px;margin-bottom:14px}
.fortune-pages button{flex:1;border:0;border-radius:12px;background:transparent;color:#d9c7e8;min-height:43px;font:18px var(--game-font);cursor:pointer}
.fortune-pages button.active{background:#ffcf68;color:#482340;box-shadow:0 3px #a76640}
.fortune-reveal{position:relative;isolation:isolate;text-align:center;border:2px solid #eec180;border-radius:28px;padding:22px 16px 18px;background:radial-gradient(ellipse at 50% 48%,#9479c0 0%,#65408b 45%,#38234f 80%);box-shadow:0 5px #100921;overflow:hidden}
.fortune-reveal:before,.fortune-reveal:after{content:'✦';position:absolute;color:#ffe5a1;font-size:38px;top:41%;left:9%;transform:rotate(-12deg);z-index:-1}.fortune-reveal:after{content:'✧';left:auto;right:9%;top:57%;font-size:52px}
.fortune-eyebrow{font-size:13px;font-weight:800;letter-spacing:.12em;color:#ffe6ae}
.fortune-title{font:42px/1.15 var(--game-font);color:#ffdf85;margin:12px 0 0;text-shadow:0 3px #582d65;overflow-wrap:anywhere}
.fortune-reveal .result-companion{height:208px;margin:4px auto;align-items:center}
.fortune-reveal .result-companion .animal-art{width:145px;height:208px;filter:drop-shadow(0 10px 8px #25133370);background-position:var(--cx) center}
.fortune-reveal .affirmation{color:#fff4e4;font-size:16px;font-weight:700;font-style:normal;line-height:1.6;margin:0 auto;max-width:310px}
.fortune-seal{display:inline-block;background:#21172e;border:1px solid #b698c9;color:#ffdf9c;border-radius:30px;padding:5px 17px;font-weight:800;font-size:14px;margin-top:13px}
#screen-result .fortune-dialogue{background:transparent;border:0;padding:0;margin:19px 0 15px}
.fortune-speaker{display:flex;align-items:center;gap:12px;margin-bottom:9px}
.fortune-portrait{width:74px;height:74px;background:#dec7ef;border:2px solid #fce3ad;border-radius:24px;overflow:hidden;flex-shrink:0}
.fortune-portrait .teller-art{width:100%;height:100%;object-fit:contain;background:none;transform:scale(1.2);transform-origin:center top;filter:none}
.fortune-speaker-name{font:23px var(--game-font);color:#ffe2a1}.fortune-speaker-name small{display:block;font:13px/1.5 sans-serif;color:#d2bfe3;margin-top:3px}
#screen-result #ai-interpret{position:relative;background:#fff4df;color:#34233f;border:2px solid #e4c9a1;border-radius:8px 22px 22px 22px;padding:18px;box-shadow:0 4px #100921}
.fortune-speech{font-size:16px;font-weight:500;line-height:1.85;margin:0;word-break:keep-all;overflow-wrap:anywhere;color:#34233f}
.fortune-speech-controls{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:15px;padding-top:10px;border-top:1px solid #dac9b3}
.fortune-speech-controls button{border:0;background:#684487;color:white;border-radius:10px;min-height:38px;padding:7px 12px;font-weight:700;cursor:pointer}.fortune-speech-controls button:disabled{opacity:.35;cursor:default}.fortune-speech-controls span{font-size:12px;color:#695170}
.fortune-mission{display:flex;gap:12px;align-items:flex-start;border:1px solid #8d6ca2;border-radius:17px;background:#402b55;padding:15px;color:#fff1dc}.fortune-mission b{font:17px var(--game-font);color:#ffda81;white-space:nowrap}.fortune-mission p{font-size:14px;line-height:1.6;margin:0}
.fortune-next{display:block;width:100%;min-height:48px;border:1px solid #a282b8;border-radius:14px;background:#563874;color:#fff0dc;font:18px var(--game-font);margin-top:14px;cursor:pointer}
.fortune-detail-title{font:29px var(--game-font);color:#ffe09d;margin:20px 0 8px}.fortune-detail-note{font-size:14px;line-height:1.8;color:#d5c4e3}
#screen-result .fortune-detail .result-head{padding:18px;margin-top:16px;border-width:1px}.fortune-detail .result-head:before,.fortune-detail .result-head:after{display:none}
#screen-result .fortune-detail .card{padding:20px;background:#352445;border-color:#765889}#screen-result .fortune-detail .card h3{font:22px var(--game-font);color:#ffe1a0}
#screen-result .gua-ci-han{color:#fff1d9;font-size:20px;line-height:2}#screen-result .gua-ci-ko,#screen-result .qian-gloss,#screen-result .si-txt,#screen-result .trad-text{font-size:15px;color:#efe2f5;line-height:1.85}
#screen-result .qian-title{color:#ffdb87;font-size:15px}#screen-result .si-name{color:#e8d5f5;font-size:15px}#screen-result .section-grid{gap:10px}#screen-result .section-item{padding:12px;min-width:0}#screen-result .avoid-text{color:#dac6e8}#screen-result .warning-text{color:#ffd2ce}#screen-result .result-flag{color:#ffd2ce;font-size:14px;line-height:1.7}#screen-result .result-overview,#screen-result .result-number{font-size:14px}
@media(max-width:360px){#screen-result{padding-left:12px;padding-right:12px}#screen-result .result-actions .btn{font-size:13px}.fortune-title{font-size:36px}.fortune-speech{font-size:15px}.fortune-reveal .result-companion{height:175px}.fortune-reveal .result-companion .animal-art{height:175px;width:122px}}
@media(prefers-reduced-motion:no-preference){.fortune-reveal .animal-art{animation:fortune-float 3.5s ease-in-out infinite}@keyframes fortune-float{50%{transform:translateY(-5px) rotate(2deg)}}}
#screen-result .animal-art{background:none;overflow:hidden}
#screen-result .fortune-reveal .result-companion .animal-art{width:195px;height:208px}
.fortune-reveal[data-character=muni]{background:radial-gradient(ellipse at 50% 48%,#bc8aa1,#794362 48%,#392345 85%)}
.fortune-reveal[data-character=sol]{background:radial-gradient(ellipse at 50% 48%,#72a5bf,#365780 48%,#1d294a 85%)}
.fortune-reveal[data-character=mali]{background:radial-gradient(ellipse at 50% 48%,#ba945c,#805234 48%,#38283c 85%)}
.fortune-reveal[data-character=rin]{background:radial-gradient(ellipse at 50% 48%,#ca93a7,#824f73 48%,#3e244b 85%)}
.fortune-share-preview{position:fixed;width:min(440px,calc(100vw - 24px));max-height:92dvh;padding:20px;border:2px solid #d9b279;border-radius:25px;background:#2c1c41;color:#fff1d7;overflow-y:auto;box-sizing:border-box}
.fortune-share-preview::backdrop{background:#0f081ddd;backdrop-filter:blur(8px)}.fortune-share-preview h2{font:28px var(--game-font);margin:0 40px 16px 0;color:#ffdc8c}.fortune-preview-close{position:absolute;right:14px;top:12px;width:40px;height:40px;border:1px solid #9375a7;border-radius:50%;background:#4d355f;color:white;font-size:27px;cursor:pointer}.fortune-share-preview>img{display:block;width:100%;height:auto;border-radius:14px}.fortune-preview-actions{position:sticky;bottom:-20px;display:flex;gap:9px;padding:14px 0;background:#2c1c4fee}.fortune-preview-actions button{flex:1;cursor:pointer}

.fortune-reveal .result-companion.comic-result-scene{width:100%;height:auto;min-height:0;aspect-ratio:900/760;margin:8px 0;border-radius:24px;overflow:hidden}.comic-result-scene>img{display:block;width:100%;height:100%;object-fit:contain}

.comic-result-scene{position:relative}.result-effect-overlay{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
.result-clip-dialog{background:#271934;color:#ffedce;border:2px solid #d8b478;border-radius:24px;width:min(92vw,490px);box-sizing:border-box;max-height:94vh;overflow:auto;padding:20px;font:15px/1.6 system-ui}.result-clip-dialog::backdrop{background:#100a1bd9}.result-clip-preview{width:min(100%,320px);margin:12px auto}.result-clip-dialog button{background:#ffd46c;color:#35213f;border:0;border-radius:12px;padding:10px;margin:4px;cursor:pointer}.result-clip-dialog h2{margin:0}.result-clip-dialog p{margin:6px 0}.result-clip-dialog button:disabled{opacity:.6}.comic-result-scene>canvas{display:block;width:100%;height:auto}

/* Share actions remain legible on narrow screens; the video entry is a full row. */
.fortune-preview-actions{flex-wrap:wrap;align-items:stretch}
.fortune-preview-actions .fortune-video-button{flex:1 0 100%;border:1px solid #e8c580;border-radius:18px;background:linear-gradient(120deg,#674386,#40274f);color:#ffe7a8;min-height:54px;padding:12px 18px;font:inherit;font-weight:700;box-shadow:0 3px 0 #20132c;white-space:nowrap}
.fortune-video-button::before{content:'▶';font-size:.8em;margin-right:10px}
.result-clip-dialog{position:relative;width:min(94vw,480px);padding:22px;overflow:auto;box-shadow:0 24px 100px #0008}
.result-clip-dialog h2{font:700 24px/1.4 var(--game-font,system-ui);color:#ffe4a0;padding-right:30px}
.result-clip-dialog .result-clip-note{color:#d6bfdc;font-size:13px;margin-top:5px}
.result-clip-preview{width:auto;height:min(57dvh,560px);aspect-ratio:9/16;max-width:100%;margin:16px auto;overflow:hidden;border-radius:18px;background:#21142e;box-shadow:0 8px 30px #100a1b80}
.result-clip-preview>canvas,.result-clip-preview>video{display:block;width:100%;height:100%;object-fit:contain}
.result-clip-dialog .result-clip-close{position:absolute;right:12px;top:10px;margin:0;background:#ffffff12;color:#eadcf0;border:1px solid #806287;width:34px;height:34px;padding:0;border-radius:50%;font:24px/1 system-ui}
.result-clip-actions{display:flex}
.result-clip-dialog .result-clip-save{width:100%;margin:0;padding:14px;border-radius:16px;background:#ffd46c;color:#392541;font:700 17px/1.3 system-ui;box-shadow:0 4px 0 #ac783b}
.result-clip-dialog .result-clip-status{min-height:22px;margin-top:13px;color:#ddc9e4;text-align:center;font-size:12px}

.result-clip-modes{display:flex;gap:8px;margin-top:12px}.result-clip-dialog .result-clip-modes button{flex:1;margin:0;background:#493254;color:#e6d2ee;border:1px solid #80658e;font:600 14px system-ui;padding:10px}.result-clip-dialog .result-clip-modes button[aria-pressed=true]{background:#ffdf94;color:#392541;border-color:#ffe8ac}

.result-clip-lengths{display:flex;gap:8px;margin-top:9px}.result-clip-dialog .result-clip-lengths button{flex:1;margin:0;padding:8px;border:1px solid #80658e;background:#34233f;color:#dfcee6;font:600 14px system-ui}.result-clip-dialog .result-clip-lengths button[aria-pressed=true]{border-color:#ffe4a0;background:#604572;color:#ffe4a0}.result-clip-preview{height:min(52dvh,530px)}
