/* GuitarCoach — design system derived from the bonzocorp family (dark violet glass). */
:root {
  --bg: #0b0713;
  --bg-soft: #130a24;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-2: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.10);
  --text: #f4f1fb;
  --muted: #b9b1d0;
  --faint: #8078a0;
  --brand: #8b5cf6;
  --brand-2: #a78bfa;
  --brand-3: #6d5cff;
  --accent: #22d3ee;
  --ok: #22c55e;
  --bad: #ef4444;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --r: 16px;
  --r-sm: 10px;
  --maxw: 1140px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3 { font-family: "Sora", system-ui, sans-serif; line-height: 1.15; margin: 0 0 .5em; }
a { color: inherit; text-decoration: none; }
.muted { color: var(--muted); }

/* aurora bg */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.aurora span {
  position: absolute; border-radius: 50%; filter: blur(90px); opacity: .5;
  animation: drift 22s ease-in-out infinite;
}
.aurora span:nth-child(1) { width: 46vw; height: 46vw; left: -8vw; top: -10vw; background: radial-gradient(circle, var(--brand), transparent 70%); }
.aurora span:nth-child(2) { width: 40vw; height: 40vw; right: -10vw; top: 10vh; background: radial-gradient(circle, var(--brand-3), transparent 70%); animation-delay: -7s; }
.aurora span:nth-child(3) { width: 34vw; height: 34vw; left: 30vw; bottom: -14vw; background: radial-gradient(circle, var(--accent), transparent 70%); opacity: .3; animation-delay: -13s; }
@keyframes drift { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(4vw,3vh) scale(1.08); } }

.glass {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* topbar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px clamp(16px, 4vw, 40px);
  background: rgba(11, 7, 19, 0.7);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-family: "Sora"; font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em; }
.brand b { color: var(--brand-2); }
.brand-logo { width: 26px; height: 26px; object-fit: contain; }
.topnav { display: flex; gap: 22px; align-items: center; font-weight: 600; font-size: .95rem; }
.topnav a.active { color: var(--brand-2); }
.topnav a:hover { color: var(--brand-2); }

main { max-width: var(--maxw); margin: 0 auto; padding: clamp(20px, 4vw, 44px) clamp(16px, 4vw, 40px) 80px; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--r-sm); border: 1px solid var(--border);
  font-family: "Plus Jakarta Sans"; font-weight: 700; font-size: .95rem;
  cursor: pointer; color: var(--text); background: var(--surface-2);
  transition: transform .12s ease, background .2s, border-color .2s;
  min-height: 44px;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-3)); border-color: transparent; }
