/* «Академія»: panel, lesson / trainer dialogs, mascot «Ґніт», lesson schematics. Tokens only, neutral greys;
   colour is kept for meaning: green = done / right, amber = careful, red = stop / wrong. */

#academyPanel { overflow: auto; }
.ac { display: grid; gap: var(--s3); padding: var(--s3); font-size: var(--fs-xs); color: var(--text); }
.ac-muted { margin: 0; color: var(--muted); line-height: 1.45; font-size: var(--fs-2xs); }
.ac-num { font-family: var(--mono); font-weight: 600; }
.ac-tag { display: inline-flex; align-items: center; height: 18px; padding: 0 7px; border: 1px solid var(--border-strong); border-radius: var(--r-pill);
  color: var(--muted); font: 500 var(--fs-2xs)/1 var(--sans); white-space: nowrap; }
.ac .icon { width: 14px; height: 14px; flex: none; }

/* me: mascot + level + XP + streak */
.ac-me { display: flex; align-items: center; gap: var(--s3); }
.ac-ma { flex: none; display: inline-flex; }
.ac-me-main { display: grid; gap: 6px; flex: 1; min-width: 0; }
.ac-lvl { display: flex; align-items: baseline; gap: 6px; font-size: var(--fs-sm); }
.ac-lvl .ac-num { font-size: var(--fs-xl); line-height: 1; }
.ac-xp { margin-left: auto; color: var(--muted); font: 500 var(--fs-2xs) var(--mono); }
.ac-bar { height: 6px; border-radius: var(--r-pill); background: var(--border); overflow: hidden; }
.ac-bar > i { display: block; height: 100%; border-radius: inherit; background: var(--text); transition: width var(--dur-slow) var(--ease); }
.ac-streak { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: var(--fs-2xs); }
.ac-streak .icon { color: var(--warning); width: 13px; height: 13px; }
.ac-streak .ac-num { color: var(--text); }
.ac-dim { opacity: .7; margin-left: 4px; }
.ac-streak .ac-num.ac-dim { margin-left: 0; color: var(--muted); }
.ac-say-b { margin-left: .3em; font-weight: 600; }
.ac-say { margin: 0; padding: var(--s2) var(--s3); border-radius: var(--r-md); background: var(--panel2); line-height: 1.45; color: var(--text); }

/* cards */
.ac-card { display: grid; gap: var(--s2); padding-top: var(--s3); border-top: 1px solid var(--border); }
.ac-h { display: flex; align-items: center; gap: 6px; margin: 0; font: 600 var(--fs-sm)/1.3 var(--sans); }
.ac-h .icon { color: var(--muted); }
.ac-h .ac-tag { margin-left: auto; }
.ac-qtext { margin: 0; line-height: 1.45; }
.ac-qrow { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.ac-qn { font: 600 var(--fs-2xs) var(--mono); color: var(--muted); }
.ac-ok { display: inline-flex; align-items: center; gap: 5px; color: var(--green); font-weight: 500; }

/* path map: every lesson is a small candle that fills when done */
.ac-lv { display: grid; gap: 6px; padding: var(--s2); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--panel2); }
.ac-lv.is-soon { background: transparent; border-style: dashed; }
.ac-lv.is-soon b, .ac-lv.is-soon .ac-topics { color: var(--muted); }
.ac-lv-head { display: flex; align-items: center; gap: var(--s2); }
.ac-lv-head > :last-child { margin-left: auto; }
.ac-lv-n { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--border-strong);
  font: 600 var(--fs-2xs) var(--mono); color: var(--muted); }
