/* Platypus Economics courses. Design tokens match platypuseconomics.com. */

/* Titles: Helvetica Neue Condensed Black, the heavy condensed face platypuseconomics.com uses for its
   punchy headings (from its /fonts folder). It's the only cut, so it serves every weight. */
@font-face {
  font-family: 'Helvetica Neue LT Cond';
  src: url('../brand/helvetica-neue-cond-black.woff2') format('woff2');
  font-weight: 400 900;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../brand/inter-var.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
/* Handwriting for certificates and captions (Caveat, SIL Open Font License), served from here rather than
   Google Fonts so visitors' addresses aren't sent to Google. The browser only downloads it where it's used. */
@font-face {
  font-family: 'Caveat';
  src: url('../brand/caveat-latin.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Caveat';
  src: url('../brand/caveat-latin-ext.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --ink: #0b0b0a;
  --shell: #ffffff;
  --abyss: #0e4a53;
  --abyss-dark: #083940;
  --abyss-line: #13575f;
  --surf: #2f9e97;
  --surf-deep: #217a74;
  --surf-neon: #00fff0;
  --surf-tint: #ccfffb;
  --sun: #d9a315;
  --sun-neon: #ffc325;
  --sun-tint: #ffd966;
  --coral: #d93a43;
  --coral-deep: #b8222b;
  --coral-wash: #fdecee;
  --algae: #006b2e;
  --algae-wash: #e6f5ec;
  --bg: var(--shell);
  --bg-alt: #f5f7f7;
  --fg: var(--ink);
  --fg-muted: #3a4347;
  --fg-subtle: #5a6467;
  --fg-on-dark-muted: #d4eaec;
  --border: #e2e6e6;
  --border-strong: #c9d1d1;
  --font-display: 'Helvetica Neue LT Cond', 'Helvetica Neue Condensed', Impact, 'Arial Black', sans-serif;
  --font-ui: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  --radius: 3px;
  --gutter: 1.25rem;
  --header-h: 64px;
  --outline-w: 320px;
  --shadow: 0 1px 2px rgba(8, 57, 64, 0.06), 0 8px 24px rgba(8, 57, 64, 0.08);
  --accent: var(--surf);
}

.accent-surf { --accent: var(--surf); }
.accent-sun { --accent: var(--sun); }
.accent-coral { --accent: var(--coral); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 64px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--surf-deep); text-underline-offset: 2px; }
a:hover { color: var(--abyss); }
button { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--surf); outline-offset: 2px; }
[hidden] { display: none !important; }

.skip-link { position: absolute; left: -999px; top: 0; background: var(--sun); color: var(--ink); padding: 0.6rem 1rem; z-index: 100; font-weight: 700; }
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 var(--gutter-r) 0 var(--gutter-l); }
.narrow { max-width: 640px; }
.muted { color: var(--fg-subtle); }
.small { font-size: 0.85rem; }
.row { display: flex; align-items: center; gap: 0.75rem 1rem; flex-wrap: wrap; }
.row.center { justify-content: center; }
.stack > * + * { margin-top: 1rem; }
.stack-lg > * + * { margin-top: 2rem; }
.hide-sm, .hide-xs { }
/* Phones: a 16px gutter, widened in landscape so content clears the notch (viewport-fit=cover). */
@media (max-width: 480px) { :root { --gutter: 1rem; } }
:root { --gutter-l: max(var(--gutter), env(safe-area-inset-left, 0px)); --gutter-r: max(var(--gutter), env(safe-area-inset-right, 0px)); }
@media (max-width: 640px) { .hide-sm { display: none !important; } }
@media (max-width: 420px) { .hide-xs { display: none !important; } }

.display { font-family: var(--font-display); text-transform: uppercase; font-weight: 400; letter-spacing: -0.005em; line-height: 0.98; }
.display-xl { font-size: clamp(44px, 8.5vw, 104px); }
.display-l { font-size: clamp(36px, 6vw, 64px); }
.display-m { font-size: clamp(28px, 4vw, 44px); }

.chip {
  display: inline-block;
  font: 700 0.7rem/1 var(--font-ui);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  padding: 0.45rem 0.65rem;
  border: 1px solid currentColor;
  margin-bottom: 1.25rem;
}
.chip-neon { color: var(--surf-neon); border-color: rgba(0, 255, 240, 0.45); background: rgba(0, 255, 240, 0.06); }

