:root{--bg:#060d13;--panel:#0e1d29;--line:#1c3646;--tx:#d6e7ee;--dim:#7d97a7;--run:#46e6d4;--echo:#ffb534;--bad:#ff5b4a;--ink:#06141b}
*{box-sizing:border-box}
html,body{margin:0;background:var(--bg);color:var(--tx);font-family:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;-webkit-text-size-adjust:100%}
body{padding-left:env(safe-area-inset-left);padding-right:env(safe-area-inset-right);padding-bottom:env(safe-area-inset-bottom)}
a{color:var(--run)}
.game-header{display:flex;justify-content:space-between;align-items:center;padding:.5rem 1rem;padding-top:calc(.5rem + env(safe-area-inset-top));font-size:.9rem}
.game-header a{display:inline-flex;align-items:center;min-height:44px;text-decoration:none}
.game-tag{color:var(--dim)}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.ep{display:flex;flex-direction:column;gap:.5rem;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}
.ep-top{display:flex;align-items:center;gap:.5rem}
.ep-room{font-weight:800;font-size:1.05rem;letter-spacing:.02em}
.ep-delay{flex:1;color:var(--echo);font-size:.85rem;font-variant-numeric:tabular-nums}
.tb{min-height:44px;min-width:44px;padding:0 .8rem;border:1px solid var(--line);background:var(--panel);color:var(--tx);border-radius:10px;font:inherit;font-size:.85rem;cursor:pointer}
.ep-chips{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap;gap:.35rem;min-height:1.7rem}
.chip{display:inline-flex;align-items:center;gap:.35rem;padding:.2rem .55rem;border-radius:999px;border:1.5px solid;font-size:.78rem;background:var(--ink)}
.chip b{font-family:ui-monospace,Menlo,Consolas,monospace}
.chip.kR{border-color:var(--run);color:var(--run)}
.chip.kE{border-color:var(--echo);color:var(--echo)}
.chip.kS{border-color:#f2f6f8;color:#f2f6f8;border-radius:8px}
.chip.next{box-shadow:0 0 0 2px rgba(255,255,255,.2)}
.chip.done{background:currentColor}
.chip.done b,.chip.done{color:var(--ink)}
.chip.done.kR{background:var(--run)}.chip.done.kE{background:var(--echo)}.chip.done.kS{background:#f2f6f8}
.ep-tip{margin:0;min-height:2.6em;font-size:.85rem;line-height:1.3;color:var(--dim)}
.ep-stage{position:relative;min-height:420px;display:flex;align-items:center;justify-content:center;background:var(--bg);border:1px solid var(--line);border-radius:14px;overflow:hidden}
#ep-canvas{display:block;touch-action:none;-webkit-touch-callout:none;max-width:100%}
.ep-ov{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:rgba(6,13,19,.9);padding:12px;overflow:hidden}
.ep-ov[hidden]{display:none}
.ep-ov.res{align-items:flex-end;background:rgba(6,13,19,.55)}
.card{width:100%;max-width:340px;background:var(--panel);border:1px solid var(--line);border-radius:14px;padding:1rem;display:flex;flex-direction:column;gap:.55rem;text-align:center;animation:rise .28s ease-out}
.card h2{margin:0;font-size:1.3rem}
.card p{margin:0;font-size:.9rem;line-height:1.35;color:var(--dim)}
.ttl h2{font-size:2.1rem;letter-spacing:.04em;color:var(--run);text-shadow:0 0 18px rgba(70,230,212,.35)}
.ttl .kick{color:var(--echo);text-transform:uppercase;letter-spacing:.14em;font-size:.72rem}
.ttl .note{font-size:.78rem}
.btn{min-height:48px;padding:0 .9rem;border:1px solid var(--line);background:var(--panel);color:var(--tx);border-radius:12px;font:inherit;font-weight:700;font-size:.95rem;cursor:pointer;touch-action:manipulation}
.btn:disabled{opacity:.4;cursor:default}
.btn.pri,.btn.go{background:var(--run);border-color:var(--run);color:var(--ink)}
.btn.go{min-height:56px;font-size:1.15rem;letter-spacing:.06em;text-transform:uppercase}
.btn.go:disabled{background:var(--panel);border-color:var(--line);color:var(--dim)}
.btn:active:not(:disabled){transform:scale(.97)}
.btn:focus-visible,.tb:focus-visible,.room:focus-visible{outline:3px solid var(--echo);outline-offset:2px}
.ep-btns{display:flex;gap:.5rem}.ep-btns .btn{flex:1}
.ep-row{display:grid;grid-template-columns:repeat(4,1fr);gap:.4rem}
.ep-row .btn{padding:0;font-weight:600;font-size:.88rem}
.ep-meter{font-size:.85rem;color:var(--dim);font-variant-numeric:tabular-nums;white-space:pre}
.stars{display:inline-flex;gap:6px;justify-content:center}
.st{width:22px;height:22px;background:#26404f;clip-path:polygon(50% 0,62% 36%,100% 38%,70% 60%,80% 100%,50% 76%,20% 100%,30% 60%,0 38%,38% 36%)}
.st.on{background:var(--echo)}
.lv{max-width:360px;height:100%;max-height:100%}
.lv-head{display:flex;justify-content:space-between;align-items:center}
.roomgrid{display:grid;grid-template-columns:repeat(5,1fr);gap:6px;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y;-webkit-overflow-scrolling:touch;min-height:0;flex:1;padding:2px}
.lv{min-height:0}
.room{min-height:56px;border:1px solid var(--line);background:var(--ink);color:var(--tx);border-radius:10px;font:inherit;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;cursor:pointer;touch-action:manipulation}
.room span:first-child{font-weight:700;font-family:ui-monospace,Menlo,Consolas,monospace}
.room .st{width:9px;height:9px}.room .stars{gap:1px}
.room.cleared{border-color:var(--run)}
.room.current{border-color:var(--echo);box-shadow:0 0 0 1px var(--echo)}
.room:disabled{opacity:.35;cursor:default}
.ep-about{margin-top:1.2rem;color:var(--dim);font-size:.85rem;line-height:1.5}
.ep-about h2{font-size:1rem;color:var(--tx);margin:0 0 .4rem}
footer{padding:1rem;text-align:center;font-size:.8rem;color:var(--dim)}
@keyframes rise{from{transform:translateY(14px);opacity:0}to{transform:none;opacity:1}}
@media (prefers-reduced-motion:reduce){.card{animation:none}.btn:active:not(:disabled){transform:none}}
.card .nxt{color:var(--echo);font-size:.85rem}
.ep-tip{border-left:3px solid var(--line);padding-left:.55rem}
.ep-stage{background:radial-gradient(ellipse at 50% 40%,#0d2230,var(--bg) 70%);box-shadow:inset 0 0 40px rgba(70,230,212,.05)}
.chip.next{animation:nextp 1.4s ease-in-out infinite}
@keyframes nextp{50%{box-shadow:0 0 0 4px rgba(255,255,255,.12)}}
@media (prefers-reduced-motion:reduce){.chip.next{animation:none}}

/* ---- full screen (shell immersive / native) ---- */
html.pip-immersive .ep-about,html.pip-immersive .ad-well,html.pip-immersive .game-header,html.pip-immersive footer,html.pip-immersive #similar-games,html.pip-immersive .ep-tip:empty{display:none!important}
html.pip-immersive .game-wrap{max-width:none;margin:0;padding:8px 10px calc(8px + env(safe-area-inset-bottom));display:flex;flex-direction:column;overflow:hidden}
html.pip-immersive .ep{flex:1;min-height:0;gap:.35rem}
html.pip-immersive .ep-stage{flex:1;min-height:0}
html.pip-immersive .ep-tip{min-height:0;font-size:.8rem}
html.pip-immersive .ep-chips{min-height:0;flex-wrap:nowrap;overflow:hidden}
html.pip-immersive .btn{min-height:44px}
html.pip-immersive .btn.go{min-height:48px}
@media (orientation:landscape) and (max-height:520px){
  html.pip-immersive .ep{display:grid;grid-template-columns:minmax(0,1fr) 168px;grid-template-rows:auto auto auto minmax(0,1fr) auto;column-gap:.6rem}
  html.pip-immersive .ep-top,html.pip-immersive .ep-chips,html.pip-immersive .ep-tip{grid-column:1}
  html.pip-immersive .ep-stage{grid-column:1;grid-row:4/6}
  html.pip-immersive .ep-meter{grid-column:2;grid-row:1;align-self:center}
  html.pip-immersive .ep-row{grid-column:2;grid-row:2/4;grid-template-columns:1fr 1fr;align-content:start}
  html.pip-immersive .ep-row~.go,html.pip-immersive .btn.go{grid-column:2;grid-row:4/6;align-self:end}
}
