:root {
  color-scheme: dark;
  --bg: #050707;
  --panel: rgba(6, 9, 10, 0.58);
  --panel-strong: rgba(10, 14, 15, 0.72);
  --line: rgba(255, 255, 255, 0.16);
  --text: #f7f2e6;
  --muted: rgba(247, 242, 230, 0.68);
  --dim: rgba(247, 242, 230, 0.44);
  --accent: #72f2cf;
  --accent-2: #ffcc66;
  --accent-3: #ff5d87;
  --shadow: rgba(0, 0, 0, 0.34);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.stage {
  position: relative;
  min-height: 100vh;
  isolation: isolate;
  background:
    radial-gradient(circle at 20% 20%, rgba(114, 242, 207, 0.14), transparent 30%),
    radial-gradient(circle at 88% 24%, rgba(255, 93, 135, 0.12), transparent 28%),
    #050707;
}

.stage::before {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(90deg, rgba(5, 7, 7, 0.62), transparent 28%, transparent 74%, rgba(5, 7, 7, 0.48)),
    linear-gradient(180deg, rgba(5, 7, 7, 0.38), transparent 42%, rgba(5, 7, 7, 0.66));
}

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

.topbar,
.panel,
.readout,
.caption {
  position: fixed;
  z-index: 3;
}

.topbar {
  top: 20px;
  left: 22px;
  right: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  pointer-events: none;
}

.brand,
.top-actions,
.signal-chip,
.panel,
.readout > div,
.caption {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 20px 60px var(--shadow);
  backdrop-filter: blur(20px) saturate(1.28);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
  padding: 10px 12px;
  border-radius: 8px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border-radius: 50%;
  background:
    radial-gradient(circle at 40% 38%, #ffffff 0 4px, transparent 5px),
    conic-gradient(from 40deg, var(--accent), var(--accent-2), var(--accent-3), var(--accent));
  box-shadow: 0 0 28px rgba(114, 242, 207, 0.46);
}

.brand h1,
.panel h2,
.eyebrow {
  margin: 0;
}

.brand h1 {
  font-size: 18px;
  line-height: 1.05;
  letter-spacing: 0;
}

.eyebrow {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  border-radius: 8px;
  background: rgba(6, 9, 10, 0.42);
  box-shadow: none;
}

.signal-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 18px var(--accent);
  animation: pulse 1.7s ease-in-out infinite;
}

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

.icon-button svg,
.mode-button svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.9;
}

.icon-button:hover,
.icon-button.active,
.mode-button:hover,
.mode-button.active {
  border-color: color-mix(in srgb, var(--accent) 64%, white 8%);
  background: color-mix(in srgb, var(--accent) 16%, rgba(8, 11, 12, 0.76));
}

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

.panel {
  left: 22px;
  bottom: 24px;
  width: min(360px, calc(100vw - 44px));
  padding: 16px;
  border-radius: 8px;
  pointer-events: auto;
}

.panel-head {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.panel h2 {
  max-width: 310px;
  font-size: 24px;
  line-height: 1.08;
  letter-spacing: 0;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 16px;
}

.mode-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease, transform 180ms ease;
}

.mode-button.active {
  color: var(--text);
}

.mode-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.control-stack {
  display: grid;
  gap: 13px;
}

.slider-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.slider-row strong {
  color: var(--text);
  font-size: 12px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  width: 100%;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.spectrum {
  display: grid;
  grid-template-columns: 1.2fr 0.7fr 1.6fr 0.9fr 1.1fr;
  gap: 5px;
  height: 8px;
  margin-top: 17px;
}

.spectrum span {
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 20px color-mix(in srgb, var(--accent) 62%, transparent);
}

.spectrum span:nth-child(2) {
  background: var(--accent-2);
}

.spectrum span:nth-child(3) {
  background: var(--accent-3);
}

.spectrum span:nth-child(4) {
  background: #f4f0dd;
}

.readout {
  right: 22px;
  bottom: 24px;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.readout > div {
  min-width: 116px;
  padding: 10px 12px;
  border-radius: 8px;
}

.readout span {
  display: block;
  color: var(--dim);
  font-size: 10px;
  letter-spacing: 0.14em;
}

.readout strong {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.caption {
  left: 50%;
  bottom: 24px;
  display: flex;
  gap: 10px;
  align-items: center;
  max-width: min(420px, calc(100vw - 44px));
  min-height: 38px;
  padding: 0 12px;
  transform: translateX(-50%);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
}

.caption span:first-child {
  color: var(--text);
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(0.86);
    opacity: 0.64;
  }

  50% {
    transform: scale(1.18);
    opacity: 1;
  }
}

@media (max-width: 820px) {
  body {
    overflow: hidden;
  }

  .topbar {
    top: 12px;
    left: 12px;
    right: 12px;
  }

  .brand {
    min-width: 0;
    padding: 9px 10px;
  }

  .brand h1 {
    font-size: 16px;
  }

  .brand-mark {
    width: 28px;
    height: 28px;
  }

  .signal-chip {
    display: none;
  }

  .panel {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    padding: 12px;
  }

  .panel h2 {
    max-width: none;
    font-size: 19px;
  }

  .panel-head {
    margin-bottom: 10px;
  }

  .segmented {
    margin-bottom: 12px;
  }

  .mode-button {
    min-height: 38px;
    font-size: 12px;
  }

  .slider-row {
    grid-template-columns: 45px minmax(0, 1fr) 38px;
    gap: 8px;
    font-size: 12px;
  }

  .readout {
    top: 78px;
    right: 12px;
    bottom: auto;
    gap: 6px;
  }

  .readout > div {
    min-width: 84px;
    padding: 8px 9px;
  }

  .readout strong {
    font-size: 18px;
  }

  .caption {
    display: none;
  }
}

@media (max-width: 430px) {
  .mode-button {
    gap: 0;
  }

  .mode-button span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .panel h2 {
    font-size: 17px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pulse-dot {
    animation: none;
  }
}
