/* 
   OpenPiano - Umimbae Design System v2 Pro
   Cohesive Brand Identity: Terracotta (#C75B39), Dark Earth (#1A1412), Deep Charcoal (#0d0a09), Bone White (#F0EAE5)
   Full 100dvh CSS Grid Layout: Zero page-scrolling, High-density Canvas, Fluid Piano Keys
*/

:root {
  /* Umimbae Brand Colors */
  --bg-primary: #0d0a09;        /* Deep Charcoal Black */
  --bg-secondary: #14100e;      /* Rich Dark Cocoa */
  --bg-surface: #1e1715;        /* Dark Earth Card */
  --bg-surface-elevated: #281f1c;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(199, 91, 57, 0.35);

  --accent-terracotta: #c75b39;  /* Official Umimbae Accent */
  --accent-terracotta-light: #e07a5f;
  --accent-gold: #e5a93b;        /* Secondary Warm Amber */
  --accent-moss: #4A5D23;        /* Forest Moss */
  --accent-emerald: #10b981;     /* Hit Success */
  --accent-rose: #f43f5e;        /* Mistake warning */
  --accent-cyan: #38bdf8;

  --text-main: #F0EAE5;         /* Bone White */
  --text-muted: #a89f91;        /* Muted Earth */
  --text-dim: #73695c;

  --glow-terracotta: 0 0 22px rgba(199, 91, 57, 0.45);
  --glow-gold: 0 0 20px rgba(229, 169, 59, 0.45);
  --glow-emerald: 0 0 20px rgba(16, 185, 129, 0.45);

  --font-heading: 'Space Grotesk', 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'Space Mono', 'Fira Code', monospace;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

html, body {
  height: 100%;
  height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: hidden; /* No page-level scrollbars */
}

body {
  background: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-body);
  display: grid;
  grid-template-rows: auto 1fr auto; /* 1: Header, 2: Workspace, 3: Piano */
  user-select: none;
}

/* Ambient glow */
.ambient-glow {
  position: fixed;
  top: -15vw;
  left: 25vw;
  width: 50vw;
  height: 40vw;
  background: radial-gradient(circle, rgba(199, 91, 57, 0.12) 0%, rgba(229, 169, 59, 0.04) 50%, transparent 80%);
  pointer-events: none;
  z-index: 0;
}

/* Audio Autoplay Unlock Banner */
.audio-start-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 999;
  background: linear-gradient(90deg, #c75b39, #e5a93b);
  color: #fff;
  padding: 8px 16px;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  animation: slide-down 0.3s ease;
}

@keyframes slide-down {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

.start-banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Header */
.app-header {
  grid-row: 1;
  z-index: 100;
  background: rgba(13, 10, 9, 0.95);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  padding: 8px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-main);
}

.logo-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent-terracotta) 0%, var(--accent-gold) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.25rem;
  box-shadow: var(--glow-terracotta);
}

.brand-title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.brand-dot {
  color: var(--accent-terracotta);
}

.brand-tag {
  font-size: 0.62rem;
  font-family: var(--font-mono);
  background: rgba(199, 91, 57, 0.15);
  color: var(--accent-terracotta);
  border: 1px solid rgba(199, 91, 57, 0.3);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-left: 6px;
}

/* Mode Nav */
.mode-nav {
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  gap: 2px;
}

.mode-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 6px;
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.mode-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.mode-btn.active {
  color: #fff;
  background: linear-gradient(135deg, #c75b39 0%, #e07a5f 100%);
  box-shadow: var(--glow-terracotta);
  font-weight: 700;
}

/* Header Right Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.instrument-selector-box {
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 30px;
  padding: 3px 10px;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: border-color 0.2s ease;
}

.instrument-selector-box:hover {
  border-color: var(--border-accent);
}

.instrument-select {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 700;
  outline: none;
  cursor: pointer;
}

.instrument-select option {
  background: #14100e;
  color: #fff;
}

.midi-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 30px;
  padding: 5px 12px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
}

.midi-pill:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: var(--bg-surface-elevated);
}

.midi-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
  position: relative;
  transition: all 0.3s ease;
}

.midi-pill.connected {
  border-color: rgba(16, 185, 129, 0.4);
  color: var(--text-main);
  background: rgba(16, 185, 129, 0.1);
}

.midi-pill.connected .midi-indicator {
  background: var(--accent-emerald);
  box-shadow: 0 0 10px var(--accent-emerald);
}

.midi-indicator.activity {
  transform: scale(1.6);
  background: var(--accent-terracotta) !important;
  box-shadow: 0 0 14px var(--accent-terracotta) !important;
}

.tool-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1.05rem;
}

.tool-btn:hover {
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
  background: var(--bg-surface-elevated);
}

.tool-btn.active {
  color: var(--accent-gold);
  border-color: rgba(229, 169, 59, 0.4);
  background: rgba(229, 169, 59, 0.12);
  box-shadow: var(--glow-gold);
}

.back-btn {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  gap: 5px;
}

.back-btn:hover {
  color: #fff;
  border-color: var(--border-accent);
  background: var(--bg-surface-elevated);
}

/* Metronome Popover */
.metronome-popover {
  position: absolute;
  top: 58px;
  right: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  padding: 18px;
  width: 250px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7);
  z-index: 120;
  display: none;
  flex-direction: column;
  gap: 14px;
}

