:root {
  --bg: #0b0f17;
  --fg: #e6edf3;
  --accent: #f0883e;
  --muted: #8b949e;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: radial-gradient(circle at 50% 20%, #16202e 0%, var(--bg) 60%);
  color: var(--fg);
  font-family: ui-sans-serif, system-ui, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

#wrap {
  position: relative;
  width: min(100vw, calc(100vh * 16 / 9));
  height: min(100vh, calc(100vw * 9 / 16));
  margin: auto;
  top: 50%;
  transform: translateY(-50%);
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 10px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .06) inset;
}

#overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(6, 10, 16, .72);
  backdrop-filter: blur(4px);
  border-radius: 10px;
  text-align: center;
  padding: 24px;
  transition: opacity .18s ease;
}

#overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

#overlay h1 {
  margin: 0;
  font-size: clamp(28px, 5vw, 52px);
  letter-spacing: .06em;
  text-shadow: 0 0 28px rgba(240, 136, 62, .45);
}

#overlay .sub {
  margin: 0;
  color: var(--accent);
  letter-spacing: .18em;
  font-size: clamp(11px, 1.4vw, 14px);
}

#overlay .keys {
  display: flex;
  gap: 22px;
  color: var(--muted);
  font-size: clamp(11px, 1.3vw, 14px);
  margin-top: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

#hint {
  margin-top: 12px;
  color: var(--fg);
  font-size: clamp(12px, 1.5vw, 15px);
  animation: pulse 1.8s ease-in-out infinite;
}

kbd {
  background: #1c2534;
  border: 1px solid #2d3a4d;
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 6px;
  font: inherit;
  font-size: .92em;
  color: #c9d6e4;
}

@keyframes pulse {
  0%, 100% { opacity: .55; }
  50% { opacity: 1; }
}

#touch {
  position: absolute;
  inset: 0;
  display: none;
  pointer-events: none;
}

#stick {
  position: absolute;
  left: 6%;
  bottom: 8%;
  width: 118px;
  height: 118px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .05);
  pointer-events: auto;
  touch-action: none;
}

#knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  border-radius: 50%;
  background: rgba(240, 136, 62, .85);
  box-shadow: 0 0 18px rgba(240, 136, 62, .5);
}

#btnAtk {
  position: absolute;
  right: 7%;
  bottom: 10%;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  border: 2px solid rgba(240, 136, 62, .6);
  background: rgba(240, 136, 62, .18);
  color: var(--accent);
  font-size: 16px;
  font-weight: 700;
  pointer-events: auto;
  touch-action: none;
}

#btnAtk:active {
  background: rgba(240, 136, 62, .45);
}

body.touch #touch { display: block; }
