:root {
    --ink: #101714;
    --muted: #65706a;
    --paper: #f4f1e8;
    --surface: #fffdf7;
    --line: #d8d3c6;
    --green: #1d5b45;
    --green-soft: #dce9df;
    --coral: #e05e43;
    --yellow: #e9bc48;
    --fret: #342e29;
    --white: #fff;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    color: var(--ink);
    background-color: var(--paper);
    background-image: radial-gradient(#cbc5b7 0.7px, transparent 0.7px);
    background-size: 18px 18px;
    font-family: Georgia, 'Times New Roman', serif;
}

button, input { font: inherit; }
button { color: inherit; }

.topbar {
    min-height: 68px;
    display: grid;
    grid-template-columns: 240px 1fr auto;
    align-items: center;
    gap: 24px;
    padding: 10px 28px;
    color: var(--white);
    background: var(--ink);
    border-bottom: 4px solid var(--coral);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: inherit;
    text-decoration: none;
    font: 700 17px/1 'Trebuchet MS', sans-serif;
    letter-spacing: 0.14em;
}

.brand-mark {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    color: var(--ink);
    background: var(--yellow);
    border-radius: 50%;
    font-size: 20px;
}

.session-status {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    color: #c9d1cc;
    font: 13px/1.2 'Trebuchet MS', sans-serif;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #77c890;
    box-shadow: 0 0 0 4px rgb(119 200 144 / 14%);
}

.progress-summary {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font: 12px/1 'Trebuchet MS', sans-serif;
    color: #aeb9b2;
}
.progress-summary span:first-child { color: var(--white); font-size: 18px; font-weight: 700; }

.app-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    max-width: 1500px;
    min-height: calc(100vh - 68px);
    margin: 0 auto;
}

.lesson-nav {
    display: flex;
    flex-direction: column;
    padding: 34px 18px 24px;
    background: rgb(255 253 247 / 72%);
    border-right: 1px solid var(--line);
}

