:root {
  --bg-canvas: #FFFFFF;
  --bg-toolbar-top: #F6F7FA;
  --bg-toolbar-bottom: #E4E7EF;
  --border-chrome: #C5CBD8;
  --border-subtle: #DCE0EA;

  --ink-primary: #14161C;
  --ink-secondary: #3E4554;
  --ink-muted: #5C6475;

  --accent-blue: #2563EB;
  --accent-blue-bright: #3B82F6;
  --accent-blue-soft: #DBEAFE;
  --accent-blue-ink: #1E3A8A;

  --accent-lh: #D97706;
  --accent-lh-bright: #F59E0B;
  --accent-lh-soft: #FEF3C7;
  --accent-lh-ink: #78350F;

  --accent-emerald: #059669;
  --accent-amber: #D97706;

  --sustain-on: #16A34A;
  --sustain-off: #94A3B8;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

::selection {
  background-color: var(--accent-blue-soft);
  color: var(--accent-blue-ink);
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-canvas);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
}

/* Custom Scrollbars for Dialogs */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #F1F3F8;
}

::-webkit-scrollbar-thumb {
  background: #B8C0D0;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #8E97AB;
}

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

.app-shell {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100dvh;
  background-color: var(--bg-canvas);
}

/* =========================================================
   1. Top Classic Studio Toolbar (Chordie Reference Style)
   ========================================================= */
.studio-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 6px 14px;
  background: linear-gradient(180deg, var(--bg-toolbar-top) 0%, var(--bg-toolbar-bottom) 100%);
  border-bottom: 1px solid var(--border-chrome);
  box-shadow: 0 1px 3px rgba(20, 22, 28, 0.06);
  flex-shrink: 0;
  flex-wrap: wrap;
  z-index: 20;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

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

.toolbar-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-secondary);
  white-space: nowrap;
}

.studio-btn {
  appearance: none;
  background: linear-gradient(180deg, #FFFFFF 0%, #EEF0F6 100%);
  color: var(--ink-primary);
  border: 1px solid #B4BCCB;
  border-radius: 14px;
  padding: 4px 13px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(20, 22, 28, 0.06);
  transition: background-color 120ms ease-out, border-color 120ms ease-out, transform 80ms ease-out;
  white-space: nowrap;
}

.studio-btn:hover {
  background: linear-gradient(180deg, #FFFFFF 0%, #E3E7F2 100%);
  border-color: #939DB2;
}

.studio-btn:active {
  transform: translateY(1px);
}

.studio-btn-compact {
  padding: 4px 10px;
  font-size: 12px;
}

.studio-btn-active {
  background: linear-gradient(180deg, #2563EB 0%, #1D4ED8 100%);
  color: #FFFFFF;
  border-color: #1E40AF;
}

.studio-btn-active:hover {
  background: linear-gradient(180deg, #3B82F6 0%, #2563EB 100%);
  border-color: #1E3A8A;
}

.studio-btn-primary {
  background: var(--accent-blue);
  color: #FFFFFF;
  border-color: #1D4ED8;
  border-radius: 8px;
  padding: 7px 18px;
}

.studio-btn-primary:hover {
  background: #1D4ED8;
}

.studio-select {
  background-color: #FFFFFF;
  color: var(--ink-primary);
  border: 1px solid #B4BCCB;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(20, 22, 28, 0.04);
}

.midi-status-wrapper {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.72);
  padding: 2px 8px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}

.midi-select {
  min-width: 220px;
  max-width: 310px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: var(--sustain-off);
  flex-shrink: 0;
  transition: background-color 180ms ease-out, box-shadow 180ms ease-out;
}

.status-dot.connected {
  background-color: var(--sustain-on);
  box-shadow: 0 1px 2px rgba(20, 22, 28, 0.18);
}

/* =========================================================
   2. Main Pure White Classroom Stage (Notes & Chords on Top)
   ========================================================= */
.classroom-stage {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background-color: #FFFFFF;
  padding: 8px 24px 6px 24px;
  min-height: 0;
  overflow: hidden;
}

/* Role Mode Switcher (Teacher Studio vs Student View) */
.role-mode-switcher {
  display: inline-flex;
  align-items: center;
  background-color: #E2E6F0;
  padding: 2px;
  border-radius: 16px;
  border: 1px solid #B8C0D2;
}

.role-switch-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 14px;
  cursor: pointer;
  transition: background-color 120ms ease-out, color 120ms ease-out;
  white-space: nowrap;
}

.role-switch-btn.active {
  background-color: var(--accent-blue);
  color: #FFFFFF;
  box-shadow: 0 1px 2px rgba(20, 22, 28, 0.18);
}

/* Hide Teacher-only controls when in Student View */
body[data-view-role="student"] .teacher-only-ctrl {
  display: none !important;
}

/* Student Classroom Bar (Shown in Student View) */
.student-mode-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 14px;
  background-color: #F0FDF4;
  border: 1px solid #BBF7D0;
  border-radius: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.student-bar-left,
.student-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.student-badge-pill {
  font-size: 11.5px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 6px;
  background-color: #15803D;
  color: #FFFFFF;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.student-status-text {
  font-size: 12.5px;
  font-weight: 600;
  color: #14532D;
}

.student-room-input {
  width: 195px;
  padding: 4px 10px;
  font-size: 12.5px;
  font-weight: 700;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  text-transform: uppercase;
}

/* Interactive Note Color Strip */
.note-color-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 12px;
  background-color: #F8FAFC;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.note-color-strip-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.note-strip-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-secondary);
  white-space: nowrap;
}

.studio-select-sm {
  padding: 3px 8px;
  font-size: 12px;
}

.quick-single-picker-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
  cursor: pointer;
}

