/* Eno Aleatoric Soundscape — GM3 Tonal Stylesheet (BillSkill Compliant) */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scrollbar-gutter: stable;
}

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--md-sys-color-surface-container-low);
  color: var(--md-sys-color-on-surface);
  font-family: var(--md-ref-typeface-plain);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font-family: inherit;
}

button {
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

h1, h2, h3, h4, .title, .section-title, .btn {
  font-family: var(--md-ref-typeface-brand);
  color: var(--md-sys-color-on-surface);
  margin: 0;
  font-weight: 600;
}

@font-face {
  font-family: 'Material Symbols Outlined';
  font-style: normal;
  font-weight: 100 700;
  font-display: block;
  src: url('../fonts/GoogleSymbols.ttf') format('truetype'), local('Material Symbols Outlined'), local('Google Symbols');
}

@font-face {
  font-family: 'Google Symbols';
  font-style: normal;
  font-weight: 100 700;
  font-display: block;
  src: url('../fonts/GoogleSymbols.ttf') format('truetype'), local('Google Symbols');
}

.material-symbols-outlined {
  font-family: 'Material Symbols Outlined', 'Google Symbols' !important;
  font-weight: normal;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  font-feature-settings: 'liga';
  -webkit-font-Feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

/* Z-Index Ladder: Sticky cell: 5 | Sticky header: 10 | Corner: 25 | Top bar: 40 | Modal backdrop: 1200 | Modal card: 1300 */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background-color: var(--md-sys-color-surface-container-low);
}

/* Top App Bar — matches canvas background, no border, no shadow */
.top-app-bar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 20px;
  background-color: var(--md-sys-color-surface-container-low);
  flex-wrap: wrap; max-width: 100%;
}
.brand-cluster { display: flex; align-items: center; gap: 8px; flex: 1 1 0; min-width: 0; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background-color: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.brand-title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-bar-center { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; min-width: 0; }
.top-bar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: nowrap; flex: 1 1 0; min-width: 0; }
.top-bar-actions .btn, .top-bar-actions .btn-tonal, .top-bar-actions .btn-text {
  min-height: 40px; height: 40px; min-width: 40px; padding: 0 14px; font-size: 13px; gap: 6px;
}
.top-bar-actions .material-symbols-outlined { font-size: 18px; }
.top-bar-actions .icon-btn { width: 40px; height: 40px; min-width: 40px; min-height: 40px; }

/* Pill-Style Tabs & GM3 Expressive Connected Mode Selectors (Zero Borders, >= 40px Touch Targets) */
.m3-pill-tabs {
  display: inline-flex; align-items: center; gap: 6px;
  overflow-x: auto; max-width: 100%; min-width: 0;
  scrollbar-width: none; -ms-overflow-style: none;
}
.m3-pill-tabs::-webkit-scrollbar { display: none; }

.m3-pill-tab {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px; height: 40px; min-width: 40px; padding: 0 15px; gap: 6px; border-radius: 9999px;
  font-family: var(--md-ref-typeface-plain); font-size: 13px; font-weight: 500; line-height: 1;
  white-space: nowrap; flex-shrink: 0; user-select: none; cursor: pointer;
  color: var(--md-sys-color-on-surface-variant);
  background-color: var(--md-sys-color-surface-container);
  border: none;
  transition: background-color 0.15s ease, color 0.15s ease, border-radius 0.18s ease, padding 0.15s ease;
}
.top-app-bar .m3-pill-tabs { flex: 0 0 auto; margin: 0 auto; min-width: 0; }
.top-app-bar .m3-pill-tab { background-color: var(--md-sys-color-surface-container-highest); }
.m3-pill-tab:hover:not(.active):not([aria-selected="true"]):not([class*="badge-"]) {
  background-color: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
}
.m3-pill-tab[class*="badge-"]:hover:not(.active):not([aria-selected="true"]) { filter: brightness(0.95); }
.m3-pill-tab.active, .m3-pill-tab[aria-selected="true"] { font-weight: 600; }
/* Gmail GM3 Color Rule: Sky Blue reserved for tab-buttons (.m3-pill-tab / .gm3-connected-dsp) */
.m3-pill-tab.active:not([class*="badge-"]), .m3-pill-tab[aria-selected="true"]:not([class*="badge-"]) {
  background-color: var(--md-sys-color-blue-tonal);
  color: var(--md-sys-color-primary);
}

