:root {
  --teal: #2ee6c8; --mag: #ff4f6e; --amber: #ffc65c;
  --ink: #0b0f2a; --panel: rgba(13, 17, 48, 0.86); --line: #2c3a6e;
  --text: #dfe6ff;
}
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; overflow: hidden; background: var(--ink); }
body { font-family: "Segoe UI", system-ui, sans-serif; color: var(--text); }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#hud button, #hud .panel button, .overlay button { pointer-events: auto; }

#topbar {
  position: absolute; top: 10px; left: 12px; display: flex; gap: 10px; align-items: center;
}
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 6px 12px; display: flex; gap: 8px; align-items: baseline;
}
.stat span { opacity: 0.7; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.stat b { font-size: 18px; color: var(--amber); }
#hud-queue-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; min-width: 110px; opacity: 0; transition: opacity 0.3s; }
#hud-queue { font-size: 12px; margin-bottom: 4px; }

#corebars { position: absolute; top: 10px; right: 12px; width: 190px; display: flex; flex-direction: column; gap: 8px; }
.corebar { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; }
.corebar span { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; opacity: 0.8; }
.track { height: 8px; border-radius: 4px; background: #1a2148; margin-top: 4px; overflow: hidden; }
.track.sm { height: 6px; }
#core-player-bar { height: 100%; width: 100%; background: var(--teal); transition: width 0.25s; }
#core-enemy-bar { height: 100%; width: 100%; background: var(--mag); transition: width 0.25s; }

#hint {
  position: absolute; top: 64px; left: 50%; transform: translateX(-50%);
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 6px 14px; font-size: 13px; opacity: 0; transition: opacity 0.6s; max-width: 90vw;
}

#buildbar {
  position: absolute; bottom: 12px; left: 12px; display: flex; gap: 8px; flex-wrap: wrap; max-width: 70vw;
}
#buildbar button, #touchpad button, .panel button {
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 14px; font-size: 14px; cursor: pointer;
  touch-action: manipulation; user-select: none;
}
#buildbar button:hover, #touchpad button:hover { border-color: var(--teal); color: #fff; }
kbd { background: #222c58; border-radius: 4px; padding: 1px 6px; font-size: 11px; margin-left: 6px; }

#touchpad { position: absolute; bottom: 12px; right: 12px; display: flex; gap: 14px; align-items: flex-end; }
#dpad button { width: 46px; height: 46px; font-size: 16px; }
#dpad > div { display: flex; gap: 4px; justify-content: center; }
#dpad > button { display: block; margin: 0 auto 4px; }
#pad-right { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
#pad-right button { width: 46px; height: 40px; font-size: 16px; }

#overlay-start, #overlay-end, #overlay-paused {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(6, 8, 22, 0.72); z-index: 10;
}
#overlay-paused { display: none; }
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 28px 32px; max-width: min(560px, 92vw); text-align: center;
}
.panel h1 { font-size: clamp(30px, 7vw, 44px); letter-spacing: 2px; color: var(--amber); }
.panel h2 { font-size: 26px; color: var(--amber); margin-bottom: 8px; }
.panel .tag { opacity: 0.8; margin: 6px 0 14px; }
.panel ul { text-align: left; margin: 0 0 14px; padding-left: 20px; font-size: 14px; line-height: 1.7; }
.panel b { color: var(--teal); }
.panel .keys { font-size: 12px; opacity: 0.75; margin-bottom: 18px; line-height: 1.8; }
.panel button {
  font-size: 17px; padding: 12px 26px; border-color: var(--teal);
  color: #fff; background: linear-gradient(135deg, #12594c, #0f3f70);
}
.panel button:hover { filter: brightness(1.25); }

@media (max-width: 640px) {
  #corebars { width: 130px; }
  #touchpad { gap: 8px; }
  #buildbar { max-width: 58vw; }
  #buildbar button { padding: 8px 10px; font-size: 12px; }
  #buildbar kbd { display: none; }
}