.native-color-input-sm {
  width: 26px;
  height: 22px;
}

.note-pills-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.note-color-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 24px;
  padding: 0 7px;
  border-radius: 6px;
  color: #FFFFFF;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(20, 22, 28, 0.16);
  transition: transform 90ms ease-out;
}

.note-color-pill:hover {
  transform: translateY(-1px);
}

.note-color-pill.playing-now {
  outline: 2px solid var(--ink-primary);
  outline-offset: 1px;
  transform: translateY(-2px);
}

.note-color-pill input[type="color"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.notation-harmony-workspace {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(340px, 56%) minmax(260px, 44%);
  align-items: center;
  gap: 20px;
  min-height: 0;
  width: 100%;
  max-width: 1520px;
  margin: 0 auto;
}

.staff-region {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
  min-height: 0;
  position: relative;
}

.staff-key-caption {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-secondary);
  margin-left: 112px;
  margin-bottom: -4px;
  letter-spacing: -0.01em;
}

.staff-canvas-container {
  width: 100%;
  height: 100%;
  max-height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.grand-staff-svg {
  width: 100%;
  height: 100%;
  max-height: 350px;
  overflow: visible;
}

/* Right Side: Chord Name, Slash Chords & Active Key Badges */
.chord-region {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding-left: 12px;
  gap: 18px;
}

.chord-display-block {
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.primary-chord-name {
  margin: 0 0 8px 0;
  font-size: clamp(2.1rem, 3.8vw, 3.5rem);
  font-weight: 500;
  color: var(--ink-primary);
  letter-spacing: -0.025em;
  line-height: 1.08;
}

.secondary-chord-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.secondary-chord-item {
  font-size: clamp(1.05rem, 1.7vw, 1.45rem);
  font-weight: 500;
  color: var(--ink-secondary);
  letter-spacing: -0.01em;
  line-height: 1.28;
}

/* Pressed Keys Readout Box */
.pressed-keys-panel {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-top: 8px;
  border-top: 1px solid #EAECEF;
  width: 100%;
  max-width: 520px;
}

.pressed-keys-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pressed-keys-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 30px;
  align-items: center;
}

.key-readout-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 6px;
  background-color: var(--accent-blue);
  color: #FFFFFF;
  font-size: 13.5px;
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(20, 22, 28, 0.16);
}

.key-readout-badge.lh-badge {
  background-color: var(--accent-lh);
  box-shadow: 0 2px 4px rgba(20, 22, 28, 0.16);
}

.key-readout-badge .badge-midi-sub {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.88;
}

.empty-keys-placeholder {
  font-size: 13px;
  color: var(--ink-muted);
  font-style: italic;
}

/* Stage Footer Bar (Sustain Indicator + Hint) */
.stage-footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 4px;
  flex-shrink: 0;
}

.sustain-indicator {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 3px 8px 3px 4px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  color: var(--ink-secondary);
  font-size: 13px;
  font-weight: 600;
}

.sustain-indicator:hover {
  background-color: #F4F6FA;
  border-color: var(--border-subtle);
}

.sustain-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background-color: #CBD5E1;
  border: 1px solid #94A3B8;
  transition: background-color 100ms ease-out, box-shadow 100ms ease-out;
}