.card-header-row .m3-pill-tab { min-height: 40px; height: 40px; min-width: 40px; padding: 0 13px; font-size: 12.5px; gap: 5px; }
.m3-pill-tab .curve-svg {
  width: 15px; height: 11px; flex-shrink: 0;
  stroke: currentColor; fill: none;
  stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}

/* GM3 Expressive Connected Group + DSP Curve / Active Dot Fallback */
.m3-pill-tabs.gm3-connected-dsp { gap: 3px; }
.m3-pill-tabs.gm3-connected-dsp .m3-pill-tab { border-radius: 6px; padding: 0 14px; }
.m3-pill-tabs.gm3-connected-dsp .m3-pill-tab:first-child {
  border-top-left-radius: 9999px; border-bottom-left-radius: 9999px;
}
.m3-pill-tabs.gm3-connected-dsp .m3-pill-tab:last-child {
  border-top-right-radius: 9999px; border-bottom-right-radius: 9999px;
}
.m3-pill-tabs.gm3-connected-dsp .m3-pill-tab.active,
.m3-pill-tabs.gm3-connected-dsp .m3-pill-tab[aria-selected="true"] {
  border-radius: 9999px;
}
.m3-pill-tabs.gm3-connected-dsp .m3-pill-tab.active:not(:has(svg, .material-symbols-outlined))::before,
.m3-pill-tabs.gm3-connected-dsp .m3-pill-tab[aria-selected="true"]:not(:has(svg, .material-symbols-outlined))::before {
  content: ''; width: 6px; height: 6px; border-radius: 9999px;
  background-color: currentColor; flex-shrink: 0;
}

/* Buttons — Strict Emphasis Hierarchy (1 Primary .btn per screen; Cyan reserved for .btn-tonal; >= 40px Touch Targets) */
.btn, .btn-tonal, .btn-text { text-decoration: none; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px; height: 40px; min-width: 40px;
  gap: 8px; padding: 0 18px; border-radius: 9999px;
  background-color: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary);
  font-family: var(--md-ref-typeface-brand); font-size: 13.5px; font-weight: 600;
  white-space: nowrap; flex-shrink: 0;
}
.btn:hover { opacity: 0.92; }
.btn.is-playing { background-color: var(--md-sys-color-tertiary); color: var(--md-sys-color-on-tertiary); }

/* Gmail GM3 Color Rule: Cyan (--md-sys-color-secondary-container) reserved for tonal action buttons */
.btn-tonal {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px; height: 40px; min-width: 40px;
  gap: 6px; padding: 0 16px; border-radius: 9999px;
  background-color: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container);
  font-family: var(--md-ref-typeface-plain); font-size: 13px; font-weight: 600;
  white-space: nowrap; flex-shrink: 0; transition: filter 0.15s ease;
}
.btn-tonal:hover { filter: brightness(0.95); }

.btn-text {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px; height: 40px; min-width: 40px;
  gap: 6px; padding: 0 14px; border-radius: 9999px;
  background-color: transparent; color: var(--md-sys-color-on-surface-variant);
  font-family: var(--md-ref-typeface-plain); font-size: 13px; font-weight: 500;
  white-space: nowrap; flex-shrink: 0; transition: background-color 0.15s ease, color 0.15s ease;
}
.btn-text:hover { background-color: var(--md-sys-color-surface-container-high); color: var(--md-sys-color-on-surface); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; min-width: 40px; min-height: 40px; padding: 0; border-radius: 9999px;
  background-color: transparent; color: var(--md-sys-color-on-surface-variant);
  transition: background-color 0.15s ease, color 0.15s ease;
}
.icon-btn:hover, .icon-btn.active {
  background-color: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface);
}

