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

body {
    font-family: Arial, sans-serif;
    background-color: #1a1a1a;
    color: #fff;
    /*padding: 2px 10px;*/
    /*min-height: 100vh;*/
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    flex-direction: column;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    gap: 32px;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    
}

.header-left {
    flex-basis: 25%;
    max-width: 25%;
    min-width: 100px;
}

.header-right {
    flex-basis: 75%;
    max-width: 75%;
    min-width: 100px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}

.header-center {
    flex: 1;
    max-width: 400px;
}

.donate-btn {
    background-color: #FF6B00;
    color: white;
    margin-left: 8px;
    padding: 1px 4px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-family: 'Jolly Lodger', cursive;
    font-size: 1.2em;
    text-align: center;
    transition: background-color 0.3s;
    line-height: 1;
}

.donate-btn::after {
    content: "Buy me a coffee if you like the app";
    position: absolute;
    background: #333;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    top: 100%;
    left: 100%;
    transform: translateX(-50%);
    margin-top: 4px;
    z-index: 100;
    border: 1px solid #666;
}

.donate-btn:hover::after {
    opacity: 1;
}

h1 {
    color: #ff6b1a;
    font-size: 0.9em;
    font-weight: bold;
}

.export-btn {
    background-color: #333;
    color: white;
    border: none;
    padding: 2px 8px;
    margin: 0;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s;
    font-size: 0.9em;
    line-height: 1.2;
    white-space: nowrap;
    position: relative;
}

.export-btn::after {
    content: "Export current view to PNG";
    position: absolute;
    background: #333;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 4px;
    z-index: 100;
    border: 1px solid #666;
}

.export-btn:hover::after {
    opacity: 1;
}

.export-btn:hover {
    background-color: #444;
}

.fretboard-container {
    /*background-color: #242424;*/
    border-radius: 8px;
    /*padding: 12px 12px 12px 2px;*/
    margin: 0;
    /*height: 480px;*/
    display: flex;
    flex-direction: column;
}

.view-title-input {
    width: 100%;
    font-size: 0.9em;
    flex: 2;
    background-color: #333;
    padding-left: 4px;
    border: none;
    border-right: 1px solid #666;
    border-radius: 4px;
    color: #fff;
    outline: none;
    min-width: 70;
    line-height: 0.6;
    margin: 0;
}

.fretboard {
    width: 100%;
    height: auto;
    margin: 0;
    max-width: 850px;
    display: grid;
    grid-template-columns: auto repeat(24, 1fr);
    grid-template-rows: repeat(6, 1fr) 14px 14px;
    gap: 0;
    background-color: #1a1a1a;
    padding: 0;
    border-radius: 5px;
    min-height: 170px;
}

/* Adjust grid and height for 7 strings */
[data-instrument="7string"] .fretboard {
    grid-template-rows: repeat(7, 1fr) 14px 14px;
    min-height: 190px;
}

/* Adjust grid and height for 8 strings */
[data-instrument="8string"] .fretboard {
    grid-template-rows: repeat(8, 1fr) 14px 14px;
    min-height: 210px;
}

.fret-numbers {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: auto repeat(24, 1fr);
    gap: 0;
    background-color: #1a1a1a;
    height: 14px;
    align-items: center;
}

.fret-number {
    text-align: center;
    color: #888;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75em;
    width: 100%;
    height: 100%;
}

.fret-markers {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: auto repeat(24, 1fr);
    gap: 0;
    background-color: #1a1a1a;
    height: 14px;
    align-items: center;
}

