/* ========================================================================
   TrueVoice Atlas — Somatic Anatomy & Resonators (Spec 006 · Spec 011)
   Design System: Obsidian ground · Ember red · Sacred gold · Crisp bone air
   Typography: Oswald Display · Manrope Body and metadata (two fonts, as on 7d)
   ======================================================================== */

:root {
  --void: #08080a;
  --surface: #121013;
  --surface-2: #1a1619;
  --surface-3: #221c21;
  --line: rgba(245, 245, 242, 0.08);
  --line-strong: rgba(245, 245, 242, 0.16);
  --edge: #332a2e;
  --ember: #E60012;
  --ember-lit: #FF382E;
  --ember-deep: #7A0818;
  --ember-ghost: rgba(230, 0, 18, 0.14);
  --bone: #FFFFFF;
  --ash: #B4B4B0;
  --dim: #8A8A86;   /* 5.7:1 on black (spec 012 · FR-3, bug 027) */
  --gold: #C9A227;
  --gold-lit: #E5BA35;
  --sacred-glow: rgba(201, 162, 39, 0.28);
  --ok: #4E8C6A;
  /* names the anatomy plates (atlas-diagrams.js, copied from the atlas repo) draw with (bug 031) */
  --accent-lit: #FF2D2D;
  --fg-ash: var(--ash);
  --sacred-lit: var(--bone);

  --f-display: 'Oswald', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --f-body: 'Manrope', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* 4px scale */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;

  --rail: 290px;
  --head-h: 64px;
}

