body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f9fafb;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
    flex-grow: 1;
}
.header {
    background-color: #2563eb;
    padding: 16px;
    color: white;
    text-align: center;
    margin-bottom: 20px;
    position: relative;
}
.header h1 {
    font-size: 24px;
    font-weight: bold;
    margin: 0;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

@media (min-width: 768px) and (max-width: 1199px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  }
}

@media (min-width: 1200px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  }
}

@media (max-width: 767px) {
  .piano-board {
    padding: 12px;
  }

  .tone-button, .chord-button {
    padding: 3px 6px;
    font-size: 11px;
  }
}

.piano-board {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 16px;
    background-color: white;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
}
.tone-selector, .chord-type-selector {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 8px;
}
button {
    padding: 4px 8px;
    margin: 4px;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}
.tone-button {
    background-color: #e5e7eb;
    color: #374151;
}
.tone-button:hover {
    background-color: #d1d5db;
}
.tone-button.active {
    background-color: #3b82f6;
    color: white;
}
.chord-button {
    background-color: #e5e7eb;
    color: #374151;
}
.chord-button:hover {
    background-color: #d1d5db;
}
.chord-button.active {
    background-color: #10b981;
    color: white;
}
.footer {
    padding: 16px;
    background-color: #f3f4f6;
    text-align: center;
    color: #4b5563;
    margin-top: 20px;
    font-size: 14px;
    flex-shrink: 0;
}
svg {
    max-width: 100%;
    height: auto;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
}

.sound-toggle {
    position: absolute;
    top: 16px;
    right: 16px;
    background-color: #fff;
    color: #333;
    padding: 6px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}
.sound-toggle:hover {
    background-color: #f3f4f6;
}
.sound-toggle.muted {
    background-color: #ef4444;
    color: white;
}
.sound-icon {
    width: 16px;
    height: 16px;
}

.play-button {
    background-color: #10b981;
    color: white;
    padding: 8px 16px;
    margin-top: 12px;
    font-size: 14px;
    border-radius: 4px;
    min-width: 120px;
}
.play-button:hover {
    background-color: #059669;
}

.settings-bar {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    margin: 16px auto;
    padding: 12px;
    background-color: #f3f4f6;
    border-radius: 8px;
}
.setting-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.setting-label {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    color: #4b5563;
}
select, .duration-button {
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid #d1d5db;
    background-color: white;
    font-size: 14px;
    min-width: 120px;
}
select:focus {
    outline: none;
    border-color: #3b82f6;
}
.duration-button {
    cursor: pointer;
    border: none;
}
.duration-button.active {
    background-color: #3b82f6;
    color: white;
}

.autoplay-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 24px;
    padding: 16px;
    background-color: #f8fafc;
    border-radius: 8px;
    width: 100%;
    max-width: 400px;
}
.autoplay-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #4b5563;
}
.autoplay-button {
    background-color: #f59e0b;
    color: white;
    padding: 8px 20px;
    border-radius: 4px;
    font-size: 14px;
    margin: 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.autoplay-button:hover {
    background-color: #d97706;
}
.autoplay-button.playing {
    background-color: #ef4444;
}
.bpm-control {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}
.bpm-label {
    font-size: 14px;
    color: #4b5563;
}
.bpm-value {
    font-weight: 600;
    color: #1f2937;
}
input[type="range"] {
    width: 160px;
}
.autoplay-setting, .metronome-control, .keyboard-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 12px;
    width: 100%;
}
.autoplay-label, .metronome-label, .keyboard-label {
    font-size: 14px;
    color: #4b5563;
    margin-bottom: 8px;
}
.autoplay-buttons, .metronome-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}
.metronome-button {
    padding: 4px 10px;
    border-radius: 4px;
    background-color: #e5e7eb;
    color: #374151;
    cursor: pointer;
}
.metronome-button.active {
    background-color: #10b981;
    color: white;
}
.current-chord-indicator {
    display: flex;
    justify-content: center;
    margin-top: 12px;
    gap: 8px;
}
.chord-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #e5e7eb;
}
.chord-indicator.active {
    background-color: #3b82f6;
}
.keyboard-tips {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #4b5563;
    margin-top: 4px;
}
.key-badge {
    display: inline-block;
    padding: 2px 6px;
    background-color: #e5e7eb;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    margin-right: 4px;
}

