/* Piano Practice PWA Styles */
:root {
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-tertiary: #0f3460;
  --accent: #e94560;
  --accent-light: #ff6b6b;
  --text-primary: #eee;
  --text-secondary: #aaa;
  --success: #4ade80;
  --warning: #fbbf24;
  --error: #f87171;
  --white-key: #fafafa;
  --black-key: #1a1a1a;
  --border-radius: 12px;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 800px;
  margin: 0 auto;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--bg-tertiary);
}

.app-header h1 {
  font-size: 1.25rem;
  font-weight: 600;
}

.icon-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
}

/* Navigation */
.tool-nav {
  display: flex;
  background: var(--bg-secondary);
  padding: 8px;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.nav-btn {
  flex: 1;
  min-width: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.nav-btn:hover {
  background: var(--bg-tertiary);
}

.nav-btn.active {
  background: var(--accent);
  color: white;
}

.nav-icon {
  font-size: 1.5rem;
}

.nav-label {
  font-size: 0.75rem;
  font-weight: 500;
}

/* Tool Container */
.tool-container {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.tool-panel {
  display: none;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

.tool-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.tool-header {
  margin-bottom: 16px;
}

.tool-header h2 {
  font-size: 1.5rem;
  margin-bottom: 12px;
}

/* Mode/Level Selectors */
.mode-selector, .level-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mode-btn, .level-btn {
  padding: 8px 16px;
  background: var(--bg-tertiary);
  border: none;
  border-radius: 20px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.mode-btn:hover, .level-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.mode-btn.active, .level-btn.active {
  background: var(--accent);
  color: white;
}

/* Buttons */
.big-btn {
  display: block;
  width: 100%;
  max-width: 300px;
  margin: 20px auto;
  padding: 20px 40px;
  font-size: 1.5rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow);
}

.big-btn:hover {
  background: var(--accent-light);
  transform: translateY(-2px);
}

.big-btn:active {
  transform: translateY(0);
}

.big-btn:disabled {
  background: var(--bg-tertiary);
  cursor: not-allowed;
  transform: none;
}

.action-btn, .small-btn {
  padding: 10px 20px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.action-btn:hover, .small-btn:hover {
  background: var(--accent);
}

.action-btn:disabled, .small-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.toggle-btn.active {
  background: var(--accent);
}

/* Options Grid (Ear Trainer) */
.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 10px;
  margin: 20px 0;
}

.option-btn {
  padding: 16px;
  background: var(--bg-tertiary);
  border: 2px solid transparent;
  border-radius: var(--border-radius);
  color: var(--text-primary);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.option-btn:hover {
  border-color: var(--accent);
}

.option-btn.correct {
  background: var(--success);
  color: #000;
}

.option-btn.incorrect {
  background: var(--error);
  color: #fff;
}

/* Feedback */
.feedback {
  text-align: center;
  padding: 12px;
  min-height: 48px;
  font-size: 1.1rem;
  font-weight: 500;
}

.feedback.correct {
  color: var(--success);
}

.feedback.incorrect {
  color: var(--error);
}

/* Stats */
.stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
}

/* Form Elements */
label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
}

label span {
  min-width: 80px;
  color: var(--text-secondary);
}

select, input[type="text"] {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--bg-secondary);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 1rem;
}

select:focus, input:focus {
  outline: none;
  border-color: var(--accent);
}

input[type="range"] {
  flex: 1;
  height: 8px;
  -webkit-appearance: none;
  background: var(--bg-tertiary);
  border-radius: 4px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
}

/* Piano Keyboard */
.piano-keyboard {
  display: flex;
  justify-content: center;
  margin: 20px 0;
  height: 120px;
  position: relative;
}

.white-key {
  width: 40px;
  height: 120px;
  background: var(--white-key);
  border: 1px solid #ccc;
  border-radius: 0 0 6px 6px;
  position: relative;
  cursor: pointer;
  transition: background 0.1s;
}

.white-key:hover {
  background: #e8e8e8;
}

.white-key.active, .white-key.correct {
  background: var(--success);
}

.white-key.expected {
  background: #bbdefb;
}

.black-key {
  width: 28px;
  height: 75px;
  background: var(--black-key);
  border-radius: 0 0 4px 4px;
  position: absolute;
  z-index: 2;
  cursor: pointer;
  transition: background 0.1s;
}

.black-key:hover {
  background: #333;
}

.black-key.active, .black-key.correct {
  background: var(--success);
}

.key-label {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  color: #666;
}

.black-key .key-label {
  color: #aaa;
}

/* Metronome */
.tempo-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin: 20px 0;
}

.tempo-btn {
  width: 50px;
  height: 50px;
  font-size: 2rem;
  background: var(--bg-tertiary);
  border: none;
  border-radius: 50%;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
}

.tempo-btn:hover {
  background: var(--accent);
}

.tempo-value {
  text-align: center;
}

#tempo-number {
  font-size: 4rem;
  font-weight: 700;
  line-height: 1;
}

