/* HyperAcademy's own parts, on HyperCluster's shared design (/ui/hc.css): the course lists, the
   certificate, the course player (steps, lessons, quick checks) and the legal pages. Colours, type,
   buttons, cards, pills and the page shell all come from hc.css; layout rules are container
   queries on .site, like the kit's. */

[hidden] { display: none !important; }

/* ---------- the shared header and sidebar, here ---------- */
/* Signed out on a narrow phone, the header's language link leaves no room for the name beside the
   HyperCluster logo, so the logo stands alone there (it still links home). */
@container site (max-width: 439px) { .hdr .brand.public .pname { display: none; } }
/* The sidebar names the open course: one line, cut short if it's long. */
.side a svg { flex-shrink: 0; }
.side a span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- small parts ---------- */
/* Chinese headings break at punctuation, not inside a word. */
.ac-keep { word-break: keep-all; }
.pill svg { width: 14px; height: 14px; }
.ac-fine { font-size: 12px; color: var(--muted); }
.ac-fine a { color: var(--muted); }
.ac-fine a:hover { color: var(--text); }
.ac-words dt { font-weight: 600; font-size: 14px; }
.ac-words dd { margin: 2px 0 12px; font-size: 13px; color: var(--muted); }
.ac-words dd:last-child { margin-bottom: 0; }
.ac-seal { width: 64px; height: 64px; flex-shrink: 0; }

/* ---------- course lists ---------- */
.ac-course { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--field); color: var(--text); text-decoration: none; }
.ac-course:hover { border-color: var(--line-2); color: var(--text); }
.ac-course .chev { color: var(--muted); display: inline-flex; }
.ac-card { color: var(--text); text-decoration: none; }
.ac-card:hover { border-color: var(--line-2); color: var(--text); }
.ac-card img { height: 120px; }

/* ---------- certificate ---------- */
.ac-cert { text-align: center; align-items: center; background: radial-gradient(120% 80% at 50% 0%, rgba(47, 140, 255, .12), transparent 60%), var(--card); }
.ac-cert .ac-seal { width: 76px; height: 76px; }
.ac-cert h1 { font-size: clamp(26px, 6cqi, 38px); overflow-wrap: anywhere; }
.ac-cert .course { font-size: 19px; font-weight: 600; color: var(--link-2); }

/* ---------- course player ---------- */
/* A reading page: no footer under it, so the steps column can stay put
   below the header all the way down; focused answers scroll clear of the header and Back / Continue. */
body[data-page="course"] #ftr { display: none; }
html:has(body[data-page="course"]) { scroll-padding-top: 80px; scroll-padding-bottom: calc(var(--ac-tabbar, 0px) + 84px); }
.player { display: grid; grid-template-columns: minmax(0, 1fr); flex: 1; }
@container site (min-width: 1100px) { .player { grid-template-columns: 280px minmax(0, 1fr); } }

