/* =========================================================
   Guitar & Music — "dusk workshop" theme
   Warm, analog, editorial. Ember on deep ink, soft grain.
   ========================================================= */

:root {
  /* surfaces */
  --ink:        #14100e;
  --ink-2:      #1b1512;
  --panel:      #201813;
  --panel-2:    #271d17;
  --raised:     #2f221b;
  --line:       #3a2a21;
  --line-soft:  #2c2019;

  /* text */
  --text:       #f1e7da;
  --text-2:     #c8b6a4;
  --muted:      #9c8978;
  --faint:      #6f5e50;

  /* accents */
  --ember:      #e8884a;   /* primary warm */
  --ember-soft: #f0a062;
  --ember-deep: #b95f2c;
  --sage:       #8db39b;   /* ambient / secondary */
  --sage-deep:  #5f8772;

  --shadow:     0 18px 50px -22px rgba(0,0,0,.8);
  --radius:     14px;
  --radius-sm:  9px;

  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans:  "Hanken Grotesk", ui-sans-serif, system-ui, sans-serif;
  --mono:  "Spline Sans Mono", ui-monospace, "SFMono-Regular", monospace;

  --sidebar-w: 270px;
}

* { box-sizing: border-box; }
/* Make the `hidden` attribute win over component display rules (.timer-pill, .mtr, …) */
[hidden] { display: none !important; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 78% -8%, rgba(232,136,74,.10), transparent 60%),
    radial-gradient(900px 600px at 0% 100%, rgba(141,179,155,.06), transparent 55%),
    var(--ink);
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---- atmosphere: grain + roaming glow ---- */
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  opacity: .045; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.glow {
  position: fixed; z-index: 0; pointer-events: none;
  top: -22vh; right: -10vw; width: 60vw; height: 60vw;
  background: radial-gradient(circle, rgba(232,136,74,.16), transparent 62%);
  filter: blur(18px);
  animation: drift 26s ease-in-out infinite alternate;
}
@keyframes drift {
  from { transform: translate3d(0,0,0) scale(1); }
  to   { transform: translate3d(-4vw, 5vh, 0) scale(1.12); }
}

/* =========================================================
   Sidebar
   ========================================================= */
.sidebar {
  position: sticky; top: 0; z-index: 6;
  height: 100vh;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--panel), var(--ink-2));
  border-right: 1px solid var(--line-soft);
  padding: 22px 14px 16px;
  overflow-y: auto;
}

.wordmark {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; color: var(--text);
  padding: 6px 8px 18px;
}
.wordmark-mark {
  font-size: 26px; color: var(--ember);
  text-shadow: 0 0 22px rgba(232,136,74,.5);
  animation: breathe 6s ease-in-out infinite;
}
@keyframes breathe { 0%,100%{opacity:.85} 50%{opacity:1} }
.wordmark-text { display: flex; flex-direction: column; line-height: 1.05; }
.wordmark-text strong { font-family: var(--serif); font-weight: 600; font-size: 19px; letter-spacing: .2px; }
.wordmark-text em {
  font-style: italic; font-family: var(--serif);
  color: var(--muted); font-size: 13px; margin-top: 2px;
}

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-group { margin-top: 16px; }
.nav-group-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .18em;
  color: var(--faint); padding: 0 10px 7px; font-weight: 600;
}
.nav-link {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); text-decoration: none;
  font-size: 14.5px; line-height: 1.2;
  border: 1px solid transparent;
  transition: background .16s ease, color .16s ease, border-color .16s ease, transform .16s ease;
}
.nav-link:hover { background: var(--panel-2); color: var(--text); transform: translateX(2px); }
.nav-link.active {
  background: linear-gradient(90deg, rgba(232,136,74,.16), rgba(232,136,74,.04));
  color: var(--text);
  border-color: rgba(232,136,74,.3);
}
.nav-link.active::before {
  content: ""; width: 3px; height: 16px; border-radius: 3px;
  background: var(--ember); box-shadow: 0 0 12px var(--ember);
  margin-left: -4px; margin-right: 4px;
}

