:root {
  --bg: #fff3f8;
  --panel: #ffffff;
  --panel-soft: #fff8fb;
  --border: #e6c9d6;
  --border-soft: rgba(230, 201, 214, 0.72);
  --module-card-radius: 12px;
  --module-card-padding: 16px;
  --module-card-shadow: 0 6px 18px rgba(90, 35, 60, 0.06);
  --section-header-padding: 8px 12px;
  --font-size-body: 14px;
  --font-size-label: 12px;
  --font-size-section-title: 15px;
  --font-size-panel-title: 24px;
  --font-size-app-title: 30px;
  --font-weight-heading: 800;
  --font-weight-label: 600;
  --font-weight-body: 400;
  --text: #332630;
  --muted: #6e5b67;
  --accent: #c85f8f;
  --accent-dark: #a94673;
  --accent-soft: #f4d8e6;
  --add-btn-bg: #b9e8bf;
  --add-btn-hover: #9bdba5;
  --add-btn-border: #77bd86;
  --add-btn-text: #1f5a2c;
}

/* Suggestion Modal */
.suggestion-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
}

.suggestion-modal.active {
  display: flex;
}

.suggestion-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

.suggestion-modal-content {
  position: relative;
  background: var(--panel);
  border-radius: 12px;
  max-width: 500px;
  width: 90%;
  margin: auto;
  padding: 24px;
  box-shadow: 0 10px 40px rgba(90, 35, 60, 0.3);
  z-index: 10;
  animation: modalSlideIn 0.25s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.suggestion-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  padding: 0;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  border-radius: 50%;
}

.suggestion-modal-close:hover {
  background: var(--accent-soft);
  color: var(--accent);
  transform: rotate(90deg);
}