/* Reset & Base within atlas */
.atl-body {
  margin: 0;
  background: var(--void);
  color: var(--bone);
  font-family: var(--f-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.atl-body h1, .atl-body h2, .atl-body h3 {
  font-family: var(--f-display);
  font-weight: 700;
  text-transform: uppercase;
  color: #FFFFFF;
  line-height: 1.2;
  margin: 0;
  text-wrap: balance;
}

.atl-body p { margin: 0; }
/* :where() keeps this reset weaker than every button class below (bug 027). */
:where(.atl-body) button { font: inherit; color: inherit; background: none; border: none; padding: 0; cursor: pointer; }
.atl-body :focus-visible { outline: 2px solid var(--ember-lit); outline-offset: 2px; border-radius: 2px; }
#atl-pane:focus, #atl-pane:focus-visible { outline: none; }
.atl-body ::selection { background: var(--ember); color: #fff; }

.mono { font-family: var(--f-body); font-variant-numeric: tabular-nums; }
.eyebrow {
  font-family: var(--f-body);
  font-size: 10.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ash);
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: fixed; top: 8px; left: 8px; z-index: 70; transform: translateY(-200%);
  background: var(--ember); color: #fff; padding: 10px 16px; border-radius: 2px; font-weight: 600;
  text-decoration: none; transition: transform .2s ease;
}
.skip:focus { transform: none; }

/* ── Top Header ─────────────────────────────────────────────── */
.head {
  position: sticky; top: 0; z-index: 40;
  background: var(--glass-tint);
  backdrop-filter: var(--glass-filter);
  -webkit-backdrop-filter: var(--glass-filter);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.12), 0 12px 30px -4px rgba(0, 0, 0, 0.5);
  transition: background 240ms ease, box-shadow 240ms ease;
}
.head-in {
  display: flex; align-items: center; gap: var(--s4);
  padding: var(--s3) var(--s5); min-height: var(--head-h);
}
/* scoped to the header: the shared footer also has a .brand block (bug 027) */
.head .brand,
.head a.pg-logo {
  display: flex; align-items: baseline; gap: var(--s3); min-width: 0;
  text-decoration: none; color: inherit;
}
.brand-mark-icon { display: block; filter: drop-shadow(0 0 8px rgba(200, 16, 46, 0.4)); align-self: center; }
.brand-mark {
  font-family: var(--f-display); font-size: 20px; font-weight: 600; letter-spacing: .14em;
  color: var(--bone); white-space: nowrap;
}
.brand-sub { font-size: 11.5px; color: var(--dim); letter-spacing: .06em; white-space: nowrap; }
.head-tools { display: flex; align-items: center; gap: var(--s3); margin-left: auto; }

.search { position: relative; display: flex; align-items: center; }
.search input {
  font-family: var(--f-body); font-size: 13px; color: var(--bone);
  background: var(--surface); border: 1px solid var(--line); border-radius: 3px;
  min-height: 44px; padding: 8px 32px 8px 12px; width: 210px; transition: border-color .18s, width .2s, box-shadow .2s;
}
.search input::placeholder { color: var(--dim); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.search input:focus { border-color: var(--ember); outline: none; box-shadow: 0 0 12px var(--ember-ghost); width: 240px; }
.search kbd {
  position: absolute; right: 9px; font-family: var(--f-body); font-size: 10px;
  color: var(--dim); pointer-events: none; border: 1px solid var(--line); border-radius: 2px; padding: 1px 5px;
}
.search-clear {
  position: absolute; right: 6px; width: 22px; height: 22px; color: var(--ash);
  display: grid; place-items: center; font-size: 16px; line-height: 1; border-radius: 2px;
}
.search-clear:hover { color: var(--bone); background: var(--surface-2); }



.head-cabinet-btn {
  font-family: var(--f-body); font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ash); text-decoration: none; padding: 7px 12px; border: 1px solid var(--line);
  border-radius: 3px; transition: all .18s;
  min-height: 44px; display: inline-flex; align-items: center;
}
.head-cabinet-btn:hover { color: var(--bone); border-color: var(--line-strong); background: var(--surface); }

.atl-user-bar {
  display: flex; align-items: center; padding: 8px var(--s5);
  background: rgba(18, 16, 19, 0.4); border-bottom: 1px solid var(--line); font-size: 12px;
}

/* ── Weeks Bar (4-col Grid) ─────────────────────────────────── */
.weeks {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--line); background: var(--void);
}
.week {
  display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 12px 18px 14px;
  border-bottom: 2px solid transparent; background: transparent; transition: background .18s;
}
.week:hover { background: var(--surface); }
.week[aria-selected="true"] {
  background: var(--surface);
  border-bottom-color: var(--ember);
}
.week + .week { border-left: 1px solid var(--line); }
.week-n { font-family: var(--f-body); font-size: 10px; letter-spacing: .14em; color: var(--dim); }
.week-t {
  font-family: var(--f-display); font-size: 16px; font-weight: 500; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ash); transition: color .18s; line-height: 1.2;
}
.week[aria-selected="true"] .week-t { color: var(--bone); }
.week-bar { display: block; height: 2px; background: var(--line); margin-top: 3px; border-radius: 1px; overflow: hidden; }
.week-bar i { display: block; height: 100%; background: var(--ember-deep); transition: width .4s cubic-bezier(0.4, 0, 0.2, 1); }
.week[aria-selected="true"] .week-bar i { background: var(--ember); box-shadow: 0 0 6px var(--ember-lit); }

/* ── Shell: Rail + Pane ─────────────────────────────────────── */
.shell {
  display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); align-items: start; /* the lesson may not widen the page (spec 013 · NFR-1) */
  min-height: calc(100vh - var(--head-h) - 58px);
}
.rail {
  position: sticky; top: calc(var(--head-h) + 54px);
  max-height: calc(100vh - var(--head-h) - 54px); overflow-y: auto;
  border-right: 1px solid var(--line); background: rgba(8, 8, 10, 0.5);
}
.rail-note {
  padding: 14px 18px; border-bottom: 1px solid var(--line); font-size: 12.5px;
  color: var(--ash); line-height: 1.45;
}
.lesson-btn {
  display: flex; align-items: baseline; gap: 12px; width: 100%; text-align: left; padding: 13px 18px;
  border-bottom: 1px solid var(--line); border-left: 2px solid transparent;
  transition: background .15s, border-color .15s;
}
.lesson-btn:hover { background: var(--surface); }
.lesson-btn[aria-current="true"] {
  background: var(--surface-2); border-left-color: var(--ember);
}
.lesson-num {
  font-family: var(--f-body); font-size: 10.5px; color: var(--dim); padding-top: 2px;
  flex: none; width: 34px; letter-spacing: .06em;
}
.lesson-btn[aria-current="true"] .lesson-num { color: var(--ember-lit); font-weight: 600; }
.lesson-t { font-size: 13.5px; line-height: 1.45; color: var(--ash); flex: 1; }
.lesson-btn[aria-current="true"] .lesson-t { color: var(--bone); font-weight: 500; }
.lesson-btn.done .lesson-t { color: var(--ash); }
.tick { flex: none; width: 16px; color: var(--ember-lit); font-size: 12px; text-align: right; font-weight: 700; }

