:root { --ink: #e9e6df; --dim: #8d939b; --red: #d23a2a; --cyan: #5cd2ff; --amber: #ffa646; --glass: rgba(8, 10, 14, .62); color-scheme: dark; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #030406; color: var(--ink); font: 15px/1.5 'Noto Sans TC', system-ui, sans-serif; -webkit-user-select: none; user-select: none; touch-action: none; }
#stage, #stage canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }

#title, #end { position: fixed; inset: 0; display: flex; align-items: flex-end; padding: 0 clamp(16px, 6vw, 90px) clamp(40px, 12vh, 120px); background: linear-gradient(90deg, rgba(0,0,0,.78) 0%, rgba(0,0,0,.35) 45%, transparent 70%); }
#end { align-items: center; justify-content: center; background: rgba(0,0,0,.5); text-align: center; }
.tbox { max-width: 560px; animation: rise 1.4s ease-out both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.kicker { margin: 0 0 6px; color: var(--red); font: 600 13px 'Oswald', sans-serif; letter-spacing: .28em; text-transform: uppercase; animation: blink 2.2s steps(1) infinite; }
@keyframes blink { 50% { opacity: .45; } }
h1, h2 { margin: 0; font: 900 clamp(48px, 9vw, 104px)/1 'Noto Serif TC', serif; letter-spacing: .06em; text-shadow: 0 4px 30px rgba(0,0,0,.8); }
h2 { font-size: clamp(40px, 7vw, 76px); }
.en { margin: 4px 0 18px; font: 400 clamp(16px, 2.2vw, 22px) 'Oswald', sans-serif; letter-spacing: .6em; color: var(--dim); }
.lede, #endSub { color: #c7c4bd; max-width: 46ch; text-wrap: balance; }
.stats { color: var(--dim); font-variant-numeric: tabular-nums; }
.modes { display: grid; gap: 8px; margin: 22px 0 16px; }
.modes button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 18px; text-align: left; background: var(--glass); border: 1px solid rgba(255,255,255,.12); border-left: 3px solid var(--red); backdrop-filter: blur(6px); transition: background .2s, transform .2s; }
.modes button:hover, .modes button:focus-visible { background: rgba(60, 14, 10, .7); transform: translateX(4px); outline: none; }
.modes b { font-size: 19px; letter-spacing: .1em; }
.modes span { font-size: 13px; color: var(--dim); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: inherit; }
#end .row { justify-content: center; margin-top: 18px; }
#end .row button, select { padding: 9px 18px; background: var(--glass); border: 1px solid rgba(255,255,255,.2); color: var(--ink); font: inherit; }
#end .row button:first-child { border-color: var(--red); background: rgba(90, 18, 12, .7); }
.home { color: var(--dim); text-decoration: none; font-size: 14px; }
.home:hover { color: var(--ink); }

#hud { position: fixed; inset: 0; pointer-events: none; font-family: 'Oswald', 'Noto Sans TC', sans-serif; }
.bars { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 7vh); left: 50%; transform: translateX(-50%); width: min(960px, calc(100% - 32px)); display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: end; }
.side .nm { font-size: 14px; letter-spacing: .12em; text-shadow: 0 1px 4px #000; }
.side small { color: var(--dim); font-size: 11px; letter-spacing: .2em; }
.side.k { text-align: right; }
.bar { height: 7px; background: rgba(0,0,0,.6); border: 1px solid rgba(255,255,255,.18); margin-top: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; transition: width .25s; }
.r .bar i { background: linear-gradient(90deg, #2a7fae, var(--cyan)); box-shadow: 0 0 10px var(--cyan); }
.k .bar { transform: scaleX(-1); }
.k .bar i { background: linear-gradient(90deg, #8a1c12, #ff5a36); box-shadow: 0 0 10px #ff5a36; }
.num { font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; margin-top: 2px; }
#clock { font-size: 22px; letter-spacing: .1em; font-variant-numeric: tabular-nums; text-shadow: 0 1px 4px #000; padding-bottom: 6px; }
#feed { position: absolute; left: clamp(16px, 4vw, 48px); bottom: calc(7vh + 18px); font-size: 13px; letter-spacing: .18em; color: #fff; text-shadow: 0 1px 3px #000; opacity: .85; }
#feed:empty { display: none; }
#cds { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom, 0px) + 54px); display: flex; gap: 8px; }
.cd { position: relative; min-width: 92px; padding: 4px 10px; font-size: 12px; letter-spacing: .1em; background: rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.12); overflow: hidden; color: var(--dim); text-align: center; }
.cd i { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--dim); }
.cd.ready { color: var(--ink); border-color: rgba(92, 210, 255, .6); }
.cd.ready i { background: var(--cyan); }
#help { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom, 0px) + 18px); width: max-content; max-width: calc(100% - 32px); text-align: center; font: 12px 'Noto Sans TC', sans-serif; color: var(--dim); text-shadow: 0 1px 3px #000; }
#help b { color: var(--ink); font-weight: 700; }

#pads { position: fixed; inset: auto 0 0 0; height: 46vh; pointer-events: none; }
#stick { position: absolute; left: 24px; bottom: calc(env(safe-area-inset-bottom, 0px) + 28px); width: 130px; height: 130px; border-radius: 50%; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.2); pointer-events: auto; touch-action: none; }
#knob { position: absolute; left: 40px; top: 40px; width: 50px; height: 50px; border-radius: 50%; background: rgba(255,255,255,.25); }
.btns { position: absolute; right: 16px; bottom: calc(env(safe-area-inset-bottom, 0px) + 22px); display: grid; grid-template-columns: repeat(4, 58px); gap: 8px; pointer-events: auto; }
.btns button { height: 58px; border-radius: 50%; background: rgba(0,0,0,.45); border: 1px solid rgba(255,255,255,.25); font-size: 13px; touch-action: none; }
.btns button:active { background: rgba(210, 58, 42, .6); }
@media (pointer: coarse) { #help { display: none; } #cds { bottom: auto; top: calc(7vh + 64px); } }

#mute { position: fixed; right: 14px; top: calc(env(safe-area-inset-top, 0px) + 12px); width: 40px; height: 40px; border-radius: 50%; background: var(--glass); border: 1px solid rgba(255,255,255,.15); font-size: 17px; z-index: 5; }
#nogl { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; text-align: center; background: #030406; }
@media (max-width: 560px) { #title { background: linear-gradient(0deg, rgba(0,0,0,.85) 0%, rgba(0,0,0,.4) 60%, transparent); padding-bottom: 28px; } .lede { font-size: 14px; } .modes button { padding: 10px 14px; } }