/* Main Dashboard Bento Container (1440px max-width) */
.main-workspace {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 8px 20px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.tab-panel {
  display: none;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.tab-panel.active {
  display: flex;
}

/* Preset & Circadian Bar */
.preset-strip-card {
  background-color: var(--md-sys-color-surface-container-lowest);
  border-radius: 20px; padding: 12px 18px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px 14px; flex-wrap: wrap; min-width: 0;
}
.preset-strip-card .field-select {
  min-height: 40px; height: 40px; padding: 6px 34px 6px 12px;
  font-size: 13px; max-width: 100%; min-width: 0;
}

.preset-pills-row {
  display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; max-width: 100%; min-width: 0;
}

.preset-Controls-right {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; max-width: 100%;
}

/* Asymmetric Bento Grid for Studio View — minmax(0, ...) ensures proportional shrinking */
.studio-bento-grid {
  display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
  gap: 16px; align-items: start; width: 100%; min-width: 0;
}

.bento-col {
  display: flex; flex-direction: column; gap: 16px; min-width: 0; max-width: 100%;
}

/* Tonal Surface Cards — NO Borders, NO Resting Box Shadows */
.surface-card {
  background-color: var(--md-sys-color-surface-container-lowest);
  border-radius: 24px; padding: 20px; display: flex; flex-direction: column; gap: 16px;
  min-width: 0; max-width: 100%;
}

.nested-card {
  background-color: var(--md-sys-color-surface-container);
  border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 12px;
  min-width: 0; max-width: 100%;
}

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

.card-title-cluster { display: flex; align-items: center; gap: 8px; min-width: 0; }
.card-title { font-size: 15.5px; font-weight: 600; color: var(--md-sys-color-on-surface); line-height: 1.25; }

/* Colour-Coded Badges & Chips */
.badge-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px; max-width: 100%; min-width: 0;
}

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 9999px;
  font-family: var(--md-ref-typeface-plain); font-size: 11.5px; font-weight: 600;
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1;
  white-space: nowrap; flex-shrink: 0;
  background-color: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface-variant);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.badge-blue { background-color: var(--md-sys-color-blue-tonal); color: var(--md-sys-color-on-blue-tonal); }
.badge-green { background-color: var(--md-sys-color-green-tonal); color: var(--md-sys-color-on-green-tonal); }
.badge-yellow { background-color: var(--md-sys-color-yellow-tonal); color: var(--md-sys-color-on-yellow-tonal); }
.badge-orange { background-color: var(--md-sys-color-orange-tonal); color: var(--md-sys-color-on-orange-tonal); }
.badge-red { background-color: var(--md-sys-color-red-tonal); color: var(--md-sys-color-on-red-tonal); }
.badge-purple { background-color: var(--md-sys-color-purple-tonal); color: var(--md-sys-color-on-purple-tonal); }
.badge-teal { background-color: var(--md-sys-color-teal-tonal); color: var(--md-sys-color-on-teal-tonal); }

/* Generative Canvas Container — absolute canvas decouples DPR backing store from grid min-content width */
.canvas-stage-wrapper {
  position: relative; width: 100%; min-width: 0; height: 360px;
  border-radius: 16px; overflow: hidden;
  background-color: var(--md-sys-color-surface-container);
}

.app-shell.deep-listening-active .canvas-stage-wrapper { height: 520px; }

#soundscape-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair;
}

.canvas-hud-overlay {
  position: absolute; top: 12px; left: 12px; right: 12px;
  display: flex; align-items: center; justify-content: space-between;
  pointer-events: none; gap: 8px; flex-wrap: wrap;
}

