* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-image: url('assets/background.webp');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    padding: 20px;
    min-height: 100vh;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    background-color: rgba(255, 255, 255, 0.6);
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    position: relative; /* Added for chord grid positioning */
}

h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.fretboard-container {
    background-color: #5a7991;
    padding: 20px 20px 10px 20px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

#fretboard {
    display: grid;
    grid-template-columns: repeat(23, minmax(45px, 1fr));
    gap: 1px;
    background-color: #000;
    padding: 10px;
    border-radius: 5px;
    min-width: min-content;
    margin: 0 auto;
}

/* Add larger gap after the nut position */
.string > :first-child {
    margin-right: 8px;
    border-right: 6px solid #000;
}

.fretboard-markers {
    display: grid;
    grid-template-columns: repeat(23, minmax(45px, 1fr));
    gap: 1px;
    margin-top: 10px;
}

/* Add same gap in the markers below */
.position-dots > :first-child,
.position-numbers > :first-child {
    margin-right: 10px;
}

.string {
    display: contents;
}

.fret {
    aspect-ratio: 1;
    text-align: center;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    transition: background-color 0.3s ease;
    background-color: #D2B48C;
    border: 1px solid #000;
}

.fret::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: #000;
}

/* Box colors */
.fret.box-1, .fret.box-6, .fret.box-11 { background-color: #FFB6C1; }
.fret.box-2, .fret.box-7, .fret.box-12 { background-color: #98FB98; }
.fret.box-3, .fret.box-8, .fret.box-13 { background-color: #87CEEB; }
.fret.box-4, .fret.box-9, .fret.box-14 { background-color: #DDA0DD; }
.fret.box-5, .fret.box-10, .fret.box-15 { background-color: #FFD700; }

/* Split backgrounds */
.fret.split-1-2 { 
    background: linear-gradient(90deg, #FFB6C1 50%, #98FB98 50%);
}
.fret.split-2-3 { 
    background: linear-gradient(90deg, #98FB98 50%, #87CEEB 50%);
}
.fret.split-3-4 { 
    background: linear-gradient(90deg, #87CEEB 50%, #DDA0DD 50%);
}
.fret.split-4-5 { 
    background: linear-gradient(90deg, #DDA0DD 50%, #FFD700 50%);
}
.fret.split-5-1 { 
    background: linear-gradient(90deg, #FFD700 50%, #FFB6C1 50%);
}
.fret.split-5-6 { 
    background: linear-gradient(90deg, #FFD700 50%, #FFB6C1 50%);
}
.fret.split-6-7 { 
    background: linear-gradient(90deg, #FFB6C1 50%, #98FB98 50%);
}
.fret.split-7-8 { 
    background: linear-gradient(90deg, #98FB98 50%, #87CEEB 50%);
}
.fret.split-8-9 { 
    background: linear-gradient(90deg, #87CEEB 50%, #DDA0DD 50%);
}
.fret.split-9-10 { 
    background: linear-gradient(90deg, #DDA0DD 50%, #FFD700 50%);
}
.fret.split-10-6 { 
    background: linear-gradient(90deg, #FFD700 50%, #FFB6C1 50%);
}
.fret.split-10-11 { 
    background: linear-gradient(90deg, #FFD700 50%, #FFB6C1 50%);
}
.fret.split-11-12 { 
    background: linear-gradient(90deg, #FFB6C1 50%, #98FB98 50%);
}
.fret.split-12-13 { 
    background: linear-gradient(90deg, #98FB98 50%, #87CEEB 50%);
}
.fret.split-13-14 { 
    background: linear-gradient(90deg, #87CEEB 50%, #DDA0DD 50%);
}
.fret.split-14-15 { 
    background: linear-gradient(90deg, #DDA0DD 50%, #FFD700 50%);
}
.fret.split-15-11 { 
    background: linear-gradient(90deg, #FFD700 50%, #FFB6C1 50%);
}

.note {
    font-weight: bold;
    color: #333;
    z-index: 1;
    font-size: 14px;
}

.note.pentatonic {
    color: #fff;
    background-color: #4CAF50;
    padding: 4px 8px;
    border-radius: 4px;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}

.note.root {
    color: #fff;
    background-color: #f44336;
    padding: 4px 8px;
    border-radius: 4px;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}

.note.blue {
    color: #fff;
    background-color: #1e90ff;
    padding: 4px 8px;
    border-radius: 4px;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}

/* Remove old fret markers from the fretboard */
.fret:nth-child(3)::before,
.fret:nth-child(5)::before,
.fret:nth-child(7)::before,
.fret:nth-child(9)::before,
.fret:nth-child(15)::before,
.fret:nth-child(17)::before,
.fret:nth-child(19)::before,
.fret:nth-child(21)::before,
.fret:nth-child(13)::before,
.fret:nth-child(13)::after {
    display: none;
}

.position-dots {
    display: contents;
}

.position-dots .dot {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 20px;
}

/* Update the markers below the fretboard to be white */
.position-dots .dot::before {
    content: '';
    width: 12px;
    height: 12px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.3);
}

.position-dots .double-dot {
    position: relative;
    height: 35px;  /* Increased height to accommodate both dots */
    display: flex;
    align-items: center;
}

.position-dots .double-dot::before,
.position-dots .double-dot::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.3);
}

.position-dots .double-dot::before {
    top: -1px;
}

.position-dots .double-dot::after {
    bottom: -1px;
}

.position-numbers {
    display: contents;
}

.position-numbers .number {
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    padding: 4px 0;
    font-weight: bold;
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.3);
}

.key-selector {
    margin: 20px 0;
    text-align: center;
}

.key-selector label {
    margin-right: 10px;
    font-weight: bold;
}

.key-selector select {
    margin-right: 10px;
    padding: 5px;
    font-size: 16px;
}

.key-selector button {
    padding: 5px 10px;
    font-size: 16px;
    cursor: pointer;
}

.control-panel {
    margin: 20px 0;
    text-align: center;
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.tuning-selector,
.key-selector {
    margin: 10px 0;
}

.tuning-selector label,
.key-selector label {
    margin-right: 10px;
    font-weight: bold;
}

.tuning-selector select,
.key-selector select {
    margin-right: 10px;
    padding: 5px;
    font-size: 16px;
    min-width: 200px;
}

.toggle-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-container input[type="checkbox"] {
    width: 40px;
    height: 20px;
    appearance: none;
    background: #ddd;
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s;
}

.toggle-container input[type="checkbox"]:checked {
    background: #4CAF50;
}

.toggle-container input[type="checkbox"]::before {
    content: '';
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 1px;
    left: 1px;
    transition: left 0.3s;
}

.toggle-container input[type="checkbox"]:checked::before {
    left: 21px;
}

.tool-description {
    margin: 40px auto;
    max-width: 800px;
    padding: 20px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tool-description h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.8em;
}

.tool-description p {
    color: #444;
    line-height: 1.6;
    margin-bottom: 20px;
    font-size: 1.1em;
}

.tool-description ul {
    list-style-type: none;
    padding: 0;
}

.tool-description li {
    color: #555;
    margin: 10px 0;
    padding-left: 24px;
    position: relative;
    line-height: 1.4;
}

.tool-description li::before {
    content: "•";
    color: #4CAF50;
    font-weight: bold;
    position: absolute;
    left: 0;
}

.chord-grid {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 100;
}

.chord-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.chord-cell {
    padding: 8px;
    text-align: center;
    border-radius: 4px;
    background-color: #f0f0f0;
    font-weight: bold;
    min-width: 60px;
    transition: all 0.3s ease;
}

.chord-cell.current {
    background-color: #4CAF50;
    color: white;
}

/* Responsive adjustments for chord grid */
@media (max-width: 768px) {
    .chord-grid {
        position: static;
        margin: 20px auto;
        width: fit-content;
    }
    
    .chord-cell {
        min-width: 50px;
        font-size: 0.9em;
    }
}

@media (max-width: 1200px) {
    #fretboard {
        grid-template-columns: repeat(23, 45px);
    }

    .fretboard-markers {
        grid-template-columns: repeat(23, 45px);
    }
}

/* For very small screens, ensure controls stay readable */
@media (max-width: 600px) {
    .control-panel {
        flex-direction: column;
        align-items: center;
    }

    .tuning-selector,
    .key-selector {
        width: 100%;
        max-width: 300px;
    }

    .tuning-selector select,
    .key-selector select {
        width: 100%;
        min-width: unset;
    }

    .donation-buttons {
        flex-direction: column;
        align-items: center;
        gap: 15px !important;
    }
}

/* ------------------------------
   Additional layout & typography improvements
   (Overrides and page-level styles for readability)
   ------------------------------ */

:root{
    --content-max-width: 1100px;
    --muted: #555;
    --brand: #2563eb; /* blue */
    --accent: #4caf50;
    --surface: rgba(255,255,255,0.95);
    --card-shadow: 0 6px 18px rgba(16,24,40,0.08);
}

body{
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
    color: #111827;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container{
    max-width: var(--content-max-width);
    margin: 24px auto;
    padding: 28px;
    background-color: var(--surface);
    border-radius: 14px;
    box-shadow: var(--card-shadow);
}

/* Top-level site navigation (header) */
.site-nav, header nav {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
    margin-bottom: 16px;
}

.site-nav a, header nav a {
    color: var(--brand);
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 8px;
    font-weight: 600;
}
.site-nav a:hover, header nav a:hover{
    background: rgba(37,99,235,0.08);
}

/* Main content / articles */
main{ display:block; }
article{ margin: 18px auto; padding: 18px; border-radius: 10px; background: white; box-shadow: 0 4px 12px rgba(0,0,0,0.04); }
article h2{ font-size: 1.6rem; margin-bottom: 12px; color: #0f172a; }
article h3{ font-size: 1.15rem; margin-top: 14px; margin-bottom: 8px; color: #111827; }
article p{ color: var(--muted); line-height: 1.75; margin-bottom: 12px; }
article ul, article ol{ margin-left: 1.1rem; margin-bottom: 12px; color: var(--muted); }

/* Form styles */
.contact-form{ max-width:720px; margin: 10px 0; }
.contact-form label{ display:block; margin-bottom:6px; font-weight:600; color:#111827; }
.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form textarea,
.contact-form select{
    width:100%; padding:10px 12px; border-radius:8px; border:1px solid #e6e6e6; background:#fff; font-size:1rem; margin-bottom:12px;
    box-shadow: 0 1px 2px rgba(16,24,40,0.03) inset;
}
.contact-form textarea{ min-height:140px; resize:vertical; }

.contact-form button{ display:inline-block; background: var(--brand); color:#fff; border:none; padding:10px 16px; border-radius:10px; cursor:pointer; font-weight:700; font-size:1rem; }
.contact-form button:hover{ background:#1e40af; }

/* Buttons used elsewhere */
button, .key-selector button{ cursor:pointer; }

/* Ad placeholder styling */
.ad-placeholder{
    border-radius: 8px; padding:18px; background: linear-gradient(180deg, #ffffff, #f7fafc); border:1px solid #e2e8f0; color:var(--muted);
    text-align:center; box-shadow: 0 6px 12px rgba(2,6,23,0.04);
}

/* Improve footer */
footer{ margin-top: 28px; text-align:center; color:var(--muted); font-size:0.95rem; }

/* Utility */
.muted{ color:var(--muted); }

/* Responsive tweaks */
@media (max-width: 800px){
    :root{ --content-max-width: 92%; }
    .container{ padding:16px; }
    article{ padding:12px; }
}

/* Theory index preview cards */
.preview-card{ background:linear-gradient(180deg,#ffffff,#fcfdff); padding:16px; border-radius:10px; box-shadow:0 6px 18px rgba(2,6,23,0.04); }
.preview-card h3{ margin:0 0 8px 0; font-size:1.1rem; }
.preview-card p{ margin:0 0 10px 0; }
.read-btn{ display:inline-block; padding:8px 12px; background:var(--brand); color:#fff; border-radius:8px; text-decoration:none; font-weight:700; }
.read-btn:hover{ background:#1e40af; }
