/* ============================================================
   GUITAR SCALE CATALOG
   Compact Interactive 24-Fret Fretboard
   ============================================================ */

.fretboard-card {
    overflow: hidden;
}


.compact-fretboard-card {
    margin-top: 14px;
    padding: 20px;
}


/* ============================================================
   FRETBOARD HEADER
   ============================================================ */

.fretboard-top-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    gap: 24px;
}


.fretboard-heading {
    min-width: 0;
}


.fretboard-heading h2 {
    margin: 4px 0 3px;

    font-size: 21px;

    letter-spacing: -0.02em;
}


.fretboard-heading p {
    margin: 0;

    color: var(--muted);

    font-size: 13px;

    line-height: 1.45;
}


.fretboard-sub-row {
    margin-top: 12px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    min-height: 26px;
}


/* ============================================================
   LEGEND
   ============================================================ */

.fretboard-legend {
    display: flex;
    align-items: center;

    gap: 13px;

    flex-wrap: wrap;

    margin: 0;

    color: var(--muted);

    font-size: 12px;
}


.legend-item {
    display: inline-flex;
    align-items: center;

    gap: 6px;
}


.legend-tip {
    color: #7f91a3;
}


.legend-dot {
    width: 14px;
    height: 14px;

    display: inline-block;

    flex: 0 0 auto;

    border-radius: 50%;
}


.legend-dot.scale-note {
    background: linear-gradient(
        135deg,
        #4a9cff,
        #246fd5
    );

    border: 2px solid #8fc0ff;
}


.legend-dot.root-note-marker {
    background: linear-gradient(
        135deg,
        #f1c45e,
        #c88b1f
    );

    border: 2px solid #ffe19a;
}


/* ============================================================
   FRETBOARD SCROLL AREA
   ============================================================ */

.fretboard-scroll {
    width: 100%;

    margin-top: 10px;

    overflow-x: hidden;
    overflow-y: hidden;
}


/*
    Desktop:
    allow the entire 24-fret board to use the available width.

    The old version had min-width: 1240px, which forced
    horizontal scrolling. That restriction is removed here.
*/

.guitar-fretboard {
    width: 100%;
    min-width: 0;

    user-select: none;
}


/* ============================================================
   FRET NUMBERS
   ============================================================ */

.fret-number-row {
    display: grid;

    grid-template-columns:
        48px
        36px
        repeat(24, minmax(0, 1fr));

    height: 24px;

    color: #7f91a3;

    font-size: 9px;

    font-weight: 750;

    text-align: center;
}


.fret-number-label,
.fret-number {
    display: flex;
    align-items: center;
    justify-content: center;

    min-width: 0;
}


.fret-number-label.open-label {
    color: #aebdcc;
}


/* ============================================================
   NECK
   ============================================================ */

.fretboard-neck {
    position: relative;

    overflow: hidden;

    border: 1px solid #3a4652;
    border-radius: 9px;

    background:
        linear-gradient(
            180deg,
            rgba(255, 255, 255, 0.025),
            rgba(0, 0, 0, 0.08)
        ),
        linear-gradient(
            90deg,
            #4b301e,
            #69432a 20%,
            #54351f 40%,
            #6a442a 60%,
            #4d311e 80%,
            #654027
        );

    box-shadow:
        inset 0 0 35px rgba(0, 0, 0, 0.32),
        0 9px 20px rgba(0, 0, 0, 0.16);
}


/*
    String label | open | frets 1-24
*/

.guitar-string-row {
    position: relative;
    z-index: 4;

    display: grid;

    grid-template-columns:
        48px
        36px
        repeat(24, minmax(0, 1fr));

    height: 43px;
}


/* Guitar string */

.guitar-string-row::after {
    content: "";

    position: absolute;

    left: 48px;
    right: 0;

    top: 50%;

    transform: translateY(-50%);

    background: linear-gradient(
        180deg,
        #d9dee2,
        #727b83
    );

    box-shadow:
        0 1px 1px rgba(0, 0, 0, 0.8),
        0 -1px 1px rgba(255, 255, 255, 0.18);

    pointer-events: none;

    z-index: 1;
}


/*
    Correct visual string thickness:

    row 0 = high E
    row 5 = low E
*/

.guitar-string-row[data-string-index="0"]::after {
    height: 1px;
}


.guitar-string-row[data-string-index="1"]::after {
    height: 1.5px;
}


.guitar-string-row[data-string-index="2"]::after {
    height: 2px;
}


.guitar-string-row[data-string-index="3"]::after {
    height: 2.5px;
}


.guitar-string-row[data-string-index="4"]::after {
    height: 3px;
}


.guitar-string-row[data-string-index="5"]::after {
    height: 3.5px;
}


/* ============================================================
   STRING LABELS
   ============================================================ */

.string-label {
    position: relative;
    z-index: 8;

    display: flex;
    align-items: center;
    justify-content: center;

    min-width: 0;

    color: #d9e4ed;

    background: #111a23;

    border-right: 1px solid #394755;

    font-size: 12px;

    font-weight: 850;
}


.string-label small {
    margin-left: 2px;

    color: #71869a;

    font-size: 7px;
}


/* ============================================================
   FRET CELLS
   ============================================================ */