.chord-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.action-button {
    background-color: #e5e7eb;
    color: #374151;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.action-button:hover:not([disabled]) {
    background-color: #d1d5db;
}

.action-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chord-extractor {
    margin: 20px auto;
    max-width: 800px;
    background-color: white;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.chord-extractor h3 {
    font-size: 18px;
    color: #333;
    margin-top: 0;
    margin-bottom: 12px;
}

.song-text-area {
    width: 100%;
    padding: 12px;
    font-family: monospace;
    font-size: 14px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    margin-bottom: 12px;
    resize: vertical;
}

.extract-button {
    background-color: #2563eb;
    color: white;
    padding: 8px 16px;
    font-size: 14px;
    border-radius: 4px;
    cursor: pointer;
}

.extract-button:hover {
    background-color: #1d4ed8;
}

.chord-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    background-color: #f8fafc;
    padding: 10px;
    border-radius: 8px 8px 0 0;
    border-bottom: 2px solid #e2e8f0;
    position: relative;
}

.chord-number {
    position: absolute;
    left: 10px;
    top: 10px;
    background-color: #475569;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
}

.chord-name {
    font-size: 24px;
    font-weight: 800;
    text-align: center;
    color: #1e293b;
    width: 100%;
    letter-spacing: -1px;
}

.chord-type-display {
    font-size: 18px;
    font-weight: 600;
    color: #3b82f6;
    margin-left: 4px;
}

.midi-status {
    margin: 20px auto;
    max-width: 800px;
    background-color: #f1f5f9;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #3b82f6;
}

.midi-status h3 {
    font-size: 18px;
    color: #0f172a;
    margin-top: 0;
    margin-bottom: 12px;
}

.midi-devices {
    font-size: 14px;
    color: #475569;
}

.midi-devices ul {
    padding-left: 20px;
    margin: 10px 0;
}

.midi-devices li {
    margin-bottom: 4px;
}

.numbered-chord-text {
    margin-top: 16px;
    padding: 12px;
    background-color: #f0f9ff;
    border-radius: 8px;
    font-family: monospace;
    border: 1px solid #bae6fd;
    white-space: pre-wrap;
    position: relative;
}

.numbered-chord-text .chord-num {
    font-weight: 700;
    color: #0369a1;
    background-color: #e0f2fe;
    padding: 1px 5px;
    border-radius: 4px;
    display: inline-block;
}

.toggle-button {
    background-color: #0ea5e9;
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    margin-top: 12px;
    font-size: 13px;
    cursor: pointer;
    display: inline-block;
}

.toggle-button:hover {
    background-color: #0284c7;
}

.help-text {
    margin-top: 8px;
    font-size: 13px;
    color: #64748b;
    font-style: italic;
}

.settings-group {
  background-color: white;
  border-radius: 8px;
  padding: 12px;
  margin: 12px 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.settings-title {
  font-size: 16px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 10px;
  text-align: center;
}

.controls-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;
}