.sustain-indicator.active .sustain-dot {
  background-color: var(--sustain-on);
  border-color: #15803D;
  box-shadow: 0 1px 2px rgba(20, 22, 28, 0.2);
}

.sustain-indicator.active .sustain-text {
  color: #15803D;
}

.classroom-hint {
  font-size: 12px;
  color: var(--ink-muted);
  text-align: center;
}

.hand-legend {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-chip {
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
}

.legend-lh {
  background-color: var(--accent-lh-soft);
  color: var(--accent-lh-ink);
}

.legend-rh {
  background-color: var(--accent-blue-soft);
  color: var(--accent-blue-ink);
}

/* =========================================================
   3. Bottom Full 88-Key Interactive Piano (A0 to C8)
   ========================================================= */
.piano-dock {
  flex: 0 0 clamp(165px, 28dvh, 255px);
  display: flex;
  flex-direction: column;
  width: 100%;
  background-color: #FFFFFF;
  border-top: 2px solid #262932;
  position: relative;
  z-index: 15;
}

/* Callout Rail directly above the 88 keys showing floating badges for pressed keys */
.piano-key-callout-rail {
  position: relative;
  width: 100%;
  height: 24px;
  background: #F7F8FB;
  border-bottom: 1px solid #D5DAE4;
  overflow: hidden;
  flex-shrink: 0;
}

.key-callout-flag {
  position: absolute;
  top: 2px;
  transform: translateX(-50%);
  padding: 1px 6px;
  border-radius: 4px;
  background-color: var(--accent-blue);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(20, 22, 28, 0.2);
  pointer-events: none;
  z-index: 5;
}

.key-callout-flag.lh-flag {
  background-color: var(--accent-lh);
}

.piano-keyboard-wrapper {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  position: relative;
}

.piano-keyboard {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  background-color: #14161C;
}

/* 52 White Keys */
.piano-key-white {
  position: relative;
  flex: 1 1 calc(100% / 52);
  height: 100%;
  background: linear-gradient(180deg, #FFFFFF 0%, #FDFDFE 88%, #ECEFF5 100%);
  border-right: 1px solid #8E96A8;
  border-bottom: 1px solid #8E96A8;
  box-shadow: inset 0 -3px 0 #BFC5D2;
  border-radius: 0 0 4px 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding-bottom: 5px;
  z-index: 1;
  transition: background 45ms ease-out;
}

.piano-key-white:last-of-type {
  border-right: none;
}

/* 36 Black Keys */
.piano-key-black {
  position: absolute;
  top: 0;
  height: 63%;
  background: linear-gradient(180deg, #2B2F3A 0%, #14161C 82%, #0B0C10 100%);
  border: 1px solid #090A0D;
  border-radius: 0 0 3px 3px;
  box-shadow: inset 0 -4px 0 #050608, 1px 3px 5px rgba(0, 0, 0, 0.34);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding-bottom: 5px;
  z-index: 3;
  transition: background 45ms ease-out;
}

/* Octave Markers (C1..C8) at the bottom of C keys */
.key-octave-marker {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--ink-muted);
  pointer-events: none;
  line-height: 1;
}

/* Pressed Key Label Badge shown directly on the key */
.key-pressed-label {
  display: none;
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1.1;
  padding: 2px 3px;
  border-radius: 3px;
  pointer-events: none;
  text-align: center;
  margin-bottom: 3px;
  white-space: nowrap;
}

.piano-keyboard.show-all-labels .piano-key-white .key-pressed-label {
  display: block;
  color: var(--ink-muted);
  font-weight: 600;
  font-size: 9px;
}

/* Active / Pressed Key States */
.piano-key-white.active {
  background: linear-gradient(180deg, #60A5FA 0%, #2563EB 100%);
  box-shadow: inset 0 -2px 0 #1E3A8A;
}

.piano-key-black.active {
  background: linear-gradient(180deg, #3B82F6 0%, #1D4ED8 100%);
  box-shadow: inset 0 -2px 0 #1E3A8A, 0 2px 4px rgba(0, 0, 0, 0.35);
}

/* Hand Split Left-Hand Color Override */
.piano-key-white.active.lh-key {
  background: linear-gradient(180deg, #FBBF24 0%, #D97706 100%);
  box-shadow: inset 0 -2px 0 #78350F;
}

.piano-key-black.active.lh-key {
  background: linear-gradient(180deg, #F59E0B 0%, #B45309 100%);
  box-shadow: inset 0 -2px 0 #78350F, 0 2px 4px rgba(0, 0, 0, 0.35);
}

/* Emerald Theme Mode */
body[data-color-mode="emerald"] .piano-key-white.active {
  background: linear-gradient(180deg, #34D399 0%, #059669 100%);
  box-shadow: inset 0 -2px 0 #064E3B;
}
body[data-color-mode="emerald"] .piano-key-black.active {
  background: linear-gradient(180deg, #10B981 0%, #047857 100%);
}

/* Amber Theme Mode */
body[data-color-mode="amber"] .piano-key-white.active {
  background: linear-gradient(180deg, #FBBF24 0%, #D97706 100%);
  box-shadow: inset 0 -2px 0 #78350F;
}
body[data-color-mode="amber"] .piano-key-black.active {
  background: linear-gradient(180deg, #F59E0B 0%, #B45309 100%);
}

/* Sustain-held key tint (finger lifted while sustain pedal held) */
.piano-key-white.sustained:not(.active) {
  background: linear-gradient(180deg, #EFF6FF 0%, #BFDBFE 100%);
}

.piano-key-black.sustained:not(.active) {
  background: linear-gradient(180deg, #1E3A8A 0%, #172554 100%);
}

/* Always show high-contrast key label when key is pressed */
.piano-key-white.active .key-pressed-label,
.piano-key-black.active .key-pressed-label {
  display: block;
  background-color: rgba(20, 22, 28, 0.86);
  color: #FFFFFF;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.piano-key-white.active .key-octave-marker {
  color: #FFFFFF;
}

/* =========================================================
   4. Dialogs (Options & Supported Pianos Guide)
   ========================================================= */
.studio-dialog {
  border: none;
  border-radius: 12px;
  padding: 0;
  max-width: 520px;
  width: calc(100vw - 32px);
  background-color: #FFFFFF;
  color: var(--ink-primary);
  box-shadow: 0 14px 28px rgba(20, 22, 28, 0.22);
}

.studio-dialog-wide {
  max-width: 820px;
}

.studio-dialog::backdrop {
  background-color: rgba(20, 22, 28, 0.42);
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: linear-gradient(180deg, var(--bg-toolbar-top) 0%, var(--bg-toolbar-bottom) 100%);
  border-bottom: 1px solid var(--border-chrome);
}

.dialog-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.dialog-close-btn {
  appearance: none;
  background: transparent;
  border: none;
  font-size: 18px;
  color: var(--ink-secondary);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}

.dialog-close-btn:hover {
  background-color: rgba(20, 22, 28, 0.08);
}

.dialog-body {
  padding: 18px 20px;
  max-height: 70dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dialog-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  background-color: #FAFBFD;
}

.option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid #F0F2F7;
}

.option-label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-primary);
}

.option-checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
}

.studio-range {
  width: 180px;
  accent-color: var(--accent-blue);
}

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

.platform-guide-item {
  padding: 12px;
  border-radius: 8px;
  background-color: #F8FAFC;
  border: 1px solid var(--border-subtle);
}

.platform-guide-item h3 {
  margin: 0 0 6px 0;
  font-size: 13.5px;
  color: var(--accent-blue-ink);
}

.platform-guide-item p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink-secondary);
}

.studio-input {
  width: 100%;
  padding: 9px 12px;
  font-size: 13.5px;
  border: 1px solid var(--border-chrome);
  border-radius: 8px;
}

.piano-models-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.piano-brand-block {
  padding: 12px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background-color: #FFFFFF;
}

.piano-brand-block.featured-brand {
  border-color: #93C5FD;
  background-color: #F8FBFF;
}

.piano-brand-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.piano-brand-name {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink-primary);
}

.piano-connection-tag {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent-blue-ink);
  background-color: var(--accent-blue-soft);
  padding: 2px 8px;
  border-radius: 4px;
}

.piano-models-ul {
  margin: 4px 0 6px 0;
  padding-left: 18px;
  font-size: 12.5px;
  color: var(--ink-secondary);
  line-height: 1.5;
}

.piano-brand-note {
  margin: 0;
  font-size: 12px;
  color: var(--ink-muted);
}

/* =========================================================
   5. Color Customizer Controls & Swatches
   ========================================================= */
.studio-btn-color-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.color-dot-preview {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #2563EB;
  border: 1px solid rgba(20, 22, 28, 0.28);
  display: inline-block;
  flex-shrink: 0;
}

.color-section-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid #F0F2F7;
}

.color-section-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-secondary);
}

.preset-swatch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.swatch-preset-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 8px;
  border: 1px solid var(--border-chrome);
  background-color: #FFFFFF;
  color: var(--ink-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 120ms ease-out, border-color 120ms ease-out;
}

.swatch-preset-btn:hover {
  background-color: #F4F6FB;
  border-color: #8E97AB;
}

.swatch-circle {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(20, 22, 28, 0.2);
  flex-shrink: 0;
}

.color-pickers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #F0F2F7;
}

