/* ============================================================
   Fretboard — warm rosewood guitar neck
   Palette: #0d0c0a body · #1c0f04 neck · #e94560 accent
   ============================================================ */

/* ── Page background (only in fretboard mode) ─────────────── */
body.mode-fretboard {
    background: #0d0c0a;
}

/* ── Wider layout on tablet/desktop in fretboard mode ─────── */
@media (min-width: 768px) {
    body.mode-fretboard .container {
        max-width: 760px;
    }
}

@media (min-width: 1024px) {
    body.mode-fretboard .container {
        max-width: 960px;
    }

    body.mode-fretboard .fb-neck {
        min-width: 780px;
    }

    body.mode-fretboard .fb-cell,
    body.mode-fretboard .fb-dot-cell {
        min-width: 44px;
    }

    body.mode-fretboard .fb-row,
    body.mode-fretboard .fb-dot-row {
        height: 50px;
    }

    body.mode-fretboard .fb-dot-row {
        height: 0;
    }

    body.mode-fretboard .fb-circle {
        width: 34px;
        height: 34px;
    }

    body.mode-fretboard .fb-pos-dot {
        width: 14px;
        height: 14px;
    }

    /* Scale string thickness for wider neck */
    body.mode-fretboard .fb-string-line--E_high { height: 2px; }
    body.mode-fretboard .fb-string-line--B      { height: 3px; }
    body.mode-fretboard .fb-string-line--G      { height: 4px; }
    body.mode-fretboard .fb-string-line--D      { height: 5px; }
    body.mode-fretboard .fb-string-line--A      { height: 6.5px; }
    body.mode-fretboard .fb-string-line--E_low  { height: 8px; }
}

/* ── Wrapper ──────────────────────────────────────────────── */
.fretboard-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0.5rem 0 1rem;
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
    mask-image: linear-gradient(to right, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
}

/* ── Neck container ───────────────────────────────────────── */
.fb-neck {
    display: flex;
    flex-direction: column;
    min-width: 560px;
    /* Subtle radial glow in center — no horizontal banding */
    background: radial-gradient(
        ellipse 90% 55% at 50% 50%,
        #2a1608 0%,
        #1c1006 45%,
        #110904 100%
    );
    border-radius: 8px;
    /* Binding: thin ivory highlight, then dark shadow, then outer glow */
    box-shadow:
        0 0 0 2px #c8b880,
        0 0 0 4px #0a0705,
        0 12px 48px rgba(0, 0, 0, 0.85),
        0 4px 16px rgba(0, 0, 0, 0.6);
    padding: 10px 8px 6px;
    user-select: none;
    position: relative;
}

/* ── Shared row layout ────────────────────────────────────── */
.fb-row,
.fb-dot-row {
    display: flex;
    flex-direction: row;
    align-items: stretch;
}

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

/* ── String rows ─────────────────────────────────────────── */
.fb-row {
    height: 44px;
    transition: opacity 0.2s ease;
    position: relative;
}

.fb-row--dim {
    opacity: 1;
    pointer-events: none;
}

/* Dim only the string content, not the whole row —
   keeps the neck background seamless without visible row seams */
.fb-row--dim .fb-string-line {
    opacity: 0.28;
}

.fb-row--dim .fb-label {
    opacity: 0.75;
}

.fb-row--dim .fb-cell {
    border-right-color: rgba(138, 128, 112, 0.25);
}

.fb-row--dim .fb-cell--open {
    border-right-color: rgba(200, 180, 110, 0.25);
}

.fb-row--active {
    opacity: 1;
    border-radius: 4px;
}

.fb-row--active .fb-cell {
    border-right-color: rgba(138, 128, 112, 0.25);
    box-shadow: inset -1px 0 0 rgba(220, 210, 190, 0.06);
}

.fb-row--active .fb-cell--open {
    border-right-color: rgba(200, 180, 110, 0.25);
}

/* ── Dot row (between G and D) ────────────────────────────── */
.fb-dot-row {
    height: 0;
    overflow: visible;
    position: relative;
}

/* ── Roman numeral row ────────────────────────────────────── */
.fb-num-row {
    height: 18px;
    margin-top: 4px;
}

/* ── Label column ─────────────────────────────────────────── */
.fb-label {
    width: 22px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: #7a6a58;
    letter-spacing: 0.03em;
    font-family: monospace;
}