.canvas-hud-pill {
  pointer-events: auto;
  background-color: var(--md-sys-color-surface-container-lowest);
  color: var(--md-sys-color-on-surface);
  padding: 4px 12px; border-radius: 9999px;
  font-size: 12px; font-weight: 500;
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1;
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  transition: opacity 0.5s ease, visibility 0s linear 0.5s;
}
.canvas-hud-pill:last-child { margin-left: auto; }
.canvas-hud-pill.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }

/* Global Performance Macro Grid — auto-fit allows proportional shrinking and graceful reflow */
.macro-rack-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(164px, 1fr));
  gap: 10px; min-width: 0;
}

.macro-rack-grid-3 {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(144px, 1fr));
  gap: 10px; min-width: 0;
}

.control-row {
  display: flex; flex-direction: column; gap: 6px; min-width: 0; max-width: 100%;
}

.control-label-line {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; font-size: 13px; font-weight: 500;
  color: var(--md-sys-color-on-surface-variant); min-width: 0;
}

.control-value {
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1;
  font-weight: 600; color: var(--md-sys-color-on-surface); font-size: 13px;
}

/* Range Sliders — Contained Tonal Fill Bar with >= 40px Touch Target */
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; min-width: 40px; min-height: 40px; height: 40px;
  padding: 9px 0; box-sizing: border-box; background-clip: content-box;
  border-radius: 17px; overflow: hidden;
  border: none; outline: none; cursor: pointer;
  background-image: linear-gradient(to right,
    var(--md-sys-color-primary-container) 0%,
    var(--md-sys-color-primary-container) var(--pct, 50%),
    var(--md-sys-color-surface-container-highest) var(--pct, 50%),
    var(--md-sys-color-surface-container-highest) 100%);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 4px; height: 22px; border-radius: 2px;
  background-color: var(--md-sys-color-primary); border: none;
}
input[type="range"]::-moz-range-thumb {
  width: 4px; height: 22px; border-radius: 2px;
  background-color: var(--md-sys-color-primary); border: none;
}

/* Envelope Mini Canvas */
.envelope-preview-box {
  position: relative; width: 100%; min-width: 0; height: 76px;
  border-radius: 12px; background-color: var(--md-sys-color-surface-container-lowest);
  overflow: hidden;
}

#envelope-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
}

/* XY Performance Pad — shrinks proportionally with column */
.xy-pad-layout {
  display: grid; grid-template-columns: minmax(116px, 168px) minmax(0, 1fr);
  gap: 14px; align-items: center; min-width: 0;
}

.xy-pad-surface {
  position: relative; width: 100%; max-width: 168px; aspect-ratio: 1 / 1; height: auto;
  border-radius: 16px; background-color: var(--md-sys-color-surface-container-high);
  cursor: pointer; overflow: hidden; touch-action: none; justify-self: center;
}

.xy-pad-crosshair-x, .xy-pad-crosshair-y {
  position: absolute; background-color: var(--md-sys-color-outline-variant); pointer-events: none;
}
.xy-pad-crosshair-x { left: 0; right: 0; height: 1px; top: 50%; }
.xy-pad-crosshair-y { top: 0; bottom: 0; width: 1px; left: 50%; }

.xy-pad-puck {
  position: absolute; width: 22px; height: 22px; border-radius: 9999px;
  background-color: var(--md-sys-color-primary);
  border: 3px solid var(--md-sys-color-on-primary);
  transform: translate(-50%, -50%); pointer-events: none; left: 50%; top: 50%;
}

/* Voice Probability Cards Grid — auto-fit stacks to 1 col inside narrow left column, 2 cols when wide */
.voices-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px; min-width: 0;
}

.voice-card {
  background-color: var(--md-sys-color-surface-container);
  border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 10px;
  min-width: 0; max-width: 100%;
}

.voice-card.is-muted { opacity: 0.58; }

.voice-phase-bar-track {
  width: 100%; height: 6px; border-radius: 9999px;
  background-color: var(--md-sys-color-surface-container-highest); overflow: hidden;
}

.voice-phase-bar-fill {
  height: 100%; width: 0%;
  background-color: var(--md-sys-color-inverse-primary);
  border-radius: 9999px; transition: width 0.08s linear;
}

