:root {
  --bg: #1a1a1e;
  --panel: rgba(32, 32, 38, 0.94);
  --panel-strong: rgba(40, 40, 48, 0.98);
  --ink: #e0dcd4;
  --muted: #8a8580;
  --accent: #59a7ff;
  --accent-soft: #9fd0ff;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  --screen-bg: #0d0f12;
  --screen-glow: rgba(89, 167, 255, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
  background: linear-gradient(180deg, #1e1e24 0%, #141418 100%);
  background-attachment: fixed;
}

.page-shell {
  width: min(1440px, calc(100% - 16px));
  margin: 0 auto;
  padding: 0 0 48px;
}

/* Transport Header Bar */
.transport-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  background: linear-gradient(180deg, #222228 0%, #1a1a20 100%);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

.transport-brand {
  display: grid;
  gap: 2px;
  min-width: 220px;
}

.transport-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.transport-purpose {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.25;
  max-width: 36ch;
}

.transport-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: 8px;
}

.transport-field {
  display: flex;
  align-items: center;
  gap: 6px;
}

.transport-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.transport-field select,
.transport-field input[type="number"] {
  min-width: 80px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
}

.transport-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.transport-btn {
  padding: 8px 16px;
  font-size: 0.88rem;
  border-radius: 6px;
}

.transport-btn-primary {
  background: linear-gradient(135deg, var(--accent), #357fcb);
  color: #fff;
  box-shadow: 0 0 12px rgba(89, 167, 255, 0.32);
}

.transport-btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  border: 1px solid var(--border);
}

.transport-btn-secondary:hover:not(:disabled) {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.12);
}

.hero {
  padding: 28px 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.78rem;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.6rem, 3.7vw, 3rem);
  line-height: 0.95;
}

.hero-copy {
  max-width: 58ch;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 12px;
}

.output-panel {
  order: 1;
}

.controls-panel {
  order: 2;
}

.panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.controls-panel {
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  align-content: start;
}

.output-panel {
  padding: 16px;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.4rem;
}

.panel-header p {
  margin: 8px 0 0;
  color: var(--muted);
}

.panel-header {
  display: grid;
  gap: 14px;
}

.panel-header-tools {
  display: grid;
  gap: 10px;
}

.panel-header-tool {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.module-form {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.controls-top-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 18px;
}

.ingredient-section {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.ingredient-section-header h3 {
  margin: 0;
  font-size: 1.02rem;
}

.ingredient-section-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.35;
}

.ingredient-grid {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.modifier-panel {
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-strong);
  position: relative;
}

.modifier-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 8px;
  right: 8px;
  height: 2px;
  background: var(--accent);
  border-radius: 0 0 2px 2px;
  opacity: 0.5;
}

.modifier-option {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
}

.modifier-option span:first-child {
  flex: 1;
}

.modifier-option select {
  min-width: 120px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  font: inherit;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
}

.modifier-option input[type="number"] {
  width: 92px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  font: inherit;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
}

.modifier-panel small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.35;
}

.generation-bias-grid {
  display: grid;
  gap: 12px;
}

.generation-bias-row {
  display: grid;
  gap: 8px;
}

.generation-bias-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.generation-bias-row input[type="range"] {
  width: 100%;
}

.generation-bias-row.is-disabled {
  opacity: 0.55;
}

.degree-bias-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 6px;
  font-size: 0.9rem;
}

.degree-bias-table th,
.degree-bias-table td {
  padding: 4px 6px;
  text-align: center;
}

.degree-bias-table th:first-child {
  text-align: left;
  white-space: nowrap;
}

.degree-bias-table input[type="checkbox"] {
  margin: 0;
}

.generation-bias-row.is-disabled input[type="range"] {
  pointer-events: none;
}

