* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #9ad8ff;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#scene {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

#scene:active {
  cursor: grabbing;
}

#hud {
  position: fixed;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  z-index: 5;
}

#hud-restart {
  pointer-events: auto;
  margin-left: auto;
  padding: 8px 14px;
  border: none;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
  color: #16324f;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(20, 45, 80, 0.18);
}

#hud-restart:hover {
  background: #ffffff;
}

.overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(16, 38, 62, 0.45);
  z-index: 10;
}

.overlay.show {
  display: flex;
}

.panel {
  width: 100%;
  max-width: 420px;
  padding: 24px 20px;
  border-radius: 18px;
  background: #ffffff;
  text-align: center;
  box-shadow: 0 18px 40px rgba(10, 30, 55, 0.3);
}

.panel h1 {
  margin: 0 0 10px;
  font-size: 22px;
  color: #16324f;
}

.panel p {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.6;
  color: #4a6480;
}

.panel .final-score {
  margin: 2px 0 6px;
  font-size: clamp(40px, 11vw, 60px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: #16324f;
}

.panel .final-score .score-unit {
  margin-left: 4px;
  font-size: 0.4em;
  font-weight: 800;
  color: #4a6480;
}

.panel .ranking-status {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #2f8bf0;
}

.panel .ranking-status:not(:empty) {
  margin: 14px 0 0;
}

.panel .primary {
  width: 100%;
  padding: 13px 16px;
  border: none;
  border-radius: 12px;
  background: #2f8bf0;
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}

.panel .primary:hover {
  background: #1d78dd;
}

#touch-ui {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 190px;
  display: none;
  pointer-events: none;
  z-index: 6;
}

body.touch #touch-ui {
  display: block;
}

.stick {
  position: absolute;
  left: 18px;
  bottom: 24px;
  width: 118px;
  height: 118px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.75);
  pointer-events: auto;
  touch-action: none;
}

.knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 50px;
  height: 50px;
  margin: -25px 0 0 -25px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 2px 6px rgba(10, 30, 55, 0.25);
}

.jump-btn {
  position: absolute;
  right: 22px;
  bottom: 32px;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.85);
  color: #16324f;
  font-size: 16px;
  font-weight: 800;
  font-family: inherit;
  pointer-events: auto;
  touch-action: none;
}

.jump-btn:active {
  background: rgba(255, 255, 255, 1);
}
