:root{--bg:#ffffff;--panel:#171924;--ink:#0d0f16;--muted:#5c637a;--accent:#4fb3ff;--accent-2:#8ef1a7;--danger:#ff6b6b;--fret:#000000;--string:#000000;--note:#ffffff;--note-bad:#ff6b6b;--dot:#c2b59b;--good:#46d38a;--board:#e7d9bd}
*{box-sizing:border-box}
html,body{height:100%}
body{margin:0;background:var(--bg);color:var(--ink);font:400 16px/1.4 system-ui,-apple-system,Segoe UI,Roboto,Arial}
button{cursor:pointer}

.app-header{display:flex;align-items:center;justify-content:space-between;padding:10px 12px;background:var(--panel);border-bottom:1px solid #202437;position:sticky;top:0;z-index:5}
.brand{display:flex;align-items:center;gap:10px}
.brand .logo{display:inline-grid;place-items:center;width:28px;height:28px;border-radius:6px;background:linear-gradient(135deg,var(--accent),#6ee7ff);color:#00161f;font-weight:700}
.brand-copy{display:flex;flex-direction:column;gap:2px}
.app-header h1{font-size:16px;margin:0;color:#e9eef6}
.trainer-purpose{margin:0;color:#cfd7e3;font-size:12px;line-height:1.25;max-width:520px}
.header-actions{display:flex;align-items:center;gap:4px;flex-shrink:0}
.icon-btn{display:inline-grid;place-items:center;border:1px solid #2b3145;background:#1b1f2f;border-radius:8px;color:#d5dceb;padding:6px}
.icon-btn:hover{background:#22263a}
.primary{background:var(--accent);border:0;color:#001019;border-radius:10px;padding:10px 14px;font-weight:700}
.primary:hover{filter:brightness(1.04)}
.enable-audio-btn{background:#2b3145;border:1px solid #3b4155;color:#e9eef6;border-radius:8px;padding:6px 12px;font-size:14px;font-weight:600}
.enable-audio-btn:hover{background:#3b4155}

.app-main{max-width:1100px;margin:0 auto;padding:10px}
.info-bar{display:flex;align-items:center;justify-content:center;gap:12px;flex-wrap:wrap;margin:8px 0 14px}
.controls{display:flex;align-items:center;gap:8px}
.audio-status{color:var(--muted);font-size:12px;line-height:1.25;max-width:220px}
.audio-status.is-problem{color:#9f2f2f}
.chip{display:inline-block;font-size:11px;line-height:1;padding:3px 6px;border-radius:999px;background:#26304a;color:#d5dceb;margin-left:6px}

.fretboard-section{position:relative}
.fretboard-container{width:100%;max-width:350px;aspect-ratio:8/14;border:1px solid #d3d5de;border-radius:8px;overflow:hidden;display:grid;place-items:center;background:#fff;margin:0 auto}

/* Fretboard (SVG) */
.fretboard{width:92%;height:94%}
.fret{stroke:#000;stroke-width:3}
.nut{stroke:#000;stroke-width:6}
.string{stroke:var(--string);stroke-linecap:round}
.string.s1{stroke-width:4.5}
.string.s2{stroke-width:4.2}
.string.s3{stroke-width:3.8}
.string.s4{stroke-width:3.4}
.string.s5{stroke-width:3.0}
.string.s6{stroke-width:2.6}
.fret-marker{fill:var(--dot)}
.fret-number{font-size:10px;fill:#2a2a2a}

/* Voicing type label */
.voicing-label{font-size:18px;font-weight:800;fill:#1a1a1a;text-anchor:middle}

/* String active/inactive states */
.string.active{opacity:1}
.string.inactive{opacity:0.25}

.note{stroke-width:2}
.note.target{fill:#000;stroke:#fff}
.note.user{fill:#fff;stroke:#000}
.note.bad{fill:var(--note-bad)}
.note.correct{fill:var(--good)}
.note-label{font-size:12px;font-weight:800;pointer-events:none}
.note.target + .note-label, .note.target ~ .note-label{fill:#fff}
.note.user + .note-label, .note.user ~ .note-label{fill:#000}

.feedback{position:absolute;inset:auto 0 8px 0;text-align:center;color:var(--muted)}
.feedback.correct{color:var(--good)}
.badge{display:inline-block;padding:8px 16px;border-radius:20px;background:var(--good);color:#fff;font-weight:600;animation:badge-bounce .3s ease-out}
.badge.perfect{background:linear-gradient(135deg,#10b981,#059669);box-shadow:0 4px 12px rgba(16,185,129,0.3)}
.badge.nice{background:linear-gradient(135deg,#3b82f6,#2563eb);box-shadow:0 4px 12px rgba(59,130,246,0.3)}
.badge.good{background:linear-gradient(135deg,#f59e0b,#d97706);box-shadow:0 4px 12px rgba(245,158,11,0.3)}
.badge.tries{background:linear-gradient(135deg,#8b5cf6,#7c3aed);box-shadow:0 4px 12px rgba(139,92,246,0.3)}
@keyframes badge-bounce{0%{transform:scale(0.9);opacity:0.7}50%{transform:scale(1.1)}100%{transform:scale(1);opacity:1}}

/* Settings */
.scrim{position:fixed;inset:0;background:rgba(0,0,0,.45);backdrop-filter:blur(1px)}
.settings{position:fixed;inset:0 0 0 auto;width:min(500px,92vw);background:var(--panel);border-left:1px solid #202437;transform:translateX(105%);transition:transform .2s ease;z-index:10;display:flex;flex-direction:column;color:#e9eef6}
.settings[aria-hidden="false"]{transform:none}
.settings-header{display:flex;align-items:center;justify-content:space-between;padding:14px;border-bottom:1px solid #202437}
.settings-header h2{color:#e9eef6;margin:0;font-size:16px}
.settings-content{padding:14px 14px 18px;overflow:auto;color:#e9eef6}
.options-grid{display:grid;grid-template-columns:1fr;gap:4px}
.options-grid.small{grid-template-columns:1fr}
.options-grid label{display:flex;align-items:center;gap:8px;padding:6px 10px;border:1px solid #2b3145;border-radius:6px;background:#1b1f2f;color:#e9eef6;font-size:14px}
.options-grid label:hover{background:#232841}
.options-grid input{accent-color:var(--accent)}
.settings legend{color:#cfd7e3;margin-bottom:8px}
.settings .switch{color:#e9eef6}
.switch{display:flex;align-items:center;gap:8px}
.switch select{background:#1b1f2f;border:1px solid #2b3145;border-radius:6px;color:#e9eef6;padding:4px 8px;font-size:14px}
.switch select:hover{background:#232841}
.volume-control{display:flex;align-items:center;gap:8px}
.volume-control input[type="range"]{flex:1;accent-color:var(--accent)}
.volume-control span{min-width:40px;font-size:12px;color:#cfd7e3}
.settings-actions{display:flex;justify-content:flex-end;margin-top:10px}

/* Stats panel */
.stats-panel{background:var(--panel);color:#e9eef6}
.stats-section{display:flex;flex-direction:column;gap:8px}
.stat-item{display:flex;justify-content:space-between;align-items:center;padding:6px 0;border-bottom:1px solid #2b3145}
.stat-item:last-child{border-bottom:none}
.stat-label{color:#cfd7e3;font-size:14px}
.stat-value{font-weight:600;font-size:14px}
.stat-value.correct{color:var(--good)}
.stat-value.incorrect{color:var(--danger)}
.secondary{background:#2b3145;border:1px solid #3b4155;color:#e9eef6;border-radius:10px;padding:10px 14px;font-weight:600}
.secondary:hover{background:#3b4155}

/* Help panel */
.help-panel{background:var(--panel);color:#e9eef6}
.help-content{max-height:70vh;overflow-y:auto}
.help-content section{margin-bottom:24px}
.help-content h3{color:#e9eef6;margin:0 0 12px 0;font-size:16px;font-weight:600}
.help-content p{margin:0 0 12px 0;line-height:1.5;color:#cfd7e3}
.help-content ol, .help-content ul{margin:0 0 12px 0;padding-left:20px;color:#cfd7e3;line-height:1.5}
.help-content li{margin-bottom:8px}
.help-content strong{color:#e9eef6;font-weight:600}
.help-content em{color:#9ca3af;font-style:italic}

/* Mobile tweaks */
@media (max-width:700px){
  .app-main{padding:8px}
  .app-header{align-items:flex-start;gap:8px}
  .trainer-purpose{max-width:calc(100vw - 190px);font-size:11px}
  .controls{flex-wrap:wrap;justify-content:center}
  .audio-status{order:3;flex-basis:100%;text-align:center;max-width:none}
  .fretboard-container{aspect-ratio:7/14}
}
