@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=DM+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Playfair+Display:ital,wght@0,600;0,700;1,500&display=swap');

:root {
    --ink: #291710;
    --ink-soft: #5b4439;
    --muted: #806d64;
    --paper: #fdfbf5;
    --cream: #f5eddd;
    --cream-deep: #eaddc5;
    --wine: #6e2529;
    --wine-dark: #48171a;
    --wine-pale: #f1dfdc;
    --gold: #c59a3f;
    --gold-light: #ead7a7;
    --green: #416d55;
    --line: #ded4c4;
    --white: #fff;
    --shadow: 0 18px 50px rgba(55, 31, 18, .09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: "DM Sans", sans-serif; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: "Playfair Display", serif; line-height: 1.08; }
h1 { margin-bottom: .5rem; font-size: clamp(2.3rem, 5vw, 4rem); letter-spacing: -.035em; }
h2 { margin-bottom: .6rem; font-size: 1.65rem; }
code { padding: .1rem .3rem; border-radius: 4px; background: rgba(110, 37, 41, .08); }

.app-header {
    position: sticky; z-index: 20; top: 0; display: grid; grid-template-columns: 1fr auto 1fr;
    align-items: center; min-height: 78px; padding: 0 clamp(1.25rem, 4vw, 4.5rem);
    border-bottom: 1px solid rgba(197,154,63,.28); background: rgba(253,251,245,.94); backdrop-filter: blur(12px);
}
.brand { display: inline-flex; align-items: center; gap: .8rem; }
.brand-mark { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 50%; color: #fff; background: var(--wine); font: italic 700 1.5rem "Playfair Display"; }
.brand strong, .brand small { display: block; }
.brand strong { font: 700 1.2rem "Playfair Display"; }
.brand small { color: var(--muted); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; }
.brand--large .brand-mark { width: 56px; height: 56px; font-size: 2rem; }
.brand--large strong { font-size: 1.5rem; }
.app-header nav { display: flex; align-self: stretch; gap: 2rem; }
.app-header nav a { display: grid; align-items: center; border-bottom: 2px solid transparent; color: var(--ink-soft); font-size: .92rem; font-weight: 600; }
.app-header nav a:hover { border-color: var(--gold); color: var(--wine); }
.account { display: flex; justify-content: flex-end; align-items: center; gap: 1rem; color: var(--muted); font-size: .82rem; }
.account a { color: var(--wine); font-weight: 700; }
.app-main { width: min(1440px, calc(100% - 3rem)); margin: 0 auto; padding: 4rem 0 6rem; }

.eyebrow { margin-bottom: .7rem; color: var(--gold); font-size: .72rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }
.lead { max-width: 680px; margin-bottom: 0; color: var(--muted); font-size: 1.03rem; }
.page-heading, .section-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 2rem; }
.page-heading { margin-bottom: 2.7rem; }
.page-heading h1 { margin-bottom: .35rem; }
.section { margin-top: 4rem; }
.section-heading { margin-bottom: 1.25rem; }
.section-heading h2 { margin: 0; font-size: 2rem; }
.button-row { display: flex; flex-wrap: wrap; gap: .7rem; }
.text-right { text-align: right; }
.text-link { color: var(--wine); font-weight: 700; }

.button {
    display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: .45rem; padding: .65rem 1rem;
    border: 1px solid transparent; border-radius: 6px; cursor: pointer; font-size: .86rem; font-weight: 700; transition: .18s ease;
}
.button:hover { transform: translateY(-1px); }
.button--primary { color: white; background: var(--wine); box-shadow: 0 8px 20px rgba(110,37,41,.18); }
.button--primary:hover { background: var(--wine-dark); }
.button--dark { color: white; background: var(--ink); }
.button--quiet { border-color: var(--line); background: transparent; }
.button--quiet:hover { border-color: var(--gold); background: #fff; }
.button--danger { color: var(--wine); border-color: #dfb9b9; background: #fff7f6; }
.button--small { min-width: 35px; min-height: 32px; padding: .25rem .5rem; }
.button--wide { width: 100%; }

.flash { max-width: 900px; margin: 0 auto 1rem; padding: .8rem 1rem; border-radius: 6px; font-weight: 600; }
.flash--success { color: #28553b; border: 1px solid #bdd7c6; background: #edf7f0; }
.flash--error { color: #772b30; border: 1px solid #e2babe; background: #fff0f0; }
.pill, .status { display: inline-flex; padding: .3rem .6rem; border-radius: 999px; font-size: .67rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.pill { color: var(--wine); background: var(--wine-pale); }
.pill--soft { color: var(--ink-soft); background: var(--cream); text-transform: none; }
.student-card__pills { display: flex; flex-wrap: wrap; gap: .35rem; }
.status--draft { color: #6c5b43; background: #eee6d7; }
.status--published { color: #285b3e; background: #dcecdf; }
.pill--done { color: #285b3e; background: #dcecdf; }
/* Fortschritt der Grundlagen */
.progress-chip { display: inline-flex; margin-top: .4rem; padding: .28rem .55rem; border-radius: 999px; color: var(--muted); background: #f0ebe0; font-size: .66rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.progress-chip--seen { color: #6c5b43; background: #efe6d3; }
.progress-chip--done { color: #285b3e; background: #dcecdf; }
.complete-form { margin: 0; }
.student-lesson-card.is-done { border-color: #bcdcc6; }
.student-lesson-card.is-done::after { color: rgba(40,91,62,.08); content: "✓"; }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; }
.stat-card { min-height: 200px; padding: 1.5rem; border-radius: 10px; box-shadow: var(--shadow); transition: transform .2s; }
a.stat-card:hover { transform: translateY(-3px); }
.stat-card span, .stat-card small { display: block; }
.stat-card span { font-size: .75rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.stat-card strong { display: block; margin: .7rem 0 1rem; font: 700 4rem "Playfair Display"; line-height: 1; }
.stat-card small { margin-top: auto; opacity: .75; }
.stat-card--wine { color: #fff; background: var(--wine); }
.stat-card--gold { color: var(--ink); background: var(--gold-light); }
.stat-card--cream { border: 1px solid var(--line); background: #fff; }

.table-wrap { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 8px 28px rgba(55,31,18,.04); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 1rem 1.2rem; border-bottom: 1px solid #eee7db; text-align: left; }
th { color: var(--muted); background: #faf6ed; font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
.empty-state { padding: 4rem 2rem; border: 1px dashed var(--line); border-radius: 8px; text-align: center; background: rgba(255,255,255,.5); }
.empty-state > span { display: block; margin-bottom: 1rem; color: var(--gold); font: 600 3rem "Playfair Display"; }
.empty-state h3 { margin-bottom: .5rem; font-size: 1.5rem; }
.empty-state p { color: var(--muted); }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 1.2rem; }
.student-card { display: grid; grid-template-columns: auto 1fr; gap: 1.2rem; padding: 1.4rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: 0 8px 30px rgba(55,31,18,.04); }
.student-card.is-inactive { opacity: .55; }
.avatar { display: grid; width: 58px; height: 58px; place-items: center; border-radius: 50%; color: #fff; background: var(--wine); font: 700 1.2rem "Playfair Display"; }
.student-card__body h2 { margin: .65rem 0 .2rem; font-size: 1.45rem; }
.student-card__body p { margin: 0; color: var(--muted); font-size: .82rem; }
.student-card__actions { display: flex; grid-column: 1 / -1; gap: .6rem; padding-top: 1rem; border-top: 1px solid #eee7db; }
.student-card__actions .button { flex: 1; }
.lesson-list { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.lesson-list > a { display: grid; grid-template-columns: 110px 1fr auto 30px; align-items: center; gap: 1rem; padding: 1.15rem; border-bottom: 1px solid #eee7db; }
.lesson-list > a:last-child { border-bottom: 0; }
.lesson-list > a:hover { background: #fcf8ef; }
.lesson-list time { color: var(--gold); font-weight: 700; }
.lesson-tag { color: var(--wine); font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.play-row { display: flex; flex-wrap: wrap; align-items: center; gap: .9rem; margin-top: .4rem; }
.tempo-control { display: inline-flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .75rem; font-weight: 700; letter-spacing: .04em; }
.tempo-control input[type="range"] { width: 130px; accent-color: var(--wine); }
.tempo-control output { min-width: 60px; color: var(--wine); }
.lesson-tag--card { margin-bottom: 1rem; font-size: .75rem; letter-spacing: .1em; }
.lesson-list strong, .lesson-list small { display: block; }
.lesson-list small { color: var(--muted); }
.note-box, .info-box { padding: 1rem 1.2rem; border-left: 3px solid var(--gold); background: var(--cream); }
.note-box p { margin: .3rem 0 0; color: var(--ink-soft); }
.form-section-heading { margin-top: .5rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.form-section-heading h2 { margin-bottom: .3rem; }
.form-section-heading p:last-child { margin-bottom: 0; color: var(--muted); font-size: .85rem; }
.student-lesson-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.2rem; }
.student-basics { margin-bottom: 1.6rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.student-basics > summary { display: flex; align-items: center; gap: .7rem; padding: 1rem 1.2rem; cursor: pointer; list-style: none; }
.student-basics > summary::-webkit-details-marker { display: none; }
.student-basics > summary::before { content: "▸"; color: var(--gold); font-size: .9rem; transition: transform .15s; }
.student-basics[open] > summary::before { transform: rotate(90deg); }
.student-basics > summary:hover .student-basics__title { color: var(--wine); }
.student-basics__title { font: 700 1.1rem "Playfair Display", serif; }
.student-basics__count { margin-left: auto; color: var(--muted); font-size: .78rem; font-weight: 700; letter-spacing: .06em; }
.student-basics .student-lesson-grid { padding: 0 1.2rem 1.2rem; }
.student-lesson-card { position: relative; display: flex; min-height: 270px; flex-direction: column; align-items: flex-start; padding: 1.5rem; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: var(--shadow); transition: .2s ease; }
.student-lesson-card::after { position: absolute; right: -1rem; bottom: -4rem; color: rgba(110,37,41,.06); content: "♪"; font: 700 12rem "Playfair Display"; }
.student-lesson-card:hover { transform: translateY(-3px); border-color: var(--gold); }
.student-lesson-card time { margin-bottom: 1rem; color: var(--gold); font-size: .75rem; font-weight: 700; letter-spacing: .1em; }
.student-lesson-card h2 { margin: 1.2rem 0 .5rem; font-size: 1.8rem; }
.student-lesson-card p { position: relative; z-index: 1; color: var(--muted); }
.student-lesson-card > strong { position: relative; z-index: 1; margin-top: auto; color: var(--wine); font-size: .85rem; }

.panel { padding: clamp(1.3rem, 3vw, 2.2rem); border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: var(--shadow); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.form-stack { display: grid; gap: 1rem; }
label { display: grid; gap: .42rem; color: var(--ink-soft); font-size: .76rem; font-weight: 700; letter-spacing: .04em; }
input, select, textarea {
    width: 100%; min-height: 46px; padding: .72rem .8rem; border: 1px solid #cfc3b3; border-radius: 5px; outline: none;
    color: var(--ink); background: #fff; font-size: .92rem; font-weight: 400; letter-spacing: 0;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(197,154,63,.15); }
.span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; padding-top: .5rem; }
.check-label { grid-template-columns: auto 1fr; align-content: end; align-items: center; justify-content: start; }
.check-label input { width: 18px; min-height: 18px; }
.code-input { font-family: "DM Mono", monospace; white-space: pre; }
.compact-form { margin-bottom: 2rem; box-shadow: none; }
.type-fields { display: none; gap: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: 6px; background: #faf7f0; }
.type-fields.is-visible { display: grid; }
.chord-picker { display: grid; gap: .8rem; }
.chord-sequence { display: flex; min-height: 76px; flex-wrap: wrap; align-items: center; gap: .45rem; padding: .8rem; border: 1px dashed #cdbb98; border-radius: 7px; background: #fffdf8; }
.chord-sequence__empty { width: 100%; color: var(--muted); font-size: .82rem; text-align: center; }
.chord-sequence__arrow { color: var(--gold); font-weight: 700; }
.chord-sequence__step { position: relative; display: grid; min-width: 74px; min-height: 54px; place-items: center; padding: .5rem 1rem; border: 1px solid var(--gold); border-radius: 5px; color: var(--wine); background: #fff8e9; cursor: pointer; }
.chord-sequence__step:hover { color: #fff; border-color: var(--wine); background: var(--wine); }
.chord-sequence__step strong { font: 700 1rem "Playfair Display"; }
.chord-sequence__step small { position: absolute; top: 3px; right: 5px; color: var(--muted); font-size: .55rem; }
.chord-sequence__step:hover small { color: rgba(255,255,255,.7); }
.chord-picker__tools { display: grid; grid-template-columns: 1fr auto auto auto; gap: .5rem; }
.chord-picker__tools input { min-height: 38px; }
.chord-picker__library { display: flex; max-height: 220px; flex-wrap: wrap; gap: .4rem; overflow-y: auto; padding: .7rem; border: 1px solid var(--line); border-radius: 6px; background: #f7f1e6; }
.chord-choice { display: inline-flex; align-items: center; gap: .5rem; padding: .5rem .65rem; border: 1px solid #d7c8af; border-radius: 4px; color: var(--ink); background: #fff; cursor: pointer; font-size: .75rem; font-weight: 700; }
.chord-choice span { color: var(--wine); font-size: 1rem; line-height: 1; }
.chord-choice:hover { border-color: var(--wine); color: var(--wine); }
.chord-choice--diminished { border-style: dashed; color: var(--wine); background: var(--wine-pale); }
.chord-editor { display: grid; gap: .8rem; padding: 1rem; border: 1px solid var(--line); border-radius: 7px; background: #fffdf8; }
.chord-editor__toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; }
.chord-editor__preset { width: auto; min-height: 38px; flex: 1 1 180px; padding: .4rem .6rem; font-size: .82rem; }
.chord-editor__toolbar .button { padding: .45rem .8rem; font-size: .78rem; }
.chord-editor__shift { display: flex; align-items: center; gap: .35rem; }
.chord-editor__shift > span { color: var(--ink-soft); font-size: .72rem; font-weight: 700; letter-spacing: .04em; }
.chord-editor__shift-value { min-width: 52px; color: var(--wine); font-size: .82rem; text-align: center; }
.chord-editor__shift-btn { display: grid; width: 30px; height: 30px; place-items: center; border: 1px solid #d7c8af; border-radius: 50%; color: var(--wine); background: #fff; cursor: pointer; font-size: .95rem; font-weight: 700; }
.chord-editor__shift-btn:hover { border-color: var(--wine); }
.finger-palette { display: flex; align-items: center; gap: .35rem; }
.finger-palette > span { color: var(--ink-soft); font-size: .72rem; font-weight: 700; letter-spacing: .04em; }
.finger-palette__finger { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid #d7c8af; border-radius: 50%; color: var(--ink); background: #fff; cursor: pointer; font-size: .82rem; font-weight: 700; }
.finger-palette__finger:hover { border-color: var(--wine); color: var(--wine); }
.finger-palette__finger.is-active { border-color: var(--wine); color: #fff; background: var(--wine); }
.chord-editor__board { display: grid; place-items: center; }
.chord-editor__board .chord-svg--editor { width: min(240px, 100%); max-height: none; }
.chord-svg--editor .hit { fill: transparent; cursor: pointer; }
.chord-svg--editor .hit:hover { fill: rgba(197, 154, 63, .22); }
.chord-editor__hint { margin: 0; color: var(--muted); font-size: .72rem; font-weight: 400; letter-spacing: 0; }
.tab-editor { display: grid; gap: .7rem; padding: 1rem; border: 1px solid var(--line); border-radius: 7px; background: #fffdf8; }
.tab-editor__toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.tab-editor__strings { width: auto; min-height: 38px; padding: .4rem .6rem; font-size: .82rem; }
.tab-editor__toolbar .button { padding: .45rem .8rem; font-size: .78rem; }
.tab-editor__symbols { display: flex; flex-wrap: wrap; gap: .3rem; }
.tab-editor__symbol { display: grid; min-width: 30px; height: 30px; place-items: center; padding: 0 .4rem; border: 1px solid #d7c8af; border-radius: 4px; color: var(--wine); background: #fff; cursor: pointer; font: 500 .8rem "DM Mono", monospace; }
.tab-editor__symbol:hover { border-color: var(--wine); background: var(--wine-pale); }
.tab-editor__scroll { overflow-x: auto; padding: .6rem .4rem; border: 1px dashed #cdbb98; border-radius: 6px; background: #fff; }
.tab-editor__scroll:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(197,154,63,.15); }
.tab-editor__row { display: flex; width: max-content; align-items: center; }
.tab-editor__tuning { position: sticky; left: 0; z-index: 1; width: 40px; min-height: 26px; margin-right: .35rem; padding: .15rem .3rem; border-color: transparent; background: #fff; font: 500 .78rem "DM Mono", monospace; text-align: center; }
.tab-editor__tuning:hover, .tab-editor__tuning:focus { border-color: #cfc3b3; }
.tab-editor__cells { display: flex; }
.tab-editor__cell { display: grid; width: 21px; height: 26px; place-items: center; border-radius: 3px; color: var(--ink-soft); cursor: pointer; font: 400 .82rem "DM Mono", monospace; }
.tab-editor__cell:hover { background: rgba(197,154,63,.22); }
.tab-editor__cell.is-bar { color: var(--gold); font-weight: 700; }
.tab-editor__cell.is-cursor { color: #fff; background: var(--wine); }
.tab-editor__hint { margin: 0; color: var(--muted); font-size: .72rem; font-weight: 400; letter-spacing: 0; }
.pattern-editor { display: grid; gap: .8rem; padding: 1rem; border: 1px solid var(--line); border-radius: 7px; background: #fffdf8; }
.pattern-editor__toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.pattern-editor__preset { width: auto; min-height: 38px; margin-right: .5rem; padding: .4rem .6rem; font-size: .82rem; }
.pattern-editor__group { margin-left: .4rem; color: var(--ink-soft); font-size: .72rem; font-weight: 700; letter-spacing: .04em; }
.pattern-editor__token { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid #d7c8af; border-radius: 50%; color: var(--wine); background: #fff; cursor: pointer; font-size: .9rem; font-weight: 700; }
.pattern-editor__token:hover { border-color: var(--wine); }
.pattern-editor__token.is-active { border-color: var(--wine); color: #fff; background: var(--wine); }
.pattern-editor__token--wide { width: 46px; border-radius: 17px; font-size: .78rem; letter-spacing: .02em; }
.pattern-editor__segment-btn { margin-left: .4rem; padding: .35rem .6rem; font-size: .78rem; }
.pattern-editor__steps { display: grid; gap: .35rem; }
.pattern-editor__row { display: flex; flex-wrap: wrap; align-items: stretch; gap: .3rem; }
.pattern-editor__row-label { align-self: center; min-width: 92px; color: var(--wine); font-size: .74rem; font-weight: 700; letter-spacing: .03em; }
.pattern-editor__step { display: grid; min-width: 42px; justify-items: center; gap: .25rem; padding: .45rem .3rem .5rem; border: 1px solid #d7c8af; border-radius: 6px; background: #fff; cursor: pointer; }
.pattern-editor__step:hover { border-color: var(--wine); box-shadow: 0 0 0 2px rgba(110,37,41,.1); }
.pattern-editor__step small { color: var(--gold); font-size: .68rem; font-weight: 700; }
.pattern-editor__step strong { min-height: 1.3rem; color: var(--wine); font-size: 1.05rem; line-height: 1.3rem; }
.pattern-editor__step.is-rest strong { color: #cdbfae; }
.pattern-editor__hint { margin: 0; color: var(--muted); font-size: .72rem; font-weight: 400; letter-spacing: 0; }
.fifths-preview { width: min(340px, 100%); margin: 0 auto; }
/* Griffbrett-Diagramm (fretboard) */
.fretboard-presentation { display: grid; gap: .5rem; }
.fretboard-svg { display: block; width: 100%; max-width: 720px; height: auto; }
.mini-fretboard { margin: .4rem 0; }
.fb-board { fill: var(--cream-deep); stroke: var(--gold); stroke-width: 1; }
.fb-string { stroke: #8a6d47; }
.fb-fret { stroke: #b9a074; stroke-width: 1.4; }
.fb-nut { fill: var(--ink); }
.fb-inlay { fill: #cdb98d; }
.fb-slabel { fill: var(--muted); font-size: 11px; font-weight: 700; }
.fb-roman { fill: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .04em; }
.fb-dot { fill: var(--gold-light); stroke: var(--gold); stroke-width: 1; }
.fb-dot-root { fill: var(--wine); stroke: var(--gold); stroke-width: 1.5; }
.fb-root-halo { fill: none; stroke: var(--wine); stroke-width: 1.4; }
.fb-open { fill: #fff; stroke: var(--gold); stroke-width: 1.4; }
.fb-dot-off { fill: #efe7d6; stroke: #d5c8ae; stroke-width: 1; }
.fb-name { fill: var(--ink); font-size: 10px; font-weight: 700; text-anchor: middle; }
.fb-name-root { fill: #fff; }
.fb-name-off { fill: var(--muted); font-size: 8.5px; font-weight: 600; }
.play-block { margin-top: .5rem; }
.notation-editor { display: grid; gap: .7rem; padding: 1rem; border: 1px solid var(--line); border-radius: 7px; background: #fffdf8; }
.notation-editor__toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.notation-editor__toolbar .button { padding: .4rem .7rem; font-size: .76rem; }
.notation-editor__key { display: grid; min-width: 34px; height: 34px; place-items: center; padding: 0 .5rem; border: 1px solid #d7c8af; border-radius: 5px; color: var(--wine); background: #fff; cursor: pointer; font-size: .82rem; font-weight: 700; }
.notation-editor__key:hover { border-color: var(--wine); }
.notation-editor__key.is-active { border-color: var(--wine); color: #fff; background: var(--wine); }
.notation-editor__board { overflow-x: auto; border: 1px dashed #cdbb98; border-radius: 6px; background: #fff; }
.notation-svg .n-hit { fill: transparent; }
.notation-svg.is-editable .n-hit { cursor: pointer; }
.notation-svg .n-hit.is-selected { fill: rgba(197, 154, 63, .18); stroke: var(--gold); stroke-width: 1; rx: 4; }
.tab-import { display: grid; gap: .5rem; padding: .7rem; border: 1px dashed #cdbb98; border-radius: 6px; background: #fffdf7; }
.tab-import textarea { width: 100%; }
.tab-import__actions { display: flex; gap: .5rem; }
.notation-editor__hint { margin: 0; color: var(--muted); font-size: .72rem; font-weight: 400; letter-spacing: 0; }
.notation-widget { overflow-x: auto; }
.notation-svg { display: block; }
.notation-svg.is-editable { cursor: pointer; }
.notation-svg .n-line { stroke: #5b4439; stroke-width: 1; }
.notation-svg .n-tabline { stroke: #a08a72; stroke-width: .8; }
.notation-svg .n-clef { fill: var(--ink); font-size: 58px; }
.notation-svg .n-tablabel { fill: var(--muted); font: 700 9px "DM Sans"; letter-spacing: .2em; }
.notation-svg .n-fill { fill: var(--ink); }
.notation-svg .n-open { fill: none; stroke: var(--ink); stroke-width: 1.6; }
.notation-svg .n-stem, .notation-svg .n-rest { stroke: var(--ink); stroke-width: 1.4; fill: none; }
.notation-svg .n-flag { stroke: var(--ink); stroke-width: 1.6; fill: none; }
.notation-svg .n-sharp { fill: var(--ink); font-size: 13px; }
.notation-svg .n-bar { stroke: var(--ink); stroke-width: 1.6; }
.notation-svg .n-fret-dot { fill: var(--wine); }
.degree-staff { width: 100%; margin-top: .25rem; }
.triad-staff-svg { display: block; width: 76px; margin: 0 auto; }
.triad-staff-svg .ts-line { stroke: #5b4439; stroke-width: .9; }
.triad-staff-svg .ts-clef { fill: var(--ink); font-size: 34px; }
.triad-staff-svg .ts-head { fill: none; stroke: var(--ink); stroke-width: 1.4; }
.triad-staff-svg .ts-acc { fill: var(--ink); font-size: 10px; }
.degree-play { display: grid; width: 26px; height: 26px; place-items: center; margin-top: .3rem; border: 1px solid #d7c8af; border-radius: 50%; color: var(--wine); background: #fff; cursor: pointer; font-size: .6rem; }
.degree-play:hover { border-color: var(--wine); }
.scale-names { margin-right: auto; color: var(--wine); font: 700 .95rem "Playfair Display", serif; }
.scale-mode { display: flex; gap: .35rem; }
.fret-palette { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.fret-palette > span { color: var(--ink-soft); font-size: .72rem; font-weight: 700; letter-spacing: .04em; }
.fret-palette__fret { display: grid; min-width: 28px; height: 28px; place-items: center; border: 1px solid #d7c8af; border-radius: 5px; color: var(--ink); background: #fff; cursor: pointer; font-size: .78rem; font-weight: 700; }
.fret-palette__fret:hover { border-color: var(--wine); color: var(--wine); }
.fret-palette__fret.is-active { border-color: var(--wine); color: #fff; background: var(--wine); }
.notation-svg .n-fret { fill: var(--wine); font: 700 9px "DM Mono", monospace; paint-order: stroke; stroke: #fff; stroke-width: 3; }
.notation-svg.is-editable .n-fret { cursor: pointer; }
.notation-svg.is-editable .n-fret:hover { fill: var(--ink); }
.chord-presentation .play-block { grid-column: 1 / -1; justify-self: start; margin-top: 0; }
.scale-editor { display: grid; gap: .9rem; }
.scale-editor__degrees { display: grid; grid-template-columns: repeat(7, minmax(75px, 1fr)); gap: .45rem; overflow-x: auto; padding-bottom: .3rem; }
.scale-editor__degree { display: grid; min-height: 122px; place-items: center; padding: .55rem .35rem; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; text-align: center; }
.scale-editor__degree:hover, .scale-editor__degree.is-active { border-color: var(--wine); box-shadow: 0 0 0 2px rgba(110,37,41,.12); }
.scale-editor__degree .degree-roman { color: var(--gold); font-size: .65rem; font-weight: 700; }
.scale-editor__degree .degree-chord { color: var(--wine); font: 700 .88rem "Playfair Display"; }
.scale-editor__degree .degree-note { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 50%; color: #fff; background: var(--ink); font: 700 1rem "Playfair Display"; }
.scale-editor__degree .degree-quality { min-height: 1em; color: var(--muted); font-size: .6rem; }
.scale-editor__tools { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.scale-editor__tools strong { margin-right: auto; color: var(--wine); }
.scale-editor__chords { display: flex; max-height: 180px; flex-wrap: wrap; gap: .4rem; overflow-y: auto; padding: .7rem; border: 1px solid var(--line); border-radius: 6px; background: #f7f1e6; }

.filter-bar { display: grid; grid-template-columns: 1fr 250px auto; gap: .7rem; margin-bottom: 1.5rem; padding: 1rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.material-group { margin-bottom: .8rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.material-group > summary { display: flex; align-items: center; gap: .7rem; padding: 1rem 1.2rem; cursor: pointer; list-style: none; }
.material-group > summary::-webkit-details-marker { display: none; }
.material-group > summary::before { content: "▸"; color: var(--gold); font-size: .9rem; transition: transform .15s; }
.material-group[open] > summary::before { transform: rotate(90deg); }
.material-group > summary:hover .material-group__title { color: var(--wine); }
.material-group__title { font: 700 1.1rem "Playfair Display", serif; }
.material-group__count { margin-left: auto; color: var(--muted); font-size: .78rem; font-weight: 700; letter-spacing: .06em; }
.material-group .material-grid { padding: 0 1.2rem 1.2rem; }
.material-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.1rem; }
.material-card { position: relative; min-height: 255px; padding: 1.3rem; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.material-card__top { display: flex; justify-content: space-between; align-items: center; }
.material-card__top > a { color: var(--wine); font-size: .75rem; font-weight: 700; }
.material-card h2 { margin: 1.2rem 0 .2rem; font-size: 1.45rem; }
.material-card .subtitle { color: var(--gold); font-weight: 600; }
.material-card p { color: var(--muted); font-size: .85rem; }
.tags { display: flex; flex-wrap: wrap; gap: .3rem; }
.tags span { padding: .22rem .45rem; border-radius: 3px; color: var(--muted); background: #f4efe5; font-size: .66rem; }
.mini-chord { position: absolute; right: .6rem; bottom: -.7rem; width: 110px; opacity: .15; transform: rotate(4deg); }
.mini-fifths { position: absolute; right: -1.6rem; bottom: -2rem; width: 170px; opacity: .13; transform: rotate(7deg); }
.material-card--fifths .mini-fifths { position: relative; right: auto; bottom: auto; width: min(270px, 82%); margin: 1rem auto .5rem; opacity: 1; transform: none; }
.material-card--fifths { min-height: 0; }

.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 390px; align-items: start; gap: 2rem; }
.editor-preview { padding: clamp(1rem, 3vw, 2.5rem); border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: var(--shadow); }
.builder-panel { position: sticky; top: 100px; max-height: calc(100vh - 120px); overflow: auto; border: 1px solid var(--line); border-radius: 9px; background: #fff; box-shadow: var(--shadow); }
.tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); }
.tab { padding: 1rem; border: 0; color: var(--muted); background: #f8f3e9; cursor: pointer; font-weight: 700; }
.tab.is-active { color: var(--wine); background: #fff; box-shadow: inset 0 -2px var(--wine); }
.tab-content { display: none; padding: 1rem; }
.tab-content.is-active { display: grid; }
.library-search { margin-bottom: .8rem; }
.library-filters { display: grid; gap: .5rem; margin-bottom: .8rem; }
.library-filters .library-search { margin-bottom: 0; }
.library-filters .library-type-filter { min-height: 40px; padding: .45rem .6rem; font-size: .82rem; }
.library-list { display: grid; gap: .45rem; max-height: 560px; overflow: auto; }
.library-group { border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.library-group > summary { display: flex; align-items: center; gap: .5rem; padding: .55rem .7rem; color: var(--ink-soft); cursor: pointer; font-size: .8rem; font-weight: 700; list-style: none; }
.library-group > summary::-webkit-details-marker { display: none; }
.library-group > summary::before { content: "▸"; color: var(--gold); font-size: .75rem; transition: transform .15s; }
.library-group[open] > summary::before { transform: rotate(90deg); }
.library-group > summary small { margin-left: auto; color: var(--muted); font-weight: 700; }
.library-group .library-item { margin: 0 .45rem .45rem; }
.library-item { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .7rem; padding: .75rem; border: 1px solid #e8dfd1; border-radius: 5px; background: #fff; }
.library-item:hover { border-color: var(--gold); }
.library-item small, .library-item strong { display: block; }
.library-item small { color: var(--gold); font-size: .62rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.library-item button { display: grid; width: 34px; height: 34px; place-items: center; border: 0; border-radius: 50%; color: #fff; background: var(--wine); cursor: pointer; font-size: 1.2rem; }
.share-box { display: grid; gap: .5rem; margin: 1rem; padding: 1rem; border-radius: 6px; background: var(--cream); }
.share-box small { color: var(--muted); }

.auth-page { min-height: 100vh; background: var(--cream); }
.auth-shell { display: grid; grid-template-columns: minmax(420px, .85fr) 1.15fr; min-height: 100vh; }
.auth-card { display: flex; flex-direction: column; justify-content: center; gap: 2.5rem; padding: clamp(2rem, 7vw, 7rem); background: var(--paper); }
.auth-card h1 { max-width: 650px; font-size: clamp(2.7rem, 5vw, 5rem); }
.auth-card .form-stack { max-width: 440px; }
.fine-print { color: var(--muted); font-size: .72rem; }
.auth-visual { position: relative; display: flex; min-height: 100vh; flex-direction: column; justify-content: flex-end; padding: 6vw; overflow: hidden; color: #fff; background: var(--wine); }
.giant-chord { position: absolute; top: 5%; right: -3%; color: rgba(255,255,255,.09); font: 700 clamp(15rem, 37vw, 38rem)/1 "Playfair Display"; }
.auth-visual p { position: relative; z-index: 2; margin: 0; font: italic 500 clamp(2rem, 4vw, 4rem)/1.15 "Playfair Display"; }
.string-art { position: absolute; inset: 0 10%; display: flex; justify-content: space-around; transform: rotate(8deg) scale(1.15); opacity: .23; }
.string-art i { width: 1px; background: var(--gold-light); box-shadow: 0 0 8px rgba(255,255,255,.4); }
.error-shell { grid-template-columns: 1fr; }
.error-shell .auth-card { align-items: flex-start; }
.narrow-page { max-width: 720px; margin: 3rem auto; }

/* Lesson / print design */
.lesson-page { background: #e8e1d5; }
.print-toolbar { position: sticky; z-index: 20; top: 0; display: flex; justify-content: center; gap: .7rem; padding: .8rem; border-bottom: 1px solid #ccc0ae; background: rgba(253,251,245,.95); }
.lesson-sheet { width: 210mm; min-height: 297mm; margin: 2rem auto; padding: 17mm 17mm 13mm; background: #fffef9; box-shadow: 0 20px 70px rgba(45,25,14,.2); }
.lesson-header { margin-bottom: 10mm; text-align: center; }
.lesson-header h1 { margin: 0; font-size: 38pt; }
.lesson-subtitle { margin: 2mm 0 0; color: var(--wine); font: italic 500 14pt "Playfair Display"; }
.lesson-intro { max-width: 130mm; margin: 3mm auto 0; color: var(--muted); font-size: 9pt; }
.gold-rule { height: 2px; margin-top: 5mm; background: var(--gold); }
.lesson-content { display: grid; grid-template-columns: minmax(0, 1fr); gap: 5mm; }
.lesson-block { position: relative; padding: 5mm; break-inside: avoid; border: 1px solid #e4d9c6; border-radius: 2mm; background: #fff; }
.lesson-block--homework { border: 0; border-left: 4px solid var(--gold); background: var(--cream); }
.lesson-block--text_note { border: 0; background: var(--wine-pale); }
.block-heading { margin-bottom: 3mm; }
.block-heading h2 { margin: 1mm 0 0; font-size: 17pt; }
.block-kicker { color: var(--gold); font-size: 7pt; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.lesson-block p { margin: 2mm 0 0; color: var(--ink-soft); font-size: 9pt; }
.block-actions { display: flex; justify-content: space-between; gap: 1rem; margin: 4mm -5mm -5mm; padding: 2mm 3mm; border-top: 1px solid #e7ded0; background: #fbf7ef; }
.block-actions form { display: flex; gap: .25rem; }
.chord-presentation { display: grid; grid-template-columns: 42mm 1fr; align-items: center; gap: 8mm; }
.chord-svg { width: 100%; max-height: 42mm; overflow: visible; }
.chord-svg .string, .chord-svg .fret { stroke: #5b4439; stroke-width: 1; }
.chord-svg .nut { fill: var(--ink); }
.chord-svg .string-label, .chord-svg .base-fret { fill: var(--muted); font: 7px "DM Sans"; }
.chord-svg .muted { fill: var(--wine); font: 700 12px "DM Sans"; }
.chord-svg .open { fill: none; stroke: var(--wine); stroke-width: 1.5; }
.chord-svg .finger { fill: var(--wine); }
.chord-svg .finger-number { fill: white; font: 700 8px "DM Sans"; }
.chord-svg .tone-label { fill: var(--wine); font: 700 7.5px "DM Sans"; }
.fifths-presentation { display: grid; grid-template-columns: minmax(70mm, 105mm) 1fr; align-items: center; gap: 8mm; }
.fifths-svg { width: 100%; overflow: visible; }
.fifths-outer { fill: #f8eed9; stroke: var(--gold); stroke-width: 2; }
.fifths-inner { fill: #fffaf0; stroke: var(--wine); stroke-width: 1.5; }
.fifths-divider { stroke: #d5c29a; stroke-width: 1; }
.fifths-center { fill: var(--wine); stroke: var(--gold); stroke-width: 2; }
.fifths-major { fill: var(--ink); font: 700 14px "Playfair Display"; }
.fifths-minor { fill: var(--wine); font: 600 10px "DM Sans"; }
.fifths-title { fill: #fff; font: 700 8px "DM Sans"; letter-spacing: 1.5px; }
.tab-sheet { overflow-x: auto; margin: 3mm 0 0; padding: 4mm; border-left: 3px solid var(--gold); color: var(--ink); background: #f8f1e3; font: 500 9pt/1.55 "DM Mono", monospace; }
.progression { display: flex; flex-wrap: wrap; align-items: stretch; gap: 3mm; }
.progression span { display: grid; min-width: 23mm; min-height: 18mm; place-items: center; border: 1px solid var(--gold); color: var(--wine); background: #fffaf0; font: 700 17pt "Playfair Display"; }
.progression-chord { display: grid; width: 26mm; margin: 0; justify-items: center; align-content: center; gap: 1.5mm; padding: 2.5mm 1.5mm; border: 1px solid var(--gold); background: #fffaf0; }
.progression-chord .chord-svg { width: 100%; max-height: 30mm; }
.progression-chord figcaption { color: var(--wine); font: 700 11pt/1.15 "Playfair Display"; text-align: center; text-wrap: balance; }
.pattern-display { padding: 3mm 4mm; color: var(--wine); background: var(--cream); font: 700 22pt "DM Mono"; letter-spacing: .08em; text-align: center; }
.pattern-display--inline { margin-top: 3mm; padding: 2mm 3mm; font-size: 13pt; }
.pattern-display--per-chord { display: grid; gap: 1.4mm; font-size: 11pt; text-align: left; }
.pattern-segment { display: flex; flex-wrap: wrap; align-items: baseline; gap: 3mm; }
.pattern-segment__chord { min-width: 30mm; color: var(--gold); font: 700 8pt "DM Sans"; letter-spacing: .08em; text-transform: uppercase; }
.scale-harmony { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2mm; overflow: hidden; }
.scale-degree { position: relative; display: grid; min-height: 35mm; grid-template-rows: auto 1fr auto auto; place-items: center; padding: 2.5mm 1mm; border: 1px solid #dfd3c0; border-radius: 1.5mm; background: #fffaf0; text-align: center; }
.scale-degree::after { position: absolute; right: 0; bottom: 0; left: 0; height: 2mm; content: ""; background: var(--muted); }
.scale-degree--major::after { background: var(--gold); }
.scale-degree--minor::after { background: var(--wine); }
.scale-degree--diminished::after { background: var(--ink); }
.scale-degree__roman { color: var(--gold); font-size: 7pt; font-weight: 700; }
.scale-degree__chord { align-self: center; color: var(--wine); font: 700 10pt "Playfair Display"; }
.scale-degree__note { display: grid; width: 10mm; height: 10mm; place-items: center; border-radius: 50%; color: #fff; background: var(--ink); font: 700 10pt "Playfair Display"; }
.scale-degree small { margin-top: 1mm; color: var(--muted); font-size: 5.5pt; }
.count-display { padding: 2mm; color: var(--muted); font: 8pt "DM Mono"; letter-spacing: .18em; text-align: center; }
.meta-line { color: var(--gold) !important; font-weight: 700; }
.media-link { display: inline-block; margin-top: 3mm; color: var(--wine); font-weight: 700; }
.lesson-footer { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-top: 10mm; padding-top: 4mm; border-top: 1px solid var(--gold-light); }
.lesson-footer > span { color: var(--gold); font-size: 7pt; font-weight: 700; letter-spacing: .2em; }
.lesson-footer p { margin: 0; font-size: 8pt; }
.empty-print { padding: 2rem; color: var(--muted); text-align: center; }

@media (max-width: 980px) {
    .app-header { grid-template-columns: 1fr auto; }
    .app-header nav { position: fixed; right: 0; bottom: 0; left: 0; z-index: 30; justify-content: space-around; height: 58px; background: #fff; box-shadow: 0 -5px 20px rgba(0,0,0,.08); }
    .account span { display: none; }
    .app-main { padding-bottom: 6rem; }
    .stat-grid { grid-template-columns: 1fr; }
    .stat-card { min-height: 150px; }
    .editor-layout { grid-template-columns: 1fr; }
    .builder-panel { position: static; max-height: none; }
    .auth-shell { grid-template-columns: 1fr; }
    .auth-visual { display: none; }
}

@media (max-width: 680px) {
    .app-main { width: min(100% - 1.4rem, 1440px); padding-top: 2rem; }
    .page-heading { align-items: flex-start; flex-direction: column; margin-bottom: 1.8rem; }
    .page-heading .button, .button-row { width: 100%; }
    .form-grid, .filter-bar { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
    .lesson-list > a { grid-template-columns: 90px 1fr; }
    .lesson-list .status, .lesson-list b { display: none; }
    .table-wrap { overflow-x: auto; }
    .card-grid { grid-template-columns: 1fr; }
    .lesson-sheet { width: 100%; min-height: 100vh; margin: 0; padding: 8vw; box-shadow: none; }
    .chord-presentation { grid-template-columns: 1fr; }
    .fifths-presentation { grid-template-columns: 1fr; }
    .chord-svg { max-height: 55mm; }
    .chord-picker__tools { grid-template-columns: 1fr 1fr; }
    .chord-picker__tools input { grid-column: 1 / -1; }
    .scale-editor__degrees { grid-template-columns: repeat(7, 82px); }
}

@page { size: A4; margin: 0; }
@media print {
    .no-print { display: none !important; }
    body.lesson-page { background: #fff; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .lesson-sheet { width: 210mm; min-height: 297mm; margin: 0; padding: 16mm; box-shadow: none; }
    .lesson-block { page-break-inside: avoid; }
}
