* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0a0418; color: #fff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  user-select: none; -webkit-user-select: none; touch-action: none; overscroll-behavior: none; }
#game canvas { position: fixed; inset: 0; display: block; touch-action: none; }
.hidden { display: none !important; }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none;
  padding: max(12px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left)); }
#hearts { position: absolute; left: max(14px, env(safe-area-inset-left)); top: max(14px, env(safe-area-inset-top));
  font-size: 26px; letter-spacing: 3px; color: #ff3d6e; text-shadow: 0 0 10px #ff3d6e; }
#hearts .empty { color: rgba(255,255,255,.18); text-shadow: none; }
#hearts .pop { display: inline-block; animation: heartPop .4s ease-out; }
@keyframes heartPop { 50% { transform: scale(1.6); } }
#scoreBox { position: absolute; left: 50%; top: max(10px, env(safe-area-inset-top)); transform: translateX(-50%); text-align: center; }
#score { font-size: 38px; font-weight: 900; font-variant-numeric: tabular-nums; text-shadow: 0 0 18px rgba(41,230,255,.8); }
#combo { font-size: 16px; font-weight: 800; color: #ffd84a; text-shadow: 0 0 10px #ff8a1f; height: 20px; letter-spacing: .08em; }
#buttons { position: absolute; right: max(12px, env(safe-area-inset-right)); top: max(10px, env(safe-area-inset-top)); display: flex; gap: 8px; pointer-events: auto; }
.icon { width: 44px; height: 44px; border-radius: 12px; border: 1px solid rgba(255,255,255,.25); background: rgba(20,8,40,.55);
  color: #fff; display: grid; place-items: center; cursor: pointer; backdrop-filter: blur(4px); }
.icon svg { width: 22px; height: 22px; fill: #fff; stroke: #fff; }
#banner { position: absolute; top: 34%; left: 0; right: 0; text-align: center; font-size: clamp(34px, 9vw, 64px); font-weight: 900;
  letter-spacing: .12em; text-shadow: 0 0 24px #ff3df0; opacity: 0; transform: scale(.9); transition: opacity .3s, transform .3s; }
#banner.show { opacity: 1; transform: scale(1); }
#banner small { display: block; font-size: 16px; letter-spacing: .25em; color: #ffd84a; margin-top: 6px; font-weight: 700; }

/* effects layer */
#fx { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.ring { position: absolute; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%;
  border: 2px solid #9ff6ff; box-shadow: 0 0 12px #29e6ff; animation: ring .35s ease-out forwards; }
.ring.miss { border-color: rgba(255,255,255,.5); box-shadow: none; }
@keyframes ring { from { transform: scale(.3); opacity: 1; } to { transform: scale(1.2); opacity: 0; } }
.popup { position: absolute; transform: translate(-50%, -50%); font-weight: 900; font-size: 22px; white-space: nowrap;
  text-shadow: 0 0 10px currentColor, 0 2px 0 rgba(0,0,0,.4); animation: pop .8s ease-out forwards; }
@keyframes pop { 0% { transform: translate(-50%,-50%) scale(.6); opacity: 1; } 20% { transform: translate(-50%,-70%) scale(1.15); }
  100% { transform: translate(-50%,-160%) scale(1); opacity: 0; } }
#hurt { position: fixed; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(255,0,60,.8) 100%); }

/* overlays */
.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: radial-gradient(ellipse at center, rgba(20,6,40,.35), rgba(8,2,20,.85)); }
.panel { width: min(400px, 100%); text-align: center; padding: 30px 24px; border-radius: 22px;
  background: rgba(22,8,44,.7); border: 1px solid rgba(255,255,255,.14); backdrop-filter: blur(8px);
  box-shadow: 0 20px 60px rgba(0,0,0,.4), 0 0 50px rgba(255,61,240,.15); }
.kicker { font-size: 12px; font-weight: 800; letter-spacing: .35em; color: #29e6ff; margin-bottom: 8px; }
.kicker.red { color: #ff3d6e; }
h1 { font-size: clamp(48px, 15vw, 72px); line-height: .9; font-weight: 900; letter-spacing: .04em; text-shadow: 0 0 30px rgba(41,230,255,.6); }
h1 span { color: #ff3df0; text-shadow: 0 0 30px rgba(255,61,240,.7); }
h2 { font-size: 40px; font-weight: 900; letter-spacing: .08em; margin-bottom: 14px; }
.sub { margin: 14px 0 16px; color: #d9c9f5; font-size: 16px; line-height: 1.4; }
.legend { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; text-align: left; font-size: 14px; color: #cdbbe9; margin-bottom: 22px; }
.legend li:last-child { grid-column: span 2; justify-self: center; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; background: var(--c); box-shadow: 0 0 10px var(--c); }
button { font-family: inherit; }
.big { width: 100%; padding: 17px; border: 0; border-radius: 16px; cursor: pointer; font-size: 22px; font-weight: 900; letter-spacing: .2em; color: #12051f;
  background: linear-gradient(90deg, #29e6ff, #ff3df0); box-shadow: 0 8px 30px rgba(255,61,240,.35); transition: transform .1s; }
.big:active { transform: scale(.97); }
.ghost { margin-top: 12px; width: 100%; padding: 13px; border-radius: 14px; border: 1px solid rgba(255,255,255,.3); background: transparent;
  color: #e6dcff; font-size: 15px; font-weight: 700; letter-spacing: .15em; cursor: pointer; }
.best { margin-top: 16px; font-size: 13px; letter-spacing: .25em; color: #b7a6d6; }
.best b { color: #ffd84a; }
.final { font-size: 64px; font-weight: 900; line-height: 1; text-shadow: 0 0 24px rgba(41,230,255,.7); }
.newbest { margin-top: 6px; color: #ffd84a; font-weight: 900; letter-spacing: .3em; text-shadow: 0 0 12px #ff8a1f; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 20px 0 22px; }
.stats div { display: flex; flex-direction: column; gap: 2px; }
.stats b { font-size: 20px; }
.stats span { font-size: 11px; letter-spacing: .1em; color: #b7a6d6; text-transform: uppercase; }
