/* AcousticDoodler - Complete Styles with New Fretboard Architecture */
@import url("https://fonts.googleapis.com/css2?family=Instrument+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap");

:root {
  --bg-primary: #1c1c1c;
  --text-primary: #ffffff;
  --text-secondary: #b3b3b3;
  --text-muted: #757575;
  --text-dark: #5c5c5c;
  --border-color: #5c5c5c;
  --red: #ff6169;
  --blue: #69d7ff;
  --yellow: #deb605;
  --fretboard-wood: #8B4513;
  --fret-wire: #C0C0C0;
  --fretboard-shadow: rgba(0, 0, 0, 0.3);
}

[data-theme="light"] {
  --bg-primary: #ffffff;
  --text-primary: #1c1c1c;
  --text-secondary: #5c5c5c;
  --text-muted: #757575;
  --text-dark: #b3b3b3;
  --border-color: #b3b3b3;
}

[data-theme="light"] .row-one,
[data-theme="light"] .row-two {
  border-bottom-color: #444444;
}

[data-theme="light"] .app-title-section::after,
[data-theme="light"] .tab-navigation::after {
  background: #444444;
}

[data-theme="light"] .control-select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231c1c1c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
  background-position: right 16px center;
  padding: 11px 32px 11px 16px;
}

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

body {
  font-family: "Instrument Sans", -apple-system, BlinkMacSystemFont, system-ui,
    sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.4;
  overflow-x: hidden;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Row 1: App Title + Instrument Navigation + Top Controls */
.row-one {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  border-bottom: 1px solid #444444;
  height: 64px;
}

.app-title-section {
  flex-shrink: 0;
  width: 200px;
  position: relative;
}

.app-title-section::after {
  content: "";
  position: absolute;
  right: -16px;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 24px;
  background: #444444;
}

.app-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
}

.instrument-nav {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 32px;
  flex: 1;
  margin-left: 32px;
}

.instrument-button {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  padding: 12px 0;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  font-family: "Instrument Sans", sans-serif;
  position: relative;
}

.instrument-button.active {
  color: var(--text-primary);
  border-bottom-color: transparent;
}

.instrument-button.active::after {
  content: "";
  position: absolute;
  bottom: -15px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--text-primary);
}

.instrument-button:hover:not(.active) {
  color: var(--text-primary);
}

.top-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  width: 200px;
  justify-content: flex-end;
}

#tunerButton {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: "Instrument Sans", sans-serif;
  transition: all 0.2s ease;
  white-space: nowrap;
  height: 40px;
}

#tunerButton:hover {
  background: rgba(255, 255, 255, 0.05);
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: "Instrument Sans", sans-serif;
  padding: 12px 16px;
  border-radius: 6px;
  transition: all 0.2s ease;
  white-space: nowrap;
  height: 40px;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.05);
}

.toggle-switch {
  position: relative;
  width: 16px;
  height: 16px;
}

.toggle-circle {
  width: 12px;
  height: 12px;
  border: 1px solid var(--text-primary);
  border-radius: 50%;
  background: var(--text-primary);
}

/* Row 2: Tab Navigation + Audio Control + Volume Controls */
.row-two {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 16px 32px;
  border-bottom: 1px solid #444444;
  height: 64px;
  gap: 32px;
}

.tab-navigation {
  display: flex;
  align-items: center;
  gap: 48px;
  flex-shrink: 0;
  position: relative;
}

.tab-navigation::after {
  content: "";
  position: absolute;
  right: -16px;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 24px;
  background: #444444;
}

.tab-button {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 0;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  font-family: "Instrument Sans", sans-serif;
  position: relative;
}

.tab-button.active {
  color: var(--text-primary);
  border-bottom-color: transparent;
}

.tab-button.active::after {
  content: "";
  position: absolute;
  bottom: -15px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--text-primary);
}

.tab-button:hover:not(.active) {
  color: var(--text-primary);
}

.audio-control {
  flex-shrink: 0;
  display: flex;
}

#initAudioBtn {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: "Instrument Sans", sans-serif;
  transition: all 0.2s ease;
  height: 40px;
}

#initAudioBtn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.volume-controls {
  display: flex;
  align-items: center;
  gap: 32px;
  flex-shrink: 0;
}