.generation-bias-toggles {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.start-beat-random-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.mini-settings-btn {
  padding: 8px 12px;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  border: 1px solid var(--border);
}

.start-beat-summary {
  margin-top: 6px;
}

.rest-settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rest-settings-grid {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.rest-settings-row {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.rest-settings-row-main {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  line-height: 1.15;
}

.rest-settings-row-main input[type="checkbox"] {
  margin: 0;
}

.rest-settings-slider-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.rest-settings-slider-wrap input[type="range"] {
  width: 100%;
}

.rest-settings-slider-value {
  min-width: 44px;
  text-align: right;
  font-weight: 700;
  color: var(--muted);
  font-size: 0.88rem;
}

#rest-settings-panel .bar-settings-columns {
  align-items: start;
}

#rest-settings-panel .modifier-panel small {
  margin-top: 10px;
}

@media (max-width: 900px) {
  .rest-settings-row {
    padding: 9px 10px;
  }
}

.export-panel button {
  width: 100%;
  margin-top: 8px;
}

.bar-builder-panel {
  display: grid;
  gap: 12px;
}

.bar-builder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.bar-builder {
  display: grid;
  gap: 10px;
}

.bar-builder-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.bar-card {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  display: grid;
  gap: 10px;
}

.bar-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.bar-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.bar-inline-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.bar-inline-row select {
  min-width: 0;
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  font: inherit;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
}

.bar-card-actions {
  display: flex;
  gap: 8px;
}

.bar-settings-dialog {
  width: min(760px, calc(100% - 32px));
  border: 1px solid rgba(89, 167, 255, 0.25);
  border-radius: 12px;
  padding: 0;
  background: var(--panel-strong);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  color: var(--ink);
}

#notation-render svg g.abcjs-note.is-playing-note path,
#notation-render svg g.abcjs-note.is-playing-note line,
#notation-render svg g.abcjs-note.is-playing-note ellipse,
#notation-render svg g.abcjs-tab-number.is-playing-note path,
#notation-render svg g.abcjs-tab-number.is-playing-note line,
#notation-render svg g.abcjs-tab-number.is-playing-note ellipse,
#notation-render svg g.abcjs-tab-number.is-playing-note text {
  stroke: var(--accent) !important;
  fill: var(--accent) !important;
}

.bar-settings-dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
}

.bar-editor-dialog {
  width: min(980px, calc(100% - 32px));
}

.bar-settings-form {
  padding: 20px;
  display: grid;
  gap: 16px;
}

.vocabulary-settings-form {
  max-height: min(84vh, 960px);
  overflow: auto;
  align-content: start;
}

.bar-settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.vocabulary-sticky-top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  gap: 16px;
  margin: -20px -20px 0;
  padding: 20px 20px 12px;
  background: var(--panel-strong);
  border-bottom: 1px solid var(--border);
}

.modal-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.modal-tab-button {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-weight: 700;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
}

.modal-tab-button.is-active {
  background: var(--accent);
  color: #1a1a1e;
  border-color: var(--accent);
}

.modal-tab-panels {
  display: grid;
  gap: 16px;
}

.modal-tab-panel {
  display: grid;
  gap: 16px;
}

.modal-tab-panel[hidden] {
  display: none;
}

.bar-settings-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.bar-settings-column {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  display: grid;
  gap: 10px;
  align-content: start;
}

.bar-settings-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.bar-settings-box-header strong {
  font-size: 1rem;
}

.bar-settings-grid {
  display: grid;
  gap: 8px;
}

.random-start-panel {
  display: grid;
  gap: 12px;
}

.template-help-list {
  display: grid;
  gap: 12px;
}

.template-help-card {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  display: grid;
  gap: 8px;
}

.template-help-card h3 {
  margin: 0;
  font-size: 1rem;
}

.template-help-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.template-help-favors {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.template-help-favors span {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(89, 167, 255, 0.16);
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 700;
}

.random-start-help {
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
}

.random-start-header,
.random-start-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px;
}

.random-start-header {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
}

.random-start-grid label {
  display: flex;
  justify-content: center;
}

.triplet-settings-panel {
  display: grid;
  gap: 14px;
}

.natback-settings-panel {
  display: grid;
  gap: 14px;
}

.master-defaults-panel,
.master-defaults-grid,
.master-default-column {
  display: grid;
  gap: 14px;
}

.bar-profile-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.bar-profile-row .compact-toggle {
  margin-left: auto;
}