.control-group {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.control-label {
  font-size: 14px;
  color: #4b5563;
  margin-bottom: 8px;
}

.button-group {
  display: flex;
  gap: 8px;
}

.control-button {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #e5e7eb;
  border: none;
  border-radius: 4px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.control-button:hover:not(:disabled) {
  background-color: #d1d5db;
}

.control-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.quick-transpose {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.key-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.key-button {
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  background-color: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.key-button:hover {
  background-color: #e5e7eb;
}

.pattern-controls {
  background-color: white;
  border-radius: 8px;
  padding: 16px;
  margin: 12px 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.pattern-section {
  margin-bottom: 16px;
}

.pattern-buttons, .rhythm-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 8px;
}

.pattern-button, .rhythm-button {
  background-color: #e5e7eb;
  color: #374151;
  border: none;
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.pattern-button:hover, .rhythm-button:hover {
  background-color: #d1d5db;
}

.pattern-button.active, .rhythm-button.active {
  background-color: #3b82f6;
  color: white;
}

.enhanced-music-theory {
  margin-bottom: 24px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.guide-header {
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background-color: #1e293b;
    color: white;
    border-radius: 8px;
    transition: border-radius 0.3s ease;
}

.guide-header.open {
     border-radius: 8px 8px 0 0;
     border-bottom: 1px solid #3b82f6;
}

.guide-content {
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    background-color: #f8fafc;
}

.theory-section {
  margin: 16px 0;
}

.theory-section h4 {
  color: #334155;
  margin-bottom: 10px;
  font-weight: 600;
  font-size: 16px;
}

.theory-section ul, .theory-section ol {
  padding-left: 20px;
  margin: 10px 0;
}

.theory-section li {
  margin-bottom: 8px;
  line-height: 1.5;
  color: #475569;
}

.theory-section li strong {
  color: #1e293b;
}

.tabs-header {
  display: flex;
  overflow-x: auto;
  border-bottom: 1px solid #e2e8f0;
  background-color: #f1f5f9;
}

 .tabs-header::-webkit-scrollbar {
   height: 3px;
 }

 .tabs-header::-webkit-scrollbar-thumb {
   background-color: #cbd5e1;
   border-radius: 3px;
 }

.tab {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 400;
    color: #64748b;
    border-bottom: 2px solid transparent;
    transition: border-bottom 0.3s ease, color 0.3s ease;
    white-space: nowrap;
}

.tab:hover {
    color: #1e40af;
}

.tab.active {
    font-weight: 600;
    color: #1e40af;
    border-bottom-color: #3b82f6;
}

.guitar-chord-viewer {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 16px 0;
  padding: 16px;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  width: 100%;
}

.guitar-chord-viewer .chord-name {
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 12px;
  color: #334155;
}

.variant-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.variant-button {
  padding: 6px 12px;
  background-color: #e2e8f0;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.variant-button:hover:not(:disabled) {
  background-color: #cbd5e1;
}

.variant-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.variant-indicator {
  font-size: 14px;
  color: #64748b;
}

.guitar-chord-svg {
  width: 100%;
  max-width: 300px;
  height: auto;
}

.guitar-string {
  stroke: #94a3b8;
  stroke-opacity: 0.8;
}

.guitar-fret {
  stroke: #475569;
  stroke-width: 2;
}

.unplayed-marker {
  font-size: 12px;
  fill: #ef4444;
  font-weight: bold;
}

.open-string-marker {
  font-size: 12px;
  fill: #10b981;
  font-weight: bold;
}

.finger-marker {
  fill: #3b82f6;
}

.finger-marker.finger-1 {
  fill: #10b981;
}

.finger-marker.finger-2 {
  fill: #f59e0b;
}

.finger-marker.finger-3 {
  fill: #ef4444;
}

.finger-marker.finger-4 {
  fill: #8b5cf6;
}

.finger-number {
  fill: white;
  font-size: 10px;
  font-weight: bold;
  user-select: none;
}

.fret-marker {
  font-size: 12px;
  fill: #64748b;
}

.no-shapes-message {
  color: #64748b;
  font-style: italic;
  margin: 20px 0;
}

.instrument-toggle {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 10px 0;
}

.instrument-button {
  padding: 8px 16px;
  background-color: #e5e7eb;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
}

.instrument-button.active {
  background-color: #3b82f6;
  color: white;
}

.midi-keyboard-container {
    margin: 20px auto;
    max-width: 800px;
    background-color: white;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.midi-keyboard-title {
    font-size: 18px;
    color: #333;
    margin-top: 0;
    margin-bottom: 12px;
}

 .midi-keyboard-svg {
     width: 100%;
     height: auto;
     min-height: 150px;
     max-height: 200px;
     overflow: hidden;
 }

.midi-key-white {
    fill: white;
    stroke: #d1d5db;
    stroke-width: 1;
    transition: fill 0.05s ease;
}

.midi-key-black {
    fill: #374151;
    transition: fill 0.05s ease;
}

.midi-key-white.pressed {
    fill: #a7f3d0;
}

.midi-key-black.pressed {
    fill: #34d399;
}

.detected-chord-info {
    margin-top: 12px;
    font-size: 16px;
    color: #4b5563;
}

.add-chord-button {
    background-color: #10b981;
    color: white;
    padding: 8px 16px;
    margin-top: 12px;
    font-size: 14px;
    border-radius: 4px;
    cursor: pointer;
}
 .add-chord-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
 }

.add-chord-button:hover:not(:disabled) {
    background-color: #059669;
}

@media (max-width: 768px) {
  .pattern-button, .rhythm-button {
    padding: 4px 8px;
    font-size: 12px;
  }

  .tab {
    padding: 10px 12px !important;
    font-size: 13px !important;
  }

  .theory-section li {
    font-size: 13px;
  }
   .guitar-chord-viewer .chord-name {
     font-size: 20px;
   }
   .guitar-chord-viewer .chord-type-display {
     font-size: 16px;
   }

    .midi-keyboard-title {
        font-size: 16px;
    }
    .detected-chord-info {
        font-size: 14px;
    }
}



.sound-octave-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
  padding: 4px 8px;
  background-color: #fef3c7;
  border-radius: 4px;
  border: 1px solid #f59e0b;
}

.sound-octave-controls .octave-label {
  font-size: 12px;
  color: #92400e;
  font-weight: 600;
}

.sound-octave-controls .octave-buttons {
  display: flex;
  gap: 4px;
}

.sound-octave-controls .octave-button {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #fbbf24;
  color: white;
  border: none;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.sound-octave-controls .octave-button:hover:not(:disabled) {
  background-color: #f59e0b;
}

.sound-octave-controls .octave-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}


.piano-board {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 16px;
  background-color: white;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  position: relative;
  transition: all 0.3s ease;
}

.piano-board.playing {
  background: linear-gradient(135deg, #fef3c7 0%, #fed7aa 50%, #fbbf24 100%);
  box-shadow: 0 8px 25px rgba(251, 191, 36, 0.4), 0 0 0 3px rgba(251, 191, 36, 0.3);
  transform: scale(1.02);
  animation: pulseGlow 0.6s ease-in-out;
}

@keyframes pulseGlow {
  0% {
      box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
      transform: scale(1);
  }
  50% {
      box-shadow: 0 8px 25px rgba(251, 191, 36, 0.6), 0 0 0 5px rgba(251, 191, 36, 0.4);
      transform: scale(1.03);
  }
  100% {
      box-shadow: 0 8px 25px rgba(251, 191, 36, 0.4), 0 0 0 3px rgba(251, 191, 36, 0.3);
      transform: scale(1.02);
  }
}

.piano-board.playing .chord-number {
  background-color: #f59e0b;
  animation: numberPulse 0.6s ease-in-out;
}

@keyframes numberPulse {
  0%, 100% {
      transform: scale(1);
  }
  50% {
      transform: scale(1.1);
  }
}

.piano-board.playing .chord-name {
  color: #92400e;
  text-shadow: 0 2px 4px rgba(146, 64, 14, 0.2);
}



@media (max-width: 767px) {
  .piano-board.playing {
    transform: scale(1.01);
  }
  
  @keyframes pulseGlow {
    50% {
      transform: scale(1.02);
    }
    100% {
      transform: scale(1.01);
    }
  }
}