:root {
  --bg: #212121;
  --fg: #f2f2f2;
  --muted: #8a8a8a;
  --line: rgba(255, 255, 255, 0.14);
  --chip: rgba(255, 255, 255, 0.06);
}

body[data-theme='light'] {
  --bg: #ececec;
  --fg: #111;
  --muted: #6b6b6b;
  --line: rgba(0, 0, 0, 0.16);
  --chip: rgba(0, 0, 0, 0.05);
}

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

body {
  background: var(--bg);
  font: 11px/1.4 ui-monospace, Menlo, Consolas, monospace;
  color: var(--muted);
  transition: background 0.3s;
}

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

#scene.grabbing {
  cursor: grabbing;
}

.hud {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hud-left {
  right: auto;
  left: 16px;
  align-items: flex-start;
}

.buttons {
  display: flex;
  gap: 4px;
}

.hud button {
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  color: var(--muted);
  background: var(--chip);
  border: 1px solid var(--line);
  padding: 6px 10px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.hud button:hover {
  color: var(--fg);
}

.hud button.active {
  color: var(--bg);
  background: var(--fg);
  border-color: var(--fg);
}

.hud textarea {
  width: 200px;
  font: inherit;
  letter-spacing: inherit;
  line-height: 1.5;
  color: var(--fg);
  background: var(--chip);
  border: 1px solid var(--line);
  padding: 6px 8px;
  outline: none;
  resize: vertical;
}

.hud textarea:focus {
  border-color: var(--fg);
}

@media (max-width: 640px) {
  .hud {
    left: 16px;
    right: 16px;
    align-items: stretch;
  }
  .hud-left {
    top: 16px;
    bottom: auto;
  }
  .hud textarea {
    width: auto;
  }
  .buttons {
    justify-content: flex-end;
  }
}