.compact-settings-columns {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.natback-count-row {
  display: grid;
  gap: 12px;
}

.natback-count-row .modifier-option {
  justify-content: flex-start;
}

.natback-count-row .modifier-option span:first-child {
  flex: 0 0 auto;
}

.natback-settings-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.natback-column {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.natback-column strong {
  display: block;
  margin-bottom: 10px;
}

.natback-check-grid {
  display: grid;
  gap: 8px;
}

.triplet-count-row {
  display: grid;
  gap: 12px;
}

.triplet-count-row .modifier-option {
  justify-content: flex-start;
}

.triplet-count-row .modifier-option span:first-child {
  flex: 0 0 auto;
}

.triplet-settings-grid {
  display: grid;
  gap: 12px;
}

.triplet-column {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.triplet-column strong {
  display: block;
  margin-bottom: 10px;
}

.triplet-check-grid {
  display: grid;
  gap: 8px;
}

.master-toggle-list {
  display: grid;
  gap: 10px;
}

.master-toggle-buckets {
  display: grid;
  gap: 12px;
}

.master-toggle-bucket {
  display: grid;
  gap: 8px;
}

.micro-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.master-toggle-item {
  display: flex;
  gap: 10px;
  align-items: center;
  font-weight: 700;
}

.compact-toggle {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin-right: 12px;
  font-weight: 700;
  font-size: 0.95rem;
}

.panel-header-tool .meta-label {
  margin-bottom: 10px;
}

.style-pack-toggle-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

@media (min-width: 900px) {
  .natback-count-row,
  .natback-settings-grid,
  .triplet-count-row,
  .triplet-settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.module-option {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-strong);
}

.module-option-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.module-option-top strong {
  font-size: 1rem;
}

.module-option-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 150px;
}

.module-option-controls input[type="range"] {
  width: 92px;
}

.module-option-weight-value {
  min-width: 1.5rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.module-option small {
  color: var(--muted);
  line-height: 1.35;
}

.button-row {
  display: flex;
  gap: 12px;
  margin-top: 18px;
}

.output-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  color: #1a1a1e;
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.context-card,
.output-tab-panels {
  display: grid;
  gap: 12px;
}

.context-card {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 16px;
}

.context-card > div {
  background: var(--screen-bg);
  border: 1px solid rgba(89, 167, 255, 0.22);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
}

.context-card strong {
  color: #a0e8a0;
  font-family: 'Courier New', monospace;
  font-size: 0.88rem;
}

.context-card > div,
.meta-card {
  padding: 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-strong);
}

.context-label,
.meta-label {
  display: block;
  margin-bottom: 6px;
  color: var(--accent-soft);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.status {
  min-height: 1.4em;
  margin: 16px 0 0;
  color: var(--accent);
  font-weight: 700;
}

.diagnostics-panel {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.diagnostics-panel summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 700;
}

.diagnostics-summary {
  margin: 8px 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.diagnostics-log {
  margin: 8px 0 10px;
  max-height: 170px;
  overflow: auto;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--screen-bg);
  color: #a0e8a0;
  font-size: 0.8rem;
  line-height: 1.35;
}

.notation-frame {
  min-height: 280px;
  padding: 16px 16px 22px;
  border-radius: 8px;
  border: 2px solid rgba(89, 167, 255, 0.32);
  background: linear-gradient(180deg, #f4e6c7 0%, #e6d2ad 100%);
  box-shadow: inset 0 0 18px rgba(96, 67, 27, 0.14), 0 0 15px var(--screen-glow);
  overflow-x: auto;
}

#notation-render svg path,
#notation-render svg line,
#notation-render svg text {
  stroke: #171411 !important;
  fill: #171411 !important;
}

#notation-render svg text {
  stroke: none !important;
}

#notation-render svg {
  display: block;
  overflow: visible;
  margin-bottom: 8px;
}

.piano-frame {
  padding: 10px 14px;
  overflow: hidden;
}

.playback-piano {
  min-height: 164px;
  overflow: hidden;
}

.piano-keyboard {
  position: relative;
  display: block;
  width: 100%;
  padding: 4px 0 0;
}

.piano-white-keys {
  display: flex;
  position: relative;
  width: 100%;
}

.piano-white-key {
  position: relative;
  flex: 0 0 var(--piano-white-key-width, 34px);
  width: var(--piano-white-key-width, 34px);
  height: 148px;
  border: 1px solid rgba(80, 80, 80, 0.4);
  border-right-width: 0;
  background: linear-gradient(180deg, #f8f6f1 0%, #e8e1d5 100%);
}

.piano-white-key:last-child {
  border-right-width: 1px;
}

.piano-white-key.is-ghost {
  background: linear-gradient(180deg, #edf4fc 0%, #d8e6f5 100%);
  box-shadow: inset 0 0 0 1px rgba(150, 186, 225, 0.38);
}

.piano-white-key.is-active {
  background: linear-gradient(180deg, #8ec6ff 0%, var(--accent) 100%);
  box-shadow: inset 0 0 0 1px rgba(89, 167, 255, 0.55);
}

.piano-black-layer {
  position: absolute;
  left: 0;
  top: 4px;
  right: 0;
  height: 0;
  pointer-events: none;
}

.piano-black-key {
  position: absolute;
  width: calc(var(--piano-white-key-width, 34px) * 0.6);
  height: 92px;
  border: 1px solid rgba(20, 16, 13, 0.72);
  border-radius: 0 0 6px 6px;
  background: linear-gradient(180deg, #383532 0%, #1f1d1b 100%);
  transform: translateX(-50%);
}

.piano-black-key.is-ghost {
  background: linear-gradient(180deg, #7d90a9 0%, #596879 100%);
  border-color: rgba(120, 150, 184, 0.62);
  box-shadow: none;
}

.piano-black-key.is-active {
  background: linear-gradient(180deg, #6db7ff 0%, #357fcb 100%);
  border-color: rgba(53, 127, 203, 0.95);
}

.notation-view-switch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  margin-bottom: 8px;
  padding: 0 2px;
}

.notation-view-switch .mini-settings-btn.is-active {
  background: var(--accent);
  color: #1a1a1e;
  border-color: var(--accent);
}

.notation-play-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 0.88rem;
  line-height: 1;
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  color: #1a1a1e;
  border-color: var(--accent);
}

.notation-play-btn:disabled {
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  border-color: var(--border);
}

.notation-toolbar-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--accent);
}

.notation-toolbar-select span {
  display: inline-flex;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
}

.notation-toolbar-select select {
  min-width: 220px;
  margin: 0;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
  font: inherit;
}

.output-main-column,
.output-main-footer {
  min-width: 0;
}

/* Recipe always visible beside notation */
.output-panel {
  display: grid;
  grid-template-columns: 1fr 300px;
  grid-template-rows: auto 1fr auto;
  gap: 0 16px;
}

.output-panel > .panel-header {
  grid-column: 1 / -1;
}

.output-panel > .notation-sticky-shell {
  grid-column: 1;
  grid-row: 2;
}

.output-panel > .output-main-footer {
  grid-column: 2;
  grid-row: 2;
  align-self: stretch;
  min-height: 0;
}

.output-panel > .output-main-footer .output-tab-panel.is-active {
  display: block;
}

/* Recipe panel styling when always visible */
#recipe-panel {
  height: 100%;
  min-height: 0;
  position: sticky;
  top: 12px;
  display: flex;
  flex-direction: column;
}

.fretboard-sidebar[hidden] {
  display: none !important;
}

/* Instrument Strip (Fretboard + Piano shared area) */
.instrument-strip {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.instrument-strip-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}

.instrument-strip-btn {
  padding: 6px 14px;
  font-size: 0.82rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  border: 1px solid var(--border);
}

.instrument-strip-btn.is-active {
  background: var(--accent);
  color: #1a1a1e;
  border-color: var(--accent);
}

.fretboard-shell {
  padding: 2px 0 6px 8px;
  border-radius: 0;
  background: linear-gradient(180deg, #cdbb97 0%, #b9a57f 100%);
  border: none;
  box-shadow: none;
}

.fretboard-sidebar,
.fretboard-shell {
  position: static;
  align-self: auto;
}

.playback-fretboard {
  min-height: 0;
  position: relative;
  overflow-x: visible;
  overflow-y: hidden;
}

.playback-fretboard .fretboard-container,
.playback-fretboard #fretboard-display,
.playback-fretboard svg {
  display: block;
  margin: 0 !important;
}

.screen-area {
  min-height: 280px;
}

.guitar-tab-frame {
  min-height: 280px;
  padding: 16px;
  border-radius: 8px;
  border: 2px solid rgba(89, 167, 255, 0.32);
  background: linear-gradient(180deg, #f4e6c7 0%, #e6d2ad 100%);
  box-shadow: inset 0 0 18px rgba(96, 67, 27, 0.14);
  overflow-x: auto;
}

.guitar-tab-pre {
  margin: 0;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.98rem;
  line-height: 1.55;
  color: #171411;
  white-space: pre;
}

.guitar-tab-line {
  white-space: pre;
}

.ascii-tab-token.is-playing-note {
  color: var(--accent);
  background: rgba(89, 167, 255, 0.2);
  border-radius: 4px;
}

.guitar-tab-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-start;
}

.notation-sticky-shell {
  position: sticky;
  top: 12px;
  z-index: 4;
  padding-bottom: 8px;
  overflow: visible;
  background: linear-gradient(180deg, rgba(26, 26, 30, 0.98) 0%, rgba(26, 26, 30, 0.92) 82%, rgba(26, 26, 30, 0) 100%);
}

.notation-sticky-shell .notation-frame {
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
}

.notation-loading-overlay {
  position: absolute;
  inset: 18px 0 auto 0;
  min-height: 280px;
  display: grid;
  place-items: center;
  padding: 16px;
  border-radius: 8px;
  border: 2px solid rgba(89, 167, 255, 0.22);
  background: radial-gradient(circle at center, rgba(13, 15, 18, 0.97), rgba(13, 15, 18, 0.99));
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.4);
  z-index: 6;
}

.notation-loading-overlay[hidden] {
  display: none !important;
}

.loading-card {
  width: min(100%, 560px);
  display: grid;
  gap: 14px;
  text-align: center;
}

.loading-spinner {
  display: inline-flex;
  justify-content: center;
  gap: 10px;
}

.loading-spinner span {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  animation: loading-bounce 1.1s infinite ease-in-out;
}

.loading-spinner span:nth-child(2) {
  animation-delay: 0.14s;
}

.loading-spinner span:nth-child(3) {
  animation-delay: 0.28s;
}

.loading-eyebrow {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.loading-subtitle {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
}

.loading-progress {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: rgba(89, 167, 255, 0.14);
}

.loading-progress-bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 36%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft), var(--accent));
  animation: loading-slide 1.8s infinite ease-in-out;
}

