:root {
  --bg-deep: #080e1c;
  --bg-panel: #0f172a;
  --bg-card: #162033;
  --border-slate: #334155;
  --text-bright: #f8fafc;
  --text-body: #cbd5e1;
  --text-accent: #7dd3fc;
  --btn-blue: #0369a1;
  --btn-emerald: #15803d;
  --btn-amber: #c2410c;
  --btn-slate: #1e293b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 8px 14px 16px;
  background: var(--bg-deep);
  color: var(--text-bright);
  font-family: "DejaVu Sans", system-ui, -apple-system, sans-serif;
  line-height: 1.38;
}

a {
  color: var(--text-accent);
  text-decoration: underline;
}

.top-header {
  max-width: 1004px;
  margin: 0 auto 8px;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.top-header h1 {
  margin: 0;
  font-size: 1.24rem;
  letter-spacing: -0.01em;
}

.badge-pill {
  background: #0c253d;
  color: var(--text-accent);
  border: 1px solid #0284c7;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.74rem;
  font-weight: 700;
}

.lede {
  margin: 4px 0 6px;
  color: var(--text-body);
  font-size: 0.82rem;
}

kbd, code {
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid #475569;
  border-radius: 4px;
  padding: 0 4px;
  font-size: 0.76rem;
  font-family: "DejaVu Sans Mono", monospace;
}

.action-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

button {
  font-family: inherit;
  cursor: pointer;
  border-radius: 6px;
  border: 1px solid var(--border-slate);
  color: #ffffff;
  font-weight: 700;
  transition: filter 0.12s ease, border-color 0.12s ease;
}

button:hover {
  filter: brightness(1.1);
}

button:focus-visible {
  outline: 2px solid #7dd3fc;
  outline-offset: 2px;
}

.action-strip button {
  padding: 5px 10px;
  font-size: 0.78rem;
}

.btn-primary {
  background: var(--btn-blue);
  border-color: #38bdf8;
}

.btn-emerald {
  background: var(--btn-emerald);
  border-color: #4ade80;
}

.btn-amber {
  background: var(--btn-amber);
  border-color: #fb923c;
}

.btn-slate {
  background: var(--btn-slate);
  border-color: #475569;
}

.studio-grid {
  max-width: 1004px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 312px;
  gap: 10px;
  align-items: start;
  isolation: isolate;
}

.stage-column {
  min-width: 0;
}

.canvas-frame {
  background: #060b16;
  border: 1px solid var(--border-slate);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

#studioCanvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  cursor: crosshair;
}

.metrics-row {
  margin-top: 6px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.metric-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-slate);
  border-radius: 8px;
  padding: 5px 8px;
  min-width: 0;
}

.metric-label {
  display: block;
  font-size: 0.64rem;
  color: #94a3b8;
  letter-spacing: 0.04em;
}

.metric-value {
  display: block;
  font-size: 0.75rem;
  color: var(--text-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.control-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-slate);
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.panel-group h2 {
  margin: 0 0 4px;
  font-size: 0.76rem;
  color: var(--text-accent);
  font-weight: 700;
}

.btn-row-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.btn-row-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.btn-chip {
  background: var(--bg-card);
  border: 1px solid #334155;
  color: #f1f5f9;
  padding: 5px 6px;
  font-size: 0.73rem;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-chip.active {
  background: var(--btn-blue);
  border-color: #7dd3fc;
  color: #ffffff;
}

.slider-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 38px;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  color: var(--text-body);
  margin-top: 3px;
}

.slider-row input[type="range"] {
  width: 100%;
  accent-color: #38bdf8;
}

.slider-row strong {
  text-align: right;
  color: var(--text-bright);
  font-size: 0.74rem;
}

.notes-grid {
  max-width: 1004px;
  margin: 10px auto 8px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.note-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-slate);
  border-radius: 10px;
  padding: 9px 12px;
}

.note-card h2 {
  margin: 0 0 4px;
  font-size: 0.86rem;
  color: var(--text-accent);
}

.note-card p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-body);
}

.site-footer {
  max-width: 1004px;
  margin: 6px auto 0;
  padding-top: 6px;
  border-top: 1px solid #1e293b;
  font-size: 0.74rem;
  color: #94a3b8;
  text-align: center;
}

@media (max-width: 760px) {
  body {
    padding: 6px 8px 14px;
  }
  .top-header {
    margin-bottom: 5px;
  }
  .top-header h1 {
    font-size: 0.98rem;
  }
  .badge-pill {
    font-size: 0.64rem;
    padding: 1px 7px;
  }
  .lede {
    font-size: 0.70rem;
    line-height: 1.26;
    margin: 3px 0 5px;
  }
  .action-strip {
    gap: 4px;
  }
  .action-strip button {
    font-size: 0.65rem;
    padding: 3px 6px;
  }
  .studio-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }
  .metrics-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
  }
  .notes-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