/* The course's steps: a column beside the lesson on a wide screen, a drawer ("Steps") otherwise. */
.rail { display: none; background: var(--head); border-right: 1px solid var(--line); padding: 20px 14px 28px; overflow-y: auto; }
@container site (min-width: 1100px) { .rail { display: block; position: sticky; top: 68px; align-self: start; max-height: calc(100vh - 68px); max-height: calc(100dvh - 68px); } }
.rail.open { display: block; position: fixed; z-index: 45; top: 64px; bottom: 0; left: 0; width: min(340px, calc(100% - 56px)); box-shadow: 14px 0 40px rgba(0, 0, 0, .5); }
@container site (min-width: 900px) { .rail.open { top: 68px; } }
.pl-scrim { display: none; position: fixed; inset: 0; z-index: 44; background: rgba(0, 0, 0, .5); }
.rail.open ~ .pl-scrim { display: block; }
@container site (min-width: 1100px) { .rail.open { position: sticky; width: auto; box-shadow: none; } .rail.open ~ .pl-scrim { display: none; } }
.rail .ctitle { font-weight: 600; font-size: 14px; }
.rail .cbar { height: 6px; border-radius: 999px; background: #1a2333; overflow: hidden; margin: 10px 0 14px; }
.rail .cbar > i { display: block; height: 100%; background: var(--blue); border-radius: 999px; }
.rail .mod { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin: 16px 6px 6px; }
.snav { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 6px 10px; border-radius: 10px; font-size: 14px; color: var(--muted); cursor: pointer; border: 1px solid transparent; }
.snav:hover { color: var(--text); }
.snav.cur { background: var(--blue-bg); border-color: rgba(47, 140, 255, .4); color: var(--text); font-weight: 500; }
.snav.locked { opacity: .5; cursor: not-allowed; }
.snav .tick { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--faint); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.snav.done .tick { background: var(--good); border-color: var(--good); color: #04120c; }
.snav.cur .tick { border-color: var(--link); }

.pl-main { display: flex; flex-direction: column; min-width: 0; }
.pl-top { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
@container site (min-width: 900px) { .pl-top { padding: 12px 32px; } }
@container site (min-width: 1100px) { .pl-top { display: none; } }
/* player.js shows or hides #railToggle by the window's width; the page's width decides here. */
.pl-top #railToggle { display: inline-flex !important; }
.pl-top .t { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.stage { width: 100%; max-width: 760px; margin: 0 auto; padding: 24px 16px 32px; flex: 1; }
@container site (min-width: 900px) { .stage { padding: 36px 32px 48px; } }
.stage .kicker { color: var(--link); font-size: 13px; font-weight: 600; letter-spacing: .02em; margin-bottom: 6px; }
.stage h1 { font-size: clamp(24px, 4.4cqi, 32px); margin: 0 0 20px; }
.video { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: var(--r-sm); overflow: hidden; margin: 6px 0 26px; border: 1px solid var(--line); background: #000; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* A lesson, as written in the course's markdown. */
.lesson { font-size: 16px; line-height: 1.75; color: #cbd5e1; overflow-wrap: break-word; }
.lesson h2 { font-size: 20px; margin: 28px 0 10px; color: var(--text); }
.lesson h3 { font-size: 17px; margin: 22px 0 8px; color: var(--text); }
.lesson p { margin: 0 0 16px; }
.lesson strong { color: var(--text); }
.lesson ul, .lesson ol { padding-left: 22px; margin: 0 0 16px; }
.lesson li { margin: 6px 0; }
.lesson blockquote { border-left: 3px solid var(--blue); margin: 18px 0; padding: 2px 0 2px 16px; color: var(--muted); }
.lesson blockquote p:last-child { margin-bottom: 0; }
.lesson code { font-family: var(--mono); background: var(--field); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; font-size: .88em; }
.lesson pre { overflow-x: auto; background: var(--field); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px; }
.lesson pre code { border: 0; padding: 0; background: none; }
.lesson img { max-width: 100%; height: auto; border-radius: var(--r-sm); }
.lesson hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
/* A wide table scrolls on its own, never the page. */
.lesson table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; margin: 16px 0; font-size: 14px; line-height: 1.55; }
.lesson th, .lesson td { border: 1px solid var(--line); padding: 9px 11px; text-align: left; vertical-align: top; min-width: 110px; }
.lesson th { background: var(--card); color: var(--text); }

/* Quick checks (quizzes). */
.q { margin: 0 0 26px; }
.q .qtext { font-weight: 600; font-size: 16px; margin-bottom: 12px; }
.opt { display: flex; align-items: flex-start; gap: 12px; padding: 13px 14px; min-height: 52px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); margin-bottom: 10px; cursor: pointer; font-size: 15px; }
.opt:hover { border-color: var(--line-2); }
.opt input { width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--blue); flex-shrink: 0; }
.opt.sel { border-color: var(--link); background: rgba(47, 140, 255, .09); }
.opt.correct { border-color: var(--good); background: var(--good-bg); }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); }
.qresult { padding: 14px 16px; border-radius: var(--r-sm); margin: 8px 0 20px; font-weight: 600; font-size: 14px; }
.qresult.pass { background: var(--good-bg); color: var(--good); }
.qresult.fail { background: var(--bad-bg); color: var(--bad); border: 1px solid rgba(248, 113, 113, .3); }

/* Back / Continue: stays at the bottom of the screen while a lesson scrolls (above the phone's
   tab bar, whose height academy.js measures into --ac-tabbar). */
.stepbar { position: sticky; bottom: var(--ac-tabbar, 0px); z-index: 30; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px max(16px, calc((100% - 760px) / 2 + 16px)); background: rgba(7, 12, 22, .94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
@container site (min-width: 900px) { .stepbar { padding-inline: max(32px, calc((100% - 760px) / 2 + 32px)); } }
.stepbar .prog { font-size: 13px; color: var(--muted); text-align: center; }

/* The end of the course. */
.pl-done { text-align: center; padding: 24px 0; max-width: 540px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.pl-done .ac-seal { width: 76px; height: 76px; }
.pl-done .pl-tick { width: 72px; height: 72px; border-radius: 20px; }
.pl-done h1 { margin: 0; }
.pl-done .card { width: 100%; text-align: left; }

/* ---------- legal pages (the wording is unchanged) ---------- */
.ac-legal { max-width: 800px; }
.ac-legal h1 { font-size: clamp(26px, 5cqi, 34px); margin: 0 0 6px; }
.ac-legal .u { color: var(--muted); font-size: 13px; margin: 0 0 22px; }
.ac-legal h2 { font-size: 19px; margin: 28px 0 8px; }
.ac-legal p, .ac-legal li { color: #cbd5e1; line-height: 1.8; }
.ac-legal p { margin: 0 0 14px; }
.ac-legal ul { padding-left: 22px; margin: 0 0 14px; }
.ac-legal strong { color: var(--text); }
.ac-legal .box { background: var(--blue-bg); border: 1px solid rgba(47, 140, 255, .3); border-radius: var(--r-sm); padding: 14px 18px; margin: 16px 0; color: #cbd5e1; line-height: 1.7; }
.ac-legal .note { display: block; padding: 0 0 0 14px; border-radius: 0; color: var(--muted); font-size: 13px; border-left: 3px solid var(--faint); margin-top: 26px; }