.loading-pun {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.45;
  color: var(--muted);
}

@keyframes loading-bounce {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  40% {
    transform: translateY(-7px);
    opacity: 1;
  }
}

@keyframes loading-slide {
  0% {
    transform: translateX(-115%);
  }
  50% {
    transform: translateX(180%);
  }
  100% {
    transform: translateX(-115%);
  }
}

.notation-sticky-shell .output-actions {
  padding-bottom: 8px;
}

.output-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

.tab-button {
  padding: 10px 16px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
}

.tab-button.is-active {
  color: #1a1a1e;
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
}

.output-tab-panels {
  margin-top: 12px;
  height: calc(100% - 12px);
}

.output-tab-panel {
  display: none;
}

.output-tab-panel.is-active {
  display: block;
}

.recipe-list {
  display: grid;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  align-content: start;
}

.recipe-item {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 120ms ease, transform 120ms ease;
  border-radius: 6px;
  padding: 8px 10px;
}

.recipe-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.recipe-item:hover {
  background: rgba(89, 167, 255, 0.12);
  transform: translateY(-1px);
}

.recipe-item.is-meta,
.recipe-item.is-resolution {
  cursor: default;
}

.recipe-item.is-meta:hover,
.recipe-item.is-resolution:hover {
  background: transparent;
  transform: none;
}

