@import url("https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&display=swap");

:root {
  --hud-bg: rgba(12, 14, 18, 0.78);
  --hud-border: rgba(255, 255, 255, 0.16);
  --hud-text: #e8edf5;
  --accent: #5ad3c7;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  font-family: "Space Mono", "Consolas", monospace;
  background: radial-gradient(circle at 20% 20%, #2a3246, #0d0f14 70%);
  overflow: hidden;
}

#renderCanvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

#hud {
  position: absolute;
  top: 16px;
  left: 16px;
  padding: 12px 14px;
  min-width: 220px;
  border-radius: 10px;
  background: var(--hud-bg);
  border: 1px solid var(--hud-border);
  color: var(--hud-text);
  letter-spacing: 0.02em;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}

#hud .title {
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}

#hud .line {
  font-size: 12px;
  margin-bottom: 4px;
}

#hud .controls {
  font-size: 11px;
  margin-top: 6px;
  color: rgba(232, 237, 245, 0.72);
}

#tasks {
  position: absolute;
  top: 16px;
  right: 16px;
  padding: 12px 14px;
  min-width: 220px;
  border-radius: 10px;
  background: var(--hud-bg);
  border: 1px solid var(--hud-border);
  color: var(--hud-text);
  letter-spacing: 0.02em;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
  text-align: right;
}

#tasks .title {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}

#task-progress {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-bottom: 6px;
}

.task-slot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(232, 237, 245, 0.5);
  background: rgba(232, 237, 245, 0.1);
}

.task-slot.filled {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(90, 211, 199, 0.6);
}

#task-count {
  font-size: 11px;
  color: rgba(232, 237, 245, 0.7);
  margin-bottom: 6px;
}

#tasks-list {
  font-size: 11px;
  line-height: 1.35;
  display: grid;
  gap: 6px;
}

.task-line {
  display: block;
  color: rgba(232, 237, 245, 0.92);
}

.task-line .assignee {
  color: rgba(232, 237, 245, 0.6);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.08em;
  margin-bottom: 2px;
  display: block;
}

#npc-bubble,
#parent-bubble,
#world-bubble {
  position: absolute;
  padding: 6px 10px;
  border-radius: 14px;
  background: rgba(15, 24, 32, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #eef4ff;
  font-size: 12px;
  letter-spacing: 0.03em;
  pointer-events: none;
  transform: translate(-50%, -100%);
  opacity: 0;
  transition: opacity 0.18s ease;
  backdrop-filter: blur(2px);
}

#world-bubble {
  font-size: 11px;
  padding: 4px 8px;
}

#task-complete {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 12px 18px;
  border-radius: 16px;
  background: rgba(18, 26, 34, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #f5f9ff;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  backdrop-filter: blur(4px);
}

#npc-bubble::after,
#parent-bubble::after,
#world-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 10px;
  height: 10px;
  background: rgba(15, 24, 32, 0.55);
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  transform: translateX(-50%) rotate(45deg);
}

#mobile-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 45vh;
  pointer-events: none;
  display: none;
}

#joystick-area {
  position: absolute;
  left: 16px;
  bottom: 16px;
  width: 150px;
  height: 150px;
  pointer-events: auto;
  touch-action: none;
}

#joystick-base {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 120px;
  height: 120px;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  background: rgba(15, 24, 32, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.35);
}

#joystick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56px;
  height: 56px;
  margin-left: -28px;
  margin-top: -28px;
  border-radius: 999px;
  background: rgba(90, 211, 199, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
  transform: translate(0px, 0px);
}

#mobile-buttons {
  position: absolute;
  right: 16px;
  bottom: 16px;
  display: grid;
  gap: 10px;
  pointer-events: auto;
}

.mobile-button {
  min-width: 64px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(15, 24, 32, 0.6);
  color: #f1f6ff;
  font-family: "Space Mono", "Consolas", monospace;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.mobile-button:active {
  background: rgba(90, 211, 199, 0.6);
  color: #071419;
}

@media (max-width: 900px), (pointer: coarse) {
  #hud,
  #tasks {
    top: 10px;
    padding: 10px 12px;
    min-width: 160px;
    max-width: 44vw;
  }

  #hud .controls {
    display: none;
  }

  #hud .line {
    font-size: 11px;
  }

  #tasks-list {
    font-size: 10px;
  }

  #task-complete {
    font-size: 16px;
    padding: 10px 14px;
  }

  #mobile-controls {
    display: block;
  }
}
