:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #03050a;
  color: #eef4ff;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: #03050a; }
button, input, select { font: inherit; }
button { color: inherit; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.topbar {
  position: fixed; top: max(12px, env(safe-area-inset-top)); left: 12px; right: 12px;
  display: flex; align-items: center; gap: 10px; pointer-events: none; z-index: 5;
}
.brand { min-width: 0; display: grid; line-height: 1.05; text-shadow: 0 2px 14px #000; }
.brand strong { font-size: 14px; letter-spacing: .08em; text-transform: uppercase; }
.brand span { color: #9aa9be; font-size: 11px; margin-top: 4px; }
.icon-button {
  pointer-events: auto; width: 42px; height: 42px; border: 1px solid rgba(255,255,255,.16);
  border-radius: 12px; background: rgba(5,8,16,.72); backdrop-filter: blur(14px); cursor: pointer;
}
#fullscreen { margin-left: auto; }

.panel {
  position: fixed; z-index: 4; left: 12px; bottom: max(12px, env(safe-area-inset-bottom));
  width: min(370px, calc(100vw - 24px)); max-height: calc(100dvh - 86px);
  overflow: auto; overscroll-behavior: contain; padding: 15px; border-radius: 18px;
  border: 1px solid rgba(255,255,255,.13); background: rgba(4,7,14,.82);
  box-shadow: 0 24px 80px rgba(0,0,0,.48); backdrop-filter: blur(20px);
  transition: transform .24s ease, opacity .24s ease;
}
.panel.closed { transform: translateX(calc(-100% - 24px)); opacity: 0; pointer-events: none; }
.panel section + section { border-top: 1px solid rgba(255,255,255,.1); margin-top: 14px; padding-top: 14px; }
.hero-copy p { margin: 0; color: #aebbd0; font-size: 12px; line-height: 1.45; }
.hero-copy .eyebrow { color: #d7e8ff; letter-spacing: .11em; font-size: 10px; margin-bottom: 7px; }
h2 { margin: 0 0 10px; font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: #c6d6eb; }
label { display: grid; grid-template-columns: 1fr auto; gap: 5px 10px; margin: 10px 0; font-size: 12px; color: #bac6d7; }
label input[type="range"] { grid-column: 1 / -1; }
output { color: #eef4ff; font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; accent-color: #8fbfff; }
input[type="text"], input[type="number"], select {
  min-width: 0; width: 100%; border: 1px solid rgba(255,255,255,.14); border-radius: 9px;
  background: rgba(255,255,255,.06); color: #eef4ff; padding: 9px 10px; outline: none;
}
input:focus, select:focus { border-color: #8fbfff; box-shadow: 0 0 0 3px rgba(95,160,255,.16); }
button { border: 1px solid rgba(255,255,255,.16); border-radius: 9px; background: rgba(255,255,255,.08); padding: 9px 12px; cursor: pointer; }
button:hover { background: rgba(255,255,255,.14); }
button:disabled { opacity: .5; cursor: wait; }
button.primary { width: 100%; border-color: rgba(132,190,255,.5); background: linear-gradient(135deg, rgba(67,121,220,.72), rgba(94,70,210,.65)); }
.check { display: flex; align-items: center; gap: 8px; }
.stack { display: grid; }
.voices { display: grid; gap: 7px; }
.voice { display: grid; grid-template-columns: auto 1fr 90px; gap: 8px; align-items: center; }
.voice label { display: block; margin: 0; color: #dbe8fa; }
.voice small { display: block; color: #8190a4; font-variant-numeric: tabular-nums; }
.voice input[type="number"] { text-align: right; font-variant-numeric: tabular-nums; }
.harmony-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.status { min-height: 1.2em; margin: 8px 0 0; font-size: 11px; color: #94a7c1; }
.meter-row { display: flex; justify-content: space-between; margin-top: 9px; font-size: 11px; color: #8fa0b8; }
footer { color: #6f7d91; font-size: 10px; margin-top: 14px; }
dialog { color: #eef4ff; border: 1px solid rgba(255,255,255,.2); border-radius: 14px; background: #0b101a; max-width: min(420px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(6px); }

@media (max-width: 560px) {
  .panel { max-height: min(72dvh, 720px); }
  .brand span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .panel { transition: none; }
}