/* ── Main Content Pane ──────────────────────────────────────── */
.pane { padding: var(--s6) var(--s6) var(--s8); max-width: 820px; margin: 0 auto; width: 100%; box-sizing: border-box; }
.pane-head { display: flex; flex-direction: column; gap: var(--s3); }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.meta .eyebrow { color: var(--ember-lit); }
.dot { width: 3px; height: 3px; border-radius: 50%; background: var(--dim); }
h1.title { font-size: clamp(26px, 3.8vw, 38px); font-weight: 700; color: #FFFFFF; text-transform: uppercase; letter-spacing: .03em; }

.sense {
  border-left: 3px solid var(--ember); background: rgba(200, 16, 46, 0.06);
  padding: 16px 20px; font-family: var(--f-display); font-style: italic; font-weight: 300;
  font-size: clamp(17px, 2.2vw, 20px); line-height: 1.6; color: var(--bone); max-width: 100%;
  border-radius: 0 4px 4px 0; box-sizing: border-box;
}

.actions { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s4); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: 3px; border: 1px solid var(--line);
  font-family: var(--f-body); font-size: 13px; font-weight: 500; color: var(--ash);
  transition: border-color .18s, color .18s, background .18s, box-shadow .18s;
  text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--line-strong); color: var(--bone); background: var(--surface); }
.btn.primary { border-color: var(--ember-deep); color: var(--bone); background: rgba(200, 16, 46, 0.12); }
.btn.primary:hover { background: rgba(200, 16, 46, 0.22); border-color: var(--ember); }
.btn.primary[aria-pressed="true"] {
  background: var(--ember); border-color: var(--ember-lit); color: #fff;
  box-shadow: 0 0 14px var(--ember-ghost);
}

.section { margin-top: var(--s7); display: flex; flex-direction: column; gap: var(--s4); }
.rule { display: flex; align-items: center; gap: var(--s3); }
.rule::after { content: ''; height: 1px; flex: 1; background: var(--line); }
.rule .eyebrow { white-space: nowrap; color: var(--ember-lit); }
.rule .count { font-family: var(--f-body); font-size: 10px; color: var(--dim); }

.grid { display: grid; gap: 12px; }
@media (min-width: 860px) { .grid.two { grid-template-columns: 1fr 1fr; } }
.card {
  background: var(--glass-tint);
  backdrop-filter: var(--glass-filter);
  -webkit-backdrop-filter: var(--glass-filter);
  border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 4px;
  padding: 16px 18px; display: flex; flex-direction: column; gap: 8px;
  box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.1), 0 8px 24px rgba(0,0,0,0.35);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.2), 0 12px 32px rgba(0,0,0,0.45);
}
.card h3 { font-family: var(--f-display); font-size: 15px; font-weight: 700; color: #FFFFFF; letter-spacing: .04em; text-transform: uppercase; }
.card p { font-size: 13.5px; line-height: 1.7; color: var(--ash); }

.pain {
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--ember-deep);
  padding: 14px 18px; display: flex; flex-direction: column; gap: 6px; max-width: 100%; border-radius: 0 4px 4px 0;
  box-sizing: border-box;
}
.pain p { font-size: 13.5px; line-height: 1.68; color: var(--ash); }

