/* Title composition: environment, animated cast, then a clear route into play. */
.arcade:has(#intro:not([hidden]))>.arena,.arcade:has(#warmup:not([hidden]))>.arena{width:100%;max-width:100%;min-width:0;aspect-ratio:auto;height:clamp(560px,calc(100svh - 160px),710px)}
.arcade:has(#intro:not([hidden]))>:is(.hud,.combo-row,.progress-track,.boss-bar,.hunt-bar,.bottom),.arcade:has(#warmup:not([hidden]))>:is(.hud,.combo-row,.progress-track,.boss-bar,.hunt-bar,.bottom){display:none}
.arena #intro.cinematic-intro{isolation:isolate;justify-content:flex-start;padding:24px 18px 18px;gap:8px;background:linear-gradient(180deg,#170c2a22,#160b2099 36%,#10091df5 68%),url('/play/assets/title-graveyard-v3.webp') center top/cover no-repeat;backdrop-filter:none}
.title-wordmark{z-index:2;flex-shrink:0;text-align:center;text-shadow:0 3px 0 #1c0b28,0 0 22px #0d051d}
.title-wordmark>span{font:800 14px Georgia,serif;letter-spacing:6px;color:#f4e3c0}
#intro .title-wordmark h2{font:900 clamp(31px,8.5vw,47px)/1.05 Georgia,serif;letter-spacing:-1.5px;margin:2px 0;color:#fff0c9;text-shadow:0 3px #4b244d,0 5px #170a23,0 0 24px #b172cb88}
.title-wordmark small{font-size:8px;letter-spacing:2.6px;color:#e5c4f7}
.title-scene{position:relative;width:100%;height:190px;flex-shrink:0;perspective:650px;isolation:isolate;margin-top:0}
.title-grimlet{position:absolute;width:188px;height:188px;object-fit:contain;left:50%;bottom:-3px;transform:translateX(-50%);z-index:3;filter:drop-shadow(0 8px 9px #08040dc0);animation:grimlet-guard 4s ease-in-out infinite}
.title-soul{position:absolute;width:85px;height:85px;z-index:4;pointer-events:none;filter:drop-shadow(0 0 12px #b569c970)}
.soul-left{left:0;top:40px;animation:soul-escape 4.5s ease-in-out infinite}
.soul-right{right:0;top:83px;animation:soul-escape 3.8s ease-in-out -1.7s infinite}
.title-gate{position:absolute;bottom:0;width:30%;height:170px;object-fit:fill;z-index:2;opacity:.84;pointer-events:none}
.title-gate.gate-left{left:-7px;transform-origin:left;transform:rotateY(-37deg)}
.title-gate.gate-right{right:-7px;transform-origin:right;transform:scaleX(-1) rotateY(-37deg)}
.title-haze{position:absolute;inset:70% -15% -8%;z-index:5;pointer-events:none;background:radial-gradient(ellipse,#b493d550,transparent 65%);animation:cinema-fog 9s ease-in-out infinite alternate}
.title-spark{position:absolute;width:3px;height:3px;background:#ffe9ab;border-radius:50%;box-shadow:0 0 8px #ffe39b;z-index:6;animation:title-ember 4s ease-in-out infinite}
.spark-one{left:18%;top:75%;animation-delay:-1s}.spark-two{left:73%;top:63%;animation-delay:-3s}.spark-three{left:39%;top:30%;animation-delay:-2s}
#intro .grimlet-quote{font:italic 16px Georgia,serif;color:#e3cde9;margin:0 0 3px;text-shadow:0 2px 6px #000}
.grimlet-quote em{color:#f1ca79;font-weight:700}
#intro #start{background:linear-gradient(110deg,#ffe6a5,#dca650);color:#25112d;box-shadow:0 3px 0 #926529,0 0 24px #f0c57930;border:1px solid #ffedb7;letter-spacing:.6px;min-height:50px}
#intro #start:hover{filter:brightness(1.07)}#intro #start:disabled{opacity:.65}
#intro #learn-game{background:#331e456b;border:1px solid #c4a0dd33;border-radius:10px;width:100%;color:#ead9f7}
.opening-how{width:100%;text-align:center;flex-shrink:0}
.opening-how summary{min-height:36px;padding:9px 0;cursor:pointer;font-size:11px;color:#cdb7dc}
.opening-how .opening-rules{margin-top:3px}.opening-how .opening-stakes{padding-top:7px}
.quick-start{display:flex;align-items:center;gap:8px;font-size:10px;color:#c6b2d5;min-height:32px;cursor:pointer;flex-shrink:0}.quick-start input{accent-color:#d9b5ef;width:16px;height:16px}
#intro .opening-controls{font-size:8px;opacity:.8}
/* The countdown is presentation only; input and the ranked clock start afterward. */
body.entering{overflow:hidden;overscroll-behavior:none}
body.entering .arcade{position:fixed;inset:max(8px,env(safe-area-inset-top)) 8px max(8px,env(safe-area-inset-bottom));max-width:670px;margin:auto;z-index:60;display:flex;flex-direction:column}
body.entering .arcade>.arena{height:auto!important;flex:1;min-height:0}
body.entering .arcade>:not(.arena){display:none!important}
#entrance-scene{position:absolute;inset:0;z-index:40;display:flex;justify-content:center;align-items:center;background:linear-gradient(#170b2022,#13091d80),url('/play/assets/title-graveyard-v3.webp') center/cover;overflow:hidden;perspective:800px}
#entrance-scene[hidden]{display:none}
.entrance-gates{position:absolute;inset:15% -3% 0;perspective:800px;pointer-events:none}
.entrance-gates img{position:absolute;bottom:0;width:51%;height:100%;object-fit:fill;filter:drop-shadow(0 0 10px #000);transition:transform 1.35s ease-in-out,opacity 1.35s}
.entrance-left{left:0;transform-origin:left}.entrance-right{right:0;transform-origin:right;transform:scaleX(-1)}
.gates-open .entrance-left{transform:rotateY(-100deg);opacity:.35}.gates-open .entrance-right{transform:scaleX(-1) rotateY(-100deg);opacity:.35}
.entrance-haze{position:absolute;inset:55% -20% -10%;background:radial-gradient(ellipse,#ac80cf66,transparent 70%);animation:cinema-fog 3s ease-in-out infinite alternate}
.entrance-copy{position:relative;z-index:3;text-align:center;text-shadow:0 3px 15px #000;padding:16px}
.entrance-copy>span{font-size:10px;letter-spacing:3px;color:#f4dfab}
#entrance-count{display:block;font:900 clamp(65px,18vw,110px)/1.4 Georgia,serif;color:#fff1c6}
.entrance-copy p{font-size:12px;color:#ead5f5}
#skip-entrance{position:absolute;bottom:24px;left:50%;transform:translateX(-50%);z-index:5;min-height:44px;padding:10px 20px;border:1px solid #cbb0df88;background:#180e29d9;color:#fff0d7;border-radius:99px;white-space:nowrap}
/* A compact record celebration leaves the rematch button within reach. */
#record-moment{display:flex;width:100%;align-items:center;justify-content:center;gap:8px;padding:8px;border:1px solid #e8c88066;border-radius:12px;background:linear-gradient(100deg,#68462555,#43205877);flex-shrink:0}
#record-moment[hidden]{display:none}.record-crown{width:42px;height:36px;filter:drop-shadow(0 0 9px #edbf5666);animation:crown-arrival .65s ease-out both}
#record-moment strong{display:block;font-size:10px;letter-spacing:.6px;color:#ffe3a0}#record-moment span{display:block;font-size:10px;color:#e7d2f1;margin-top:3px}
.record-grimlet{width:40px;height:40px;object-fit:contain;animation:record-grumble .5s ease-in-out 2}
@keyframes grimlet-guard{50%{transform:translateX(-50%) translateY(-5px) rotate(-2deg)}}
@keyframes soul-escape{50%{transform:translateY(-12px) rotate(7deg)}}
@keyframes cinema-fog{to{transform:translateX(5%) scale(1.1);opacity:.65}}
@keyframes title-ember{0%,100%{transform:translateY(0);opacity:0}40%{opacity:1}90%{transform:translateY(-45px);opacity:0}}
@keyframes crown-arrival{from{transform:translateY(-15px) scale(.5);opacity:0}65%{transform:scale(1.14)}to{transform:none;opacity:1}}
@keyframes record-grumble{25%{transform:rotate(-8deg)}75%{transform:rotate(8deg)}}
@media(max-width:360px){.title-scene{height:165px}.title-grimlet{width:166px;height:166px}.title-soul{width:68px;height:68px}#intro.cinematic-intro{padding:18px 12px}}
@media(prefers-reduced-motion:reduce){.title-grimlet,.title-soul,.title-haze,.title-spark,.entrance-haze,.record-crown,.record-grimlet{animation:none}.entrance-gates img{transition:none}.title-spark{opacity:.5}}

/* Keep the tall opening inside the phone width, independent of the playfield ratio. */
.arena #intro.cinematic-intro{width:100%;max-width:100%;min-width:0;overflow-x:hidden}
#intro.cinematic-intro>*{max-width:100%;min-width:0}
#intro .title-wordmark h2{overflow-wrap:normal}
#intro #ranked-mode,#intro .opening-controls{white-space:normal;overflow-wrap:break-word}

/* The title is the opening scene, without a second website title above it. */
body:has(#intro:not([hidden]))>header,body:has(#intro:not([hidden])) main>.title{display:none}
body:has(#intro:not([hidden])) main{padding:8px;max-width:690px}
.arcade:has(#intro:not([hidden]))>.arena{height:max(600px,calc(100svh - 16px - env(safe-area-inset-top)))}
.entrance-grimlet{position:absolute;z-index:2;width:min(58%,270px);height:auto;left:50%;top:20%;opacity:0;transform:translate(-50%,20px) scale(.85);transition:opacity .6s,transform 1s;filter:drop-shadow(0 0 25px #a045b888)}
#entrance-scene[data-step="1"] .entrance-grimlet{opacity:1;transform:translate(-50%,0) scale(1)}
#entrance-scene[data-step="1"] .entrance-copy{transform:translateY(140px)}
#entrance-scene[data-step="0"] #entrance-count,#entrance-scene[data-step="1"] #entrance-count{font-size:clamp(25px,7vw,43px);line-height:1.15;max-width:330px;margin:15px auto}
#entrance-scene[data-step="0"] .entrance-copy p,#entrance-scene[data-step="1"] .entrance-copy p{visibility:hidden}
@media(prefers-reduced-motion:reduce){.entrance-grimlet{transition:none}}
/* Film presentation replaces the old text countdown. */
#entrance-scene{display:block;background:#10091d;perspective:none}
#entrance-canvas{position:absolute;inset:0;width:100%;height:100%;display:block}
.film-top{position:absolute;top:max(16px,env(safe-area-inset-top));left:18px;right:18px;display:flex;justify-content:space-between;align-items:center;gap:12px;color:#e9d7f3}
.film-top>span{font-size:9px;letter-spacing:2px;text-shadow:0 1px 8px #000}
#entrance-sound,#lobby-sound{font-size:10px;padding:9px 12px;background:#140c24b0;border:1px solid #c49eda44;border-radius:99px;min-height:38px}
.film-accessible{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
#skip-entrance{bottom:max(22px,env(safe-area-inset-bottom));font-size:11px;background:#170d25c9}
.arena #intro.cinematic-intro{padding:50px 22px 20px;gap:9px;background:linear-gradient(180deg,#15092305,#12092230 35%,#10091de8 70%,#10091dfc),url('/play/assets/title-graveyard-v3.webp') center top/cover no-repeat}
#lobby-sound{position:absolute;right:14px;top:12px;z-index:8}
#intro .title-wordmark h2{font-size:clamp(33px,9vw,52px);letter-spacing:-1px}
.title-wordmark>span{font-size:12px;letter-spacing:7px}.title-wordmark small{font-size:8px;letter-spacing:1.8px}
.title-scene{height:clamp(195px,31svh,300px);margin:0}
.title-grimlet{width:clamp(210px,57vw,290px);height:clamp(210px,57vw,290px);bottom:0;animation:grimlet-guard 3.5s ease-in-out infinite}
.title-soul{width:78px;height:78px}.soul-left{left:-5px;top:25%;animation:film-soul-left 6s ease-in-out infinite}.soul-right{right:-5px;top:52%;animation:film-soul-right 5s ease-in-out infinite}
.title-gate{display:none}#intro .grimlet-quote{font-size:17px;margin:0 0 8px}#intro #start{min-height:54px;font-size:13px;border-radius:14px}
#intro #ranked-mode{font-size:9px;max-width:270px}#intro .history-shortcut{font-size:11px;padding:7px 14px}
#intro #learn-game{border:0;background:none;min-height:30px;font-size:11px;color:#d7c2e8}
.opening-how summary{font-size:10px;min-height:30px;padding:7px 0}.quick-start{font-size:9px;min-height:26px}#intro .opening-controls{display:none}
@keyframes film-soul-left{0%,100%{transform:translate(0,0) rotate(-8deg)}35%{transform:translate(22px,-25px) rotate(7deg)}70%{transform:translate(-7px,12px) rotate(-4deg)}}
@keyframes film-soul-right{0%,100%{transform:translate(0,0) rotate(5deg)}45%{transform:translate(-16px,-27px) rotate(-9deg)}75%{transform:translate(5px,-10px) rotate(6deg)}}
@media(max-height:740px){.arena #intro.cinematic-intro{padding-top:45px;gap:6px}.title-scene{height:195px}.title-grimlet{width:215px;height:215px}#intro .grimlet-quote{margin-bottom:3px}}
@media(prefers-reduced-motion:reduce){.title-grimlet,.title-soul{animation:none}}

#entrance-video{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;background:#11091d;display:block;}
