/* Design V4 — editorial music learning interface */

:root{
  --bg:#f5f2ec;
  --panel:#fffdf8;
  --panel-strong:#ffffff;
  --panel-soft:#eee9e0;
  --text:#1d1b18;
  --muted:#716b63;
  --border:#d9d2c8;
  --accent:#5156d8;
  --accent-strong:#3f43b8;
  --accent-soft:#ececff;
  --accent-warm:#d98b2b;
  --accent-warm-soft:#fff0d8;
  --good:#217a4b;
  --good-soft:#e8f5ed;
  --warn:#9a5b16;
  --danger:#a23a33;
  --shadow:0 18px 46px rgba(40,34,28,.08);
  --shadow-soft:0 8px 24px rgba(40,34,28,.05);
  --radius:22px;
  --radius-sm:13px;
  --sidebar:268px;
  --reading:760px;
}

body{
  background:
    radial-gradient(circle at 78% -10%, rgba(81,86,216,.08), transparent 26rem),
    radial-gradient(circle at -10% 45%, rgba(217,139,43,.06), transparent 23rem),
    var(--bg);
  color:var(--text);
}

h1,h2,h3{letter-spacing:-.025em}
h1{font-weight:760}
h2{font-weight:730}
p{line-height:1.7}

.sidebar{
  background:#181715;
  border-right:1px solid rgba(255,255,255,.06);
}
.brand-mark{
  background:linear-gradient(145deg,#676cf1,#b77ae5);
  box-shadow:0 8px 24px rgba(81,86,216,.32);
}
.level-summary{
  background:rgba(255,255,255,.045);
  border-color:rgba(255,255,255,.07);
}
.level-btn{
  border-radius:14px;
  padding:9px 10px;
}
.level-btn:hover,.level-btn.active{
  background:rgba(255,255,255,.07);
}
.level-btn.active{
  box-shadow:inset 3px 0 0 #8a8df5;
}
.level-btn.active .level-num{
  background:#6267e5;
}
.main{
  max-width:1540px;
  margin:0 auto;
  width:100%;
}
.topbar{
  padding-top:4px;
}
.topbar h1{
  font-size:clamp(27px,3vw,42px);
}
.top-stats div{
  border:0;
  background:rgba(255,253,248,.72);
  box-shadow:var(--shadow-soft);
}
.tabs{
  gap:4px;
  padding:6px;
  width:max-content;
  max-width:100%;
  border:1px solid rgba(217,210,200,.8);
  border-radius:16px;
  background:rgba(255,253,248,.72);
  box-shadow:var(--shadow-soft);
}
.tab-btn{
  border:0;
  background:transparent;
  padding:9px 13px;
  border-radius:11px;
}
.tab-btn.active{
  background:#1f1d1a;
  color:#fff;
}

.lesson-card,.mini-map,.tool-card,.theory-card,.theory-nav,.progress-hero,.practice-log,
.project-video-card,.project-roadmap-card,.project-drills-card,.score-import-card,.project-notes-card,
.reference-hero{
  border-color:rgba(217,210,200,.82);
  background:rgba(255,253,248,.9);
  box-shadow:var(--shadow-soft);
}
.lesson-card{
  padding:28px;
  box-shadow:var(--shadow);
}
.lesson-goal{
  font-size:17px;
  line-height:1.55;
}
.lesson-body{
  margin-top:28px;
  gap:0;
}
.lesson-block{
  position:relative;
  padding:18px 18px 18px 24px;
  border:0;
  border-left:1px solid var(--border);
  border-radius:0;
  background:transparent;
}
.lesson-block::before{
  content:"";
  position:absolute;
  left:-5px;
  top:24px;
  width:9px;
  height:9px;
  border-radius:50%;
  background:var(--accent);
  box-shadow:0 0 0 5px var(--accent-soft);
}
.lesson-block h3{margin-bottom:8px}
.lesson-block p{max-width:72ch}
.callout{
  border-left:0;
  padding:13px 15px;
  background:var(--accent-warm-soft);
  color:#5b431f;
}
.pill{
  background:var(--accent-soft);
  color:var(--accent-strong);
}
.primary-btn{
  background:var(--accent);
  border-color:var(--accent);
  box-shadow:0 8px 18px rgba(81,86,216,.18);
}
.primary-btn:hover{background:var(--accent-strong)}
.secondary-btn{
  background:rgba(255,255,255,.75);
}
.mini-map{
  background:rgba(255,253,248,.72);
}
.lesson-item.active{
  background:#fff;
  border-color:rgba(81,86,216,.22);
}

.tool-grid{gap:16px}
.tool-card{
  border:0;
  box-shadow:var(--shadow-soft);
}
.result-box,.note-readout,.sequence-target{
  border:0;
}
.piano{
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.04),0 12px 34px rgba(15,23,42,.14);
}
.piano-key.white{
  background:linear-gradient(#fff,#f6f3ed);
}
.piano-key.black{
  background:linear-gradient(#1f1f22,#0c0c0d);
}
.piano-key.target{
  background:#e3e5ff!important;
  box-shadow:inset 0 0 0 3px rgba(81,86,216,.20);
}
.piano-key.active{
  background:#8f96ff!important;
  color:#17191d!important;
  transform:translateY(2px);
  box-shadow:inset 0 0 0 3px rgba(81,86,216,.38);
}
.piano-key.coach-target{
  background:#b7e9c8!important;
}
.piano-key.demo-active{
  background:#ffd77b!important;
}

/* Theory Atlas */
#view-theory{
  min-height:70vh;
}
.atlas-shell{
  display:grid;
  grid-template-columns:280px minmax(0,1fr);
  gap:20px;
  align-items:start;
}
.atlas-index{
  position:sticky;
  top:112px;
  max-height:calc(100vh - 132px);
  overflow:auto;
  padding:16px;
  border-radius:20px;
  background:rgba(29,27,24,.96);
  color:#fff;
  box-shadow:0 20px 44px rgba(29,27,24,.16);
}
.atlas-index-head{
  padding:6px 6px 14px;
  border-bottom:1px solid rgba(255,255,255,.09);
}
.atlas-index-head .eyebrow{color:#a9a4ff}
.atlas-index-head h2{
  margin:0 0 7px;
  font-size:20px;
}
.atlas-index-head p{
  margin:0;
  color:#aaa39a;
  font-size:12px;
  line-height:1.5;
}
.atlas-search{
  display:block;
  padding:14px 5px 10px;
  font-size:10px;
  text-transform:uppercase;
  letter-spacing:.09em;
  color:#9f998f;
  font-weight:800;
}
.atlas-search input{
  width:100%;
  min-height:42px;
  margin-top:6px;
  padding:9px 11px;
  border:1px solid rgba(255,255,255,.1);
  border-radius:11px;
  background:rgba(255,255,255,.06);
  color:#fff;
  outline:none;
  text-transform:none;
  letter-spacing:0;
}
.atlas-search input:focus{
  border-color:#787df0;
  box-shadow:0 0 0 3px rgba(120,125,240,.15);
}
#atlasNav{
  display:grid;
  gap:4px;
}
.atlas-nav-item{
  width:100%;
  display:grid;
  grid-template-columns:30px minmax(0,1fr);
  gap:8px;
  align-items:center;
  padding:9px 8px;
  border:0;
  border-radius:11px;
  background:transparent;
  color:#cfc9c1;
  text-align:left;
}
.atlas-nav-item:hover{
  background:rgba(255,255,255,.055);
}
.atlas-nav-item.active{
  background:#fff;
  color:#1d1b18;
}
.atlas-nav-num{
  display:grid;
  place-items:center;
  width:28px;
  height:28px;
  border-radius:9px;
  background:rgba(255,255,255,.07);
  font-size:10px;
  font-weight:900;
}
.atlas-nav-item.active .atlas-nav-num{
  background:var(--accent-soft);
  color:var(--accent-strong);
}
.atlas-nav-item small{
  display:block;
  color:#888279;
  font-size:8px;
  text-transform:uppercase;
  letter-spacing:.08em;
}
.atlas-nav-item.active small{color:#7f7ac8}
.atlas-nav-item strong{
  display:block;
  font-size:12px;
  margin-top:1px;
  line-height:1.3;
}
.atlas-empty{
  color:#aaa39a;
  font-size:12px;
  padding:10px;
}

.atlas-article{
  min-width:0;
}
.atlas-hero{
  display:grid;
  grid-template-columns:minmax(0,1.4fr) minmax(260px,.6fr);
  gap:24px;
  padding:34px;
  border-radius:28px;
  background:
    linear-gradient(135deg,rgba(255,253,248,.98),rgba(246,244,255,.96)),
    var(--panel);
  border:1px solid rgba(217,210,200,.75);
  box-shadow:var(--shadow);
}
.atlas-meta{
  display:flex;
  gap:7px;
  flex-wrap:wrap;
  margin-bottom:14px;
}
.atlas-meta span{
  padding:5px 8px;
  border-radius:999px;
  background:#fff;
  border:1px solid var(--border);
  color:var(--muted);
  font-size:10px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.08em;
}
.atlas-hero h1{
  max-width:760px;
  margin:0 0 12px;
  font-family:ui-serif,Georgia,Cambria,"Times New Roman",serif;
  font-size:clamp(32px,4.7vw,58px);
  font-weight:650;
  line-height:1.02;
  letter-spacing:-.045em;
}
.atlas-hero-main>p{
  max-width:680px;
  margin:0;
  color:var(--muted);
  font-size:17px;
}
.atlas-goals{
  align-self:end;
  padding:16px;
  border-radius:18px;
  background:rgba(29,27,24,.96);
  color:#fff;
}
.atlas-goals>span{
  display:block;
  margin-bottom:10px;
  color:#9d978f;
  font-size:9px;
  text-transform:uppercase;
  letter-spacing:.09em;
  font-weight:900;
}
.atlas-goals div{
  display:grid;
  grid-template-columns:20px 1fr;
  gap:7px;
  align-items:start;
  margin:7px 0;
  font-size:12px;
}
.atlas-goals i{
  display:grid;
  place-items:center;
  width:18px;
  height:18px;
  border-radius:50%;
  background:rgba(120,125,240,.2);
  color:#aeb1ff;
  font-style:normal;
}

.atlas-visual-panel{
  margin-top:18px;
  overflow:hidden;
  border-radius:26px;
  border:1px solid rgba(217,210,200,.78);
  background:var(--panel);
  box-shadow:var(--shadow-soft);
}
.atlas-visual-head{
  display:flex;
  justify-content:space-between;
  gap:16px;
  align-items:end;
  padding:18px 22px 13px;
  border-bottom:1px solid var(--border);
}
.atlas-visual-head span{
  display:block;
  color:var(--accent-strong);
  text-transform:uppercase;
  letter-spacing:.08em;
  font-size:9px;
  font-weight:900;
}
.atlas-visual-head strong{
  display:block;
  margin-top:2px;
  font-size:17px;
}
.atlas-visual-head small{color:var(--muted)}
.atlas-visual{
  min-height:320px;
  padding:24px;
  background:
    linear-gradient(rgba(81,86,216,.025) 1px,transparent 1px),
    linear-gradient(90deg,rgba(81,86,216,.025) 1px,transparent 1px),
    #fcfaf5;
  background-size:22px 22px;
}
.visual-caption{
  color:var(--muted);
  font-size:12px;
  text-align:center;
  margin:0 0 16px;
}
.visual-controls{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:end;
  justify-content:center;
  margin:12px 0 18px;
}
.visual-controls label,.interval-controls label{
  font-size:10px;
  text-transform:uppercase;
  letter-spacing:.08em;
  color:var(--muted);
  font-weight:800;
}
.visual-controls label>span,.interval-controls label>span{display:block;margin-bottom:4px}
.visual-controls select,.interval-controls select{
  min-width:130px;
}

.atlas-reading-layout{
  display:grid;
  grid-template-columns:minmax(0,var(--reading)) minmax(220px,280px);
  gap:36px;
  justify-content:center;
  align-items:start;
  margin:34px auto 0;
}
.atlas-reading{
  min-width:0;
}
.atlas-section{
  display:grid;
  grid-template-columns:42px minmax(0,1fr);
  gap:16px;
  padding:0 0 34px;
}
.atlas-section+.atlas-section{
  padding-top:6px;
}
.atlas-section-number{
  position:sticky;
  top:120px;
  align-self:start;
  width:36px;
  height:36px;
  display:grid;
  place-items:center;
  border-radius:11px;
  background:var(--accent-soft);
  color:var(--accent-strong);
  font-size:10px;
  font-weight:900;
}
.atlas-section h2{
  margin:0 0 12px;
  font-family:ui-serif,Georgia,Cambria,"Times New Roman",serif;
  font-size:clamp(24px,3vw,34px);
  font-weight:650;
}
.atlas-section p{
  margin:0 0 14px;
  font-size:16px;
  line-height:1.78;
}
.atlas-callout{
  margin-top:16px;
  padding:14px 16px;
  border-left:4px solid var(--accent-warm);
  border-radius:0 13px 13px 0;
  background:var(--accent-warm-soft);
  color:#5c4627;
}
.atlas-confusions{
  position:sticky;
  top:118px;
  padding:15px;
  border-radius:18px;
  background:rgba(255,253,248,.85);
  border:1px solid var(--border);
  box-shadow:var(--shadow-soft);
}
.atlas-confusions>span{
  display:block;
  margin-bottom:8px;
  font-size:9px;
  text-transform:uppercase;
  letter-spacing:.09em;
  font-weight:900;
  color:var(--muted);
}
.atlas-confusions details{
  border-top:1px solid var(--border);
}
.atlas-confusions summary{
  padding:11px 0;
  cursor:pointer;
  font-size:12px;
  font-weight:800;
}
.atlas-confusions p{
  margin:-3px 0 12px;
  color:var(--muted);
  font-size:12px;
  line-height:1.55;
}
.atlas-selfcheck{
  display:flex;
  justify-content:space-between;
  gap:18px;
  align-items:center;
  margin:4px 0 30px;
  padding:22px;
  border-radius:20px;
  background:#1f1d1a;
  color:#fff;
}
.atlas-selfcheck .eyebrow{color:#a6a9ff}
.atlas-selfcheck h2{margin-bottom:7px}
.atlas-selfcheck p{max-width:720px;margin:0;color:#c8c1b7;font-size:13px}
.atlas-selfcheck .secondary-btn{flex:0 0 auto}

/* Atlas visual components */
.wave-stage{
  position:relative;
  max-width:760px;
  margin:0 auto;
  border-radius:18px;
  background:#1d1b18;
  overflow:hidden;
}
.wave-stage svg{display:block;width:100%;height:auto}
.wave-stage path{
  fill:none;
  stroke:#8e93ff;
  stroke-width:4;
  filter:drop-shadow(0 0 10px rgba(142,147,255,.55));
}
.wave-badge{
  position:absolute;
  top:14px;
  right:14px;
  padding:8px 10px;
  border-radius:10px;
  background:rgba(255,255,255,.08);
  color:#fff;
  backdrop-filter:blur(10px);
}
.wave-badge span{display:block;font-weight:900}
.wave-badge small{color:#aaa4a0}
.frequency-relations{
  display:flex;
  justify-content:center;
  gap:12px;
  align-items:center;
  margin-top:14px;
}
.frequency-relations span{
  min-width:100px;
  padding:10px;
  border-radius:12px;
  background:#fff;
  border:1px solid var(--border);
  text-align:center;
}
.frequency-relations strong,.frequency-relations small{display:block}
.frequency-relations small{color:var(--muted)}

.atlas-keyboard{
  position:relative;
  display:flex;
  max-width:820px;
  height:210px;
  margin:0 auto;
  border:8px solid #1f1d1a;
  border-radius:17px;
  overflow:hidden;
  background:#1f1d1a;
}
.ak-white,.ak-black{
  border:1px solid #c9c2b9;
  cursor:pointer;
}
.ak-white{
  flex:1;
  display:flex;
  justify-content:center;
  align-items:flex-end;
  padding:0 2px 12px;
  border-radius:0 0 7px 7px;
  background:linear-gradient(#fff,#f0ece4);
  color:#514c45;
  font-size:10px;
  font-weight:900;
}
.ak-black{
  position:absolute;
  top:0;
  z-index:2;
  width:6.3%;
  height:62%;
  border-color:#050505;
  border-radius:0 0 6px 6px;
  background:linear-gradient(#222,#080808);
}
.ak-white.active{background:#cfd2ff}
.ak-black.active{background:#777cf1}
.ak-white:active,.ak-black:active{transform:translateY(2px)}
.naming-row{
  display:grid;
  grid-template-columns:repeat(7,1fr);
  max-width:820px;
  margin:10px auto 0;
  gap:5px;
}
.naming-row span{
  padding:6px;
  border-radius:9px;
  background:#fff;
  border:1px solid var(--border);
  text-align:center;
  font-size:10px;
}
.naming-row b{display:block;color:var(--accent-strong);font-size:13px}
.enharmonic-demo{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
  justify-content:center;
  margin-top:14px;
  color:var(--muted);
  font-size:12px;
}
.enharmonic-demo button{
  padding:7px 10px;
  border:1px solid var(--border);
  border-radius:9px;
  background:#fff;
  font-weight:800;
}

.interval-controls{
  display:flex;
  gap:10px;
  justify-content:center;
  margin-bottom:14px;
}
.interval-result{
  display:grid;
  grid-template-columns:140px 1fr;
  gap:8px;
  max-width:560px;
  margin:0 auto 14px;
}
.interval-result>div:not(.interval-ruler){
  padding:10px;
  border-radius:12px;
  background:#fff;
  border:1px solid var(--border);
}
.interval-result strong,.interval-result span{display:block}
.interval-result strong{font-size:18px}
.interval-result span{font-size:10px;color:var(--muted)}
.interval-ruler{
  grid-column:1/-1;
  display:flex;
  gap:4px;
}
.interval-ruler i{
  flex:1;
  height:9px;
  border-radius:999px;
  background:#ddd7ce;
}
.interval-ruler i.on{background:var(--accent)}

.scale-formula{
  display:flex;
  justify-content:center;
  gap:5px;
  margin-bottom:12px;
}
.scale-formula span{
  width:40px;
  height:40px;
  display:grid;
  place-items:center;
  border-radius:11px;
  background:#1f1d1a;
  color:#fff;
  font-weight:900;
}
.scale-formula span:nth-child(3),.scale-formula span:nth-child(7){
  background:var(--accent-warm);
}
.scale-degrees{
  display:grid;
  grid-template-columns:repeat(7,1fr);
  max-width:820px;
  margin:10px auto 0;
  gap:5px;
}
.scale-degrees span{
  padding:7px;
  border-radius:10px;
  text-align:center;
  background:#fff;
  border:1px solid var(--border);
}
.scale-degrees small,.scale-degrees strong{display:block}
.scale-degrees small{color:var(--muted)}

.rhythm-tree{
  max-width:760px;
  margin:0 auto;
}
.rhythm-branch{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:8px;
  margin-top:8px;
}
.rhythm-branch.four{grid-template-columns:repeat(4,1fr)}
.rv{
  padding:13px;
  border-radius:13px;
  background:#fff;
  border:1px solid var(--border);
  text-align:center;
}
.rv.main{max-width:360px;margin:0 auto}
.rv b{display:block;font-size:38px;line-height:1}
.rv span,.rv small{display:block}
.rv span{margin-top:5px;font-weight:800}
.rv small{color:var(--muted)}
.beat-animation{
  display:flex;
  gap:14px;
  justify-content:center;
  align-items:center;
  margin-top:18px;
  flex-wrap:wrap;
}
#atlasRhythmBeats{
  display:flex;
  gap:7px;
}
#atlasRhythmBeats span{
  width:34px;
  height:34px;
  display:grid;
  place-items:center;
  border-radius:50%;
  background:#e5dfd6;
  font-weight:900;
  transition:.15s;
}
#atlasRhythmBeats span.hit{
  transform:scale(1.18);
  background:var(--accent);
  color:#fff;
}

.meter-tabs{
  display:flex;
  gap:7px;
  justify-content:center;
}
.meter-tabs button{
  border:1px solid var(--border);
  border-radius:999px;
  background:#fff;
  padding:8px 13px;
  font-weight:800;
}
.meter-tabs button.active{
  background:#1f1d1a;
  color:#fff;
}
.meter-beats{
  display:flex;
  justify-content:center;
  gap:12px;
  margin:36px 0 20px;
}
.meter-beats span{
  width:52px;
  height:52px;
  display:grid;
  place-items:center;
  border-radius:50%;
  background:#ded8cf;
  font-weight:900;
}
.meter-beats span.strong{
  width:68px;
  height:68px;
  background:var(--accent);
  color:#fff;
}
.meter-beats span.medium{
  background:#b9bbf5;
  color:#2d317b;
}

.staff-explorer{
  max-width:760px;
  margin:0 auto;
}
.staff-explorer svg{
  width:100%;
  display:block;
  background:#fff;
  border:1px solid var(--border);
  border-radius:17px;
}
.staff-line,.ledger{stroke:#444;stroke-width:1.3}
#atlasStaffNote ellipse{fill:var(--accent)}
#atlasStaffNote line{stroke:var(--accent);stroke-width:2}
.staff-explorer input{width:100%;margin:14px 0 4px}
.staff-label{
  text-align:center;
  font-size:18px;
  font-weight:900;
}

.chord-stack{
  display:flex;
  justify-content:center;
  align-items:flex-end;
  gap:7px;
  min-height:120px;
  margin-bottom:12px;
}
.chord-stack div{
  min-width:100px;
  padding:12px;
  border-radius:13px;
  background:#fff;
  border:1px solid var(--border);
  text-align:center;
}
.chord-stack small,.chord-stack strong{display:block}
.chord-stack small{color:var(--muted)}
.chord-stack strong{font-size:18px;margin-top:3px}

.function-map{
  display:grid;
  grid-template-columns:1fr auto 1fr auto 1fr auto 1fr;
  gap:8px;
  align-items:center;
  max-width:840px;
  margin:30px auto;
}
.function-map button{
  min-height:120px;
  border:0;
  border-radius:18px;
  color:#fff;
  box-shadow:var(--shadow-soft);
}
.function-map strong,.function-map span,.function-map small{display:block}
.function-map strong{font-size:30px}
.function-map span{font-weight:800}
.function-map small{opacity:.72}
.function-map .tonic{background:#4f55d3}
.function-map .predom{background:#5b8b77}
.function-map .dom{background:#b96b43}
.function-map>i{font-style:normal;color:var(--muted)}

.circle-wrap{
  max-width:600px;
  margin:0 auto;
  position:relative;
}
#atlasCircle{width:100%;display:block}
.fifth-node{cursor:pointer}
.fifth-node circle{fill:#fff;stroke:#d9d2c8;stroke-width:2}
.fifth-node text{fill:#2e2b27;font-size:14px;font-weight:900}
.fifth-node:hover circle,.fifth-node:focus circle{fill:var(--accent-soft);stroke:var(--accent)}
.circle-core{fill:#1f1d1a}
.circle-title{fill:#fff;font-size:20px;font-weight:900;letter-spacing:.1em}
.circle-sub{fill:#aaa49c;font-size:13px}
.circle-info{
  position:absolute;
  left:50%;
  top:50%;
  transform:translate(-50%,55px);
  width:190px;
  text-align:center;
  color:#fff;
}
.circle-info strong,.circle-info span{display:block}
.circle-info span{font-size:10px;color:#b7b1aa;margin-top:4px}

.expression-grid{
  display:grid;
  gap:14px;
  max-width:760px;
  margin:0 auto;
}
.dynamic-lane,.articulation-examples,.pedal-demo{
  padding:16px;
  border-radius:15px;
  background:#fff;
  border:1px solid var(--border);
}
.dynamic-lane{
  display:grid;
  grid-template-columns:auto 1fr auto;
  gap:12px;
  align-items:center;
}
.dynamic-lane>span{font-family:ui-serif,serif;font-size:28px;font-style:italic}
.dynamic-lane small{grid-column:1/-1;text-align:center;color:var(--muted)}
.crescendo-shape{
  height:46px;
  background:linear-gradient(90deg,transparent 0 10%,rgba(81,86,216,.12),rgba(81,86,216,.9));
  clip-path:polygon(0 48%,100% 0,100% 100%);
}
.articulation-examples{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:8px;
}
.articulation-examples div{text-align:center}
.articulation-examples i{display:block;height:36px;font-style:normal;font-size:24px}
.legato-line{
  border-top:3px solid var(--accent);
  border-radius:50%;
  transform:translateY(16px);
}
.pedal-demo{display:flex;gap:12px;align-items:center}
#atlasPedalBars{display:flex;gap:5px;flex:1}
#atlasPedalBars span{
  flex:1;
  height:28px;
  border-radius:8px;
  background:#ded8cf;
}
#atlasPedalBars.ring span{animation:pedalRing 1.1s ease-out both}
#atlasPedalBars.ring span:nth-child(2){animation-delay:.08s}
#atlasPedalBars.ring span:nth-child(3){animation-delay:.16s}
#atlasPedalBars.ring span:nth-child(4){animation-delay:.24s}
@keyframes pedalRing{0%{background:#ded8cf;transform:scaleY(.5)}30%{background:#8e93ff;transform:scaleY(1)}100%{background:#ded8cf;transform:scaleY(.35)}}

.ear-flow{
  display:flex;
  justify-content:center;
  align-items:center;
  gap:10px;
  margin:18px 0 26px;
}
.ear-flow span{
  width:100px;
  height:100px;
  display:grid;
  place-items:center;
  align-content:center;
  border-radius:50%;
  background:#fff;
  border:1px solid var(--border);
  font-size:28px;
}
.ear-flow small{display:block;font-size:10px;color:var(--muted);margin-top:4px}
.ear-flow i{font-style:normal;color:var(--muted)}
.ear-demo{text-align:center}
#atlasEarChoices{
  display:flex;
  gap:5px;
  justify-content:center;
  flex-wrap:wrap;
  margin-top:12px;
}
#atlasEarChoices button{
  min-width:48px;
  min-height:42px;
  border:1px solid var(--border);
  border-radius:10px;
  background:#fff;
  font-weight:800;
}

.standards-map{
  display:flex;
  justify-content:center;
  gap:10px;
  align-items:center;
  margin:24px 0;
}
.standards-map div{
  min-width:150px;
  padding:14px;
  border-radius:14px;
  background:#fff;
  border:1px solid var(--border);
  text-align:center;
}
.standards-map small,.standards-map strong{display:block}
.standards-map small{color:var(--muted)}
.standards-map strong{font-size:24px}
.standards-map>i{font-style:normal;color:var(--muted)}
.standards-frequency{
  position:relative;
  max-width:520px;
  margin:0 auto 16px;
  padding:20px;
  overflow:hidden;
  border-radius:16px;
  background:#1f1d1a;
  color:#fff;
  text-align:center;
}
.standards-frequency span,.standards-frequency strong{display:block}
.standards-frequency strong{font-size:30px}
.freq-pulse{
  position:absolute;
  left:50%;
  top:50%;
  width:60px;
  height:60px;
  border:1px solid rgba(142,147,255,.8);
  border-radius:50%;
  transform:translate(-50%,-50%);
  animation:freqPulse 1.2s ease-out infinite;
}
@keyframes freqPulse{0%{opacity:.8;transform:translate(-50%,-50%) scale(.4)}100%{opacity:0;transform:translate(-50%,-50%) scale(4)}}
.format-comparison{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:7px;
}
.format-comparison div{
  padding:11px;
  border-radius:11px;
  background:#fff;
  border:1px solid var(--border);
  text-align:center;
}
.format-comparison strong,.format-comparison span{display:block}
.format-comparison span{font-size:10px;color:var(--muted)}

.form-blocks{
  display:grid;
  grid-template-columns:1fr .8fr 1fr;
  gap:8px;
  max-width:760px;
  margin:30px auto;
}
.form-blocks div{
  min-height:130px;
  display:grid;
  place-items:center;
  align-content:center;
  border-radius:18px;
}
.form-blocks .A{background:#555bd7;color:#fff}
.form-blocks .B{background:#df9a47;color:#38240f}
.form-blocks strong{font-size:38px}
.form-blocks span{font-size:11px}
.motive-demo{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  justify-content:center;
  align-items:center;
  color:var(--muted);
}
.motive-notes{display:flex;gap:4px}
.motive-notes i{
  width:16px;height:16px;border-radius:50%;background:var(--accent);
}
.motive-notes i:nth-child(2){transform:translateY(-8px)}
.motive-notes i:nth-child(3){transform:translateY(3px)}

.practice-loop{
  display:grid;
  grid-template-columns:1fr auto 1fr auto 1fr auto 1fr auto;
  gap:8px;
  align-items:center;
  max-width:900px;
  margin:28px auto;
}
.practice-loop>div{
  min-height:118px;
  padding:12px;
  display:grid;
  place-items:center;
  align-content:center;
  border-radius:17px;
  background:#fff;
  border:1px solid var(--border);
  text-align:center;
}
.practice-loop strong{
  width:30px;height:30px;display:grid;place-items:center;border-radius:9px;background:var(--accent-soft);color:var(--accent-strong)
}
.practice-loop span{font-weight:900;margin-top:7px}
.practice-loop small{color:var(--muted)}
.practice-loop>i{font-style:normal;color:var(--muted)}
.tempo-ladder{
  display:flex;
  gap:6px;
  justify-content:center;
}
.tempo-ladder span{
  padding:8px 11px;
  border-radius:9px;
  background:#1f1d1a;
  color:#fff;
}
.tempo-ladder span:last-child{background:var(--accent)}

.music-term{
  color:inherit;
  text-decoration-color:rgba(81,86,216,.55);
}

/* Refined practice surface */
.modal{
  background:rgba(27,25,22,.7);
  backdrop-filter:blur(9px);
}
.modal-panel{
  border:0;
  background:#fbfaf7;
}
.practice-mode-bar{
  padding:5px;
  border-radius:15px;
  background:#ece7de;
}
.mode-btn{
  border:0;
  background:transparent;
}
.mode-btn.active{
  background:#fff;
  box-shadow:0 6px 16px rgba(34,29,24,.08);
}
.practice-visual-grid>div{
  min-width:0;
}
.practice-score,.falling-lane{
  border:0;
  box-shadow:inset 0 0 0 1px var(--border);
}
.practice-hud span{
  border:0;
}
.practice-step{
  border:0;
  background:#eae5dd;
}
.practice-step.current{
  background:var(--accent-soft);
  color:var(--accent-strong);
}
.practice-step.done{
  background:var(--good-soft);
}

/* Reference & project cleanup */
.reference-hero,.project-hero{
  box-shadow:var(--shadow);
}
.glossary-item,.standard-item,.measure-box{
  border-color:rgba(217,210,200,.8);
}
.project-milestone{
  border:0;
  box-shadow:inset 0 0 0 1px var(--border);
}
.project-milestone.done{
  box-shadow:inset 0 0 0 1px #9ed6af;
}

/* Tablet */
@media (max-width:1100px){
  .atlas-shell{grid-template-columns:230px minmax(0,1fr)}
  .atlas-reading-layout{grid-template-columns:minmax(0,1fr) 230px;gap:20px}
}
@media (max-width:900px){
  .atlas-shell{display:block}
  .atlas-index{
    position:relative;
    top:auto;
    max-height:none;
    margin-bottom:12px;
    padding:12px;
  }
  .atlas-index-head{
    display:grid;
    grid-template-columns:1fr auto;
    gap:8px;
    align-items:center;
  }
  .atlas-index-head p{display:none}
  .atlas-search{padding:8px 4px}
  #atlasNav{
    display:flex;
    overflow-x:auto;
    padding-bottom:4px;
    scroll-snap-type:x proximity;
  }
  .atlas-nav-item{
    min-width:190px;
    flex:0 0 auto;
    scroll-snap-align:start;
  }
  .atlas-hero{
    grid-template-columns:1fr;
    padding:24px;
  }
  .atlas-goals{align-self:auto}
  .atlas-reading-layout{
    grid-template-columns:1fr;
    max-width:780px;
    margin-left:auto;
    margin-right:auto;
  }
  .atlas-confusions{
    position:relative;
    top:auto;
    order:-1;
  }
  .atlas-section-number{position:relative;top:auto}
}

/* Mobile */
@media (max-width:700px){
  .topbar h1{font-size:22px}
  .top-stats{display:none}
  .atlas-index{
    margin:0 -2px 10px;
    border-radius:15px;
  }
  .atlas-index-head{
    display:block;
  }
  .atlas-index-head h2{font-size:17px}
  .atlas-search input{min-height:44px}
  .atlas-nav-item{
    min-width:168px;
  }
  .atlas-hero{
    padding:20px 16px;
    border-radius:20px;
  }
  .atlas-hero h1{
    font-size:34px;
  }
  .atlas-hero-main>p{font-size:14px}
  .atlas-goals{padding:13px}
  .atlas-visual-panel{
    border-radius:18px;
    margin-top:10px;
  }
  .atlas-visual-head{
    padding:13px 14px 10px;
  }
  .atlas-visual-head small{display:none}
  .atlas-visual{
    min-height:260px;
    padding:14px;
  }
  .atlas-reading-layout{
    margin-top:22px;
    gap:16px;
  }
  .atlas-section{
    grid-template-columns:1fr;
    gap:9px;
    padding-bottom:26px;
  }
  .atlas-section-number{
    width:32px;height:32px;
  }
  .atlas-section h2{font-size:27px}
  .atlas-section p{font-size:15px;line-height:1.72}
  .atlas-selfcheck{
    flex-direction:column;
    align-items:stretch;
    padding:18px;
  }
  .atlas-keyboard{
    min-width:560px;
    height:180px;
  }
  .atlas-visual:has(.atlas-keyboard){
    overflow-x:auto;
  }
  .naming-row,.scale-degrees{
    min-width:560px;
  }
  .interval-result{grid-template-columns:1fr 1fr}
  .interval-controls{display:grid;grid-template-columns:1fr 1fr}
  .frequency-relations{gap:5px}
  .frequency-relations span{min-width:0;flex:1}
  .frequency-relations i{font-size:10px}
  .rhythm-branch.four{grid-template-columns:repeat(2,1fr)}
  .meter-beats{gap:6px}
  .meter-beats span{width:40px;height:40px}
  .meter-beats span.strong{width:52px;height:52px}
  .function-map{
    grid-template-columns:1fr;
    gap:5px;
  }
  .function-map button{min-height:78px}
  .function-map>i{transform:rotate(90deg);text-align:center}
  .circle-wrap{max-width:420px}
  .articulation-examples{grid-template-columns:1fr}
  .pedal-demo{align-items:stretch;flex-direction:column}
  .ear-flow{gap:3px}
  .ear-flow span{width:66px;height:66px;font-size:20px}
  .ear-flow i{font-size:11px}
  .standards-map{display:grid;grid-template-columns:1fr auto 1fr;gap:5px}
  .standards-map div{min-width:0;padding:9px}
  .standards-map div:last-of-type{grid-column:1/-1}
  .standards-map>i:last-of-type{display:none}
  .format-comparison{grid-template-columns:1fr 1fr}
  .form-blocks{grid-template-columns:1fr}
  .form-blocks div{min-height:90px}
  .practice-loop{
    grid-template-columns:1fr;
  }
  .practice-loop>i{transform:rotate(90deg);text-align:center}
  .tempo-ladder{flex-wrap:wrap}
}
@media (max-width:430px){
  .atlas-hero h1{font-size:31px}
  .atlas-visual{padding:11px}
  .interval-controls{grid-template-columns:1fr}
  .visual-controls{align-items:stretch;flex-direction:column}
  .visual-controls select,.visual-controls button{width:100%}
  .scale-formula span{width:34px;height:34px}
  .frequency-relations{font-size:10px}
}
@media (prefers-reduced-motion:reduce){
  .freq-pulse,#atlasPedalBars.ring span{animation:none!important}
}


/* Contextual lesson visuals */
.lesson-visual-v4{
  margin:0 0 26px;
  padding:18px;
  border-radius:20px;
  background:
    linear-gradient(135deg,rgba(81,86,216,.07),rgba(217,139,43,.04)),
    #fff;
  border:1px solid rgba(217,210,200,.76);
  box-shadow:var(--shadow-soft);
  overflow:hidden;
}
.lesson-visual-title{
  display:flex;
  justify-content:space-between;
  gap:14px;
  align-items:baseline;
  margin-bottom:14px;
}
.lesson-visual-title span{
  color:var(--accent-strong);
  text-transform:uppercase;
  letter-spacing:.08em;
  font-size:9px;
  font-weight:900;
}
.lesson-visual-title strong{
  font-size:15px;
}
.lesson-visual-caption{
  margin-top:10px;
  color:var(--muted);
  font-size:11px;
  text-align:center;
}
.lv-keyboard{
  position:relative;
  display:grid;
  grid-template-columns:repeat(7,1fr);
  height:150px;
  max-width:720px;
  margin:0 auto;
  border:7px solid #1f1d1a;
  border-radius:14px;
  background:#1f1d1a;
  overflow:hidden;
}
.lv-white{
  display:flex;
  flex-direction:column;
  justify-content:flex-end;
  align-items:center;
  padding-bottom:9px;
  border-right:1px solid #cfc8be;
  background:linear-gradient(#fff,#f2eee8);
  font-size:10px;
  font-weight:900;
}
.lv-white small{color:var(--muted)}
.lv-white.target{background:#d8d9ff;color:var(--accent-strong)}
.lv-black{
  position:absolute;
  top:0;
  z-index:2;
  width:7.5%;
  height:62%;
  border-radius:0 0 5px 5px;
  background:linear-gradient(#252525,#090909);
}
.lv-black.b1{left:10.5%}.lv-black.b2{left:24.8%}.lv-black.b4{left:53.3%}.lv-black.b5{left:67.6%}.lv-black.b6{left:81.9%}

.lv-hand{
  display:block;
  width:min(520px,100%);
  margin:0 auto;
}
.lv-hand>path{fill:#f1d0b4;stroke:#b78461;stroke-width:3}
.lv-hand g circle{fill:#1f1d1a}
.lv-hand g text{fill:#fff;font-weight:900;font-size:13px}

.lv-pulse{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:10px;
  max-width:640px;
  margin:10px auto 0;
}
.lv-pulse div{
  position:relative;
  height:92px;
  display:grid;
  place-items:center;
}
.lv-pulse strong{
  position:relative;
  z-index:2;
  width:42px;height:42px;
  display:grid;place-items:center;
  border-radius:50%;
  background:#1f1d1a;color:#fff;
}
.lv-pulse span{
  position:absolute;
  top:45px;left:50%;
  width:calc(100% + 10px);
  height:2px;
  background:#d6cfc5;
}
.lv-pulse div:last-child span{display:none}
.lv-pulse div:nth-child(1) strong{animation:lvPulse 2.4s ease-in-out infinite}
.lv-pulse div:nth-child(2) strong{animation:lvPulse 2.4s .6s ease-in-out infinite}
.lv-pulse div:nth-child(3) strong{animation:lvPulse 2.4s 1.2s ease-in-out infinite}
.lv-pulse div:nth-child(4) strong{animation:lvPulse 2.4s 1.8s ease-in-out infinite}
@keyframes lvPulse{0%,18%,100%{transform:scale(1);background:#1f1d1a}8%{transform:scale(1.18);background:var(--accent)}}

.lv-semitone{
  display:flex;
  justify-content:center;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  margin:20px 0;
}
.lv-semitone span{
  min-width:76px;
  padding:12px;
  border-radius:12px;
  background:#fff;
  border:1px solid var(--border);
  text-align:center;
  font-weight:900;
}
.lv-semitone i{
  color:var(--accent-strong);
  font-style:normal;
  font-weight:900;
}
.lv-special{
  display:grid;
  grid-template-columns:auto auto auto auto;
  gap:7px;
  max-width:520px;
  margin:0 auto;
}
.lv-special>*{
  padding:8px 10px;
  border-radius:9px;
  background:var(--panel-soft);
  text-align:center;
  font-size:11px;
}

.lv-values{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:8px;
  max-width:680px;
  margin:0 auto;
}
.lv-values div{
  padding:14px;
  border-radius:14px;
  background:#fff;
  border:1px solid var(--border);
  text-align:center;
}
.lv-values b{display:block;font-size:38px;line-height:1}
.lv-values span{display:block;font-weight:900;margin-top:5px}
.lv-values small{display:block;color:var(--muted);font-size:10px}

.lv-stairs{
  display:flex;
  align-items:flex-end;
  justify-content:center;
  gap:4px;
  min-height:190px;
  padding:12px;
}
.lv-stairs span{
  width:54px;
  min-height:42px;
  display:grid;
  place-items:center;
  margin-bottom:calc(var(--step) * 16px);
  border-radius:10px 10px 3px 3px;
  background:linear-gradient(#676cf1,#5156d8);
  color:#fff;
  font-size:10px;
  font-weight:900;
  box-shadow:0 7px 14px rgba(81,86,216,.14);
}

.lv-chords{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:9px;
  max-width:700px;
  margin:0 auto;
}
.lv-chords>div{
  padding:12px;
  border-radius:14px;
  background:#fff;
  border:1px solid var(--border);
}
.lv-chords span{
  display:block;
  color:var(--muted);
  font-size:10px;
  text-transform:uppercase;
  letter-spacing:.08em;
  font-weight:900;
  margin-bottom:7px;
}
.lv-chords b{
  display:inline-grid;
  place-items:center;
  min-width:44px;
  min-height:44px;
  margin-right:4px;
  border-radius:50%;
  background:var(--accent-soft);
  color:var(--accent-strong);
  font-size:10px;
}
.lv-inversions{
  display:grid;
  grid-template-columns:1fr auto 1fr auto 1fr;
  gap:8px;
  align-items:center;
  max-width:760px;
  margin:0 auto;
}
.lv-inversions>div{
  padding:14px;
  border-radius:13px;
  background:#fff;
  border:1px solid var(--border);
  text-align:center;
}
.lv-inversions small,.lv-inversions strong{display:block}
.lv-inversions small{color:var(--muted)}
.lv-inversions i{font-style:normal;color:var(--muted)}

.lv-staff{
  display:block;
  width:min(700px,100%);
  margin:0 auto;
  border-radius:14px;
  background:#fff;
  border:1px solid var(--border);
}
.lv-staff line{stroke:#444;stroke-width:1.2}
.lv-staff ellipse{fill:var(--accent)}
.lv-staff g line{stroke:var(--accent);stroke-width:2}
.lv-staff g{animation:lvStaffGlow 3s ease-in-out infinite}
.lv-staff g:nth-of-type(2){animation-delay:.45s}
.lv-staff g:nth-of-type(3){animation-delay:.9s}
.lv-staff g:nth-of-type(4){animation-delay:1.35s}
.lv-staff g:nth-of-type(5){animation-delay:1.8s}
.lv-note-label{fill:var(--muted);font-size:10px;font-weight:900}
@keyframes lvStaffGlow{0%,20%,100%{opacity:.45}10%{opacity:1}}

.lv-fifths{
  display:flex;
  justify-content:center;
  align-items:center;
  gap:6px;
  flex-wrap:wrap;
  margin:24px 0;
}
.lv-fifths span{
  width:56px;height:56px;
  display:grid;place-items:center;
  border-radius:50%;
  background:#fff;
  border:1px solid var(--border);
  font-weight:900;
}
.lv-fifths span:nth-child(3),.lv-fifths span:nth-child(5),.lv-fifths span:nth-child(7){background:var(--accent-soft);color:var(--accent-strong)}
.lv-fifths i{font-style:normal;color:var(--muted)}

.lv-stack{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:4px;
  margin:15px 0;
}
.lv-stack span{
  width:150px;
  padding:9px;
  margin-left:calc(var(--y) * -18px);
  border-radius:9px;
  background:var(--accent-soft);
  color:var(--accent-strong);
  text-align:center;
  font-weight:900;
}
.lv-ear{
  display:flex;
  justify-content:center;
  align-items:center;
  gap:12px;
  min-height:120px;
}
.lv-ear span{
  width:62px;height:62px;
  display:grid;place-items:center;
  border-radius:50%;
  background:#fff;
  border:1px solid var(--border);
  font-size:24px;
}
.lv-ear i{font-style:normal;color:var(--muted)}

.lv-contour{
  position:relative;
  height:140px;
  max-width:620px;
  margin:0 auto;
  border-bottom:1px solid var(--border);
}
.lv-contour i{
  position:absolute;
  left:calc(7% + var(--x) * 14%);
  bottom:calc(var(--y) * 13px);
  width:18px;height:18px;
  border-radius:50%;
  background:var(--accent);
  box-shadow:0 0 0 5px var(--accent-soft);
}
.lv-contour i::after{
  content:"";
  position:absolute;
  left:16px;top:8px;
  width:calc(14vw - 5px);
  max-width:82px;
  height:2px;
  background:#b7b2dc;
  transform-origin:left center;
}
.lv-contour i:last-child::after{display:none}

@media (max-width:700px){
  .lesson-visual-v4{
    margin:0 0 20px;
    padding:14px;
  }
  .lesson-visual-title{
    display:block;
  }
  .lesson-visual-title strong{
    display:block;
    margin-top:3px;
  }
  .lv-keyboard{min-width:520px}
  .lesson-visual-v4:has(.lv-keyboard){overflow-x:auto}
  .lv-values{grid-template-columns:repeat(2,1fr)}
  .lv-stairs{
    justify-content:flex-start;
    min-width:480px;
    min-height:170px;
  }
  .lesson-visual-v4:has(.lv-stairs){overflow-x:auto}
  .lv-chords{grid-template-columns:1fr}
  .lv-inversions{grid-template-columns:1fr}
  .lv-inversions i{transform:rotate(90deg);text-align:center}
  .lv-special{grid-template-columns:1fr 1fr}
}
@media (prefers-reduced-motion:reduce){
  .lv-pulse strong,.lv-staff g{animation:none!important}
}


/* Mobile navigation V4 */
.mobile-nav-v4,.mobile-more-v4{display:none}

@media (max-width:760px){
  body{
    padding-bottom:calc(78px + env(safe-area-inset-bottom));
  }
  .tabs{display:none!important}
  .topbar{display:none!important}

  .sidebar{
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    grid-template-areas:
      "brand levels"
      "summary levels"
      "nav nav";
    gap:4px 8px;
    padding:8px 10px;
    min-height:72px;
  }
  .brand{
    grid-area:brand;
    margin:0;
    min-width:0;
  }
  .brand-mark{
    width:32px;height:32px;border-radius:10px;font-size:17px;
  }
  .brand strong{
    font-size:13px;
    white-space:nowrap;
  }
  .brand span{display:none}
  .level-summary{
    grid-area:summary;
    margin:0;
    padding:0;
    border:0;
    background:transparent;
    min-width:0;
  }
  .level-summary .stage-badge,
  .level-summary>span,
  .level-summary .progress-track,
  .level-summary small{
    display:none!important;
  }
  .level-summary strong{
    display:block;
    margin:0!important;
    color:#aeb7c3;
    font-size:11px;
    font-weight:650;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }
  .mobile-level-toggle{
    grid-area:levels;
    display:flex;
    align-items:center;
    justify-content:center;
    width:auto!important;
    min-width:78px;
    min-height:42px;
    margin:0!important;
    padding:8px 12px;
    font-size:0;
    border-radius:11px;
  }
  .mobile-level-toggle::after{
    content:"Niveles";
    font-size:11px;
    font-weight:850;
  }
  .sidebar.levels-open .mobile-level-toggle::after{
    content:"Cerrar";
  }
  .level-nav{
    grid-area:nav;
    margin-top:5px;
  }
  .sidebar.levels-open .level-nav{
    max-height:58vh;
  }

  .main{
    padding-top:10px;
  }

  .mobile-nav-v4{
    position:fixed;
    z-index:120;
    left:8px;
    right:8px;
    bottom:calc(8px + env(safe-area-inset-bottom));
    display:grid;
    grid-template-columns:repeat(6,1fr);
    gap:3px;
    min-height:62px;
    padding:5px;
    border:1px solid rgba(255,255,255,.08);
    border-radius:18px;
    background:rgba(24,23,21,.96);
    box-shadow:0 16px 40px rgba(0,0,0,.24);
    backdrop-filter:blur(18px);
  }
  .mobile-nav-v4 button{
    min-width:0;
    min-height:50px;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:3px;
    padding:4px 2px;
    border:0;
    border-radius:13px;
    background:transparent;
    color:#aaa49c;
    font-size:9px;
    font-weight:800;
  }
  .mobile-nav-v4 button.active{
    background:#fff;
    color:#1f1d1a;
  }
  .mobile-nav-v4 svg{
    width:20px;
    height:20px;
    fill:none;
    stroke:currentColor;
    stroke-width:1.8;
    stroke-linejoin:round;
    stroke-linecap:round;
  }
  .mobile-nav-v4 [data-mobile-view="train"] svg,
  .mobile-nav-v4 [data-mobile-view="aerith"] svg{
    fill:currentColor;
    stroke:none;
  }

  .mobile-more-v4{
    position:fixed;
    z-index:119;
    left:12px;
    right:12px;
    bottom:calc(78px + env(safe-area-inset-bottom));
    display:grid;
    gap:5px;
    padding:10px;
    border-radius:18px;
    background:rgba(255,253,248,.98);
    border:1px solid var(--border);
    box-shadow:0 20px 54px rgba(0,0,0,.2);
    backdrop-filter:blur(18px);
  }
  .mobile-more-v4[hidden]{display:none}
  .mobile-more-v4 button{
    min-height:58px;
    display:grid;
    grid-template-columns:38px 1fr;
    gap:9px;
    align-items:center;
    padding:8px 10px;
    border:0;
    border-radius:12px;
    background:transparent;
    color:var(--text);
    text-align:left;
  }
  .mobile-more-v4 button:hover{
    background:var(--panel-soft);
  }
  .mobile-more-v4 svg{
    width:24px;height:24px;
    fill:none;stroke:var(--accent);stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;
  }
  .mobile-more-v4 span,.mobile-more-v4 strong,.mobile-more-v4 small{display:block}
  .mobile-more-v4 strong{font-size:12px}
  .mobile-more-v4 small{margin-top:2px;color:var(--muted);font-size:10px}

  .lesson-card{
    border-radius:18px;
  }
  .lesson-header{
    display:block;
  }
  .lesson-header #completeLessonBtn{
    margin-top:12px;
    width:100%;
  }
  .lesson-goal{
    font-size:15px;
  }
}

@media (max-width:430px){
  .sidebar{
    grid-template-columns:minmax(0,1fr) 72px;
  }
  .mobile-level-toggle{min-width:72px}
  .mobile-nav-v4{
    left:6px;right:6px;bottom:calc(6px + env(safe-area-inset-bottom));
  }
  .mobile-nav-v4 button span{font-size:8px}
}


/* QA V4.1 · prevent cramped atlas at tablet/compact desktop widths */
@media (max-width:1280px) and (min-width:901px){
  .atlas-shell{
    display:block;
  }
  .atlas-index{
    position:relative;
    top:auto;
    max-height:none;
    margin-bottom:14px;
    padding:12px;
  }
  .atlas-index-head{
    display:flex;
    justify-content:space-between;
    gap:18px;
    align-items:end;
  }
  .atlas-index-head p{
    max-width:420px;
  }
  .atlas-search{
    max-width:360px;
  }
  #atlasNav{
    display:flex;
    overflow-x:auto;
    gap:5px;
    padding-bottom:5px;
    scroll-snap-type:x proximity;
  }
  .atlas-nav-item{
    min-width:190px;
    flex:0 0 auto;
    scroll-snap-align:start;
  }
  .atlas-hero{
    grid-template-columns:minmax(0,1fr) minmax(250px,330px);
  }
  .atlas-hero-main{
    min-width:0;
  }
  .atlas-hero h1{
    overflow-wrap:anywhere;
  }
  .atlas-reading-layout{
    grid-template-columns:minmax(0,1fr) 245px;
    max-width:1040px;
  }
}


/* Functional lesson materials V5 */
.lv-sequence-notes,
.lv-scale-sequence,
.lv-rhythm-events{
  display:flex;
  gap:7px;
  flex-wrap:wrap;
  align-items:stretch;
  justify-content:center;
  margin:12px auto;
}
.lv-sequence-notes span,
.lv-scale-sequence span,
.lv-rhythm-events span{
  min-width:70px;
  padding:10px 11px;
  border-radius:12px;
  border:1px solid var(--border);
  background:#fff;
  text-align:center;
}
.lv-sequence-notes small,
.lv-scale-sequence small,
.lv-rhythm-events small{
  display:block;
  margin-bottom:3px;
  color:var(--muted);
  font-size:8px;
  font-weight:850;
  text-transform:uppercase;
  letter-spacing:.04em;
}
.lv-sequence-notes b,
.lv-scale-sequence b,
.lv-rhythm-events b{
  display:block;
  font-size:12px;
}
.lv-rhythm-events em{
  display:block;
  margin-top:4px;
  color:var(--accent-strong);
  font-style:normal;
  font-size:9px;
  font-weight:800;
}
.lv-chord-events{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(145px,1fr));
  gap:8px;
  max-width:760px;
  margin:10px auto;
}
.lv-chord-events>div{
  padding:12px;
  border:1px solid var(--border);
  border-radius:13px;
  background:#fff;
}
.lv-chord-events small,
.lv-chord-events strong,
.lv-chord-events span{display:block}
.lv-chord-events small{color:var(--muted);font-size:9px}
.lv-chord-events strong{margin:5px 0;font-size:13px}
.lv-chord-events span{color:var(--accent-strong);font-size:9px;font-weight:850}
.lv-twohand{
  display:grid;
  grid-template-columns:minmax(0,.8fr) auto minmax(0,1.4fr);
  gap:10px;
  align-items:center;
  margin:12px auto;
}
.lv-twohand>div:not(.brace){
  min-height:105px;
  padding:14px;
  border-radius:14px;
  border:1px solid var(--border);
  background:#fff;
}
.lv-twohand .left{border-left:5px solid #2d8a57}
.lv-twohand .right{border-left:5px solid var(--accent)}
.lv-twohand small,.lv-twohand strong,.lv-twohand span{display:block}
.lv-twohand small{color:var(--muted);font-size:9px;font-weight:850}
.lv-twohand strong{margin:6px 0;font-size:15px}
.lv-twohand span{color:var(--muted);font-size:10px;line-height:1.45}
.lv-twohand .brace{font-weight:900;color:var(--accent-strong)}
.lesson-visual-use{
  display:grid;
  grid-template-columns:auto minmax(0,1fr);
  gap:6px 10px;
  max-width:820px;
  margin:14px auto 0;
  padding:10px 12px;
  border-radius:12px;
  background:rgba(81,86,216,.055);
  font-size:10px;
  line-height:1.45;
}
.lesson-visual-use b{color:var(--accent-strong)}
.lesson-visual-use span{color:var(--text)}
.lesson-visual-action{
  display:flex;
  gap:8px;
  align-items:flex-start;
  margin-top:12px;
  padding-top:10px;
  border-top:1px solid var(--border);
  font-size:10px;
}
.lesson-visual-action strong{
  flex:0 0 auto;
  color:var(--text);
}
.lesson-visual-action span{
  color:var(--muted);
  line-height:1.45;
}
.lv-score-preview-wrap{
  overflow-x:auto;
  padding:4px 0;
}
.lv-score-preview-wrap svg{
  display:block;
  min-width:620px;
  max-width:100%;
  margin:0 auto;
}
@media(max-width:700px){
  .lv-twohand{grid-template-columns:1fr}
  .lv-twohand .brace{display:none}
  .lesson-visual-use{grid-template-columns:1fr}
  .lesson-visual-action{display:block}
  .lesson-visual-action strong{display:block;margin-bottom:3px}
}


/* Material pedagógico V5 · visuales conceptuales por bloque */
.lesson-concepts-v5{
  display:grid;
  gap:12px;
  margin-top:14px;
}
.lesson-concept-v5{
  min-width:0;
  padding:14px;
  border:1px solid var(--border);
  border-radius:14px;
  background:#fff;
  overflow:hidden;
}
.lmv5-head{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:baseline;
  margin-bottom:10px;
}
.lmv5-head span{
  color:var(--accent-strong);
  font-size:8px;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:.07em;
}
.lmv5-head strong{
  font-size:13px;
  text-align:right;
}
.lmv5-body{min-width:0}
.lmv5-use{
  display:grid;
  grid-template-columns:auto minmax(0,1fr);
  gap:5px 8px;
  margin-top:10px;
  padding:9px 10px;
  border-radius:10px;
  background:var(--panel-soft);
  font-size:10px;
  line-height:1.45;
}
.lmv5-use b{color:var(--accent-strong)}
.lmv5-use span{color:var(--text)}

.lmv5-score-scroll,
.lmv5-wide-scroll{
  width:100%;
  max-width:100%;
  min-width:0;
  overflow-x:auto;
  overflow-y:hidden;
  overscroll-behavior-inline:contain;
}
.lmv5-score-scroll svg{
  display:block;
  width:auto;
  min-width:520px;
  max-width:none;
  height:170px;
  margin:0 auto;
}
.lesson-concept-v5[data-concept="rests"] .score-v2-rest{
  font-size:27px;
  font-weight:700;
}
.lesson-concept-v5[data-concept="rests"] .lmv5-score-scroll svg{
  height:190px;
}
.lmv5-anatomy{
  display:block;
  width:760px;
  min-width:760px;
  height:auto;
  margin:0 auto;
  border-radius:12px;
  background:#fbfaf7;
}
.lmv5-anatomy .staff{stroke:#777;stroke-width:1.2}
.lmv5-anatomy .head{fill:var(--accent)}
.lmv5-anatomy .stem{stroke:var(--accent);stroke-width:3}
.lmv5-anatomy .flag{fill:none;stroke:var(--accent);stroke-width:5;stroke-linecap:round}
.lmv5-anatomy .beam{stroke:var(--accent);stroke-width:8;stroke-linecap:round}
.lmv5-anatomy .call text{fill:var(--text);font-size:14px;font-weight:850}
.lmv5-anatomy .call path{fill:none;stroke:#9c958c;stroke-width:1.5;marker-end:none}

.lmv5-legend,
.lmv5-tech,
.lmv5-fingering,
.lmv5-scale,
.lmv5-rhythm,
.lmv5-texture{
  display:flex;
  gap:7px;
  flex-wrap:wrap;
  justify-content:center;
  margin-top:8px;
}
.lmv5-legend span,
.lmv5-tech span,
.lmv5-fingering span,
.lmv5-scale span,
.lmv5-rhythm span,
.lmv5-texture span{
  min-width:72px;
  padding:8px 10px;
  border:1px solid var(--border);
  border-radius:10px;
  background:#fbfaf7;
  text-align:center;
}
.lmv5-legend b,
.lmv5-tech b,
.lmv5-fingering b,
.lmv5-scale b,
.lmv5-rhythm b,
.lmv5-texture b{display:block}
.lmv5-legend small,
.lmv5-tech small,
.lmv5-fingering small,
.lmv5-scale small,
.lmv5-rhythm small,
.lmv5-texture small{
  display:block;
  color:var(--muted);
  font-size:8px;
}
.lmv5-tech em,
.lmv5-fingering em,
.lmv5-rhythm em{
  display:block;
  margin-top:3px;
  color:var(--accent-strong);
  font-style:normal;
  font-size:8px;
  font-weight:800;
}

.lmv5-compare{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
}
.lmv5-compare>div{
  min-width:0;
  padding:10px;
  border:1px solid var(--border);
  border-radius:11px;
  background:#fbfaf7;
}
.lmv5-compare>div>strong,
.lmv5-compare>div>small{display:block;text-align:center}
.lmv5-compare>div>strong{font-size:11px}
.lmv5-compare>div>small{margin-top:4px;color:var(--muted);font-size:9px}

.lmv5-key-path,
.lmv5-function,
.lmv5-interval{
  display:flex;
  justify-content:center;
  align-items:center;
  gap:7px;
  flex-wrap:wrap;
  padding:8px 0;
}
.lmv5-key-path span,
.lmv5-function span,
.lmv5-interval span{
  min-width:78px;
  padding:10px;
  border:1px solid var(--border);
  border-radius:11px;
  background:#fbfaf7;
  text-align:center;
}
.lmv5-key-path small,
.lmv5-interval small{display:block;color:var(--muted);font-size:8px}
.lmv5-key-path i,
.lmv5-function i,
.lmv5-interval i{
  color:var(--muted);
  font-style:normal;
  font-size:10px;
  font-weight:850;
}

.lmv5-chords{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(150px,1fr));
  gap:8px;
}
.lmv5-chords>div{
  min-width:0;
  padding:10px;
  border:1px solid var(--border);
  border-radius:11px;
  background:#fbfaf7;
}
.lmv5-chords small,
.lmv5-chords strong,
.lmv5-chords span{display:block}
.lmv5-chords small{color:var(--muted);font-size:8px}
.lmv5-chords strong{margin:4px 0;font-size:11px;overflow-wrap:anywhere}
.lmv5-chords span{color:var(--accent-strong);font-size:8px;font-weight:850}

@media(max-width:700px){
  .lesson-concept-v5{padding:11px}
  .lmv5-head{display:block}
  .lmv5-head strong{display:block;margin-top:3px;text-align:left}
  .lmv5-use{grid-template-columns:1fr}
  .lmv5-compare{grid-template-columns:1fr}
  .lmv5-score-scroll svg{
    min-width:500px;
    height:185px;
  }
}
@media(max-width:430px){
  .lmv5-score-scroll svg{
    min-width:480px;
    height:180px;
  }
  .lmv5-anatomy{
    width:680px;
    min-width:680px;
  }
}
@media(prefers-reduced-motion:reduce){
  .lesson-concept-v5 *{scroll-behavior:auto!important}
}