/* ── Practice Step Cards ────────────────────────────────────── */
.step {
  background: var(--glass-tint);
  backdrop-filter: var(--glass-filter);
  -webkit-backdrop-filter: var(--glass-filter);
  border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 6px;
  display: flex; gap: 14px; align-items: flex-start; padding: 18px 20px;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease, transform .2s ease;
  box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.12), 0 8px 24px rgba(0,0,0,0.35);
}
.step:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: linear-gradient(180deg, rgba(28, 24, 30, 0.85) 0%, rgba(18, 16, 20, 0.75) 100%);
  box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.24), 0 14px 36px rgba(0, 0, 0, 0.5), 0 0 20px rgba(200, 16, 46, 0.12);
  transform: translateY(-1px);
}
.step.done, .step.is-done {
  border-color: rgba(230, 0, 18, 0.45);
  box-shadow: inset 0 1px 0 0 rgba(230, 0, 18, 0.25), 0 8px 24px rgba(0, 0, 0, 0.35);
}
.step-check {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; border: 1px solid var(--line-strong);
  color: var(--dim); font-size: 14px; background: transparent; cursor: pointer;
  transition: all .18s ease; margin-top: 2px;
}
.step-check:hover { border-color: var(--ember-lit); color: var(--bone); background: var(--surface-2); }
.step.done .step-check, .step.is-done .step-check {
  color: #fff; border-color: var(--ember); background: var(--ember);
  box-shadow: 0 0 10px var(--ember-ghost);
}
.step-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; flex: 1; padding: 0; }
.step-top { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); }
.step-name { font-family: var(--f-display); font-size: 18px; font-weight: 700; color: #FFFFFF; letter-spacing: .03em; text-transform: uppercase; }
.step-name strong { font-weight: 700; } /* bolder inside 700 would ask for 900, which Oswald does not have */
.step.done .step-name { color: var(--ash); }
.step-dur {
  flex: none; font-family: var(--f-body); font-size: 12px; color: var(--ash);
  border: 1px solid var(--line-strong); border-radius: 3px; padding: 2px 8px; letter-spacing: .02em;
}
.step-body p { font-size: 14px; line-height: 1.7; color: var(--ash); margin: 0; }

.atl-timer {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px;
  padding: 10px 14px; background: var(--glass-tint);
  backdrop-filter: var(--glass-filter);
  -webkit-backdrop-filter: var(--glass-filter);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
.atl-clock {
  font-family: var(--f-body); font-size: 18px; font-weight: 600; min-width: 58px; font-variant-numeric: tabular-nums;
  color: var(--bone); letter-spacing: 0.04em;
}
.atl-mini {
  min-height: 44px; padding: 6px 14px; font-family: var(--f-body); font-size: 11px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ash); border: 1px solid var(--line);
  border-radius: 3px; cursor: pointer; transition: all .18s;
}
.atl-mini:hover { color: var(--bone); border-color: var(--line-strong); background: var(--surface-3); }
.atl-keep { font-size: 12px; color: var(--dim); margin-top: 8px; }

/* ── Breath Pacer ───────────────────────────────────────────── */
.atl-pacer { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-top: 14px; padding: 20px 0 6px; }
.pacer-circle {
  width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid var(--ember);
  background: radial-gradient(circle, rgba(200, 16, 46, 0.35) 0%, rgba(200, 16, 46, 0.02) 70%);
  transition: transform 1.7s cubic-bezier(0.4, 0, 0.2, 1);
}
.pacer-circle.inhale { transform: scale(1.3); border-color: var(--ember-lit); background: radial-gradient(circle, rgba(255, 45, 45, 0.30) 0%, rgba(255, 45, 45, 0.02) 70%); }
.pacer-circle.hold { transform: scale(1.3); border-color: var(--bone); }
.pacer-circle.exhale { transform: scale(0.78); }
.pacer-counter { font-family: var(--f-display); font-variant-numeric: tabular-nums; font-size: 38px; font-weight: 300; line-height: 1; color: var(--bone); }
.pacer-phase-label { margin-top: 4px; font-family: var(--f-body); font-size: 11px; letter-spacing: .16em; color: var(--ash); }

/* ── Sound & Task ───────────────────────────────────────────── */
.atl-sound { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.atl-sound-word { font-family: var(--f-display); font-size: 28px; font-weight: 500; color: var(--ember-lit); margin-right: 6px; }
.hw {
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--ember);
  padding: 16px 20px; font-size: 14px; line-height: 1.75; color: var(--ash); max-width: 74ch; border-radius: 0 4px 4px 0;
}
.atl-note {
  width: 100%; min-height: 120px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 4px; padding: 12px 16px; font-family: var(--f-body); font-size: 13.5px;
  color: var(--bone); resize: vertical; box-sizing: border-box;
}
.atl-note:focus { border-color: var(--ember); outline: none; }

/* ── Schemas & Figures ──────────────────────────────────────── */
.schemas { display: flex; flex-wrap: wrap; gap: var(--s3); justify-content: center; }
figure.schema {
  margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 4px;
  padding: 20px 18px 14px; display: flex; flex-direction: column; align-items: center;
  justify-content: space-between; gap: 14px; flex: 1 1 320px; min-width: 0;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3); box-sizing: border-box;
}
figure.schema.wide { flex-basis: 100%; }
figure.schema svg { width: 100%; max-width: 540px; height: auto; display: block; }
figure.schema svg[hidden] { display: none; } /* the 2D plate while the 3D viewer shows (bug 031) */
figcaption {
  font-family: var(--f-body); font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--dim); text-align: center;
}