.fret-marker {
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.dot {
    width: 4px;
    height: 4px;
    background-color: #666;
    border-radius: 50%;
}

.double-dot {
    display: flex;
    gap: 2px;
    justify-content: center;
}

.double-dot::before,
.double-dot::after {
    content: '';
    width: 4px;
    height: 4px;
    background-color: #666;
    border-radius: 50%;
}

.note-circle {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75em;
    color: white;
    position: relative;
    z-index: 2;
}

.string-tune-btn {
    padding: 1px 3px;
    font-size: 0.75em;
}

.string-label {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    font-weight: bold;
    min-width: 60px;
    white-space: nowrap;
    background-color: #1a1a1a;
    font-size: 12px;
    padding: 0 4px;
}

.controls {
        margin: 0;
        padding: 4px 0;
        background-color: #1a1a1a;
        border-bottom: 0px solid #333; /*line before fretboard*/
        display: flex;
        flex-direction: column;
    }

/* Desktop margins */
[data-instrument="6string"] .controls {
    margin-top: 0;
}

[data-instrument="7string"] .controls {
    margin-top: 0;
}

[data-instrument="8string"] .controls {
    margin-top: 0;
}

.key-selector {
    display: flex;
    align-items: center;
    margin-left: 12px;
    padding: 0 2px;
    border: 0px solid #666;
    border-radius: 4px;
    background-color: #333;
}

.key-selector .key-btn {
    border: none;
    background: none;
    padding: 0 6px;
    height: 28px;
    border-radius: 3px;
}

.key-selector .key-btn:hover {
    background-color: #444;
}

.key-selector .key-btn.active {
    background-color: #ff6b1a;
}

.scale-selector {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 16px;
}

.scale-row {
    display: flex;
    gap: 4px;
    justify-content: space-between;
}

.scale-btn {
    flex: 1;
    min-width: 0;
    padding: 6px 8px;
    font-size: 0.9em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Common button styles */
.key-btn,
.scale-btn,
.chord-btn,
.string-group-btn {
    background-color: #333;
    color: white;
    border: none;
    padding: 4px 12px;
    margin: 0;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s;
    flex: 1;
    min-width: 0;
}

.key-btn.active,
.scale-btn.active,
.chord-btn.active,
.string-group-btn.active {
    background-color: #FF6B00;
    color: white;
}

.key-btn:hover, .scale-btn:hover {
    background-color: #555;
}

.key-btn.active:hover, .scale-btn.active:hover {
    background-color: #e65100;
}

.header-buttons {
    display: flex;
    align-items: center;
    gap: 4px;
}

#noteColorPicker {
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
}

#noteColorPicker::-webkit-color-swatch-wrapper {
    padding: 0;
}

#noteColorPicker::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.reset-btn {
    background-color: #333;
    color: white;
    border: none;
    border-right: 1px solid #666;
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.3s;
    position: relative;
}

.reset-btn::after {
    content: "Reset user-selected notes";
    position: absolute;
    background: #333;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9em;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 4px;
    z-index: 100;
    border: 1px solid #666;
}

/*.reset-btn:hover::after {
    opacity: 1;
}*/

/*.reset-btn:hover {
    background-color: #444;
}*/

.mode-selector {
    display: flex;
    gap: 2px;
    background-color: #333;
    padding: 2px;
    border-radius: 5px;
    border: 0px solid #666;
}

.mode-btn {
    background-color: #333;
    color: white;
    border: none;
    padding: 2px 8px;
    margin: 0;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s;
    position: relative;
    line-height: 1.2;
    font-size: 0.9em;
}

.mode-btn.active {
    background-color: #FF6B00;
}

.button-icon {
    width: 20px;
    height: 20px;
    display: block;
    filter: invert(1);
}

/*Icons source: https://iconduck.com/icons/60187/minuet-chords*/

.mode-btn.active .button-icon {
    filter: invert(1);
}

.mode-content {
    display: none;
    margin: 0;
    padding: 0;
    flex: 0 0 auto;
}

.mode-content.active {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0;
    padding: 0;
    flex: 0 0 auto;
}

.notation-btn {
    height: 24px;
    background-color: #333;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s;
    font-size: 0.9em;
    white-space: nowrap;
    margin-left: 2px;
    margin-right: 2px;
    padding: 2px 4px;
    position: relative;
}

.notation-btn:hover {
    background-color: #444;
}

.notation-btn:last-of-type {
    margin-right: 4px;
}

.notation-btn[data-tooltip="sharp-flat"]::after {
    content: "Toggle between sharp (♯) and flat (♭) notation";
    position: absolute;
    background: #333;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-family: Arial, sans-serif;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 4px;
    z-index: 100;
    border: 1px solid #666;
}

.notation-btn[data-tooltip="notes-degrees"]::after {
    content: "Toggle between note names and scale/chord degrees";
    position: absolute;
    background: #333;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-family: Arial, sans-serif;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 4px;
    z-index: 100;
    border: 1px solid #666;
}

.notation-btn:hover::after {
    background-color: #444;
}

/* Add handedness toggle styles */
#handednessToggle {
    background-color: #333;
    color: white;
    border: none;
    padding: 6px 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s;
}

#handednessToggle:hover {
    background-color: #444;
}

#handednessToggle.active {
    background-color: #FF6B00;
}

#handednessToggle::after {
    content: "Switch between left-handed and right-handed layout";
    position: absolute;
    background: #333;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-family: Arial, sans-serif;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 4px;
    z-index: 100;
    border: 1px solid #666;
}