.metronome-popover.open {
  display: flex;
}

/* Layout Core */
.app-container {
  grid-row: 2;
  display: flex;
  min-height: 0;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.view-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

/* Sidebar Curriculum */
.course-sidebar {
  width: 340px;
  min-width: 340px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 40;
}

.course-sidebar.collapsed {
  display: none;
}

.sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(20, 16, 14, 0.9);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.sidebar-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-subtitle {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.course-stats-bar {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.stats-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.progress-track {
  height: 6px;
  background: var(--bg-surface-elevated);
  border-radius: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-terracotta), var(--accent-gold));
  border-radius: 10px;
  transition: width 0.4s ease;
}

/* Modules & Lessons */
.modules-list {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Curriculum Level Headers (Iniciante, Intermediário, Avançado) */
.curriculum-level-header {
  margin-top: 14px;
  margin-bottom: 2px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-color);
  border-left-width: 4px;
}

.curriculum-level-header:first-child {
  margin-top: 0;
}

.curriculum-level-header.level-beginner {
  border-left-color: var(--accent-emerald);
}

.curriculum-level-header.level-intermediate {
  border-left-color: var(--accent-gold);
}

.curriculum-level-header.level-advanced {
  border-left-color: var(--accent-terracotta);
}


.module-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.module-header {
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.module-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.module-number {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent-terracotta);
}

.module-name {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 700;
}

.module-arrow {
  color: var(--text-dim);
  font-size: 0.75rem;
  transition: transform 0.2s ease;
}

.module-card.open .module-arrow {
  transform: rotate(180deg);
}

.lessons-container {
  display: none;
  flex-direction: column;
  padding: 4px;
  gap: 2px;
}

.module-card.open .lessons-container {
  display: flex;
}

.lesson-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.8rem;
  border: 1px solid transparent;
}

.lesson-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
}

.lesson-item.active {
  background: rgba(199, 91, 57, 0.15);
  border-color: rgba(199, 91, 57, 0.4);
  color: var(--text-main);
  font-weight: 600;
}

.lesson-item.completed .lesson-check {
  color: var(--accent-emerald);
  font-size: 0.75rem;
  font-weight: 700;
}

.lesson-title-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lesson-badge {
  font-size: 0.68rem;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg-surface-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-weight: 700;
}

.lesson-item.active .lesson-badge {
  background: var(--accent-terracotta);
  color: #fff;
}

/* Stage Area */
.stage-area {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  box-sizing: border-box;
}

#stageCourse {
  justify-content: center;
  align-items: center;
  gap: 14px;
  flex-direction: row;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* ==============================================================
   Anatomical Hand Wings & Fingering Indicators (Desktop & Compact)
============================================================== */
.hand-wing {
  flex: 0 0 135px;
  width: 135px;
  min-width: 135px;
  max-width: 135px;
  height: 480px;
  max-height: 85%;
  background: rgba(20, 16, 14, 0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.55);
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10;
  box-sizing: border-box;
}

.hand-wing.is-resting {
  opacity: 0.46;
  filter: grayscale(35%);
  transform: scale(0.97);
  pointer-events: none;
}

.hand-wing.hand-wing-left:not(.is-resting) {
  border-color: rgba(56, 189, 248, 0.45);
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.65), 0 0 24px rgba(56, 189, 248, 0.18);
}

.hand-wing.hand-wing-right:not(.is-resting) {
  border-color: rgba(229, 169, 59, 0.45);
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.65), 0 0 24px rgba(229, 169, 59, 0.18);
}

.hand-wing-inner {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}

.hand-wing-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.hand-badge-tag {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 3px 8px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.hand-badge-tag.tag-left {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.hand-badge-tag.tag-right {
  background: rgba(249, 115, 22, 0.15);
  color: #f97316;
  border: 1px solid rgba(249, 115, 22, 0.35);
}

.hand-clef-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

.hand-svg-box {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 0;
}

.hand-svg {
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.55));
  overflow: visible;
}

/* Silhueta Única e Elegante da Mão */
.hand-silhouette {
  fill: rgba(255, 255, 255, 0.05);
  stroke: rgba(255, 255, 255, 0.24);
  stroke-width: 4px;
  stroke-linejoin: round;
  transition: all 0.2s ease;
}

