/* Whiteboard Tutor: public lesson library (/learn) */
:root { --ink: #1f2937; --muted: #6b7280; --line: #e5e7eb; --board: #fcfcf9; --brand: #2563eb; --brand-d: #1d4ed8; --hand: "Caveat", "Comic Sans MS", cursive; --ui: "Inter", system-ui, sans-serif; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.learn { margin: 0; font-family: var(--ui); color: var(--ink); background: #eef0f3; line-height: 1.55; min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden; }
a { color: var(--brand); }
img, video { max-width: 100%; }

.ltop { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; background: #111827; color: #fff; flex-wrap: wrap; }
.lbrand { font-weight: 700; font-size: 18px; color: #fff; text-decoration: none; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.lbrand small { font-weight: 500; font-size: 13px; color: #9ca3af; border-left: 1px solid #374151; padding-left: 8px; }
.lbrand .dot { width: 10px; height: 10px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 4px rgba(52,211,153,.25); }
.ltop nav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ltop nav a { color: #e5e7eb; text-decoration: none; font-weight: 600; font-size: 14px; padding: 8px 12px; border-radius: 10px; border: 1px solid #374151; background: #1f2937; white-space: nowrap; }
.ltop nav a:hover { border-color: var(--brand); }
.ltop nav a.cta { background: var(--brand); border-color: var(--brand); color: #fff; }

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 22px 20px 40px; flex: 1; }
.lhero h1 { font: 800 clamp(28px, 4.5vw, 42px)/1.15 var(--ui); margin: 6px 0 6px; letter-spacing: -.02em; }
.lhero p { color: var(--muted); margin: 0 0 14px; font-size: 16px; max-width: 70ch; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin: 6px 0 12px; }
.filters input, .filters select { font: 500 15px var(--ui); padding: 11px 14px; border-radius: 10px; border: 1px solid #d1d5db; background: #fff; color: var(--ink); }
.filters input { flex: 1 1 280px; min-width: 0; }
.filters select { flex: 0 1 170px; }
.filters input:focus, .filters select:focus { outline: 2px solid var(--brand); border-color: transparent; }
.chiprow { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { font: 600 13px var(--ui); padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; text-decoration: none; display: inline-block; }
.chip i { font-style: normal; color: var(--muted); font-weight: 500; margin-left: 3px; }
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip.on i { color: #dbeafe; }
.chiprow.static .chip { cursor: default; }
.chiprow.static a.chip { cursor: pointer; }
.chip.bdgc { background: #eff6ff; border-color: #bfdbfe; color: var(--brand-d); }
.count { color: var(--muted); font-size: 14px; margin: 0 0 12px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.grid.small { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.card { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; text-decoration: none; color: var(--ink); box-shadow: 0 2px 10px rgba(17,24,39,.04); transition: transform .12s, box-shadow .12s, border-color .12s; }
.card:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(17,24,39,.1); border-color: var(--ac, var(--brand)); }
.card[hidden] { display: none; }
.thumb { position: relative; aspect-ratio: 3 / 2; background: #f3f0e4; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .subj { position: absolute; left: 8px; top: 8px; background: rgba(17,24,39,.78); color: #fff; font: 600 11px var(--ui); padding: 3px 8px; border-radius: 999px; }
.ph { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 14px; text-align: center; background: var(--board); background-image: radial-gradient(#e7e5dc 1px, transparent 1px); background-size: 16px 16px; border-bottom: 3px solid var(--ac); }
.ph .ico { font-size: 38px; }
.ph .t { font: 700 22px/1.1 var(--hand); color: #374151; }
.cbody { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.cbody h3 { margin: 0; font: 700 16px/1.3 var(--ui); }
.meta { color: var(--muted); font-size: 12.5px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.bdg { font: 600 11px var(--ui); padding: 3px 8px; border-radius: 6px; background: #f3f4f6; color: #374151; }
.bdg.v { background: #dbeafe; color: #1d4ed8; }
.bdg.s { background: #fce7f3; color: #be185d; }
.bdg.n { background: #dcfce7; color: #15803d; }
.none { text-align: center; color: var(--muted); padding: 40px 0; }

/* lesson page */
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.crumbs a { text-decoration: none; }
.lesson h1 { font: 800 clamp(26px, 4.2vw, 40px)/1.2 var(--ui); margin: 4px 0 10px; letter-spacing: -.02em; }
.hero { display: grid; grid-template-columns: 1fr; gap: 14px; margin: 14px 0; align-items: start; }
.hero.withshort { grid-template-columns: minmax(0, 1fr) 260px; }
.mainmedia { background: #000; border-radius: 14px; overflow: hidden; box-shadow: 0 8px 30px rgba(17,24,39,.12); }
.mainmedia video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; }
.mainmedia .heroimg { display: block; width: 100%; max-height: 460px; object-fit: contain; background: #f3f0e4; }
.mainmedia:not(.isvideo) { background: #f3f0e4; }
.heroph { aspect-ratio: 16 / 9; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 16px; background: var(--board); background-image: radial-gradient(#e7e5dc 1px, transparent 1px); background-size: 22px 22px; border-bottom: 4px solid var(--ac); font-size: 1.2rem; overflow: hidden; }
.heroph .ico { font-size: 56px; }
.shortbox { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 8px; }
.shortlbl { font: 700 11px var(--ui); text-transform: uppercase; letter-spacing: .06em; color: #be185d; padding: 2px 4px 6px; }
.shortbox video { display: block; width: 100%; aspect-ratio: 9 / 16; border-radius: 10px; background: #000; }

.actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 4px 0 18px; }
.btn { display: inline-block; font: 600 15px var(--ui); padding: 10px 18px; border: 1px solid var(--brand); border-radius: 999px; background: var(--brand); color: #fff; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--brand-d); }
.btn.big { font-size: 17px; padding: 13px 24px; box-shadow: 0 6px 20px rgba(37,99,235,.28); }
.btn.ghost { background: #fff; color: var(--brand); }
.btn.ghost:hover { background: #eff6ff; }
.btn:disabled { opacity: .6; cursor: wait; }
.hint { color: var(--muted); font-size: 13.5px; margin: 8px 0 0; }
.actions .hint { margin: 0; max-width: 52ch; }

.cols { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 18px; align-items: start; }
.col-side { position: sticky; top: 14px; display: flex; flex-direction: column; gap: 16px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; margin-bottom: 16px; box-shadow: 0 2px 10px rgba(17,24,39,.04); }
.col-side .panel { margin-bottom: 0; }
.panel h2 { margin: 0 0 10px; font: 700 20px var(--ui); letter-spacing: -.01em; }
.panel.board { background: var(--board); background-image: radial-gradient(#e7e5dc 1px, transparent 1px); background-size: 22px 22px; border-color: #e2e0d6; }
.transcript p { margin: 0 0 12px; font-size: 16.5px; line-height: 1.7; }
.bnotes { list-style: none; margin: 0 0 16px; padding: 10px 14px; background: #fffbea; border-left: 4px solid #facc15; border-radius: 8px; font: 600 24px/1.2 var(--hand); }
.bnotes li { margin: 2px 0; }
.bnotes li::before { content: "✎ "; font-size: 15px; color: #a16207; }
.eq { margin: 6px 0 16px; padding: 10px 14px; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; text-align: center; font-size: 1.25rem; }
.eq.big { background: transparent; border: 0; font-size: 1.7rem; }
.eq code { font-size: 14px; color: var(--muted); }
.eq .katex-display { margin: .2em 0; }
.transcript figure { margin: 6px 0 18px; }
.transcript figure img { display: block; max-width: 100%; max-height: 420px; border-radius: 10px; border: 1px solid var(--line); background: #f3f0e4; margin: 0 auto; }
.transcript figcaption { font-size: 12.5px; color: var(--muted); text-align: center; margin-top: 5px; }
.flowline { margin: 4px 0 16px; padding: 8px 12px; background: #eff6ff; border-radius: 8px; font-size: 14.5px; color: #1e3a8a; }
.flowline b { text-transform: uppercase; font-size: 11px; letter-spacing: .06em; margin-right: 8px; color: #3b82f6; }

.quiz { padding: 14px 0; border-top: 1px solid var(--line); }
.quiz:first-of-type { border-top: 0; padding-top: 0; }
.qq { margin: 0 0 10px; font-size: 16.5px; }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt { text-align: left; font: 500 15.5px var(--ui); padding: 11px 14px; border: 1.5px solid var(--line); background: #fff; border-radius: 10px; cursor: pointer; color: var(--ink); }
.opt:hover:not(:disabled) { border-color: var(--brand); background: #f5f9ff; }
.opt:disabled { cursor: default; }
.opt.right { border-color: #16a34a; background: #dcfce7; color: #14532d; }
.opt.wrong { border-color: #dc2626; background: #fee2e2; color: #7f1d1d; }
.qres { font-weight: 700; margin: 10px 0 2px; }
.qres.ok { color: #15803d; }
.qres.no { color: #b91c1c; }
.qexp { margin: 2px 0 0; color: #374151; }

.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 14.5px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }
.notesbox .btn { margin: 0 6px 6px 0; }
.notesmsg { font-size: 14px; color: var(--muted); }
.more { margin: 12px 0 0; font-weight: 600; }

.lfoot { text-align: center; color: var(--muted); font-size: 13.5px; padding: 14px 20px 26px; }

@media (max-width: 900px) {
  .cols { grid-template-columns: minmax(0, 1fr); }
  .col-side { position: static; order: -1; }
  .hero.withshort { grid-template-columns: minmax(0, 1fr); }
  .shortbox { max-width: 280px; }
}
@media (max-width: 600px) {
  .wrap { padding: 14px 12px 30px; }
  .ltop { padding: 10px 12px; }
  .ltop nav a { padding: 7px 10px; font-size: 13px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .cbody { padding: 9px 10px 11px; }
  .cbody h3 { font-size: 14px; }
  .meta { font-size: 11.5px; }
  .bdg { font-size: 10px; padding: 2px 6px; }
  .badges { gap: 4px; }
  #subjChips { flex-wrap: wrap; gap: 6px; }
  #subjChips .chip { white-space: nowrap; }
  .thumb .subj { font-size: 10px; padding: 2px 6px; }
  .ph .t { font-size: 17px; }
  .panel { padding: 14px 14px; }
  .transcript p { font-size: 16px; }
  .btn.big { width: 100%; text-align: center; }
  .filters select { flex: 1 1 45%; }
  .heroph { font-size: 1rem; }
}

.ph .eq.mini { margin: 2px 0 0; padding: 0; border: 0; background: transparent; font-size: 1.05rem; color: #1f2937; overflow: hidden; max-width: 100%; }
.ph .eq.mini code { font-size: 12px; }
.mainmedia .heroph { border-radius: 0; }