.color-picker-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background-color: #F8FAFC;
  border: 1px solid var(--border-subtle);
}

.picker-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-primary);
  cursor: pointer;
}

.picker-control-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.native-color-input {
  appearance: none;
  -webkit-appearance: none;
  width: 32px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border-chrome);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.native-color-input::-webkit-color-swatch-wrapper {
  padding: 2px;
}

.native-color-input::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}

.picker-hex-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-muted);
  min-width: 54px;
}

.per-note-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(98px, 1fr));
  gap: 8px;
}

.per-note-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 9px;
  border-radius: 6px;
  background-color: #F8FAFC;
  border: 1px solid var(--border-subtle);
}

.per-note-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-primary);
}

/* =========================================================
   6. Licensing & 2-Super-Admin Access Control Styles
   ========================================================= */
.studio-btn-admin {
  background: linear-gradient(180deg, #1E293B 0%, #0F172A 100%);
  color: #FFFFFF;
  border-color: #0F172A;
}

.studio-btn-admin:hover {
  background: linear-gradient(180deg, #334155 0%, #1E293B 100%);
  border-color: #0F172A;
}

.license-status-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  background-color: #F0FDF4;
  border: 1px solid #BBF7D0;
  flex-wrap: wrap;
}

.banner-role-title {
  font-size: 14px;
  font-weight: 700;
  color: #14532D;
}

.banner-device-sub {
  font-size: 12px;
  color: #166534;
  margin-top: 2px;
}

.super-admins-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.super-admin-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 8px;
  background-color: #F8FAFC;
  border: 1px solid var(--border-subtle);
}

