:root {
  color-scheme: dark;
  --ink: #f3f2e8;
  --dark: #111410;
  --panel: #1b201b;
  --muted: #b6bead;
  --lime: #d7ff3f;
  --cyan: #75ead7;
  --line: #ffffff24;
  --stage-bg: #1a1f1a;
  --font: "DM Sans", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--dark);
  color: var(--ink);
  font: 400 16px / 1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

body {
  display: grid;
  grid-template-columns: minmax(280px, 340px) 1fr;
  min-height: 100%;
}

a {
  color: var(--cyan);
  text-underline-offset: 3px;
}

button,
input,
label {
  font: inherit;
}

#nogpu {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-content: center;
  padding: 32px;
  background: #111410;
  color: #d5dde4;
  font: 13px / 1.7 ui-monospace, Menlo, Consolas, monospace;
}

#nogpu[hidden] {
  display: none !important;
}

#nogpu b {
  color: var(--lime);
  display: block;
  margin-bottom: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 11px;
}

.panel {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 28px 24px 40px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.04em;
}

.brand img {
  width: 32px;
  height: 32px;
}

.brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lime);
  display: inline-block;
  margin-left: 4px;
  vertical-align: 2px;
}

.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--lime);
  margin: 0 0 8px;
}

.panel h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: -0.04em;
}

.panel .lede {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.block {
  display: grid;
  gap: 12px;
}

.block h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.field {
  display: grid;
  gap: 8px;
}

.field input[type="url"],
.field input[type="text"] {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #121612;
  color: var(--ink);
}

.field input:focus {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  color: var(--dark);
  background: var(--lime);
}

.btn:hover {
  filter: brightness(1.05);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.btn-ghost:hover {
  border-color: var(--lime);
  color: var(--lime);
}

.btn-file {
  position: relative;
  overflow: hidden;
}

.btn-file input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.toggles {
  display: grid;
  gap: 10px;
}

.toggles label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  cursor: pointer;
}

.toggles input {
  width: 16px;
  height: 16px;
  accent-color: var(--lime);
}

.hint {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.links {
  margin-top: auto;
  display: grid;
  gap: 8px;
  font-size: 14px;
}

.interact {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  cursor: pointer;
}

.interact input {
  width: 16px;
  height: 16px;
  accent-color: var(--lime);
}

.hint code {
  font-size: 12px;
  color: var(--cyan);
}

.stage-wrap {
  position: relative;
  min-height: 100%;
  background: var(--stage-bg);
  overflow: hidden;
}

#stage {
  display: block;
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#css3d {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

#css3d > div {
  position: absolute !important;
  inset: 0;
}

#css3d .screen-frame {
  pointer-events: auto;
}

.screen-frame {
  overflow: hidden;
  background: #0b0d0b;
  border: 0;
}

.screen-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #0b0d0b;
}

#stage.is-drop {
  outline: 3px dashed var(--lime);
  outline-offset: -12px;
}

.hud {
  position: absolute;
  left: 20px;
  bottom: 20px;
  right: 20px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
  font-size: 13px;
  color: var(--muted);
}

.hud strong {
  color: var(--lime);
  font-weight: 600;
}

@media (max-width: 900px) {
  body {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(55vh, 1fr);
  }

  .panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: none;
  }

  .stage-wrap {
    min-height: 55vh;
  }
}

.field select {
  width: 100%;
  padding: 10px 12px;
  background: #0f120f;
  color: inherit;
  border: 1px solid #2a312a;
  border-radius: 8px;
  font: inherit;
}
.field.slider input[type="range"] {
  width: 100%;
  accent-color: var(--lime, #d7ff3f);
}

/* tooltips on the ? marks */
.tip {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-left: 6px;
  border: 1px solid #3a433a;
  border-radius: 50%;
  font: 600 11px/1 ui-monospace, monospace;
  color: #9aa690;
  cursor: help;
  position: relative;
  vertical-align: middle;
}

/* one row per device: its toggle, and its own image */
.devices { display: grid; gap: 6px; }
.device-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.device-row > label { display: flex; align-items: center; gap: 8px; }
.device-img { display: inline-flex; gap: 4px; }
.mini {
  display: inline-grid;
  place-items: center;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid #2a312a;
  border-radius: 6px;
  background: #121612;
  color: #b6bead;
  font: 500 12px/1 "DM Sans", system-ui, sans-serif;
  cursor: pointer;
}
.mini.clear { width: 26px; padding: 0; color: #f0a27a; }
.mini input { display: none; }
.mini[hidden] { display: none; }

#tooltip {
  position: fixed;
  z-index: 50;
  width: 280px;
  padding: 10px 12px;
  background: #0f130f;
  color: #d9dccd;
  border: 1px solid #2a312a;
  border-radius: 8px;
  font: 400 12px/1.45 "DM Sans", system-ui, sans-serif;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}
#tooltip[hidden] { display: none; }