/* SVG Palette Hooks */
.e-s { stroke: var(--edge); } .e-f { fill: var(--surface); } .s2-f { fill: var(--surface-2); }
.r-s { stroke: var(--ember); } .r-f { fill: var(--ember-lit); } .rg-f { fill: var(--ember-ghost); }
.rd-s { stroke: var(--ember-deep); } .d-s { stroke: var(--line); } .d-f { fill: var(--dim); }
.t-f { fill: var(--bone); } .m-f { fill: var(--ash); } .g-s { stroke: var(--gold); } .g-f { fill: var(--gold); }

/* Seven Sounds Table */
.sounds { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.sounds th {
  text-align: left; font-family: var(--f-body); font-size: 10px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--dim); font-weight: 500; padding: 0 12px 10px 0;
}
.sounds td { padding: 10px 12px 10px 0; border-top: 1px solid var(--line); color: var(--ash); vertical-align: baseline; }
.sounds td:first-child { font-family: var(--f-display); font-style: italic; font-size: 19px; color: var(--ember-lit); white-space: nowrap; }
.sounds tr.soft td:first-child { color: var(--ash); }
.sound-play-btn {
  min-width: 44px; min-height: 44px; padding: 6px 12px; white-space: nowrap;
  font-family: var(--f-body); font-size: 12px; font-weight: 600; letter-spacing: .04em; color: var(--bone);
  border: 1px solid var(--line-strong); border-radius: 3px; cursor: pointer; transition: all .18s;
}
.sound-play-btn:hover { border-color: var(--ember); background: var(--ember-ghost); }
/* phones: each sound is a small card instead of a five-column row (bug 031) */
@media (max-width: 600px) {
  .sounds thead { display: none; }
  .sounds, .sounds tbody { display: block; }
  .sounds tr {
    display: grid; grid-template-columns: 64px 1fr auto; column-gap: 12px; row-gap: 2px; align-items: center;
    padding: 12px 0; border-top: 1px solid var(--line);
  }
  .sounds td { padding: 0; border: 0; }
  .sounds td:nth-child(1) { grid-column: 1; grid-row: 1 / span 3; align-self: start; }
  .sounds td:nth-child(2), .sounds td:nth-child(3), .sounds td:nth-child(4) { grid-column: 2; }
  .sounds td:nth-child(3) { font-size: 12px; color: var(--dim); }
  .sounds td:nth-child(5) { grid-column: 3; grid-row: 1 / span 3; }
}
.sounds td:nth-child(2) { color: var(--bone); }

/* ── 3D Somatic Anatomy Plate ───────────────────────────────── */
.atl-3d-mount {
  width: 100%; max-width: 100%; margin: 0 auto 16px; position: relative; box-sizing: border-box;
  background: rgba(14, 12, 15, 0.9); border: 1px solid var(--line);
  border-radius: 6px; padding: 16px; box-shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.9);
  backdrop-filter: var(--glass-filter); -webkit-backdrop-filter: var(--glass-filter);
}
.atl-3d-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; margin-bottom: 12px; flex-wrap: wrap;
}
.atl-3d-views { display: flex; gap: 6px; }
.atl-3d-view-btn {
  background: var(--surface); border: 1px solid var(--line); color: var(--ash);
  font-family: var(--f-body); font-size: 13px; min-height: 44px; padding: 4px 14px; border-radius: 3px;
  cursor: pointer; transition: all .18s ease;
}
.atl-3d-view-btn:hover { background: var(--surface-2); color: var(--bone); border-color: var(--line-strong); }
.atl-3d-view-btn.is-active {
  background: var(--ember-ghost); border-color: var(--ember);
  color: var(--bone); font-weight: 600;
}
.atl-3d-tools { display: flex; align-items: center; gap: 10px; }
.atl-3d-hint { font-size: 11px; color: var(--dim); letter-spacing: .04em; }
.atl-3d-toggle-btn {
  background: transparent; border: 1px solid var(--line); color: var(--ash);
  font-family: var(--f-body); font-size: 13px; min-height: 44px; padding: 4px 14px; border-radius: 3px;
  cursor: pointer; transition: all .18s;
}
.atl-3d-toggle-btn:hover { border-color: var(--line-strong); color: var(--bone); }