.volume-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.volume-label {
  font-size: 14px;
  color: var(--text-primary);
  font-family: "Instrument Sans", sans-serif;
  white-space: nowrap;
}

.volume-value {
  font-size: 14px;
  color: var(--text-primary);
  font-family: "Instrument Sans", sans-serif;
  min-width: 50px;
  text-align: center;
}

.slider {
  width: 80px;
  height: 4px;
  border-radius: 2px;
  outline: none;
  appearance: none;
  background: var(--border-color);
  cursor: pointer;
}

.slider::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-primary);
  cursor: pointer;
}

.slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-primary);
  cursor: pointer;
  border: none;
}

/* Row 3: Action Buttons + Control Selects + Tempo */
.row-three {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  height: 64px;
}

.action-buttons {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.position-button {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: "Instrument Sans", sans-serif;
  transition: all 0.2s ease;
  white-space: nowrap;
  height: 40px;
}

.position-button.active {
  background: var(--text-primary);
  color: var(--bg-primary);
  border-color: var(--text-primary);
}

.position-button:hover:not(.active) {
  background: rgba(255, 255, 255, 0.05);
}

.full-neck-button {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: "Instrument Sans", sans-serif;
  transition: all 0.2s ease;
  white-space: nowrap;
  height: 40px;
}

.full-neck-button.active {
  background: var(--text-primary);
  color: var(--bg-primary);
  border-color: var(--text-primary);
}

.full-neck-button:hover:not(.active) {
  background: rgba(255, 255, 255, 0.05);
}

.control-selects {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  justify-content: flex-end;
  margin-right: 32px;
}

.play-button {
  background: var(--text-primary);
  color: var(--bg-primary);
  border: none;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: "Instrument Sans", sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  white-space: nowrap;
  min-width: 80px;
  height: 40px;
  margin-right: 16px;
}

.play-button:hover:not(:disabled) {
  background: var(--text-secondary);
}

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

.play-arrow {
  display: none;
}

.play-icon {
  width: 12px;
  height: 12px;
  fill: currentColor;
}

.control-select {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 11px 32px 11px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  font-family: "Instrument Sans", sans-serif;
  min-width: 140px;
  transition: all 0.2s ease;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 16px;
  height: 40px;
  line-height: 1.2;
}

.control-select:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.control-select:focus {
  border-color: var(--text-primary);
}

.tempo-control {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  width: 200px;
  justify-content: flex-end;
}

.tempo-label {
  font-size: 14px;
  color: var(--text-primary);
  font-family: "Instrument Sans", sans-serif;
}

.tempo-value {
  font-size: 14px;
  color: var(--text-primary);
  font-family: "Instrument Sans", sans-serif;
  min-width: 55px;
  text-align: center;
}

#tempoSlider {
  width: 60px;
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 40px;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Fretboard Section */
.fretboard-section {
  margin-bottom: 32px;
}

.fretboard {
  margin-bottom: 24px;
  padding: 32px 0;
}

/* NEW FRETBOARD ARCHITECTURE */

/* Main Fretboard Container */
.fretboard-container {
  width: 100%;
  margin: 0;
  padding: 0 40px; /* Equal padding on both sides */
  position: relative;
  background: var(--bg-primary);
  overflow: visible;
  box-sizing: border-box;
}

/* Fretboard Grid Layout */
.fretboard-grid {
  display: grid;
  grid-template-columns: 80px repeat(12, 1fr);
  grid-template-rows: repeat(6, 60px);
  position: relative;
  min-height: 360px;
}

/* Adjust grid for different instruments */
.fretboard-grid.ukulele {
  grid-template-rows: repeat(4, 60px);
  min-height: 240px;
}

.fretboard-grid.mandolin {
  grid-template-rows: repeat(4, 60px);
  min-height: 240px;
}

/* String Names Column */
.string-names {
  grid-column: 1;
  grid-row: 1 / -1;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  border-right: 1px solid var(--border-color);
  z-index: 3;
}

.string-name {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  font-family: "Instrument Sans", sans-serif;
}

.string-name:last-child {
  border-bottom: none;
}

/* Fret Wires (Vertical Lines) */
.fret-wire {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border-color);
  z-index: 2;
}

