:root {
  color-scheme: dark;
  --bg: #050507;
  --fg: #f8f7f1;
  --muted: rgba(248, 247, 241, 0.62);
  --panel: rgba(5, 5, 7, 0.48);
  --line: rgba(248, 247, 241, 0.18);
  --accent: #78ffe3;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

.stage {
  position: fixed;
  inset: 0;
  min-width: 320px;
  min-height: 320px;
  background:
    radial-gradient(circle at 50% 50%, rgba(120, 255, 227, 0.06), transparent 36%),
    #050507;
  touch-action: none;
}

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

.hud {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  left: max(16px, env(safe-area-inset-left));
  right: max(16px, env(safe-area-inset-right));
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
}

.brand {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  backdrop-filter: blur(16px);
}

.brand__name {
  color: var(--fg);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.brand__status {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.toolbar {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--fg);
  cursor: pointer;
  line-height: 1;
  backdrop-filter: blur(16px);
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: rgba(120, 255, 227, 0.66);
  background: rgba(120, 255, 227, 0.12);
  outline: none;
}

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

.icon-button span {
  display: block;
  min-width: 2ch;
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}

@media (max-width: 520px) {
  .hud {
    align-items: flex-start;
    gap: 10px;
  }

  .brand {
    max-width: 112px;
  }

  .toolbar {
    flex-wrap: wrap;
    justify-content: flex-end;
    width: min(144px, calc(100vw - 160px));
  }

  .icon-button {
    width: 40px;
    height: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .stage {
    background: #050507;
  }

  .icon-button {
    transition: none;
  }
}