/* Outlined Inputs & Selects (The One Exception to No Outlines, >= 40px Touch Targets) */
.input-wrapper {
  position: relative; display: flex; align-items: center;
  max-width: 320px; width: 100%; min-width: 0;
}

.m3-input-field {
  width: 100%; min-width: 0; min-height: 40px; height: 40px;
  background-color: var(--md-sys-color-surface-container-lowest);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 8px; padding: 6px 42px 6px 12px;
  font-family: var(--md-ref-typeface-plain); font-size: 13.5px;
  color: var(--md-sys-color-on-surface); outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.m3-input-field:hover, select:hover, .field-select:hover {
  border-color: var(--md-sys-color-outline);
}

.m3-input-field:focus, select:focus, .field-select:focus {
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 1px var(--md-sys-color-primary);
  outline: none;
}

.input-clear-btn {
  position: absolute; right: 2px; top: 50%; transform: translateY(-50%);
  display: none; align-items: center; justify-content: center;
  width: 40px; height: 40px; min-width: 40px; min-height: 40px;
  padding: 0; border: none; border-radius: 9999px;
  background-color: transparent; color: var(--md-sys-color-on-surface-variant);
  cursor: pointer; z-index: 3;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.input-clear-btn:hover {
  background-color: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface);
}

select, .field-select {
  appearance: none; -webkit-appearance: none;
  min-height: 40px; height: 40px; min-width: 40px;
  background-color: var(--md-sys-color-surface-container-lowest);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='%23444746'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 18px 18px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 8px; padding: 6px 36px 6px 12px;
  font-family: var(--md-ref-typeface-plain); font-size: 13.5px;
  color: var(--md-sys-color-on-surface); cursor: pointer; outline: none;
  max-width: 100%; min-width: 0;
  text-overflow: ellipsis; overflow: hidden; white-space: nowrap;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.control-row select, .control-row .field-select { width: 100%; }

[data-theme="dark"] select, [data-theme="dark"] .field-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='%23C4C7C5'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
}

/* Scale Degree Weights Strip */
.degree-weights-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(76px, 1fr));
  gap: 8px; min-width: 0;
}
.degree-column {
  background-color: var(--md-sys-color-surface-container);
  border-radius: 12px; padding: 12px 10px;
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; text-align: center; min-width: 0;
}

/* Probability Event Log Stream */
.event-log-list {
  display: flex; flex-direction: column; gap: 8px; max-height: 300px;
  overflow-y: auto; scrollbar-width: thin;
  scrollbar-color: var(--md-sys-color-outline-variant) transparent;
}
.event-log-item {
  background-color: var(--md-sys-color-surface-container);
  border-radius: 12px; padding: 8px 12px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px 12px; font-size: 13px; min-width: 0;
}

/* Research Homage & Attribution Banner */
.research-homage-banner {
  background-color: var(--md-sys-color-surface-container-lowest);
  border-radius: 20px; padding: 16px 24px; display: flex; align-items: center; min-width: 0;
}
.research-homage-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.research-homage-text { margin: 0; font-size: 14px; color: var(--md-sys-color-on-surface); line-height: 1.5; }

/* Research Cards Grid */
.research-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px; min-width: 0;
}
.research-card {
  background-color: var(--md-sys-color-surface-container-lowest);
  border-radius: 24px; padding: 24px;
  display: flex; flex-direction: column; gap: 12px; min-width: 0;
}
.research-bullet-list {
  margin: 0; padding-left: 18px; display: flex; flex-direction: column;
  gap: 8px; color: var(--md-sys-color-on-surface-variant); font-size: 14px; max-width: 65ch;
}
.research-bullet-list strong { color: var(--md-sys-color-on-surface); }
.inset-divider { height: 1px; background-color: var(--md-sys-color-surface-container-highest); margin: 4px 12px; }