.atl-3d-stage {
  position: relative; width: 100%; border-radius: 4px; overflow: hidden;
  background: radial-gradient(circle at 50% 45%, #181418 0%, #08080a 100%);
  border: 1px solid var(--line); box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.7);
}
/* pan-y: a vertical swipe scrolls the page, a sideways drag turns the model (bug 027) */
.atl-3d-canvas { width: 100% !important; height: 100% !important; display: block; touch-action: pan-y; cursor: grab; }
.atl-3d-canvas:active { cursor: grabbing; }

.atl-3d-loading {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  justify-content: center; align-items: center; gap: 12px;
  background: rgba(8, 8, 10, 0.85); color: var(--ash); font-size: 13px; z-index: 5;
}
.atl-3d-spinner {
  width: 26px; height: 26px; border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--ember-lit); border-radius: 50%; animation: atlSpin .8s linear infinite;
}
@keyframes atlSpin { to { transform: rotate(360deg); } }

.atl-3d-card {
  margin-top: 14px; padding: 14px 16px; background: rgba(20, 18, 22, 0.7);
  border: 1px solid var(--line); border-radius: 4px;
}
.atl-3d-card-header {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; margin-bottom: 8px; flex-wrap: wrap;
}
.atl-3d-card-title { font-family: var(--f-display); font-size: 15px; font-weight: 600; color: var(--bone); letter-spacing: .06em; text-transform: uppercase; }
.atl-3d-sound-badge {
  font-family: var(--f-body); font-size: 11px; background: rgba(200, 16, 46, 0.15);
  color: var(--ember-lit); padding: 2px 8px; border-radius: 3px; border: 1px solid rgba(200, 16, 46, 0.3);
}
.atl-3d-sound-btn {
  font-family: var(--f-body); font-size: 13px; background: rgba(200, 16, 46, 0.15);
  color: var(--ember-lit); min-height: 44px; padding: 4px 14px; border-radius: 3px; border: 1px solid rgba(200, 16, 46, 0.35);
  cursor: pointer; transition: all .18s ease; display: inline-flex; align-items: center; gap: 4px;
}
.atl-3d-sound-btn:hover {
  background: var(--ember); color: #fff; border-color: var(--ember);
  box-shadow: 0 0 12px var(--ember-ghost);
}
.atl-3d-breath-btn {
  display: inline-flex; align-items: center; gap: 4px;
}
.atl-breath-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--ember-lit); margin-right: 4px; box-shadow: 0 0 6px var(--ember);
  animation: atlPulse 2s ease-in-out infinite;
}
@keyframes atlPulse {
  0%, 100% { opacity: 0.4; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.2); }
}
.atl-3d-card-fact { font-size: 13px; line-height: 1.6; color: var(--ash); margin-bottom: 8px; }
.atl-3d-card-note {
  font-size: 13px; line-height: 1.55; color: var(--ash); background: var(--surface-2);
  padding: 8px 12px; border-radius: 3px; border-left: 2px solid var(--line-strong);
}
.atl-3d-play-btn {
  margin-top: 10px; width: 100%; padding: 8px 12px; background: rgba(200, 16, 46, 0.15);
  border: 1px solid var(--ember); color: var(--bone); border-radius: 3px; font-size: 12px;
  cursor: pointer; transition: all .18s;
}
.atl-3d-play-btn:hover { background: var(--ember); color: #fff; }

.atl-3d-pills {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; justify-content: center;
}
.atl-3d-pill {
  font-family: var(--f-body); font-size: 12px; font-weight: 500; letter-spacing: .02em;
  min-height: 44px; padding: 5px 14px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--line); color: var(--ash); cursor: pointer; transition: all .18s ease;
}
.atl-3d-pill:hover {
  color: var(--bone); border-color: var(--line-strong); background: var(--surface-2);
}
.atl-3d-pill.is-active {
  background: rgba(200, 16, 46, 0.18); border-color: var(--ember); color: var(--bone);
  box-shadow: 0 0 10px var(--ember-ghost);
}

