* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; background: #0b0a1e; }
body { font-family: "Segoe UI", system-ui, sans-serif; color: #e8e6ff;
       -webkit-user-select: none; user-select: none; touch-action: manipulation; }
#game-canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#hud-top { display: flex; justify-content: space-between; align-items: flex-start;
           padding: 10px 14px; }
.hud-box { display: flex; flex-direction: column; gap: 2px; min-width: 90px; }
.label { font-size: 10px; letter-spacing: 3px; color: #8f89c9; }
#score { font-size: 26px; font-weight: 700; color: #ffd98a;
         text-shadow: 0 0 14px rgba(255,177,78,.6); font-variant-numeric: tabular-nums; }
#time-left { font-size: 20px; color: #7de3ff; text-align: right; }
#combo { font-size: 30px; font-weight: 800; color: #b9b3ef;
         text-shadow: 0 0 12px rgba(140,120,255,.5); }
#combo.hot { color: #ff5d8f; text-shadow: 0 0 18px rgba(255,93,143,.8); }
#judge { position: absolute; top: 30%; left: 50%; transform: translate(-50%,-50%);
         font-size: 34px; font-weight: 800; letter-spacing: 4px; opacity: 0; }
#judge.show { opacity: 1; animation: pop .28s ease-out; }
#judge.q2 { color: #ffd98a; text-shadow: 0 0 22px rgba(255,217,138,.9); }
#judge.q1 { color: #7de3ff; text-shadow: 0 0 18px rgba(125,227,255,.8); }
#judge.q0 { color: #ff5d8f; text-shadow: 0 0 18px rgba(255,93,143,.8); }
@keyframes pop { from { transform: translate(-50%,-50%) scale(1.6); } to { transform: translate(-50%,-50%) scale(1); } }
#bars { position: absolute; top: 64px; left: 14px; width: 210px; display: flex;
        flex-direction: column; gap: 6px; }
.bar { display: flex; align-items: center; gap: 8px; }
.bar .label { width: 44px; }
.track { flex: 1; height: 8px; background: rgba(255,255,255,.12); border-radius: 4px; overflow: hidden; }
#life-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #ff5d8f, #ffd98a); border-radius: 4px; }
#prog-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #2ee8c8, #7de3ff); border-radius: 4px; }
#touch-controls { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
                  display: flex; gap: 10px; pointer-events: auto; }
.touch-btn { pointer-events: auto; width: 74px; height: 60px; border-radius: 14px;
  border: 2px solid var(--c); background: color-mix(in srgb, var(--c) 18%, rgba(10,8,30,.7));
  color: var(--c); font: 700 20px/1 "Segoe UI", sans-serif; letter-spacing: 2px;
  touch-action: manipulation; }
.touch-btn.press { animation: btnflash .18s ease-out; }
@keyframes btnflash { from { background: var(--c); } to { background: rgba(10,8,30,.7); } }
.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
           background: rgba(8,6,24,.78); backdrop-filter: blur(4px); z-index: 10; }
.overlay.hidden { display: none; }
.panel { max-width: 560px; margin: 16px; padding: 28px 32px; text-align: center;
  background: linear-gradient(160deg, rgba(40,32,80,.92), rgba(20,14,44,.92));
  border: 1px solid rgba(169,123,255,.4); border-radius: 18px;
  box-shadow: 0 0 60px rgba(120,80,255,.25); }
.panel h1 { font-size: 40px; letter-spacing: 10px; color: #ffd98a;
  text-shadow: 0 0 24px rgba(255,177,78,.7); margin-bottom: 10px; }
#end-title.lose { color: #ff5d8f; text-shadow: 0 0 24px rgba(255,93,143,.7); }
.tag { color: #b9b3ef; margin-bottom: 14px; }
.keys { list-style: none; text-align: left; font-size: 14px; line-height: 1.8; color: #d5d1f5; }
.keys b { color: #7de3ff; }
.big-btn { margin-top: 16px; padding: 14px 42px; font-size: 18px; font-weight: 700;
  letter-spacing: 3px; color: #14102e; background: linear-gradient(90deg, #ffb14e, #ff5d8f);
  border: none; border-radius: 999px; cursor: pointer;
  box-shadow: 0 0 26px rgba(255,120,110,.5); }
.hint { margin-top: 10px; font-size: 12px; color: #8f89c9; }
@media (max-width: 640px) {
  #touch-controls { gap: 8px; width: 100%; justify-content: center; }
  .touch-btn { width: calc((100vw - 56px) / 4); max-width: 86px; height: 52px; }
  #bars { width: 150px; }
  .panel h1 { font-size: 28px; letter-spacing: 6px; }
}