#handednessToggle:hover::after {
    opacity: 1;
}

/*deprec
.footer {
    margin-top: 20px;
    padding: 15px;
    border-top: 1px solid #333;
    text-align: center;
    position: relative;
    z-index: 1;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}*/

.tuning-controls {
    display: flex;
    align-items: center;
    /*margin-top: 6px;*/
    gap: 4px;
}

.tuning-controls .instrument-btn,
.tuning-controls .tune-btn,
.tuning-controls .mode-btn,
.tuning-controls .key-btn {
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    /*padding: 2px 4px;*/
    font-size: 0.9em;
    border: 0px solid #666;
    border-radius: 4px;
    background-color: #333;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tuning-controls .button-group {
    height: 24px;
    display: flex;
    align-items: center;
    padding: 0;
}

.instrument-btn {
    padding: 4px 8px;
    background-color: #444;
    color: #fff;
    border: 1px solid #666;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    min-width: 110px;
    position: relative;
    text-overflow: ellipsis;
}

.instrument-btn::after {
    content: "Select an instrument";
    position: absolute;
    background: #333;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 4px;
    z-index: 100;
    border: 1px solid #666;
}

.instrument-btn:hover {
    background-color: #555;
}

.instrument-btn:hover::after {
    opacity: 1;
}

.tune-btn {
    padding: 4px 8px;
    background-color: #444;
    color: #fff;
    border: 1px solid #666;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
}

.tuning-display {
    color: #fff;
    font-size: 0.9em;
    min-width: 100px;
    text-align: center;
}

.key-btn {
    padding: 4px 6px;
    background-color: #444;
    color: #fff;
    margin-left: 4px;
    border: 0px solid #666;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8em;
    min-width: 24px;
}

.key-btn:last-of-type {
    margin-right: 4px;
}

.instrument-options {
    display: none;
    position: absolute;
    background-color: #2a2a2a;
    border: 1px solid #444;
    border-radius: 4px;
    z-index: 1000;
    margin: 5px 0 0 2px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.instrument-options.show {
    display: block;
}

.instrument-option {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: none;
    color: #fff;
    text-align: left;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s ease;
}

.instrument-option:hover {
    background-color: #3a3a3a;
}

/* Update string group buttons for different instruments */
[data-instrument="bass"] .string-group-row {
    display: none;
}

[data-instrument="7string"] .string-group-row button:nth-child(4),
[data-instrument="8string"] .string-group-row button:nth-child(4) {
    display: none;
}

.title-container {
    display: flex;
    align-items: center;
    position: relative;
    cursor: pointer;
}

.desktop-title, .mobile-title {
    position: relative;
}

.desktop-title::after, .mobile-title::after {
    content: "Click to view version history";
    position: absolute;
    background: #333;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-family: Arial, sans-serif;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    top: 100%;
    left: 30%;
    transform: translateX(-50%);
    margin-top: 4px;
    z-index: 100;
    border: 1px solid #666;
}

.desktop-title:hover::after, .mobile-title:hover::after {
    opacity: 1;
}

.title-container h1 {
    font-family: 'Jolly Lodger', cursive;
    font-size: 3.5em;
    margin: 0;
    color: #FF6B00;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    line-height: 1.2;
}

.mobile-title {
    display: none;  /* Hidden by default */
}

.desktop-title {
    display: block;  /* Shown by default */
}

.version-container {
    position: relative;
    display: inline-block;
}

.version {
    cursor: pointer;
    color: #666;
    font-size: 0.8em;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.version:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.version-history-popup {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #242424;
    border: 1px solid #444;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    padding: 15px;
    width: 500px;
    z-index: 1000;
    margin-top: 5px;
    color: #fff;
}

.version-history-popup.show {
    display: block;
}

.version-history-content h3 {
    margin: 0 0 10px 0;
    color: #fff;
    font-size: 0.8em;
}

.version-history-list {
    margin-bottom: 15px;
}

.version-entry {
    display: flex;
    margin-bottom: 5px;
    color: #888;
    font-size: 0.8em;
}

.version-desc {
    margin-left: 10px;
    color: #ccc;
}

/* Orientation warning styles */
.orientation-warning {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #1a1a1a;
    z-index: 9999;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
}

.orientation-warning p {
    font-size: 1.5em;
    color: #ff6b1a;
    max-width: 80%;
}

/* Reset Scale button within mode selector */
#resetScaleBtn.mode-btn {
    background-color: #333;
    border-right: 1px solid #666;
    padding-right: 12px;
    margin-right: 2px;
    position: relative;
}

#resetScaleBtn.mode-btn::after {
    content: "Reset scales or chord notes";
    position: absolute;
    background: #333;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9em;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 4px;
    z-index: 100;
    border: 1px solid #666;
}

