:root {
  color-scheme: dark;
  --panel: rgba(16, 22, 28, 0.72);
  --panel-strong: rgba(13, 18, 24, 0.9);
  --line: rgba(255, 255, 255, 0.16);
  --text: #f4f7fb;
  --muted: #aeb9c7;
  --accent: #67d9c0;
  --accent-strong: #2bbf9b;
  --button: rgba(255, 255, 255, 0.1);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #101720;
}

body {
  color: var(--text);
}

button,
input {
  font: inherit;
}

#scene {
  display: block;
  width: 100vw;
  height: 100vh;
  cursor: crosshair;
  touch-action: none;
}

.hud {
  position: fixed;
  z-index: 2;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(16px);
}

.hud-left {
  top: 16px;
  left: 16px;
  width: min(340px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 14px;
}

.hud-right {
  right: 16px;
  bottom: 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(76px, 1fr));
  gap: 1px;
  overflow: hidden;
  background: var(--line);
}

.hud-right div {
  min-width: 0;
  padding: 10px 12px;
  background: var(--panel-strong);
}

.hud-right span,
label span {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.1;
}

.hud-right strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 1rem;
  font-weight: 800;
}

.icon-button,
button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--button);
  color: var(--text);
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.icon-button {
  width: 40px;
  padding: 0;
}

button {
  padding: 0 13px;
  font-weight: 700;
}

button:hover {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.16);
}

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

.primary {
  border-color: rgba(103, 217, 192, 0.62);
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #04211b;
}

label {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px 12px;
  align-items: center;
  margin-top: 11px;
}

output {
  color: var(--text);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
  accent-color: var(--accent);
}

input[type="color"] {
  width: 44px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

.color-control {
  grid-template-columns: 1fr auto auto;
}

.inline-control {
  display: flex;
  align-items: center;
  gap: 9px;
}

.inline-control input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.button-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}

#crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 1;
  width: 12px;
  height: 12px;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

#crosshair::before,
#crosshair::after {
  position: absolute;
  background: rgba(255, 255, 255, 0.7);
  content: "";
}

#crosshair::before {
  top: 5px;
  left: 0;
  width: 12px;
  height: 2px;
}

#crosshair::after {
  top: 0;
  left: 5px;
  width: 2px;
  height: 12px;
}

@media (max-width: 720px) {
  .hud-left {
    top: 10px;
    left: 10px;
    width: calc(100vw - 20px);
    max-height: 48vh;
    overflow: auto;
    padding: 12px;
  }

  .hud-right {
    right: 10px;
    bottom: 10px;
    left: 10px;
    grid-template-columns: repeat(3, 1fr);
  }
}
