:root {
  --bg-page: #080e1c;
  --bg-card: #0f172a;
  --bg-panel: #111827;
  --bg-elevated: #1e293b;
  --border-subtle: #334155;
  --border-accent: #38bdf8;
  --text-main: #f8fafc;
  --text-muted: #cbd5e1;
  --text-soft: #94a3b8;
  --accent-sky: #7dd3fc;
  --btn-blue: #0369a1;
  --btn-blue-hover: #0284c7;
  --btn-green: #15803d;
  --btn-amber: #c2410c;
  --btn-slate: #1e293b;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-page);
  color: var(--text-main);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "DejaVu Sans", sans-serif;
  line-height: 1.4;
}

.page-shell {
  max-width: 1008px;
  margin: 0 auto;
  padding: 8px 10px 18px;
}

.top-header {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 6px;
}

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

h1 {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 750;
  letter-spacing: -0.01em;
  color: #f8fafc;
}

.cc-pill {
  font-size: 0.72rem;
  font-weight: 650;
  padding: 2px 9px;
  border-radius: 999px;
  background: #0c243d;
  border: 1px solid #0284c7;
  color: #bae6fd;
  white-space: nowrap;
}

.lede {
  margin: 0;
  font-size: 0.80rem;
  color: var(--text-muted);
}

kbd, code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "DejaVu Sans Mono", monospace;
  font-size: 0.74rem;
  padding: 1px 4px;
  border-radius: 4px;
  background: #1e293b;
  border: 1px solid #475569;
  color: #f1f5f9;
}

.action-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

button {
  font-family: inherit;
  font-size: 0.73rem;
  font-weight: 650;
  padding: 4px 7px;
  border-radius: 6px;
  border: 1px solid #475569;
  background: var(--btn-slate);
  color: #ffffff;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

button:hover {
  background: #334155;
  border-color: #94a3b8;
}

button:focus-visible,
input[type="range"]:focus-visible {
  outline: 2px solid #7dd3fc;
  outline-offset: 2px;
}

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

.btn-primary:hover {
  background: var(--btn-blue-hover);
}

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

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

.studio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 296px;
  gap: 8px;
  align-items: start;
  isolation: isolate;
}

.stage-column {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.canvas-frame {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 5px;
  overflow: hidden;
}

#studioCanvas {
  display: block;
  width: 100%;
  height: 392px;
  border-radius: 7px;
  background: #0b1222;
  touch-action: none;
  cursor: crosshair;
}

.hud-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.hud-pill {
  font-size: 0.72rem;
  font-weight: 650;
  padding: 2px 8px;
  border-radius: 999px;
  background: #0b1628;
  border: 1px solid #334155;
  color: #e2e8f0;
  white-space: nowrap;
}

.hud-pill.accent {
  border-color: #0284c7;
  color: #bae6fd;
}

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

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

.metric-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-soft);
}

.metric-value {
  margin-top: 1px;
  font-size: 0.77rem;
  font-weight: 700;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.panel-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.section-heading {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-sky);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

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

.btn-grid-3 button,
.btn-grid-2 button {
  padding: 4px 5px;
  font-size: 0.72rem;
  white-space: nowrap;
  overflow: hidden;
}

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

.slider-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 52px;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
}

.slider-row label {
  font-weight: 650;
  color: #e2e8f0;
}

.slider-row output {
  text-align: right;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "DejaVu Sans Mono", monospace;
  font-size: 0.71rem;
  color: #bae6fd;
}

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

.notes-card {
  margin-top: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.80rem;
  color: var(--text-muted);
}

.notes-card h2 {
  margin: 0 0 5px;
  font-size: 0.92rem;
  color: #f8fafc;
}

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

.notes-grid p {
  margin: 0;
}

.page-footer {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #1e293b;
  font-size: 0.76rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}

a {
  color: #7dd3fc;
  text-decoration: underline;
  text-underline-offset: 2px;
}

a:hover {
  color: #bae6fd;
}

@media (max-width: 760px) {
  .page-shell {
    padding: 5px 6px 14px;
  }

  h1 {
    font-size: 0.96rem;
  }

  .cc-pill {
    font-size: 0.64rem;
    padding: 1px 6px;
  }

  .lede {
    font-size: 0.70rem;
    line-height: 1.28;
  }

  .action-strip {
    gap: 3px;
  }

  .action-strip button {
    font-size: 0.65rem;
    padding: 3px 6px;
  }

  .studio-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }

  #studioCanvas {
    height: 236px;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .notes-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