#resetScaleBtn.mode-btn:hover::after {
    opacity: 1;
}

/* Export group container styles */
.export-group-container {
    /*min-width: 100px;*/
}

.mode-selector, .export-group-container {
    display: flex;
    gap: 2px;
    background-color: #333;
    padding: 2px;
    border-radius: 5px;
    border: 0px solid #666;
}

.chord-row {
    display: flex;
    gap: 1px;
    justify-content: space-between;
    margin: 0;
    padding: 0;
}

.chord-btn {
    flex: 1;
    padding: 4px 2px;
    margin: 1px;
    border: 0px solid #666;
    border-radius: 3px;
    background-color: #444;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chord-btn.active {
    background-color: #ff6b1a;
    color: white;
    border-color: #ff6b1a;
}

.chord-btn.active:hover {
    background-color: #e65100;
}

.global-tuning-controls {
    display: flex;
    gap: 1px;
    position: relative;
    margin-left: 4px;
    padding: 0;
}

.global-tuning-controls::after {
    content: "Adjust global tuning";
    position: absolute;
    background: #333;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
        font-size: 0.8em;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 4px;
    z-index: 100;
    border: 1px solid #666;
}

.global-tuning-controls:hover::after {
    opacity: 1;
}

.tune-btn {
    padding: 4px 8px;
    margin: 0;
    border: 1px solid #666;
    border-radius: 4px;
    background-color: #444;
    color: #fff;
    cursor: pointer;
    font-size: 0.9em;
    min-width: 24px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.tune-btn:hover {
    background-color: #555;
}

.tune-btn:active {
    background-color: #ff6b1a;
    color: white;
    border-color: #ff6b1a;
}

/* Dropdown styles */
.melodic-minor-dropdown,
.harmonic-minor-dropdown,
.pentatonic-dropdown,
.special-chords-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #333;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1000;
    border-radius: 4px;
    margin-top: 4px;
}

.pentatonic-dropdown .dropdown-content,
.melodic-minor-dropdown .dropdown-content,
.harmonic-minor-dropdown .dropdown-content {
    /* Add padding to top */
    padding-top: 0px;
    /* Pull content up with negative margin */
    margin-top: -0px;
    /* Make sure the padding area is part of hover zone */
    pointer-events: auto;
}

.pentatonic-dropdown:hover .dropdown-content,
.melodic-minor-dropdown:hover .dropdown-content,
.harmonic-minor-dropdown:hover .dropdown-content {
    display: flex;
    flex-direction: column;
}

.dropdown-content .scale-btn:hover {
    background-color: #444;
    display: flex;
    flex-direction: column;
}

.dropdown-content .scale-btn:first-child {
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
}

.dropdown-content .scale-btn:last-child {
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
}

.special-chords-dropdown .dropdown-content {
    display: none;
    position: absolute;
    background-color: #333;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1000;
    border-radius: 4px;
    padding: 4px;
    right: 0;
    top: 100%; /* Position directly below button */
    margin-top: 0; /* Remove gap */
}

.special-chords-dropdown:hover .dropdown-content {
    display: block;
}

.special-chords-dropdown .dropdown-content .chord-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 12px;
    margin: 0px 0;
    border-radius: 0px;
    white-space: nowrap;
}

.special-chords-dropdown .dropdown-content {
    /* Add padding to top */
    padding-top: 0px;
    /* Pull content up with negative margin */
    margin-top: -0px;
    /* Make sure the padding area is part of hover zone */
    pointer-events: auto;
}

.special-chords-dropdown .dropdown-btn {
    background-color: #006400;  /* Dark green */
    color: #fff;
    padding: 4px 12px;
    border: 1px solid #008000;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    min-width: 120px;  /* Make button wider */
    text-align: center;
}

.special-chords-dropdown .dropdown-btn::after {
    display: none;  /* Remove the triangle */
}

.special-chords-dropdown .dropdown-btn:hover,
.special-chords-dropdown .dropdown-btn.active {
    background-color: #008000;  /* Lighter green on hover/active */
}

/* Update dropdown content position to align with wider button */
.special-chords-dropdown .dropdown-content {
    min-width: 120px;  /* Match button width */
    left: 50%;
    transform: translateX(-50%);
}