.super-admin-card.active-admin {
  background-color: #EFF6FF;
  border-color: #93C5FD;
}

.super-admin-role {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink-primary);
}

.super-admin-key-line {
  font-size: 12px;
  color: var(--ink-secondary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.license-generator-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.generator-selects-row,
.checkout-config-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.newly-generated-key-box {
  padding: 10px 12px;
  border-radius: 8px;
  background-color: #EFF6FF;
  border: 1px solid #93C5FD;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-blue-ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.issued-licenses-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.license-record-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background-color: #F8FAFC;
  border: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.license-record-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.license-record-key {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-primary);
}

.license-record-meta {
  font-size: 12px;
  color: var(--ink-secondary);
}

.license-status-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
}

.license-status-pill.status-active {
  background-color: #DCFCE7;
  color: #14532D;
}

.license-status-pill.status-suspended {
  background-color: #FEF3C7;
  color: #78350F;
}

.license-status-pill.status-revoked {
  background-color: #FEE2E2;
  color: #7F1D1D;
}

.license-record-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Customer License Lock / Purchase Gate */
.gate-intro-text {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-secondary);
}

.gate-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gate-key-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 700;
  text-transform: uppercase;
}

.gate-error-msg {
  font-size: 12.5px;
  font-weight: 600;
  color: #B91C1C;
  background-color: #FEF2F2;
  padding: 7px 10px;
  border-radius: 6px;
}

.gate-buttons-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gate-btn-full {
  width: 100%;
  padding: 10px 16px;
  font-size: 14px;
}

.gate-purchase-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  background-color: #F8FAFC;
  border: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.gate-purchase-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12.5px;
  color: var(--ink-secondary);
}

.gate-buy-btn {
  text-decoration: none;
  color: var(--accent-blue-ink);
  background: var(--accent-blue-soft);
  border-color: #93C5FD;
}

.gate-quick-admin-fill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid #F0F2F7;
  font-size: 12px;
  color: var(--ink-muted);
  flex-wrap: wrap;
}

/* =========================================================
   7. Live Classroom Screen Share & Multi-Student Broadcast
   ========================================================= */