.suggestion-modal-header {
  margin-bottom: 16px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.suggestion-modal-chord {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
}

.suggestion-modal-fn {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.5px;
}

.suggestion-modal-body {
  margin-bottom: 20px;
}

.suggestion-modal-reason {
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
}

.suggestion-modal-actions {
  display: flex;
  gap: 10px;
}

.suggestion-modal-play-btn,
.suggestion-modal-add-btn {
  flex: 1;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 500;
  border: 1.5px solid var(--accent);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.suggestion-modal-play-btn {
  background: linear-gradient(to bottom, var(--accent), #c85f8f);
  color: white;
}

.suggestion-modal-play-btn:hover {
  background: linear-gradient(to bottom, #d1679f, #a94673);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(200, 95, 143, 0.25);
}

.suggestion-modal-add-btn {
  background: var(--add-btn-bg);
  color: var(--add-btn-text);
  border-color: var(--add-btn-border);
}

.suggestion-modal-add-btn:hover {
  background: var(--add-btn-hover);
  color: var(--add-btn-text);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(80, 145, 92, 0.18);
}
body {
  font-family: Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-body);
  line-height: 1.5;
  margin: 0;
  padding: 0;
}

.page {
  max-width: 980px;
  margin: 32px auto;
  padding: 20px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 16px;
  margin-top: 20px;
  box-shadow: 0 2px 8px rgba(90, 35, 60, 0.045);
  transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.tool-shell {
  margin-top: 26px;
}

.tool-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 0;
}

.tool-stage {
  display: grid;
  margin-top: 20px;
}

.tool-nav-btn {
  flex: 1 1 180px;
  width: auto;
  margin: 0;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--accent-dark);
  border: 1px solid var(--border);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-label);
  box-shadow: 0 1px 2px rgba(90, 35, 60, 0.05);
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.tool-nav-btn-warning {
  position: relative;
  padding-right: 34px;
}

.tool-nav-status-icon {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff0f0;
  border: 1px solid rgba(201, 88, 88, 0.42);
  color: #c94a4a;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.tool-nav-btn.active .tool-nav-status-icon {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.38);
  color: #fff4f4;
}

.tool-nav-btn:hover {
  background: linear-gradient(to bottom, var(--accent-soft), #f9d0e0);
  color: var(--accent-dark);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.tool-nav-btn.active {
  background: linear-gradient(to bottom, var(--accent), #b95482);
  color: white;
  border-color: var(--accent-dark);
  box-shadow: 0 4px 10px rgba(169, 70, 115, 0.2);
}

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

.tool-panel {
  grid-area: 1 / 1;
  margin-top: 0;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.tool-panel.tool-panel-active {
  opacity: 1;
  transform: translateY(0);
}

.tool-panel.tool-panel-exiting {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

.sequence-panel {
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: visible;
  margin-bottom: 14px;
}

.app-section-header,
.sequence-panel-title,
.chord-loader-title,
.key-summary-title,
.key-chords-title,
.select-root-style-title {
  margin: 0;
  padding: var(--section-header-padding);
  border-bottom: 1px solid rgba(230, 201, 214, 0.72);
  font-size: var(--font-size-section-title);
  font-weight: var(--font-weight-heading);
  background: linear-gradient(to bottom, #fae8f0, #f8e6ef);
  color: var(--text);
}

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

.section-title-row-inline {
  width: 100%;
}

.sequence-panel > .section-title-row {
  padding: var(--section-header-padding);
  border-bottom: 1px solid rgba(230, 201, 214, 0.72);
  background: linear-gradient(to bottom, #fae8f0, #f8e6ef);
}

.sequence-panel > .section-title-row .sequence-panel-title {
  padding: 0;
  border-bottom: none;
  background: none;
  flex: 0 1 auto;
}

.app-section-header-primary {
  color: var(--accent-dark);
}

.sequence-panel-body,
.chord-loader-body {
  padding: 12px;
}

.sequence-panel-body textarea,
.sequence-panel-body button {
  margin-bottom: 0;
}

.progression-builder-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: stretch;
  margin-top: 8px;
}

.progression-builder-primary,
.progression-text-shell {
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 8px 10px;
}

.progression-builder-primary {
  background: rgba(255, 255, 255, 0.42);
}

.progression-sequence-key-badge {
  margin: 0 0 6px;
  color: #8a6d7c;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.progression-section-label,
.progression-text-label {
  display: block;
  margin: 0 0 4px;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.progression-subsection-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.progression-subsection-header-inline {
  margin-bottom: 4px;
}

.progression-subsection-header .progression-section-label {
  margin-bottom: 0;
}

.progression-sequence-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px 12px;
}

.progression-sequence-heading {
  flex: 1 1 260px;
  min-width: 0;
}

.progression-sequence-heading .input-help {
  margin: 0;
}

.progression-sequence-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  margin-top: 0;
}

.progression-sequence-setting {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
}

.progression-sequence-setting-label {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.progression-sequence-setting input,
.progression-sequence-setting select {
  width: auto;
  min-width: 82px;
  margin: 0;
  padding: 6px 8px;
  font-size: 12px;
  border-radius: 8px;
}

.progression-sequence-setting input {
  max-width: 92px;
}

.progression-metronome-control {
  position: relative;
  display: flex;
  align-items: end;
  margin: 0;
}

.progression-sequence-metronome-btn {
  position: relative;
  width: 38px;
  min-width: 38px;
  height: 38px;
  margin: 0 0 1px;
  --icon-size: 16px;
}

.progression-sequence-metronome-btn:hover {
  background: linear-gradient(180deg, rgba(248, 228, 238, 0.98), rgba(244, 214, 229, 0.98));
}

.progression-sequence-metronome-btn-active {
  background: rgba(244, 216, 230, 0.98);
  box-shadow: 0 0 0 3px rgba(200, 95, 143, 0.12);
}

.progression-sequence-metronome-btn-running::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #d16e2d;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.92);
}

.progression-metronome-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  width: 176px;
  padding: 10px 10px 9px;
  border-radius: 14px;
  border: 1px solid rgba(200, 95, 143, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(252, 244, 248, 0.98));
  box-shadow: 0 12px 28px rgba(78, 38, 58, 0.14);
}

.progression-metronome-popover-title {
  margin: 0 0 5px;
  font-size: 11px;
  font-weight: 800;
  color: var(--accent-dark);
}

.progression-metronome-popover .progression-sequence-setting-label {
  font-size: 8px;
  letter-spacing: 0.08em;
}

.progression-metronome-controls-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px;
}

.progression-metronome-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.progression-metronome-field select,
.progression-metronome-field input[type="range"] {
  width: 100%;
  margin: 0;
}

.progression-metronome-field input[type="range"] {
  height: 16px;
}

.progression-metronome-volume-value {
  margin: 0 0 4px 84px;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  line-height: 1;
}

.progression-metronome-help {
  margin: 0;
  font-size: 9px;
  line-height: 1.3;
  color: var(--muted);
}

.progression-metronome-arm-btn {
  width: auto;
  min-width: 58px;
  margin: 0;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  flex: 0 0 auto;
}

.progression-metronome-arm-btn-active {
  background: linear-gradient(180deg, rgba(201, 92, 144, 0.98), rgba(176, 68, 123, 0.98));
  color: white;
  border-color: rgba(136, 46, 92, 0.92);
}

.progression-sequence-demo-btn {
  width: auto;
  min-width: 0;
  align-self: end;
  margin: 0 0 1px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--accent-dark);
  border: 1px solid rgba(200, 95, 143, 0.22);
}

.progression-sequence-demo-btn:hover {
  background: rgba(244, 216, 230, 0.92);
}

.progression-demo-menu-shell {
  position: relative;
  align-self: end;
  flex: 0 0 auto;
  z-index: 6;
}

.progression-demo-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 90;
  min-width: 220px;
  padding: 10px;
  border-radius: 16px;
  background: rgba(255, 251, 253, 0.98);
  border: 1px solid rgba(216, 118, 164, 0.24);
  box-shadow: 0 16px 34px rgba(95, 56, 74, 0.18);
}

.progression-demo-popover-title {
  margin-bottom: 8px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
}

.progression-demo-menu-list {
  display: grid;
  gap: 6px;
}

.progression-demo-menu-item {
  width: 100%;
  margin: 0;
  padding: 8px 10px;
  text-align: left;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--accent-dark);
  border: 1px solid rgba(216, 118, 164, 0.2);
  font-size: 11px;
  font-weight: 700;
}

.progression-demo-menu-item:hover {
  background: rgba(244, 216, 230, 0.92);
}

.progression-demo-menu-item-loading,
.progression-demo-menu-item-empty {
  padding: 6px 2px;
  color: #8d6c7b;
  font-size: 11px;
  font-weight: 600;
}

.progression-blocks {
  overflow: visible;
  margin-top: 6px;
  min-height: 58px;
  padding-bottom: 0;
}

.progression-blocks-track {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: stretch;
  min-width: 0;
}

.progression-blocks-empty {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.58);
}

.progression-block {
  --progression-beat-width: 24px;
  width: auto;
  position: relative;
  overflow: hidden;
  flex: 0 0 clamp(52px, calc(22px + (var(--progression-duration-beats, 4) * var(--progression-beat-width))), 214px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 0;
  min-height: 44px;
  padding: 16px 7px 5px;
  background: linear-gradient(180deg, #fffafc, #fff4f8);
  border: 1px solid rgba(200, 95, 143, 0.24);
  border-radius: 8px;
  color: var(--text);
  box-shadow: 0 1px 4px rgba(90, 35, 60, 0.03);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.progression-block-markers {
  position: absolute;
  inset: 0;
  pointer-events: auto;
  z-index: 0;
}

.progression-block-marker {
  position: absolute;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background: rgba(110, 91, 103, 0.42);
  transform: translateX(-0.5px);
}

.progression-block-marker-bar {
  width: 2px;
  background: rgba(110, 91, 103, 0.72);
}

.progression-block-marker-bar-label {
  position: absolute;
  top: 3px;
  left: 4px;
  min-width: 14px;
  padding: 1px 3px;
  border-radius: 999px;
  background: rgba(155, 49, 96, 0.96);
  color: white;
  font-size: 8px;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
  box-shadow: 0 1px 3px rgba(90, 35, 60, 0.08);
  pointer-events: auto;
  z-index: 1;
}

.progression-block-bar-start-label {
  position: absolute;
  top: 3px;
  left: 5px;
  min-width: 14px;
  padding: 1px 3px;
  border-radius: 999px;
  background: rgba(155, 49, 96, 0.96);
  color: white;
  font-size: 8px;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
  pointer-events: auto;
  z-index: 1;
  box-shadow: 0 1px 3px rgba(90, 35, 60, 0.06);
}

.progression-block-chord,
.progression-block-meta {
  position: relative;
  z-index: 1;
}

.progression-block:hover {
  transform: translateY(-1px);
  border-color: rgba(200, 95, 143, 0.42);
  box-shadow: 0 5px 12px rgba(90, 35, 60, 0.07);
}

.progression-block-dragging {
  opacity: 0.55;
  transform: scale(0.98);
}

.progression-block-drop-before::before,
.progression-block-drop-after::after {
  content: "";
  position: absolute;
  top: 4px;
  bottom: 4px;
  width: 3px;
  border-radius: 999px;
  background: rgba(200, 95, 143, 0.92);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.8);
  z-index: 2;
}

.progression-block-drop-before::before {
  left: 0;
}

.progression-block-drop-after::after {
  right: 0;
}

.progression-block-selected {
  background: linear-gradient(180deg, #fde9f2, #f8e2ec);
  border-color: rgba(169, 70, 115, 0.7);
  box-shadow: 0 4px 10px rgba(169, 70, 115, 0.1);
}

.progression-block-playing {
  background: linear-gradient(180deg, #fff6d8, #ffeab1);
  border-color: rgba(202, 152, 34, 0.78);
  box-shadow: 0 0 0 2px rgba(248, 206, 95, 0.28), 0 5px 12px rgba(168, 121, 18, 0.12);
}

.progression-block-selected.progression-block-playing {
  background: linear-gradient(180deg, #ffe9db, #ffd8bd);
  border-color: rgba(186, 104, 63, 0.84);
  box-shadow: 0 0 0 2px rgba(255, 194, 143, 0.34), 0 5px 12px rgba(169, 70, 115, 0.12);
}

.progression-block-chord {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.1;
  margin-top: auto;
}

.progression-block-meta {
  display: flex;
  flex-wrap: nowrap;
  gap: 0;
  min-height: 20px;
  margin-bottom: 3px;
  align-items: center;
}

.progression-block-voicing-badge {
  min-width: 10px;
  height: auto;
  padding: 1px 2px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(244, 216, 230, 0.96);
  border: 1px solid rgba(200, 95, 143, 0.28);
  color: var(--accent-dark);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.1;
  white-space: nowrap;
  flex: 0 0 auto;
}

.progression-block-duration {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
}

.progression-editor-modal-root {
  display: none;
}

.progression-editor-modal-root-active {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 1200;
}

.progression-editor-shell {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progression-editor-modal {
  position: fixed;
  width: min(430px, 100%);
  background: linear-gradient(180deg, rgba(255, 251, 253, 0.98), rgba(255, 244, 248, 0.96));
  border: 1px solid rgba(200, 95, 143, 0.22);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 14px 36px rgba(90, 35, 60, 0.18);
  z-index: 1;
}

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

.progression-editor-title {
  color: var(--accent-dark);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.progression-editor-note,
.progression-editor-empty {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.progression-editor-close {
  width: 28px;
  min-width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(200, 95, 143, 0.22);
  background: rgba(255, 255, 255, 0.86);
  color: var(--accent-dark);
  font-size: 18px;
  line-height: 1;
}

.progression-editor-close:hover {
  background: rgba(244, 216, 230, 0.92);
}

.progression-editor-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.progression-editor-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.progression-editor-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.progression-editor-field {
  border: 1px solid rgba(200, 95, 143, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
  padding: 4px 7px;
}

.progression-editor-field-select {
  display: block;
  margin: 0;
  padding-bottom: 6px;
}

.progression-editor-field-checkbox {
  display: block;
  margin: 0;
}

.progression-editor-field-label {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.progression-editor-field-value {
  margin-top: 1px;
  font-size: 11px;
  font-weight: 700;
}

.progression-editor-select {
  width: auto;
  min-width: 64px;
  margin: 2px 0 0;
  padding: 4px 22px 4px 6px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 6px;
}

.progression-editor-checkbox-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
}

.progression-editor-checkbox {
  width: 14px;
  min-width: 14px;
  height: 14px;
  margin: 0;
  padding: 0;
}

.progression-editor-checkbox-value {
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
}

.progression-editor-voicing {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.progression-editor-voicing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.progression-editor-voicing-rows {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.progression-editor-voicing-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 7px;
  border: 1px solid rgba(200, 95, 143, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
}

.progression-editor-voicing-note {
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
}

.progression-editor-voicing-select {
  width: auto;
  min-width: 88px;
  margin: 0;
  padding: 4px 24px 4px 7px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 6px;
}

.progression-editor-voicing-mode-toggle,
.progression-editor-voicing-input {
  width: auto;
  margin: 0;
  padding: 4px 24px 4px 7px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 6px;
}

.progression-editor-voicing-mode-toggle {
  min-width: 94px;
  padding: 4px 9px;
  margin-bottom: 0;
  background: rgba(255, 255, 255, 0.88);
  color: var(--accent-dark);
  border: 1px solid rgba(200, 95, 143, 0.24);
}

.progression-editor-voicing-mode-toggle:hover {
  background: rgba(244, 216, 230, 0.92);
}

.progression-editor-voicing-mode-toggle-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent-dark);
}

.progression-editor-voicing-mode-toggle-active:hover {
  background: var(--accent-dark);
}

.progression-editor-voicing-input {
  min-width: 76px;
  padding-right: 7px;
}

.progression-text-shell {
  margin-top: 8px;
  padding-top: 7px;
  padding-bottom: 7px;
}

.progression-text-shell-hidden {
  display: none;
}

.progression-text-shell .input-help {
  margin-bottom: 6px;
}

.progression-toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.sequence-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 0;
  justify-content: flex-start;
}

.sequence-panel-actions button {
  flex: 0 0 auto;
  width: auto;
}

.sequence-panel-action-shell {
  position: relative;
  display: flex;
  flex: 0 0 auto;
}

.sequence-panel-action-btn.app-icon-button {
  --icon-size: 16px;
  width: 38px;
  min-width: 38px;
  height: 38px;
  border-radius: 12px;
}

.sequence-panel-action-shell-danger {
  margin-left: 0;
}

.sequence-panel-action-btn-danger {
  position: relative;
}

.progression-confirm-modal-root {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
}

.progression-confirm-modal-root[hidden] {
  display: none;
}

.progression-confirm-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(73, 42, 56, 0.18);
  backdrop-filter: blur(2px);
}

.progression-confirm-modal {
  position: relative;
  width: min(320px, calc(100vw - 32px));
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(200, 95, 143, 0.2);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(252, 244, 248, 0.98));
  box-shadow: 0 18px 42px rgba(78, 38, 58, 0.2);
}

.progression-confirm-modal-title {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 800;
}

.progression-confirm-modal-text {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.progression-confirm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.progression-confirm-modal-confirm,
.progression-confirm-modal-cancel {
  width: auto;
  min-width: 62px;
  margin: 0;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.progression-confirm-modal-confirm {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent-dark);
}

.progression-confirm-modal-confirm:hover {
  background: var(--accent-dark);
}

.progression-confirm-modal-cancel {
  background: rgba(255, 255, 255, 0.92);
  color: var(--accent-dark);
  border: 1px solid rgba(200, 95, 143, 0.22);
}

.progression-confirm-modal-cancel:hover {
  background: rgba(244, 216, 230, 0.92);
}

label {
  display: block;
  margin-top: 12px;
  margin-bottom: 6px;
  font-size: var(--font-size-label);
  font-weight: var(--font-weight-label);
}

select,
textarea,
button {
  width: 100%;
  padding: 10px;
  margin-bottom: 10px;
  font-size: var(--font-size-body);
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  box-sizing: border-box;
}

select,
textarea {
  background: #fff;
  color: var(--text);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

button {
  cursor: pointer;
  background: var(--accent);
  color: white;
  border: 1px solid var(--accent-dark);
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.12s ease;
}

button:hover {
  background: var(--accent-dark);
}

button:active {
  transform: translateY(1px);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-icon-button {
  --icon-size: 18px;
  width: 46px;
  min-width: 46px;
  height: 46px;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 251, 253, 0.98), rgba(250, 238, 244, 0.98));
  color: var(--accent-dark);
  border: 1px solid rgba(200, 95, 143, 0.24);
  box-shadow: 0 5px 14px rgba(118, 50, 84, 0.08);
}

.app-icon-button::before {
  content: "";
  width: var(--icon-size);
  height: var(--icon-size);
  background-color: currentColor;
  -webkit-mask-image: var(--icon-mask);
  mask-image: var(--icon-mask);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.app-icon-button:hover {
  background: linear-gradient(180deg, rgba(248, 228, 238, 0.98), rgba(244, 214, 229, 0.98));
  color: var(--accent-dark);
  border-color: rgba(200, 95, 143, 0.34);
  box-shadow: 0 8px 18px rgba(118, 50, 84, 0.14);
}

.app-icon-button:disabled {
  opacity: 1;
  cursor: not-allowed;
  background: linear-gradient(180deg, rgba(255, 252, 253, 0.92), rgba(246, 240, 243, 0.96));
  color: #c3aeb7;
  border-color: rgba(200, 95, 143, 0.14);
  box-shadow: none;
}

.app-icon-button.app-icon-button-active {
  background: linear-gradient(180deg, rgba(201, 92, 144, 0.98), rgba(176, 68, 123, 0.98));
  color: white;
  border-color: rgba(136, 46, 92, 0.92);
  box-shadow: 0 10px 22px rgba(120, 41, 82, 0.2);
}

.app-icon-button.app-icon-button-active:hover {
  background: linear-gradient(180deg, rgba(191, 83, 136, 1), rgba(164, 57, 112, 1));
  color: white;
}

.app-icon-button[data-icon="play"] { --icon-mask: url("./graphics/play.svg"); }
.app-icon-button[data-icon="add"] { --icon-mask: url("./graphics/add.svg"); }
.app-icon-button[data-icon="update"] { --icon-mask: url("./graphics/update.svg"); }
.app-icon-button[data-icon="insert"] { --icon-mask: url("./graphics/insert.svg"); }
.app-icon-button[data-icon="split"] { --icon-mask: url("./graphics/split.svg"); }
.app-icon-button[data-icon="duplicate"] { --icon-mask: url("./graphics/duplicate.svg"); }
.app-icon-button[data-icon="delete"] { --icon-mask: url("./graphics/delete.svg"); }
.app-icon-button[data-icon="clear"] { --icon-mask: url("./graphics/clear.svg"); }
.app-icon-button[data-icon="reset-progression"] { --icon-mask: url("./graphics/reset-progression.svg"); }
.app-icon-button[data-icon="play-sequence"] { --icon-mask: url("./graphics/play-sequence.svg"); }
.app-icon-button[data-icon="play-from"] { --icon-mask: url("./graphics/play-from.svg"); }
.app-icon-button[data-icon="undo"] { --icon-mask: url("./graphics/undo.svg"); }
.app-icon-button[data-icon="redo"] { --icon-mask: url("./graphics/redo.svg"); }
.app-icon-button[data-icon="save-progression"] { --icon-mask: url("./graphics/save-progression.svg"); }
.app-icon-button[data-icon="load-progression"] { --icon-mask: url("./graphics/load-progression.svg"); }
.app-icon-button[data-icon="metronome"] { --icon-mask: url("./graphics/metronome.svg"); }

.app-icon-button[data-icon="stop"]::before {
  width: 13px;
  height: 13px;
  border-radius: 4px;
  background-color: currentColor;
  -webkit-mask-image: none;
  mask-image: none;
}

select:hover,
textarea:hover {
  border-color: rgba(212, 116, 158, 0.72);
}

select:focus,
textarea:focus,
button:focus-visible {
  outline: none;
  border-color: rgba(200, 95, 143, 0.92);
  box-shadow: 0 0 0 3px rgba(200, 95, 143, 0.12);
}

h1,
h2 {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
}

h1 {
  font-size: var(--font-size-app-title);
  font-weight: var(--font-weight-heading);
  line-height: 1.1;
}

h2 {
  font-size: var(--font-size-panel-title);
  font-weight: var(--font-weight-heading);
  line-height: 1.15;
}

.app-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0;
  margin-bottom: 2px;
}

.app-brand-logo {
  display: block;
  width: min(100%, 404px);
  height: auto;
}

.app-intro {
  margin-top: 0;
}

.app-brand-subtitle {
  max-width: 620px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.35;
}

.tool-panel-description {
  margin: 10px 0 14px;
  font-size: var(--font-size-label);
  font-weight: var(--font-weight-body);
  color: #705765;
}

.tool-panel-description-inline {
  margin: 0;
  padding: 8px 14px 2px;
}

.section-help-btn {
  width: 24px;
  min-width: 24px;
  height: 24px;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(200, 95, 143, 0.34);
  background: rgba(255, 251, 253, 0.9);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 4px 10px rgba(118, 50, 84, 0.08);
}

.section-help-btn:hover {
  background: rgba(246, 224, 235, 0.98);
  border-color: rgba(200, 95, 143, 0.52);
}

.section-help-btn-subtle {
  width: 20px;
  min-width: 20px;
  height: 20px;
  font-size: 11px;
}

.tool-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: var(--section-header-padding);
  border-bottom: 1px solid rgba(230, 201, 214, 0.72);
  background: linear-gradient(to bottom, #fae8f0, #f8e6ef);
}

.tool-header-bar .chord-loader-title {
  padding: 0;
  border-bottom: none;
  background: none;
  flex: 0 1 auto;
}

.tool-header-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.tool-context {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 14px 0;
}

.tool-context-inline {
  padding: 0;
  justify-content: flex-end;
  flex: 0 1 auto;
}

.tool-context-chip {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(214, 188, 201, 0.72);
  color: #8a6d7c;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.tool-context-chip-mode {
  color: #967c88;
  font-weight: 600;
}

.section-help-modal-root {
  position: fixed;
  inset: 0;
  z-index: 1800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.section-help-modal-root[hidden] {
  display: none;
}

.section-help-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(53, 28, 40, 0.34);
  backdrop-filter: blur(3px);
}

.section-help-modal {
  position: relative;
  z-index: 1;
  width: min(720px, calc(100vw - 28px));
  max-height: min(82vh, 760px);
  overflow: auto;
  border-radius: 18px;
  border: 1px solid rgba(200, 95, 143, 0.24);
  background: linear-gradient(180deg, rgba(255, 252, 253, 0.99), rgba(250, 242, 246, 0.99));
  box-shadow: 0 24px 56px rgba(90, 39, 62, 0.24);
}

.section-help-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid rgba(230, 201, 214, 0.72);
}

.section-help-modal-title {
  color: var(--accent-dark);
  font-size: 22px;
  font-weight: var(--font-weight-heading);
  line-height: 1.15;
}

.section-help-modal-close {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  margin: 0;
  border-radius: 999px;
  border: 1px solid rgba(200, 95, 143, 0.24);
  background: rgba(255, 250, 252, 0.92);
  color: var(--accent-dark);
  font-size: 22px;
  line-height: 1;
}

.section-help-modal-close:hover {
  background: rgba(246, 224, 235, 0.98);
}

.section-help-modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 20px 22px;
  color: #5f4957;
}

.section-help-modal-intro {
  margin: 0;
  color: #6d5562;
  line-height: 1.55;
}

.section-help-modal-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(230, 201, 214, 0.62);
}

.section-help-modal-section-title {
  margin: 0;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.section-help-modal-section p {
  margin: 0;
  color: #624e5a;
  line-height: 1.55;
}

.section-help-modal-section ul {
  margin: 0;
  padding-left: 18px;
  color: #624e5a;
}

.section-help-modal-section li + li {
  margin-top: 6px;
}

.tool-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 14px 0;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.4;
}

.tool-status-warning {
  background: #fff3f0;
  border: 1px solid rgba(220, 130, 106, 0.35);
  color: #8b4b3d;
}

.sequence-audio-status {
  margin: 10px 0 0;
}

.sequence-audio-status[hidden] {
  display: none;
}

.tool-status-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(220, 130, 106, 0.16);
  border: 1px solid rgba(220, 130, 106, 0.28);
  font-size: 12px;
  font-weight: 700;
}

.suggestion-engine-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.suggestion-debug-panel {
  padding: 12px 14px;
  border: 1px solid rgba(169, 70, 115, 0.2);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 252, 253, 0.98), rgba(251, 243, 247, 0.96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.84);
}

.suggestion-debug-panel[hidden] {
  display: none;
}

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

.suggestion-debug-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-dark);
}

.suggestion-debug-copy-btn {
  position: relative;
  width: 24px;
  min-width: 24px;
  height: 24px;
  padding: 0;
  margin: 0;
  border-radius: 8px;
  border: 1px solid rgba(200, 95, 143, 0.24);
  background: rgba(255, 255, 255, 0.86);
  color: var(--accent-dark);
  box-shadow: 0 4px 10px rgba(118, 50, 84, 0.08);
}

.suggestion-debug-copy-btn::before,
.suggestion-debug-copy-btn::after {
  content: "";
  position: absolute;
  border-radius: 2px;
  border: 1.5px solid currentColor;
  background: transparent;
}

.suggestion-debug-copy-btn::before {
  width: 8px;
  height: 8px;
  top: 6px;
  left: 10px;
  background: rgba(255, 255, 255, 0.92);
}

.suggestion-debug-copy-btn::after {
  width: 8px;
  height: 8px;
  top: 9px;
  left: 7px;
}

.suggestion-debug-copy-btn:hover {
  background: rgba(244, 216, 230, 0.92);
  border-color: rgba(200, 95, 143, 0.36);
}

.suggestion-debug-copy-btn:disabled {
  opacity: 1;
  cursor: not-allowed;
  color: #c3aeb7;
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(200, 95, 143, 0.14);
  box-shadow: none;
}

.suggestion-debug-copy-btn.suggestion-debug-copy-btn-copied {
  background: linear-gradient(180deg, rgba(201, 92, 144, 0.98), rgba(176, 68, 123, 0.98));
  color: white;
  border-color: rgba(136, 46, 92, 0.92);
}

.suggestion-debug-output {
  margin: 10px 0 0;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  color: var(--text);
}

.suggestion-engine-controls {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 12px;
}

.suggestion-engine-feeling {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 220px;
}

.suggestion-engine-feeling-label {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.suggestion-engine-feeling-subtitle {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.suggestion-engine-controls > select {
  width: auto;
  min-width: 170px;
  margin-bottom: 0;
  flex: 0 0 auto;
}

.suggest-refresh-btn {
  width: auto;
  min-width: 0;
  margin-bottom: 0;
  padding: 10px 14px;
  flex: 0 0 auto;
}

.suggest-debug-toggle-btn {
  position: relative;
  width: 24px;
  min-width: 24px;
  height: 24px;
  margin-bottom: 0;
  padding: 0;
  flex: 0 0 auto;
  border-radius: 8px;
  border: 1px solid rgba(200, 95, 143, 0.24);
  background: rgba(255, 255, 255, 0.86);
  color: var(--accent-dark);
  box-shadow: 0 4px 10px rgba(118, 50, 84, 0.08);
}

.suggest-debug-toggle-btn:hover {
  background: rgba(244, 216, 230, 0.92);
}

.suggest-debug-toggle-btn::before,
.suggest-debug-toggle-btn::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.suggest-debug-toggle-btn::before {
  top: 6px;
  width: 9px;
  height: 9px;
  border: 1.6px solid currentColor;
  border-radius: 50% 50% 44% 44%;
  background:
    radial-gradient(circle at 35% 45%, currentColor 0 1px, transparent 1.2px),
    radial-gradient(circle at 65% 45%, currentColor 0 1px, transparent 1.2px),
    rgba(255, 255, 255, 0.94);
}

.suggest-debug-toggle-btn::after {
  top: 4px;
  width: 10px;
  height: 3px;
  border-top: 1.6px solid currentColor;
  border-radius: 999px;
  clip-path: polygon(0 100%, 14% 0, 50% 100%, 86% 0, 100% 100%, 100% 100%, 0 100%);
}

.suggest-debug-toggle-btn[aria-pressed="true"] {
  background: linear-gradient(180deg, rgba(201, 92, 144, 0.98), rgba(176, 68, 123, 0.98));
  color: white;
  border-color: rgba(136, 46, 92, 0.92);
}

.suggest-debug-toggle-btn[aria-pressed="true"]:hover {
  background: linear-gradient(180deg, rgba(209, 101, 151, 0.98), rgba(184, 76, 130, 0.98));
}

p {
  color: var(--muted);
}

#results {
  padding-left: 0;
  margin: 0;
  list-style: none;
}

#results li {
  margin-bottom: 14px;
  line-height: 1.4;
}

.key-info {
  margin-top: 14px;
}

.scale-note-item {
  display: flex;
  gap: 6px;
  align-items: center;
}

.key-summary-card,
.key-chords-card {
  background: var(--panel-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--module-card-radius);
  overflow: hidden;
  margin-top: 12px;
  box-shadow: var(--module-card-shadow);
}

.key-scale-play {
  display: inline-block;
  margin-left: 0.35rem;
  cursor: pointer;
  user-select: none;
  vertical-align: middle;
}

.key-scale-play:hover {
  transform: scale(1.08);
}

.key-scale-play:focus-visible {
  outline: 2px solid #8b3a62;
  outline-offset: 2px;
  border-radius: 4px;
}

.key-label {
  font-weight: 600;
  color: var(--text);
}

.key-summary-meta strong {
  color: var(--accent-dark);
}

.key-summary-meta {
  padding: 14px var(--module-card-padding);
  color: var(--text);
  line-height: 1.5;
}

.key-summary-overview {
  padding: var(--module-card-padding);
  color: var(--text);
}

.key-summary-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  line-height: 1.5;
}

.key-summary-help {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.key-summary-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-dark);
}