/* Update button group styles */
.button-group {
    display: inline-flex;
    padding: 2px;
    background-color: #333;
    border: 0px solid #666;
    border-radius: 4px;
    gap: 4px;
    align-items: center;
}

.color-palette {
    display: flex;
    gap: 0;
    align-items: center;
    height: 24px;
}

.color-btn {
    width: 24px;
    height: 24px;
    border: 2px solid transparent;
    box-sizing: border-box;
    border-radius: 4px;
    cursor: pointer;
    margin: 0;
    margin-right: 2px;
    transition: border-color 0.2s;
}

.color-btn:hover {
    opacity: 0.8;
    border-color: rgba(255, 255, 255, 0.5);
}

.color-btn.active {
    border: 2px solid white;
}

.color-btn:first-child {
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
}

.color-btn:last-child {
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
}

.color-btn:hover {
    border-color: #fff;
}

.metronome-controls {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-right: 2px;
}

.metronome-btn {
    height: 24px;
    padding: 0 8px;
    background-color: #333;
    color: white;
    
    border: 0px solid #666;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.3s;
}

#toggleMetronome {
    min-width: 70px;
}

.metronome-btn:hover {
    background-color: #444;
}

.metronome-btn.active {
    background-color: #ff6b1a;
}

#decreaseTempo::after {
    content: "Click: -1 BPM, Double click: -5 BPM";
    position: absolute;
    background: #333;
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
        font-size: 0.8em;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    margin-top: 25px;
    margin-left: 25px;
    transform: translateX(-50%);
    z-index: 100;
    border: 1px solid #666;
}

#increaseTempo::after {
    content: "Click: +1 BPM, Double click: +5 BPM";
    position: absolute;
    background: #333;
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8em;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    margin-top: 25px;
    margin-left: 25px;
    transform: translateX(-50%);
    z-index: 100;
    border: 1px solid #666;
}

#toggleMetronome::after {
    content: "Click to start/stop metronome";
    position: absolute;
    background: #333;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    margin-top: 25px;
    margin-left: 25px;
    transform: translateX(-50%);
    z-index: 100;
    border: 1px solid #666;
}

#decreaseTempo:hover::after,
#increaseTempo:hover::after,
#toggleMetronome:hover::after {
    opacity: 1;
}

.metronome-btn:hover {
    background-color: #444;
}

.metronome-btn.active {
    background-color: #ff6b1a;
}

.special-scales-dropdown {
    position: relative;
    display: inline-block;
}

.special-scales-dropdown .dropdown-btn {
    width: 100%;
    text-align: center;
    padding: 4px 12px;
    background-color: #333;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.special-scales-dropdown .dropdown-btn:hover {
    background-color: #444;
}

.special-scales-dropdown .dropdown-content {
    display: none;
    position: absolute;
    background-color: #333;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1000;
    border-radius: 4px;
    margin-top: 4px;
    /* Add padding to top */
    padding-top: 0px;
    /* Pull content up with negative margin */
    margin-top: -0px;
    /* Make sure the padding area is part of hover zone */
    pointer-events: auto;
}

.special-scales-dropdown:hover .dropdown-content {
    display: flex;
    flex-direction: column;
}

.special-scales-dropdown .dropdown-content .scale-btn {
    padding: 4px 12px;
    text-align: left;
    border-radius: 0;
    width: 100%;
}

.special-scales-dropdown .dropdown-content .scale-btn:first-child {
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
}

.special-scales-dropdown .dropdown-content .scale-btn:last-child {
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
}

.special-scales-dropdown .dropdown-content .scale-btn:hover {
    background-color: #444;
}

.scale-btn[data-scale="augmented"],
.scale-btn[data-scale="diminished"] {
    flex: 0 1 12%;
    max-width: 12%;
}

.special-scales-dropdown {
    flex: 0 1 12%;
    max-width: 12%;.
}

.scale-btn[data-scale="custom"] {
    background-color: #8B0000;  /* Dark red */
    border: 0px solid #A52A2A;
    color: #ffffff;
}

.scale-btn[data-scale="custom"]:hover {
    background-color: #A52A2A;  /* Slightly lighter red for hover */
}

.scale-btn[data-scale="custom"].active {
    background-color: #DC143C;  /* Brighter red (crimson) when active */
    border-color: #FF0000;
}

.scale-btn[data-scale="custom"].active:hover {
    background-color: #B22222;  /* Slightly darker active hover */
}