/* Custom sleek dark scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--void); }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--edge); }

/* Performance optimization: lazy rendering offscreen content */
.section {
  content-visibility: auto;
  contain-intrinsic-size: 1px 320px;
}

/* ── Pager Nav ──────────────────────────────────────────────── */
.pager {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  margin-top: var(--s7); padding-top: var(--s5); border-top: 1px solid var(--line);
}
.pager .btn:disabled { opacity: .35; cursor: default; }
.pager .btn:disabled:hover { border-color: var(--line); color: var(--ash); background: none; }
.pager-pos { font-family: var(--f-body); font-size: 11.5px; color: var(--dim); letter-spacing: .1em; white-space: nowrap; }

/* ── Search Results Overlay ─────────────────────────────────── */
.results { padding: var(--s5) var(--s6) var(--s8); max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; gap: var(--s2); }
.hit {
  display: block; width: 100%; text-align: left; background: var(--surface);
  border: 1px solid var(--line); border-radius: 3px; padding: 16px 18px; transition: border-color .18s;
}
.hit:hover { border-color: var(--line-strong); background: var(--surface-2); }
.hit-meta { display: block; font-family: var(--f-body); font-size: 10.5px; color: var(--ember-lit); letter-spacing: .1em; }
.hit-t { display: block; font-family: var(--f-display); font-size: 18px; color: var(--bone); margin-top: 6px; font-weight: 500; }
.hit-x { display: block; font-size: 13px; color: var(--ash); margin-top: 8px; line-height: 1.65; }
.hit mark { background: rgba(200, 16, 46, 0.35); color: #fff; padding: 1px 3px; border-radius: 2px; }
.empty {
  padding: var(--s7) var(--s6); text-align: center; display: flex; flex-direction: column;
  gap: 12px; align-items: center; color: var(--ash);
}
.empty h2 { font-size: 22px; color: var(--bone); }
.empty p { font-size: 13.5px; max-width: 48ch; line-height: 1.6; }

/* ── Mobile Lesson Picker ───────────────────────────────────── */
.picker {
  display: none; border-bottom: 1px solid var(--line); padding: 10px var(--s4);
  align-items: center; gap: 10px; background: var(--void); position: sticky;
  top: calc(var(--head-h) + 52px); z-index: 20;
}
.picker select {
  font-family: var(--f-body); font-size: 13px; color: var(--bone); background: var(--surface);
  border: 1px solid var(--line); border-radius: 3px; padding: 9px 12px; flex: 1; min-width: 0;
  min-height: 44px;
}

/* ── Video Embed ────────────────────────────────────────────── */
.atl-video-frame { position: relative; padding-top: 56.25%; background: #000; border-radius: 4px; overflow: hidden; }
.atl-video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ── Focus Mode Overlay ─────────────────────────────────────── */
.atl-focus {
  position: fixed; inset: 0; z-index: 60; overflow-y: auto;
  display: grid; place-items: center; padding: 24px 16px;
  background: rgba(6, 6, 7, 0.97); backdrop-filter: var(--glass-filter);
}
.atl-focus-in { max-width: 640px; width: 100%; }
.atl-focus-in p { font-size: 16px; line-height: 1.6; color: var(--ash); }
.atl-focus-clock { margin: 22px 0 6px; font-family: var(--f-display); font-variant-numeric: tabular-nums; font-weight: 300; font-size: clamp(64px, 18vw, 120px); line-height: 1; color: var(--bone); }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1080px) {
  :root { --rail: 250px; }
  .pane { padding: var(--s5) var(--s5) var(--s8); }
}

@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .picker { display: flex; }
  .weeks { grid-template-columns: repeat(2, 1fr); }
  .week:nth-child(3), .week:nth-child(4) { border-top: 1px solid var(--line); }
  .week:nth-child(odd) { border-left: none; }
  .head-in { flex-wrap: wrap; gap: 10px; padding: 10px var(--s4); }
  .brand-sub { display: none; }
  .head-tools { width: 100%; margin-left: 0; }
  .search { flex: 1; }
  .search input { width: 100% !important; }
  .pane { padding: var(--s5) var(--s4) var(--s8); }
  .results { padding: var(--s4) var(--s4) var(--s8); }
}