.fb-row--active .fb-label {
    color: #d4cfc8;
}

/* ── Fret cells ───────────────────────────────────────────── */
.fb-cell {
    flex: 1;
    min-width: 18px;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Fret wire: nickel-silver with highlight top, shadow bottom */
    border-right: 2.5px solid #8a8070;
    box-shadow: inset -1px 0 0 rgba(220, 210, 190, 0.22);
}

/* Open / nut */
.fb-cell--open {
    flex: 0 0 30px;
    border-right: 7px solid #3a2e1e;
    box-shadow: inset -2px 0 4px rgba(0, 0, 0, 0.55);
}

/* Dot row cells */
.fb-dot-cell {
    flex: 1;
    min-width: 18px;
    height: 20px;
    margin-top: -10px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 2.5px solid transparent;
}

.fb-dot-cell.fb-cell--open {
    flex: 0 0 30px;
    border-right: 2.5px solid transparent;
    visibility: hidden;
}

/* Number cells */
.fb-num-cell {
    flex: 1;
    min-width: 18px;
    height: 18px;
    text-align: center;
    font-size: 0.62rem;
    color: #8a7a60;
    font-family: Georgia, serif;
    letter-spacing: -0.02em;
    border-right: 2.5px solid transparent;
}

.fb-num-cell.fb-cell--open {
    flex: 0 0 30px;
}

/* ── String lines ─────────────────────────────────────────── */
.fb-string-line {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    border-radius: 1px;
}

/* Realistic: plain steel (high strings) → wound bronze (low strings)
   Each gets a top-edge highlight to suggest the string's cylindrical shape */