.ac-lv:not(.is-soon) .ac-lv-n { background: var(--text); color: var(--bg); border-color: var(--text); }
.ac-topics { margin: 0; color: var(--muted); font-size: var(--fs-2xs); line-height: 1.4; }
.ac-lessons { list-style: none; margin: 2px 0 0; padding: 0; display: grid; gap: 2px; position: relative; }
.ac-lesson { display: flex; align-items: center; gap: var(--s2); width: 100%; min-height: 30px; padding: 4px 6px; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--text); font: 500 var(--fs-xs)/1.3 var(--sans); text-align: left; cursor: pointer; }
.ac-lesson:hover { background: var(--hover, #ffffff0d); }
.ac-lesson:focus-visible { outline: 2px solid #9A9A9A; outline-offset: 1px; }
.ac-lt { flex: 1; min-width: 0; }
.ac-min { color: var(--muted); font: 500 var(--fs-2xs) var(--mono); white-space: nowrap; }
.ac-lesson .icon { color: var(--green); }
.ac-cdl { position: relative; flex: none; width: 8px; height: 14px; border: 1.5px solid var(--border-strong); border-radius: 2px; }
.ac-cdl::before, .ac-cdl::after { content: ""; position: absolute; left: 50%; width: 1.5px; height: 4px; margin-left: -.75px; background: var(--border-strong); }
.ac-cdl::before { top: -5.5px; } .ac-cdl::after { bottom: -5.5px; }
.ac-lesson.is-next .ac-cdl { border-color: var(--text); }
.ac-lesson.is-next .ac-cdl::before, .ac-lesson.is-next .ac-cdl::after { background: var(--text); }
.ac-lesson.is-done .ac-cdl { background: var(--green); border-color: var(--green); }
.ac-lesson.is-done .ac-cdl::before, .ac-lesson.is-done .ac-cdl::after { background: var(--green); }
.ac-lesson.is-done .ac-lt { color: var(--muted); }

/* trainers */
.ac-tr { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.ac-tr b { font-weight: 600; }
.ac-tr .ac-muted { margin-top: 2px; }
.ac-tr .btn { flex: none; }
.ac-tr:has(.ac-tag) b { color: var(--muted); font-weight: 500; }

/* badges */
.ac-bgrid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ac-badge { display: grid; grid-template-columns: auto 1fr; column-gap: 6px; row-gap: 2px; align-content: start; padding: 6px 8px;
  border: 1px solid var(--border); border-radius: var(--r-sm); color: var(--muted); }
.ac-badge .icon { grid-row: span 2; margin-top: 1px; }
.ac-badge b { font-weight: 600; font-size: var(--fs-2xs); line-height: 1.3; }
.ac-badge span { font-size: 10px; line-height: 1.35; }
.ac-badge.is-got { border-color: var(--green); color: var(--text); }
.ac-badge.is-got .icon { color: var(--green); }
.ac-skip { display: grid; gap: 6px; justify-items: start; padding-top: var(--s3); border-top: 1px solid var(--border); }
p.ac-skip { display: flex; align-items: center; gap: 6px; }
.ac-disc { margin: 0; color: var(--soft); font-size: var(--fs-2xs); }

/* soft hint chip in the demo ticket */
.ac-hint { display: flex; align-items: center; gap: 6px; margin: var(--s2) var(--s3) 0; padding: 3px 4px 3px 8px; border: 1px solid var(--border);
  border-radius: var(--r-pill); background: var(--panel2); font-size: var(--fs-2xs); color: var(--muted); }
.ac-hint-ma { display: inline-flex; flex: none; }
.ac-hint-go { flex: 1; min-width: 0; padding: 2px 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.ac-hint-go b { color: var(--text); font-weight: 500; }
.ac-hint-go:hover b { text-decoration: underline; text-underline-offset: 2px; }
.ac-hint-x { width: 22px; height: 22px; flex: none; }
.ac-hint-x .icon { width: 12px; height: 12px; }

/* ---------- dialogs ---------- */
dialog.ac-dlg { width: min(560px, 96vw); max-height: min(760px, 94vh); padding: 0; overflow: auto; }
.ac-dlg-head { padding: var(--s3) var(--s5) var(--s3) var(--s4); }
.ac-dlg-title { display: flex; align-items: center; gap: var(--s2); margin: 0; font: 600 var(--fs-lg)/1.3 var(--sans); }
.ac-dlg-body { display: grid; gap: var(--s3); padding: var(--s4); font-size: var(--fs-sm); }
.ac-foot { display: flex; justify-content: flex-end; gap: var(--s2); }
.ac-dots { display: flex; gap: 4px; }
.ac-dots i { flex: 1; height: 3px; border-radius: 2px; background: var(--border-strong); }
.ac-dots i.on { background: var(--text); }
.ac-dots i.is-quiz.on { background: var(--green); }
.ac-cardview { display: grid; gap: var(--s3); min-height: 230px; align-content: start; }
.ac-art { display: block; padding: var(--s2); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg); }
.ac-art-ma { display: flex; justify-content: center; padding: var(--s3) 0; }
.ac-text { margin: 0; font-size: var(--fs-md); line-height: 1.55; max-width: 62ch; }
.ac-step { margin: 0; color: var(--muted); font-size: var(--fs-2xs); }
.ac-step b { font-family: var(--mono); font-weight: 500; }
.ac-q { margin: 0; font-size: var(--fs-md); font-weight: 600; line-height: 1.45; }
.ac-opts { display: grid; gap: 6px; }
.ac-opts-grid { grid-template-columns: 1fr 1fr; }
.ac-opt { display: flex; align-items: center; gap: var(--s2); min-height: 40px; padding: 8px var(--s3); border: 1px solid var(--border-strong); border-radius: var(--r-md);
  background: var(--panel2); color: var(--text); font: 500 var(--fs-sm)/1.35 var(--sans); text-align: left; cursor: pointer; }
.ac-opt:hover:not(:disabled) { border-color: var(--muted); }
.ac-opt:focus-visible { outline: 2px solid #9A9A9A; outline-offset: 1px; }
.ac-opt:disabled { cursor: default; opacity: .6; }
.ac-opt.is-right { opacity: 1; border-color: var(--green); box-shadow: inset 3px 0 0 var(--green); }
.ac-opt.is-wrong { opacity: 1; border-color: var(--warning); box-shadow: inset 3px 0 0 var(--warning); }
.ac-key { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 4px; background: var(--border); color: var(--muted); font: 600 10px var(--mono); }
.ac-opts-grid .ac-opt { font-family: var(--mono); }
.ac-why { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3); border-radius: var(--r-md); background: var(--panel2); }
.ac-why[hidden] { display: none; }
.ac-why-ma { flex: none; display: inline-flex; }
.ac-why p { margin: 4px 0 0; line-height: 1.5; color: var(--text); }
.ac-result { display: grid; justify-items: center; gap: var(--s2); text-align: center; padding: var(--s3) 0; }
.ac-result p { margin: 0; max-width: 46ch; line-height: 1.5; }
.ac-big { font-size: var(--fs-lg); }
.ac-big b { font-family: var(--mono); }
.ac-gain { color: var(--green); font: 600 var(--fs-md) var(--mono); }

/* «Що далі?» */
.ac-segs { display: inline-flex; gap: 4px; }
.ac-seg { height: var(--h-sm); padding: 0 var(--s3); border: 1px solid var(--border-strong); border-radius: var(--r-pill); background: transparent;
  color: var(--muted); font: 500 var(--fs-xs) var(--sans); cursor: pointer; }
.ac-seg[aria-pressed="true"] { color: var(--bg); background: var(--text); border-color: var(--text); }
.ac-seg-stop[aria-pressed="true"] { background: var(--red); border-color: var(--red); color: #fff; }
.ac-seg-target[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #fff; }
.ac-chart { display: block; width: 100%; height: auto; aspect-ratio: 2 / 1; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--chart-bg, #000); touch-action: none; cursor: crosshair; user-select: none; }
.cz-fut { fill: #ffffff08; }
.cz-q { fill: var(--muted); font: 600 28px var(--mono); }
.cz-cut { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 4; }
.cz-grid { stroke: var(--rule, #1a1a1a); stroke-width: 1; }
.cz-ax { fill: var(--muted); font: 10px var(--mono); }
.cz-up { stroke: var(--green); fill: var(--green); } .cz-dn { stroke: var(--red); fill: var(--red); }
.cz-up path, .cz-dn path { stroke-width: 1; }
.cz-new { opacity: .95; }
.cz-line path { stroke-width: 1.5; stroke-dasharray: 5 4; }
.cz-line text { font: 600 10px var(--mono); }
.cz-en path { stroke: var(--text); stroke-dasharray: none; } .cz-en rect { fill: var(--text); } .cz-en text { fill: var(--bg); }
.cz-sl path { stroke: var(--red); } .cz-sl rect { fill: var(--red); } .cz-sl text { fill: #fff; }
.cz-tp path { stroke: var(--green); } .cz-tp rect { fill: var(--green); } .cz-tp text { fill: #fff; }
.cz-mk { fill: var(--bg); stroke: var(--text); stroke-width: 2; }
.cz-mk-x { stroke: var(--warning); }
.ac-wn-ctl { display: grid; gap: var(--s2); }
.ac-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.ac-field { display: grid; gap: 3px; font-size: var(--fs-2xs); color: var(--muted); }
.ac-in { width: 100%; min-width: 0; height: var(--h-sm); padding: 0 6px; border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--panel2); color: var(--text); font: 500 var(--fs-xs) var(--mono); }
.ac-live { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; margin: 0; color: var(--muted); font-size: var(--fs-xs); }
.ac-live b { color: var(--text); font: 600 var(--fs-xs) var(--mono); margin-right: 6px; }
.ac-wn-res { display: grid; gap: var(--s2); padding-top: var(--s3); border-top: 1px solid var(--border); }
.ac-res-head { display: flex; align-items: center; gap: var(--s3); }
.ac-res-head .ac-art-ma { padding: 0; }
.ac-res-head p { margin: 0; }
.ac-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ac-checks li { display: flex; align-items: center; gap: 6px; }
.ac-checks li b { margin-left: auto; font-family: var(--mono); font-weight: 600; }
.ac-checks .is-ok .icon { color: var(--green); } .ac-checks .is-half .icon { color: var(--warning); } .ac-checks .is-bad .icon { color: var(--red); }
.ac-out { margin: 0; }
.ac-up { color: var(--green); font-family: var(--mono); } .ac-dn { color: var(--red); font-family: var(--mono); }
.ac-reveal { margin: 0; color: var(--muted); font: 500 var(--fs-2xs) var(--mono); }

/* «Порахуй ризик» */
.ac-rd-top { display: flex; align-items: center; justify-content: space-between; }
.ac-sec { font: 600 var(--fs-lg) var(--mono); }
.ac-timer { height: 4px; border-radius: 2px; background: var(--border); overflow: hidden; }
.ac-timer > i { display: block; height: 100%; width: 100%; background: var(--warning); }
.ac-given { display: grid; grid-template-columns: repeat(5, auto); justify-content: start; gap: 2px var(--s4); margin: 0; }
.ac-given dt { grid-row: 1; color: var(--muted); font-size: var(--fs-2xs); }
.ac-given dd { grid-row: 2; margin: 0; font: 600 var(--fs-md) var(--mono); }
.ac-formula { font-family: var(--mono); white-space: nowrap; }

/* «Знайди рівень», «Витримай стоп», «Новина вийшла!» (same chart as «Що далі?») */
.cz-lv path { stroke: var(--text); } .cz-lv rect { fill: var(--text); } .cz-lv text { fill: var(--bg); }
.cz-lv-ok path { stroke: var(--green); stroke-dasharray: none; } .cz-lv-ok rect { fill: var(--green); } .cz-lv-ok text { fill: #fff; }
.cz-lv-half path { stroke: var(--warning); } .cz-lv-half rect { fill: var(--warning); } .cz-lv-half text { fill: #000; }
.cz-lv-miss path { stroke: var(--muted); } .cz-lv-miss rect { fill: var(--muted); } .cz-lv-miss text { fill: var(--bg); }
.cz-zone rect { fill: #ffffff1f; stroke: #ffffff40; stroke-width: 1; }
.cz-zone text { fill: var(--text); font: 600 10px var(--mono); }
.cz-sharp rect { stroke: var(--warning); stroke-width: 2; }
.cz-old { opacity: .35; }
.cz-sl2 path { stroke: var(--warning); } .cz-sl2 rect { fill: var(--warning); } .cz-sl2 text { fill: #000; }
.cz-ev path { stroke: var(--warning); stroke-width: 1; stroke-dasharray: 3 3; fill: none; }
.cz-ev circle { fill: var(--bg); stroke: var(--warning); stroke-width: 1.5; }
.cz-ev .cz-ev-h { stroke-dasharray: none; stroke-width: 1.5; stroke-linecap: round; }
.ac-lv-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px var(--s3); min-height: 26px; }
.ac-lines { display: flex; flex-wrap: wrap; gap: 6px; }
.ac-chip { display: inline-flex; align-items: center; gap: 2px; height: 24px; padding: 0 2px 0 8px; border: 1px solid var(--border-strong); border-radius: var(--r-pill);
  font-size: var(--fs-xs); }
.ac-chip-x { display: inline-grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; }
.ac-chip-x:hover { color: var(--text); background: var(--hover, #ffffff0d); }
.ac-chip-x:focus-visible { outline: 2px solid #9A9A9A; }
.ac-chip-x .icon { width: 12px; height: 12px; }
.ac-lv-add { display: flex; gap: 6px; max-width: 260px; }
.ac-checks li b.ac-lv-p { margin-left: 0; min-width: 7ch; }
.ac-checks li p.ac-lv-v { margin: 0; color: var(--muted); }
.ac-zones { margin: 0; padding-left: 1.4em; display: grid; gap: 2px; font: 500 var(--fs-xs) var(--mono); }
.ac-hs-opts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ac-hs-opts .ac-opt { justify-content: center; text-align: center; }
.ac-opt.is-picked { opacity: 1; border-color: var(--text); box-shadow: inset 3px 0 0 var(--text); }
.ac-outs { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ac-outs li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--s2); padding: 6px var(--s2); border-radius: var(--r-sm); }
.ac-outs li.is-mine { background: var(--panel2); }
.ac-outs-r { margin-left: auto; color: var(--muted); }
.ac-facts { margin: 0; padding-left: 1.2em; display: grid; gap: 4px; line-height: 1.5; }
.ac-news-ev { display: flex; gap: var(--s2); align-items: flex-start; padding: var(--s2) var(--s3); border: 1px solid var(--border); border-left: 3px solid var(--warning);
  border-radius: var(--r-md); background: var(--panel2); }
.ac-news-ev .icon { width: 16px; height: 16px; margin-top: 2px; color: var(--warning); flex: none; }
.ac-news-ev b { display: block; font-weight: 600; line-height: 1.4; }
.ac-few { max-width: 46ch; }

/* ---------- mascot «Ґніт» ---------- */
.ma { --ma-c: var(--green); overflow: visible; }
.ma-warn { --ma-c: var(--warning); } .ma-stop { --ma-c: var(--red); }
.ma-body { fill: var(--ma-c); }
.ma-wick, .ma-arm { stroke: var(--ma-c); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.ma-palm { fill: var(--ma-c); }
.ma-eye { fill: #0A0A0A; }
.ma-ln { stroke: #0A0A0A; stroke-width: 2.2; stroke-linecap: round; fill: none; }
.ma-mouth { fill: #0A0A0A; }
.ma-spark { stroke: var(--text); stroke-width: 1.8; stroke-linecap: round; }
.ma-party { animation: maHop 1.2s var(--ease) 2; }
.ma-party .ma-spark { animation: maTwinkle 1.2s ease-in-out 3; }
.ma-warn .ma-arm, .ma-stop .ma-palm { transform-box: fill-box; }
@keyframes maHop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-4px); } }
@keyframes maTwinkle { 0%, 100% { opacity: 1; } 50% { opacity: .2; } }

/* ---------- lesson schematics ---------- */
.ar { display: block; width: 100%; height: auto; max-height: 190px; }
.ar text { font: 600 11px var(--mono); }
.ar-tx { fill: var(--muted); }
.ar-red { fill: var(--red); } .ar-green { fill: var(--green); } .ar-amber { fill: var(--warning); }
.ar-up { fill: var(--green); stroke: var(--green); } .ar-dn { fill: var(--red); stroke: var(--red); }
.ar-wk { stroke-width: 2; }
.ar-ld { stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 2 3; }
.ar-gd { stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 4 4; fill: none; }
.ar-arrow { stroke: var(--muted); stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.ar-en { stroke: var(--text); stroke-width: 1.5; }
.ar-sl { stroke: var(--red); stroke-width: 1.5; stroke-dasharray: 6 4; }
.ar-liq { stroke: var(--warning); stroke-width: 1.5; stroke-dasharray: 2 3; }
.ar-path { stroke: var(--text); stroke-width: 2; fill: none; stroke-linejoin: round; stroke-linecap: round; }
.ar-ghost { stroke: var(--muted); stroke-width: 1.5; fill: none; stroke-dasharray: 3 4; opacity: .6; }
.ar-x { fill: var(--bg); stroke: var(--red); stroke-width: 2; }
.ar-bar { fill: var(--panel2); stroke: var(--border-strong); }
.ar-risk { fill: var(--red); }
.ar-coin { fill: var(--panel2); stroke: var(--text); stroke-width: 1.5; }
.ar-win { fill: color-mix(in srgb, var(--green) 28%, transparent); stroke: var(--green); }
.ar-loss { fill: color-mix(in srgb, var(--red) 28%, transparent); stroke: var(--red); }
.ar-dot { fill: var(--border-strong); }
.ar-good { fill: var(--bg); stroke: var(--green); stroke-width: 3; }
.ar-clock { fill: none; stroke: var(--warning); stroke-width: 1.8; } .ar-clock-h { stroke: var(--warning); stroke-width: 1.8; fill: none; stroke-linecap: round; }
/* one short entrance per picture: candles grow, paths draw themselves */
.ar-grow, .ar-grow-x, .ar-pop { transform-box: fill-box; }
.ar-grow { transform-origin: 50% 100%; animation: arGrow .7s var(--ease) both; }
.ar-grow-x { transform-origin: 0 50%; animation: arGrowX .9s var(--ease) .2s both; }
.ar-pop { animation: arPop .45s var(--ease) both; }
.ar-d1 { animation-delay: .15s; } .ar-d2 { animation-delay: .3s; } .ar-d3 { animation-delay: .45s; } .ar-d4 { animation-delay: .7s; }
.ar-draw { stroke-dasharray: 400; stroke-dashoffset: 400; animation: arDraw 1.6s var(--ease) .1s forwards; }
@keyframes arGrow { from { transform: scaleY(0); } }
@keyframes arGrowX { from { transform: scaleX(0); } }
@keyframes arPop { from { opacity: 0; transform: translateY(6px); } }
@keyframes arDraw { to { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
  .ma-party, .ma-party .ma-spark, .ar-grow, .ar-grow-x, .ar-pop { animation: none; }
  .ar-draw { animation: none; stroke-dashoffset: 0; }
  .ac-bar > i { transition: none; }
}

@media (max-width: 639px) {
  /* phones: the same bottom sheet as every other dialog (stage5.css), just allowed to be tall */
  dialog.ac-dlg { max-height: calc(100dvh - var(--m-nav, 56px) - 12px); }
  .ac-dlg-body { padding: var(--s3); }
  .ac-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ac-given { grid-template-columns: repeat(3, auto); }
  .ac-given dt:nth-of-type(n+4) { grid-row: 3; } .ac-given dd:nth-of-type(n+4) { grid-row: 4; }
  .ac-opt { min-height: 44px; }
  .ac-lesson { min-height: 40px; }
  .ac-hs-opts { grid-template-columns: 1fr; }
  .ac-chip { height: 32px; } .ac-chip-x { width: 28px; height: 28px; }
}

/* ---------- levels 2–4: locks, exam, skip ---------- */
.ac-lv.is-locked { opacity: .85; }
.ac-lk { display: inline-flex; color: var(--muted); }
.ac-lv-ok { margin-left: 2px; }
.ac-lock { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; margin: 0; color: var(--muted); font-size: var(--fs-2xs); }
.ac-lock b { color: var(--text); font-weight: 600; }
.ac-exam { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--s2); padding-top: 6px; border-top: 1px dashed var(--border); }
.ac-exam .btn { display: inline-flex; align-items: center; gap: 6px; }
.ac-exam-note { display: flex; align-items: center; gap: 6px; padding-top: 6px; border-top: 1px dashed var(--border); }
.ac-lv-skip { justify-self: start; }
.ac-link { display: inline-flex; align-items: center; gap: 6px; justify-self: start; padding: 4px 0; border: 0; background: none; color: var(--muted);
  font: 500 var(--fs-2xs) var(--sans); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.ac-link:hover { color: var(--text); }
.ac-link:focus-visible { outline: 2px solid #9A9A9A; outline-offset: 2px; }

/* ---------- level badges: the mascot in a frame that grows with the level ---------- */
.lb { display: block; overflow: visible; }
.lb .lb-num { font: 800 10px var(--mono); }
.lb-t9 { filter: drop-shadow(0 0 4px rgba(127, 224, 255, .55)); }
.lb-t10 { filter: drop-shadow(0 0 5px rgba(199, 146, 255, .7)); }
.lb-aura { transform-box: view-box; transform-origin: 48px 50px; animation: lbPulse 2.6s ease-in-out infinite; }
.lb-orbit { transform-box: view-box; transform-origin: 48px 50px; animation: lbSpin 7s linear infinite; }
.lb-shine { animation: lbShine 3.8s ease-in-out infinite; }
.lb-tw { animation: maTwinkle 2.4s ease-in-out infinite; }
.lb-pop { animation: lbPop .9s cubic-bezier(.2, 1.5, .4, 1) both; }
@keyframes lbPulse { 0%, 100% { opacity: .55; transform: scale(.94); } 50% { opacity: 1; transform: scale(1.04); } }
@keyframes lbSpin { to { transform: rotate(360deg); } }
@keyframes lbShine { 0% { transform: translateX(0); } 55%, 100% { transform: translateX(150px); } }
@keyframes lbPop { 0% { transform: scale(.3) rotate(-14deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
.ac-lbgrid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 8px 4px; }
.ac-lbc { display: grid; justify-items: center; gap: 2px; font-size: 10px; color: var(--muted); line-height: 1.2; text-align: center; }
.ac-lbc b { color: var(--text); font-size: var(--fs-2xs); margin-left: 3px; }
.ac-lbl { white-space: nowrap; }
.ac-lbc.is-next .ac-lbi { opacity: .3; filter: grayscale(1); }
.ac-lbc.is-next b { color: var(--muted); }
.ac-lbi { display: inline-flex; }
dialog.ac-lvlup-dlg { width: min(340px, 92vw); }
.ac-lvlup { display: grid; justify-items: center; gap: var(--s2); text-align: center; padding: var(--s2) 0; }
.ac-lvlup p { margin: 0; }
.ac-lvlup-b { display: inline-flex; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .45)); }
.ac-lvlup-dlg .ac-dlg-title b { font-size: var(--fs-xl); }

/* ---------- «Академія пройдена»: rating form ---------- */
dialog.ac-fin-dlg { width: min(520px, 96vw); }
.ac-fin-top { padding: 0; }
.ac-field-row, .ac-fl-wrap { display: grid; gap: 6px; }
.ac-fl { font-weight: 600; font-size: var(--fs-xs); }
.ac-fl .ac-dim { font-weight: 400; }
.ac-fl-wrap textarea { width: 100%; min-height: 72px; }
.ac-stars { display: inline-flex; gap: 4px; }
.ac-star { display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: var(--r-md); background: transparent; color: var(--border-strong); cursor: pointer; }
.ac-star svg { width: 30px; height: 30px; fill: currentColor; stroke: currentColor; stroke-width: 1.2; stroke-linejoin: round; }
.ac-star.on { color: var(--warning); }
.ac-star:hover { color: var(--warning); }
.ac-star:focus-visible { outline: 2px solid #9A9A9A; outline-offset: 2px; }
.ac-err { margin: 0; color: var(--warning); font-size: var(--fs-xs); line-height: 1.45; }
.ac-err[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  .lb-aura, .lb-orbit, .lb-shine, .lb-tw, .lb-pop { animation: none; }
  .lb-shine { display: none; }
}
.ac-still .lb-aura, .ac-still .lb-orbit, .ac-still .lb-shine, .ac-still .lb-tw { animation: none; }
@media (max-width: 639px) {
  .ac-star { width: 48px; height: 48px; }
}
