:root {
  --bg: #15151b;
  --panel: #1f1f27;
  --field: #2a2a34;
  --line: #363642;
  --text: #e8e8ef;
  --muted: #9a9aa8;
  --accent: #8b7cff;
}

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

body {
  display: flex;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 14px system-ui, sans-serif;
}

/****** editor ****/
#panel {
  flex: none;
  width: 320px;
  overflow-y: auto;
  padding: 12px 16px;
  box-sizing: border-box;
  background: var(--panel);
  border-right: 1px solid var(--line);
}

#controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

#status {
  color: var(--muted);
  font-size: 12px;
}

button {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--field);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

#run {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

fieldset {
  margin: 10px 0 0;
  padding: 8px 10px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

legend {
  padding: 0 4px;
  color: var(--accent);
  font-weight: 600;
}

label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
}

label.stack {
  flex-direction: column;
  align-items: stretch;
}

input, select, textarea {
  box-sizing: border-box;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--field);
  color: var(--text);
  font: inherit;
}

input[type="number"], select {
  width: 130px;
}
input[type="text"] {
  width: 170px;
}

textarea {
  resize: vertical;
}

#view {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

#frame {
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  background: repeating-conic-gradient(#24242c 0 25%, #1c1c22 0 50%) 0 0 / 32px 32px;
}

#stage {
  position: absolute;
  left: 0;
  top: 0;
  width: 1920px;
  height: 1080px;
  transform-origin: 0 0;
}

.zone-box {
  position: absolute;
  border: 2px dashed rgba(139, 124, 255, 0.6);
  border-radius: 8px;
  pointer-events: none;
}

/****** overlay in obs ****/
body.obs {
  background: transparent;
}

body.obs #panel {
  display: none;
}

body.obs #view {
  display: block;
  padding: 0;
}

body.obs #frame {
  width: 1920px;
  height: 1080px;
  border-radius: 0;
  background: none;
}

.sprite {
  position: absolute;
}

.bob, .art {
  display: block;
  width: 100%;
  height: 100%;
}

.art {
  object-fit: contain;
}

.art.mirror {
  transform: scaleX(-1);
}

@media (max-width: 700px) {
  body:not(.obs) {
    flex-direction: column;
    overflow: auto;
    height: auto;
  }

  #panel {
    width: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  #view {
    height: 60vw;
  }
}