.fret-cell {
    position: relative;

    z-index: 3;

    min-width: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border-right: 1px solid rgba(205, 212, 218, 0.52);
}


.fret-cell.open-string-cell {
    background: rgba(10, 15, 20, 0.42);

    border-right: 4px solid #d8d3c6;
}


.fret-cell.open-string-cell::after {
    content: "";

    position: absolute;

    top: 0;
    right: -7px;
    bottom: 0;

    width: 6px;

    background: linear-gradient(
        90deg,
        rgba(0, 0, 0, 0.3),
        transparent
    );
}


.guitar-string-row .fret-cell:last-child {
    border-right: 0;
}


/* ============================================================
   NOTE MARKERS
   ============================================================ */

.fret-note {
    position: relative;
    z-index: 10;

    width: 25px;
    height: 25px;

    min-width: 25px;

    padding: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    color: #ffffff;

    background: linear-gradient(
        135deg,
        #4a9cff,
        #246fd5
    );

    border: 1.5px solid #94c4ff;

    box-shadow:
        0 2px 5px rgba(0, 0, 0, 0.36);

    font-family: inherit;

    font-size: 8px;

    font-weight: 900;

    letter-spacing: -0.04em;

    text-shadow:
        0 1px 2px rgba(0, 0, 0, 0.45);

    cursor: pointer;

    transition:
        transform 0.08s ease,
        background 0.08s ease,
        border-color 0.08s ease,
        box-shadow 0.08s ease,
        color 0.08s ease;
}


.fret-note.root {
    width: 28px;
    height: 28px;

    min-width: 28px;

    color: #17120a;

    background: linear-gradient(
        135deg,
        #ffe08a,
        #e1a631
    );

    border: 2px solid #fff0bd;

    box-shadow:
        0 0 0 2px rgba(231, 184, 77, 0.13),
        0 3px 7px rgba(0, 0, 0, 0.38);

    font-size: 8px;

    text-shadow: none;
}


.fret-note.root::after {
    content: "R";

    position: absolute;

    right: -5px;
    bottom: -4px;

    width: 11px;
    height: 11px;

    display: grid;
    place-items: center;

    color: #fff;

    background: #1e65c7;

    border: 1px solid #a9d0ff;
    border-radius: 50%;

    font-size: 6px;

    font-weight: 900;
}


@media (hover: hover) and (pointer: fine) {

    .fret-note:hover {
        transform: scale(1.12);
    }

}


.fret-note:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}


/* Currently playing */

.fret-note.currently-playing,
.fret-note.root.currently-playing {
    z-index: 20;

    transform: scale(1.28);

    color: #111820;

    background: #ffffff;

    border-color: #ffffff;

    box-shadow:
        0 0 0 3px rgba(255, 255, 255, 0.22),
        0 0 16px rgba(255, 255, 255, 0.9),
        0 0 28px rgba(109, 170, 255, 0.45),
        0 4px 9px rgba(0, 0, 0, 0.48);

    text-shadow: none;
}


.fret-note.root.currently-playing::after {
    opacity: 0;
}


/* ============================================================
   POSITION MARKERS
   ============================================================ */

.position-marker-row {
    display: grid;

    grid-template-columns:
        48px
        36px
        repeat(24, minmax(0, 1fr));

    height: 22px;

    background: #111820;

    border-left: 1px solid #3a4652;
    border-right: 1px solid #3a4652;
    border-bottom: 1px solid #3a4652;

    border-radius: 0 0 9px 9px;
}


.position-marker-cell {
    display: flex;

    align-items: center;
    justify-content: center;

    gap: 3px;

    min-width: 0;
}


.position-dot {
    width: 6px;
    height: 6px;

    border-radius: 50%;

    background: #536272;
}


.position-marker-cell.double {
    flex-direction: column;

    gap: 2px;
}


.position-marker-cell.double .position-dot {
    width: 5px;
    height: 5px;
}


/* ============================================================
   HELP TEXT
   ============================================================ */

.fretboard-help {
    margin-top: 8px;

    color: var(--muted);

    font-size: 12px;

    line-height: 1.45;
}


.fretboard-help strong {
    color: #d6e1eb;
}


/* ============================================================
   SMALL DESKTOP / TABLET

   Once the screen becomes too narrow to keep note labels
   readable, preserve the useful fretboard size and allow
   horizontal scrolling locally.
   ============================================================ */

@media (max-width: 900px) {

    .fretboard-scroll {
        overflow-x: auto;

        padding-bottom: 7px;

        scrollbar-width: thin;

        scrollbar-color:
            #3a536d
            #101820;
    }


    .guitar-fretboard {
        width: auto;

        min-width: 980px;
    }

}


/* ============================================================
   PHONE
   ============================================================ */

@media (max-width: 700px) {

    .compact-fretboard-card {
        padding: 16px;
    }


    .fretboard-top-row {
        flex-direction: column;

        gap: 14px;
    }


    .fretboard-sub-row {
        align-items: flex-start;

        flex-direction: column;

        gap: 5px;
    }


    .fretboard-scroll {
        width: 100%;

        margin-top: 8px;
    }


    .guitar-fretboard {
        min-width: 940px;
    }


    .fretboard-help {
        font-size: 11px;
    }

}