.hand-wing-left:not(.is-resting) .hand-silhouette {
  fill: rgba(14, 165, 233, 0.08);
  stroke: rgba(14, 165, 233, 0.4);
}

.hand-wing-right:not(.is-resting) .hand-silhouette {
  fill: rgba(249, 115, 22, 0.08);
  stroke: rgba(249, 115, 22, 0.4);
}

/* Círculos com Números nos Dedos (1 a 5) - Sem Fade In (Acendimento Imediato) */
.finger-badge {
  cursor: default;
  transition: none !important;
  animation: none !important;
}

.finger-badge-circle {
  fill: rgba(18, 14, 12, 0.7);
  stroke: rgba(255, 255, 255, 0.15);
  stroke-width: 2.5px;
  transition: none !important;
  animation: none !important;
}

.finger-badge-num {
  font-family: var(--font-mono, monospace);
  font-size: 32px;
  font-weight: 800;
  fill: rgba(255, 255, 255, 0.35);
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
  transition: none !important;
  animation: none !important;
}

/* 1. Dedo Desligado / Apagado (Baixa opacidade, sem rastro) */
.finger-badge.is-off {
  opacity: 0.12 !important;
}

.finger-badge.is-off .finger-badge-circle {
  fill: rgba(0, 0, 0, 0.4) !important;
  stroke: rgba(255, 255, 255, 0.08) !important;
  stroke-width: 2px !important;
  filter: none !important;
}

.finger-badge.is-off .finger-badge-num {
  fill: rgba(255, 255, 255, 0.2) !important;
}

/* 2. Dedos que farão parte da lição mas ainda não foram tocados (Opacidade Média) */
.finger-badge.upcoming-target {
  opacity: 0.38 !important;
}

.hand-accent-left .finger-badge.upcoming-target .finger-badge-circle {
  fill: rgba(14, 165, 233, 0.12) !important;
  stroke: rgba(56, 189, 248, 0.5) !important;
  stroke-width: 2.5px !important;
  filter: none !important;
}

.hand-accent-left .finger-badge.upcoming-target .finger-badge-num {
  fill: #38bdf8 !important;
  font-weight: 700 !important;
}

.hand-accent-right .finger-badge.upcoming-target .finger-badge-circle {
  fill: rgba(249, 115, 22, 0.12) !important;
  stroke: rgba(249, 115, 22, 0.5) !important;
  stroke-width: 2.5px !important;
  filter: none !important;
}

.hand-accent-right .finger-badge.upcoming-target .finger-badge-num {
  fill: #fb923c !important;
  font-weight: 700 !important;
}

/* 3. Dedo Alvo Ativo AGORA - Mão Esquerda (Azul Puro - Acendimento Imediato) */
.hand-accent-left .finger-badge.active-target {
  opacity: 1 !important;
}

.hand-accent-left .finger-badge.active-target .finger-badge-circle {
  fill: #0ea5e9 !important;
  stroke: #ffffff !important;
  stroke-width: 4.5px !important;
  filter: drop-shadow(0 0 16px rgba(14, 165, 233, 0.95)) !important;
}

.hand-accent-left .finger-badge.active-target .finger-badge-num {
  fill: #031726 !important;
  font-weight: 900 !important;
}

/* 4. Dedo Alvo Ativo AGORA - Mão Direita (Laranja Puro - Acendimento Imediato) */
.hand-accent-right .finger-badge.active-target {
  opacity: 1 !important;
}

.hand-accent-right .finger-badge.active-target .finger-badge-circle {
  fill: #f97316 !important;
  stroke: #ffffff !important;
  stroke-width: 4.5px !important;
  filter: drop-shadow(0 0 16px rgba(249, 115, 22, 0.95)) !important;
}

.hand-accent-right .finger-badge.active-target .finger-badge-num {
  fill: #1f0b03 !important;
  font-weight: 900 !important;
}

/* 5. Toque Mecânico via Teclado MIDI (SEM VERDE: Azul na esquerda, Laranja na direita) */
.hand-accent-left .finger-badge.pressed-down .finger-badge-circle {
  fill: #38bdf8 !important;
  stroke: #ffffff !important;
  filter: drop-shadow(0 0 22px rgba(56, 189, 248, 1)) !important;
}

.hand-accent-left .finger-badge.pressed-down .finger-badge-num {
  fill: #02111d !important;
  font-weight: 900 !important;
}

.hand-accent-right .finger-badge.pressed-down .finger-badge-circle {
  fill: #ea580c !important;
  stroke: #ffffff !important;
  filter: drop-shadow(0 0 22px rgba(234, 88, 12, 1)) !important;
}

.hand-accent-right .finger-badge.pressed-down .finger-badge-num {
  fill: #ffffff !important;
  font-weight: 900 !important;
}

.hand-wing-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
}

.hand-status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-main);
  max-width: 100%;
}