.section-label {
    margin: 0 0 8px;
    color: var(--coral);
    font: 700 11px/1 'Trebuchet MS', sans-serif;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.lesson-button {
    width: 100%;
    display: grid;
    grid-template-columns: 38px 1fr 22px;
    align-items: center;
    gap: 10px;
    padding: 13px 10px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.lesson-button:hover, .lesson-button.active { background: var(--green-soft); }
.lesson-button.active { box-shadow: inset 3px 0 var(--green); }
.lesson-number { color: var(--coral); font: 700 12px/1 'Trebuchet MS', sans-serif; }
.lesson-button small { display: block; color: var(--muted); font: 10px/1.3 'Trebuchet MS', sans-serif; text-transform: uppercase; }
.lesson-button strong { display: block; margin-top: 3px; font-size: 15px; }
.lesson-check { opacity: 0; color: var(--green); font-family: sans-serif; }
.lesson-button.completed .lesson-check { opacity: 1; }

.nav-footer {
    margin-top: auto;
    padding: 22px 10px 0;
    color: var(--muted);
    font: 12px/1.5 'Trebuchet MS', sans-serif;
}

.workspace {
    min-width: 0;
    padding: 44px clamp(22px, 4vw, 64px) 72px;
}

.lesson-heading {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 24px;
    max-width: 960px;
    margin-bottom: 30px;
}

h1, h2, p { overflow-wrap: anywhere; }
h1 { margin: 0; font-size: clamp(34px, 5vw, 62px); line-height: 0.98; font-weight: 500; }
h2 { margin: 0; font-size: 23px; font-weight: 500; }
.lesson-heading p:last-child { max-width: 650px; margin: 15px 0 0; color: var(--muted); line-height: 1.55; }

.icon-button, .transport-button, .play-button {
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    cursor: pointer;
}
.icon-button {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    background: var(--surface);
    border-radius: 50%;
}
.icon-button.completed { color: var(--white); background: var(--green); border-color: var(--green); }

.theory-band {
    display: grid;
    grid-template-columns: 190px minmax(240px, 1fr) minmax(230px, 0.75fr);
    gap: 30px;
    align-items: start;
    padding: 26px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-top: 4px solid var(--yellow);
}
.theory-band > p { margin: 0; color: #39423d; line-height: 1.7; }
.practice-tip { display: flex; gap: 12px; padding-left: 20px; border-left: 1px solid var(--line); }
.practice-tip span { width: 25px; height: 25px; flex: 0 0 25px; display: grid; place-items: center; color: var(--white); background: var(--green); border-radius: 50%; font-style: italic; }
.practice-tip p { margin: 0; color: var(--muted); font: 13px/1.55 'Trebuchet MS', sans-serif; }

.player { margin-top: 28px; background: var(--ink); color: var(--white); border-bottom: 5px solid var(--coral); }
.player-header, .transport { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 20px 24px; }
.player .section-label { color: var(--yellow); }
.player h2 { font-size: 25px; }
.tempo-control { display: flex; flex-direction: column; gap: 8px; min-width: min(220px, 45vw); color: #cbd4ce; font: 12px/1.2 'Trebuchet MS', sans-serif; }
.tempo-control strong { color: var(--yellow); }
input[type='range'] { accent-color: var(--coral); width: 100%; }

.live-note-panel {
    display: grid;
    grid-template-columns: minmax(220px, 0.7fr) minmax(320px, 1.3fr);
    gap: 28px;
    align-items: center;
    padding: 18px 24px;
    background: #202b25;
    border-top: 1px solid #303b35;
}
.live-note-current { display: flex; align-items: center; gap: 15px; }
.note-icon { width: 46px; height: 46px; display: grid; place-items: center; color: var(--ink); background: var(--yellow); border-radius: 50%; font-size: 24px; }
.live-note-current > div { display: grid; grid-template-columns: auto 1fr; align-items: baseline; column-gap: 12px; }
.live-note-label { color: #91a097; font: 700 10px/1.2 'Trebuchet MS', sans-serif; letter-spacing: 0.12em; text-transform: uppercase; }
.live-note-current .live-note-label { grid-column: 1 / -1; margin-bottom: 3px; }
.live-note-current strong { color: var(--yellow); font-size: 34px; line-height: 1; }
#liveNotePosition { color: #cbd4ce; font: 12px/1.4 'Trebuchet MS', sans-serif; }
.notation-wrap { min-width: 0; display: grid; gap: 5px; }
.notation { width: 100%; overflow-x: auto; overflow-y: hidden; background: #17201c; border: 1px solid #3c4942; }
.notation svg { display: block; }

.tab-stage { overflow-x: auto; padding: 24px; background: #17201c; }
.tab-grid { min-width: 650px; display: grid; grid-template-columns: 28px repeat(8, minmax(54px, 1fr)); }
.string-label, .tab-cell { height: 48px; display: grid; place-items: center; }
.string-label { color: var(--yellow); font: 700 12px/1 monospace; }
.tab-cell { position: relative; font: 700 15px/1 monospace; color: #aab5ae; }
.tab-cell::before { content: ''; position: absolute; left: 0; right: 0; height: 1px; background: #68736d; }
.tab-cell span { position: relative; z-index: 1; min-width: 25px; height: 25px; display: grid; place-items: center; background: #17201c; border-radius: 50%; }
.tab-cell.current { background: rgb(233 188 72 / 9%); }
.tab-cell.current span:not(:empty) { color: var(--ink); background: var(--yellow); }
.tab-cell.beat-start { border-left: 1px solid #4b5650; }

.transport { justify-content: center; border-top: 1px solid #303b35; }
.transport-button { width: 38px; height: 38px; color: #c7d0ca; background: transparent; border-color: #465149; border-radius: 50%; font-family: sans-serif; }
.transport-button.active { color: var(--yellow); border-color: var(--yellow); }
.play-button { width: 52px; height: 52px; color: var(--ink); background: var(--yellow); border: 0; border-radius: 50%; font-family: sans-serif; font-size: 18px; }
.beat-display { position: absolute; margin-left: 250px; color: #819087; font: 12px/1 'Trebuchet MS', sans-serif; }
.beat-display span:first-child { color: var(--white); }

.fretboard-section { margin-top: 28px; }
.fretboard-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 16px; }
.fretboard-heading > p { margin: 0; color: var(--muted); font: 12px/1.4 'Trebuchet MS', sans-serif; }
.fretboard-scroll { overflow-x: auto; padding-bottom: 8px; }
.fret-numbers, .fret-row { min-width: 820px; display: grid; grid-template-columns: 42px repeat(13, 1fr); }
.fret-numbers span { padding: 0 0 7px; color: var(--muted); text-align: center; font: 10px/1 'Trebuchet MS', sans-serif; }
.fretboard { min-width: 820px; padding: 10px 0; background: var(--fret); border-radius: 3px; box-shadow: inset 0 0 30px #17130f; }
.fret-string-label, .fret-note { height: 38px; display: grid; place-items: center; }
.fret-string-label { color: var(--yellow); font: 700 12px/1 monospace; }
.fret-note { position: relative; border-left: 2px solid #9b9287; background: transparent; border-top: 0; border-right: 0; border-bottom: 0; cursor: pointer; }
.fret-note::before { content: ''; position: absolute; left: -2px; right: 0; height: 2px; background: #a99e8f; box-shadow: 0 1px #14110f; }
.fret-note span { position: relative; z-index: 1; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; color: transparent; font: 700 10px/1 'Trebuchet MS', sans-serif; }
.fret-note:hover span { color: var(--white); background: var(--green); }
.fret-note.active span { color: var(--ink); background: var(--yellow); box-shadow: 0 0 0 4px rgb(233 188 72 / 22%); }

.site-footer {
    display: flex;
    justify-content: center;
    gap: 24px;
    padding: 22px;
    color: var(--muted);
    background: var(--surface);
    border-top: 1px solid var(--line);
    font: 12px/1.4 'Trebuchet MS', sans-serif;
}
.site-footer a { color: var(--green); }

.legal-page { max-width: 840px; margin: 0 auto; padding: 54px 24px 80px; }
.legal-page h1 { margin-bottom: 30px; }
.legal-page h2 { margin: 34px 0 10px; }
.legal-page p, .legal-page li { color: #39423d; line-height: 1.7; }
.legal-page .placeholder { padding: 16px; background: #fff0cf; border-left: 4px solid var(--yellow); }
.back-link { display: inline-block; margin-bottom: 30px; color: var(--green); font: 700 13px/1 'Trebuchet MS', sans-serif; }

@media (max-width: 900px) {
    .topbar { grid-template-columns: 1fr auto; }
    .session-status { display: none; }
    .app-shell { display: block; }
    .lesson-nav { position: static; padding: 18px; border-right: 0; border-bottom: 1px solid var(--line); }
    .lesson-nav > .section-label, .nav-footer { display: none; }
    #lessonList { display: flex; overflow-x: auto; gap: 8px; }
    .lesson-button { min-width: 210px; border: 1px solid var(--line); }
    .theory-band { grid-template-columns: 1fr; gap: 18px; }
    .practice-tip { padding: 18px 0 0; border-left: 0; border-top: 1px solid var(--line); }
}

@media (max-width: 600px) {
    .topbar { padding: 10px 16px; }
    .progress-summary span:last-child { display: none; }
    .workspace { padding: 32px 14px 55px; }
    h1 { font-size: 39px; }
    .theory-band { padding: 20px; }
    .player-header { align-items: start; flex-direction: column; }
    .live-note-panel { grid-template-columns: 1fr; gap: 18px; padding: 18px 14px; }
    .tempo-control { width: 100%; }
    .tab-stage { padding: 18px 10px; }
    .beat-display { display: none; }
    .fretboard-heading { align-items: start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
    * { scroll-behavior: auto !important; transition: none !important; }
}
