/* Navigation and the picture-first chapter pages. Loaded after app.css.
   One top bar on every page; inside a section, a side list of that section's chapters only. */
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------------------------------------------------------------- top bar */
.top { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 16px; padding: 7px 20px; min-height: 60px; background: var(--card); border-bottom: 1px solid var(--line); box-shadow: 0 4px 14px -12px rgba(23, 43, 77, .5); }
.top .brand { padding: 0; flex: none; }
.tnav { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tnav::-webkit-scrollbar { display: none; }
.tnav a { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 13px 5px; border-radius: 10px; text-decoration: none; color: var(--muted); font-size: 12.5px; font-weight: 600; white-space: nowrap; border-bottom: 3px solid transparent; transition: color .12s, background-color .12s; }
.tnav a .ic { width: 22px; height: 22px; }
.tnav a:hover { color: var(--ink); background: var(--pen-soft); }
.tnav a.on { color: var(--pen); background: var(--pen-soft); border-bottom-color: var(--pen); }
.tright { display: flex; align-items: center; gap: 10px; flex: none; }
.tright .days { font-size: 13px; color: var(--muted); white-space: nowrap; }
.tright .days b { font: 800 20px var(--f-head); color: var(--ink); margin-right: 2px; }
.ibtn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; display: grid; place-items: center; }
.ibtn:hover { background: var(--pen-soft); }