.key-summary-chord,
.key-summary-scale,
.key-summary-characteristic {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.key-summary-chord-name {
  font-weight: 700;
  color: var(--text);
}

.key-summary-characteristic-note {
  font-weight: 700;
  color: var(--text);
}

.key-summary-characteristic-degree {
  color: var(--muted);
  font-weight: 600;
}

.key-summary-chord-btn {
  width: auto;
  min-width: 72px;
  margin: 0;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  background: linear-gradient(to bottom, var(--accent-soft), #f9d0e0);
  color: var(--accent-dark);
  border: 1.5px solid var(--accent);
}

.key-summary-chord-btn:hover {
  background: linear-gradient(to bottom, var(--accent), #c85f8f);
  color: white;
}

.key-mode-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 0 var(--module-card-padding) var(--module-card-padding);
  color: var(--text);
}

.key-mode-detail {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(230, 201, 214, 0.6);
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
}

.key-mode-detail-wide {
  grid-column: 1 / -1;
}

.key-mode-detail-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #705765;
  flex: 0 0 auto;
}

.key-mode-detail-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  text-align: left;
  flex: 1 1 auto;
}

.key-summary-meta strong {
  font-weight: 600;
  color: var(--accent-dark);
}

.key-summary-sep {
  color: var(--muted);
  margin: 0 2px;
}