.btn-primary.active, .btn-primary:hover { box-shadow: 0 6px 22px rgba(139, 92, 246, .35); }
.btn-ghost { background: transparent; }
.btn-done { background: rgba(34, 197, 94, .16); border-color: rgba(34, 197, 94, .4); color: #bbf7d0; }
.btn-choice { background: var(--surface-2); }
.btn-choice.right { background: rgba(34,197,94,.22); border-color: var(--ok); color: #bbf7d0; }
.btn-choice.wrong { background: rgba(239,68,68,.2); border-color: var(--bad); color: #fecaca; }

/* ---------- Home ---------- */
.hero { padding: clamp(28px, 5vw, 52px); text-align: center; margin-bottom: 22px; }
.hero-kicker { color: var(--brand-2); font-weight: 700; font-size: .85rem; letter-spacing: .05em; text-transform: uppercase; }
.hero h1 { font-size: clamp(2.4rem, 7vw, 4rem); font-weight: 800; letter-spacing: -.02em; margin: .2em 0; background: linear-gradient(120deg, var(--text), var(--brand-2)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero-sub { color: var(--muted); max-width: 640px; margin: 0 auto 1.4em; font-size: 1.08rem; }
.hero-stats { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.stat { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 12px 22px; min-width: 110px; }
.stat-n { display: block; font-family: "Sora"; font-weight: 800; font-size: 1.6rem; }
.stat-l { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }

.pareto-banner { padding: 16px 20px; margin-bottom: 26px; color: var(--muted); font-size: .98rem; border-left: 3px solid var(--brand); }
.pareto-banner b { color: var(--text); }

.week-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.week-card { padding: 20px; display: flex; flex-direction: column; gap: 8px; transition: transform .15s, border-color .2s; position: relative; overflow: hidden; }
.week-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--brand), var(--accent)); opacity: .7; }
.week-card:hover { transform: translateY(-3px); border-color: var(--brand); }
.week-card.done { border-color: rgba(34,197,94,.4); }
.wc-top { display: flex; align-items: center; gap: 10px; }
.wc-num { font-family: "Sora"; font-weight: 800; font-size: 1.1rem; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: var(--surface-2); color: var(--brand-2); }
.wc-theme { color: var(--faint); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.wc-check { margin-left: auto; color: var(--ok); font-weight: 800; }
.week-card h3 { font-size: 1.25rem; }
.wc-dose { color: var(--accent); font-size: .9rem; font-weight: 600; }
.wc-reward { color: var(--muted); font-size: .9rem; }

/* ---------- Week ---------- */
.back { color: var(--muted); font-weight: 600; display: inline-block; margin-bottom: 16px; }
.back:hover { color: var(--brand-2); }
.week-head { margin-bottom: 24px; }
.wh-kicker { color: var(--brand-2); font-weight: 700; font-size: .85rem; letter-spacing: .04em; text-transform: uppercase; }
.week-head h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 800; letter-spacing: -.02em; margin: .15em 0 .3em; }
.wh-why { color: var(--muted); max-width: 720px; font-size: 1.05rem; }

.week-cols { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; align-items: start; }
.col-main, .col-side { display: flex; flex-direction: column; gap: 20px; }
.col-side { position: sticky; top: 78px; }

.panel { padding: 22px; }
.panel h2 { font-size: 1.15rem; color: var(--text); display: flex; align-items: center; gap: 8px; }
.panel.pareto ul { margin: 0; padding-left: 20px; color: var(--muted); }
.panel.pareto li { margin-bottom: 8px; }
.panel.pareto li::marker { color: var(--brand-2); }

.theory h3 { font-size: 1.02rem; color: var(--brand-2); margin-top: 1.1em; }
.theory p { color: var(--muted); margin: .6em 0; }
.theory b { color: var(--text); }
.theory code { font-family: var(--mono); background: var(--surface-2); padding: 1px 6px; border-radius: 5px; font-size: .9em; }
.theory ul { color: var(--muted); padding-left: 20px; }
.theory li { margin-bottom: .5em; }
.note-expanded { color: var(--accent); font-size: .88rem; font-style: italic; border-top: 1px dashed var(--border); padding-top: .8em; }

/* charts */
.chart-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 10px; }
.chart-thumb { display: block; border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--border); background: #fff; aspect-ratio: 3/4; transition: transform .15s, border-color .2s; }
.chart-thumb:hover { transform: scale(1.03); border-color: var(--brand); }
.chart-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }

/* drills */
.drills { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.drill { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); cursor: pointer; transition: background .2s; }
.drill:hover { background: rgba(255,255,255,.1); }
.drill.checked { opacity: .6; }
.drill.checked .drill-text { text-decoration: line-through; }
.drill input { margin-top: 4px; accent-color: var(--brand); width: 17px; height: 17px; flex-shrink: 0; }
.drill-min { font-family: var(--mono); color: var(--accent); font-weight: 600; flex-shrink: 0; }
.drill-text { font-size: .92rem; color: var(--muted); }
.drill-tool { color: var(--brand-2); font-style: normal; font-weight: 600; }

/* check + reward */
.check p { color: var(--muted); }
.reward { border: 1px solid rgba(139,92,246,.35); background: linear-gradient(180deg, rgba(139,92,246,.1), var(--surface)); }
.reward-kicker { color: var(--brand-2); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; font-size: .85rem; }
.reward-why { color: var(--muted); }
.reward-rule { font-size: .88rem; color: var(--faint); border-top: 1px solid var(--border); padding-top: .8em; margin-top: .8em; }
.reward-video { font-size: .9rem; }

.week-nav { display: flex; justify-content: space-between; margin-top: 26px; }

/* ---------- Tools ---------- */
.tool-mount, .tool-slot { display: flex; flex-direction: column; gap: 14px; }
.tool { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 16px; }
.tool-head { font-family: "Sora"; font-weight: 700; font-size: .95rem; display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.tool-icon { color: var(--brand-2); }
.metro-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.metro-row .btn { flex: 1; min-width: 70px; padding: 8px 12px; }

/* metronome */
.metro-bpm { text-align: center; font-family: "Sora"; }
.bpm-val { font-size: 2.4rem; font-weight: 800; }
.bpm-unit { color: var(--muted); }
.bpm-range { width: 100%; accent-color: var(--brand); margin: 8px 0; }
.metro-sig { color: var(--muted); font-size: .85rem; display: flex; align-items: center; gap: 6px; }
.sig { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 4px 6px; }
.metro-dots { display: flex; gap: 8px; justify-content: center; margin-top: 14px; }
.metro-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); transition: transform .05s, background .05s; }
.metro-dot.on { background: var(--brand); transform: scale(1.4); box-shadow: 0 0 14px var(--brand); }