.fb-string-line--E_high {
    height: 1.5px;
    background: linear-gradient(180deg, #f0ece0 0%, #b8b4aa 100%);
    box-shadow: 0 1px 1px rgba(0,0,0,0.5);
}
.fb-string-line--B {
    height: 2px;
    background: linear-gradient(180deg, #e8e4d8 0%, #a8a498 100%);
    box-shadow: 0 1px 2px rgba(0,0,0,0.55);
}
.fb-string-line--G {
    height: 2.5px;
    background: linear-gradient(180deg, #dcd8c8 0%, #9c9888 55%, #807c70 100%);
    box-shadow: 0 1px 2px rgba(0,0,0,0.6);
}
.fb-string-line--D {
    height: 3px;
    background: linear-gradient(180deg, #e8c868 0%, #c8a040 45%, #907020 100%);
    box-shadow: 0 1px 3px rgba(0,0,0,0.65), 0 -0.5px 0 rgba(255,220,100,0.3);
}
.fb-string-line--A {
    height: 3.5px;
    background: linear-gradient(180deg, #d8a838 0%, #a87828 45%, #785018 100%);
    box-shadow: 0 1px 4px rgba(0,0,0,0.7), 0 -0.5px 0 rgba(255,200,80,0.25);
}
.fb-string-line--E_low {
    height: 4.5px;
    background: linear-gradient(180deg, #c89828 0%, #986818 45%, #603808 100%);
    box-shadow: 0 2px 5px rgba(0,0,0,0.75), 0 -0.5px 0 rgba(255,190,60,0.2);
}

/* ── Position inlay dots (Mother-of-Pearl) ────────────────── */
.fb-pos-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    /* MOP: iridescent radial gradient with off-center highlight */
    background: radial-gradient(
        circle at 32% 28%,
        #f8f6f0 0%,
        #d8e8ec 25%,
        #a8c4d0 50%,
        #6890a8 75%,
        #3a6078 100%
    );
    box-shadow:
        0 2px 5px rgba(0,0,0,0.85),
        0 0 0 1px rgba(0,0,0,0.65),
        inset 0 1px 2px rgba(255,255,255,0.35);
}

/* Double dots for 12th fret */
.fb-pos-dot--a,
.fb-pos-dot--b {
    width: 10px;
    height: 10px;
    background: radial-gradient(
        circle at 32% 28%,
        #f8f6f0 0%,
        #d8e8ec 25%,
        #a8c4d0 50%,
        #6890a8 75%,
        #3a6078 100%
    );
    box-shadow:
        0 1px 4px rgba(0,0,0,0.85),
        0 0 0 1px rgba(0,0,0,0.65),
        inset 0 1px 1px rgba(255,255,255,0.3);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

.fb-pos-dot--a { left: calc(50% - 11px); }
.fb-pos-dot--b { left: calc(50% + 1px); }

/* ── Note circles (active string) ────────────────────────── */
.fb-circle {
    position: absolute;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.58rem;
    font-weight: 700;
    font-family: monospace;
    letter-spacing: -0.04em;
    color: transparent;
    background: transparent;
    /* Ghost ring: warm bone/ivory tone */
    border: 1.5px solid rgba(195, 185, 157, 0.55);
    transition: background 0.12s ease, border-color 0.12s ease, color 0.08s ease,
                box-shadow 0.12s ease;
    pointer-events: none;
    z-index: 2;
}

/* Open fret: no ghost ring */
.fb-cell--open .fb-circle {
    border-color: transparent;
}

/* Tappable cell cursor */
.fb-cell--tap {
    cursor: pointer;
}

/* Hover: brighten the ring */
.fb-cell--tap:hover .fb-circle {
    border-color: rgba(195, 185, 157, 0.9);
    background: rgba(195, 185, 157, 0.1);
}

.fb-cell--tap:active .fb-circle {
    border-color: #c3b99d;
    background: rgba(195, 185, 157, 0.2);
    transform: scale(0.92);
    transition: transform 0.07s ease;
}

/* Focus ring (keyboard nav) */
.fb-cell--tap:focus-visible {
    outline: none;
}
.fb-cell--tap:focus-visible .fb-circle {
    border-color: #c3b99d;
    box-shadow: 0 0 0 2px rgba(195, 185, 157, 0.35);
}

/* ── Answer feedback states ───────────────────────────────── */

/* Correct: filled green */
.fb-cell--correct .fb-circle {
    background: #1b4d20;
    border-color: #4caf50;
    color: #c8ffc8;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5), 0 0 0 2px rgba(76,175,80,0.2);
    font-size: 0.55rem;
}

/* Incorrect: filled red */
.fb-cell--incorrect .fb-circle {
    background: #4d1b1b;
    border-color: #f44336;
    color: #ffc8c8;
    box-shadow: 0 0 10px rgba(244, 67, 54, 0.5), 0 0 0 2px rgba(244,67,54,0.2);
    font-size: 0.55rem;
}

/* Target (correct fret player missed): warm bone ring */
.fb-cell--target .fb-circle {
    background: rgba(195, 185, 157, 0.15);
    border-color: #c3b99d;
    color: #e8dfc8;
    box-shadow: 0 0 10px rgba(195, 185, 157, 0.4), 0 0 0 2px rgba(195,185,157,0.2);
    font-size: 0.55rem;
}

/* ── Mode switcher pills ─────────────────────────────────── */
.mode-switcher {
    display: flex;
    gap: 0.4rem;
    justify-content: center;
    margin-bottom: 1.25rem;
}

.mode-btn {
    padding: 0.3rem 1.2rem;
    border-radius: 999px;
    border: 1px solid #2e2c28;
    background: transparent;
    color: #4a4640;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s ease;
    letter-spacing: 0.02em;
}

.mode-btn:hover {
    border-color: #4a4640;
    color: #d4cfc8;
    background: rgba(255,255,255,0.04);
}

.mode-btn.active {
    background: #e94560;
    border-color: #e94560;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(233, 69, 96, 0.35);
}

/* ── Fretboard mode prompt ────────────────────────────────── */
.fretboard-prompt {
    text-align: center;
    margin-bottom: 0.6rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #2e2c28;
}

.fretboard-prompt .prompt-chord {
    font-size: clamp(2rem, 5vw, 2.8rem);
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.01em;
    line-height: 1.15;
}

.fretboard-prompt .prompt-interval {
    font-size: 0.95rem;
    color: #786e62;
    margin-top: 0.2rem;
    letter-spacing: 0.02em;
}

.fretboard-prompt .prompt-string {
    display: inline-block;
    margin-top: 0.45rem;
    padding: 0.18rem 0.85rem;
    border-radius: 999px;
    background: rgba(233, 69, 96, 0.1);
    border: 1px solid rgba(233, 69, 96, 0.4);
    color: #e94560;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.03em;
}

/* ── Scales display (fretboard mode) ─────────────────────── */
#fb-scales-display {
    color: #786e62;
}

/* ── Feedback text under fretboard ───────────────────────── */
#fb-feedback p {
    margin: 0;
    font-size: 0.85rem;
    letter-spacing: 0.01em;
}