.recipe-item strong {
  display: block;
}

.recipe-item span {
  color: var(--muted);
  font-size: 0.95rem;
}

.note-list {
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--accent);
}

@media (max-width: 900px) {
  .fretboard-sidebar {
    position: static;
  }

  .fretboard-shell {
    position: static;
  }

  .playback-fretboard {
    min-height: 0;
  }

  .notation-sticky-shell {
    position: static;
    background: transparent;
    padding-bottom: 0;
  }

  .notation-sticky-shell .notation-frame {
    box-shadow: none;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .output-panel {
    grid-template-columns: 1fr;
  }

  .output-panel > .output-main-footer {
    grid-column: 1;
    grid-row: auto;
  }

  .context-card {
    grid-template-columns: 1fr;
  }

  .controls-panel {
    grid-template-columns: 1fr;
  }

  .bar-card-grid,
  .bar-settings-columns {
    grid-template-columns: 1fr;
  }

  .button-row {
    flex-direction: column;
  }

  .transport-bar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
  }

  .transport-actions {
    width: 100%;
    justify-content: center;
    margin-left: 0;
  }
}

/* Dark theme global form styles */
input[type="checkbox"],
input[type="range"] {
  accent-color: var(--accent);
}

select {
  color-scheme: light;
}

select option,
select optgroup {
  color: #111317;
  background: #f7f4ee;
}

input[type="number"] {
  color-scheme: dark;
}

/* Scrollbar styling for dark theme */
* {
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
  scrollbar-width: thin;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}
