* { box-sizing: border-box; }

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
  background: #180f19;
  color: #ffe9d7;
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}

#app {
  position: fixed;
  inset: 0;
}

canvas {
  display: block;
  touch-action: none;
}

#overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 52% 58%, rgba(191, 98, 74, 0.36), rgba(24, 15, 25, 0.92) 66%),
    linear-gradient(180deg, rgba(72, 49, 99, 0.55), rgba(31, 14, 21, 0.94));
  transition: opacity 700ms ease;
}

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

.start-panel {
  width: min(480px, calc(100vw - 32px));
  text-align: center;
}

.eyebrow {
  margin: 0 0 8px;
  color: rgba(255, 225, 195, 0.74);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(40px, 9vw, 78px);
  font-weight: 250;
  letter-spacing: 0.16em;
  text-indent: 0.16em;
  text-shadow: 0 0 36px rgba(255, 185, 115, 0.65);
}

.lead {
  margin: 16px auto 28px;
  max-width: 34em;
  color: rgba(255, 232, 214, 0.78);
  font-size: 14px;
  line-height: 1.8;
}

#nickInput {
  width: min(320px, 100%);
  height: 44px;
  padding: 0 18px;
  border: 1px solid rgba(255, 215, 178, 0.36);
  border-radius: 22px;
  outline: none;
  background: rgba(19, 9, 17, 0.48);
  color: #ffe9d7;
  text-align: center;
  font-size: 15px;
}

#nickInput::placeholder {
  color: rgba(255, 226, 205, 0.48);
}

.actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

button {
  height: 44px;
  min-width: 132px;
  border: 1px solid rgba(255, 213, 172, 0.48);
  border-radius: 22px;
  background: rgba(255, 204, 142, 0.12);
  color: #fff0dc;
  font: inherit;
  cursor: pointer;
  transition: background 180ms ease, transform 180ms ease, border-color 180ms ease;
}

button:hover {
  background: rgba(255, 204, 142, 0.22);
  border-color: rgba(255, 230, 202, 0.76);
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: default;
  opacity: 0.55;
}

#vrBtn {
  background: rgba(120, 199, 255, 0.14);
  border-color: rgba(145, 216, 255, 0.55);
}

#overlayMsg {
  min-height: 1.5em;
  margin: 14px 0 0;
  color: rgba(255, 219, 191, 0.82);
  font-size: 13px;
}

#hud {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 8;
  display: flex;
  gap: 10px;
  align-items: center;
  color: rgba(255, 242, 228, 0.94);
  font-size: 13px;
  pointer-events: none;
}

#hud span {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 7px 13px;
  border: 1px solid rgba(255, 222, 190, 0.16);
  border-radius: 16px;
  background: rgba(28, 12, 22, 0.42);
  backdrop-filter: blur(6px);
}

#hint {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 7;
  max-width: calc(100vw - 28px);
  transform: translateX(-50%);
  padding: 8px 18px;
  border-radius: 18px;
  background: rgba(27, 11, 21, 0.34);
  color: rgba(255, 242, 228, 0.88);
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
  pointer-events: none;
  transition: opacity 900ms ease;
}

#hint.hidden {
  opacity: 0;
}

#energy {
  position: fixed;
  left: 50%;
  bottom: 64px;
  z-index: 7;
  width: 138px;
  height: 4px;
  transform: translateX(-50%);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.15);
}

#energyFill {
  width: 55%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffb36b, #fff1c8);
}

#touchControls {
  position: fixed;
  inset: 0;
  z-index: 9;
  pointer-events: none;
}

#touchSing,
#touchJump {
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
}

#stick {
  position: absolute;
  left: 0;
  top: 0;
  width: 120px;
  height: 120px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.stick-base {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 230, 210, 0.28);
  background: rgba(36, 16, 27, 0.32);
  box-shadow: 0 0 32px rgba(255, 176, 100, 0.14);
}

.stick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 218, 180, 0.42);
  box-shadow: 0 0 24px rgba(255, 176, 100, 0.25);
}

#touchSing,
#touchJump {
  position: absolute;
  right: 24px;
  width: 58px;
  min-width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(255, 214, 156, 0.16);
}

#touchSing.active,
#touchJump.active {
  background: rgba(255, 224, 180, 0.34);
  border-color: rgba(255, 236, 212, 0.78);
}

#touchJump {
  bottom: 32px;
}

#touchSing {
  right: 94px;
  bottom: 46px;
}

@media (pointer: coarse) {
  #hint {
    bottom: 164px;
    font-size: 12px;
  }

  #energy {
    bottom: 226px;
  }
}