.studio-btn-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.studio-btn-live.broadcasting-now {
  background: linear-gradient(180deg, #DC2626 0%, #B91C1C 100%);
  color: #FFFFFF;
  border-color: #991B1B;
}

.studio-btn-live.watching-now {
  background: linear-gradient(180deg, #16A34A 0%, #15803D 100%);
  color: #FFFFFF;
  border-color: #14532D;
}

.live-pulse-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: #94A3B8;
  display: inline-block;
  flex-shrink: 0;
}

.studio-btn-live.broadcasting-now .live-pulse-dot,
.studio-btn-live.watching-now .live-pulse-dot {
  background-color: #FFFFFF;
}

.live-share-status-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  background-color: #F8FAFC;
  border: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.live-share-status-banner.active-live {
  background-color: #FEF2F2;
  border-color: #FECACA;
}

.live-share-status-banner.active-student {
  background-color: #F0FDF4;
  border-color: #BBF7D0;
}

.live-banner-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-primary);
}

.live-banner-sub {
  font-size: 12px;
  color: var(--ink-secondary);
  margin-top: 2px;
}

.live-modes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 14px;
}

.live-mode-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 10px;
  background-color: #F8FAFC;
  border: 1px solid var(--border-subtle);
}

.live-mode-card h3 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink-primary);
}

.live-mode-card p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink-secondary);
}

.live-form-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.live-form-row .studio-input {
  flex: 1 1 160px;
}

.teacher-active-room-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 8px;
  background-color: #EFF6FF;
  border: 1px solid #93C5FD;
}

.room-code-display-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.room-code-caption {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
  margin-right: 6px;
}

.room-code-badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 17px;
  font-weight: 800;
  color: var(--accent-blue-ink);
  letter-spacing: 0.03em;
}

.viewer-count-pill {
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 12px;
  background-color: #DCFCE7;
  color: #14532D;
}

.share-actions-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.screen-capture-preview-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: 8px;
  background-color: #14161C;
  color: #FFFFFF;
}

.screen-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
}

.screen-capture-video {
  width: 100%;
  max-height: 170px;
  border-radius: 6px;
  background-color: #000000;
  object-fit: contain;
}

.student-watching-box {
  padding: 10px 12px;
  border-radius: 8px;
  background-color: #DCFCE7;
  color: #14532D;
  font-size: 12.5px;
  line-height: 1.45;
}

/* =========================================================
   7B. Student Dual-Piano Mode (Teacher Stream + Student Own Piano)
   ========================================================= */
.student-layout-picker-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #14532D;
}

body[data-student-dual="true"] .piano-dock {
  flex: 0 0 clamp(128px, 21dvh, 188px);
}

.dual-deck-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 12px;
  font-size: 11.5px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.teacher-deck-banner {
  background-color: #EFF6FF;
  border-bottom: 1px solid #BFDBFE;
  color: #1E3A8A;
}

.student-deck-banner {
  background-color: #F0FDF4;
  border-bottom: 1px solid #BBF7D0;
  color: #14532D;
}

.deck-banner-left,
.deck-banner-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.deck-role-tag {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
}

.deck-role-tag.teacher-tag {
  background-color: #1D4ED8;
  color: #FFFFFF;
}

.deck-role-tag.student-tag {
  background-color: #15803D;
  color: #FFFFFF;
}

.deck-banner-desc {
  font-size: 11.5px;
  font-weight: 600;
  color: #1E3A8A;
}

.student-live-chord-label {
  font-size: 12px;
  color: #14532D;
}

.student-live-chord-label strong {
  font-weight: 800;
  color: #14161C;
}

.student-pressed-pills {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.student-mini-key-pill {
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  color: #FFFFFF;
  background-color: #2563EB;
}

.student-match-pill {
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 12px;
  background-color: #E2E8F0;
  color: #334155;
}

.student-match-pill.match-partial {
  background-color: #DBEAFE;
  color: #1E3A8A;
}

.student-match-pill.match-perfect {
  background-color: #15803D;
  color: #FFFFFF;
}

/* =========================================================
   8. Responsive Adaptations (iPad, iPhone, Android Tablets)
   ========================================================= */
@media (max-width: 960px) {
  .notation-harmony-workspace {
    grid-template-columns: 54% 46%;
    gap: 10px;
  }

  .classroom-stage {
    padding: 8px 14px 4px 14px;
  }

  .staff-key-caption {
    margin-left: 72px;
  }

  .midi-select {
    min-width: 160px;
  }
}

@media (max-width: 720px) {
  .notation-harmony-workspace {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
    gap: 6px;
  }

  .chord-display-block {
    min-height: 64px;
  }

  .primary-chord-name {
    font-size: 1.75rem;
  }

  .classroom-hint {
    display: none;
  }
}