@media (max-width: 440px) {
  .step-body { padding: 10px 0; }
  .head-cabinet-btn { padding: 6px 8px; font-size: 10px; }
}

/* ── Unified Footer on Atlas ────────────────────────────────── */
.atl-body .pg-foot {
  max-width: 820px;
  margin: 56px auto 0;
  padding: 26px var(--s4) 48px;
  width: 100%;
  box-sizing: border-box;
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

@media print {
  .head, .weeks, .rail, .picker, .pager, .actions, .step-check, .head-tools { display: none !important; }
  body { background: #fff; color: #111; }
  .card, .step, .sense, .hw, .pain, figure.schema { background: #fff; border-color: #ccc; box-shadow: none; }
  .card p, .step-body p, .hw, .lesson-t { color: #333; }
  .pane { max-width: none; padding: 0; }
}

/* BodyParts3D licence credit under the 3D viewer (spec 011 · FR-11) */
.atl-3d-credit { margin: 10px 0 0; font-size: 12px; line-height: 1.5; color: var(--ash); text-align: center; }
.atl-3d-credit a { color: var(--ash); text-decoration: underline; }
.atl-3d-credit a:hover { color: var(--bone); }

/* ── Bug 027 · cabinet Atlas on phones ─────────────────────── */
.atl-3d-view-btn, .atl-3d-toggle-btn { min-width: 44px; }
@media (max-width: 820px) {
  /* the 3D plate uses the full width: no card-in-a-card padding */
  figure.schema:has(.atl-3d-mount) { padding: 0; background: none; border: 0; box-shadow: none; }
  .atl-3d-mount { padding: 12px 0 0; border: 0; background: none; box-shadow: none; backdrop-filter: var(--glass-filter); -webkit-backdrop-filter: var(--glass-filter); }
}
@media (max-width: 720px) {
  /* footer: one tidy column on phones */
  .atl-body .tv-footer-top { display: flex; flex-direction: column; gap: 18px; }
  .atl-body .tv-footer-top > * { width: 100%; max-width: none; }
}
/* the lesson's four actions fit one row on desktop (bug 027): tighter tracking than the site's buttons */
.actions .btn { letter-spacing: .06em; padding: 9px 14px; }

/* ── Spec 013 · Atlas interactive finish ───────────────────── */
.atl-done-sec { display: flex; justify-content: flex-start; }
.atl-saved { min-height: 18px; margin: 6px 0 0; font-size: 12px; color: var(--dim); }
.atl-focus-tools { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 8px; }
.atl-focus-pacer:empty { display: none; }
.atl-pacer-btn[aria-pressed="true"] { color: var(--bone); border-color: var(--ember); background: var(--ember-ghost); }
@media (max-width: 600px) {
  /* lesson head: two compact buttons in one row; printing is a desktop thing (FR-5) */
  .atl-actions { flex-wrap: nowrap; }
  .atl-actions .pg-btn { width: auto; flex: 1 1 0; min-height: 44px; padding: 8px 6px; font-size: 12px; letter-spacing: .02em; white-space: nowrap; }
  #atl-print { display: none; }
  /* step timer: one row from 320 px, words hidden, icons stay (FR-6) */
  .atl-step { padding: 16px; }
  .atl-step .atl-step-body { min-width: 0; }
  .atl-step .atl-timer { flex-wrap: nowrap; gap: 8px; padding: 8px 10px; margin-left: -58px; width: calc(100% + 58px); min-width: 0; box-sizing: border-box; }
  .atl-timer .atl-mini { min-width: 44px; padding: 6px 10px; }
  .atl-lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .atl-done-sec .pg-btn { width: 100%; }
  /* practice mode has room for the words */
  .atl-focus .atl-lbl { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  /* pager fits 320 px */
  .pager .btn { padding: 8px 10px; font-size: 12px; letter-spacing: .04em; }
}