.finger-active-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f97316;
  box-shadow: 0 0 6px #f97316;
}

.tag-left .finger-active-dot {
  background: #0ea5e9;
  box-shadow: 0 0 6px #0ea5e9;
}

.hand-sub-tip {
  font-size: 0.65rem;
  color: var(--text-dim);
  text-align: center;
}

/* ==============================================================
   Compact Hand Widget (Bottom Actions Bar on < 1100px)
============================================================== */
.hand-compact-container {
  display: none;
  align-items: center;
  justify-content: center;
}

.hand-compact-pill {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-color);
  border-radius: 30px;
  padding: 3px 12px;
  backdrop-filter: blur(8px);
}

.compact-hand-item {
  display: flex;
  align-items: center;
  gap: 8px;
  transition: opacity 0.25s ease;
}

.compact-hand-item.compact-resting {
  opacity: 0.35;
}

.compact-hand-svg {
  display: flex;
  align-items: center;
}

.compact-info {
  display: flex;
  flex-direction: column;
}

.compact-tag-sub {
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.compact-finger-label {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-main);
}

.compact-divider {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.12);
}

@media (max-width: 1100px) {
  .hand-wing {
    display: none !important;
  }
  .hand-compact-container {
    display: flex !important;
  }
  #stageCourse {
    flex-direction: column;
  }
  .lesson-board {
    width: 100% !important;
    max-width: 820px !important;
  }
}

/* Lesson Display Board */
.lesson-board {
  flex: 1 1 auto;
  max-width: 760px;
  min-width: 0;
  width: auto;
  margin: auto 0;
  background: rgba(20, 16, 14, 0.85);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 22px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.6);
  position: relative;
  z-index: 10;
  box-sizing: border-box;
}

.lesson-header-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.lesson-step-badge {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--accent-terracotta);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  background: rgba(199, 91, 57, 0.12);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid rgba(199, 91, 57, 0.25);
}

.hand-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-gold);
  background: rgba(229, 169, 59, 0.12);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid rgba(229, 169, 59, 0.3);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.lesson-title {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.4px;
}

/* Caixa Pedagógica de Educomunicação */
.pedagogy-box {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.pedagogy-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 0.83rem;
  line-height: 1.45;
}

.pedagogy-label {
  font-weight: 700;
  color: var(--accent-gold);
  white-space: nowrap;
  font-family: var(--font-heading);
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.pedagogy-text {
  color: var(--text-muted);
}

/* Sheet Music Staff Container */
.music-staff-container {
  width: 100%;
  height: 110px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 4px;
}

.staff-svg {
  width: 100%;
  height: 100%;
  max-width: 660px;
}

.staff-svg .clef {
  fill: var(--accent-gold);
  font-family: serif;
}

/* Target Note / Interactive Prompt Box */
.interactive-prompt-card {
  background: linear-gradient(180deg, rgba(30, 23, 21, 0.9) 0%, rgba(13, 10, 9, 0.95) 100%);
  border: 1.5px dashed rgba(199, 91, 57, 0.35);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}

.prompt-instruction {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
}

/* ==============================================================
   Fita Deslizante Centralizada (Sliding Note Tape / Rolling Window)
   Garante altura 100% fixa (74px), zero quebra de linha e zero scroll
   ============================================================== */
.target-keys-display {
  width: 100%;
  max-width: 580px;
  height: 74px;
  margin: 0 auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  user-select: none;
  mask-image: linear-gradient(to right, transparent 0%, rgba(0, 0, 0, 0.6) 8%, #000 20%, #000 80%, rgba(0, 0, 0, 0.6) 92%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0%, rgba(0, 0, 0, 0.6) 8%, #000 20%, #000 80%, rgba(0, 0, 0, 0.6) 92%, transparent 100%);
}

/* Mira Central de Foco (Spotlight Reticle) */
.note-tape-reticle {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 82px;
  height: 64px;
  border-radius: 10px;
  border: 1.5px dashed rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.02);
  pointer-events: none;
  z-index: 1;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.4);
}

.note-tape-reticle::before {
  content: '';
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid rgba(255, 255, 255, 0.6);
}

/* Trilho Deslizante 60fps */
.note-tape-track {
  position: absolute;
  left: 50%;
  top: 50%;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translate(0px, -50%);
  transition: transform 0.28s cubic-bezier(0.2, 0.85, 0.25, 1);
  will-change: transform;
  z-index: 2;
}

/* Item de Passo na Fita */
.tape-step-item {
  width: 74px;
  height: 60px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: rgba(18, 14, 12, 0.85);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  box-sizing: border-box;
  transition: transform 0.22s ease, opacity 0.22s ease, border-color 0.22s ease, background-color 0.22s ease, box-shadow 0.22s ease;
  position: relative;
  cursor: default;
}

