/* ── Fretboard standalone library styles ─────────────────────────────────── */

:root {
    --fb-fret-width: clamp(1.4rem, 3.5vw, 2.5rem);
    --fb-fret-0-width: clamp(1.1rem, 2.8vw, 2rem);
    --fb-cell-height: clamp(1.6rem, 3.2vw, 2.4rem);
    --fb-string-num-w: clamp(1rem, 2.1vw, 1.6rem);
    --fb-note-size: clamp(1.15rem, 2.2vw, 1.75rem);
    --fb-board-bg: #3b3833;
    --fb-num-color: #aaa;
    --fb-mark-color: rgba(255, 255, 255, 0.18);
}

/* ── Board ───────────────────────────────────────────────────────────────── */

.fb-board {
    display: inline-flex;
    flex-direction: column;
    background: var(--fb-board-bg);
    user-select: none;
    position: relative;
    isolation: isolate;
}

/* ── Shared row / cell base ──────────────────────────────────────────────── */

.fb-row {
    display: flex;
    flex-direction: row;
    align-items: center;
}

.fb-lefty .fb-row {
    flex-direction: row-reverse;
}

.fb-corner {
    flex: 0 0 var(--fb-string-num-w);
}

/* ── Fret number row ─────────────────────────────────────────────────────── */

.fb-fret-nums-row {
    height: 1.5rem;
    background: #222;
}

.fb-fret-num {
    flex: 0 0 var(--fb-fret-width);
    font-size: calc(var(--fb-fret-width) * 0.24);
    color: var(--fb-num-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.fb-fret-num[data-fret="0"] {
    flex: 0 0 var(--fb-fret-0-width);
}

/* ── Fret mark overlay (absolutely positioned over string area) ──────────── */

.fb-marks-overlay {
    position: absolute;
    left: 0;
    right: 0;
    top: var(--fb-fret-nums-h, 0px);
    bottom: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    pointer-events: none;
    z-index: 0;
}

.fb-lefty .fb-marks-overlay {
    flex-direction: row-reverse;
}

.fb-mark-cell {
    flex: 0 0 var(--fb-fret-width);
    display: flex;
    align-items: center;
    justify-content: center;
}

.fb-mark-cell[data-fret="0"] {
    flex: 0 0 var(--fb-fret-0-width);
}

.fb-mark-single {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--fb-mark-color);
}

.fb-mark-double {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.fb-mark-double span {
    display: block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--fb-mark-color);
}

/* ── String rows ─────────────────────────────────────────────────────────── */

.fb-string {
    height: var(--fb-cell-height);
    position: relative;
}

/* String line */
.fb-string::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 1px;
    background: linear-gradient(#eee, #999);
    box-shadow: 0px 2px 6px #806233;
    z-index: 0;
    pointer-events: none;
}

.fb-string-num {
    flex: 0 0 var(--fb-string-num-w);
    font-size: calc(var(--fb-string-num-w) * 0.41);
    color: var(--fb-num-color);
    background: #207bb2;
    height: 100%;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Fret cells ──────────────────────────────────────────────────────────── */

.fb-fret {
    flex: 0 0 var(--fb-fret-width);
    height: 100%;
    cursor: pointer;
    position: relative;
    z-index: 1;
    /* fret wire right border */
    border-right: 2px solid;
    border-image: linear-gradient(to left, #777, #bbb, #777) 1 100%;
}

.fb-fret[data-fret="0"] {
    flex: 0 0 var(--fb-fret-0-width);
}

/* Nut */
.fb-zero-fret {
    border-right: 8px solid;
    border-image: linear-gradient(to left, #bbb, #fff, #bbb) 1 100%;
    background: #161717;
}

.fb-lefty .fb-zero-fret {
    border-right: none;
    border-left: 8px solid;
    border-image: linear-gradient(to right, #bbb, #fff, #bbb) 1 100%;
}

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

.fb-fret:hover .fb-fret-inner {
    background: rgba(255, 255, 255, 0.06);
}

/* ── Note slot ───────────────────────────────────────────────────────────── */

.fb-note-slot {
    position: relative;
    z-index: 2;
    width: var(--fb-note-size);
    height: var(--fb-note-size);
    display: flex;
    flex-direction: row;
    align-items: baseline;
    justify-content: center;
    gap: 1px;
    pointer-events: none;
    overflow: visible;
    align-items: center;
}

.fb-note {
    border-radius: 3px;
}

.fb-note.circle {
    border-radius: 50%;
}

.fb-note.square {
    border-radius: 2px;
}

.fb-note.diamond {
    transform: rotate(45deg);
}

.fb-note.diamond span {
    display: inline;
    transform: rotate(-45deg);
}

.fb-note-name {
    font-weight: bold;
    font-size: calc(var(--fb-note-size) * 0.73);
}

.fb-note-octave {
    font-size: calc(var(--fb-note-size) * 0.27);
    opacity: 0.75;
}

.fb-note-interval {
    font-size: calc(var(--fb-note-size) * 0.27);
    opacity: 0.85;
}

/* ── Interval colour classes ─────────────────────────────────────────────── */

.fb-color-root {
    background: #c0392b;
    color: #fff;
}

.fb-color-m2 {
    background: #8e44ad;
    color: #fff;
}

.fb-color-M2 {
    background: #2980b9;
    color: #fff;
}

.fb-color-m3 {
    background: #16a085;
    color: #fff;
}

.fb-color-M3 {
    background: #27ae60;
    color: #fff;
}

.fb-color-p4 {
    background: #f39c12;
    color: #000;
}

.fb-color-dim5 {
    background: #d35400;
    color: #fff;
}

.fb-color-p5 {
    background: #2c3e50;
    color: #fff;
}

.fb-color-m6 {
    background: #7f8c8d;
    color: #fff;
}

.fb-color-M6 {
    background: #1abc9c;
    color: #000;
}

.fb-color-m7 {
    background: #e74c3c;
    color: #fff;
}

.fb-color-M7 {
    background: #9b59b6;
    color: #fff;
}

.fb-color-mono {
    background: #5b7a91;
    color: #fff;
}