/* ---------------------------------------------------------------- shell and side list */
.shell { grid-template-columns: 268px minmax(0, 1fr); min-height: calc(100vh - 60px); }
.shell.norail { grid-template-columns: minmax(0, 1fr); }
.shell.norail .rail { display: none; }
.rail { top: 60px; height: calc(100vh - 60px); padding: 14px 12px 30px; }
.railhd { display: flex; align-items: center; gap: 10px; padding: 8px 10px 12px; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.railhd b { font: 800 15.5px var(--f-head); line-height: 1.2; }
.railhd .ic { width: 24px; height: 24px; color: var(--pen); }
.rail .grp { margin: 14px 0 4px; padding: 0 10px; font-weight: 700; font-size: 12.5px; color: var(--muted); }
.rail .ch { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: 14.5px; }
.rail .ch .ic { width: 18px; height: 18px; color: var(--muted); }
.rail .ch .tt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail .ch .pb { width: 30px; height: 5px; border-radius: 3px; background: var(--grid); overflow: hidden; flex: none; }
.rail .ch .pb i { display: block; height: 100%; background: var(--green); }
.rail .ch:hover { background: var(--pen-soft); }
.rail .ch.on { background: var(--pen-soft); color: var(--pen); font-weight: 700; }
.rail .ch.on .ic { color: var(--pen); }

/* ---------------------------------------------------------------- where am I */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); margin-bottom: 12px; }
.crumbs a { color: var(--pen); text-decoration: none; font-weight: 600; }
.crumbs a:hover { text-decoration: underline; }
.crumbs i { font-style: normal; opacity: .6; }
.chh { align-items: center; justify-content: flex-start; }
.chh > div:nth-child(2) { flex: 1; min-width: 200px; }
.chico { width: 62px; height: 62px; border-radius: 16px; background: var(--pen-soft); color: var(--pen); display: grid; place-items: center; flex: none; }
.chico .ic { width: 34px; height: 34px; }
.chico.big { width: 74px; height: 74px; } .chico.big .ic { width: 42px; height: 42px; }
.chnav { display: flex; gap: 8px; flex-wrap: wrap; }
.chnav a { max-width: 190px; } .chnav a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chnav .ic { width: 16px; height: 16px; }
.tabs.steps3 { gap: 8px; border-bottom: 0; margin-bottom: 20px; flex-wrap: wrap; }
.tabs.steps3 a { display: flex; align-items: center; gap: 8px; padding: 9px 16px 9px 10px; border: 1.5px solid var(--line); border-radius: 99px; margin: 0; background: var(--card); color: var(--muted); }
.tabs.steps3 a .sn { width: 24px; height: 24px; border-radius: 50%; background: var(--grid); color: var(--ink); display: grid; place-items: center; font: 800 13px var(--f-head); }
.tabs.steps3 a .ic { width: 18px; height: 18px; }
.tabs.steps3 a.on { border-color: var(--pen); background: var(--pen); color: #fff; }
.tabs.steps3 a.on .sn { background: #fff; color: var(--pen); }
:root[data-theme="dark"] .tabs.steps3 a.on { color: #0c1730; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tabs.steps3 a.on { color: #0c1730; } }

/* ---------------------------------------------------------------- section page: chapter tiles */
.parth { font-size: 19px; margin: 26px 0 10px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 12px; }
.tile { display: flex; flex-direction: column; gap: 4px; padding: 16px 16px 14px; text-decoration: none; color: var(--ink); min-height: 150px; }
.tile:hover { border-color: var(--pen); }
.tile .tico { width: 48px; height: 48px; border-radius: 13px; background: var(--pen-soft); color: var(--pen); display: grid; place-items: center; margin-bottom: 6px; }
.tile .tico .ic { width: 27px; height: 27px; }
.tile b { font: 800 16.5px var(--f-head); line-height: 1.2; }
.tile .muted { font-size: 13.5px; }
.tile .tbar { margin-top: auto; height: 6px; border-radius: 3px; background: var(--grid); overflow: hidden; }
.tile .tbar i { display: block; height: 100%; background: var(--green); border-radius: 3px; }
.tile.last { border-color: var(--hl); border-width: 2px; }
.tile .lastt { position: absolute; top: 8px; right: 10px; font-size: 15px; }
.door { text-decoration: none; color: var(--ink); }
.door:hover { border-color: var(--pen); }
.door b { display: flex; align-items: center; gap: 8px; } .door b .ic { color: var(--pen); }
.savebox { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- notes as a deck */
.deckbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; scroll-margin-top: 72px; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pillb { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; font-size: 14px; font-weight: 600; }
.pillb .ic { width: 17px; height: 17px; color: var(--muted); }
.pillb:hover { border-color: var(--pen); }
.pillb.on { background: var(--ink); color: var(--paper); border-color: var(--ink); } .pillb.on .ic { color: var(--hl); }
.deck:not(.all) .slide { display: none; }
.deck:not(.all) .slide.on { display: block; }
.slide { background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 24px 28px; scroll-margin-top: 72px; }
.deck.all .slide { margin-bottom: 20px; } .deck.all .slidenav, .deck.all .slide .cnt { display: none; }
.slide.tr { border-left: 4px solid var(--red); }
.slidehd { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.slidehd h2 { font-size: 25px; flex: 1; }
.slidehd .shi { width: 42px; height: 42px; border-radius: 12px; background: var(--pen-soft); color: var(--pen); display: grid; place-items: center; flex: none; }
.slide.sc .shi { background: var(--hl); color: var(--hl-ink); } .slide.tr .shi { background: var(--red-soft); color: var(--red); }
.slide > .rt { max-width: 78ch; font-size: 17px; }
.slide figure.fig { max-width: 640px; background: var(--paper); }
.slide .labhost { margin-top: 18px; }
.slidenav { display: flex; justify-content: space-between; gap: 10px; margin-top: 22px; padding-top: 16px; border-top: 1px dashed var(--line); }
.slidenav .ic { width: 17px; height: 17px; }

/* pictograph: one square per question */
.picto { margin: 0 0 18px; padding: 14px 16px 12px; border-radius: 14px; background: var(--paper); border: 1px solid var(--line); max-width: 640px; }
.pth { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.pth b { font: 800 16px var(--f-head); } .pth .muted { font-size: 13px; }
.ptg { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; align-items: end; }
.ptc { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.pts { display: flex; flex-direction: column-reverse; flex-wrap: wrap; align-content: center; gap: 3px; height: 84px; }
.pts i, .ptk i { width: 12px; height: 12px; border-radius: 3px; display: block; }
.pts i.E, .ptk i.E { background: var(--green); } .pts i.M, .ptk i.M { background: #e0a100; } .pts i.H, .ptk i.H { background: var(--red); }
.ptc b { font: 800 14px var(--f-head); } .ptc span { font-size: 12px; color: var(--muted); }
.ptk { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 12.5px; } .ptk span { display: inline-flex; align-items: center; gap: 5px; }

/* shortcuts and traps: cards you open one at a time */
.points { display: grid; gap: 9px; max-width: 80ch; }
.point { border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); }
.point > summary { display: flex; align-items: center; gap: 12px; padding: 11px 14px; cursor: pointer; list-style: none; font-size: 17px; font-weight: 700; }
.point > summary::-webkit-details-marker { display: none; }
.point > summary::after { content: "+"; margin-left: auto; font: 400 22px var(--f-head); color: var(--muted); }
.point[open] > summary::after { content: "−"; }
.point .pn { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font: 800 14px var(--f-head); flex: none; transform: rotate(-4deg); }
.points.sc .pn { background: var(--hl); color: var(--hl-ink); } .points.tr .pn { background: var(--red-soft); color: var(--red); }
.points.sc .point[open] { border-color: var(--hl); } .points.tr .point[open] { border-color: var(--red); }
.points.sc .point[open] .ptt { background: linear-gradient(100deg, transparent .2em, var(--hl) .3em, var(--hl) calc(100% - .3em), transparent calc(100% - .2em)) 0 62%/100% 70% no-repeat; color: var(--hl-ink); padding: 0 .3em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.point .in { padding: 0 16px 14px 54px; font-size: 16.5px; line-height: 1.7; }

@media (prefers-reduced-motion: no-preference) {
  .deck:not(.all) .slide.on { animation: slidein .3s cubic-bezier(.2, .7, .2, 1) both; }
  @keyframes slidein { from { opacity: 0; transform: translateY(10px); } }
  .deck[data-dir="fwd"]:not(.all) .slide.on { animation: turnfwd .28s cubic-bezier(.2, .7, .2, 1) both; }
  .deck[data-dir="back"]:not(.all) .slide.on { animation: turnback .28s cubic-bezier(.2, .7, .2, 1) both; }
  @keyframes turnfwd { from { opacity: 0; transform: translateX(48px); } }
  @keyframes turnback { from { opacity: 0; transform: translateX(-48px); } }
  .pts i { animation: popsq .35s cubic-bezier(.2, 1.6, .4, 1) both; animation-delay: calc(var(--k) * 45ms + 150ms); }
  @keyframes popsq { from { transform: scale(0); } }
  .point[open] .in { animation: rise .22s ease-out both; }
  #main.enter .tiles .tile { animation: deal .42s cubic-bezier(.2, .9, .3, 1.15) both; transform-origin: 50% 100%; }
  .tile .tbar i, .rail .ch .pb i { transition: width .5s ease-out; }
}

/* ---------------------------------------------------------------- small screens */
@media (max-width: 980px) {
  .shell, .shell.norail { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .top { gap: 8px; padding: 6px 10px; }
  .top .brand span, .tright .days { display: none; }
  .tnav a { padding: 6px 9px 5px; }
  .slide { padding: 18px 16px; } .slidehd h2 { font-size: 21px; }
  .chnav a span { display: none; }
  .point .in { padding-left: 16px; }
}
@media (max-width: 560px) { .top .brand { display: none; } .chico { width: 48px; height: 48px; } .chico .ic { width: 26px; height: 26px; } .ptg { gap: 2px; } }
@media print { .top { display: none; } }

/* entrance animations lean cards in 3D; never let that cause a sideways scrollbar */
main { overflow-x: clip; }

/* ---------------------------------------------------------------- chapter route: one path, learn → practice → revise → next chapter */
.route { margin: 2px 0 18px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: thin; -webkit-mask: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 28px), transparent); mask: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 28px), transparent); }
.route ol { padding: 0 24px 0 6px !important; }
.route ol { display: flex; align-items: center; list-style: none; margin: 0; padding: 0; min-width: max-content; }
.rs { display: flex; align-items: center; }
.rs + .rs::before { content: ""; flex: none; width: 18px; height: 2px; background: var(--line); }
.rs.done + .rs::before { background: var(--green); }
.rs a { display: flex; align-items: center; gap: 8px; padding: 7px 13px 7px 8px; border: 1.5px solid var(--line); border-radius: 99px; background: var(--card); color: var(--ink); font-weight: 700; font-size: 14px; line-height: 1.15; white-space: nowrap; text-decoration: none; }
.rs a:hover { border-color: var(--pen); }
.rs a:focus-visible { outline: 3px solid var(--hl); outline-offset: 2px; }
.rs .dot { flex: none; display: grid; place-items: center; width: 20px; height: 20px; border: 2px solid var(--line); border-radius: 50%; box-sizing: border-box; font-size: 12px; font-weight: 900; }
.rs .dot .ic { width: 13px; height: 13px; }
.rs.done .dot { background: var(--green); border-color: var(--green); color: #fff; }
.rs .n { margin-left: 3px; color: var(--muted); font-weight: 600; }
.rs .rl small { display: block; font-size: 11px; font-weight: 600; color: var(--muted); }
.rs.end a { border-style: dashed; }
.rs.on a { background: var(--pen); border-color: var(--pen); color: #fff; }
.rs.on .dot { background: #fff; border-color: #fff; color: var(--green); }
.rs.on .n, .rs.on .rl small { color: inherit; opacity: .8; }
:root[data-theme="dark"] .rs.on a { color: #0c1730; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .rs.on a { color: #0c1730; } }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
#cont { position: fixed; left: 50%; bottom: 16px; z-index: 43; transform: translateX(-50%); }
#cont .btn { display: flex; align-items: center; gap: 8px; padding: 12px 22px; font-size: 16px; white-space: nowrap; box-shadow: 0 8px 22px -8px rgba(10, 20, 40, .65); }
body.has-cont #main { padding-bottom: 96px; }
@media (max-width: 700px) {
  #cont { left: 16px; right: 16px; bottom: 76px; transform: none; }
  #cont .btn { width: 100%; justify-content: center; white-space: normal; }
  body.has-cont #main { padding-bottom: 150px; }
}

/* ---------------------------------------------------------------- slim route pinned under the top menu once the full row scrolls away */
#rmini { position: fixed; left: 0; right: 0; top: 0; z-index: 39; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 12px; background: var(--card); border-bottom: 1px solid var(--line); box-shadow: 0 8px 18px -12px rgba(10, 20, 40, .6); transform: translateY(-110%); visibility: hidden; transition: transform .2s ease, visibility 0s .2s; }
#rmini.on { transform: none; visibility: visible; transition: transform .2s ease; }
#rmini ol { display: flex; align-items: center; list-style: none; margin: 0; padding: 0; min-width: 0; overflow: hidden; }
#rmini .rs a { padding: 4px 11px 4px 6px; font-size: 13px; }
#rmini .rs .dot { width: 17px; height: 17px; font-size: 10px; }
#rmini .rs + .rs::before { width: 12px; }
#rmini .ra { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--line); color: var(--ink); }
#rmini .ra:hover { border-color: var(--pen); }
#rmini .ra .ic { width: 16px; height: 16px; }
#rmini span.ra { border-color: transparent; }
@media (max-width: 700px) { #rmini .rs:not(.on) .rl { display: none; } #rmini .rs:not(.on) a { padding: 4px; } }
@media (prefers-reduced-motion: reduce) { #rmini, #rmini.on { transition: none; } }

/* ---------------------------------------------------------------- solution tabs */
.soltabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 16px 0 12px; padding: 4px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--card); }
.stab { flex: 1 1 auto; display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 7px 14px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); font: 700 14.5px var(--f-head, system-ui); cursor: pointer; position: relative; }
.stab .ic { width: 17px; height: 17px; color: var(--muted); }
.stab .n { font-weight: 600; color: var(--muted); font-size: 13px; }
.stab:hover { background: var(--grid); }
.stab:focus-visible { outline: 3px solid var(--hl); outline-offset: 1px; }
.stab.on { background: var(--pen); color: #fff; } .stab.on .ic, .stab.on .n { color: inherit; opacity: .85; }
:root[data-theme="dark"] .stab.on { color: #0c1730; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .stab.on { color: #0c1730; } }
.stab .rdot { width: 8px; height: 8px; border-radius: 50%; background: var(--red, #d64545); }
.spane > .fast:first-child { margin-top: 18px; }
.spane > .duo:first-child { margin-top: 4px; }
@media (max-width: 560px) { .stab { padding: 7px 9px; font-size: 13.5px; } .stab .n { display: none; } }

/* fastest route: no highlighter over the maths; a yellow bar and bold text instead, so fractions stay readable */
.fast .hlr { background: none !important; animation: none !important; font-weight: 700; }
.fast ol.moves .mv { padding: 5px 10px 5px 42px; border-radius: 8px; }
.fast ol.moves .mv::before { left: 9px; top: 9px; }
.fast ol.moves .mv:has(.mvt.hlr), .fast .rt p:has(> .hlr) { box-shadow: inset 4px 0 0 var(--hl); background: color-mix(in srgb, var(--hl) 12%, transparent); }
.fast .rt p:has(> .hlr) { padding: 4px 10px 4px 14px; border-radius: 8px; }
.spane .sol-h h3 { display: none; }
.spane .sol-h { justify-content: flex-end; margin-top: 0; }
.spane .sol-h:not(:has(.allsteps)) { display: none; }
.fast .hlr { color: inherit !important; }
/* the Continue bar already says "Next question" / "Continue: Revise": no second copy under the card */
body.has-cont .nextbar #nxt, body.has-cont .nextbar > a.btn { display: none; }