/* Fret wire positions (calculated for proper spacing) */
.fret-wire:nth-child(2) { left: calc(80px + 8.333%); }
.fret-wire:nth-child(3) { left: calc(80px + 16.667%); }
.fret-wire:nth-child(4) { left: calc(80px + 25%); }
.fret-wire:nth-child(5) { left: calc(80px + 33.333%); }
.fret-wire:nth-child(6) { left: calc(80px + 41.667%); }
.fret-wire:nth-child(7) { left: calc(80px + 50%); }
.fret-wire:nth-child(8) { left: calc(80px + 58.333%); }
.fret-wire:nth-child(9) { left: calc(80px + 66.667%); }
.fret-wire:nth-child(10) { left: calc(80px + 75%); }
.fret-wire:nth-child(11) { left: calc(80px + 83.333%); }
.fret-wire:nth-child(12) { left: calc(80px + 91.667%); }
.fret-wire:nth-child(13) { left: calc(80px + 100%); }

/* String Lines (Horizontal) - Different thicknesses for each string */
.string-line {
  position: absolute;
  left: 80px;
  right: 0;
  background: var(--border-color);
  z-index: 1;
}

/* String line positions and thicknesses for 6-string instruments */
.string-line:nth-child(14) { top: 30px; height: 2px; }   /* High E (1st string) - 2px */
.string-line:nth-child(15) { top: 90px; height: 2px; }   /* B (2nd string) - 2px */
.string-line:nth-child(16) { top: 150px; height: 3px; }  /* G (3rd string) - 3px */
.string-line:nth-child(17) { top: 210px; height: 4px; }  /* D (4th string) - 4px */
.string-line:nth-child(18) { top: 270px; height: 6px; }  /* A (5th string) - 6px */
.string-line:nth-child(19) { top: 330px; height: 8px; }  /* Low E (6th string) - 8px */

/* Adjust string lines for 4-string instruments */
.fretboard-container.ukulele .string-line:nth-child(14) { top: 30px; height: 2px; }   /* A (4th string) - 2px */
.fretboard-container.ukulele .string-line:nth-child(15) { top: 90px; height: 3px; }   /* E (3rd string) - 3px */
.fretboard-container.ukulele .string-line:nth-child(16) { top: 150px; height: 4px; }  /* C (2nd string) - 4px */
.fretboard-container.ukulele .string-line:nth-child(17) { top: 210px; height: 6px; }  /* G (1st string) - 6px */
.fretboard-container.ukulele .string-line:nth-child(18),
.fretboard-container.ukulele .string-line:nth-child(19) { display: none; }

.fretboard-container.mandolin .string-line:nth-child(14) { top: 30px; height: 2px; }  /* E (4th string) - 2px */
.fretboard-container.mandolin .string-line:nth-child(15) { top: 90px; height: 3px; }  /* A (3rd string) - 3px */
.fretboard-container.mandolin .string-line:nth-child(16) { top: 150px; height: 4px; } /* D (2nd string) - 4px */
.fretboard-container.mandolin .string-line:nth-child(17) { top: 210px; height: 6px; } /* G (1st string) - 6px */
.fretboard-container.mandolin .string-line:nth-child(18),
.fretboard-container.mandolin .string-line:nth-child(19) { display: none; }

/* Fret Markers */
.fret-marker {
  position: absolute;
  width: 12px;
  height: 12px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  z-index: 1;
  top: 50%;
  transform: translateY(-50%);
}

/* Position markers at frets 3, 5, 7, 9, 12 */
.fret-marker.fret-3 { left: calc(80px + 20.833%); }
.fret-marker.fret-5 { left: calc(80px + 37.5%); }
.fret-marker.fret-7 { left: calc(80px + 54.167%); }
.fret-marker.fret-9 { left: calc(80px + 70.833%); }
.fret-marker.fret-12 { left: calc(80px + 95.833%); }

/* Double dots for 12th fret */
.fret-marker.fret-12:before {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  top: -20px;
  left: 2px;
}

.fret-marker.fret-12:after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  bottom: -20px;
  left: 2px;
}