.tempo-label {
  font-size: 1rem;
  color: var(--text-secondary);
}

.tempo-slider {
  width: 100%;
  margin: 20px 0;
}

.tempo-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 16px 0;
}

.tempo-preset {
  padding: 8px 16px;
  background: var(--bg-tertiary);
  border: none;
  border-radius: 20px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.tempo-preset:hover {
  background: var(--accent);
  color: white;
}

.time-signature {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin: 16px 0;
}

.beat-display {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin: 24px 0;
}

.beat-dot {
  width: 24px;
  height: 24px;
  background: var(--bg-tertiary);
  border-radius: 50%;
  transition: all 0.1s;
}

.beat-dot.active {
  background: var(--accent);
  transform: scale(1.3);
  box-shadow: 0 0 10px var(--accent);
}

.beat-dot.downbeat.active {
  background: var(--warning);
  box-shadow: 0 0 10px var(--warning);
}

.metro-start {
  background: var(--success);
}

.metro-start:hover {
  background: #22c55e;
}

.metro-stop {
  background: var(--error);
}

.metro-stop:hover {
  background: #ef4444;
}

.tap-tempo {
  text-align: center;
  margin-top: 20px;
}

/* Backing Tracks */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.preset-btn {
  padding: 12px;
  background: var(--bg-tertiary);
  border: 2px solid transparent;
  border-radius: 8px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
}

.preset-btn:hover, .preset-btn.active {
  border-color: var(--accent);
}

.backing-settings {
  margin: 20px 0;
}

.custom-progression {
  margin: 20px 0;
}

.custom-progression h3 {
  margin-bottom: 8px;
  font-size: 1rem;
  color: var(--text-secondary);
}

.backing-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.current-chord {
  text-align: center;
  margin-top: 24px;
  font-size: 3rem;
  font-weight: 700;
  color: var(--accent);
  min-height: 60px;
}

/* Sight Reading */
.notation-container {
  background: white;
  border-radius: var(--border-radius);
  padding: 16px;
  margin: 16px 0;
  min-height: 200px;
  overflow-x: auto;
}

.sight-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 16px 0;
}

.sight-settings {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Settings */
.ear-settings, .scale-settings {
  margin-top: 24px;
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
}

/* MIDI Status */
.midi-status {
  font-size: 0.85rem;
  padding: 4px 12px;
  background: var(--bg-tertiary);
  border-radius: 12px;
  color: var(--text-secondary);
}

.midi-status.connected {
  background: var(--success);
  color: #000;
}

/* Scale Content */
.scale-selector {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 16px;
}

.scale-selector select {
  width: 120px;
}

.scale-notes {
  text-align: center;
  font-size: 1.2rem;
  margin: 16px 0;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
}

.scale-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.fingering-display {
  text-align: center;
  margin-top: 16px;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
  font-family: monospace;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  width: 90%;
  max-width: 400px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--bg-tertiary);
}

.modal-header h2 {
  font-size: 1.25rem;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.close-btn:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 16px;
}

.setting-group {
  margin-bottom: 24px;
}

.setting-group h3 {
  margin-bottom: 12px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-transform: uppercase;
}

