/* Learn (/learn). Builds on proto.css + home.css (app header). Mobile-first, one column; no tab bar. */

.learn-body .app-header .back { width: 44px; height: 44px; margin-left: -10px; flex: none; display: grid; place-items: center; border-radius: 12px; color: var(--muted); }
.learn-body .page-title { flex: 1; min-width: 0; margin: 0; font-size: 0.95rem; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.learn-body.in-lesson .learn-link { display: none; }
.learn { max-width: 680px; padding-top: 12px; padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
.learn h1 { font-size: 1.6rem; }
.lead { margin-top: 4px; color: var(--ink-2); }

.overall { margin-top: 12px; }
.overall .bar { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.overall .bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--ok); transition: width 0.4s; }
.overall p { margin-top: 4px; font-size: 0.82rem; color: var(--muted); font-weight: 700; }

.next-card { position: relative; display: grid; gap: 2px; margin-top: 14px; padding: 14px 40px 14px 16px; border-radius: var(--radius); background: var(--ink); color: #fff; text-decoration: none; box-shadow: none; }
.next-card .next-label { font-size: 0.75rem; font-weight: 800; color: var(--gold); text-transform: uppercase; letter-spacing: 0.05em; }
.next-card b { font-size: 1.05rem; }
.next-card .next-meta { font-size: 0.82rem; color: #c9cbe0; }
.next-card .next-go { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 1.6rem; color: var(--gold); }
.next-card.all-done { background: var(--teal-soft); color: var(--teal); font-weight: 700; padding-right: 16px; }

#sections { display: grid; gap: 12px; margin-top: 16px; }
.sec { padding: 12px 14px 6px; box-shadow: none; border: 1px solid var(--line); }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.sec-head h2 { font-size: 1.05rem; }
.sec-head .count { font-size: 0.8rem; font-weight: 700; color: var(--muted); }
.lessons { list-style: none; margin: 6px 0 0; padding: 0; }
.lessons li + li { border-top: 1px solid var(--line); }
.lesson-row { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 0; color: inherit; text-decoration: none; }
.lesson-row .num { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--paper-2); font-size: 0.78rem; font-weight: 800; color: var(--ink-2); }
.lesson-row.is-done .num { background: #e5f4e4; color: #2e7d4b; }
.lesson-row .l-title { flex: 1; min-width: 0; font-weight: 700; font-size: 0.92rem; }
.lesson-row .l-meta { flex: none; font-size: 0.75rem; color: var(--muted); font-weight: 700; }
a.lesson-row .l-meta::after { content: ' ›'; }
.lesson-row.soon { color: var(--muted); }
.lesson-row.soon .l-title { font-weight: 600; }
.lesson-row.soon .l-meta { padding: 2px 8px; border-radius: 999px; background: var(--paper-2); }

/* ---- one lesson ---- */
.dots { display: flex; gap: 4px; margin-bottom: 14px; }
.dots span { flex: 1; height: 5px; border-radius: 999px; background: var(--line); }
.dots span.past { background: #f0b48f; }
.dots span.on { background: var(--accent); }
.step-title { font-size: 1.3rem; outline: none; }
.step-text p { margin-top: 6px; color: var(--ink-2); font-size: 1rem; line-height: 1.55; }
.step-text p.q { color: var(--ink); font-weight: 700; font-size: 1.05rem; }
.figs { display: grid; gap: 10px; margin-top: 12px; }
.fig { position: relative; padding: 10px 10px 8px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--ink); overflow-x: auto; }
.fig svg { display: block; width: 100%; height: auto; margin: 0 auto; }
.fig .nt.lit { color: var(--accent) !important; }
.fig .key.lit { fill: #f6c9ad; }
.listen { display: inline-flex; align-items: center; gap: 5px; min-height: 36px; margin-top: 6px; padding: 4px 12px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--card); font-weight: 800; font-size: 0.82rem; color: var(--ink); cursor: pointer; }
.listen svg { width: 12px; color: var(--accent); }
.tap-hint { font-size: 0.78rem; color: var(--muted); }
.tip { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: var(--teal-soft); color: var(--teal); }
.tip p { font-weight: 800; font-size: 1.02rem; line-height: 1.6; }
.tip .mnemonic { margin-top: 4px; font-weight: 600; font-size: 0.88rem; }
.tip .mnemonic span { color: var(--ink-2); }

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.choice { min-height: 52px; padding: 8px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; font-weight: 800; font-size: 1rem; color: var(--ink); cursor: pointer; }
.choice:active { transform: scale(0.98); }
.choice.right { border-color: var(--ok); background: #e5f4e4; color: #2e7d4b; }
.choice.right::after { content: ' ✓'; }
.choice.wrong { border-color: var(--bad); background: #fbe6e6; color: #a32d2d; }
.choice[aria-disabled="true"] { cursor: default; }
.feedback { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--paper-2); color: var(--ink-2); font-size: 0.92rem; }
.feedback.ok { background: #e5f4e4; color: #2e7d4b; }
.feedback.no { background: #fbe6e6; color: #a32d2d; }

.end { margin-top: 6px; }
.score { font-size: 1.05rem; font-weight: 800; color: var(--ok); }
.practice { display: grid; gap: 8px; margin-top: 12px; }
.practice-btn { width: 100%; display: grid; justify-items: start; gap: 0; padding: 10px 14px; text-align: left; min-height: 56px; }
.practice-btn .p-kicker { font-size: 0.72rem; font-weight: 800; color: var(--accent-ink); text-transform: uppercase; letter-spacing: 0.04em; }
.practice-btn.first { border-color: var(--accent); }

.lesson-nav { display: flex; gap: 8px; margin-top: 18px; }
.lesson-nav .btn { flex: 1; min-height: 52px; }
.lesson-nav #prev { flex: 0 0 auto; padding-inline: 18px; }
.missing { padding-top: 40px; text-align: center; }
.missing p { margin: 6px 0 16px; color: var(--ink-2); }

@media (min-width: 900px) {
  .learn { padding-top: 28px; }
  .learn h1 { font-size: 2rem; }
  .learn-body .page-title { flex: none; margin-right: 8px; font-size: 1.05rem; }
}