/* Interactive Notes Layer */
.notes-layer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
}

/* Note Elements */
.note-element {
  position: absolute;
  width: 44px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
  transform: translate(-50%, -50%);
  font-family: "Instrument Sans", sans-serif;
  user-select: none;
}

/* Note States - Dark background with colored borders */
.note-element.note-root {
  background: var(--bg-primary);
  color: var(--red);
  border: 2px solid var(--red);
}

.note-element.note-pattern {
  background: var(--bg-primary);
  color: var(--blue);
  border: 2px solid var(--blue);
}

.note-element.note-open {
  background: var(--bg-primary);
  color: var(--blue);
  border: 2px solid var(--blue);
}

.note-element.note-scale {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 2px solid var(--border-color);
}

.note-element.note-playing {
  background: var(--yellow);
  color: var(--bg-primary);
  transform: translate(-50%, -50%) scale(1.2);
  box-shadow: 0 4px 16px rgba(222, 182, 5, 0.6);
  border: 2px solid var(--yellow);
  z-index: 15;
}

.note-element:hover:not(.note-playing) {
  transform: translate(-50%, -50%) scale(1.1);
  z-index: 12;
}

/* Open String Notes (Nut Area) - Keep filled style */
.note-element.fret-0 {
  left: 40px !important; /* Position over nut */
  width: 36px;
  height: 36px;
  border-radius: 18px;
}

.note-element.fret-0.note-root {
  background: var(--red);
  color: var(--text-primary);
  border: none;
}

.note-element.fret-0.note-pattern,
.note-element.fret-0.note-open {
  background: var(--blue);
  color: var(--text-primary);
  border: none;
}

.note-element.fret-0.note-scale {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 2px solid var(--border-color);
}

/* Fret Numbers */
.fret-numbers {
  position: relative;
  width: 100%;
  margin-top: 10px;
  height: 30px;
}

.fret-number {
  position: absolute;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  font-family: "Instrument Sans", sans-serif;
  transform: translateX(-50%);
}

.fret-number:first-child {
  display: none; /* Hide the empty first column */
}

/* Position each fret number at the center of its fret space */
.fret-number:nth-child(2) { left: calc(80px + 4.167%); }  /* Fret 1 */
.fret-number:nth-child(3) { left: calc(80px + 12.5%); }   /* Fret 2 */
.fret-number:nth-child(4) { left: calc(80px + 20.833%); } /* Fret 3 */
.fret-number:nth-child(5) { left: calc(80px + 29.167%); } /* Fret 4 */
.fret-number:nth-child(6) { left: calc(80px + 37.5%); }   /* Fret 5 */
.fret-number:nth-child(7) { left: calc(80px + 45.833%); } /* Fret 6 */
.fret-number:nth-child(8) { left: calc(80px + 54.167%); } /* Fret 7 */
.fret-number:nth-child(9) { left: calc(80px + 62.5%); }   /* Fret 8 */
.fret-number:nth-child(10) { left: calc(80px + 70.833%); } /* Fret 9 */
.fret-number:nth-child(11) { left: calc(80px + 79.167%); } /* Fret 10 */
.fret-number:nth-child(12) { left: calc(80px + 87.5%); }   /* Fret 11 */
.fret-number:nth-child(13) { left: calc(80px + 95.833%); } /* Fret 12 */

.fret-number:first-child {
  /* Empty space above string names */
}

/* Fretboard Key */
.fretboard-key {
  margin-bottom: 32px;
}

.fretboard-key h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  font-family: "Instrument Sans", sans-serif;
}

.legend {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-primary);
  font-family: "Instrument Sans", sans-serif;
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  flex-shrink: 0;
}

.legend-root {
  background: var(--bg-primary);
  border: 2px solid var(--red);
}
.legend-pattern {
  background: var(--bg-primary);
  border: 2px solid var(--blue);
}
.legend-scale {
  background: var(--bg-primary);
  border: 2px solid var(--border-color);
}
.legend-playing {
  background: var(--yellow);
}

/* Info Panel */
.info-panel {
  margin-bottom: 32px;
}

.info-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  font-family: "Instrument Sans", sans-serif;
}

.info-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
  font-family: "Instrument Sans", sans-serif;
}

