:root {
  --bg: #050608;
  --fg: #e8eef2;
  --muted: rgba(232, 238, 242, 0.65);
  --ui: rgba(10, 12, 16, 0.65);
  --ui2: rgba(10, 12, 16, 0.85);
  --accent: #86ff9b;
  --danger: #ff5c5c;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial,
    "Apple Color Emoji", "Segoe UI Emoji";
  overscroll-behavior: none;
  touch-action: none;
}

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

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

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

#topbar {
  position: absolute;
  left: env(safe-area-inset-left);
  right: env(safe-area-inset-right);
  top: env(safe-area-inset-top);
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

#debug {
  position: absolute;
  left: calc(env(safe-area-inset-left) + 12px);
  top: calc(env(safe-area-inset-top) + 54px);
  font-size: 12px;
  color: rgba(232, 238, 242, 0.72);
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 6px 8px;
  border-radius: 10px;
  backdrop-filter: blur(8px);
  max-width: min(460px, calc(100vw - 24px));
  display: none;
  white-space: pre;
}

#title {
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--ui);
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
}

#hint {
  font-size: 12px;
  color: var(--muted);
  background: var(--ui);
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
}

#stats {
  position: absolute;
  left: env(safe-area-inset-left);
  bottom: env(safe-area-inset-bottom);
  padding: 10px 12px;
  display: flex;
  gap: 10px;
  pointer-events: none;
  flex-wrap: wrap;
}

.stat {
  background: var(--ui);
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  font-size: 13px;
  min-width: 90px;
}

.stat .k {
  color: var(--muted);
  margin-right: 6px;
}

#center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

#crosshair {
  width: 14px;
  height: 14px;
  position: relative;
  opacity: 0.95;
}

#crosshair::before,
#crosshair::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 2px;
  background: rgba(255, 255, 255, 0.75);
  transform: translate(-50%, -50%);
}

#crosshair::after {
  width: 2px;
  height: 14px;
}

#toast {
  position: absolute;
  top: 22%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.10);
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  color: var(--fg);
  backdrop-filter: blur(10px);
  display: none;
  max-width: min(520px, calc(100vw - 28px));
}

#bossbar {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 18px);
  width: min(520px, calc(100vw - 28px));
  background: rgba(0, 0, 0, 0.40);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 14px;
  padding: 10px 12px;
  backdrop-filter: blur(10px);
  pointer-events: none;
  display: none;
}

#bossname {
  font-weight: 800;
  letter-spacing: 0.03em;
  margin-bottom: 8px;
}

#bossouter {
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

#bossinner {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, rgba(255, 92, 92, 0.9), rgba(255, 184, 77, 0.9));
}

button {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: var(--fg);
  border-radius: 14px;
  padding: 12px 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

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

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

@media (hover: none) and (pointer: coarse) {
  #mobile {
    display: block;
  }
}

.stick {
  position: absolute;
  width: 140px;
  height: 140px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(10, 12, 16, 0.35);
  backdrop-filter: blur(6px);
  pointer-events: auto;
  touch-action: none;
}

.stick-inner {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 62px;
  height: 62px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

#stick-move {
  left: calc(env(safe-area-inset-left) + 14px);
  bottom: calc(env(safe-area-inset-bottom) + 84px);
}

#stick-look {
  right: calc(env(safe-area-inset-right) + 14px);
  bottom: calc(env(safe-area-inset-bottom) + 84px);
}

#m-buttons {
  position: absolute;
  right: calc(env(safe-area-inset-right) + 14px);
  bottom: calc(env(safe-area-inset-bottom) + 14px);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  pointer-events: auto;
  width: min(360px, calc(100vw - 28px));
}

#m-buttons button {
  padding: 12px 10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
}