.note-circle.seventh-note {
    background-color: rgba(255, 0, 0, 0.7);
    color: white;
}

.note-circle.seventh-note:hover {
    background-color: rgba(255, 0, 0, 0.9);
}

.fretboard.left-handed {
    transform: scaleX(-1);
}

.fretboard.left-handed .position-cell {
    direction: ltr;
}

.fretboard.left-handed .fret-number {
    direction: ltr;
}

/* Adjust fret markers for left-handed mode */
.fretboard.left-handed .fret-marker {
    direction: ltr;
}

/* Ensure note circles remain correctly oriented */
.fretboard.left-handed .note-circle {
    transform: scaleX(-1); /* Flip the note circles back so text is readable */
}

/* Adjust hover effects for left-handed mode */
.fretboard.left-handed .position-cell:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.mode-btn[data-tooltip="handedness"]::after {
    content: "Switch between left-handed and right-handed layout";
    position: absolute;
    background: #333;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-family: Arial, sans-serif;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 4px;
    z-index: 100;
    border: 1px solid #666;
}

.mode-btn[data-tooltip="handedness"]:hover::after {
    opacity: 1;
}

.mode-btn[data-tooltip="mode"]::after {
    content: attr(data-mode);
    content: attr(data-mode, capitalize);
    content: "Reset or Switch to " attr(data-mode) " mode";
    position: absolute;
    background: #333;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-family: Arial, sans-serif;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 4px;
    z-index: 100;
    border: 1px solid #666;
}

.mode-btn[data-tooltip="mode"]:hover::after {
    opacity: 1;
}

.string-toggles-row {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin: 6px 0;
    padding: 0 16px;
    flex-wrap: wrap;
}

.string-toggle-btn {
    background-color: #333;
    color: #fff;
    border: 0px solid #666;
    border-radius: 4px;
    cursor: pointer;
    padding: 2px 6px;
    margin: 0 2px;
    min-width: 28px;
    height: 28px;
    /*line-height: 20px;*/
    font-size: 0.9em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.string-toggle-btn:hover {
    background-color: #444;
}

.string-toggle-btn.active {
    background-color: #ff6b1a;
    border-color: #ff6b1a;
}

/* Hide 7th and 8th string buttons by default */
.string-toggle-btn[data-string="7"],
.string-toggle-btn[data-string="8"] {
    display: none;
}

/* Show 7th string button for 7-string guitar */
[data-instrument="7string"] .string-toggle-btn[data-string="7"] {
    display: block;
}

/* Show 7th and 8th string buttons for 8-string guitar */
[data-instrument="8string"] .string-toggle-btn[data-string="7"],
[data-instrument="8string"] .string-toggle-btn[data-string="8"] {
    display: block;
}

/* Hide all but first 4 strings for bass */
[data-instrument="bass"] .string-toggle-btn:not([data-string="1"]):not([data-string="2"]):not([data-string="3"]):not([data-string="4"]) {
    display: none;
}

/* Hide all but first 5 strings for 5-string bass */
[data-instrument="5stringbass"] .string-toggle-btn:not([data-string="1"]):not([data-string="2"]):not([data-string="3"]):not([data-string="4"]):not([data-string="5"]) {
    display: none;
}

.string-toggle-btn.all-strings-btn {
    background-color: #4a4a4a;
    color: #fff;
    font-weight: bold;
    margin-left: 8px;
    padding: 4px 12px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 40px;
}

.string-toggle-btn.all-strings-btn:hover {
    background-color: #666;
}

.string-toggle-btn.all-strings-btn.active {
    background-color: #006400;
}

.string-toggle-btn.all-strings-btn.active:hover {
    background-color: #008000;
}

/* Ensure the All button is always visible regardless of instrument type */
[data-instrument] .string-toggle-btn.all-strings-btn {
    display: inline-flex !important;
}

/* Chord dropdown styles */
.special-chords-dropdown {
    position: relative;
    display: inline-block;
}

.special-chords-dropdown .dropdown-content {
    display: none;
    position: absolute;
    background-color: #333;
    min-width: 200px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1000;
    border-radius: 4px;
    padding: 4px;
    max-height: 400px;
    overflow-y: auto;
    top: 100%;
    left: 0;
}

.special-chords-dropdown:hover .dropdown-content {
    display: block;
}

.special-chords-dropdown .dropdown-content .chord-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 2px 12px;
    margin: 0px 0;
    border-radius: 0px;
    white-space: nowrap;
}

