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

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

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

.top-header {
  max-width: 1080px;
  margin: 0 auto;
  padding: 8px 14px 6px;
}

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

.top-header h1 {
  margin: 0;
  font-size: 1.22rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #f8fafc;
}

.cc0-pill {
  font-size: 0.73rem;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  background: #0c2942;
  color: var(--accent-sky-bright);
  border: 1px solid #0284c7;
}

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

.lede code, .note-card code, kbd {
  background: #1e293b;
  color: #e2e8f0;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid #475569;
  font-size: 0.76rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

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

button {
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 7px;
  padding: 5px 10px;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  color: #ffffff;
  background: var(--btn-slate);
  transition: filter 0.12s ease, border-color 0.12s ease;
}

button:hover {
  filter: brightness(1.12);
  border-color: var(--accent-sky);
}

button:focus-visible {
  outline: 2px solid var(--accent-sky-bright);
  outline-offset: 2px;
}

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

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

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

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

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

.canvas-panel, .controls-panel {
  min-width: 0;
}

.canvas-frame {
  position: relative;
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #334155;
  background: #06101e;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

#pondCanvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  touch-action: none;
  cursor: grab;
}

#pondCanvas:active {
  cursor: grabbing;
}

.hud-pill {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: rgba(8, 14, 28, 0.86);
  color: #f8fafc;
  border: 1px solid #38bdf8;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 0.72rem;
  font-weight: 600;
  pointer-events: none;
  max-width: calc(100% - 16px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.readout-card {
  background: var(--bg-panel);
  border: 1px solid #26354d;
  border-radius: 7px;
  padding: 5px 7px;
  min-width: 0;
}

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

.readout-card strong {
  display: block;
  font-size: 0.76rem;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.controls-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-group h2 {
  margin: 0 0 5px;
  font-size: 0.77rem;
  color: var(--accent-sky-bright);
  font-weight: 700;
}

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

.btn-grid-2 button, .action-sub-btn {
  font-size: 0.73rem;
  padding: 5px 7px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mode-btn.is-active,
.preset-btn.is-active,
.scale-btn.is-active,
.mood-btn.is-active {
  background: var(--btn-blue);
  border-color: var(--accent-sky-bright);
  color: #ffffff;
}

.slider-row {
  display: grid;
  grid-template-columns: auto 1fr 38px;
  align-items: center;
  gap: 7px;
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-bottom: 5px;
}

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

.slider-row output {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: #f8fafc;
  text-align: right;
}

.full-width-btn {
  width: 100%;
  margin-top: 5px;
  text-align: center;
}

.notes-section {
  max-width: 1080px;
  margin: 0 auto;
  padding: 2px 14px 12px;
}

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

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

.note-card h3 {
  margin: 0 0 4px;
  font-size: 0.85rem;
  color: var(--accent-sky-bright);
}

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

.site-footer {
  max-width: 1080px;
  margin: 0 auto;
  padding: 6px 14px 16px;
  font-size: 0.75rem;
  color: #94a3b8;
  border-top: 1px solid #1e293b;
}

.site-footer a {
  color: var(--accent-sky-bright);
  text-decoration: underline;
}

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