:root{--bg:#120f15;--bg2:#1e1922;--fg:#f4eee6;--muted:#b0a5b5;--accent:#ff4d78;--hot:#d6124a;--accent2:#ffd23f;--card:#221c27;--radius:.7rem;--ok:#2fbf71;--bad:#ff4d4d;
--sans:system-ui,-apple-system,"Segoe UI",Roboto,"PingFang TC","Noto Sans TC","Noto Sans CJK TC","Microsoft JhengHei",sans-serif;
--mono:ui-monospace,"SF Mono",Menlo,Consolas,"Courier New","PingFang TC","Noto Sans TC","Noto Sans CJK TC",monospace}
*{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:transparent}
html,body{height:100%;overflow:hidden}
body{background:var(--bg);color:var(--fg);font-family:var(--sans);display:flex;justify-content:center}
[hidden]{display:none!important}
.hsr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
button{font:inherit;cursor:pointer;color:inherit;touch-action:manipulation}
a{color:#9fd0ff}
:focus-visible{outline:3px solid var(--accent2);outline-offset:2px}
.app{width:100%;max-width:34rem;min-width:0;height:100vh;height:100dvh;display:flex;flex-direction:column;
 gap:clamp(.3rem,1.1dvh,.6rem);padding:calc(clamp(.3rem,1.1dvh,.75rem) + env(safe-area-inset-top)) calc(clamp(.45rem,3.2vw,1rem) + env(safe-area-inset-right)) calc(clamp(.3rem,1.1dvh,.75rem) + env(safe-area-inset-bottom)) calc(clamp(.45rem,3.2vw,1rem) + env(safe-area-inset-left))}
.app>.top{display:flex;align-items:center;gap:.4rem;min-width:0;flex:none}
.top .h1{flex:none;min-width:0;margin:0 auto 0 0;font:inherit;display:flex}
.top .logo{flex:none;font:900 clamp(.78rem,4vw,1.15rem)/1.1 var(--mono);letter-spacing:.04em;white-space:nowrap;background:none;border:0;color:var(--fg);display:flex;align-items:center;gap:.3em}
.top .logo b{color:#fff;background:var(--hot);padding:.05em .3em;border-radius:.25em;transform:rotate(-4deg);display:inline-block}
.top .pill{flex:0 1 auto;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font:800 clamp(.56rem,2.7vw,.85rem) var(--mono);border:1px solid #ffffff40;border-radius:999px;padding:.25em .5em}
.top .pill:empty{display:none}.top .pill.pop{animation:hpop .35s}.top .pill.hurt{animation:hhurt .6s}
.top .lang{flex:none;display:flex;border:1px solid #ffffff40;border-radius:999px;background:none;overflow:hidden;font:800 clamp(.62rem,3vw,.8rem) var(--sans);color:var(--muted);padding:0}
.top .lang span{padding:.3em .5em}.top .lang span.on{background:var(--fg);color:var(--bg)}
.app>.bar{height:3px;background:#ffffff1a;border-radius:2px;overflow:hidden;flex:none}.app>.bar>div{height:100%;width:0;background:var(--accent);transition:width .3s}
.app>.screen{display:none;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:clamp(.3rem,1.6dvh,.9rem);flex:1 1 0;min-height:0;overflow:hidden}
.app>.screen.on{display:flex}
/* home */
#home .big{font:900 clamp(2rem,min(15vw,9dvh),4.4rem)/1 var(--mono);letter-spacing:.02em;display:flex;align-items:center;gap:.25em}
#home .big b{color:#fff;background:var(--hot);padding:.04em .22em;border-radius:.12em;transform:rotate(-5deg);font-size:.7em;display:inline-block}
#home .sub{color:var(--muted);font-size:clamp(.72rem,min(3.9vw,2.4dvh),1rem);max-width:24rem;line-height:1.35}
#home .modes{display:flex;flex-direction:column;gap:clamp(.3rem,1.2dvh,.55rem);width:min(100%,21rem);flex:none}
#home .cta,#end .cta{background:var(--hot);color:#fff;border:0;border-radius:var(--radius);font-weight:900;font-size:clamp(.92rem,min(5.2vw,3.2dvh),1.3rem);padding:clamp(.35rem,1.3dvh,.75rem) 1rem;box-shadow:0 .25rem 0 #0008;line-height:1.15}
#home .cta small,#home .ghost small,#end .cta small,#end .ghost small{display:block;font-weight:700;font-size:.62em}
#home .ghost,#end .ghost{background:var(--bg2);border:1px solid #ffffff40;border-radius:var(--radius);padding:clamp(.3rem,1.1dvh,.6rem) .9rem;font-weight:800;font-size:clamp(.78rem,min(4vw,2.6dvh),.98rem);line-height:1.15;box-shadow:0 .2rem 0 #0008}
#home .cta:active,#home .ghost:active,#end .cta:active,#end .ghost:active,#home .tile:active,#hnext:active{transform:translateY(2px) scale(.98);box-shadow:0 .08rem 0 #0008}
#home .tiles{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:clamp(.25rem,1dvh,.5rem);width:min(100%,21rem);flex:0 1 auto;min-height:0}
#home .tile{min-width:0;min-height:0;background:var(--card);border:1px solid #ffffff2a;border-radius:var(--radius);padding:clamp(.2rem,.9dvh,.5rem) .2rem;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.1em;box-shadow:0 .18rem 0 #0008;overflow:hidden}
#home .tile .ic{font-size:clamp(1rem,min(6vw,3.6dvh),1.6rem);line-height:1}
#home .tile .nm{font:800 clamp(.56rem,min(2.9vw,1.8dvh),.78rem)/1.15 var(--sans);overflow-wrap:anywhere;max-width:100%}
#home .tile[aria-disabled=true]{opacity:.38}
#home .links{display:flex;gap:.9rem;flex-wrap:wrap;justify-content:center;font-size:clamp(.6rem,min(3vw,1.9dvh),.8rem)}
#home .links a{color:var(--muted)}
#home .note{font-size:clamp(.58rem,min(2.9vw,1.8dvh),.76rem);color:var(--muted);max-width:26rem;line-height:1.3}#home .note:empty{display:none}
/* play */
#play{display:none;flex-direction:column;align-items:stretch;text-align:initial;gap:clamp(.25rem,.9dvh,.5rem);flex:1 1 0;min-height:0}
#play.on{display:flex}
#play>.rhead{flex:none;display:flex;align-items:center;justify-content:space-between;gap:.5rem;min-width:0;font:800 clamp(.58rem,min(3vw,1.9dvh),.8rem) var(--mono);color:var(--muted);letter-spacing:.06em}
#play>.rhead>span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#play .qhelp{flex:none;width:1.9em;height:1.9em;border-radius:50%;border:1px solid #ffffff55;background:var(--bg2);color:var(--fg);font:900 1em/1 var(--sans);display:grid;place-items:center;padding:0}
#play{position:relative}
#play>.intro{position:absolute;inset:0;z-index:20;display:flex;align-items:center;justify-content:center;background:#120f15e6;padding:clamp(.4rem,3vw,1rem)}
#play .ibox{width:min(100%,24rem);max-height:100%;min-height:0;overflow:hidden;display:flex;flex-direction:column;gap:clamp(.4rem,1.6dvh,.8rem);background:var(--card);border:1px solid #ffffff2a;border-radius:var(--radius);padding:clamp(.6rem,2.4dvh,1.2rem) clamp(.7rem,4vw,1.2rem);box-shadow:0 .4rem 0 #0008;animation:hpop .3s}
#play .ibox h2{font:900 clamp(1rem,min(5.6vw,3.4dvh),1.4rem)/1.15 var(--sans);text-align:center}
#play .ibox ol{list-style:none;counter-reset:s;display:flex;flex-direction:column;gap:clamp(.25rem,1.2dvh,.55rem);min-height:0}
#play .ibox li{counter-increment:s;display:flex;gap:.6em;align-items:baseline;font:600 clamp(.8rem,min(4.3vw,2.6dvh),1.05rem)/1.35 var(--sans)}
#play .ibox li::before{content:counter(s);flex:none;font:900 .8em var(--mono);background:var(--accent2);color:#000;border-radius:999px;min-width:1.6em;text-align:center;padding:.1em .3em}
#play .iex{flex:0 1 auto;min-height:0;overflow:hidden;border-radius:.5rem;background:var(--bg2);padding:.5rem;font-size:clamp(.72rem,min(3.8vw,2.3dvh),.95rem)}
#play .ibox .cta{background:var(--hot);color:#fff;border:0;border-radius:var(--radius);font:900 clamp(.92rem,min(5vw,3dvh),1.2rem) var(--sans);padding:clamp(.4rem,1.4dvh,.7rem) 1rem;box-shadow:0 .25rem 0 #0008;flex:none}
#play>.stage{flex:1 1 0;min-height:0;min-width:0;display:flex;flex-direction:column;overflow:hidden;position:relative}
#play>.stage>.mroot{flex:1 1 0;min-height:0;min-width:0;display:flex;flex-direction:column;overflow:hidden}
#hnext{flex:none;background:var(--fg);color:var(--bg);border:0;border-radius:var(--radius);font:900 clamp(.86rem,min(4.8vw,3dvh),1.15rem) var(--mono);padding:clamp(.35rem,1.2dvh,.65rem) 1rem;box-shadow:0 .2rem 0 #0008}
#play .hub-wait{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.6rem;font:800 clamp(.8rem,3.6vw,1rem) var(--mono);color:var(--muted)}
#play .hub-spin{width:1.6rem;height:1.6rem;border-radius:50%;border:.22rem solid #ffffff22;border-top-color:var(--accent);animation:hspin .8s linear infinite}
/* end */
#end .score{font:900 clamp(2rem,min(13vw,8dvh),3.8rem)/1 var(--mono)}
#end .score small{font-size:.4em;color:var(--muted)}
#end .rank{font:900 clamp(.9rem,min(5vw,3dvh),1.3rem) var(--mono);color:var(--accent2)}
#end .grid{font-size:clamp(.9rem,min(5vw,3.2dvh),1.4rem);line-height:1.25;letter-spacing:.08em;white-space:pre;flex:none}
#end .stats{list-style:none;display:flex;flex-direction:column;gap:clamp(.12rem,.6dvh,.3rem);width:min(100%,22rem);flex:0 1 auto;min-height:0;overflow:hidden}
#end .stats li{background:var(--card);border-radius:.45rem;padding:clamp(.15rem,.6dvh,.35rem) .6rem;font:600 clamp(.64rem,min(3.4vw,2.1dvh),.88rem)/1.3 var(--sans);text-align:left;display:flex;gap:.5em;min-width:0}
#end .stats li b{flex:none}#end .stats li span{min-width:0;flex:1 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#end .stats li i{flex:none;align-self:center;font:800 .9em var(--mono);font-style:normal;color:var(--muted)}
#end .homeL{background:none;border:0;color:var(--muted);font:700 clamp(.66rem,min(3.4vw,2.1dvh),.88rem) var(--sans);text-decoration:underline;padding:.3em .8em;flex:none}
#end .streak{font:800 clamp(.66rem,min(3.4vw,2.1dvh),.88rem) var(--mono);color:var(--accent2)}#end .streak:empty{display:none}
#end .row{display:flex;gap:.5rem;width:min(100%,21rem);flex:none}#end .row>*{flex:1 1 0;min-width:0}
#end .toast{font:800 .8rem var(--mono);color:var(--ok);min-height:1em}#end .toast:empty{display:none}
.app>.foot{flex:none;text-align:center;font-size:clamp(.56rem,min(2.8vw,1.7dvh),.72rem);color:var(--muted)}
.app>.foot a{color:var(--muted)}
#play.on~.foot{display:none}
@keyframes hpop{50%{transform:scale(1.15)}}
@keyframes hhurt{0%,100%{transform:none}20%{transform:translateX(-4px);border-color:var(--bad);color:var(--bad)}40%{transform:translateX(4px)}60%{transform:translateX(-3px);border-color:var(--bad)}}
@keyframes hspin{to{transform:rotate(1turn)}}
@media (prefers-reduced-motion:reduce){.app>.top *,#home *,#end *{animation:none!important;transition:none!important}}
@media (orientation:landscape) and (max-height:500px){
 #home{flex-direction:row;flex-wrap:wrap;align-content:center}
 #end .rank,#end .streak{display:none}}
/* glue (see NOTES.md): bold the big verdict buttons so their module colours pass WCAG large-text contrast */
#stage .m-sos .g,#stage .m-cozy .g{font-weight:800}
.top .logo .dot,#home .big .dot{font-style:normal;margin-left:-.14em}