.checkbox-label {
  cursor: pointer;
}

.checkbox-label input {
  margin-right: 8px;
}

/* Play Section */
.play-section {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
}

/* Responsive */
@media (max-width: 480px) {
  .app-header h1 {
    font-size: 1rem;
  }

  .nav-label {
    display: none;
  }

  .nav-btn {
    min-width: 50px;
  }

  .big-btn {
    padding: 16px 32px;
    font-size: 1.25rem;
  }

  .tempo-value #tempo-number {
    font-size: 3rem;
  }

  .white-key {
    width: 32px;
    height: 100px;
  }

  .black-key {
    width: 22px;
    height: 60px;
  }
}

/* Safe area for notched devices */
@supports (padding: max(0px)) {
  .app-header {
    padding-top: max(12px, env(safe-area-inset-top));
  }

  .tool-nav {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
}

/* Quiz Module Styles */
.quiz-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.quiz-settings {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.quiz-stats-display {
  display: flex;
  gap: 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.quiz-card-container {
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  min-height: 250px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.card-side {
  width: 100%;
  text-align: center;
}

.card-front {
  font-size: 1.1rem;
  line-height: 1.6;
}

.card-deck-label {
  font-size: 0.75rem;
  color: var(--accent);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-text {
  white-space: pre-wrap;
}

.card-back {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--bg-tertiary);
  color: var(--success);
  font-weight: 500;
}

.card-back.hidden {
  display: none;
}

.quiz-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* Rating buttons */
.rating-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 500px;
}

.rating-btn {
  padding: 12px 8px;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.rating-btn.again {
  background: #dc2626;
  color: white;
}

.rating-btn.hard {
  background: #f97316;
  color: white;
}

.rating-btn.good {
  background: #eab308;
  color: black;
}

.rating-btn.easy {
  background: #22c55e;
  color: white;
}

.rating-btn.perfect {
  background: #3b82f6;
  color: white;
}

.rating-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.rating-btn:active {
  transform: translateY(0);
}

.rating-grid.hidden {
  display: none;
}

/* Session states */
.session-complete,
.empty-state,
.error-state {
  text-align: center;
  padding: 32px 20px;
}

.complete-icon,
.empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.session-complete h3 {
  font-size: 1.5rem;
  margin-bottom: 12px;
  color: var(--success);
}

.session-complete .score {
  font-size: 1.25rem;
  margin-bottom: 8px;
}

.session-complete .message {
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.empty-state p {
  color: var(--text-secondary);
  margin: 8px 0;
}

.empty-state .hint {
  font-size: 0.9rem;
}

.error-state {
  color: var(--error);
}

/* Keyboard Diagram */
.keyboard-diagram-container {
  margin: 20px auto;
  max-width: 100%;
  overflow-x: auto;
  display: flex;
  justify-content: center;
}

.keyboard-diagram {
  max-width: 100%;
  height: auto;
}

.keyboard-fallback {
  padding: 16px;
  background: var(--bg-tertiary);
  border-radius: 8px;
  text-align: center;
  color: var(--text-secondary);
  margin: 20px 0;
}

/* Responsive quiz */
@media (max-width: 480px) {
  .rating-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .rating-btn.easy,
  .rating-btn.perfect {
    grid-column: span 1;
  }

  .quiz-card-container {
    min-height: 200px;
    padding: 16px;
  }

  .card-front {
    font-size: 1rem;
  }

  .keyboard-diagram-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .keyboard-diagram {
    min-width: 400px;
  }
}

/* Progress Dashboard Styles */
.progress-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
}

/* Overall Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}

.stat-card {
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  padding: 16px;
  text-align: center;
  border: 2px solid transparent;
  transition: all 0.2s;
}

.stat-card:hover {
  border-color: var(--accent);
}

.stat-card.due {
  border-color: var(--warning);
}

.stat-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Streak Display */
.streak-container {
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.streak-main {
  display: flex;
  align-items: center;
  gap: 16px;
}

.streak-icon {
  font-size: 3rem;
  opacity: 0.3;
  transition: all 0.3s;
}

.streak-icon.active {
  opacity: 1;
  animation: flicker 2s infinite;
}

@keyframes flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

.streak-current {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.streak-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.streak-best {
  text-align: right;
}

.streak-best-value {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.streak-hint {
  font-size: 0.85rem;
  color: var(--warning);
  font-style: italic;
}

/* Deck Progress */
.progress-decks h3 {
  margin-bottom: 12px;
  color: var(--text-secondary);
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.deck-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.deck-card {
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  padding: 16px;
  border: 1px solid var(--bg-tertiary);
  transition: all 0.2s;
}

.deck-card:hover {
  border-color: var(--accent);
}

.deck-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.deck-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.deck-due {
  font-size: 0.85rem;
  padding: 4px 12px;
  background: var(--bg-tertiary);
  border-radius: 12px;
  color: var(--text-secondary);
}

.deck-due.has-due {
  background: var(--warning);
  color: #000;
  font-weight: 600;
}

.deck-stats {
  display: flex;
  gap: 24px;
  margin-bottom: 12px;
}

.deck-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.deck-stat .stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.deck-stat .stat-value {
  font-size: 1.25rem;
  font-weight: 600;
}

.deck-stat .stat-value.high {
  color: var(--success);
}

.deck-stat .stat-value.medium {
  color: var(--warning);
}

.deck-stat .stat-value.low {
  color: var(--error);
}

.mastery-bar {
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
}

.mastery-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.mastery-fill.high {
  background: var(--success);
}

.mastery-fill.medium {
  background: var(--warning);
}

.mastery-fill.low {
  background: var(--error);
}

/* Study Calendar */
.progress-calendar h3 {
  margin-bottom: 12px;
  color: var(--text-secondary);
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 12px;
}

.calendar-day {
  aspect-ratio: 1;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  transition: all 0.2s;
  cursor: pointer;
}

.calendar-day.none {
  background: var(--bg-tertiary);
  color: transparent;
}

.calendar-day.low {
  background: #374151;
  color: var(--text-secondary);
}

.calendar-day.medium {
  background: #4b5563;
  color: var(--text-primary);
}

.calendar-day.high {
  background: var(--accent);
  color: white;
}

.calendar-day.today {
  border: 2px solid var(--accent);
}

.calendar-day:hover {
  transform: scale(1.1);
  z-index: 1;
}

.day-label {
  font-size: 0.65rem;
}

.calendar-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  justify-content: flex-end;
}

.legend-box {
  width: 16px;
  height: 16px;
  border-radius: 3px;
}

.legend-box.none {
  background: var(--bg-tertiary);
}

.legend-box.low {
  background: #374151;
}

.legend-box.medium {
  background: #4b5563;
}

.legend-box.high {
  background: var(--accent);
}

.empty-hint {
  text-align: center;
  color: var(--text-secondary);
  padding: 20px;
}

/* Responsive Progress */
@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat-icon {
    font-size: 1.5rem;
  }

  .stat-value {
    font-size: 1.5rem;
  }

  .streak-container {
    flex-direction: column;
    text-align: center;
  }

  .streak-main {
    flex-direction: column;
  }

  .streak-best {
    text-align: center;
  }

  .deck-stats {
    gap: 16px;
  }

  .calendar-grid {
    gap: 2px;
  }

  .calendar-day {
    font-size: 0.6rem;
  }
}

/* Circle of Fifths Styles */
.circle-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: center;
}

.circle-visualization {
  max-width: 600px;
  width: 100%;
  height: auto;
}

.circle-segment {
  cursor: pointer;
  transition: all 0.2s;
}

.circle-segment:hover .segment-path {
  fill: var(--bg-tertiary);
  filter: brightness(1.2);
}

.circle-segment.selected .segment-path {
  fill: var(--accent);
  stroke: var(--accent-light);
  stroke-width: 3;
}

.circle-segment.related.relative .segment-path {
  fill: var(--success);
  opacity: 0.7;
}

.circle-segment.related.dominant .segment-path {
  fill: var(--warning);
  opacity: 0.7;
}

.circle-segment.related.subdominant .segment-path {
  fill: #60a5fa;
  opacity: 0.7;
}

.key-info-panel {
  width: 100%;
  max-width: 500px;
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  padding: 20px;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s;
}

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

.key-info-panel h3 {
  font-size: 1.5rem;
  margin-bottom: 16px;
  color: var(--accent);
  text-align: center;
}

.key-info-panel h4 {
  font-size: 1rem;
  margin-bottom: 12px;
  color: var(--text-secondary);
}

.key-details {
  margin-bottom: 20px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--bg-tertiary);
}

.detail-label {
  color: var(--text-secondary);
  font-weight: 500;
}

.detail-value {
  color: var(--text-primary);
  font-weight: 600;
}

.relationships-section {
  margin-bottom: 20px;
}

.relationship-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.relationship-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.relationship-item:hover {
  background: var(--accent);
  transform: translateX(4px);
}

.rel-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.rel-value {
  color: var(--text-primary);
  font-weight: 600;
}

.key-info-panel .action-btn {
  width: 100%;
  margin-top: 8px;
}

/* ====================================
   Practice Log
   ==================================== */

.log-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 16px;
}

.log-timer-section {
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  padding: 24px;
  text-align: center;
}

.log-timer {
  font-size: 3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  margin-bottom: 16px;
  letter-spacing: 0.05em;
}

.log-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.log-settings {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.log-settings label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.log-settings span {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.log-settings select,
.log-settings textarea {
  background: var(--bg-secondary);
  border: 1px solid var(--bg-tertiary);
  border-radius: 8px;
  padding: 10px;
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
}

.log-settings textarea {
  resize: vertical;
  min-height: 60px;
}

.log-settings select:disabled,
.log-settings textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.log-stats h3,
.log-goal-section h3,
.log-history-header h3 {
  font-size: 1rem;
  margin-bottom: 12px;
  color: var(--text-secondary);
}

.log-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.log-stat-card {
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  padding: 16px;
  text-align: center;
}

.log-stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 4px;
}

.log-stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.log-goal-card {
  grid-column: 1 / -1;
}

.log-goal-progress {
  margin-bottom: 8px;
}

.log-goal-bar {
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.log-goal-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  transition: width 0.3s ease;
}

.log-goal-text {
  font-size: 0.875rem;
  color: var(--text-primary);
}

.log-breakdown {
  margin-top: 16px;
}

.log-breakdown h4 {
  font-size: 0.875rem;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.log-breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.log-breakdown-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border-radius: 6px;
  font-size: 0.875rem;
}

.log-goal-section {
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  padding: 16px;
}

.log-goal-input {
  display: flex;
  gap: 8px;
}

.log-goal-input input {
  flex: 1;
  background: var(--bg-tertiary);
  border: 1px solid var(--bg-tertiary);
  border-radius: 8px;
  padding: 10px;
  color: var(--text-primary);
  font-size: 1rem;
}

.log-hint {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 8px;
  font-style: italic;
}

.log-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.log-sessions-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
}

.log-session {
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  padding: 12px;
}

.log-session-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.log-session-type {
  display: flex;
  align-items: center;
  gap: 8px;
}

.log-session-icon {
  font-size: 1.25rem;
}

.log-session-label {
  font-weight: 500;
}

.log-delete-btn {
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  padding: 4px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.log-delete-btn:hover {
  opacity: 1;
}

.log-session-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.log-session-duration {
  font-weight: 600;
  color: var(--accent);
}

.log-session-notes {
  font-size: 0.875rem;
  padding: 8px;
  background: var(--bg-tertiary);
  border-radius: 6px;
  white-space: pre-wrap;
  line-height: 1.4;
}

.log-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.log-empty p:first-child {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.small-btn {
  background: var(--bg-tertiary);
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  color: var(--text-primary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
}

.small-btn:hover {
  background: var(--accent);
}

/* Mobile responsiveness */
@media (max-width: 600px) {
  .log-timer {
    font-size: 2.5rem;
  }

  .log-stats-grid {
    grid-template-columns: 1fr;
  }

  .log-controls {
    flex-direction: column;
  }

  .log-goal-input {
    flex-direction: column;
  }
}

/* Tuner Styles */
.tuner-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 8px;
}

.tuner-status {
  font-size: 0.9rem;
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border-radius: 12px;
  text-align: center;
}

.tuner-status.idle {
  color: var(--text-secondary);
}

.tuner-status.waiting {
  color: var(--warning);
}

.tuner-status.active {
  color: var(--success);
  background: rgba(74, 222, 128, 0.1);
}

.tuner-status.error {
  color: var(--error);
  background: rgba(248, 113, 113, 0.1);
}

#tuner-start.listening {
  background: var(--error);
}

#tuner-start.listening:hover {
  background: #dc2626;
}

.tuner-display {
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.note-display {
  text-align: center;
}

.note-name {
  font-size: 5rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 8px;
  color: var(--text-primary);
  transition: color 0.2s;
}

.note-name.in-tune {
  color: var(--success);
}

.note-frequency {
  font-size: 1.25rem;
  color: var(--text-secondary);
}

.pitch-meter {
  position: relative;
  width: 100%;
  height: 80px;
  margin: 16px 0;
}

.meter-labels {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.meter-label.center {
  font-weight: 700;
  color: var(--success);
}

.meter-scale {
  position: absolute;
  top: 40px;
  width: 100%;
  height: 1px;
  background: var(--bg-tertiary);
}

.scale-mark {
  position: absolute;
  width: 2px;
  height: 12px;
  background: var(--text-secondary);
  top: -6px;
  transform: translateX(-50%);
}

.scale-mark.center {
  height: 18px;
  width: 3px;
  background: var(--success);
  top: -9px;
}

.meter-bar {
  position: absolute;
  top: 30px;
  width: 100%;
  height: 20px;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
}

.meter-zone {
  flex: 1;
  height: 100%;
}

.meter-zone.flat {
  background: linear-gradient(to right, var(--error), #fbbf24);
}

.meter-zone.in-tune {
  background: var(--success);
  flex: 0.2;
}

.meter-zone.sharp {
  background: linear-gradient(to left, var(--error), #fbbf24);
}

.pitch-needle {
  position: absolute;
  top: 20px;
  left: 50%;
  width: 4px;
  height: 40px;
  background: var(--text-secondary);
  transform: translateX(-50%) rotate(0deg);
  transform-origin: center top;
  border-radius: 2px;
  transition: all 0.15s ease-out;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  z-index: 10;
}

.cents-display {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: color 0.2s;
}

.cents-display.in-tune {
  color: var(--success);
}

.cents-display.flat {
  color: #fbbf24;
}

.cents-display.sharp {
  color: #fbbf24;
}

.tuner-info {
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  padding: 16px 20px;
}

.tuner-info h3 {
  font-size: 1rem;
  margin-bottom: 12px;
  color: var(--text-secondary);
}

.tuner-info ul {
  margin: 0;
  padding-left: 20px;
  color: var(--text-secondary);
}

.tuner-info li {
  margin: 8px 0;
  line-height: 1.4;
}

/* Responsive tuner */
@media (max-width: 480px) {
  .note-name {
    font-size: 4rem;
  }

  .note-frequency {
    font-size: 1rem;
  }

  .cents-display {
    font-size: 1.25rem;
  }

  .pitch-meter {
    height: 60px;
  }

  .tuner-display {
    padding: 16px;
  }
}

/* Lessons Module Styles */
.lessons-content {
  max-width: 900px;
  margin: 0 auto;
}

.curriculum-overview h3 {
  font-size: 1.75rem;
  margin-bottom: 12px;
}

.curriculum-intro {
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.6;
}

.level-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.level-card {
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
}

.level-card:not(.locked):hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.level-card.locked {
  opacity: 0.6;
  cursor: not-allowed;
}

.level-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.level-header h4 {
  font-size: 1.25rem;
  margin: 0;
}

.lock-icon {
  font-size: 1.25rem;
  opacity: 0.7;
}

.level-description {
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.5;
}

.level-progress {
  margin-top: 16px;
}

.progress-bar {
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.start-level-btn {
  width: 100%;
  margin-top: 16px;
  padding: 10px 20px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.start-level-btn:hover {
  background: var(--accent-light);
}

.locked-msg {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 16px;
}

/* Lesson List */
.lesson-list-container {
  animation: fadeIn 0.2s ease;
}

.back-btn {
  background: var(--bg-tertiary);
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  color: var(--text-primary);
  cursor: pointer;
  margin-bottom: 20px;
  font-size: 0.95rem;
  transition: all 0.2s;
}

.back-btn:hover {
  background: var(--accent);
}

.lessons-grid {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.lesson-card {
  display: grid;
  grid-template-columns: 50px 1fr auto;
  gap: 16px;
  align-items: center;
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
}

.lesson-card:not(.locked):hover {
  border-color: var(--accent);
  transform: translateX(4px);
}

.lesson-card.locked {
  opacity: 0.6;
  cursor: not-allowed;
}

.lesson-card.completed {
  background: var(--bg-tertiary);
}

.lesson-number {
  width: 50px;
  height: 50px;
  background: var(--bg-tertiary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
}

.lesson-card.completed .lesson-number {
  background: var(--success);
  color: #000;
}

.lesson-info h4 {
  margin: 0 0 4px 0;
  font-size: 1.1rem;
}

.lesson-info p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.lesson-duration {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 4px;
  display: block;
}

.check-icon {
  font-size: 1.5rem;
  color: var(--success);
}

/* Lesson Content */
.lesson-content-container {
  animation: fadeIn 0.2s ease;
}

.lesson-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--bg-tertiary);
}

.lesson-header h3 {
  font-size: 1.75rem;
  margin: 0;
}

.lesson-body {
  line-height: 1.7;
}

.lesson-body h3 {
  color: var(--accent);
  margin-top: 24px;
  margin-bottom: 12px;
}

.lesson-body h4 {
  color: var(--text-primary);
  margin-top: 20px;
  margin-bottom: 10px;
  font-size: 1.1rem;
}

.lesson-body p {
  margin-bottom: 16px;
}

.lesson-body ul {
  margin: 12px 0;
  padding-left: 24px;
}

.lesson-body li {
  margin-bottom: 8px;
}

.lesson-body strong {
  color: var(--accent-light);
}

.lesson-section {
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  padding: 20px;
  margin: 24px 0;
}

.lesson-section h4 {
  margin-top: 0;
  color: var(--accent);
}

.examples-list {
  list-style: none;
  padding: 0;
}

.examples-list li {
  padding: 12px;
  background: var(--bg-tertiary);
  border-radius: 6px;
  margin-bottom: 8px;
  border-left: 3px solid var(--accent);
}

.practice-section {
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
}

.tool-link-btn {
  display: inline-block;
  margin-top: 16px;
  padding: 10px 20px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
}

.tool-link-btn:hover {
  background: var(--accent-light);
  transform: translateX(4px);
}

.lesson-footer {
  margin-top: 32px;
  text-align: center;
  padding-top: 24px;
  border-top: 2px solid var(--bg-tertiary);
}

.complete-lesson-btn {
  padding: 14px 32px;
  background: var(--success);
  color: #000;
  border: none;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.complete-lesson-btn:hover {
  background: #22c55e;
  transform: translateY(-2px);
}

.complete-lesson-btn.completed {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: default;
}

.complete-lesson-btn.completed:hover {
  transform: none;
}

/* Responsive Lessons */
@media (max-width: 480px) {
  .level-cards {
    grid-template-columns: 1fr;
  }

  .lesson-card {
    grid-template-columns: 40px 1fr auto;
    gap: 12px;
  }

  .lesson-number {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  .lesson-info h4 {
    font-size: 1rem;
  }

  .lesson-header h3 {
    font-size: 1.5rem;
  }

  .lesson-body {
    font-size: 0.95rem;
  }
}