.note-play-icon {
  background: transparent; /* small unboxed icon */
  border: none;
  padding: 0 4px;
  font-size: 14px;
  cursor: pointer;
}

.scale-note-label {
  background: transparent;
  border: 1px solid rgba(0,0,0,0.06);
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text);
}

.scale-text {
  font-weight: 600;
  margin-right: 8px;
}

.scale-play-all {
  background: transparent;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
}

.key-summary-meta {
  padding: 12px 14px;
}

.theory-legend {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.theory-legend-inline {
  padding: 0 14px 12px;
}

.chord-label-friendly {
  display: block;
  font-weight: 600;
}

.chord-label-theory {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.25;
  color: #8e6c7f;
  font-weight: 500;
}

.key-mode-chords-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  padding: var(--module-card-padding);
}

.key-mode-chord-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 10px 11px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(230, 201, 214, 0.6);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(90, 35, 60, 0.03);
  align-items: stretch;
  justify-content: flex-start;
  min-height: 0;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.key-mode-chord-card-selected {
  background: rgba(255, 249, 252, 0.96);
  border-color: rgba(169, 70, 115, 0.72);
  box-shadow: 0 0 0 2px rgba(200, 95, 143, 0.12), 0 6px 16px rgba(90, 35, 60, 0.08);
}