/* timer */
.timer-phase { color: var(--brand-2); font-weight: 600; font-size: .9rem; }
.timer-clock { font-family: "Sora"; font-size: 2.6rem; font-weight: 800; text-align: center; letter-spacing: .02em; }
.timer-bar { height: 6px; background: var(--surface-2); border-radius: 4px; overflow: hidden; margin: 8px 0; }
.timer-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), var(--accent)); transition: width 1s linear; }
.timer-steps { margin-top: 12px; display: flex; flex-direction: column; gap: 5px; }
.timer-step { font-size: .82rem; color: var(--faint); display: flex; gap: 8px; padding: 4px 8px; border-radius: 6px; }
.timer-step.active { color: var(--text); background: var(--surface-2); }
.timer-step.done { color: var(--ok); }
.timer-step.done::after { content: "✓"; margin-left: auto; }
.step-min { font-family: var(--mono); color: var(--accent); }

/* fretboard */
.fb-prompt { text-align: center; color: var(--muted); margin-bottom: 6px; }
.fb-target { color: var(--brand-2); font-size: 1.3rem; font-family: "Sora"; }
.fb-stats { text-align: center; color: var(--muted); font-size: .85rem; margin-bottom: 8px; }
.fb-board { overflow-x: auto; }
.fb-grid { display: grid; gap: 3px; min-width: 460px; }
.fb-nums { display: grid; gap: 3px; min-width: 460px; margin-top: 4px; }
.fb-nums span { text-align: center; font-size: .68rem; color: var(--faint); font-family: var(--mono); }
.fb-strlabel { display: grid; place-items: center; font-family: var(--mono); font-size: .75rem; color: var(--brand-2); }
.fb-cell { height: 30px; border: 1px solid var(--border); background: var(--surface-2); border-radius: 5px; cursor: pointer; padding: 0; transition: background .1s; }
.fb-cell.dim { opacity: .3; pointer-events: none; }
.fb-cell.marker { background: rgba(139,92,246,.14); }
.fb-cell:hover:not(.dim) { background: rgba(255,255,255,.14); }
.fb-cell.hit { background: var(--ok); border-color: var(--ok); }
.fb-cell.miss { background: var(--bad); border-color: var(--bad); }
.fb-cell.reveal { background: var(--brand); border-color: var(--brand); }

