:root {
  --bg: #090511;
  --panel: rgba(18, 8, 34, .92);
  --line: rgba(255,255,255,.15);
  --pink: #ff3fad;
  --cyan: #2cf6ff;
  --lime: #b9ff3f;
  --purple: #8d5cff;
  --text: #fff8ff;
  --muted: #c5b9d4;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: radial-gradient(circle at 50% 0%, #251040 0%, var(--bg) 52%, #030205 100%); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { min-height: 100vh; overflow-x: hidden; }
button, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.page-shell { width: 100%; min-height: 100vh; padding: 18px; display: grid; place-items: center; }
.game-shell { width: min(1500px, 100%); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 12px; }
.brand-kicker { display: block; color: var(--cyan); font-size: 11px; font-weight: 900; letter-spacing: .2em; }
h1 { margin: 2px 0 0; font-size: clamp(20px, 3vw, 34px); line-height: 1; letter-spacing: -.04em; text-transform: uppercase; }
h1 em { color: var(--pink); font-style: normal; }
.top-actions { display: flex; gap: 8px; }
.icon-btn { width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.07); color: white; font-weight: 900; cursor: pointer; transition: .2s ease; }
.icon-btn:hover { transform: translateY(-2px); background: rgba(255,255,255,.14); }
.canvas-wrap { position: relative; width: 100%; aspect-ratio: 16/9; overflow: hidden; border-radius: 22px; border: 1px solid rgba(255,255,255,.2); background: #080310; box-shadow: 0 30px 80px rgba(0,0,0,.48), 0 0 42px rgba(141,92,255,.12); isolation: isolate; }
.canvas-wrap::before { content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08), inset 0 -80px 100px rgba(0,0,0,.18); }
.canvas-wrap::after { content: ""; position: absolute; inset: -45% -20%; z-index: 1; pointer-events: none; background: linear-gradient(115deg, transparent 42%, rgba(255,255,255,.055) 49%, transparent 56%); transform: translateX(-45%); animation: stageSheen 8s ease-in-out infinite; }
@keyframes stageSheen { 0%,18% { transform: translateX(-48%); } 72%,100% { transform: translateX(48%); } }
canvas { position: relative; z-index: 0; display: block; width: 100%; height: 100%; touch-action: none; }
.hud, .health-ui, .overlay, .countdown, .rating-pop { z-index: 3; }
.hud { position: absolute; left: 18px; top: 18px; display: flex; gap: 8px; pointer-events: none; }
.hud > div { min-width: 92px; padding: 9px 12px; border: 1px solid rgba(255,255,255,.14); border-radius: 12px; background: linear-gradient(145deg, rgba(25,10,39,.82), rgba(7,3,13,.72)); backdrop-filter: blur(8px); box-shadow: inset 0 1px 0 rgba(255,255,255,.07), 0 8px 22px rgba(0,0,0,.18); }
.hud span, .song-preview span, .result-stats span { display: block; color: #d1c4df; font-size: 9px; font-weight: 900; letter-spacing: .16em; }
.hud strong { font-size: 16px; }
.health-ui { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); width: min(62%, 720px); display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px; pointer-events: none; }
.health-track { position: relative; height: 18px; overflow: hidden; border-radius: 99px; background: linear-gradient(90deg, var(--pink), #4b183f 49%, #14373a 51%, var(--cyan)); border: 3px solid rgba(255,255,255,.86); box-shadow: 0 5px 0 rgba(0,0,0,.45); }
.health-fill { position: absolute; inset: 0 0 0 auto; width: 50%; background: linear-gradient(90deg, var(--lime), var(--cyan)); transition: width .14s ease-out; }
.health-center { position: absolute; left: 50%; top: -4px; bottom: -4px; width: 3px; background: #fff; transform: translateX(-50%); }
.fighter-label { font-size: 11px; font-weight: 1000; letter-spacing: .12em; text-shadow: 0 2px 0 #000; }
.enemy-label { color: var(--pink); }
.player-label { color: var(--cyan); }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(5,2,10,.55); opacity: 0; visibility: hidden; transition: opacity .2s ease; backdrop-filter: blur(5px); }
.overlay-visible { opacity: 1; visibility: visible; }
.panel { width: min(650px, 100%); padding: clamp(22px, 4vw, 42px); border-radius: 24px; border: 1px solid rgba(255,255,255,.18); background: var(--panel); box-shadow: 0 24px 80px rgba(0,0,0,.55); text-align: center; }
.start-panel { width: min(720px, 100%); }
.logo-mark { margin-bottom: 16px; transform: rotate(-2deg); text-shadow: 5px 5px 0 #000; }
.logo-mark span { display: block; color: var(--cyan); font-size: clamp(24px, 5vw, 48px); font-weight: 1000; letter-spacing: -.06em; line-height: .8; }
.logo-mark strong { color: var(--pink); font-size: clamp(54px, 10vw, 96px); font-style: italic; line-height: .82; letter-spacing: -.09em; -webkit-text-stroke: 2px white; }
.intro { max-width: 560px; margin: 0 auto 22px; color: var(--muted); line-height: 1.55; }
.selection-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; text-align: left; }
label { color: #d9cee4; font-size: 11px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
select { width: 100%; margin-top: 7px; padding: 13px 14px; border: 1px solid rgba(255,255,255,.16); border-radius: 13px; background: #160b28; color: white; outline: none; }
select:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(44,246,255,.12); }
.song-preview { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-bottom: 18px; }
.song-preview > div { padding: 12px; border-radius: 12px; background: rgba(255,255,255,.055); border: 1px solid rgba(255,255,255,.1); }
.song-preview strong { font-size: 18px; }
.primary-btn, .secondary-btn { width: 100%; padding: 14px 18px; border-radius: 13px; font-weight: 1000; letter-spacing: .08em; cursor: pointer; transition: transform .15s ease, filter .15s ease; }
.primary-btn { border: 0; background: linear-gradient(135deg, var(--pink), var(--purple)); color: white; box-shadow: 0 8px 0 #5b174a; }
.primary-btn:hover { transform: translateY(-2px); filter: brightness(1.12); }
.primary-btn:active { transform: translateY(5px); box-shadow: 0 3px 0 #5b174a; }
.secondary-btn { margin-top: 10px; border: 1px solid rgba(255,255,255,.15); background: rgba(255,255,255,.06); color: white; }
.controls-copy { margin: 17px 0 0; color: #ad9fbd; font-size: 12px; }
.compact-panel { width: min(440px, 100%); }
.compact-panel h2, .result-panel h2 { margin: 8px 0 22px; font-size: clamp(24px, 4vw, 42px); letter-spacing: -.04em; }
.eyebrow { color: var(--cyan); font-size: 11px; font-weight: 1000; letter-spacing: .2em; }
.rank { margin: 2px auto -8px; color: var(--lime); font-size: clamp(80px, 15vw, 150px); font-weight: 1000; font-style: italic; line-height: 1; text-shadow: 7px 7px 0 #000; -webkit-text-stroke: 2px white; }
.result-stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; margin-bottom: 18px; }
.result-stats > div { padding: 13px 8px; border-radius: 12px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); }
.result-stats strong { font-size: 18px; }
.countdown { position: absolute; left: 50%; top: 45%; transform: translate(-50%,-50%) rotate(-4deg); color: var(--lime); font-size: clamp(74px, 14vw, 180px); font-weight: 1000; font-style: italic; text-shadow: 8px 8px 0 #000; -webkit-text-stroke: 3px white; pointer-events: none; }
.rating-pop { position: absolute; left: 50%; top: 49%; transform: translate(-50%,-50%) rotate(-5deg); opacity: 0; font-size: clamp(36px, 6vw, 76px); font-weight: 1000; font-style: italic; text-shadow: 5px 5px 0 #000; -webkit-text-stroke: 2px white; pointer-events: none; }
.rating-pop.show { animation: rating .42s ease-out; }
@keyframes rating { 0%{opacity:0; transform:translate(-50%,-35%) scale(.65) rotate(-9deg)} 30%{opacity:1; transform:translate(-50%,-50%) scale(1.15) rotate(-4deg)} 100%{opacity:0; transform:translate(-50%,-68%) scale(.95) rotate(-2deg)} }
.mobile-controls { display: none; grid-template-columns: repeat(4,1fr); gap: 9px; margin-top: 12px; }
.mobile-key { min-height: 64px; border: 1px solid rgba(255,255,255,.18); border-radius: 16px; color: white; font-size: 28px; font-weight: 1000; background: rgba(255,255,255,.08); box-shadow: inset 0 -5px 0 rgba(0,0,0,.28); touch-action: manipulation; }
.mobile-key.active { transform: translateY(3px) scale(.97); filter: brightness(1.55); box-shadow: inset 0 -2px 0 rgba(0,0,0,.25), 0 0 24px currentColor; }
.mobile-key.left { color: #c95cff; }.mobile-key.down { color: #55f6ff; }.mobile-key.up { color: #79ff6a; }.mobile-key.right { color: #ff5d9f; }
@media (max-width: 900px), (pointer: coarse) { .mobile-controls { display: grid; } .page-shell { padding: 10px; } .topbar { margin-bottom: 8px; } .brand-kicker { display: none; } .canvas-wrap { border-radius: 15px; } .hud { left: 8px; top: 8px; } .hud > div { min-width: 68px; padding: 6px 8px; } .hud span { font-size: 7px; } .hud strong { font-size: 13px; } .health-ui { bottom: 8px; width: 78%; } }
@media (max-width: 620px) { .selection-grid { grid-template-columns: 1fr; } .song-preview { grid-template-columns: repeat(3,1fr); } .panel { padding: 18px; } .intro { font-size: 13px; margin-bottom: 14px; } .controls-copy { display: none; } .result-stats { grid-template-columns: 1fr 1fr; } .logo-mark strong { -webkit-text-stroke-width: 1px; } .top-actions .icon-btn { width: 38px; height: 38px; } }

/* Reliable mobile game controls */
.mobile-control-panel{display:none}.mobile-control-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:9px}.mobile-control-head>span{font-size:10px;font-weight:1000;letter-spacing:.16em;text-transform:uppercase;color:#d8cce5}.mobile-utility-controls{display:flex;gap:7px}.mobile-utility-controls button{width:42px;height:38px;border:1px solid rgba(255,255,255,.18);border-radius:12px;background:#211031;color:#fff;font-weight:1000;touch-action:manipulation}.mobile-controls{margin-top:0}.mobile-key{display:grid;place-items:center;align-content:center;gap:0;user-select:none;-webkit-user-select:none;touch-action:none}.mobile-key span{font-size:31px;line-height:1}.mobile-key small{font-size:7px;letter-spacing:.12em;font-weight:1000;color:currentColor;opacity:.82}.mobile-key:focus-visible,.mobile-utility-controls button:focus-visible{outline:3px solid #fff;outline-offset:2px}
@media (max-width:900px), (pointer:coarse){.mobile-control-panel{display:block;position:sticky;bottom:6px;z-index:20;margin-top:10px;padding:10px;border:1px solid rgba(255,255,255,.16);border-radius:18px;background:rgba(15,6,25,.94);box-shadow:0 14px 36px rgba(0,0,0,.42);backdrop-filter:blur(12px)}.mobile-controls{display:grid}.page-shell{display:block;min-height:auto}.game-shell{margin-inline:auto}}
@media(max-width:620px){.mobile-key{min-height:68px;border-radius:14px}.page-shell{padding:8px}.canvas-wrap{aspect-ratio:16/10}.hud>div{min-width:0}.hud{right:8px}.hud>div{flex:1}.fighter-label{font-size:8px}.health-track{height:15px}}

/* Mobile playability and full-screen mode */
html,body{overscroll-behavior:none}.fullscreen-icon-btn{font-size:20px}.mobile-utility-controls button{font-size:18px}.mobile-key{cursor:pointer;will-change:transform;transition:transform .08s ease,filter .08s ease,box-shadow .08s ease}.mobile-key:active{transform:translateY(3px) scale(.97);filter:brightness(1.55)}
body.game-fullscreen{overflow:hidden}.game-fullscreen .page-shell{width:100%;height:100svh;min-height:100svh;padding:6px;display:block}.game-fullscreen .game-shell{height:100%;display:grid;grid-template-rows:auto minmax(0,1fr) auto;gap:6px}.game-fullscreen .topbar{margin:0}.game-fullscreen .canvas-wrap{width:100%;height:100%;min-height:0;aspect-ratio:auto;border-radius:10px}.game-fullscreen canvas{width:100%;height:100%;object-fit:contain;background:#080310}.game-fullscreen .mobile-control-panel{position:relative;bottom:auto;margin:0;border-radius:13px;padding:7px}.game-fullscreen .mobile-control-head{margin-bottom:5px}.game-fullscreen .mobile-key{min-height:54px}.game-fullscreen .overlay{position:fixed;inset:0;z-index:100;padding:max(12px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));overflow:auto}.game-fullscreen .panel{margin:auto}
@media(max-width:900px),(pointer:coarse){
  html,body{min-height:100%;touch-action:manipulation}
  .page-shell{padding:8px;display:block;min-height:100%}
  .game-shell{width:100%}
  .topbar{position:relative;z-index:30}
  .canvas-wrap{aspect-ratio:16/9;min-height:0}
  .overlay{position:fixed;inset:0;z-index:100;padding:max(12px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));overflow-y:auto;overscroll-behavior:contain;background:rgba(5,2,10,.88)}
  .overlay .panel{margin:auto;max-height:none}
  .start-panel{width:min(560px,100%)}
  .logo-mark{margin-bottom:10px}
  .logo-mark span{font-size:28px}
  .logo-mark strong{font-size:58px}
  .selection-grid{gap:9px}
  select{padding:11px 12px}
  .song-preview>div{padding:9px 7px}
  .primary-btn,.secondary-btn{min-height:48px}
  .mobile-control-panel{position:sticky;bottom:max(4px,env(safe-area-inset-bottom));z-index:40;margin-top:8px;padding:9px}
  .mobile-key{min-height:72px;touch-action:none}
  .mobile-key span{font-size:34px}
}
@media(max-width:620px){
  .topbar h1{font-size:17px}
  .top-actions{gap:5px}
  .top-actions .icon-btn{width:36px;height:36px;border-radius:11px}
  .canvas-wrap{aspect-ratio:16/9}
  .hud{gap:4px}
  .hud>div{padding:5px 6px}
  .hud strong{font-size:11px}
  .health-ui{width:86%;bottom:5px}
  .mobile-control-panel{border-radius:15px}
  .mobile-key{min-height:70px}
  .mobile-utility-controls button{width:40px;height:36px}
  .panel{padding:16px;border-radius:18px}
  .intro{margin-bottom:10px}
  .song-preview{margin-bottom:12px}
}
@media(orientation:landscape) and (max-height:520px){
  .game-fullscreen .topbar{display:none}
  .game-fullscreen .game-shell{grid-template-rows:minmax(0,1fr) auto}
  .game-fullscreen .mobile-control-head{display:none}
  .game-fullscreen .mobile-controls{gap:7px}
  .game-fullscreen .mobile-key{min-height:48px}
  .game-fullscreen .health-ui{bottom:5px}
}