.key-mode-chord-card:hover {
  background: rgba(255, 255, 255, 0.84);
  border-color: rgba(216, 118, 164, 0.8);
  box-shadow: 0 6px 16px rgba(90, 35, 60, 0.08);
  transform: translateY(-1px);
}

.key-mode-chord-card:active {
  transform: translateY(0);
  box-shadow: 0 3px 10px rgba(90, 35, 60, 0.06);
}

.key-mode-chord-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.key-mode-chord-roman {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #755a69;
}

.key-mode-chord-degree {
  font-size: 11px;
  font-weight: 600;
  color: #664d5b;
  line-height: 1.2;
}

.key-mode-chord-actions {
  position: relative;
  margin-top: 2px;
}

.key-mode-selection-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 14px;
  align-items: center;
  margin: 6px 16px 12px;
  padding: 6px 10px;
  border: 1px solid rgba(169, 70, 115, 0.24);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255, 252, 253, 0.98), rgba(252, 244, 248, 0.96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.84);
}

.key-mode-selection-bar-idle {
  border-style: dashed;
  border-color: rgba(169, 70, 115, 0.18);
}

.key-mode-selection-current {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 3px 7px;
  min-width: 0;
}

.key-mode-selection-current-label {
  color: #735967;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.key-mode-selection-current-name {
  color: var(--accent-dark);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.1;
}

.key-mode-selection-current-placeholder {
  color: #8f7381;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
}