/* Responsive Breakpoints — Proportional Shrinking + Earlier Stacking */
@media (max-width: 1280px) {
  .studio-bento-grid { grid-template-columns: minmax(0, 1.04fr) minmax(0, 0.96fr); gap: 14px; }
  .main-workspace { padding: 8px 16px 28px; }
  .surface-card { padding: 16px; border-radius: 20px; }
  .nested-card { padding: 12px; }
}
@media (max-width: 1080px) { #active-preset-badge { display: none; } }
@media (max-width: 980px) {
  .brand-cluster { width: auto; flex-shrink: 1; }
  .studio-bento-grid { grid-template-columns: minmax(0, 1fr); }
  .canvas-stage-wrapper { height: 320px; }
}
@media (max-width: 720px) {
  .top-app-bar { flex-wrap: wrap; padding: 10px 12px; gap: 8px; }
  .brand-cluster { order: 1; flex: 1 1 auto; min-width: 0; }
  .brand-title { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .top-bar-actions { order: 2; flex: 0 0 auto; width: auto; justify-content: flex-end; gap: 4px; }
  .top-app-bar .btn-label-text { display: none; }
  .top-bar-actions #btn-play-toggle { padding: 0 12px; min-width: 40px; min-height: 40px; height: 40px; justify-content: center; gap: 4px; font-size: 12.5px; }
  .top-bar-actions .btn { padding: 0 12px; font-size: 12.5px; min-height: 40px; height: 40px; }
  .top-app-bar .m3-pill-tabs[role="tablist"] { order: 3; flex: 0 0 100%; width: 100%; display: flex; justify-content: stretch; margin: 0; }
  .top-app-bar .m3-pill-tabs[role="tablist"] .m3-pill-tab { flex: 1 1 0; width: auto; min-height: 40px; height: 40px; justify-content: center; padding: 0 10px; font-size: 13px; }
  .preset-strip-card { flex-direction: column; align-items: stretch; padding: 12px; gap: 10px; }
  .preset-pills-row.m3-pill-tabs.gm3-connected-dsp { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%; }
  .preset-pills-row.m3-pill-tabs.gm3-connected-dsp .m3-pill-tab { width: 100%; min-height: 40px; height: 40px; border-radius: 9999px; justify-content: center; }
  .preset-Controls-right { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 10px; width: 100%; align-items: center; }
  .preset-Controls-right .field-select { width: 100%; min-width: 0; }
}
@media (max-width: 640px) {
  .main-workspace { padding: 8px 12px 24px; gap: 12px; }
  .surface-card { padding: 14px; border-radius: 18px; }
  .top-app-bar .btn-label-text { display: none; }
  .input-wrapper { max-width: 100%; }
  .card-header-row .badge-row { max-width: 100%; flex-wrap: wrap; }
  .card-header-row:has([data-filter-type]) .m3-pill-tabs,
  .card-header-row .m3-pill-tabs:has([data-filter-type]) { width: 100%; display: flex; }
  .card-header-row:has([data-filter-type]) .m3-pill-tab,
  .card-header-row .m3-pill-tabs:has([data-filter-type]) .m3-pill-tab { flex: 1 1 0; min-height: 40px; height: 40px; padding: 0 6px; font-size: 12px; }
  .canvas-stage-wrapper { height: 268px; }
  .canvas-hud-overlay { top: 8px; left: 8px; right: 8px; gap: 6px; }
  .canvas-hud-pill { padding: 3px 9px; font-size: 11px; gap: 4px; }
  .canvas-hud-pill .material-symbols-outlined { font-size: 14px; }
  .macro-rack-grid, .macro-rack-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .piano-phrases-card .macro-rack-grid-3 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .xy-pad-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .xy-pad-surface { max-width: 176px; margin: 0 auto; }
  .xy-pad-layout .bento-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%; }
  .xy-pad-layout .bento-col > .control-row:first-child { grid-column: 1 / -1; }
  .voices-grid, .research-grid { grid-template-columns: minmax(0, 1fr); }
}