.special-chords-dropdown .dropdown-content .chord-btn:hover {
    background-color: #555;
}

/* Make the dropdown button look like other chord buttons */
.special-chords-dropdown .dropdown-btn {
    background-color: #006400;  /* Dark green */
    color: #fff;
    padding: 4px 12px;
    border: 0px solid #008000;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    min-width: 120px;  /* Make button wider */
    text-align: center;
}

.special-chords-dropdown .dropdown-btn::after {
    display: none;  /* Remove the triangle */
}

.special-chords-dropdown .dropdown-btn:hover,
.special-chords-dropdown .dropdown-btn.active {
    background-color: #008000;  /* Lighter green on hover/active */
}

/* Update dropdown content position to align with wider button */
.special-chords-dropdown .dropdown-content {
    min-width: 120px;  /* Match button width */
    left: 50%;
    transform: translateX(-50%);
}

/*Exotic scale dropdown*/
.scale-btn.dropdown-btn {
    background-color: #006400;  /* Dark green */
    color: #fff;
    padding: 4px 12px;
    border: 0px solid #008000;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    text-align: center;
}

.scale-btn.dropdown-btn:hover,
.scale-btn.dropdown-btn.active {
    background-color: #008000;  /* Lighter green on hover/active */
}

.pentatonic-dropdown .dropdown-toggle,
.melodic-minor-dropdown .dropdown-toggle,
.harmonic-minor-dropdown .dropdown-toggle {
    background-color: #006400;  /* Dark green to match Exotic button */
    border: 0px solid #008000;
}

.pentatonic-dropdown .dropdown-toggle:hover,
.pentatonic-dropdown .dropdown-toggle.active,
.melodic-minor-dropdown .dropdown-toggle:hover,
.melodic-minor-dropdown .dropdown-toggle.active,
.harmonic-minor-dropdown .dropdown-toggle:hover,
.harmonic-minor-dropdown .dropdown-toggle.active {
    background-color: #008000;  /* Lighter green on hover/active */
}

.pentatonic-dropdown:hover .dropdown-content,
.melodic-minor-dropdown:hover .dropdown-content,
.harmonic-minor-dropdown:hover .dropdown-content {
    display: block;
}

#playScale {
    min-width: 32px;
    font-size: 0.9em;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#playScale.active {
    background-color: #ff6b1a;
}

#playScale::after {
    content: "Play current scale";
    position: absolute;
    background: #333;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-family: Arial, sans-serif;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    transform: translateX(-50%);
    margin-top: 50px;
    margin-left: 100px;
    z-index: 100;
    border: 1px solid #666;
}

#playScale:hover::after {
    opacity: 1;
}

/* Playback controls styling */
.playback-controls-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0 0 0;
}

.playback-control {
    background-color: #333;
    color: #fff;
    border: 0px solid #666;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 0.9em;
    margin: 0 4px;
    transition: background-color 0.3s, border-color 0.3s;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.playback-control:focus, .playback-control:hover {
    background-color: #444;
    border-color: #ff6b1a;
    outline: none;
}

/* Optional: add a down arrow for selects */
.playback-control-select {
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23fff" height="16" viewBox="0 0 24 24" width="16" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 6px center;
    background-size: 12px 12px;
    padding-right: 24px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

/* Make permutation select look like the other buttons */
.playback-controls #permutationSelect {
    background-color: #333;
    color: white;
    height: 28px;
    padding: 0 24px 0 8px;
    border: none;
    font-size: 0.9em;
    min-width: 50px;
    text-align: center;
}

/* Style the dropdown items with darker background */
#permutationSelect option {
    background-color: #222;
    color: white;
}

/* Ensure dropdown background is dark on all browsers */
#permutationSelect {
    background-color: #333 !important;
}

.playback-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.tempo-controls {
    display: flex;
    align-items: center;
    background-color: #333;
    border-radius: 4px;
    padding: 0;
    border: 0px solid #666;
    overflow: hidden;
}

.playback-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
    background-color: #333;
    border-radius: 4px;
    padding: 0;
    border: 0px solid #666;
    overflow: hidden;
}