.info-notes {
  font-size: 14px;
  font-family: "Instrument Sans", sans-serif;
}

.info-label {
  color: var(--text-primary);
  font-weight: 500;
}

.scale-notes {
  color: var(--red);
  font-weight: 600;
}

/* Practice Tips */
.tips {
  margin-bottom: 32px;
}

.tips-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 24px;
  font-family: "Instrument Sans", sans-serif;
}

.tips-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.tips-section {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
}

.tips-section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  font-family: "Instrument Sans", sans-serif;
}

.tips-list {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  font-family: "Instrument Sans", sans-serif;
}

/* Chord Search */
.chord-search {
  margin-bottom: 24px;
}

.search-input {
  width: 100%;
  max-width: 400px;
  padding: 12px 20px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  font-family: "Instrument Sans", sans-serif;
}

.search-input:focus {
  border-color: var(--text-primary);
}

.search-input::placeholder {
  color: var(--text-muted);
}

/* Chord Grid */
.chord-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 24px;
}

.chord-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  transition: all 0.2s ease;
}

.chord-card:hover {
  border-color: var(--text-primary);
}

.chord-name {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
  font-family: "Instrument Sans", sans-serif;
}

.chord-variant {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
  font-family: "Instrument Sans", sans-serif;
}

.chord-diagram {
  width: 120px;
  height: 160px;
  margin: 0 auto 16px;
  position: relative;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.chord-frets {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  bottom: 8px;
}

.chord-fret-line,
.chord-string-line {
  background: var(--border-color);
  position: absolute;
}

.chord-fret-line {
  width: 100%;
  height: 1px;
}

.chord-string-line {
  height: 100%;
  width: 1px;
}

.chord-finger {
  position: absolute;
  width: 16px;
  height: 16px;
  background: var(--blue);
  border-radius: 50%;
  color: var(--text-primary);
  font-size: 10px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%);
  font-family: "Instrument Sans", sans-serif;
}

.chord-finger.root {
  background: var(--red);
}

.chord-open,
.chord-mute {
  position: absolute;
  top: -18px;
  font-size: 12px;
  font-weight: bold;
  transform: translateX(-50%);
  font-family: "Instrument Sans", sans-serif;
}

.chord-open {
  color: var(--blue);
}
.chord-mute {
  color: var(--red);
}

.chord-fingering {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-family: "Instrument Sans", monospace;
}

.play-chord-btn {
  background: var(--blue);
  border: none;
  border-radius: 16px;
  padding: 8px 16px;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: "Instrument Sans", sans-serif;
}

.play-chord-btn:hover {
  background: #5ac7ef;
}

.play-chord-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Tuner Modal */
.tuner-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.tuner-modal.hidden {
  display: none;
}

.tuner-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
}

.tuner-content {
  position: relative;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 32px;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

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

.tuner-title {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
  font-family: "Instrument Sans", sans-serif;
}

.close-tuner-btn {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

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

.tuner-status {
  text-align: center;
  margin-bottom: 32px;
}

.tuner-status-text {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  font-family: "Instrument Sans", sans-serif;
}

.start-tuner-btn,
.stop-tuner-btn {
  background: var(--blue);
  border: none;
  border-radius: 20px;
  padding: 12px 24px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: "Instrument Sans", sans-serif;
}

.stop-tuner-btn {
  background: var(--red);
}

.start-tuner-btn:hover {
  background: #5ac7ef;
}

.stop-tuner-btn:hover {
  background: #ff4c54;
}

.tuning-display {
  text-align: center;
  margin-bottom: 32px;
}

.note-display {
  font-size: 48px;
  font-weight: 700;
  margin-bottom: 12px;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Instrument Sans", sans-serif;
}

.frequency-display {
  font-size: 16px;
  color: var(--text-secondary);
  font-family: "Instrument Sans", sans-serif;
}

.tuning-meter {
  max-width: 320px;
  margin: 24px auto;
}

.meter-background {
  position: relative;
  height: 60px;
  background: linear-gradient(
    90deg,
    var(--red) 0%,
    var(--yellow) 25%,
    var(--blue) 45%,
    var(--blue) 55%,
    var(--yellow) 75%,
    var(--red) 100%
  );
  border-radius: 30px;
  overflow: hidden;
}

.meter-needle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--text-primary);
  left: 50%;
  transform: translateX(-50%);
  transition: all 0.2s ease;
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
}