/* ear + quiz */
.ear-choices, .quiz-choices { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.ear-choices .btn, .quiz-choices .btn { flex: 1; min-width: 90px; }
.ear-feedback { text-align: center; font-weight: 600; min-height: 1.4em; }
.ear-feedback.ok { color: var(--ok); }
.ear-feedback.bad { color: var(--bad); }
.quiz-q { font-size: 1.02rem; margin-bottom: 4px; }
.quiz-q b { color: var(--brand-2); }

/* footer */
.footer { max-width: var(--maxw); margin: 0 auto; padding: 24px clamp(16px,4vw,40px); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--border); color: var(--muted); font-size: .85rem; }

/* responsive — practice happens phone-in-hand */
@media (max-width: 860px) {
  .week-cols { grid-template-columns: 1fr; }
  .col-side { position: static; }
}
@media (max-width: 520px) {
  .hero-stats { gap: 8px; }
  .stat { min-width: 90px; padding: 10px 14px; }
  .topnav { gap: 14px; font-size: .88rem; }
}

/* ============ POLISH PASS (ui-ux-pro-max) ============ */

/* tabular figures for all data readouts — no width jitter as digits change */
.timer-clock, .bpm-val, .fb-stats b, .ear-streak, .ear-best, .quiz-score, .quiz-total, .stat-n, .drill-min, .step-min {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* visible focus rings for keyboard nav (a11y: focus-states, High) */
a:focus-visible, .btn:focus-visible, .fb-cell:focus-visible, input:focus-visible, select:focus-visible, .week-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
.btn:focus:not(:focus-visible) { outline: none; }

/* press/active feedback (interaction: active-states) */
.btn:active { transform: translateY(0) scale(.97); }
.week-card:active { transform: translateY(-1px) scale(.995); }
.chart-thumb:active { transform: scale(.99); }

/* staggered card entrance — waves in on load (motion: stagger, back.out feel) */
@keyframes cardIn { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
.week-grid .week-card {
  animation: cardIn .42s cubic-bezier(.34, 1.56, .64, 1) backwards;
}
.week-grid .week-card:nth-child(1) { animation-delay: .03s; }
.week-grid .week-card:nth-child(2) { animation-delay: .07s; }
.week-grid .week-card:nth-child(3) { animation-delay: .11s; }
.week-grid .week-card:nth-child(4) { animation-delay: .15s; }
.week-grid .week-card:nth-child(5) { animation-delay: .19s; }
.week-grid .week-card:nth-child(6) { animation-delay: .23s; }
.week-grid .week-card:nth-child(7) { animation-delay: .27s; }
.week-grid .week-card:nth-child(8) { animation-delay: .31s; }
.week .panel { animation: cardIn .4s cubic-bezier(.34,1.56,.64,1) backwards; }

/* chart thumbnails — cleaner framing + hover lift + zoom cue */
.chart-thumb { position: relative; box-shadow: 0 2px 10px rgba(0,0,0,.25); }
.chart-thumb::after {
  content: "⤢"; position: absolute; top: 6px; right: 6px;
  width: 22px; height: 22px; display: grid; place-items: center;
  background: rgba(11,7,19,.72); color: #fff; border-radius: 6px;
  font-size: .8rem; opacity: 0; transition: opacity .2s;
}
.chart-thumb:hover { box-shadow: 0 8px 26px rgba(139,92,246,.3); }
.chart-thumb:hover::after { opacity: 1; }

/* week-card reward line: keep from clipping */
.wc-reward { margin-top: auto; }

/* hero stat cards — subtle inner glow to lift off glass */
.stat { transition: transform .15s, border-color .2s; }
.stat:hover { transform: translateY(-2px); border-color: var(--brand); }

/* smoother section rhythm on desktop */
@media (min-width: 861px) {
  .col-main, .col-side { gap: 22px; }
  .panel { padding: 26px; }
}

/* respect reduced-motion — kill all decorative/entrance motion (a11y: reduced-motion, High) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .aurora span { animation: none; }
  .week-grid .week-card, .week .panel { animation: none; }
}
