:root {
  --void: #0b2f3a;
  --ink: #061a20;
  --accent: #ff6b4a;
  --glow: #7afcff;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  height: 100%;
  background: var(--ink);
  color: #e8f7ff;
  font-family: "Segoe UI", system-ui, sans-serif;
  overflow: hidden;
  touch-action: none;
}

#wrap {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #134e5e 0%, var(--ink) 65%);
}

#c {
  display: block;
  max-width: 100vw;
  max-height: 100vh;
  width: auto;
  height: auto;
  background: #000;
  border-radius: 10px;
  box-shadow:
    0 0 0 3px rgba(122, 252, 255, 0.25),
    0 24px 80px rgba(0, 0, 0, 0.75),
    inset 0 0 120px rgba(0, 40, 60, 0.35);
  cursor: crosshair;
  outline: none;
}

#hud {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 1200px;
  max-width: 100vw;
  height: 900px;
  max-height: 100vh;
  pointer-events: none;
  padding: 14px 18px;
}

#hud-left, #hud-right, #hud-center {
  position: absolute;
  top: 10px;
  font-weight: 700;
  font-size: 14px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.85);
  letter-spacing: 0.04em;
}

#hud-left {
  left: 16px;
}

#hud-right {
  right: 16px;
  text-align: right;
}

.wave-bar-wrap {
  margin-top: 8px;
  width: min(220px, 42vw);
  margin-left: auto;
  height: 10px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(122, 252, 255, 0.25);
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.wave-bar-wrap.visible {
  opacity: 1;
}

.wave-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 5px;
  background: linear-gradient(90deg, #42a85e, #7afcff);
  box-shadow: 0 0 12px rgba(122, 252, 255, 0.45);
  transition: width 0.12s ease-out;
}

.wave-bar-lab {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #9ad4e0;
  letter-spacing: 0.03em;
  min-height: 1.2em;
}

#hud-center {
  left: 50%;
  transform: translateX(-50%);
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  -webkit-text-stroke: 1px rgba(0, 0, 0, 0.35);
}

#hearts {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
  font-size: 22px;
  line-height: 1;
}

.hud-row {
  margin-top: 4px;
  opacity: 0.95;
}

.icon.star {
  color: #ffd56a;
  margin-right: 2px;
}

#xpbar-wrap {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 220px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.45);
  border: 2px solid rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

#xpfill {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 0%;
  background: linear-gradient(180deg, var(--glow), #4ad9ff);
  box-shadow: 0 0 16px rgba(122, 252, 255, 0.6);
  transition: height 0.15s ease-out;
}

#xplabel {
  position: absolute;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 4px #000;
  white-space: nowrap;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 16, 22, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  backdrop-filter: blur(6px);
}

.overlay.hidden {
  display: none;
}

.card {
  background: linear-gradient(160deg, #123541, #0a1f28);
  border: 2px solid rgba(122, 252, 255, 0.35);
  border-radius: 20px;
  padding: 32px 40px;
  max-width: 520px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.65);
}

.card h1, .card h2 {
  margin: 0 0 12px;
  font-size: 2rem;
  color: #fff;
  letter-spacing: 0.02em;
}

.card h2 {
  color: var(--accent);
}

.skull {
  filter: drop-shadow(0 0 12px rgba(255, 107, 74, 0.7));
}

.tag {
  color: #9ad4e0;
  margin: 0 0 18px;
  line-height: 1.5;
}

.music-opts {
  text-align: left;
  margin: 0 0 20px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(122, 252, 255, 0.2);
}

.music-row {
  margin-bottom: 12px;
}

.music-row:last-child {
  margin-bottom: 0;
}

.music-row label {
  display: block;
  font-size: 0.82rem;
  color: #9ad4e0;
  margin-bottom: 6px;
  font-weight: 600;
}

.music-row select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(122, 252, 255, 0.35);
  background: #0a2530;
  color: #e8f7ff;
  font: inherit;
  cursor: pointer;
}

.music-row-inline label.chk {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
  cursor: pointer;
}

.music-row-inline input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.music-row-vol {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px 12px;
  align-items: center;
}

.music-row-vol label {
  margin-bottom: 0;
  white-space: nowrap;
}

.music-row-vol input[type="range"] {
  width: 100%;
  accent-color: var(--glow);
}

#bgmVolLab {
  font-size: 0.85rem;
  font-weight: 700;
  color: #7afcff;
  min-width: 3em;
  text-align: right;
}

.hint {
  margin: 18px 0 0;
  font-size: 0.82rem;
  color: #7aa8b5;
  line-height: 1.45;
}

.card button {
  appearance: none;
  border: none;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 14px 36px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), #c13d2a);
  color: #fff;
  box-shadow:
    0 6px 0 #6b2318,
    0 10px 28px rgba(0, 0, 0, 0.45);
  transition: transform 0.08s ease, filter 0.08s;
}

.card button:hover {
  filter: brightness(1.08);
}

.card button:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 #6b2318;
}

#touchHud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  display: none;
}

#touchHud.active {
  display: block;
}

.touch-zone {
  position: absolute;
  bottom: 0;
  height: 45%;
  width: 50%;
  pointer-events: auto;
}

#stickZone {
  left: 0;
}

#aimZone {
  right: 0;
}