.icon { display: inline-flex; width: 1.15em; height: 1.15em; flex: none; }
.icon svg { width: 100%; height: 100%; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.9rem 1.4rem;
  border: 2px solid transparent;
  border-radius: 0;
  font: 700 0.82rem/1.1 var(--font-ui);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.15s;
  text-align: center;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-sun { background: var(--sun); color: var(--ink); }
.btn-sun:hover { background: var(--sun-neon); color: var(--ink); }
.btn-dark { background: var(--abyss); color: #fff; }
.btn-dark:hover { background: var(--abyss-dark); color: #fff; }
.btn-outline { border-color: var(--abyss); color: var(--abyss); background: transparent; }
.btn-outline:hover { background: var(--abyss); color: #fff; }
.btn-ghost-light { border-color: rgba(255, 255, 255, 0.55); color: #fff; }
.btn-ghost-light:hover { border-color: #fff; background: rgba(255, 255, 255, 0.08); color: #fff; }
.btn-ghost { color: var(--abyss); background: transparent; }
.btn-danger { background: var(--coral); color: #fff; }
.btn-danger:hover { background: var(--coral-deep); color: #fff; }
.btn-danger-outline { border-color: var(--coral); color: var(--coral); background: transparent; }
.btn-danger-outline:hover { background: var(--coral); color: #fff; }
.btn-sm { padding: 0.6rem 0.9rem; font-size: 0.72rem; }
.btn-block { width: 100%; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 0; background: transparent; cursor: pointer; border-radius: 50%; color: inherit; }
.icon-btn:hover { background: rgba(14, 74, 83, 0.08); }
.linklike { background: none; border: 0; padding: 0; color: var(--surf-deep); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; font-size: inherit; }
.linklike:hover { color: var(--abyss); }

/* ---------- Header and footer ---------- */
.site-header { background: var(--abyss); color: #fff; position: relative; z-index: 40; }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); gap: 1rem; }
.brand { display: flex; align-items: center; gap: 0.7rem; color: #fff; text-decoration: none; min-width: 0; }
.brand:hover { color: #fff; }
.brand img { width: 62px; height: auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-name { font-family: var(--font-display); text-transform: uppercase; font-size: 1.15rem; letter-spacing: 0.02em; white-space: nowrap; }
.brand-sub { font: 700 0.62rem/1 var(--font-ui); letter-spacing: 0.22em; text-transform: uppercase; color: var(--surf-neon); margin-top: 0.3rem; }
.header-nav { display: flex; align-items: center; gap: 0.25rem 0.5rem; }
.nav-link { display: inline-flex; align-items: center; gap: 0.4rem; color: #fff; text-decoration: none; font-weight: 600; font-size: 0.88rem; padding: 0.5rem 0.65rem; background: none; border: 0; cursor: pointer; white-space: nowrap; }
.nav-link:hover { color: var(--surf-neon); }
.header-nav .btn-sm { margin-left: 0.25rem; }
/* Signed out, the nav (with Sign in and Create account) runs into the title up to about 715px; the logo links
   to the same page as "All courses", so drop that link until there's room. */
@media (max-width: 760px) { .header-nav:has(a[href='login']) > a.hide-sm { display: none; } }
@media (max-width: 480px) {
  .brand img { width: 48px; }
  .brand-name { font-size: 0.98rem; }
}

.account-menu { position: relative; }
.account-menu summary { list-style: none; cursor: pointer; }
.account-menu summary::-webkit-details-marker { display: none; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--sun); color: var(--ink); display: grid; place-items: center; font-weight: 800; font-size: 0.95rem; margin-left: 0.25rem; }
.menu { position: absolute; right: 0; top: calc(100% + 10px); background: #fff; color: var(--ink); min-width: 250px; box-shadow: var(--shadow); border: 1px solid var(--border); padding: 0.4rem; z-index: 50; }
.menu a, .menu button { display: flex; align-items: center; gap: 0.6rem; width: 100%; padding: 0.65rem 0.75rem; text-decoration: none; color: var(--ink); background: none; border: 0; text-align: left; cursor: pointer; font-size: 0.92rem; }
.menu a:hover, .menu button:hover { background: var(--bg-alt); }
.menu-who { padding: 0.6rem 0.75rem 0.7rem; border-bottom: 1px solid var(--border); margin-bottom: 0.3rem; display: flex; flex-direction: column; font-size: 0.85rem; }
.menu-who span { color: var(--fg-subtle); overflow: hidden; text-overflow: ellipsis; }

.site-footer { background: var(--abyss-dark); color: var(--fg-on-dark-muted); margin-top: 4rem; padding: 2.5rem 0; font-size: 0.9rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; align-items: center; }
.footer-brand { display: flex; align-items: center; gap: 1rem; }
.footer-brand p { margin: 0; max-width: 34ch; }
.footer-links { display: flex; gap: 0.5rem 1.5rem; flex-wrap: wrap; }
.footer-links a, .footer-links .linklike { color: #fff; text-decoration: none; }
.footer-links a:hover, .footer-links .linklike:hover { color: var(--surf-neon); }

.main { min-height: 60vh; }
.main:focus { outline: none; }
.boot, .spinner-wrap { min-height: 60vh; display: grid; place-items: center; }
.spinner { width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--surf); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 2rem auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Home ---------- */
.hero-band { background: linear-gradient(160deg, var(--abyss) 0%, var(--abyss-dark) 100%); color: #fff; padding: clamp(3rem, 8vw, 6rem) 0 clamp(3rem, 7vw, 5rem); position: relative; overflow: hidden; }
.hero-band::after { content: ''; position: absolute; inset: 0; background: repeating-radial-gradient(circle at 85% 20%, transparent 0 38px, rgba(0, 255, 240, 0.05) 39px 40px); pointer-events: none; }
.hero-inner { position: relative; z-index: 1; }
.hero-band h1 { max-width: 12ch; margin-bottom: 1.5rem; }
.hero-band mark, .course-hero mark { background: var(--sun); color: var(--ink); padding: 0 0.12em; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.lede { font-size: clamp(1.02rem, 1.6vw, 1.2rem); max-width: 60ch; color: var(--fg-on-dark-muted); }
.hero-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 2rem; }

.courses-section { padding-top: clamp(2.5rem, 6vw, 4.5rem); }
.course-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 1.5rem; margin-top: 1.5rem; }
/* A lone course card stays card-sized rather than stretching across the page */
.course-grid-one { max-width: 420px; }
.course-card { display: flex; flex-direction: column; border: 1px solid var(--border); background: #fff; border-top: 5px solid var(--accent); transition: box-shadow 0.2s, transform 0.2s; }
.course-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.course-card-media { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--abyss); }
.course-card-media img { width: 100%; height: 100%; object-fit: cover; }
.course-card-tag { position: absolute; left: 0; bottom: 0; background: var(--accent); color: var(--ink); font: 700 0.72rem/1 var(--font-ui); letter-spacing: 0.14em; text-transform: uppercase; padding: 0.55rem 0.75rem; }
.accent-surf .course-card-tag, .accent-coral .course-card-tag { color: #fff; }
.course-card-body { padding: 1.25rem 1.35rem 1.4rem; display: flex; flex-direction: column; flex: 1; }
.course-card h3 { font-family: var(--font-display); text-transform: uppercase; font-weight: 400; font-size: 1.75rem; line-height: 1; margin-bottom: 0.5rem; }
.course-card h3 a { color: var(--ink); text-decoration: none; }
.course-card .btn { margin-top: auto; }
.stat-row { list-style: none; padding: 0; margin: 0 0 1.25rem; display: flex; flex-wrap: wrap; gap: 0.35rem 1.1rem; font-size: 0.86rem; color: var(--fg-subtle); }
.stat-row li { display: inline-flex; align-items: center; gap: 0.35rem; }
.stat-row .icon { color: var(--surf); }
.stat-row-light { color: var(--fg-on-dark-muted); margin-top: 1.25rem; }
.stat-row-light .icon { color: var(--surf-neon); }
.card-progress { display: flex; align-items: center; gap: 0.75rem; font-size: 0.8rem; color: var(--fg-subtle); margin-bottom: 1rem; }
.card-progress .progress { flex: 1; }

.progress { height: 8px; background: var(--border); overflow: hidden; border-radius: 99px; }
.progress-fill { height: 100%; background: var(--surf); border-radius: 99px; transition: width 0.4s; }

.how { background: var(--bg-alt); margin-top: clamp(3rem, 7vw, 5rem); padding: clamp(2.5rem, 6vw, 4.5rem) 0; }
.how-grid { display: grid; grid-template-columns: 1fr; gap: 1.75rem; margin-top: 1.75rem; }
@media (min-width: 560px) { .how-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .how-grid { grid-template-columns: repeat(4, 1fr); } }
.how-item h3 { font-size: 1.1rem; margin: 0.9rem 0 0.4rem; }
.how-item p { color: var(--fg-muted); font-size: 0.95rem; margin: 0; }
.how-icon { width: 52px; height: 52px; display: grid; place-items: center; background: var(--abyss); color: var(--surf-neon); font-size: 1.4rem; }

.authors { padding: clamp(2.5rem, 6vw, 4.5rem) 0 0; }
.authors-inner { display: flex; gap: 2rem; align-items: center; }
.authors-inner img { width: 180px; flex: none; }
.authors-inner p { max-width: 62ch; color: var(--fg-muted); }
@media (max-width: 640px) { .authors-inner { flex-direction: column; align-items: flex-start; } .authors-inner img { width: 140px; } }

/* ---------- Course page ---------- */
.course-hero { background: linear-gradient(160deg, var(--abyss) 0%, var(--abyss-dark) 100%); color: #fff; padding: 2rem 0 3rem; border-bottom: 6px solid var(--accent); }
.course-hero-inner { display: grid; grid-template-columns: 1fr; gap: 2rem; align-items: end; }
@media (min-width: 900px) { .course-hero-inner { grid-template-columns: 1fr 280px; } }
.crumb { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--fg-on-dark-muted); text-decoration: none; font-size: 0.85rem; font-weight: 600; margin-bottom: 1.5rem; }
.crumb:hover { color: #fff; }
.course-hero .chip { display: table; }
.course-hero h1 { margin-bottom: 1rem; }
.course-hero-progress { background: rgba(255, 255, 255, 0.07); border: 1px solid var(--abyss-line); padding: 1.4rem; font-size: 0.9rem; color: var(--fg-on-dark-muted); }
.course-hero-progress .progress { margin-top: 0.8rem; background: rgba(255, 255, 255, 0.15); }
.course-hero-progress .progress-fill { background: var(--surf-neon); }
.big-num { font-family: var(--font-display); font-size: 3.4rem; line-height: 1; color: #fff; }

.course-outline { padding-top: 2rem; }
.course-outline > * { max-width: 900px; }
.textbook-note { display: flex; align-items: flex-start; gap: 0.5rem; color: var(--fg-subtle); font-size: 0.9rem; }
.textbook-note .icon { margin-top: 0.2em; }
.textbook-note .icon { color: var(--surf); }
.outline-part { margin-top: 2.25rem; }
.outline-part-title { font: 800 0.78rem/1.3 var(--font-ui); letter-spacing: 0.14em; text-transform: uppercase; color: var(--surf-deep); border-bottom: 2px solid var(--ink); padding-bottom: 0.6rem; margin: 0; }
.lesson-list { list-style: none; margin: 0; padding: 0; }
.lesson-row a { display: grid; grid-template-columns: 40px 1fr auto; gap: 0.9rem; align-items: center; padding: 0.95rem 0.5rem; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--ink); }
.lesson-row a:hover { background: var(--bg-alt); }
.lesson-status { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; font-size: 0.8rem; font-weight: 700; color: var(--fg-subtle); }
.status-started .lesson-status { border-color: var(--sun); color: var(--ink); }
.status-done .lesson-status { background: var(--algae); border-color: var(--algae); color: #fff; }
.lesson-row-text { display: flex; flex-direction: column; min-width: 0; }
.lesson-row-title { font-weight: 700; }
.lesson-row-sub { color: var(--fg-subtle); font-size: 0.9rem; }
.lesson-row-meta { display: flex; align-items: center; gap: 0.75rem; color: var(--fg-subtle); font-size: 0.82rem; white-space: nowrap; }
.chapter-tag { display: inline-block; font: 700 0.68rem/1 var(--font-ui); letter-spacing: 0.08em; text-transform: uppercase; background: var(--abyss); color: #fff; padding: 0.35rem 0.5rem; }
.free-tag { font: 700 0.68rem/1 var(--font-ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--surf-deep); border: 1px solid var(--surf); padding: 0.3rem 0.45rem; }
.lock { color: var(--fg-subtle); }

/* ---------- Lesson layout ---------- */
.main-lesson { min-height: calc(100vh - var(--header-h)); }
.lesson-layout { display: grid; grid-template-columns: minmax(0, 1fr); }
.lesson-main { min-width: 0; }
.outline { background: var(--bg-alt); border-right: 1px solid var(--border); }
.outline-inner { padding: 1.25rem 0 3rem; }
.outline-head { padding: 0 1.25rem 1.1rem; border-bottom: 1px solid var(--border); }
.outline-course { display: flex; gap: 0.35rem; align-items: center; font-family: var(--font-display); text-transform: uppercase; font-size: 1.3rem; line-height: 1.05; color: var(--ink); text-decoration: none; margin-bottom: 0.9rem; }
.outline-course .icon { font-size: 0.85rem; color: var(--surf); }
.outline-stats { font-size: 0.8rem; color: var(--fg-subtle); }
.outline-stats .progress { margin-bottom: 0.45rem; }
.outline .outline-part { margin-top: 0; }
.outline .outline-part h2 { font: 800 0.68rem/1.3 var(--font-ui); letter-spacing: 0.13em; text-transform: uppercase; color: var(--surf-deep); margin: 1.4rem 1.25rem 0.4rem; }
.outline ol { list-style: none; margin: 0; padding: 0; }
.outline li a { display: flex; align-items: center; gap: 0.65rem; padding: 0.5rem 1.25rem; color: var(--fg-muted); text-decoration: none; font-size: 0.9rem; line-height: 1.3; border-left: 3px solid transparent; }
.outline li a:hover { background: #fff; color: var(--ink); }
.outline li.current a { background: #fff; border-left-color: var(--sun); color: var(--ink); font-weight: 700; }
.outline .dot { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; font-size: 0.66rem; font-weight: 700; flex: none; background: #fff; }
.outline .status-started .dot { border-color: var(--sun); }
.outline .status-done .dot { background: var(--algae); border-color: var(--algae); color: #fff; font-size: 0.8rem; }
.outline-title { flex: 1; }
.outline-backdrop { display: none; }

.lesson-bar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 0.75rem; background: #fff; border-bottom: 1px solid var(--border); height: 52px; padding: 0 var(--gutter-r) 0 var(--gutter-l); }
.outline-toggle { display: inline-flex; align-items: center; gap: 0.4rem; background: var(--bg-alt); border: 1px solid var(--border); padding: 0.45rem 0.7rem; font-weight: 700; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; cursor: pointer; }
.lesson-bar-course { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg-muted); font-weight: 600; font-size: 0.88rem; text-decoration: none; }
.lesson-bar-count { font-size: 0.8rem; color: var(--fg-subtle); font-weight: 600; }

@media (max-width: 1023.98px) {
  .outline { position: fixed; top: 0; bottom: 0; left: 0; width: min(88vw, 360px); z-index: 70; overflow-y: auto; transform: translateX(-102%); transition: transform 0.25s ease; box-shadow: var(--shadow); }
  .outline-open .outline { transform: none; }
  .outline-open .outline-backdrop { display: block; position: fixed; inset: 0; background: rgba(8, 57, 64, 0.55); z-index: 65; }
  .outline-open { overflow: hidden; }
}
@media (min-width: 1024px) {
  .lesson-layout { grid-template-columns: var(--outline-w) minmax(0, 1fr); }
  .outline { position: sticky; top: 0; height: 100vh; overflow-y: auto; }
  .lesson-bar { display: none; }
}

/* ---------- Lesson content ---------- */
.lesson { max-width: 780px; margin: 0 auto; padding: 2rem var(--gutter-r) 5rem var(--gutter-l); }
.lesson-head { margin-bottom: 1.5rem; }
.lesson-eyebrow { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; font: 800 0.72rem/1.3 var(--font-ui); letter-spacing: 0.13em; text-transform: uppercase; color: var(--surf-deep); margin-bottom: 0.9rem; }
.lesson-title { font-size: clamp(34px, 6vw, 58px); margin-bottom: 1rem; }
.lesson-subtitle { display: block; font-family: var(--font-ui); text-transform: none; font-weight: 600; font-size: clamp(1.1rem, 2.4vw, 1.4rem); line-height: 1.3; color: var(--fg-muted); letter-spacing: 0; margin-top: 0.5rem; }
.lesson-position { margin-left: auto; }
@media (max-width: 560px) { .lesson-position { display: none !important; } }

.block { margin: 2.25rem 0; }
.prose p { margin: 0 0 0.9em; }
.prose p:last-child { margin-bottom: 0; }
.hl { color: var(--coral); }
.block-text h2, .block-heading { font-size: clamp(1.35rem, 3vw, 1.75rem); font-weight: 800; line-height: 1.25; letter-spacing: -0.01em; }
.block-heading { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--border); }
.block-text + .block-text { margin-top: -0.5rem; }
.block-list { padding-left: 0; list-style: none; counter-reset: item; }
.block-list li { position: relative; padding-left: 2.6rem; margin-bottom: 1rem; }
.block-list.numbered li::before { counter-increment: item; content: counter(item); position: absolute; left: 0; top: 0.05em; width: 1.75rem; height: 1.75rem; display: grid; place-items: center; background: var(--abyss); color: #fff; font-weight: 800; font-size: 0.85rem; }
.block-list:not(.numbered) li::before { content: ''; position: absolute; left: 0.6rem; top: 0.6em; width: 0.5rem; height: 0.5rem; background: var(--surf); }

.block-hero { position: relative; margin-left: calc(-1 * var(--gutter-l)); margin-right: calc(-1 * var(--gutter-r)); background: var(--abyss); overflow: hidden; }
@media (min-width: 820px) { .block-hero { margin-left: 0; margin-right: 0; } }
.block-hero img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.block-hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(8, 57, 64, 0) 35%, rgba(8, 57, 64, 0.88) 100%); pointer-events: none; }
.block-hero.no-image::after { display: none; }
.hero-caption { position: absolute; z-index: 1; left: 0; right: 0; bottom: 0; padding: 1.25rem 1.5rem; color: #fff; font-size: clamp(1.02rem, 2.4vw, 1.45rem); font-weight: 700; line-height: 1.3; }
.block-hero.no-image .hero-caption { position: static; padding: 1.5rem; }
.hero-caption p { margin: 0; }
.hero-caption .hl { color: var(--sun-neon); }

.block-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.block-gallery figcaption { font-size: 0.85rem; color: var(--fg-subtle); margin-top: 0.4rem; }
.block-divider { border: 0; border-top: 1px solid var(--border); }
.block-file { display: flex; align-items: center; gap: 0.75rem; padding: 1rem 1.25rem; border: 2px solid var(--border); text-decoration: none; font-weight: 700; color: var(--abyss); }
.block-file:hover { border-color: var(--abyss); }
.block-hint { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; color: var(--fg-subtle); margin-bottom: 0.75rem; }

/* "Your main task for today" note above each episode */

/* Episode player */
.player { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; background: var(--abyss); color: #fff; padding: 1.5rem; }
@media (min-width: 600px) { .player { grid-template-columns: 150px minmax(0, 1fr); padding: 1.75rem; align-items: start; } }
.player-art { width: 100%; max-width: 150px; aspect-ratio: 1; object-fit: cover; }
@media (max-width: 599.98px) { .player-art { width: 88px; float: left; margin-right: 1rem; } }
.player-top { grid-column: 1 / -1; display: flex; justify-content: flex-end; margin: -0.5rem 0 -0.4rem; }
/* A light sky blue, set apart from the player's teal, so the button reads as its own action. */
.player-listen { --listen-blue: #8cc8ff; display: inline-flex; align-items: center; gap: 0.45rem; background: rgba(140, 200, 255, 0.08); border: 1.5px solid var(--listen-blue); border-radius: 999px; padding: 0.45rem 0.85rem; cursor: pointer; font: 800 0.7rem/1.3 var(--font-ui); letter-spacing: 0.14em; text-transform: uppercase; color: var(--listen-blue); transition: background 0.15s, color 0.15s; }
.player-listen:hover, .player-listen:focus-visible { background: var(--listen-blue); color: var(--abyss-dark); }
.player-listen:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.player-listen .icon { width: 1.05rem; height: 1.05rem; }
.podcast-apps { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.podcast-app { display: flex; align-items: center; gap: 0.75rem; padding: 0.85rem 0.25rem; border-bottom: 1px solid var(--border); color: var(--ink); text-decoration: none; }
.podcast-app:hover { background: var(--bg-alt); }
.podcast-app-logo { width: 36px; height: 36px; border-radius: 22%; flex: none; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08); }
.podcast-app-name { font-weight: 700; flex: 1; }
.podcast-app .icon { width: 1rem; height: 1rem; color: var(--fg-subtle); }
.player-title { font-family: var(--font-display); text-transform: uppercase; font-weight: 400; font-size: clamp(1.35rem, 3vw, 1.9rem); line-height: 1; margin-bottom: 0.5rem; }
.player-caption { color: var(--fg-on-dark-muted); font-size: 0.95rem; }
.player-caption p { margin: 0; }
.player-controls { display: flex; align-items: center; gap: 0.6rem; margin-top: 1.1rem; clear: both; }
.play-btn { width: 60px; height: 60px; border-radius: 50%; border: 0; background: var(--sun); color: var(--ink); display: grid; place-items: center; cursor: pointer; font-size: 1.6rem; transition: background 0.15s, transform 0.15s; flex: none; }
.play-btn:hover { background: var(--sun-neon); transform: scale(1.04); }
.play-btn-sm { width: 42px; height: 42px; font-size: 1.15rem; }
.player .skip { color: #fff; width: 46px; height: 46px; font-size: 1.55rem; }
.player .skip:hover { background: rgba(255, 255, 255, 0.1); }
.volume-group { display: flex; align-items: center; gap: 0.2rem; margin-left: auto; }
.player .mute-btn { color: #fff; width: 40px; height: 40px; font-size: 1.25rem; }
.player .mute-btn:hover { background: rgba(255, 255, 255, 0.1); }
.volume { width: 92px; -webkit-appearance: none; appearance: none; height: 5px; border-radius: 99px; background: linear-gradient(to right, #fff var(--pct, 100%), rgba(255, 255, 255, 0.22) var(--pct, 100%)); cursor: pointer; margin: 0 0.5rem 0 0; }
.volume::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 0; }
.volume::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 0; }
@media (max-width: 480px) { .volume { display: none; } }
/* Small phones: tighter controls so play, skips, mute and speed fit on one row at 320px. */
@media (max-width: 420px) {
  .player { padding: 1.15rem 1rem; }
  .player-controls { gap: 0.3rem; }
  .player .skip { width: 42px; height: 42px; }
  .play-btn:not(.play-btn-sm) { width: 54px; height: 54px; }
  .speed-btn { min-width: 3.2rem; padding: 0.45rem 0.5rem; }
}
.speed-btn { margin-left: 0.25rem; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.25); color: #fff; font-weight: 800; font-size: 0.85rem; padding: 0.45rem 0.7rem; min-width: 3.6rem; cursor: pointer; }
.speed-btn:hover { background: rgba(255, 255, 255, 0.18); }
.scrub-row { display: flex; align-items: center; gap: 0.75rem; margin-top: 1rem; }
.time { font-variant-numeric: tabular-nums; font-size: 0.8rem; color: var(--fg-on-dark-muted); min-width: 3.2em; }
.scrub-row .time:last-child { text-align: right; }
.scrub { flex: 1; -webkit-appearance: none; appearance: none; height: 6px; border-radius: 99px; background: linear-gradient(to right, var(--surf-neon) var(--pct, 0%), rgba(255, 255, 255, 0.22) var(--pct, 0%)); cursor: pointer; margin: 0; }
.scrub::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4); }
.scrub::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 0; }
.player-note { font-size: 0.82rem; color: var(--surf-neon); margin: 0.6rem 0 0; min-height: 1em; }
.player-note:empty { display: none; }

.mini-player { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; background: var(--abyss-dark); color: #fff; transform: translateY(110%); transition: transform 0.25s ease; padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2); }
.mini-player.show { transform: none; }
.mini-bar { height: 3px; background: rgba(255, 255, 255, 0.15); }
.mini-fill { height: 100%; background: var(--surf-neon); width: 0; }
.mini-inner { display: flex; align-items: center; gap: 0.85rem; padding: 0.55rem var(--gutter-r) 0.55rem var(--gutter-l); max-width: 900px; margin: 0 auto; }
.mini-title { flex: 1; min-width: 0; background: none; border: 0; color: #fff; text-align: left; font-weight: 700; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; padding: 0; }
@media (min-width: 1024px) { .mini-player { left: var(--outline-w); } }

/* Accordions and transcripts */
.accordion { border: 1px solid var(--border-strong); background: #fff; }
.accordion + .accordion { margin-top: 0.5rem; }
.accordion summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; font-weight: 700; cursor: pointer; background: var(--bg-alt); position: sticky; top: 52px; z-index: 5; }
@media (min-width: 1024px) { .accordion summary { top: 0; } }
.accordion summary::-webkit-details-marker { display: none; }
.accordion-title { display: flex; align-items: center; gap: 0.55rem; }
.accordion-title .icon { color: var(--surf); }
.accordion .chev { transition: transform 0.2s; color: var(--fg-subtle); }
.accordion[open] .chev { transform: rotate(180deg); }
.accordion-body { padding: 1.25rem 1.25rem 1.5rem; font-size: 0.97rem; }
.transcript .accordion-body p { margin-bottom: 0.75em; }
.speaker { display: block; font: 800 0.72rem/1.4 var(--font-ui); letter-spacing: 0.1em; color: var(--surf-deep); margin-bottom: 0.1rem; }

/* Flashcards (both faces share one grid cell, so cards grow to fit their text) */
.flashcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 1rem; }
.flashcard { border: 0; padding: 0; background: none; cursor: pointer; perspective: 1200px; text-align: center; min-height: 170px; display: grid; }
.flashcard-inner { display: grid; transition: transform 0.55s cubic-bezier(0.2, 0.7, 0.2, 1); transform-style: preserve-3d; }
.flashcard.is-flipped .flashcard-inner { transform: rotateY(180deg); }
.face { grid-area: 1 / 1; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1.25rem; min-height: 170px; }
.face img { max-height: 90px; width: auto; margin-bottom: 0.6rem; }
.face p { margin: 0; }
.face.front { background: var(--abyss); color: #fff; font-weight: 800; font-size: 1.12rem; line-height: 1.25; }
.face.front::after { content: 'Tap to flip'; position: absolute; bottom: 0.6rem; font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--surf-neon); font-weight: 700; }
.face.front { position: relative; }
.face.back { background: #fff; border: 2px solid var(--abyss); color: var(--ink); font-size: 0.95rem; line-height: 1.45; transform: rotateY(180deg); }
.flashcard:hover .face.front { background: var(--abyss-dark); }

/* Labeled graphics. The frame clips the picture (its padding leaves room for markers at the edges).
   .labeled-image scales by --zoom about the open marker (--zoom-x/--zoom-y, in percent), and each
   marker divides its scale by --zoom so it keeps its size. Registering the variables lets them
   animate, so the picture and markers move in step; without @property the zoom is instant. */
@property --zoom { syntax: '<number>'; inherits: true; initial-value: 1; }
@property --zoom-x { syntax: '<number>'; inherits: false; initial-value: 50; }
@property --zoom-y { syntax: '<number>'; inherits: false; initial-value: 50; }
@property --marker-scale { syntax: '<number>'; inherits: false; initial-value: 1; }
.block-labeled { margin-left: 0; margin-right: 0; }
.labeled-stage { background: var(--bg-alt); display: flex; justify-content: center; }
.labeled-frame { position: relative; max-width: calc(520px + 2rem); width: 100%; padding: 1rem; overflow: hidden; overflow: clip; }
.labeled-image { position: relative; transform: scale(var(--zoom, 1)); transform-origin: calc(var(--zoom-x, 50) * 1%) calc(var(--zoom-y, 50) * 1%); transition: --zoom 0.6s cubic-bezier(0.3, 0.7, 0.2, 1), --zoom-x 0.6s cubic-bezier(0.3, 0.7, 0.2, 1), --zoom-y 0.6s cubic-bezier(0.3, 0.7, 0.2, 1); }
.labeled-image img { width: 100%; }
.marker { --marker-size: 32px; position: absolute; width: var(--marker-size); height: var(--marker-size); margin: calc(var(--marker-size) / -2) 0 0 calc(var(--marker-size) / -2); transform: scale(calc(var(--marker-scale, 1) / var(--zoom, 1))); border-radius: 50%; border: 2px solid #fff; background: var(--coral); color: #fff; font-weight: 800; font-size: 0.85rem; cursor: zoom-in; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); transition: --marker-scale 0.15s, background 0.15s, opacity 0.2s; display: grid; place-items: center; padding: 0; touch-action: manipulation; }
.marker:hover { --marker-scale: 1.1; }
.marker.seen { background: var(--surf-deep); }
.marker.seen:not(.active) { opacity: 0.8; }
.marker.active { --marker-scale: 1.2; background: var(--abyss); box-shadow: 0 0 0 4px var(--sun-neon); z-index: 2; }
.is-zoomed .marker.active { cursor: zoom-out; }
@media (max-width: 480px) { .labeled-frame { padding: 0.85rem; } .marker { --marker-size: 26px; font-size: 0.75rem; } }
/* Entrance: hidden until in view, then a staggered pop; unvisited markers pulse a ring. */
.block-labeled.is-waiting .marker { opacity: 0; }
.block-labeled.is-entering .marker { animation: marker-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) calc(var(--i) * 0.12s) backwards; }
@keyframes marker-pop { from { opacity: 0; scale: 0.2; } }
.marker::after { content: ''; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid var(--coral); opacity: 0; pointer-events: none; }
.block-labeled:not(.is-waiting) .marker:not(.seen)::after { animation: marker-pulse 2.4s ease-out calc(var(--i) * 0.12s + 1s) infinite; }
@keyframes marker-pulse { 0% { opacity: 0.85; transform: scale(1); } 70%, 100% { opacity: 0; transform: scale(1.9); } }
.labeled-zoom-out { margin-left: auto; display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.4rem 0.65rem 0.4rem 0.5rem; border: 2px solid var(--abyss); background: transparent; color: var(--abyss); font: 800 0.7rem/1 var(--font-ui); letter-spacing: 0.1em; text-transform: uppercase; cursor: pointer; transition: opacity 0.2s, background 0.15s, color 0.15s; }
.labeled-zoom-out:hover { background: var(--abyss); color: #fff; }
.labeled-zoom-out:disabled { opacity: 0; cursor: default; }
.labeled-zoom-out .icon { font-size: 1.05rem; }
.labeled-panel { border: 1px solid var(--border-strong); border-top: 4px solid var(--abyss); padding: 1rem 1.25rem 1.25rem; background: #fff; }
.labeled-nav { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; }
.labeled-count { font: 800 0.72rem/1 var(--font-ui); letter-spacing: 0.12em; text-transform: uppercase; color: var(--fg-subtle); }
.labeled-panel h3 { font-size: 1.1rem; }
.labeled-panel .prose { font-size: 0.97rem; }

/* Certificate card (closing lessons) */
.block-certificate { background: #fffdf6; border: 2px solid var(--abyss); outline: 4px solid var(--sun); outline-offset: -10px; padding: 2rem 1.75rem; }
.block-certificate.earned { background: linear-gradient(160deg, #fffdf6 0%, #fff4cf 100%); }
.cert-card-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.cert-card-icon { font-size: 2.6rem; color: var(--sun); flex: none; }
.cert-card-kicker { display: block; font: 800 0.72rem/1.3 var(--font-ui); letter-spacing: 0.2em; text-transform: uppercase; color: var(--surf-deep); }
.block-certificate h2 { font-family: var(--font-display); text-transform: uppercase; font-weight: 400; font-size: clamp(1.5rem, 4vw, 2.1rem); line-height: 1; margin: 0.2rem 0 0; }
.block-certificate .progress { margin: 0.5rem 0 1rem; }
.cert-remaining { margin: 0; padding-left: 1.2rem; font-size: 0.95rem; }
.cert-remaining li { margin: 0.2rem 0; }

/* Knowledge checks */
.block-quiz { border: 2px solid var(--border); border-top: 5px solid var(--abyss); padding: 1.4rem 1.4rem 1.5rem; background: #fff; }
.block-quiz fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.quiz-head { display: flex; justify-content: space-between; gap: 0.5rem 1rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
.quiz-eyebrow { display: inline-flex; align-items: center; gap: 0.4rem; font: 800 0.72rem/1.3 var(--font-ui); letter-spacing: 0.13em; text-transform: uppercase; color: var(--surf-deep); }
.quiz-prompt { font-size: 1.1rem; line-height: 1.45; margin-bottom: 1rem; padding: 0; }
.quiz-prompt p { margin: 0; }
.options { display: grid; gap: 0.6rem; }
.option { display: flex; align-items: flex-start; gap: 0.8rem; padding: 0.85rem 1rem; border: 2px solid var(--border); cursor: pointer; transition: border-color 0.15s, background 0.15s; position: relative; }
.option:hover { border-color: var(--border-strong); background: var(--bg-alt); }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option-mark { width: 24px; height: 24px; border: 2px solid var(--border-strong); flex: none; display: grid; place-items: center; color: transparent; background: #fff; margin-top: 0.05rem; font-size: 0.9rem; }
.option input[type='radio'] + .option-mark { border-radius: 50%; }
.option input:checked + .option-mark { background: var(--abyss); border-color: var(--abyss); color: #fff; }
.option input:focus-visible + .option-mark { outline: 3px solid var(--surf); outline-offset: 2px; }
.option:has(input:checked) { border-color: var(--abyss); background: rgba(204, 255, 251, 0.35); }
.option-text p { margin: 0; }
.is-locked .option { cursor: default; }
.is-locked .option:hover { background: transparent; border-color: var(--border); }
.block-quiz .option.right, .block-quiz .is-locked .option.right:hover { border-color: var(--algae); background: var(--algae-wash); }
.block-quiz .option.right .option-mark { background: var(--algae); border-color: var(--algae); color: #fff; }
.block-quiz .option.wrong, .block-quiz .is-locked .option.wrong:hover { border-color: var(--coral); background: var(--coral-wash); }
.block-quiz .option.wrong .option-mark { background: var(--coral); border-color: var(--coral); color: #fff; }
.match-rows { display: grid; gap: 0.75rem; }
.match-row { display: grid; grid-template-columns: 1fr minmax(160px, 230px); gap: 0.75rem; align-items: center; padding: 0.75rem 0.9rem; border: 2px solid var(--border); }
.match-row.right { border-color: var(--algae); background: var(--algae-wash); }
.match-row.wrong { border-color: var(--coral); background: var(--coral-wash); }
.match-left p { margin: 0; }
@media (max-width: 560px) { .match-row { grid-template-columns: 1fr; } }
.quiz-actions { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: 1.1rem; }
.feedback { margin-top: 1.1rem; padding: 1rem 1.1rem; border-left: 5px solid; font-size: 0.97rem; }
.feedback strong { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.25rem; }
.feedback.good { background: var(--algae-wash); border-color: var(--algae); }
.feedback.good strong { color: var(--algae); }
.feedback.bad { background: var(--coral-wash); border-color: var(--coral); }
.feedback.bad strong { color: var(--coral-deep); }

/* End of lesson */
.lesson-end { margin-top: 3.5rem; padding-top: 2rem; border-top: 2px solid var(--ink); display: grid; gap: 1.5rem; }
.end-sentinel { height: 1px; }
.end-badge { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 700; color: var(--fg-subtle); margin: 0; }
.end-badge.done { color: var(--algae); }
.end-badge.done .icon { background: var(--algae); color: #fff; border-radius: 50%; padding: 3px; width: 1.5em; height: 1.5em; }
.next-card { display: flex; flex-direction: column; gap: 0.4rem; background: var(--abyss); color: #fff; padding: 1.5rem 1.6rem; text-decoration: none; transition: background 0.15s; }
.next-card:hover { background: var(--abyss-dark); color: #fff; }
.next-label { font: 800 0.72rem/1.3 var(--font-ui); letter-spacing: 0.14em; text-transform: uppercase; color: var(--surf-neon); }
.next-title { font-family: var(--font-display); text-transform: uppercase; font-size: clamp(1.4rem, 3.5vw, 2rem); line-height: 1.02; }
.next-go { display: inline-flex; align-items: center; gap: 0.4rem; margin-top: 0.5rem; color: var(--sun-neon); font-weight: 800; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; }
.next-card.finish { background: var(--sun); color: var(--ink); }
.next-card.finish .next-label { color: var(--abyss); }
.next-card.finish .next-go { color: var(--ink); }
.lesson-pager { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: 0.9rem; font-weight: 600; }
.lesson-pager a { display: inline-flex; align-items: center; gap: 0.3rem; text-decoration: none; }

.rate { background: var(--bg-alt); padding: 1.4rem 1.5rem; }
.rate h3 { font-size: 1.15rem; margin-bottom: 0.3rem; }
.rate .muted { font-size: 0.9rem; }
.star-row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.stars { display: flex; gap: 0.15rem; }
.star { background: none; border: 0; padding: 0.2rem; cursor: pointer; color: var(--border-strong); font-size: 2rem; line-height: 0; transition: color 0.1s, transform 0.1s; }
.star:hover { transform: scale(1.1); }
.star.on { color: var(--sun); }
.stars.static .star { font-size: 1.4rem; cursor: default; padding: 0; }
.stars.static .star:hover { transform: none; }
.star-label { font-weight: 700; font-size: 0.9rem; color: var(--fg-muted); }
.rate-comment { margin-top: 1rem; display: grid; gap: 0.75rem; }
.rate-done { display: grid; gap: 0.5rem; justify-items: start; }
.rate-done p { margin: 0; }

.gate { text-align: center; padding: 2.5rem 1.5rem; }
.gate-icon { font-size: 2.2rem; color: var(--surf); margin-bottom: 0.75rem; }
.gate p { max-width: 48ch; margin-left: auto; margin-right: auto; color: var(--fg-muted); }
.card { background: #fff; border: 1px solid var(--border); padding: 1.5rem; }
.card h3 { font-size: 1.1rem; }

/* ---------- Forms ---------- */
.field { display: grid; gap: 0.35rem; }
.field label, fieldset legend { font-weight: 700; font-size: 0.88rem; }
input[type='text'], input[type='email'], input[type='password'], input[type='search'], textarea, select {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  padding: 0.75rem 0.85rem;
  border: 2px solid var(--border-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
}
select { padding-right: 2rem; }
textarea { resize: vertical; min-height: 5rem; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--abyss); box-shadow: 0 0 0 3px var(--surf-tint); }
.field-hint { font-size: 0.8rem; color: var(--fg-subtle); margin: 0; }
.form-error { color: var(--coral-deep); font-weight: 600; font-size: 0.9rem; margin: 0; }
.form-error:empty { display: none; }
.static-value { margin: 0; padding: 0.4rem 0; color: var(--fg-muted); }
.notice { background: var(--algae-wash); border-left: 4px solid var(--algae); padding: 0.9rem 1rem; font-size: 0.95rem; }
.notice p { margin: 0; }

.auth-page { background: var(--bg-alt); padding: clamp(1.5rem, 6vw, 4rem) var(--gutter-r) clamp(1.5rem, 6vw, 4rem) var(--gutter-l); min-height: 70vh; }
.auth-card { max-width: 460px; margin: 0 auto; padding: clamp(1.5rem, 5vw, 2.5rem); box-shadow: var(--shadow); border-top: 5px solid var(--sun); }
.auth-card h1 { margin-bottom: 0.5rem; }
.auth-foot { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 0.5rem 1rem; flex-wrap: wrap; font-size: 0.9rem; }

.chips { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chips legend { margin-bottom: 0.5rem; width: 100%; }
.chip-option input { position: absolute; opacity: 0; }
.chip-option span { display: inline-block; padding: 0.5rem 0.8rem; border: 2px solid var(--border-strong); font-size: 0.88rem; font-weight: 600; cursor: pointer; }
.chip-option input:checked + span { border-color: var(--abyss); background: var(--abyss); color: #fff; }
.chip-option input:focus-visible + span { outline: 3px solid var(--surf); outline-offset: 2px; }

/* ---------- Dialogs and toasts ---------- */
.dialog { border: 0; padding: 0; width: min(540px, calc(100% - 2rem)); max-height: calc(100vh - 2rem); max-height: calc(100dvh - 2rem); box-shadow: 0 20px 60px rgba(8, 57, 64, 0.35); border-top: 5px solid var(--sun); }
.dialog::backdrop { background: rgba(8, 57, 64, 0.6); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.25rem 0.25rem 1.5rem; }
.dialog-head h2 { margin: 0; font-size: 1.3rem; }
.dialog-body { padding: 0.5rem 1.5rem 1.5rem; }
.toasts { position: fixed; top: calc(1rem + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); z-index: 100; display: grid; gap: 0.5rem; width: min(440px, calc(100% - 2rem)); pointer-events: none; }
.toast { background: var(--abyss-dark); color: #fff; padding: 0.85rem 1.1rem; box-shadow: var(--shadow); font-weight: 600; font-size: 0.93rem; animation: toast-in 0.25s ease; transition: opacity 0.4s, transform 0.4s; border-left: 5px solid var(--surf-neon); }
.toast-success { border-left-color: var(--sun); }
.toast-error { border-left-color: var(--coral); }
.toast.out { opacity: 0; transform: translateY(-6px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

/* ---------- Account ---------- */
.consent { display: flex; gap: 0.6rem; align-items: flex-start; font-size: 0.9rem; line-height: 1.45; cursor: pointer; }
.consent input { margin-top: 0.2rem; width: 1.05rem; height: 1.05rem; flex: none; accent-color: var(--surf-deep); }
.legal { padding-bottom: 3rem; }
.legal h2 { font: 800 1.15rem/1.3 var(--font-ui); margin: 2rem 0 0.6rem; }
.legal ul { padding-left: 1.2rem; margin: 0 0 0.9em; }
.legal li { margin-bottom: 0.45em; }
.page-head { padding: 2.5rem 0 0.5rem; }
.page-head h1 { margin-bottom: 0.5rem; }
.section { margin-top: 2.5rem; }
.section-title { font: 800 0.78rem/1.3 var(--font-ui); letter-spacing: 0.14em; text-transform: uppercase; color: var(--surf-deep); border-bottom: 2px solid var(--ink); padding-bottom: 0.6rem; margin-bottom: 1.25rem; }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.75rem; }
@media (max-width: 480px) { .stat-card { padding: 1rem; } .stat-value { font-size: 2rem; } }
.stat-card { border: 1px solid var(--border); padding: 1.2rem 1.25rem; background: #fff; }
.stat-value { font-family: var(--font-display); font-size: 2.4rem; line-height: 1; color: var(--abyss); margin-bottom: 0.35rem; }
.stat-label { font-size: 0.86rem; color: var(--fg-subtle); }
.my-courses { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 1rem; }
.my-course { border: 1px solid var(--border); border-left: 5px solid var(--accent); padding: 1.1rem 1.25rem; display: grid; gap: 0.75rem; }
.my-course-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.my-course h3 { margin: 0; font-size: 1.05rem; }
.my-course h3 a { color: var(--ink); text-decoration: none; }
.pct { font-family: var(--font-display); font-size: 1.6rem; color: var(--abyss); }
.my-course-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; font-size: 0.88rem; }
.recent { list-style: none; padding: 0; margin: 0; }
.recent li { display: grid; grid-template-columns: 28px 1fr auto; gap: 0.75rem; align-items: center; padding: 0.7rem 0; border-bottom: 1px solid var(--border); }
.recent .dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 0.8rem; background: var(--bg-alt); color: var(--sun); }
.recent .dot.status-done { background: var(--algae); color: #fff; }
.recent a { color: var(--ink); font-weight: 600; text-decoration: none; }
.recent a:hover { text-decoration: underline; }
@media (max-width: 560px) { .recent li { grid-template-columns: 28px 1fr; } .recent li > .muted { grid-column: 2; } }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 1rem; }
.danger-zone { margin-top: 1rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; border: 1px solid var(--coral-wash); background: #fffafa; padding: 1.2rem 1.5rem; }
.danger-zone h3 { margin: 0 0 0.2rem; font-size: 1rem; }
.danger-zone p { margin: 0; }

.empty { text-align: center; padding-top: 4rem; padding-bottom: 2rem; }
.empty .progress { max-width: 360px; margin: 0 auto 1.5rem; }
.empty-icon { font-size: 3rem; color: var(--sun); margin-bottom: 1rem; }

/* ---------- Admin ---------- */
.tabs { display: flex; gap: 0.25rem; border-bottom: 2px solid var(--border); margin: 1.5rem 0; overflow-x: auto; }
.tab { background: none; border: 0; padding: 0.75rem 1rem; font-weight: 700; color: var(--fg-subtle); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tab[aria-selected='true'] { color: var(--ink); border-bottom-color: var(--sun); }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table th { text-align: left; font: 800 0.7rem/1.3 var(--font-ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-subtle); background: var(--bg-alt); padding: 0.7rem 0.8rem; white-space: nowrap; }
.data-table td { padding: 0.65rem 0.8rem; border-top: 1px solid var(--border); vertical-align: top; }
.data-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.filters { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.filters select, .filters input { width: auto; flex: 1 1 180px; max-width: 320px; padding: 0.55rem 0.7rem; font-size: 0.9rem; }
.feedback-list { display: grid; gap: 0.75rem; }
.feedback-item { border: 1px solid var(--border); border-left: 4px solid var(--sun); padding: 1rem 1.2rem; background: #fff; }
.feedback-item.resolved { border-left-color: var(--border-strong); opacity: 0.75; }
.feedback-meta { display: flex; flex-wrap: wrap; gap: 0.4rem 0.9rem; align-items: center; font-size: 0.85rem; font-weight: 600; }
.feedback-comment { margin: 0.6rem 0; white-space: pre-wrap; }
.feedback-foot { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; justify-content: space-between; }
.feedback-foot .muted { flex: 1 1 200px; }
.pill { display: inline-block; background: var(--sun-tint); color: var(--ink); padding: 0.2rem 0.55rem; font-size: 0.78rem; font-weight: 800; }
.pill-alt { background: var(--surf-tint); }

/* Certificate page styles live in certificate.css. */

/* ---------- Touch screens ---------- */
@media (pointer: coarse) {
  /* iOS zooms the page into any field under 16px when it's focused. */
  .pe-pop textarea, .filters select, .filters input, .disc-sort { font-size: 1rem; }
  /* The episode scrubber: a taller touch area around the same thin track, and a bigger thumb. */
  .scrub { height: 28px; padding: 11px 0; background-clip: content-box; }
  .scrub::-webkit-slider-thumb { width: 24px; height: 24px; }
  .scrub::-moz-range-thumb { width: 24px; height: 24px; }
  .disc-collapse { padding: 0.45rem 0.35rem; margin: -0.45rem -0.25rem; }
  /* Labeled-graphic markers: a larger invisible tap area than the dot itself. */
  .marker::before { content: ''; position: absolute; inset: -8px; border-radius: 50%; }
}
/* The outline drawer clears the notch and home indicator. */
@media (max-width: 1023.98px) {
  .outline-inner { padding-top: calc(1.25rem + env(safe-area-inset-top, 0px)); padding-bottom: calc(3rem + env(safe-area-inset-bottom, 0px)); padding-left: env(safe-area-inset-left, 0px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- Interactive lessons and part quizzes (public/app/interactives, scoped to .ix) ---------- */
.block-interactive { margin: 2.5rem 0; }
/* Size the guided layout to the lesson column, not the window. */
.ix { container-type: inline-size; font-size: 1rem; }
.ix .where { display: none; }
.ix .widget { margin: 1rem 0 1.5rem; }
.lesson-quiz .ix { margin-top: 1.5rem; }
.lesson-quiz .quiz-card .widget-body { padding: 1.5rem; }
/* Pager: Previous on the left, Course outline in the middle, Next on the right. */
.lesson-pager { align-items: center; }
.lesson-pager .pager-next { margin-left: auto; text-align: right; }
.lesson-pager .pager-outline { color: var(--fg-subtle); font-weight: 500; }
@media (max-width: 560px) { .lesson-pager .pager-outline { order: 3; width: 100%; text-align: center; justify-content: center; } }
.outline-quiz .dot { place-items: center; }
.outline-quiz .dot .icon { width: 13px; height: 13px; }
.outline-quiz .outline-title { font-weight: 700; }

/* ---------- Site skin for the interactives ----------
   The prototypes' own look is rounded and soft; on the site they follow the course style instead:
   square corners, 2px borders, a dark top rule on cards (like the knowledge checks), uppercase labels and buttons.
   The doubled .ix.ix beats the synced stylesheets, which load later. */
.ix.ix :is(.widget, .widget-head, .yl, .yl-choice, .yl-box, .yl-takeaway, .yl-verdict, .yl-kind, .stat, .chip, .verdict, .challenge-box,
  .segmented button, .btn, .meter, .split-bar, .num-wrap, .badge-earned, .pill, .widget-kind, details.more, .jar, .effects li, .deals li,
  .kim, .person, .stretch-card, .skill, .choice, .choice-mark, .q-after, .review-item, .exam-choice, .quiz-tile, .presets button, .pie-row .stats .stat) {
  border-radius: 0;
}
.ix.ix .widget { border: 2px solid var(--border); border-top: 5px solid var(--abyss); box-shadow: none; background: #fff; }
.ix.ix .widget-head { background: #fff; border-bottom: 1px solid var(--border); padding: 1.2rem 1.4rem 1rem; }
.ix.ix .widget-head p { color: var(--fg-muted); }
.ix.ix .widget-body { padding: 1.4rem; }
.ix.ix .widget-kind { background: none; padding: 0; margin-bottom: 0.45rem; font: 800 0.72rem/1.3 var(--font-ui); letter-spacing: 0.13em; color: var(--surf-deep); }
.ix.ix .widget-kind.game { color: var(--coral-deep); }
.ix.ix .widget-kind.sim { color: var(--sun); }
.ix.ix .widget-kind.poll { color: var(--abyss); }
.ix.ix .widget h3 { font-size: 1.6rem; }

/* Buttons: the site's square, uppercase buttons. */
.ix.ix .btn { padding: 0.8rem 1.2rem; border: 2px solid transparent; font: 700 0.78rem/1.1 var(--font-ui); text-transform: uppercase; letter-spacing: 0.08em; background: var(--abyss); color: #fff; }
.ix.ix .btn:hover { background: var(--abyss-dark); }
.ix.ix .btn-sun { background: var(--sun); color: var(--ink); }
.ix.ix .btn-sun:hover { background: var(--sun-neon); }
.ix.ix .btn-ghost { background: transparent; border-color: var(--abyss); color: var(--abyss); }
.ix.ix .btn-ghost:hover { background: var(--abyss); color: #fff; }
.ix.ix .btn-small { padding: 0.55rem 0.85rem; font-size: 0.7rem; }
.ix.ix .btn-big { padding: 0.95rem 1.5rem; font-size: 0.82rem; }
.ix.ix .segmented button { border-width: 2px; font-size: 0.82rem; }
.ix.ix .segmented button[aria-checked='true'] { background: var(--abyss); border-color: var(--abyss); }

/* Your Lessons: a sun-ruled panel in the knowledge-check style. */
.ix.ix .yl { background: #fffaf0; border: 2px solid var(--border); border-top: 5px solid var(--sun); box-shadow: none; }
.ix.ix .yl.all-done { background: var(--algae-wash); border-top-color: var(--algae); }
.ix.ix .yl-kind { background: none; color: var(--surf-deep); padding: 0; font: 800 0.7rem/1.3 var(--font-ui); letter-spacing: 0.13em; }
.ix.ix .yl-kind-predict { color: var(--coral-deep); }
.ix.ix .yl-kind-read { color: var(--sun); }
.ix.ix .yl-pip { border-radius: 0; height: 5px; }
.ix.ix .yl-takeaway { background: #fff; border-left: 4px solid var(--algae); }
.ix.ix .yl-feedback .yl-wrong { border-left-color: var(--coral); }
.ix.ix .yl-feedback .yl-neutral { border-left-color: var(--sun); }

/* Answer choices look like the knowledge-check options. */
.ix.ix :is(.yl-choice, .choice) { border: 2px solid var(--border); padding: 0.85rem 1rem; font-weight: 500; }
.ix.ix :is(.yl-choice, .choice):hover:not(:disabled) { border-color: var(--border-strong); background: var(--bg-alt); transform: none; }
.ix.ix :is(.yl-choice, .choice).right { border-color: var(--algae); background: var(--algae-wash); }
.ix.ix :is(.yl-choice, .choice).wrong { border-color: var(--coral); background: var(--coral-wash); }

/* Readouts and notes. */
.ix.ix .stat, .ix.ix .chip { background: var(--bg-alt); border: 0; border-left: 3px solid var(--border-strong); margin: 0; }
.ix.ix .chip-label, .ix.ix .stat-label { letter-spacing: 0.1em; }
.ix.ix .verdict { border-left-width: 4px; }
.ix.ix .quiz-card { border-top-color: var(--abyss); }
.ix.ix .badge-earned { border-width: 2px; }
.ix.ix .stretch-card, .ix.ix .person, .ix.ix .skill { box-shadow: none; border-width: 2px; }

/* Phones: slimmer card padding gives the graphs and answer choices more of the narrow screen. */
@container (max-width: 480px) {
  .ix.ix .widget-head { padding: 1rem 1rem 0.85rem; }
  .ix.ix .widget-body { padding: 1.1rem 1rem; }
}

/* Phones: graphs (560 wide) shrink to about half size (or get capped in height when sideways), so bump
   every label and the "drag me" tips, including the parts' own smaller label classes, to stay readable. */
@media (max-width: 600px), (max-height: 560px) and (orientation: landscape) and (pointer: coarse) {
  .ix.ix .plot .tick { font-size: 22px; }
  .ix.ix .plot .axis-label { font-size: 23px; }
  .ix.ix .plot .lbl { font-size: 20px; }
  .ix.ix .plot .handle-tip { font-size: 19px; }
}

/* Phones held sideways: fit the whole graph under the lesson bar so you can see it while dragging
   (the plot letterboxes; dragging maps through getScreenCTM so it stays accurate). */
@media (max-height: 560px) and (orientation: landscape) and (pointer: coarse) {
  .ix.ix .plot { max-height: calc(100vh - 52px - 1.5rem); max-height: calc(100dvh - 52px - 1.5rem); }
}

/* No "Draggable graph" / "Game" labels above interactive titles on the site. */
.ix.ix .widget-kind { display: none; }
.lesson > .rate { margin-top: 2.5rem; }