.tape-step-item.single-item {
  width: 96px;
}

.tape-step-item.chord-item {
  width: auto;
  min-width: 105px;
  padding: 0 12px;
}

.tape-step-note {
  font-family: var(--font-mono, monospace);
  font-size: 1.25rem;
  font-weight: 900;
  line-height: 1.1;
  color: #ffffff;
}

.tape-step-sub {
  font-size: 0.62rem;
  font-weight: 700;
  font-family: var(--font-body);
  color: var(--text-muted);
}

.tape-step-finger {
  font-size: 0.58rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 1px 5px;
  border-radius: 4px;
  margin-top: 2px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
}

/* Checkmark de Nota Concluída */
.tape-done-check {
  position: absolute;
  top: 3px;
  right: 5px;
  font-size: 0.62rem;
  font-weight: 900;
  color: #10b981;
}

/* 1. Estado: Concluído (Passado - Discreto, Sem Rastro) */
.tape-step-item.is-done {
  opacity: 0.22;
  transform: scale(0.85);
  background: rgba(10, 8, 7, 0.6);
  border-color: rgba(255, 255, 255, 0.08);
}

.tape-step-item.is-done .tape-step-note {
  color: rgba(255, 255, 255, 0.45);
}

/* 2. Estado: Futuro / Próximas Notas (Antecipação com Opacidade Média) */
.tape-step-item.is-upcoming {
  opacity: 0.45;
  transform: scale(0.9);
  background: rgba(20, 16, 14, 0.75);
  border-color: rgba(255, 255, 255, 0.12);
}

/* 3. Estado: Ativo AGORA (Mira Centralizada) */
.tape-step-item.is-current {
  opacity: 1 !important;
  transform: scale(1.08) !important;
  background: rgba(30, 22, 18, 0.98);
}

/* Cores por mão no item ativo */
.tape-step-item.is-current.hand-right {
  border: 2px solid #f97316 !important;
  box-shadow: 0 0 16px rgba(249, 115, 22, 0.45), inset 0 0 8px rgba(249, 115, 22, 0.15) !important;
}

.tape-step-item.is-current.hand-right .tape-step-finger {
  background: rgba(249, 115, 22, 0.22);
  color: #fb923c;
}

.tape-step-item.is-current.hand-left {
  border: 2px solid #0ea5e9 !important;
  box-shadow: 0 0 16px rgba(14, 165, 233, 0.45), inset 0 0 8px rgba(14, 165, 233, 0.15) !important;
}

.tape-step-item.is-current.hand-left .tape-step-finger {
  background: rgba(14, 165, 233, 0.22);
  color: #38bdf8;
}

.tape-step-item.is-current.hand-both {
  border: 2px solid var(--accent-gold) !important;
  box-shadow: 0 0 16px rgba(229, 169, 59, 0.45), inset 0 0 8px rgba(229, 169, 59, 0.15) !important;
}

.tape-step-item.is-current.hand-both .tape-step-finger {
  background: rgba(229, 169, 59, 0.22);
  color: var(--accent-gold);
}

/* Flash de acerto imediato */
.tape-step-item.just-hit {
  border-color: #10b981 !important;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.6) !important;
  transform: scale(1.14) !important;
}

/* Compatibilidade retroativa */
.target-note-badge {
  display: none;
}

.feedback-status-msg {
  font-size: 0.88rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
}

.feedback-status-msg.correct {
  color: var(--accent-emerald);
}

.feedback-status-msg.waiting {
  color: var(--accent-gold);
}

.feedback-status-msg.wrong {
  color: var(--accent-rose);
}

.lesson-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
}

.btn-secondary {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-primary {
  background: linear-gradient(135deg, #c75b39 0%, #e07a5f 100%);
  border: none;
  color: #fff;
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--glow-terracotta);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 25px rgba(199, 91, 57, 0.7);
}

/* Painel de Conclusão de Lição (Domínio por Estrelas) */
.lesson-success-card {
  position: absolute;
  inset: 0;
  background: rgba(13, 10, 9, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(229, 169, 59, 0.35);
  border-radius: var(--radius-md);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 0.25s ease;
  box-shadow: 0 0 35px rgba(0, 0, 0, 0.85), inset 0 0 25px rgba(229, 169, 59, 0.05);
}

@keyframes fade-in {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.success-card-inner {
  text-align: center;
  max-width: 440px;
  width: 100%;
  padding: 20px 24px;
}

.success-stars {
  font-size: 2.4rem;
  color: var(--accent-gold);
  letter-spacing: 6px;
}

/* Waterfall Top Controls Toolbar (in flow) */
.waterfall-controls-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: rgba(20, 16, 14, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  gap: 12px;
  flex-wrap: wrap;
  z-index: 20;
  flex-shrink: 0;
}

.wf-control-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.wf-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
}

.wf-score-chips {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.score-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 3px 10px;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 55px;
}

.score-chip-label {
  font-size: 0.6rem;
  color: var(--text-dim);
  text-transform: uppercase;
}

.score-chip-val {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 900;
}

.waterfall-canvas-container {
  flex: 1;
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  display: block;
}

#waterfallCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Free Play Floating HUD */
.freeplay-hud {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 16, 14, 0.9);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-color);
  padding: 12px 24px;
  border-radius: 40px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  z-index: 20;
}

