/* ═══════════════════════════════════════════════════════════════
   MUSIC ACADEMY 🎵  (owned by music-academy.js)
   Sibling of the Art Academy: the root is ".ac-app.ma-app", so the
   shared .ac-* look comes from academy.css. Only .ma-* lives here.
   Dark + light themes · 390px → desktop · print sheet at the bottom.
   ═══════════════════════════════════════════════════════════════ */
.ma-app {
  --ma-key: #ffffff;
  --ma-key-edge: #cbd5e1;
  --ma-black: #1e293b;
  --ma-glow: #f59e0b;
  --ma-ok: #10b981;
  --ma-early: #0ea5e9;
  --ma-late: #f97316;
  --ma-ink: #f8fafc;
  --ma-soft: rgba(255, 255, 255, 0.06);
}
[data-theme="light"] .ma-app { --ma-ink: #0f172a; --ma-soft: rgba(15, 23, 42, 0.04); }
.ma-app [hidden] { display: none !important; }

/* ── home hero + Santo spotlight ── */
.ma-hero { background: radial-gradient(circle at 12% 20%, rgba(255, 255, 255, 0.22), transparent 40%), linear-gradient(135deg, #0ea5e9 0%, #6366f1 50%, #a855f7 100%); box-shadow: 0 18px 40px rgba(99, 102, 241, 0.3); }
.ma-app .ac-hero::after { content: '🎵 🎹 🎶'; }
.ma-solf { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem !important; }
.ma-santo {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 18px; margin-top: 22px;
  padding: 22px 24px; border-radius: 30px; color: #fff; position: relative; overflow: hidden;
  background: radial-gradient(circle at 92% 8%, rgba(255, 255, 255, 0.25), transparent 42%), var(--g);
  box-shadow: 0 18px 40px rgba(124, 58, 237, 0.3);
}
.ma-santo::after { content: '⛪'; position: absolute; right: 18px; bottom: -14px; font-size: 6rem; opacity: 0.13; pointer-events: none; }
.ma-santo, .ma-santo * { color: #fff; }
.ma-santo-title { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.7rem, 4vw, 2.5rem); line-height: 1.05; margin: 6px 0 2px; }
.ma-santo-sub { margin: 0 0 12px; opacity: 0.95; }
.ma-countdown-chip { display: inline-flex; align-items: center; gap: 10px; padding: 8px 16px 8px 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.2); border: 1px solid rgba(255, 255, 255, 0.35); font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; margin-bottom: 12px; }
.ma-cd-big { display: grid; place-items: center; min-width: 46px; height: 46px; padding: 0 8px; border-radius: 999px; background: #fff; color: #7c3aed !important; font-size: 1.6rem; }
.ma-santo-today { background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.28); border-radius: 22px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; position: relative; z-index: 1; }
.ma-today-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.ma-today-list li { line-height: 1.3; }
.ma-today-list li.done { opacity: 0.8; text-decoration: line-through; text-decoration-color: rgba(255, 255, 255, 0.6); }
.ma-santo-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.ma-app .ac-btn.ma-white { background: #fff; color: #6d28d9 !important; border: none; font-weight: 700; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18); }
.ma-app .ac-btn.ma-white:hover:not(:disabled) { background: #fff; }
.ma-app .ac-btn.ma-ghost { background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.35); color: #fff; }
.ma-app .ac-btn.ma-ghost:hover:not(:disabled) { background: rgba(255, 255, 255, 0.26); border-color: #fff; }
.ma-home-row:empty { display: none; }
.ma-home-row { grid-template-columns: minmax(0, 1fr); }
.ac-course.ma-special { border: 2px solid rgba(245, 158, 11, 0.55); box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.12); }
.ma-tag { position: absolute; top: 12px; right: 12px; padding: 4px 10px; border-radius: 999px; background: var(--g); color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 0.8rem; }
.ma-hero-count { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; }

/* ── week strip, tools, map tags ── */
.ma-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin-top: 18px; }
.ma-day { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; min-height: 84px; border-radius: 18px; border: 2px solid var(--border-color); background: var(--bg-card); cursor: pointer; transition: transform .15s ease, border-color .2s ease; min-width: 0; }
.ma-day:hover { transform: translateY(-2px); border-color: var(--border-hover); }
.ma-day.today { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.18); }
.ma-day.done { background: linear-gradient(160deg, rgba(16, 185, 129, 0.2), rgba(14, 165, 233, 0.12)); border-color: rgba(16, 185, 129, 0.5); }
.ma-day-name { font-family: var(--font-display); font-weight: 700; font-size: 0.95rem; }
.ma-day-emo { font-size: 1.5rem; line-height: 1.1; }
.ma-day-n { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.ma-tools { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.ma-day-tag { font-size: 0.82rem; color: var(--text-muted); font-family: var(--font-display); }

/* ── lesson stage ── */
.ma-stage { display: flex; flex-direction: column; gap: 12px; }
.ma-intro { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 10px 4px; text-align: center; }
.ma-intro-say { font-size: 1.2rem; line-height: 1.5; max-width: 640px; margin: 0; font-weight: 500; }
.ma-art { width: 100%; display: flex; justify-content: center; }
.ma-kbd { width: 100%; max-width: 560px; height: auto; color: var(--text-main); }
.ma-art-emoji { font-size: clamp(3rem, 10vw, 5rem); letter-spacing: 0.2em; }
.ma-puzzle { display: flex; gap: 6px; }
.ma-puzzle span { width: 72px; height: 72px; display: grid; place-items: center; border-radius: 16px; background: var(--pc); color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 2rem; box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2); }
.ma-puzzle span:nth-child(odd) { transform: rotate(-4deg); }
.ma-puzzle span:nth-child(even) { transform: rotate(3deg) translateY(4px); }

/* ── messages ── */
.ma-msg { min-height: 2.6em; padding: 10px 14px; border-radius: 16px; background: var(--ma-soft); border: 1px solid var(--border-color); font-family: var(--font-display); font-weight: 600; font-size: 1.12rem; line-height: 1.3; text-align: center; display: flex; align-items: center; justify-content: center; }
.ma-msg.oops { border-color: rgba(245, 158, 11, 0.6); background: rgba(245, 158, 11, 0.1); }
.ma-msg.win { border-color: rgba(16, 185, 129, 0.6); background: rgba(16, 185, 129, 0.12); }

/* ── trainer ── */
.ma-trainer, .ma-tapper, .ma-game, .ma-lengths, .ma-tips, .ma-ladder { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ma-tr-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ma-tr-badge { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; padding: 6px 12px; border-radius: 999px; background: var(--g, var(--grad-main)); color: #fff; }
.ma-tr-count { font-family: var(--font-display); font-weight: 700; color: var(--text-muted); }
.ma-progress { flex: 1 1 100px; height: 10px; border-radius: 99px; background: var(--ac-ctl); overflow: hidden; min-width: 60px; }
.ma-progress i { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--g, var(--grad-main)); transition: width .3s ease; }
.ma-tr-ctl { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; }
.ma-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ma-bpm { font-family: var(--font-display); font-weight: 700; color: var(--text-muted); padding: 0 6px; }
.ma-app .ac-btn.ma-sm { min-height: 44px; padding: 8px 14px; font-size: 0.95rem; }
.ma-go { min-width: 150px; min-height: 56px !important; font-size: 1.15rem !important; }
.ma-countdown { display: flex; align-items: center; justify-content: center; gap: 14px; min-height: 46px; }
.ma-cd-num { min-width: 46px; text-align: center; font-family: var(--font-display); font-weight: 700; font-size: 2.2rem; line-height: 1; color: var(--primary); }
.counting .ma-cd-num { animation: maPop .3s ease; }
.ma-beats { display: flex; gap: 8px; }
.ma-beats i { width: 16px; height: 16px; border-radius: 50%; background: var(--ac-ctl); border: 2px solid var(--border-hover); transition: transform .08s ease, background .08s ease; }
.ma-beats i.on { background: var(--primary); border-color: #fff; transform: scale(1.35); }
.ma-beats i:first-child.on { background: #f59e0b; }
.ma-tr-result { padding: 14px 16px; border-radius: 20px; background: var(--ma-soft); border: 2px solid var(--border-hover); text-align: center; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.ma-tr-result p { margin: 0; }
.ma-res-stars .ac-stars { font-size: 2.2rem; letter-spacing: 6px; }
.ma-timing { display: flex; width: 100%; max-width: 420px; height: 26px; border-radius: 99px; overflow: hidden; background: var(--ac-ctl); }
.ma-timing span { display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 0.85rem; min-width: 22px; }
.ma-timing .early { background: var(--ma-early); }
.ma-timing .ok { background: var(--ma-ok); }
.ma-timing .late { background: var(--ma-late); }
.ma-timing-key { font-size: 0.9rem; display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.ma-timing-key .early { color: var(--ma-early); } .ma-timing-key .ok { color: var(--ma-ok); } .ma-timing-key .late { color: var(--ma-late); }
[data-theme="light"] .ma-timing-key .early { color: #0369a1; } [data-theme="light"] .ma-timing-key .ok { color: #047857; } [data-theme="light"] .ma-timing-key .late { color: #c2410c; }

/* ── input sources ── */
.ma-inputs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; padding-top: 4px; border-top: 1px dashed var(--border-hover); }
.ma-mic-level { width: 90px; height: 10px; border-radius: 99px; background: var(--ac-ctl); overflow: hidden; }
.ma-mic-level i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #10b981, #f59e0b, #ef4444); transition: width .06s linear; }
.ma-mic-heard { font-family: var(--font-display); font-weight: 700; min-width: 3em; }
.ma-input-note { flex-basis: 100%; margin: 0; text-align: center; font-size: 0.88rem; color: var(--text-muted); }

/* ── on-screen piano ── */
.ma-piano-wrap { width: 100%; overflow-x: auto; overflow-y: hidden; padding: 4px 2px 6px; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.ma-piano {
  position: relative; height: clamp(150px, 26vw, 210px); min-width: calc(var(--whites) * 34px);
  border-radius: 10px 10px 16px 16px; background: linear-gradient(180deg, #312e81, #1e1b4b); padding: 10px 6px 6px; box-sizing: border-box;
  box-shadow: inset 0 6px 10px rgba(0, 0, 0, 0.4), 0 10px 24px rgba(0, 0, 0, 0.25); touch-action: none; user-select: none; -webkit-user-select: none;
}
.ma-keys { position: relative; height: 100%; }
.ma-key { position: absolute; top: 0; padding: 0; margin: 0; border: none; cursor: pointer; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; font-family: var(--font-display); touch-action: none; -webkit-tap-highlight-color: transparent; transition: transform .05s ease, background .08s ease; }
.ma-key.w { bottom: 0; background: linear-gradient(180deg, #f8fafc 0%, #ffffff 70%, #e2e8f0 100%); border-radius: 0 0 9px 9px; box-shadow: inset 0 -5px 0 #cbd5e1, 0 0 0 1px #94a3b8; color: #334155; padding-bottom: 10px; z-index: 1; }
.ma-key.b { height: 60%; z-index: 2; background: linear-gradient(180deg, #334155, #0f172a); border-radius: 0 0 6px 6px; box-shadow: inset 0 -4px 0 #020617, 0 3px 6px rgba(0, 0, 0, 0.4); color: #fff; padding-bottom: 6px; }
.ma-kn { font-weight: 700; font-size: 1.05rem; line-height: 1; }
.ma-key kbd { font-family: var(--font-body); font-size: 0.66rem; opacity: 0.5; }
.ma-kmid { position: absolute; top: 6px; font-size: 0.95rem; }
.ma-kfg { display: none; width: 30px; height: 30px; border-radius: 50%; background: #7c3aed; color: #fff; font-weight: 700; font-size: 1.1rem; line-height: 30px; text-align: center; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35); margin-bottom: 4px; }
.ma-key.b .ma-kfg { width: 24px; height: 24px; line-height: 24px; font-size: 0.95rem; }
.ma-key.hasfg .ma-kfg { display: block; }
.ma-key.w.down { background: linear-gradient(180deg, #ddd6fe, #c4b5fd); transform: translateY(2px); box-shadow: inset 0 -2px 0 #a78bfa, 0 0 0 1px #94a3b8; }
.ma-key.b.down { background: linear-gradient(180deg, #7c3aed, #4c1d95); transform: translateY(2px); }
.ma-key.w.next { background: linear-gradient(180deg, #fff7d6, #fcd34d); box-shadow: inset 0 -5px 0 #f59e0b, 0 0 0 3px #f59e0b, 0 0 22px rgba(245, 158, 11, 0.8); animation: maGlow 1s ease-in-out infinite; z-index: 1; }
.ma-key.b.next { background: linear-gradient(180deg, #fbbf24, #b45309); box-shadow: 0 0 0 3px #f59e0b, 0 0 22px rgba(245, 158, 11, 0.8); animation: maGlow 1s ease-in-out infinite; }
.ma-key.w.show { background: linear-gradient(180deg, #fce7f3, #f9a8d4); box-shadow: inset 0 -5px 0 #ec4899, 0 0 0 2px #ec4899; }
.ma-key.b.show { background: linear-gradient(180deg, #f472b6, #9d174d); }
.ma-key.w.found { background: linear-gradient(180deg, #d1fae5, #6ee7b7); box-shadow: inset 0 -5px 0 #10b981, 0 0 0 2px #10b981; }
.ma-key.good { animation: maGood .45s ease-out; }
.ma-key.w.good { background: linear-gradient(180deg, #d1fae5, #6ee7b7); }
.ma-key.bad { animation: maShake .4s ease-out; }
.ma-key.w.bad { background: linear-gradient(180deg, #fee2e2, #fca5a5); }
.ma-key.b.bad { background: linear-gradient(180deg, #ef4444, #7f1d1d); }
.ma-key:focus-visible { outline: 3px solid #f59e0b; outline-offset: -3px; z-index: 3; }
@keyframes maGlow { 50% { box-shadow: inset 0 -5px 0 #f59e0b, 0 0 0 4px #fbbf24, 0 0 34px rgba(245, 158, 11, 1); } }
@keyframes maGood { 40% { transform: translateY(3px) scale(1.04); } }
@keyframes maShake { 25%, 75% { transform: translateX(-4px); } 50% { transform: translateX(4px); } }
@keyframes maPop { 0% { transform: scale(1.5); opacity: 0.4; } 100% { transform: scale(1); opacity: 1; } }

/* ── note strip ── */
.ma-strip-wrap { max-height: 360px; overflow-y: auto; border-radius: 18px; scrollbar-width: thin; }
.ma-strip { display: flex; flex-direction: column; gap: 10px; }
.ma-phrase { --pc: var(--primary); border-left: 6px solid var(--pc); border-radius: 14px; padding: 6px 6px 6px 10px; background: var(--ma-soft); }
.ma-ph-label { font-family: var(--font-display); font-size: 0.95rem; margin: 0 0 4px; }
.ma-ph-label b { color: var(--pc); }
.ma-ph-label span { color: var(--text-muted); font-style: italic; }
.ma-bars { display: flex; flex-wrap: wrap; gap: 0; }
.ma-bar { flex: 1 1 105px; display: flex; gap: 4px; padding: 4px 6px; border-right: 3px solid var(--border-hover); min-width: 0; }
.ma-bar:last-child { border-right-width: 6px; border-right-style: double; }
.ma-note { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 18px 2px 4px; min-width: 30px; border-radius: 12px; border: 2px solid transparent; transition: background .12s ease, border-color .12s ease, transform .12s ease; }
.ma-note.short { min-width: 26px; }
.ma-nl { font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; line-height: 1; }
.ma-nl .ma-q { display: none; color: var(--text-faint); }
.ma-fg { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #7c3aed; color: #fff; font-style: normal; font-weight: 700; font-family: var(--font-display); font-size: 0.95rem; }
.ma-fg.ma-fg-none { background: transparent; }
.ma-rb { display: block; width: 100%; height: 10px; padding: 0 2px; }
.ma-rb i { display: block; height: 100%; border-radius: 99px; background: var(--pc, var(--primary)); opacity: 0.85; }
.ma-rb.dotted i { background: linear-gradient(90deg, var(--pc, var(--primary)) 82%, transparent 82%, transparent 88%, var(--pc, var(--primary)) 88%); }
.ma-cnt { display: none; font-size: 0.72rem; color: var(--text-muted); font-weight: 700; }
.ma-counts .ma-cnt { display: block; }
.ma-move { position: absolute; top: 0; left: 2px; white-space: nowrap; font-size: 0.7rem; font-weight: 700; color: #f59e0b; font-family: var(--font-display); z-index: 1; }
[data-theme="light"] .ma-move { color: #b45309; }
.ma-note.next { border-color: #f59e0b; background: rgba(245, 158, 11, 0.18); transform: translateY(-2px); }
.ma-note.now { border-color: #ec4899; background: rgba(236, 72, 153, 0.18); transform: translateY(-2px); }
.ma-note.done { opacity: 0.55; }
.ma-note.done .ma-nl::after { content: ''; }
.ma-note.hit-ok { background: rgba(16, 185, 129, 0.22); border-color: var(--ma-ok); }
.ma-note.hit-early { background: rgba(14, 165, 233, 0.2); border-color: var(--ma-early); }
.ma-note.hit-late { background: rgba(249, 115, 22, 0.2); border-color: var(--ma-late); }
.ma-note.miss { opacity: 0.45; }
.ma-hide .ma-note:not(.done) .ma-real { display: none; }
.ma-hide .ma-note:not(.done) .ma-q { display: inline; }
.ma-hide .ma-note:not(.done) .ma-fg { visibility: hidden; }
.ma-hide .ma-move { display: none; }

/* ── sheet music (abcjs) ── */
.ma-staff-wrap { background: #fff; border-radius: 16px; padding: 6px; color: #111827; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08); overflow-x: auto; }
.ma-staff svg { max-width: 100%; height: auto; }
.ma-staff .abcjs-note.ma-now, .ma-staff .abcjs-note.ma-now * { fill: #db2777; stroke: #db2777; }
.ma-staff .abcjs-note.ma-next, .ma-staff .abcjs-note.ma-next * { fill: #d97706; stroke: #d97706; }
.ma-staff-one { max-width: 320px; align-self: center; width: 100%; }
.ma-staff-fallback { padding: 16px; font-family: var(--font-display); font-size: 1.3rem; text-align: center; }
.ma-caption { margin: 0; text-align: center; font-size: 1.1rem; font-weight: 500; }

/* ── tapper / rhythm ── */
.ma-rhythm { display: flex; gap: 6px; padding: 10px; border-radius: 16px; background: var(--ma-soft); border: 1px solid var(--border-color); }
.ma-rh { display: flex; flex-direction: column; gap: 4px; align-items: stretch; min-width: 22px; padding: 6px 3px; border-radius: 10px; border: 2px solid transparent; transition: background .1s ease, border-color .1s ease; }
.ma-rh-bar { height: 22px; border-radius: 99px; background: var(--ac-ctl); overflow: hidden; }
.ma-rh-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #8b5cf6, #ec4899); }
.ma-rh.rest .ma-rh-bar i { background: repeating-linear-gradient(45deg, var(--border-hover) 0 6px, transparent 6px 12px); }
.ma-rh.dotted .ma-rh-bar i { background: linear-gradient(90deg, #8b5cf6, #ec4899 80%, transparent 80% 86%, #ec4899 86%); }
.ma-rh small { text-align: center; font-family: var(--font-display); font-weight: 700; color: var(--text-muted); }
.ma-rh.now { border-color: #ec4899; background: rgba(236, 72, 153, 0.14); }
.ma-rh.hit-ok { border-color: var(--ma-ok); background: rgba(16, 185, 129, 0.18); }
.ma-rh.hit-early { border-color: var(--ma-early); background: rgba(14, 165, 233, 0.16); }
.ma-rh.hit-late { border-color: var(--ma-late); background: rgba(249, 115, 22, 0.16); }
.ma-rh.miss { opacity: 0.5; }
.ma-words { margin: 0; text-align: center; font-family: var(--font-display); font-weight: 600; color: var(--text-muted); font-size: 1.05rem; }
.ma-pad {
  align-self: center; width: min(260px, 70vw); aspect-ratio: 1.4; border-radius: 40px; border: none; cursor: pointer; touch-action: manipulation;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: #fff;
  background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.35), transparent 45%), linear-gradient(135deg, #f97316, #ec4899);
  box-shadow: 0 10px 0 #9d174d, 0 18px 30px rgba(236, 72, 153, 0.35); transition: transform .06s ease, box-shadow .06s ease; -webkit-tap-highlight-color: transparent;
}
.ma-pad span { font-size: 2.6rem; line-height: 1; }
.ma-pad b { font-family: var(--font-display); font-size: 1.6rem; letter-spacing: 0.08em; }
.ma-pad small { opacity: 0.9; font-size: 0.85rem; }
.ma-pad:active, .ma-pad.hit { transform: translateY(6px); box-shadow: 0 4px 0 #9d174d, 0 8px 18px rgba(236, 72, 153, 0.3); }
.ma-mystery { aspect-ratio: auto; padding: 16px; width: min(320px, 80vw); background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.35), transparent 45%), linear-gradient(135deg, #10b981, #0ea5e9); box-shadow: 0 8px 0 #0f766e, 0 14px 26px rgba(14, 165, 233, 0.3); }
.ma-mystery b { font-size: 1.15rem; letter-spacing: 0; }

/* ── games ── */
.ma-game-score { text-align: center; font-size: 1.6rem; min-height: 1.4em; letter-spacing: 4px; }
.ma-letters { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.ma-letter { min-width: 58px; font-family: var(--font-display); font-weight: 700; }
.ma-quiz-q { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; text-align: center; }
.ma-quiz-visual { width: 100%; }
.ma-diff { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.ma-diff .ma-strip { width: 100%; }
.ma-diff.show .ma-note[data-diff] { border-color: #f59e0b; background: rgba(245, 158, 11, 0.22); animation: maGood .5s ease; }
.ma-hand { position: relative; width: min(320px, 86vw); align-self: center; }
.ma-hand-svg { display: block; width: 100%; height: auto; }
.ma-finger {
  position: absolute; transform: translate(-50%, -50%); width: 54px; height: 54px; border-radius: 50%; cursor: pointer;
  border: 3px dashed #7c3aed; background: rgba(255, 255, 255, 0.85); display: grid; place-items: center; transition: transform .12s ease;
}
.ma-finger span { font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; color: #4c1d95; }
.ma-finger:hover { transform: translate(-50%, -50%) scale(1.1); }
.ma-finger.ok { border-style: solid; border-color: #10b981; background: #d1fae5; }
.ma-finger.no { animation: maFingerNo .4s ease; }
@keyframes maFingerNo { 25%, 75% { transform: translate(-58%, -50%); } 50% { transform: translate(-42%, -50%); } }
.ma-beat-ruler { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 0 12px; }
.ma-beat-ruler span { text-align: center; font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; padding: 4px; border-radius: 12px; background: var(--ac-ctl); transition: background .08s ease, transform .08s ease; }
.ma-beat-ruler span.on { background: var(--primary); color: #fff; transform: scale(1.08); }
.ma-len-card { padding: 10px 12px; border-radius: 18px; border: 1px solid var(--border-color); background: var(--ma-soft); }
.ma-len-card.heard { border-color: rgba(16, 185, 129, 0.55); }
.ma-len-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.ma-len-head b { font-family: var(--font-display); font-size: 1.15rem; }
.ma-len-head small { color: var(--text-muted); font-weight: 600; flex: 1; }
.ma-len-sym { font-size: 1.8rem; width: 44px; text-align: center; }
.ma-len-say { margin: 6px 0 0; text-align: center; font-family: var(--font-display); color: var(--text-muted); }
.ma-inst-grid, .ma-fam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; width: 100%; }
.ma-inst, .ma-fam { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 8px; border-radius: 20px; border: 3px solid var(--border-color); background: var(--ma-soft); cursor: pointer; transition: transform .15s ease, border-color .2s ease; }
.ma-fam { cursor: default; border-color: var(--fc); }
.ma-inst:hover { transform: translateY(-3px); border-color: var(--fc); }
.ma-inst.heard { border-color: var(--fc); background: color-mix(in srgb, var(--fc) 14%, transparent); }
.ma-inst-emo, .ma-fam span { font-size: 2.6rem; line-height: 1; }
.ma-inst b, .ma-fam b { font-family: var(--font-display); font-size: 1.1rem; }
.ma-inst small { color: var(--text-muted); font-weight: 600; }

/* ── tips / breathe / ladder ── */
.ma-tip-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ma-tip { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-radius: 18px; background: var(--ma-soft); border: 1px solid var(--border-color); }
.ma-tip > div { flex: 1 1 200px; min-width: 0; }
.ma-tip b { font-family: var(--font-display); font-size: 1.12rem; }
.ma-tip p { margin: 2px 0 0; color: var(--text-muted); }
.ma-tip-emo { font-size: 2rem; width: 44px; text-align: center; }
.ma-tip-check { min-width: 120px; }
.ma-breathe { align-self: center; width: 110px; height: 110px; border-radius: 50%; display: grid; place-items: center; font-size: 2.4rem; background: radial-gradient(circle, rgba(14, 165, 233, 0.35), rgba(139, 92, 246, 0.2)); border: 3px solid rgba(14, 165, 233, 0.6); }
.ma-breathe.go { animation: maBreathe 8s ease-in-out 2; }
@keyframes maBreathe { 0% { transform: scale(0.7); } 50% { transform: scale(1.25); } 100% { transform: scale(0.7); } }
.ma-rungs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ma-rung { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border-radius: 18px; background: var(--ma-soft); border: 2px solid var(--border-color); font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; }
.ma-rung:nth-child(2) { transform: translateY(-6px); }
.ma-rung:nth-child(3) { transform: translateY(-12px); }
.ma-rung.got { border-color: rgba(250, 204, 21, 0.7); background: linear-gradient(160deg, rgba(250, 204, 21, 0.2), rgba(236, 72, 153, 0.1)); }

/* ── plan page ── */
.ma-plan-hero { margin-bottom: 12px; }
.ma-date { display: flex; flex-direction: column; gap: 4px; font-family: var(--font-display); font-weight: 700; color: #fff; }
.ma-date input { min-height: 44px; padding: 6px 12px; border-radius: 14px; border: 2px solid rgba(255, 255, 255, 0.6); background: rgba(255, 255, 255, 0.92); color: #4c1d95; font-family: var(--font-display); font-size: 1rem; font-weight: 700; }
.ma-plan-tip { margin: 6px 0 14px; padding: 10px 14px; border-radius: 16px; background: rgba(245, 158, 11, 0.1); border: 1px dashed rgba(245, 158, 11, 0.55); font-size: 1rem; }
.ma-plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.ma-plan-day { padding: 14px; border-radius: 24px; background: var(--bg-card); border: 2px solid var(--border-color); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.ma-plan-day.today { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.18); }
.ma-plan-day.past { opacity: 0.85; }
.ma-plan-day header { display: flex; align-items: center; gap: 10px; }
.ma-plan-day header > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ma-plan-day header small { color: var(--text-muted); font-weight: 600; }
.ma-pd-emo { font-size: 2rem; }
.ma-pd-fire { font-size: 1.4rem; }
.ma-plan-day h4 { font-family: var(--font-display); font-size: 1.2rem; margin: 8px 0; }
.ma-plan-day ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ma-task { display: flex; align-items: center; gap: 8px; }
.ma-task-t { flex: 1; min-width: 0; font-weight: 600; font-size: 0.98rem; line-height: 1.3; }
.ma-task.done .ma-task-t { color: var(--text-muted); text-decoration: line-through; }
.ma-check { width: 44px; height: 44px; flex: 0 0 auto; border-radius: 12px; border: 2px solid var(--border-hover); background: var(--ac-ctl); font-size: 1.3rem; cursor: pointer; }
.ma-check:disabled { cursor: default; opacity: 1; }

/* ── practice room ── */
.ma-room { display: flex; flex-direction: column; gap: 12px; }
.ma-room-sub { font-size: 0.55em; color: var(--text-muted); font-weight: 600; margin-left: 6px; }
.ma-room-pick { display: flex; flex-direction: column; gap: 10px; }
.ma-room-stage { --g: linear-gradient(135deg, #f59e0b, #7c3aed); }

/* ── finish ── */
.ma-finish-count { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; }

/* ── challenge pill (sits under the Art Academy's if both are open) ── */
.ac-pill.ma-pill { top: 78px; background: linear-gradient(135deg, #0ea5e9, #6366f1 55%, #a855f7); }

/* ── practice sheet (screen preview) ── */
.ma-sheet-page { display: flex; flex-direction: column; gap: 12px; }
.ma-paper { background: #fff; color: #111827; border-radius: 12px; padding: 18px; box-shadow: 0 18px 40px rgba(0, 0, 0, 0.3); overflow-x: auto; }
.ma-sheet { --pc: #7c3aed; color: #111827; font-family: var(--font-body); min-width: 640px; }
.ma-sheet h1 { font-family: var(--font-display); font-size: 1.9rem; margin: 0; }
.ma-sheet p { margin: 2px 0; }
.ma-sh-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-bottom: 3px solid #7c3aed; padding-bottom: 6px; margin-bottom: 8px; font-size: 0.95rem; }
.ma-sh-who { text-align: right; }
.ma-sh-top { display: flex; gap: 14px; align-items: center; margin-bottom: 6px; }
.ma-sh-kbd { flex: 1 1 60%; color: #111827; }
.ma-sh-kbd .ma-kbd { max-width: 100%; }
.ma-sh-legend { flex: 1 1 40%; display: flex; flex-direction: column; gap: 3px; font-size: 0.85rem; }
.ma-leg { display: flex; align-items: center; gap: 8px; }
.ma-leg-bar { display: inline-block; height: 8px; border-radius: 99px; background: #7c3aed; }
.ma-sheet .ma-phrase { background: #f8fafc; margin-bottom: 6px; }
.ma-sheet .ma-ph-label span { color: #475569; }
.ma-sheet .ma-nl { color: #111827; font-size: 1.5rem; }
.ma-sheet .ma-cnt { color: #64748b; }
.ma-sheet .ma-bar { border-right-color: #94a3b8; }
.ma-sheet .ma-move { color: #b45309; }
.ma-sh-plan { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 0.72rem; table-layout: fixed; }
.ma-sh-plan caption { text-align: left; font-family: var(--font-display); font-weight: 700; font-size: 1rem; padding-bottom: 2px; }
.ma-sh-plan th, .ma-sh-plan td { border: 1.5px solid #94a3b8; padding: 4px; vertical-align: top; text-align: left; }
.ma-sh-plan th { background: #ede9fe; font-family: var(--font-display); font-size: 0.85rem; }
.ma-sh-plan th small { display: block; font-weight: 500; color: #475569; }
.ma-sh-plan td b { display: block; margin-bottom: 2px; }
.ma-sh-box { display: block; line-height: 1.25; margin-top: 2px; }
.ma-sh-foot { margin-top: 6px !important; text-align: center; font-size: 0.8rem; color: #475569; }
#ma-print { display: none; }

/* ── responsive ── */
@media (max-width: 1000px) {
  .ma-santo { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 700px) {
  .ma-santo { padding: 18px 16px; border-radius: 24px; gap: 12px; }
  .ma-santo::after { font-size: 4rem; }
  .ma-week { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ma-bar { flex: 1 1 40%; padding: 4px 3px; }
  .ma-bar:nth-child(2n) { border-right-width: 6px; border-right-style: double; }
  .ma-bar:nth-child(-n+2) { border-bottom: 2px dashed var(--border-color); }
  .ma-piano { height: 190px; }
  .ma-key.b { height: 52%; }
  .ma-key kbd { display: none; }
  .ma-room-pick .ma-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
  .ma-room-pick .ac-chip { flex: 0 0 auto; }
  .ma-kfg { width: 26px; height: 26px; line-height: 26px; font-size: 1rem; }
  .ma-phrase { padding-left: 6px; }
  .ma-nl { font-size: 1.4rem; }
  .ma-strip-wrap { max-height: 300px; }
  .ma-tr-ctl { gap: 6px; }
  .ma-go { min-width: 0; flex: 1 1 100%; }
  .ac-pill.ma-pill { top: auto; bottom: 74px; }
  .ma-plan-grid { grid-template-columns: minmax(0, 1fr); }
  .ma-rungs span { font-size: 0.95rem; }
  .ma-puzzle span { width: 56px; height: 56px; font-size: 1.6rem; }
  .ma-paper { padding: 10px; }
}
@media (hover: none) and (pointer: coarse) {
  .ma-key kbd, .ac-kbd-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .ma-key.next, .ma-key.good, .ma-key.bad, .ma-breathe.go, .counting .ma-cd-num, .ma-diff.show .ma-note[data-diff] { animation: none !important; }
}

/* ── PRINT: only the practice sheet ── */
@media print {
  html.ma-print-mode, html.ma-print-mode body { background: #fff !important; color: #111827 !important; height: auto !important; overflow: visible !important; }
  html.ma-print-mode body > *:not(#ma-print) { display: none !important; }
  html.ma-print-mode #ma-print { display: block !important; }
  html.ma-print-mode .ma-sheet { min-width: 0; font-size: 11pt; }
  html.ma-print-mode .ma-sheet h1 { font-size: 20pt; }
  html.ma-print-mode .ma-strip { gap: 4px; }
  html.ma-print-mode .ma-phrase { break-inside: avoid; border-left-width: 5px; padding: 2px 4px 2px 8px; margin-bottom: 3px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  html.ma-print-mode .ma-bars { flex-wrap: nowrap; }
  html.ma-print-mode .ma-bar { flex: 1 1 0; border-bottom: none; border-right: 2px solid #64748b; padding: 2px 4px; }
  html.ma-print-mode .ma-note { padding-top: 14px; min-width: 22px; }
  html.ma-print-mode .ma-nl { font-size: 17pt; }
  html.ma-print-mode .ma-fg { width: 20px; height: 20px; font-size: 9pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  html.ma-print-mode .ma-rb i, html.ma-print-mode .ma-leg-bar, html.ma-print-mode .ma-sh-plan th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  html.ma-print-mode .ma-move { font-size: 6.5pt; }
  html.ma-print-mode .ma-cnt { display: block; font-size: 6.5pt; }
  html.ma-print-mode .ma-sh-kbd .ma-kbd { max-height: 150px; }
  html.ma-print-mode .ma-sh-plan { font-size: 7.5pt; }
  @page { size: auto; margin: 10mm; }
}
.ma-kbd .ma-kbd-cap { fill: var(--text-main); font-weight: 600; }
.ma-sheet .ma-kbd .ma-kbd-cap, #ma-print .ma-kbd .ma-kbd-cap { fill: #334155; }