/* Update the playback control styles to match the app theme */
.playback-control {
    background-color: #222;
    color: #fff;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.9em;
    transition: background-color 0.3s, border-color 0.3s;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.playback-control:focus, 
.playback-control:hover {
    background-color: #444;
    border-color: #ff6b1a;
    outline: none;
}

/* Custom dropdown arrow style */
.playback-control-select {
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23fff" height="16" viewBox="0 0 24 24" width="16" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 6px center;
    background-size: 12px 12px;
    padding-right: 24px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

/* Custom Scale Interval Controls */
.custom-intervals {
    display: none;
    gap: 4px;
    margin-top: 8px;
}

.interval-btn {
    background-color: #333;
    color: white;
    border: none;
    padding: 2px 4px;
    margin: 0;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s;
    flex: 1;
    min-width: 0;
    /*font-size: 0.75em;*/
    line-height: 1.1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 28px;
}

.interval-btn br {
    margin: 1px 0;
}

.interval-btn:hover {
    background-color: #444;
}

.interval-btn.active {
    background-color: #FF6B00;
    color: white;
}

.interval-btn:disabled {
    opacity: 0.8;
    cursor: not-allowed;
}

#directionBtn {
    min-width: 90px;
    text-align: center;
}

#directionBtn::after {
    content: "Change playback direction";
    position: absolute;
    background: #333;
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8em;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    margin-top: 25px;
    margin-left: 25px;
    transform: translateX(-50%);
    z-index: 100;
    border: 1px solid #666;
}

#directionBtn:hover::after {
    opacity: 1;
}

#intervalBtn {
    min-width: 50px;
    text-align: center;
}

#intervalBtn::after {
    content: "Change interval between notes";
    position: absolute;
    background: #333;
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8em;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    margin-top: 25px;
    margin-left: 25px;
    transform: translateX(-50%);
    z-index: 100;
    border: 1px solid #666;
}

#intervalBtn:hover::after {
    opacity: 1;
}

#patternBtn {
    min-width: 40px;
    text-align: center;
}

#patternBtn::after {
    content: "Change playback pattern";
    position: absolute;
    background: #333;
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8em;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    margin-top: 25px;
    margin-left: 25px;
    transform: translateX(-50%);
    z-index: 100;
    border: 1px solid #666;
}

#patternBtn:hover::after {
    opacity: 1;
}

.playback-controls .metronome-btn,
.playback-controls .playback-control {
    border-right: none;
    border-left: none;
    border-radius: 0;
    margin: 0;
}

.tempo-controls .metronome-btn {
    border-right: none;
    border-left: none;
    border-radius: 0;
    margin: 0;
}

/* Orientation warning */
@media screen and (max-width: 800px) and (orientation: portrait) {
    .orientation-warning {
        display: flex !important;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: #1a1a1a;
        z-index: 9999;
        justify-content: center;
        align-items: center;
        text-align: center;
        padding: 20px;
    }
    
    .container {
        display: none !important;
    }
}

@media screen and (max-width: 800px) {
    .donate-btn span {
        display: none;
    }
    .donate-btn::before {
        content: "Coffee";
        display: inline-block;
        font-size: 0.9em;
    }
    .mobile-title {
        display: block;
        font-size: 0.9em;  /* Show on mobile */
    }
    
    .desktop-title {
        display: none;  /* Hide on mobile */
    }

    .header-left {
        flex-basis: 20%;
        max-width: 20%;
        min-width: 100px;
    }
    
    .header-right {
        flex-basis: 80%;
        max-width: 80%;
        min-width: 100px;
    }
}

#permLeft::after {
    content: "Previous permutation";
    position: absolute;
    background: #333;
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8em;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    margin-top: 25px;
    margin-left: 25px;
    transform: translateX(-50%);
    z-index: 100;
    border: 1px solid #666;
}

#permLeft:hover::after {
    opacity: 1;
}

#permRight::after {
    content: "Next permutation";
    position: absolute;
    background: #333;
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8em;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    margin-top: 25px;
    margin-left: 25px;
    transform: translateX(-50%);
    z-index: 100;
    border: 1px solid #666;
}

#permRight:hover::after {
    opacity: 1;
}

#octaveRange::after {
    content: "Change octave range (1-3)";
    position: absolute;
    background: #333;
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8em;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    margin-top: 25px;
    margin-left: 25px;
    transform: translateX(-50%);
    z-index: 100;
    border: 1px solid #666;
}

#octaveRange:hover::after {
    opacity: 1;
}

#notesPerBeat::after {
    content: "Change notes per beat (1/4, 2/4, 3/4, 4/4, 6/4)";
    position: absolute;
    background: #333;
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8em;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    margin-top: 25px;
    margin-left: 25px;
    transform: translateX(-50%);
    z-index: 100;
    border: 1px solid #666;
}

#notesPerBeat:hover::after {
    opacity: 1;
}