.key-mode-selection-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.key-mode-selection-field {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.key-mode-selection-field-label {
  flex: 0 0 auto;
  color: #735967;
  font-size: 10px;
  font-weight: 700;
}

.key-mode-selection-summary-code {
  min-width: 0;
  width: fit-content;
  height: 14px;
  padding: 0 2px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(244, 216, 230, 0.96);
  border: 1px solid rgba(200, 95, 143, 0.34);
  color: var(--accent-dark);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  flex: 0 0 auto;
  box-sizing: border-box;
}

.key-mode-chord-inversion-select {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 4px 24px 4px 8px;
  min-height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(216, 118, 164, 0.34);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
}

.key-mode-chord-voicing-select {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 4px 24px 4px 8px;
  min-height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(216, 118, 164, 0.34);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
}

.key-mode-chord-inversion-select:disabled,
.key-mode-chord-voicing-select:disabled {
  border-color: rgba(216, 118, 164, 0.16);
  background: rgba(255, 255, 255, 0.72);
  color: #9f8793;
  cursor: not-allowed;
}

.key-mode-chord-inversion-select:hover {
  border-color: rgba(216, 118, 164, 0.8);
}

.key-mode-chord-voicing-select:hover {
  border-color: rgba(216, 118, 164, 0.8);
}

.key-mode-chord-inversion-select:focus-visible {
  outline: 2px solid rgba(169, 70, 115, 0.35);
  outline-offset: 1px;
  border-color: var(--accent);
}

.key-mode-chord-voicing-select:focus-visible {
  outline: 2px solid rgba(169, 70, 115, 0.35);
  outline-offset: 1px;
  border-color: var(--accent);
}

.key-mode-chord-play {
  width: 100%;
  margin: 0;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1.5px solid var(--accent);
  background: linear-gradient(to bottom, var(--accent-soft), #f9d0e0);
  color: var(--accent-dark);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  transition: all 0.15s ease;
}

.key-mode-chord-play.chord-btn-two-line {
  min-height: 36px;
}

.key-mode-chord-play:hover {
  background: linear-gradient(to bottom, var(--accent), #c85f8f);
  color: white;
  border-color: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(90, 35, 60, 0.2);
}

.key-mode-chord-add-btn {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 18px;
  height: 18px;
  min-width: unset;
  min-height: unset;
  margin: 0;
  padding: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #9a5d78;
  border: 1px solid rgba(225, 138, 178, 0.9);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(90, 35, 60, 0.12);
  opacity: 0;
  transform: scale(0.92);
  pointer-events: none;
  transition: all 0.2s ease;
}

.key-mode-chord-actions:hover .key-mode-chord-add-btn,
.key-mode-chord-add-btn:focus-visible {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

@media (max-width: 900px) {
  .key-mode-selection-bar {
    align-items: stretch;
  }

  .key-mode-selection-controls {
    width: 100%;
    justify-content: stretch;
    flex-direction: column;
  }

  .key-mode-selection-field {
    justify-content: space-between;
  }
}

.key-mode-chord-add-btn:hover {
  background: linear-gradient(to bottom, #fff, #f8e6ef);
  color: var(--accent-dark);
  border-color: var(--accent);
  box-shadow: 0 2px 4px rgba(90, 35, 60, 0.18);
}

.app-tooltip {
  display: none;
  position: fixed;
  z-index: 9999;
  background: rgba(40, 20, 30, 0.88);
  color: #fff;
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 400;
  font-family: inherit;
  white-space: pre-line;
  pointer-events: none;
  line-height: 1.4;
  max-width: 240px;
}

.circle-container {
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: auto;
  flex: 1 1 auto;
}

.root-style-row {
  display: flex;
  align-items: center; /* center vertically with style select */
  gap: 12px;
}

.sequence-keyboard-mount {
  margin-bottom: 12px;
}

.sequence-keyboard-shell {
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}

.sequence-keyboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.sequence-keyboard-title-block {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1 1 220px;
  min-width: 0;
}

.sequence-keyboard-header-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.sequence-keyboard-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.sequence-keyboard-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-dark);
}

.sequence-keyboard-chord-name {
  font-size: clamp(15px, 1.9vw, 17px);
  font-weight: 700;
  color: var(--accent-dark);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.sequence-keyboard-help-btn {
  margin-left: -2px;
}

.sequence-keyboard-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 1 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.sequence-keyboard-toolbar-mount {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  justify-content: flex-end;
}

.sequence-keyboard-toolbar {
  margin-top: 0;
  justify-content: flex-end;
}

.sequence-keyboard-action {
  --icon-size: 16px;
  width: 38px;
  min-width: 38px;
  height: 38px;
  border-radius: 12px;
}

.sequence-keyboard-insert-control {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.sequence-keyboard-insert-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  box-shadow: 0 8px 18px rgba(90, 35, 60, 0.12);
}

.sequence-keyboard-inline-choice-btn {
  width: auto;
  min-width: 0;
  margin: 0;
  padding: 6px 10px;
  border-radius: 999px;
  background: white;
  color: var(--muted);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.sequence-keyboard-inline-choice-btn:hover {
  background: #f8e6ef;
  color: var(--accent-dark);
}

.sequence-keyboard-inline-choice-btn-cancel {
  min-width: 30px;
  padding-inline: 8px;
}

.sequence-piano {
  overflow-x: auto;
  padding-bottom: 2px;
}

.sequence-bass-lane {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(214, 192, 204, 0.7);
}

.sequence-bass-lane-label {
  flex: 0 0 auto;
  min-width: 32px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sequence-bass-keys {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  gap: 4px;
  width: 100%;
  min-width: 0;
}

.sequence-bass-key {
  width: 100%;
  min-height: 34px;
  margin: 0;
  padding: 0 0 5px;
  border-radius: 8px;
  border: 1px solid #d6c0cc;
  background: linear-gradient(to bottom, #fff 0%, #f7edf3 100%);
  color: #8c7281;
  display: inline-flex;
  align-items: end;
  justify-content: center;
}

.sequence-bass-key .sequence-key-label {
  font-size: 12px;
  letter-spacing: -0.02em;
}

.sequence-bass-key:hover {
  background: linear-gradient(to bottom, #fff 0%, #f2dce6 100%);
  color: var(--accent-dark);
}

.sequence-bass-key.sequence-key-active {
  background: linear-gradient(to bottom, #ffe7f1 0%, #f7c9db 100%);
  color: var(--accent-dark);
  border-color: var(--accent);
}

.sequence-piano-stage {
  position: relative;
  width: 100%;
  min-width: 0;
}

.sequence-piano-whites {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(28, minmax(0, 1fr));
  gap: 2px;
  min-width: 0;
  width: 100%;
}

.sequence-piano-blacks {
  position: absolute;
  inset: 0 0 auto 0;
  height: 0;
  width: 100%;
  z-index: 2;
}

.sequence-key {
  position: relative;
  margin: 0;
  border: 1px solid #d6c0cc;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.sequence-key-label {
  pointer-events: none;
}

.sequence-key-white {
  min-height: 132px;
  padding: 0 0 10px;
  border-radius: 0 0 12px 12px;
  background: linear-gradient(to bottom, #fff 0%, #f7edf3 100%);
  color: #8d6077;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}

.sequence-key-black {
  position: absolute;
  z-index: 3;
  top: 0;
  width: calc((100% / 28) * 0.62);
  min-height: 78px;
  padding: 0 2px 10px;
  border-radius: 0 0 9px 9px;
  background: linear-gradient(to bottom, #755367 0%, #4f3848 100%);
  color: rgba(255, 255, 255, 0.92);
  border-color: #452f3d;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  font-size: 10px;
  z-index: 2;
  transform: translateX(-50%);
}

.sequence-key-white:hover {
  background: linear-gradient(to bottom, #fff 0%, #f2dce6 100%);
  color: var(--accent-dark);
}

.sequence-key-black:hover {
  background: linear-gradient(to bottom, #8f667c 0%, #614554 100%);
}

.sequence-key-active.sequence-key-white {
  background: linear-gradient(to bottom, #ffe7f1 0%, #f7c9db 100%);
  color: var(--accent-dark);
  border-color: var(--accent);
}

.sequence-key-active.sequence-key-black {
  background: linear-gradient(to bottom, #cc739a 0%, #9f4f73 100%);
  color: white;
  border-color: #87415f;
}

.sequence-key-flash {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.92), 0 0 0 2px rgba(255, 214, 102, 0.85);
}

.chord-root-controls {
  display: flex;
  flex-direction: row;
  gap: 10px;
  margin-bottom: 30px;
  align-items: stretch;
}

.compact-root-mount {
  flex: 1 1 0;
  min-width: 0;
}

.compact-root-selector {
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 9px;
  height: 100%;
}

.compact-root-title {
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.compact-root-row {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 6px;
}

.compact-root-btn {
  width: 100%;
  margin: 0;
  padding: 5px 2px;
  border-radius: 7px;
  background: linear-gradient(to bottom, var(--accent-soft), #f9d0e0);
  color: var(--accent-dark);
  border: 1.5px solid var(--accent);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.1;
}

.compact-root-btn:hover {
  background: linear-gradient(to bottom, var(--accent), #c85f8f);
  color: white;
}

.compact-root-btn.active {
  background: linear-gradient(to bottom, var(--accent), #a94673);
  color: white;
  border-color: var(--accent-dark);
}

.style-container {
  min-width: 160px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  gap: 8px;
  height: 100%;
}

.root-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed; /* equal-width cells */
}

.root-table td {
  padding: 4px;
  text-align: center;
  vertical-align: middle;
  width: calc(100% / 12);
}

.root-table .key-chord-main {
  padding: 6px 8px;
  width: 100%;
  box-sizing: border-box;
  font-size: 13px; /* slightly smaller to keep equal widths */
}

.circle-root-btn {
  width: 100%;
  margin: 0;
  min-height: 34px;
  padding: 5px 3px;
  border-radius: 9px;
  border: 1.5px solid var(--accent);
  background: linear-gradient(to bottom, var(--accent-soft), #f9d0e0);
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.1;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.circle-root-btn:hover {
  background: linear-gradient(to bottom, #f8dce8, #f3cade);
  color: var(--accent-dark);
  border-color: #d76f9e;
  box-shadow: 0 2px 8px rgba(169, 70, 115, 0.12);
  transform: translateY(-1px);
}

.circle-root-btn.root-btn-active {
  background: linear-gradient(to bottom, #cf6e9b, #a94673);
  color: white;
  border-color: var(--accent-dark);
  box-shadow: 0 4px 10px rgba(169, 70, 115, 0.2);
}

.select-root-style-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 8px;
}

/* Match the visual style of other info tables/cards */
.select-root-style-table {
  background: var(--panel-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--module-card-radius);
  /* remove this */
  /* padding: 8px; */
  overflow: hidden; /* keeps rounded corners clean */
  box-shadow: var(--module-card-shadow);
}

.select-root-style-title {
  text-align: left;
}

.select-root-style-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--panel-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--module-card-radius);
  overflow: hidden;
}

.select-root-style-table td {
  padding: 10px;
}

.select-root-style-table .style-container label {
  margin-bottom: 6px;
}

.select-root-style-table .style-container select {
  width: 100%;
  min-height: 34px;
  margin-bottom: 0;
  padding: 5px 10px;
  border-radius: 9px;
  border: 1.5px solid rgba(230, 201, 214, 0.92);
  background: linear-gradient(to bottom, #fffdfd, #fdf4f8);
  font-size: 14px;
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.select-root-style-table td.root-cell {
  width: 100%;
  vertical-align: middle;
  padding: 10px;
}

.select-root-style-table td.style-cell {
  width: 220px;
  padding: 10px 12px;
  vertical-align: middle;
}

.select-root-style-table .circle-container {
  justify-content: center; /* center buttons horizontally */
  align-items: center; /* center vertically */
}

.circle-svg {
  width: 100%;
  max-width: 608px;
  height: auto;
}

textarea {
  resize: vertical;
  min-height: 88px;
  font-family: inherit;
}

.input-help {
  margin-top: -2px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 14px;
}

.suggest-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  width: auto;
  white-space: nowrap;
}

.suggest-toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.suggest-toggle span {
  font-size: 13px;
  line-height: 1.3;
}

/* Chord Loader Section */
.chord-loader {
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 12px;
}

.chord-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chord-explorer-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid rgba(230, 201, 214, 0.58);
  color: #876876;
  font-size: 11px;
  font-weight: 600;
}

.chord-explorer-legend-inline {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: nowrap;
  color: #8a6d7c;
  font-size: 10px;
  white-space: nowrap;
}

.chord-explorer-legend-inline .chord-explorer-legend-item {
  gap: 4px;
}

.chord-explorer-legend-inline .chord-explorer-legend-swatch {
  width: 24px;
  height: 14px;
  border-radius: 6px;
}

.chord-explorer-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chord-explorer-legend-swatch {
  width: 28px;
  height: 16px;
  border-radius: 7px;
  display: inline-flex;
  border: 1.5px solid #e5c2d0;
  background: #fff;
  box-sizing: border-box;
}

.chord-explorer-legend-swatch-primary {
  background: linear-gradient(to bottom, #ef91ba, #de84a9);
  border-color: #cf89ab;
}

.chord-explorer-legend-swatch-related {
  background: linear-gradient(to bottom, #f8e5ee, #f3d5e3);
  border-color: #cf89ab;
}

.chord-explorer-legend-swatch-none {
  background: #fff;
  border-color: #e4c2d0;
}

.chord-loader-filters {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  margin-bottom: 0;
}

.chord-loader-filter-btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: white;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.chord-loader-filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.chord-loader-filter-btn.active {
  border-color: var(--accent);
  background: linear-gradient(to bottom, var(--accent-soft), #f9d0e0);
  color: var(--accent-dark);
  box-shadow: 0 1px 4px rgba(90, 35, 60, 0.12);
}

.chord-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 10px 10px;
  border-radius: 10px;
  border: 1px solid rgba(225, 138, 178, 0.1);
  background: rgba(255, 246, 250, 0.82);
}

.chord-group-row {
  display: grid;
  gap: 14px;
}

.chord-group-row-paired {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.chord-group-row-single {
  grid-template-columns: minmax(0, 1fr);
}

.chord-group-title {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.1;
  min-height: 14px;
}

.chord-group-strong .chord-group-title {
  color: var(--text);
  font-size: 12px;
}

.chord-group-strong {
  background: linear-gradient(to bottom, rgba(255, 225, 238, 0.96), rgba(255, 239, 247, 0.9));
}

.chord-group-normal .chord-group-title {
  color: #6e5b67;
}

.chord-group-normal {
  background: linear-gradient(to bottom, rgba(255, 232, 243, 0.92), rgba(255, 244, 249, 0.86));
}

.chord-group-soft .chord-group-title {
  color: #8b7380;
}

.chord-group-soft {
  background: linear-gradient(to bottom, rgba(252, 236, 244, 0.88), rgba(255, 246, 250, 0.82));
}

.chord-group-softer .chord-group-title {
  color: #9a8290;
}

.chord-group-softer {
  background: linear-gradient(to bottom, rgba(249, 235, 242, 0.84), rgba(254, 245, 249, 0.78));
}

.chord-group-lowest .chord-group-title {
  color: #a6919d;
}

.chord-group-lowest {
  background: linear-gradient(to bottom, rgba(247, 235, 240, 0.8), rgba(253, 246, 249, 0.74));
}

.chord-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 10px 8px;
  align-items: start;
}

.chord-group-grid-extended {
  grid-template-columns: repeat(8, minmax(0, 1fr));
}

.chord-button-wrapper {
  position: relative;
  width: 100%;
  height: auto;
  align-self: start;
}

.chord-btn {
  position: relative;
  padding: 8px 12px;
  background: #fff;
  color: #9f4f73;
  border: 1.5px solid var(--accent);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s ease;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  height: auto;
  line-height: 1.2;
  gap: 2px;
  opacity: 1;
}

.chord-btn[data-match-level="primary"] {
  background: linear-gradient(to bottom, #ef91ba, #de84a9);
  color: #fff;
  border-color: #cf89ab;
  box-shadow: 0 2px 6px rgba(137, 72, 104, 0.12);
}

.chord-btn[data-match-level="primary"] .chord-btn-main {
  color: #ffffff;
  font-weight: 700;
}

.chord-btn[data-match-level="primary"] .chord-btn-detail {
  color: rgba(255, 255, 255, 0.88);
  opacity: 1;
}

.chord-btn[data-match-level="related"] {
  background: linear-gradient(to bottom, #f8e5ee, #f3d5e3);
  color: #bc7897;
  border-color: #cf89ab;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.34);
}

.chord-btn[data-match-level="related"] .chord-btn-main {
  color: #8d4769;
  font-weight: 700;
}

.chord-btn[data-match-level="related"] .chord-btn-detail {
  color: #865f72;
  opacity: 0.92;
}

.chord-btn[data-match-level="none"] {
  border-color: #e4c2d081;
  color: #bf94a7;
  box-shadow: none;
}

.chord-btn[data-match-level="none"] .chord-btn-main {
  color: #ad758f;
}

.chord-btn[data-match-level="none"] .chord-btn-detail {
  color: #b392a2;
  opacity: 0.76;
}

.chord-btn-two-line {
  min-height: 46px;
}

.chord-group-altered .chord-btn {
  min-height: 46px;
}

.chord-group-altered .chord-btn-detail {
  font-size: 9px;
  line-height: 1.05;
}

.chord-btn-main {
  display: block;
  line-height: 1.25;
}

.chord-btn-detail {
  display: block;
  font-size: 10px;
  font-weight: 600;
  opacity: 0.84;
  line-height: 1.15;
}

.chord-btn:hover {
  background: linear-gradient(to bottom, var(--accent), #c85f8f);
  color: white;
  border-color: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(90, 35, 60, 0.2);
  opacity: 1;
}

.chord-btn:hover .chord-btn-main,
.chord-btn:hover .chord-btn-detail {
  color: white;
}

.chord-btn[data-match-level="primary"]:hover,
.chord-btn[data-match-level="related"]:hover {
  background: linear-gradient(to bottom, var(--accent), #c85f8f);
  border-color: var(--accent-dark);
  box-shadow: 0 2px 6px rgba(90, 35, 60, 0.2);
}

.chord-btn[data-match-level="primary"]:hover .chord-btn-main,
.chord-btn[data-match-level="primary"]:hover .chord-btn-detail,
.chord-btn[data-match-level="related"]:hover .chord-btn-main,
.chord-btn[data-match-level="related"]:hover .chord-btn-detail {
  color: white;
}

.chord-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(90, 35, 60, 0.15);
}

.chord-btn.active {
  background: linear-gradient(to bottom, var(--accent), #a94673);
  color: white;
  border-color: var(--accent-dark);
  opacity: 1;
}

/* Add button overlay */
.chord-add-btn {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 18px;
  height: 18px;
  padding: 0;
  min-width: unset;
  min-height: unset;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #9a5d78;
  border: 1px solid rgba(225, 138, 178, 0.9);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(90, 35, 60, 0.12);
  opacity: 0;
  transform: scale(0.92);
  pointer-events: none;
}

.chord-button-wrapper:hover .chord-add-btn {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.chord-add-btn:focus-visible {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.chord-add-btn:hover {
  background: linear-gradient(to bottom, #fff, #f8e6ef);
  color: var(--accent-dark);
  border-color: var(--accent);
  box-shadow: 0 2px 4px rgba(90, 35, 60, 0.18);
}

@media (hover: none) {
  .chord-add-btn {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
  }

  .key-mode-chord-add-btn {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
  }
}

/* Suggestion Panel Styles */
.suggestions-wrapper {
  width: 100%;
}

.suggestions-feedback {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px;
  background: var(--panel-soft);
  border-radius: 6px;
  border-left: 3px solid var(--accent);
}

.suggestion-feedback-item {
  font-size: 13px;
}

.suggestion-feedback-item strong {
  color: var(--text);
  font-weight: 600;
  display: block;
  margin-bottom: 2px;
}

.suggestion-feedback-text {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.suggestion-feedback-item.invalid {
  border-left: none;
  padding-left: 0;
}

.suggestion-feedback-item.invalid strong {
  color: #d63031;
}

.suggestions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
}

.suggestion-group {
  margin-top: 10px;
}

.suggestion-group:first-of-type {
  margin-top: 0;
}

.suggestion-group-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 2px;
}

.suggestion-group-title {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.suggestion-group-description {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
}

.suggestions-wrapper > .theory-legend {
  margin-bottom: 10px;
}

.suggestions-grid-best {
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
}

.suggestions-grid-secondary {
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
}

.suggestion-card {
  position: relative;
}

.suggestion-card[data-intent="reopen"] {
  background: none;
  border-color: transparent;
}

.suggestion-card[data-intent="tension"] {
  background: none;
  border-color: transparent;
}

.suggestion-card[data-intent="colour"] {
  background: none;
  border-color: transparent;
}

.suggestion-card[data-intent="hold"] {
  background: none;
  border-color: transparent;
}

.suggestion-card-chord {
  min-height: 44px;
}

.suggestion-card-add-btn {
  top: 6px;
  left: 6px;
}

.suggestions-empty {
  text-align: center;
  padding: 30px 20px;
  color: var(--muted);
  font-size: 14px;
}

.suggestion-detail-host {
  margin-top: 12px;
}

.suggestion-detail {
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 2px 6px rgba(90, 35, 60, 0.08);
}

.suggestion-detail-meta {
  font-size: 14px;
  margin-bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.suggestion-detail-intent {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(244, 216, 230, 0.72);
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.suggestion-detail-meta .chord-label-friendly {
  color: var(--accent-dark);
  font-size: 16px;
}

.suggestion-detail-meta .chord-label-theory {
  display: inline;
  margin-top: 0;
}

.suggestion-detail-function {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.suggestion-detail-reason {
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}

.suggestion-detail-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.suggestion-detail-play-btn,
.suggestion-detail-add-btn {
  width: auto;
  min-width: 0;
  margin-bottom: 0;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--accent);
  cursor: pointer;
  transition: all 0.2s ease;
}

.suggestion-detail-play-btn {
  background: var(--accent);
  color: white;
}

.suggestion-detail-play-btn:hover {
  background: var(--accent-dark);
}

.suggestion-detail-add-btn {
  background: var(--add-btn-bg);
  color: var(--add-btn-text);
  border-color: var(--add-btn-border);
}

.suggestion-detail-add-btn:hover {
  background: var(--add-btn-hover);
}

@media (max-width: 768px) {
  .page {
    margin: 16px auto;
    padding: 12px;
  }

  .suggestion-engine-controls {
    align-items: stretch;
  }

  .suggestion-engine-controls > select {
    width: 100%;
    min-width: 0;
  }

  .suggest-refresh-btn {
    width: 100%;
  }

  .suggest-toggle {
    white-space: normal;
  }

  .panel {
    padding: 12px;
    margin-top: 16px;
  }

  .select-root-style-table,
  .select-root-style-table thead,
  .select-root-style-table tbody,
  .select-root-style-table tr,
  .select-root-style-table th,
  .select-root-style-table td {
    display: block;
    width: 100%;
    box-sizing: border-box;
  }

  .select-root-style-table thead {
    display: none;
  }

  .select-root-style-table tr {
    display: flex;
    flex-direction: column;
  }

  .select-root-style-table td.root-cell,
  .select-root-style-table td.style-cell {
    width: 100%;
    padding: 10px;
  }

  .select-root-style-table td.style-cell {
    border-top: 1px solid var(--border);
  }

  .style-container {
    min-width: 0;
    width: 100%;
  }

  .circle-container {
    overflow-x: auto;
    overflow-y: hidden;
    justify-content: flex-start;
    padding-bottom: 6px;
  }

  .circle-svg {
    width: 100%;
    min-width: 320px;
    max-width: 100%;
    height: auto;
  }

  .key-summary-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    line-height: 1.4;
  }

  .key-summary-line {
    align-items: flex-start;
    gap: 6px;
  }

  .key-mode-details {
    grid-template-columns: 1fr;
  }

  .compact-root-row {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .chord-root-controls {
    flex-direction: column;
  }

  .chord-group-row-paired {
    grid-template-columns: 1fr;
  }

  .chord-loader-filters {
    flex-wrap: wrap;
  }

  .chord-loader-filter-btn {
    flex: 1 1 100%;
  }

  .key-mode-chords-grid,
  .chord-group-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chord-group-grid-extended {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }


  .sequence-keyboard-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .sequence-keyboard-header-tools {
    width: 100%;
    justify-content: flex-end;
  }

  .sequence-keyboard-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .sequence-keyboard-action {
    flex: 0 0 auto;
    min-width: 38px;
  }

  .sequence-key-white {
    min-height: 108px;
  }

  .sequence-key-black {
    width: 22px;
    min-height: 66px;
  }

  .sequence-piano-whites {
    min-width: 0;
  }

  .sequence-bass-lane {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .sequence-bass-lane-label {
    min-width: 0;
  }

  .sequence-bass-keys {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }

  .sequence-bass-key {
    min-height: 32px;
  }

  textarea {
    min-height: 96px;
  }

  .progression-builder-shell {
    grid-template-columns: 1fr;
  }

  .progression-editor-fields {
    grid-template-columns: 1fr;
  }

  .progression-toolbar-row {
    align-items: stretch;
  }

  .sequence-panel-actions {
    width: 100%;
  }

  .sequence-keyboard-toolbar-mount {
    width: 100%;
    justify-content: flex-end;
  }

  .sequence-panel-action-shell-danger {
    margin-left: 0;
  }
}