.meter-markers {
  display: flex;
  justify-content: space-between;
  padding: 12px 16px 0;
  font-size: 16px;
  font-weight: 600;
  font-family: "Instrument Sans", sans-serif;
}

.string-targets {
  margin-bottom: 24px;
}

.targets-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  text-align: center;
  font-family: "Instrument Sans", sans-serif;
}

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

.string-target {
  text-align: center;
  padding: 12px 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.string-target.active {
  border-color: var(--blue);
  background: rgba(105, 215, 255, 0.1);
}

.string-target.in-tune {
  background: var(--blue);
  color: var(--text-primary);
  border-color: var(--blue);
}

.target-string {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  font-family: "Instrument Sans", sans-serif;
}

.target-note {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
  font-family: "Instrument Sans", sans-serif;
}

.target-freq {
  font-size: 10px;
  color: var(--text-secondary);
  font-family: "Instrument Sans", sans-serif;
}

.tuner-instructions {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}

.tuner-instructions p {
  margin: 4px 0;
  color: var(--text-secondary);
  font-size: 12px;
  font-family: "Instrument Sans", sans-serif;
}

/* Hidden Elements for JavaScript Compatibility */
.js-compatibility {
  display: none !important;
}

.header,
.audio-status,
.controls-grid,
.control-group,
.label,
.button-container,
.button,
.button-secondary,
.button-tertiary,
.fretboard-title {
  display: none !important;
}

.hidden {
  display: none !important;
}

.play-icon.hidden {
  display: none;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .row-one,
  .row-two,
  .row-three {
    flex-direction: column;
    gap: 16px;
    height: auto;
    padding: 16px 20px;
  }

  .row-two {
    justify-content: center;
  }

  .app-title-section,
  .top-controls,
  .tab-navigation,
  .volume-controls,
  .action-buttons,
  .tempo-control {
    width: auto;
  }

  .app-title-section::after,
  .tab-navigation::after {
    display: none;
  }

  .instrument-button.active::after,
  .tab-button.active::after {
    display: none;
  }

  .instrument-nav {
    gap: 24px;
    justify-content: center;
    margin-left: 0;
  }

  .tab-navigation {
    justify-content: center;
  }

  .volume-controls {
    flex-direction: row;
    gap: 16px;
    justify-content: center;
  }

  .audio-control {
    justify-content: center;
  }

  .control-selects {
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-right: 0;
  }

  .action-buttons {
    flex-wrap: wrap;
    justify-content: center;
    width: auto;
  }

  .play-button {
    margin-right: 0;
  }
}

@media (max-width: 768px) {
  .main-content {
    padding: 24px;
  }

  .fretboard-container {
    border-radius: 6px;
  }

  .fretboard-grid {
    grid-template-columns: 60px repeat(12, 1fr) 60px;
    grid-template-rows: repeat(6, 50px);
    min-height: 300px;
  }

  .fretboard-grid.ukulele,
  .fretboard-grid.mandolin {
    grid-template-rows: repeat(4, 50px);
    min-height: 200px;
  }

  .string-names {
    grid-column: 1;
  }

  .string-name {
    font-size: 16px;
  }

  .note-element {
    width: 36px;
    height: 28px;
    border-radius: 6px;
    font-size: 11px;
  }

  .note-element.fret-0 {
    left: 30px !important;
    width: 32px;
    height: 32px;
    border-radius: 16px;
  }

  .note-element.fret-0.note-root {
    background: var(--red);
    color: var(--text-primary);
    border: none;
  }

  .note-element.fret-0.note-pattern,
  .note-element.fret-0.note-open {
    background: var(--blue);
    color: var(--text-primary);
    border: none;
  }

  .note-element.fret-0.note-scale {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
  }

  .fret-numbers {
    position: relative;
    width: 100%;
    margin-top: 10px;
    height: 30px;
  }

  .fret-number {
    position: absolute;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    font-family: "Instrument Sans", sans-serif;
    transform: translateX(-50%);
  }

  /* Mobile positioning for 60px base */
  .fret-number:nth-child(2) { left: calc(60px + 4.167%); }  /* Fret 1 */
  .fret-number:nth-child(3) { left: calc(60px + 12.5%); }   /* Fret 2 */
  .fret-number:nth-child(4) { left: calc(60px + 20.833%); } /* Fret 3 */
  .fret-number:nth-child(5) { left: calc(60px + 29.167%); } /* Fret 4 */
  .fret-number:nth-child(6) { left: calc(60px + 37.5%); }   /* Fret 5 */
  .fret-number:nth-child(7) { left: calc(60px + 45.833%); } /* Fret 6 */
  .fret-number:nth-child(8) { left: calc(60px + 54.167%); } /* Fret 7 */
  .fret-number:nth-child(9) { left: calc(60px + 62.5%); }   /* Fret 8 */
  .fret-number:nth-child(10) { left: calc(60px + 70.833%); } /* Fret 9 */
  .fret-number:nth-child(11) { left: calc(60px + 79.167%); } /* Fret 10 */
  .fret-number:nth-child(12) { left: calc(60px + 87.5%); }   /* Fret 11 */
  .fret-number:nth-child(13) { left: calc(60px + 95.833%); } /* Fret 12 */

  /* Adjust fret wire positions for mobile */
  .fret-wire:nth-child(2) { left: calc(60px + 8.333%); }
  .fret-wire:nth-child(3) { left: calc(60px + 16.667%); }
  .fret-wire:nth-child(4) { left: calc(60px + 25%); }
  .fret-wire:nth-child(5) { left: calc(60px + 33.333%); }
  .fret-wire:nth-child(6) { left: calc(60px + 41.667%); }
  .fret-wire:nth-child(7) { left: calc(60px + 50%); }
  .fret-wire:nth-child(8) { left: calc(60px + 58.333%); }
  .fret-wire:nth-child(9) { left: calc(60px + 66.667%); }
  .fret-wire:nth-child(10) { left: calc(60px + 75%); }
  .fret-wire:nth-child(11) { left: calc(60px + 83.333%); }
  .fret-wire:nth-child(12) { left: calc(60px + 91.667%); }
  .fret-wire:nth-child(13) { left: calc(60px + 99.9%); }

  .string-line {
    left: 60px;
  }

  .fret-marker.fret-3 { left: calc(60px + 20.833%); }
  .fret-marker.fret-5 { left: calc(60px + 37.5%); }
  .fret-marker.fret-7 { left: calc(60px + 54.167%); }
  .fret-marker.fret-9 { left: calc(60px + 70.833%); }
  .fret-marker.fret-12 { left: calc(60px + 95.833%); }

  /* Adjust string line positions for mobile - keep thickness variations */
  .string-line:nth-child(14) { top: 25px; height: 2px; }  /* High E - 2px */
  .string-line:nth-child(15) { top: 75px; height: 2px; }  /* B - 2px */
  .string-line:nth-child(16) { top: 125px; height: 3px; } /* G - 3px */
  .string-line:nth-child(17) { top: 175px; height: 4px; } /* D - 4px */
  .string-line:nth-child(18) { top: 225px; height: 6px; } /* A - 6px */
  .string-line:nth-child(19) { top: 275px; height: 8px; } /* Low E - 8px */

  .fretboard-container.ukulele .string-line:nth-child(14) { top: 25px; height: 2px; }
  .fretboard-container.ukulele .string-line:nth-child(15) { top: 75px; height: 3px; }
  .fretboard-container.ukulele .string-line:nth-child(16) { top: 125px; height: 4px; }
  .fretboard-container.ukulele .string-line:nth-child(17) { top: 175px; height: 6px; }

  .fretboard-container.mandolin .string-line:nth-child(14) { top: 25px; height: 2px; }
  .fretboard-container.mandolin .string-line:nth-child(15) { top: 75px; height: 3px; }
  .fretboard-container.mandolin .string-line:nth-child(16) { top: 125px; height: 4px; }
  .fretboard-container.mandolin .string-line:nth-child(17) { top: 175px; height: 6px; }

  .tips-grid {
    grid-template-columns: 1fr;
  }

  .legend {
    gap: 16px;
    justify-content: center;
  }

  .chord-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}

@media (max-width: 480px) {
  .fretboard-container {
    padding: 0 25px; /* Adjust padding for smallest screens */
  }

  .fretboard-grid {
    grid-template-columns: 50px repeat(12, 1fr);
    grid-template-rows: repeat(6, 45px);
    min-height: 270px;
  }

  .fretboard-grid.ukulele,
  .fretboard-grid.mandolin {
    grid-template-rows: repeat(4, 45px);
    min-height: 180px;
  }

  .string-name {
    font-size: 14px;
  }

  .note-element {
    width: 32px;
    height: 24px;
    border-radius: 5px;
    font-size: 10px;
  }

  .note-element.fret-0 {
    left: 25px !important;
    width: 28px;
    height: 28px;
    border-radius: 14px;
  }

  .note-element.fret-0.note-root {
    background: var(--red);
    color: var(--text-primary);
    border: none;
  }

  .note-element.fret-0.note-pattern,
  .note-element.fret-0.note-open {
    background: var(--blue);
    color: var(--text-primary);
    border: none;
  }

  .note-element.fret-0.note-scale {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
  }

  .fret-numbers {
    position: relative;
    width: 100%;
    margin-top: 10px;
    height: 30px;
  }

  .fret-number {
    position: absolute;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    font-family: "Instrument Sans", sans-serif;
    transform: translateX(-50%);
  }

  /* Small screen positioning for 50px base */
  .fret-number:nth-child(2) { left: calc(50px + 4.167%); }  /* Fret 1 */
  .fret-number:nth-child(3) { left: calc(50px + 12.5%); }   /* Fret 2 */
  .fret-number:nth-child(4) { left: calc(50px + 20.833%); } /* Fret 3 */
  .fret-number:nth-child(5) { left: calc(50px + 29.167%); } /* Fret 4 */
  .fret-number:nth-child(6) { left: calc(50px + 37.5%); }   /* Fret 5 */
  .fret-number:nth-child(7) { left: calc(50px + 45.833%); } /* Fret 6 */
  .fret-number:nth-child(8) { left: calc(50px + 54.167%); } /* Fret 7 */
  .fret-number:nth-child(9) { left: calc(50px + 62.5%); }   /* Fret 8 */
  .fret-number:nth-child(10) { left: calc(50px + 70.833%); } /* Fret 9 */
  .fret-number:nth-child(11) { left: calc(50px + 79.167%); } /* Fret 10 */
  .fret-number:nth-child(12) { left: calc(50px + 87.5%); }   /* Fret 11 */
  .fret-number:nth-child(13) { left: calc(50px + 95.833%); } /* Fret 12 */

  /* Further adjust for very small screens */
  .fret-wire:nth-child(2) { left: calc(50px + 8.333%); }
  .fret-wire:nth-child(3) { left: calc(50px + 16.667%); }
  .fret-wire:nth-child(4) { left: calc(50px + 25%); }
  .fret-wire:nth-child(5) { left: calc(50px + 33.333%); }
  .fret-wire:nth-child(6) { left: calc(50px + 41.667%); }
  .fret-wire:nth-child(7) { left: calc(50px + 50%); }
  .fret-wire:nth-child(8) { left: calc(50px + 58.333%); }
  .fret-wire:nth-child(9) { left: calc(50px + 66.667%); }
  .fret-wire:nth-child(10) { left: calc(50px + 75%); }
  .fret-wire:nth-child(11) { left: calc(50px + 83.333%); }
  .fret-wire:nth-child(12) { left: calc(50px + 91.667%); }
  .fret-wire:nth-child(13) { left: calc(50px + 100%); }

  .string-line {
    left: 50px;
  }

  .fret-marker.fret-3 { left: calc(50px + 20.833%); }
  .fret-marker.fret-5 { left: calc(50px + 37.5%); }
  .fret-marker.fret-7 { left: calc(50px + 54.167%); }
  .fret-marker.fret-9 { left: calc(50px + 70.833%); }
  .fret-marker.fret-12 { left: calc(50px + 95.833%); }
}
}