.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hud-label {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 1px;
}

.hud-chord-val {
  font-size: 1.5rem;
  font-weight: 900;
  font-family: var(--font-mono);
  color: var(--accent-terracotta);
  text-shadow: var(--glow-terracotta);
}

.hud-notes-val {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  min-height: 20px;
}

/* Piano Keyboard Section */
.piano-section {
  grid-row: 3;
  background: #0d0a09;
  border-top: 1px solid var(--border-color);
  position: relative;
  z-index: 30;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.7);
}

.keyboard-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 18px;
  background: #14100e;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.78rem;
  color: var(--text-muted);
}

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

.select-pill {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  outline: none;
  cursor: pointer;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.toggle-label input[type="checkbox"] {
  accent-color: var(--accent-terracotta);
}

.piano-wrapper {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 12px 14px 12px;
  display: flex;
  background: linear-gradient(180deg, #181210 0%, #090706 100%);
  scrollbar-width: thin;
  scrollbar-color: #281f1c transparent;
  -webkit-overflow-scrolling: touch;
}

.piano-wrapper.fits {
  justify-content: center;
}

.piano-keys-container {
  margin: 0 auto;
  display: inline-flex;
  position: relative;
  height: 175px;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.9), inset 0 2px 2px rgba(255, 255, 255, 0.1);
  background: #000;
  border: 4px solid #1e1715;
}

/* White Keys */
.piano-key.white {
  width: var(--ww, 38px);
  height: 100%;
  background: linear-gradient(180deg, #faf7f5 0%, #ede6e1 85%, #dfd6cf 100%);
  border: 1px solid #c9c0b7;
  border-top: none;
  border-radius: 0 0 5px 5px;
  position: relative;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding-bottom: 6px;
  color: #786f66;
  font-size: 0.72rem;
  font-weight: 700;
  box-shadow: inset 0 -4px 6px rgba(0, 0, 0, 0.15), 0 3px 6px rgba(0, 0, 0, 0.3);
  transition: transform 0.05s ease, background 0.05s ease;
  z-index: 1;
}

.piano-key.white:hover {
  background: linear-gradient(180deg, #ffffff 0%, #f4eeea 100%);
}

.piano-key.white.active.hand-left,
.piano-key.white.active-left {
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 100%) !important;
  color: #fff !important;
  transform: translateY(2px);
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.4), 0 0 20px rgba(14, 165, 233, 0.9) !important;
}

.piano-key.white.active.hand-right,
.piano-key.white.active-right {
  background: linear-gradient(180deg, #fb923c 0%, #ea580c 100%) !important;
  color: #fff !important;
  transform: translateY(2px);
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.4), 0 0 20px rgba(249, 115, 22, 0.9) !important;
}

.piano-key.white.active {
  background: linear-gradient(180deg, #fb923c 0%, #ea580c 100%) !important;
  color: #fff;
  transform: translateY(2px);
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.4), var(--glow-terracotta);
}

.piano-key.white.auto-play-left {
  background: linear-gradient(180deg, #7dd3fc 0%, #0284c7 100%) !important;
  color: #fff !important;
  transform: translateY(2px);
  box-shadow: 0 0 22px rgba(56, 189, 248, 1) !important;
}

.piano-key.white.auto-play-right,
.piano-key.white.auto-play {
  background: linear-gradient(180deg, #fdba74 0%, #ea580c 100%) !important;
  color: #fff !important;
  transform: translateY(2px);
  box-shadow: 0 0 22px rgba(249, 115, 22, 1) !important;
}

.piano-key.white.target-highlight.hand-left {
  background: linear-gradient(180deg, #e0f2fe 0%, #38bdf8 100%) !important;
  color: #031726 !important;
  box-shadow: 0 0 22px rgba(56, 189, 248, 0.95) !important;
}

.piano-key.white.target-highlight.hand-right {
  background: linear-gradient(180deg, #ffedd5 0%, #f97316 100%) !important;
  color: #1f0b03 !important;
  box-shadow: 0 0 22px rgba(249, 115, 22, 0.95) !important;
}

.piano-key.white.target-highlight {
  background: linear-gradient(180deg, #ffedd5 0%, #f97316 100%);
  color: #1f0b03;
  box-shadow: 0 0 18px rgba(249, 115, 22, 0.85);
}

.piano-key.white.target-success {
  background: linear-gradient(180deg, #86efac 0%, #10b981 100%) !important;
  color: #064e3b;
  box-shadow: var(--glow-emerald);
}

.piano-key.white.target-wrong {
  background: linear-gradient(180deg, #fda4af 0%, #f43f5e 100%) !important;
  color: #fff;
}

/* Black Keys */
.piano-key.black {
  width: var(--bw, 24px);
  height: 60%;
  background: linear-gradient(180deg, #241d1a 0%, #110d0b 80%, #080605 100%);
  border: 1px solid #14100e;
  border-top: none;
  border-radius: 0 0 4px 4px;
  position: absolute;
  cursor: pointer;
  z-index: 2;
  box-shadow: -2px 3px 6px rgba(0, 0, 0, 0.8), inset 0 -3px 3px rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding-bottom: 5px;
  color: #a89f91;
  font-size: 0.62rem;
  font-weight: 600;
  transition: transform 0.05s ease, background 0.05s ease;
}

.piano-key.black:hover {
  background: linear-gradient(180deg, #382c28 0%, #171210 100%);
}

.piano-key.black.active.hand-left,
.piano-key.black.active-left {
  background: linear-gradient(180deg, #0ea5e9 0%, #0369a1 100%) !important;
  color: #fff !important;
  transform: translateY(2px);
  box-shadow: 0 0 24px rgba(14, 165, 233, 1) !important;
}

.piano-key.black.active.hand-right,
.piano-key.black.active-right {
  background: linear-gradient(180deg, #ea580c 0%, #9a3412 100%) !important;
  color: #fff !important;
  transform: translateY(2px);
  box-shadow: 0 0 24px rgba(234, 88, 12, 1) !important;
}

.piano-key.black.active {
  background: linear-gradient(180deg, #ea580c 0%, #9a3412 100%) !important;
  color: #fff;
  transform: translateY(2px);
  box-shadow: var(--glow-terracotta);
}

.piano-key.black.auto-play-left {
  background: linear-gradient(180deg, #38bdf8 0%, #0369a1 100%) !important;
  color: #fff !important;
  transform: translateY(2px);
  box-shadow: 0 0 24px rgba(56, 189, 248, 1) !important;
}

.piano-key.black.auto-play-right,
.piano-key.black.auto-play {
  background: linear-gradient(180deg, #f97316 0%, #9a3412 100%) !important;
  color: #fff !important;
  transform: translateY(2px);
  box-shadow: 0 0 24px rgba(249, 115, 22, 1) !important;
}

.piano-key.black.target-highlight.hand-left {
  background: linear-gradient(180deg, #0284c7 0%, #0369a1 100%) !important;
  color: #fff !important;
  box-shadow: 0 0 24px rgba(56, 189, 248, 1) !important;
}

.piano-key.black.target-highlight.hand-right {
  background: linear-gradient(180deg, #ea580c 0%, #9a3412 100%) !important;
  color: #fff !important;
  box-shadow: 0 0 24px rgba(249, 115, 22, 1) !important;
}

.piano-key.black.target-highlight {
  background: linear-gradient(180deg, #ea580c 0%, #9a3412 100%);
  color: #fff;
  box-shadow: 0 0 20px rgba(249, 115, 22, 0.9);
}

.piano-key.black.target-success {
  background: linear-gradient(180deg, #10b981 0%, #059669 100%) !important;
  color: #fff;
  box-shadow: var(--glow-emerald);
}

.piano-key.black.target-wrong {
  background: linear-gradient(180deg, #f43f5e 0%, #be123c 100%) !important;
  color: #fff;
}

.key-finger {
  font-size: 0.72rem;
  font-weight: 900;
  color: var(--accent-terracotta);
  pointer-events: none;
  min-height: 12px;
}

.key-finger.hand-left {
  color: #0284c7 !important;
}

.key-finger.hand-right {
  color: #c2410c !important;
}

.piano-key.black .key-finger.hand-left {
  color: #7dd3fc !important;
}

.piano-key.black .key-finger.hand-right {
  color: #fed7aa !important;
}

.key-label {
  pointer-events: none;
  font-size: 0.7rem;
  font-weight: 700;
}

.key-label.is-middle-c {
  color: var(--accent-terracotta);
  font-weight: 900;
}

.key-kbd {
  font-size: 0.58rem;
  background: rgba(0, 0, 0, 0.15);
  padding: 1px 3px;
  border-radius: 3px;
  font-family: var(--font-mono);
  margin-top: 2px;
  pointer-events: none;
}

.piano-key.black .key-kbd {
  background: rgba(255, 255, 255, 0.12);
  color: #dfd6cf;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 4, 3, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 500px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
  transform: scale(0.95);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.open .modal-box {
  transform: scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close-btn:hover {
  color: var(--text-main);
  background: var(--bg-surface-elevated);
}

.device-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}

.device-item {
  padding: 10px 14px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s ease;
}

.device-item:hover {
  border-color: var(--accent-terracotta);
}

.device-item.active {
  border-color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.1);
}

.device-name {
  font-weight: 700;
  font-size: 0.85rem;
}

.device-type {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Responsive Breakpoints */
.mobile-only {
  display: none;
}

@media (max-width: 1024px) {
  .mobile-only {
    display: flex;
  }
  .sidebar-toggle-btn {
    display: flex !important;
    color: var(--accent-gold);
    border-color: rgba(229, 169, 59, 0.4);
    background: rgba(229, 169, 59, 0.08);
  }
  .course-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(340px, 85vw);
    z-index: 500;
    transform: translateX(100%);
    box-shadow: -15px 0 35px rgba(0, 0, 0, 0.9);
  }
  .course-sidebar.drawer-open {
    transform: translateX(0);
  }
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 490;
    display: none;
  }
  .sidebar-backdrop.active {
    display: block;
  }
  .piano-keys-container {
    height: 150px;
  }
  
  #arandu-neural-bridge {
    bottom: 215px !important;
    right: 18px !important;
  }
}

@media (max-width: 768px) {
  .app-header {
    padding: 6px 12px;
    gap: 8px;
    flex-wrap: nowrap;
  }
  .brand-tag, .midi-status-text, .hub-text, .nav-label {
    display: none;
  }
  .mode-nav {
    padding: 2px;
  }
  .mode-btn {
    padding: 6px 9px;
    font-size: 0.85rem;
  }
  .instrument-selector-box {
    padding: 2px 6px;
  }
  .instrument-select {
    font-size: 0.75rem;
    max-width: 85px;
  }
  .stage-area {
    padding: 10px 8px;
  }
  .lesson-board {
    padding: 14px 16px;
    gap: 10px;
    margin: auto 0;
  }
  .lesson-title {
    font-size: 1.15rem;
  }
  .pedagogy-box {
    padding: 8px 10px;
    gap: 4px;
  }
  .pedagogy-item {
    font-size: 0.78rem;
  }
  .music-staff-container {
    height: 90px;
    padding: 2px;
  }
  .interactive-prompt-card {
    padding: 10px 12px;
    gap: 8px;
  }
  .prompt-instruction {
    font-size: 0.75rem;
  }
  .target-note-badge {
    font-size: 1.4rem;
    padding: 5px 12px;
    min-width: 70px;
  }
  .keyboard-toolbar {
    padding: 4px 10px;
    font-size: 0.72rem;
  }
  .piano-wrapper {
    padding: 6px 8px 10px 8px;
  }
  .piano-keys-container {
    height: 130px;
  }
  #arandu-neural-bridge {
    bottom: 180px !important;
    right: 12px !important;
    transform: scale(0.85);
    transform-origin: bottom right;
  }
}

@media (max-width: 480px) {
  .app-header {
    padding: 6px 10px;
    gap: 6px;
    flex-wrap: wrap;
  }
  .brand-section {
    gap: 8px;
  }
  .brand-title {
    font-size: 0.95rem;
  }
  .logo-icon {
    width: 28px;
    height: 28px;
    font-size: 1rem;
  }
  .mode-nav {
    order: 3;
    width: 100%;
    justify-content: space-around;
    margin-top: 4px;
    border-radius: 8px;
  }
  .mode-btn {
    flex: 1;
    justify-content: center;
    padding: 5px 6px;
    font-size: 0.72rem;
  }
  .mode-btn .nav-label {
    display: inline !important;
    font-size: 0.68rem;
  }
  .instrument-selector-box {
    display: none;
  }
  .header-actions {
    gap: 6px;
  }
  .stage-area {
    padding: 6px;
  }
  .lesson-board {
    padding: 10px 12px;
    gap: 8px;
  }
  .lesson-header-row {
    gap: 6px;
  }
  .lesson-step-badge, .hand-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
  }
  .lesson-title {
    font-size: 1.05rem;
  }
  .pedagogy-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }
  .music-staff-container {
    height: 80px;
  }
  .lesson-actions-bar {
    flex-direction: column;
    gap: 8px;
  }
  .lesson-actions-bar > div {
    width: 100%;
    display: flex;
    justify-content: space-between;
  }
  .piano-keys-container {
    height: 120px;
  }
  #arandu-neural-bridge {
    bottom: 175px !important;
    right: 8px !important;
    transform: scale(0.75);
    transform-origin: bottom right;
  }
}

/* ==============================================================
   Arandu Neural Bridge Default Desktop Elevation
============================================================== */
#arandu-neural-bridge {
  bottom: 235px !important;
  right: 24px !important;
  z-index: 90 !important;
  transition: bottom 0.3s ease, right 0.3s ease, transform 0.3s ease;
}