.sidebar-tools { padding-bottom: 14px; border-bottom: 1px solid var(--line-soft); margin-bottom: 8px; }
.mtr-toggle {
  width: 100%; display: flex; align-items: center; gap: 10px;
  background: var(--panel-2); color: var(--text-2);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 12px; cursor: pointer; font-family: var(--sans); font-size: 14px;
  transition: border-color .16s, color .16s;
}
.mtr-toggle:hover { border-color: var(--ember); color: var(--text); }
.mtr-toggle-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--sage); box-shadow: 0 0 10px var(--sage); }
.mtr-toggle.ticking .mtr-toggle-dot { background: var(--ember); box-shadow: 0 0 12px var(--ember); animation: pulse .25s steps(2) infinite; }
.mtr-toggle-bpm { margin-left: auto; font-family: var(--mono); color: var(--muted); font-size: 13px; }
@keyframes pulse { 0%{opacity:1} 100%{opacity:.35} }

/* =========================================================
   Main column
   ========================================================= */
.main { position: relative; z-index: 2; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 28px;
  background: linear-gradient(180deg, rgba(20,16,14,.92), rgba(20,16,14,.66));
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.menu-btn { display: none; background: none; border: none; color: var(--text); font-size: 20px; cursor: pointer; }
.crumb { font-family: var(--serif); font-size: 16px; color: var(--text-2); flex: 1; min-width: 0; }
.crumb b { color: var(--ember-soft); font-weight: 600; }
.topbar-link {
  font-size: 13.5px; color: var(--muted); text-decoration: none;
  border: 1px solid var(--line); padding: 6px 12px; border-radius: 100px;
  transition: color .16s, border-color .16s;
}
.topbar-link:hover { color: var(--text); border-color: var(--ember); }

.content { padding: 40px 28px 120px; flex: 1; outline: none; }

/* =========================================================
   Document (rendered markdown)
   ========================================================= */
.doc { max-width: 760px; margin: 0 auto; animation: fadeUp .5s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.doc h1, .doc h2, .doc h3, .doc h4 { font-family: var(--serif); font-weight: 600; line-height: 1.12; color: var(--text); }
.doc h1 {
  font-size: clamp(30px, 4vw, 44px); font-weight: 900; margin: 0 0 .5em;
  letter-spacing: -.5px;
}
.doc h1::after {
  content: ""; display: block; width: 64px; height: 3px; margin-top: 18px;
  background: linear-gradient(90deg, var(--ember), transparent); border-radius: 3px;
}
.doc h2 { font-size: 25px; margin: 1.9em 0 .55em; padding-top: .3em; }
.doc h3 { font-size: 19px; margin: 1.5em 0 .5em; color: var(--ember-soft); }
.doc h4 { font-size: 16px; margin: 1.3em 0 .4em; color: var(--sage); }

.doc p, .doc li { font-size: 16px; line-height: 1.72; color: var(--text-2); }
.doc strong { color: var(--text); font-weight: 700; }
.doc em { color: var(--text); }

.doc a { color: var(--ember-soft); text-decoration: none; border-bottom: 1px solid rgba(240,160,98,.32); transition: border-color .15s, color .15s; }
.doc a:hover { color: #ffb878; border-bottom-color: var(--ember-soft); }
.doc a.ext::after { content: " ↗"; font-size: .85em; color: var(--muted); }

.doc ul, .doc ol { padding-left: 1.3em; }
.doc li { margin: .34em 0; }
.doc li::marker { color: var(--ember-deep); }

.doc blockquote {
  margin: 1.4em 0; padding: 4px 18px;
  border-left: 3px solid var(--ember); border-radius: 2px;
  background: linear-gradient(90deg, rgba(232,136,74,.07), transparent);
  color: var(--text-2);
}
.doc blockquote p { margin: .5em 0; }

.doc hr { border: none; height: 1px; margin: 2.4em 0; background: linear-gradient(90deg, transparent, var(--line), transparent); }

/* inline + block code (chord diagrams) */
.doc code { font-family: var(--mono); font-size: .9em; background: var(--raised); color: var(--ember-soft); padding: .12em .4em; border-radius: 5px; }
.doc pre {
  background: linear-gradient(180deg, var(--ink-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; overflow-x: auto; margin: 1.3em 0;
  box-shadow: inset 0 0 40px rgba(0,0,0,.3);
}
.doc pre code { background: none; color: var(--text); padding: 0; font-size: 13.5px; line-height: 1.6; }

/* tables */
.doc table { width: 100%; border-collapse: collapse; margin: 1.4em 0; font-size: 14.5px; }
.doc th, .doc td { text-align: left; padding: 10px 13px; border-bottom: 1px solid var(--line-soft); }
.doc thead th { color: var(--ember-soft); font-family: var(--sans); font-weight: 700; border-bottom: 1px solid var(--line); font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; }
.doc tbody tr:hover { background: rgba(232,136,74,.04); }
.doc td { color: var(--text-2); }

.doc img { max-width: 100%; border-radius: var(--radius); }
.doc table + p, .doc pre + p { margin-top: 1.2em; }

/* ---- chord / scale charts (rendered from ```chart blocks) ---- */
.chart-set { display: flex; flex-wrap: wrap; gap: 16px; margin: 1.6em 0; }
.chart {
  margin: 0; padding: 16px 20px 13px;
  background: linear-gradient(180deg, #f7f1e6, #efe7d8);
  color: #1c1711; border: 1px solid #e2d6c2; border-radius: 14px;
  box-shadow: 0 16px 34px -20px rgba(0,0,0,.75);
}
.chart-name { font-family: var(--serif); font-weight: 600; font-size: 17px; text-align: center; color: #1c1711; margin-bottom: 13px; }
.chart-rows { display: flex; flex-direction: column; gap: 6px; }
.chart-row { display: flex; align-items: center; gap: 12px; height: 30px; }
.chart-row .s { width: 13px; text-align: center; font-family: var(--mono); font-size: 11px; color: #8c7a63; }
.chart-row .frets { position: relative; display: flex; align-items: center; gap: 14px; flex: 1; }
.chart-row .frets::before { content: ""; position: absolute; left: 3px; right: 3px; top: 50%; height: 2px; background: #d8cab2; transform: translateY(-50%); }
.dot {
  position: relative; z-index: 1; width: 28px; height: 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 12.5px; font-weight: 600;
  background: #1c1711; color: #fff;
}
.dot.open { background: #f7f1e6; color: #1c1711; border: 2px solid #1c1711; box-sizing: border-box; }
.dot.mute { background: none; color: #b0a18b; font-weight: 400; font-size: 15px; }
.chart-cap { margin-top: 12px; font-family: var(--mono); font-size: 11.5px; color: #7c6e58; text-align: center; }

/* ---- interactive fretboard note quiz (```fretquiz) ---- */
.quiz { margin: 1.6em 0; padding: 18px; background: linear-gradient(180deg, var(--panel), var(--ink-2)); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.quiz-controls { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.quiz-strings { display: flex; flex-wrap: wrap; gap: 7px; }
.quiz-str { font-family: var(--sans); font-size: 12.5px; color: var(--text-2); background: var(--panel-2); border: 1px solid var(--line); border-radius: 100px; padding: 6px 12px; cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.quiz-str.on { background: rgba(232,136,74,.16); border-color: var(--ember); color: var(--text); }
.quiz-range { display: flex; gap: 6px; }
.quiz-range button { font-family: var(--mono); font-size: 12px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); border-radius: 7px; padding: 6px 10px; cursor: pointer; }
.quiz-range button.on { color: var(--text); border-color: var(--sage); }
.quiz-prompt { text-align: center; padding: 16px 0 18px; display: flex; flex-direction: column; gap: 3px; }
.quiz-prompt .qs { font-family: var(--serif); font-size: 25px; color: var(--text); }
.quiz-prompt .qf { font-family: var(--mono); font-size: 30px; color: var(--ember-soft); letter-spacing: .5px; }
.quiz-prompt .qh { font-size: 11px; text-transform: uppercase; letter-spacing: .2em; color: var(--faint); margin-top: 4px; }
.quiz-notes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.quiz-note { font-family: var(--mono); font-size: 13px; color: var(--text); background: var(--raised); border: 1px solid var(--line); border-radius: 9px; padding: 12px 4px; cursor: pointer; transition: transform .1s, background .15s, border-color .15s; }
.quiz-note .sl { color: var(--faint); }
.quiz-note:hover:not(:disabled) { border-color: var(--ember); transform: translateY(-1px); }
.quiz-note:disabled { cursor: default; opacity: .5; }
.quiz-note.right { background: var(--sage-deep); border-color: var(--sage); color: #0e1612; opacity: 1; }
.quiz-note.wrong { background: #7d2f2f; border-color: #b85c5c; color: #fff; opacity: 1; }
.quiz-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; }
.quiz-score { font-family: var(--mono); font-size: 13px; color: var(--text-2); }
.quiz-skip { font-family: var(--sans); font-size: 13px; color: var(--muted); background: none; border: 1px solid var(--line); border-radius: 8px; padding: 7px 14px; cursor: pointer; transition: color .15s, border-color .15s; }
.quiz-skip:hover { color: var(--text); border-color: var(--ember); }
@media (max-width: 560px) { .quiz-notes { grid-template-columns: repeat(4, 1fr); } }

/* ---- listening lab (real-time audio widgets) ---- */
.al { margin: 1.6em 0; padding: 18px; background: linear-gradient(180deg, var(--panel), var(--ink-2)); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); transition: border-color .2s; }
.al.in-tune, .al.hit, .al.done { border-color: var(--sage); }
.al-header { margin-bottom: 14px; }
.al-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.al-mic { font-family: var(--sans); font-weight: 600; font-size: 14px; color: #1c1209; background: var(--ember); border: none; border-radius: 9px; padding: 10px 16px; cursor: pointer; transition: filter .15s; }
.al-mic:hover { filter: brightness(1.08); }
.al-mic.on { background: var(--raised); color: var(--ember-soft); border: 1px solid var(--ember); }
.al-dev { flex: 1; min-width: 160px; background: var(--raised); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; font-family: var(--sans); font-size: 13px; }
.al-meter { height: 6px; background: var(--raised); border-radius: 4px; overflow: hidden; margin: 12px 0 8px; }
.al-meter-fill { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--sage), var(--ember)); transition: width .06s linear; }
.al-status { font-size: 12.5px; color: var(--muted); }

.al-bignote { font-family: var(--serif); font-weight: 900; font-size: 64px; text-align: center; line-height: 1; color: var(--text); margin: 8px 0 2px; }
.al.in-tune .al-bignote { color: var(--sage); }
.al-centtxt { text-align: center; font-family: var(--mono); font-size: 15px; color: var(--text-2); margin-bottom: 14px; }
.al-hz { text-align: center; font-family: var(--mono); font-size: 12px; color: var(--faint); margin-top: 10px; }

.al-cmeter { position: relative; height: 28px; margin: 6px 0; }
.al-cmeter::before { content: ""; position: absolute; left: 4px; right: 4px; top: 50%; height: 2px; background: var(--line); transform: translateY(-50%); }
.al-cmeter-line { position: absolute; left: 50%; top: 2px; bottom: 2px; width: 2px; background: var(--ember-soft); transform: translateX(-50%); opacity: .55; }
.al-cmeter-dot { position: absolute; top: 50%; left: 50%; width: 16px; height: 16px; border-radius: 50%; background: var(--ember); transform: translate(-50%, -50%); transition: left .07s linear, background .15s; }
.al-cmeter.ok .al-cmeter-dot { background: var(--sage); box-shadow: 0 0 12px var(--sage); }

.al-prompt { text-align: center; padding: 10px 0 16px; display: flex; flex-direction: column; gap: 3px; }
.al-prompt .qh { font-size: 11px; text-transform: uppercase; letter-spacing: .2em; color: var(--faint); }
.al-prompt .qs { font-family: var(--serif); font-weight: 700; font-size: 42px; color: var(--ember-soft); line-height: 1.05; }
.al-prompt .qf { font-family: var(--mono); font-size: 13px; color: var(--text-2); }
.al-playquiz.hit .al-prompt .qs { color: var(--sage); }

.al-scaletitle { text-align: center; font-family: var(--serif); font-size: 17px; color: var(--text); margin: 4px 0 14px; }
.al-seq { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 12px; }
.al-seqnote { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-family: var(--mono); font-size: 14px; background: var(--raised); border: 1px solid var(--line); color: var(--text-2); transition: all .15s; }
.al-seqnote.active { border-color: var(--ember); color: var(--ember-soft); box-shadow: 0 0 12px rgba(232,136,74,.4); transform: scale(1.1); }
.al-seqnote.done { background: var(--sage-deep); border-color: var(--sage); color: #0e1612; }

.al-vnotes { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 14px; }
.al-vnote { font-family: var(--mono); font-size: 13px; color: var(--text-2); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; cursor: pointer; transition: all .15s; }
.al-vnote.on { background: rgba(232,136,74,.16); border-color: var(--ember); color: var(--text); }
.al-vtarget { text-align: center; font-family: var(--serif); font-size: 26px; color: var(--text); margin-bottom: 10px; }
.al.in-tune .al-vtarget { color: var(--sage); }
.al-ref { display: block; margin: 0 auto 10px; font-family: var(--sans); font-size: 13px; color: var(--text-2); background: none; border: 1px solid var(--line); border-radius: 8px; padding: 8px 16px; cursor: pointer; }
.al-ref:hover { border-color: var(--ember); color: var(--text); }

/* =========================================================
   Home / "Today"
   ========================================================= */
.home { max-width: 880px; margin: 0 auto; }
.home-hero { animation: fadeUp .5s ease both; }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .22em; color: var(--ember); font-weight: 600; }
.home-hero h1 { font-family: var(--serif); font-weight: 900; font-size: clamp(34px, 5.5vw, 60px); letter-spacing: -1px; margin: .18em 0 .1em; line-height: 1.02; }
.home-hero h1 .glimmer { color: var(--ember); font-style: italic; font-weight: 500; }
.home-sub { font-size: 17px; color: var(--text-2); max-width: 56ch; line-height: 1.6; }

.focus-chip {
  display: inline-flex; align-items: center; gap: 12px;
  margin-top: 22px; padding: 11px 18px 11px 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 100px;
  box-shadow: var(--shadow);
}
.focus-chip .ic { font-size: 19px; }
.focus-chip .lab { font-size: 12px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
.focus-chip .val { font-family: var(--serif); font-weight: 600; color: var(--text); }

.section-label { font-size: 12px; text-transform: uppercase; letter-spacing: .2em; color: var(--faint); font-weight: 600; margin: 40px 0 14px; }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, var(--panel), var(--ink-2));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 18px 18px; display: flex; flex-direction: column;
  animation: fadeUp .5s ease both;
  transition: border-color .18s, transform .18s;
}
.card:hover { border-color: rgba(232,136,74,.4); transform: translateY(-3px); }
.card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: linear-gradient(90deg, var(--ember), transparent); opacity: .7; }
.card .card-ic { font-size: 22px; }
.card h3 { font-family: var(--serif); font-size: 20px; margin: 10px 0 2px; color: var(--text); }
.card .dur { font-family: var(--mono); font-size: 12px; color: var(--ember-soft); }
.card ul { list-style: none; padding: 0; margin: 14px 0 18px; flex: 1; }
.card li { font-size: 13.5px; color: var(--text-2); padding: 6px 0; border-bottom: 1px dashed var(--line-soft); display: flex; gap: 8px; }
.card li::before { content: "·"; color: var(--ember-deep); font-weight: 700; }
.card li:last-child { border-bottom: none; }

.start-btn {
  width: 100%; font-family: var(--sans); font-weight: 600; font-size: 14px;
  background: rgba(232,136,74,.12); color: var(--ember-soft);
  border: 1px solid rgba(232,136,74,.34); border-radius: var(--radius-sm);
  padding: 10px; cursor: pointer; transition: background .16s, color .16s;
}
.start-btn:hover { background: var(--ember); color: #1c1209; }

.quick-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.quick {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text-2);
  border-radius: 100px; padding: 9px 16px; text-decoration: none; font-size: 14px;
  transition: border-color .16s, color .16s, background .16s;
}
.quick:hover { border-color: var(--ember); color: var(--text); }
.quick.primary { background: var(--sage-deep); border-color: var(--sage); color: #0e1612; font-weight: 600; }
.quick.primary:hover { background: var(--sage); }

.home-foot { margin-top: 46px; padding-top: 22px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 14px; font-style: italic; font-family: var(--serif); }

/* =========================================================
   Metronome panel
   ========================================================= */
.mtr {
  position: fixed; right: 22px; bottom: 22px; z-index: 30; width: 290px;
  background: linear-gradient(180deg, var(--panel-2), var(--ink-2));
  border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow); padding: 18px;
  animation: fadeUp .28s ease both;
}
.mtr-head { display: flex; align-items: center; justify-content: space-between; }
.mtr-head h2 { font-family: var(--serif); font-size: 18px; margin: 0; }
.icon-btn { background: var(--raised); border: 1px solid var(--line); color: var(--text-2); border-radius: 8px; width: 30px; height: 30px; cursor: pointer; font-size: 15px; line-height: 1; transition: color .15s, border-color .15s; }
.icon-btn:hover { color: var(--text); border-color: var(--ember); }
.icon-btn.big { width: 42px; height: 42px; font-size: 22px; }

.mtr-readout { text-align: center; margin: 10px 0 4px; }
.mtr-bpm { font-family: var(--mono); font-size: 50px; color: var(--text); letter-spacing: -1px; }
.mtr-unit { font-size: 13px; color: var(--muted); margin-left: 4px; }

.mtr-beats { display: flex; justify-content: center; gap: 9px; margin: 12px 0 16px; min-height: 16px; }
.beat-dot { width: 13px; height: 13px; border-radius: 50%; background: var(--raised); border: 1px solid var(--line); transition: transform .05s; }
.beat-dot.on { background: var(--ember-soft); box-shadow: 0 0 14px var(--ember); transform: scale(1.4); }
.beat-dot.accent.on { background: var(--sage); box-shadow: 0 0 14px var(--sage); }

#bpmRange { width: 100%; accent-color: var(--ember); margin: 4px 0 14px; }
.mtr-row { display: flex; align-items: center; gap: 10px; }
.mtr-row + .mtr-row { margin-top: 12px; }
.mtr-row.spread { justify-content: space-between; }
.play-btn { flex: 1; font-family: var(--sans); font-weight: 700; font-size: 15px; background: var(--ember); color: #1c1209; border: none; border-radius: 10px; padding: 12px; cursor: pointer; transition: filter .15s; }
.play-btn:hover { filter: brightness(1.08); }
.play-btn.on { background: var(--raised); color: var(--ember-soft); border: 1px solid var(--ember); }
.ghost-btn { background: none; border: 1px solid var(--line); color: var(--text-2); border-radius: 8px; padding: 9px 14px; cursor: pointer; font-family: var(--sans); font-size: 13.5px; transition: border-color .15s, color .15s; }
.ghost-btn:hover, .ghost-btn:active { border-color: var(--ember); color: var(--text); }
.sig { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 8px; }
.sig select { background: var(--raised); color: var(--text); border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px; font-family: var(--mono); }
.mtr-hint { font-size: 12px; color: var(--faint); margin: 14px 0 0; text-align: center; font-style: italic; }

/* =========================================================
   Session timer pill
   ========================================================= */
.timer-pill {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 28;
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(180deg, var(--panel-2), var(--ink-2));
  border: 1px solid var(--line); border-radius: 100px;
  padding: 9px 12px 9px 20px; box-shadow: var(--shadow);
  animation: fadeUp .28s ease both;
}
.timer-label { font-size: 13px; color: var(--muted); }
.timer-time { font-family: var(--mono); font-size: 22px; color: var(--text); letter-spacing: .5px; }
.timer-pill.done .timer-time { color: var(--sage); }

/* =========================================================
   Error / loading states
   ========================================================= */
.skeleton { max-width: 760px; margin: 0 auto; }
.skeleton .bar { height: 18px; border-radius: 6px; background: linear-gradient(90deg, var(--panel), var(--panel-2), var(--panel)); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; margin: 14px 0; }
.skeleton .bar.w1 { width: 50%; height: 38px; } .skeleton .bar.w2 { width: 86%; } .skeleton .bar.w3 { width: 72%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.errbox { max-width: 620px; margin: 8vh auto 0; text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 34px; }
.errbox h2 { font-family: var(--serif); color: var(--ember-soft); margin-top: 0; }
.errbox code { font-family: var(--mono); background: var(--ink-2); color: var(--ember-soft); padding: 3px 7px; border-radius: 6px; }
.errbox p { color: var(--text-2); line-height: 1.7; }

.scrim { position: fixed; inset: 0; z-index: 4; background: rgba(0,0,0,.5); }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 860px) {
  body { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; width: 280px; max-width: 84vw;
    transform: translateX(-102%); transition: transform .26s ease; box-shadow: var(--shadow);
  }
  body.nav-open .sidebar { transform: none; }
  .menu-btn { display: block; }
  .cards { grid-template-columns: 1fr; }
  .content { padding: 26px 18px 120px; }
  .topbar { padding: 12px 16px; }
}
@media (min-width: 861px) { .scrim { display: none !important; } }

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