/* AlgoCademy, in the visual language of build/app (styles.css): white app bar,
   light paper with bordered cards, one blue accent, dark course drawer, and a
   dark code pane using the old app's "algocademy" editor theme. */
:root {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: #20242c; background: #f5f6f8; font-synthesis: none;
  --ink: #20242c; --muted: #626975; --line: #e0e3e8; --blue: #245bd6; --blue-dark: #194dbd;
  --green: #367149; --red: #a64d34; --appbar: 56px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* Code pane (matches ace/theme/algocademy) */
  --code-bg: #101421; --code-panel: #161b2b; --code-raised: #1c2335; --code-line: #262d40;
  --code-text: #d7dce7; --code-muted: #8d96ab; --code-accent: #86aafa;
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased; background: #f5f6f8; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; color: inherit; border: 0; background: none; }
button, a, input, textarea { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button:disabled { cursor: not-allowed; }
button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible { outline: 3px solid #7299f0; outline-offset: 2px; }
svg { flex-shrink: 0; }
.icon { width: 18px; height: 18px; vertical-align: middle; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
h1, h2, h3, h4, p { margin: 0; }
[hidden] { display: none !important; }
sup, sub { font-size: .72em; line-height: 0; }
kbd { font: 11px var(--mono); padding: 1px 5px; border: 1px solid #d4d9e2; border-bottom-width: 2px; border-radius: 4px; background: #fff; color: #4a5568; }

/* ---- App bar -------------------------------------------------------------- */
.appbar { position: sticky; top: 0; z-index: 50; height: var(--appbar); display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 20px; background: #fff; border-bottom: 1px solid var(--line); }
.appbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand { display: block; flex-shrink: 0; text-decoration: none; }
.brand .logo { display: block; height: 30px; width: auto; }
.appbar-divider { width: 1px; height: 24px; background: var(--line); }
.lessons-button { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px 0 10px; border: 1px solid #d3d9e3; border-radius: 8px; font-size: 13px; font-weight: 600; color: #2d3a52; }
.lessons-button:hover { background: #f2f5fa; }
.lessons-button .icon { width: 17px; }
.course-switch { position: relative; }
.course-switch > button { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px 0 4px; border-radius: 8px; font-size: 14px; font-weight: 600; color: #2a3243; }
.course-switch > button:hover { background: #f2f5fa; }
.course-switch > button > .icon { width: 14px; color: #7d8592; }
.course-dot { display: inline-grid; place-items: center; min-width: 28px; height: 26px; padding: 0 4px; border-radius: 6px; font: 650 10.5px var(--mono); color: #46647b; background: #edf4fa; }
.menu.course-menu { left: 0; right: auto; width: 400px; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.course-menu a { white-space: nowrap; }
.menu-label { grid-column: 1 / -1; padding: 6px 10px 4px; font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: #6a7485; }
.course-menu a[aria-current] { background: #eef3fc; color: #1f4690; font-weight: 600; }
.course-menu .menu-check { margin-left: auto; width: 15px; color: var(--blue); }
.menu-note { grid-column: 1 / -1; margin: 0 10px 6px; font-size: 12px; line-height: 1.45; color: #6a7485; }
.top-actions { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.appbar-progress { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: #5e6878; font-variant-numeric: tabular-nums; }
.upgrade-link { font-size: 13px; font-weight: 600; color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }
.upgrade-link:hover { color: var(--blue-dark); }
.plan-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #526459; }
.plan-badge .icon { width: 15px; color: #6b9a52; }
.account { position: relative; }
.account-button { display: inline-flex; align-items: center; gap: 8px; border: 1px solid #d8dee9; border-radius: 999px; padding: 3px 10px 3px 3px; background: #fff; font-size: 13px; font-weight: 600; color: #293346; }
.account-button:hover { background: #f3f5f9; }
.account-button > .icon { width: 14px; color: #7d8592; }
.account-avatar { position: relative; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; overflow: hidden; background: #e8edf6; color: #475571; font-size: 11px; font-weight: 650; }
.account-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); width: 260px; padding: 6px; background: #fff; border: 1px solid #d3d9e4; border-radius: 10px; box-shadow: 0 18px 50px #121e3a26; z-index: 60; }
.menu-head { padding: 10px 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-head strong { display: block; font-size: 14px; }
.menu-head span { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 6px; font-size: 13px; color: #343c4b; text-decoration: none; text-align: left; }
.menu a:hover, .menu button:hover { background: #f0f3f8; }
.menu .icon { width: 16px; color: #6a7487; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }

/* ---- Lessons drawer (dark, build/app sidebar style) ------------------------ */
.drawer { position: fixed; inset: 0 auto 0 0; width: 330px; max-width: 88vw; z-index: 70; display: flex; flex-direction: column; padding: 18px 14px 14px; background: #20232b; color: #e1e4eb; transform: translateX(-104%); transition: transform .2s ease; box-shadow: 0 0 50px #0006; visibility: hidden; }
.drawer.open { transform: none; visibility: visible; }
.scrim { position: fixed; inset: 0; z-index: 65; background: #15213466; }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 0 6px; }
.eyebrow { font-size: 11px; letter-spacing: 1.1px; font-weight: 650; text-transform: uppercase; color: #aeb5c5; }
.drawer-progress { font-size: 12px; color: #b7becc; margin-top: 3px; }
.drawer-close { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 7px; color: #b7bfce; }
.drawer-close:hover { background: #30343f; color: #fff; }
.drawer .progress-track { height: 4px; background: #495161; border-radius: 3px; overflow: hidden; margin: 12px 6px 14px; }
.progress-fill { height: 100%; background: #90b2fd; transition: width .3s; }
.side-search { display: flex; align-items: center; gap: 8px; margin: 0 4px 10px; padding: 7px 10px; border: 1px solid #3d424f; border-radius: 7px; background: #2a2e38; color: #9aa3b5; }
.side-search .icon { width: 15px; }
.side-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: #fff; font-size: 13px; }
.side-search input::placeholder { color: #8d96a8; }
.drawer-list { flex: 1; overflow-y: auto; margin: 0 -6px; padding: 0 6px; scrollbar-width: thin; scrollbar-color: #444a57 transparent; }
.side-section + .side-section { margin-top: 2px; }
.side-section summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 7px; cursor: pointer; font-size: 13px; font-weight: 600; color: #d5d9e2; }
.side-section summary::-webkit-details-marker { display: none; }
.side-section summary:hover { background: #2a2e38; }
.side-section summary .icon { width: 14px; color: #8d96a8; transition: transform .15s; }
.side-section[open] summary .icon { transform: rotate(180deg); }
.side-section-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-count { margin-left: auto; font-size: 11px; color: #adb7cc; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lesson-nav { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 7px 10px; margin: 2px 0; border-radius: 7px; text-align: left; color: #b7bfce; text-decoration: none; }
.lesson-nav.current { background: #324568; color: #fff; }
.lesson-nav.available:hover, .lesson-nav.done:hover, .lesson-nav.locked:hover { background: #303e58; }
.lesson-nav.locked { color: #8f97a8; }
.lesson-num { display: grid; place-items: center; flex-shrink: 0; min-width: 25px; height: 25px; padding: 0 3px; border: 1px solid #586071; border-radius: 7px; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.current .lesson-num { background: #86aafa; border-color: #86aafa; color: #192b4e; }
.done .lesson-num { background: #2f4d42; border-color: #4b7b65; color: #a8e1c3; }
.locked .lesson-num { border-style: dashed; color: #8f97a8; }
.lesson-num .icon { width: 14px; }
.lesson-name { font-size: 13px; line-height: 1.4; min-width: 0; }
.lesson-name small { display: block; font-size: 11px; color: #8f9ab0; }
.current .lesson-name small { color: #b9c9ec; }
.drawer-foot { border-top: 1px solid #3b3f49; margin-top: 10px; padding-top: 6px; }
.side-help { display: flex; align-items: center; gap: 9px; padding: 9px 8px; font-size: 12px; color: #bac3d3; width: 100%; text-decoration: none; border-radius: 7px; }
.side-help:hover { color: #fff; background: #2a2e38; }
.side-help .icon { width: 15px; }
.side-help .icon:last-child { margin-left: auto; width: 14px; }

/* ---- Shared pieces --------------------------------------------------------- */
.main { padding: 26px 28px 60px; max-width: 1180px; margin: auto; }
.intro-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 24px; }
.intro-kicker { color: #596578; font-size: 10px; font-weight: 700; letter-spacing: 1.4px; margin-bottom: 5px; }
.intro-row h1 { font-size: 28px; font-weight: 650; letter-spacing: -.8px; line-height: 1.25; }
.intro-row p { font-size: 14px; color: var(--muted); margin-top: 6px; }
.primary, .secondary { display: inline-flex; align-items: center; justify-content: center; gap: 9px; border-radius: 7px; font-size: 13px; font-weight: 500; padding: 10px 16px; min-height: 40px; text-decoration: none; white-space: nowrap; }
.primary { background: var(--blue); border: 1px solid var(--blue); color: #fff; }
.primary:hover { background: var(--blue-dark); }
.primary:disabled { background: #e4e8ef; border-color: #d9dfe8; color: #727c8c; }
.primary.large { font-size: 14px; padding: 12px 20px; min-height: 46px; }
.primary.danger-button { background: #b5472f; border-color: #b5472f; }
.primary.danger-button:hover { background: #9c3c27; }
.secondary { background: #fff; border: 1px solid #cbd5e5; color: #355788; }
.secondary:hover { background: #eff4fc; }
.secondary:disabled { color: #8a93a3; background: #f6f7f9; }
.secondary.square { padding: 0; width: 34px; min-height: 34px; height: 34px; }
.primary .icon, .secondary .icon { width: 16px; }
.text-button { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: #3e577a; padding: 5px 0; text-decoration: none; }
.text-button:hover { color: var(--blue); text-decoration: underline; }
.text-button .icon { width: 16px; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 5px; background: #eaf0fa; color: #46618e; font-size: 11px; font-weight: 500; white-space: nowrap; }
.tag .icon { width: 12px; }
.tag.muted { background: #f0f2f5; color: #5d6676; }
.tag.free { background: #fdecea; color: #a8433a; }
.tag.video-tag { background: #f0ecfc; color: #5c4fa3; }
.mini-track { display: inline-block; width: 64px; height: 4px; border-radius: 2px; background: #e5e9f0; overflow: hidden; vertical-align: middle; }
.mini-track i { display: block; height: 100%; background: #6f95e8; border-radius: 2px; }
.mini-track.wide { width: 120px; }
.icon-button { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 5px; color: #687385; }
.icon-button .icon { width: 17px; }
.icon-button:hover { color: #2c5597; background: #eaf0fb; }

/* ---- Home ------------------------------------------------------------------ */
.home-intro { padding: 26px 28px; background: #fff; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 30px; }
.home-intro h1 { font-size: 32px; }
.home-intro strong { color: var(--ink); font-weight: 600; }
.home-block { margin-bottom: 34px; scroll-margin-top: 80px; }
.block-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.block-head h2 { font-size: 20px; font-weight: 650; letter-spacing: -.3px; }
.block-head > p { font-size: 13px; color: var(--muted); }
.course-dot.tone-violet, .course-dot.tone-indigo { color: #665ba9; background: #f0ecfc; }
.course-dot.tone-pink { color: #b4588b; background: #fbeaf3; }
.course-dot.tone-teal { color: #277e87; background: #e5f5f3; }
.course-dot.tone-orange, .course-dot.tone-amber { color: #b97528; background: #fff2df; }
.course-dot.tone-green { color: #628344; background: #f0f5e8; }
.curriculum-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.search-box { display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 38px; border: 1px solid #ccd4e0; border-radius: 8px; background: #fff; color: #7d8592; }
.search-box:focus-within { border-color: #5b82d9; box-shadow: 0 0 0 3px #e5edfc; }
.search-box input { border: 0; outline: 0; width: 210px; max-width: 46vw; background: transparent; font-size: 13px; color: var(--ink); }
.filter-chips { display: inline-flex; padding: 3px; background: #eceff4; border-radius: 8px; }
.filter-chips button { padding: 5px 12px; border-radius: 6px; font-size: 12px; font-weight: 500; color: #4c5566; }
.filter-chips button.selected { background: #fff; color: #264d90; box-shadow: 0 1px 2px #1c315a1f; }
.curriculum-notice { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; padding: 14px 18px; border: 1px solid #ded5f3; border-radius: 10px; background: #f6f3ff; }
.curriculum-notice > .icon { color: #6d5bb0; }
.curriculum-notice p { margin: 0; font-size: 13px; line-height: 1.6; flex: 1; color: #4b4566; }
#curriculum-sections { display: grid; gap: 34px; }
.part-group { display: grid; gap: 14px; }
/* Parts of a language course: Learn to code, Coding interviews */
.part-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding: 4px 2px 14px; border-bottom: 2px solid #dfe5ef; }
.part-kicker { font-size: 10px; font-weight: 700; letter-spacing: 1.4px; color: var(--blue); }
.part-levelup .part-kicker { color: #6d4fc2; }
.part-interview .part-kicker { color: #8a5a12; }
.part-head h3 { font-size: 22px; font-weight: 650; letter-spacing: -.5px; margin-top: 2px; }
.part-text p:not(.part-kicker) { max-width: 620px; margin-top: 4px; font-size: 13.5px; color: var(--muted); line-height: 1.6; }
.part-progress { display: grid; justify-items: end; gap: 6px; flex-shrink: 0; }
.part-progress strong { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1; }
.part-progress strong span { font-size: 14px; font-weight: 500; color: var(--muted); }
.part-progress small { font-size: 11px; color: var(--muted); }
.drawer-part { display: flex; align-items: center; gap: 8px; margin: 16px 10px 6px; font-size: 10.5px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: #8f9bb3; }
.drawer-part:first-child { margin-top: 4px; }
.section-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; scroll-margin-top: 80px; }
.section-card-head { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.section-index { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; border: 1px solid #cfd8e6; font-size: 12px; font-weight: 650; color: #46618e; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.section-index.complete { background: #edf7f0; border-color: #96bba3; color: #2a653e; }
.section-index .icon { width: 15px; }
.section-title { flex: 1; min-width: 0; }
.section-title h3 { font-size: 15px; font-weight: 650; }
.section-title p { font-size: 12px; color: var(--muted); }
.lesson-list { list-style: none; margin: 0; padding: 4px 0; }
.lesson-row { display: flex; align-items: center; gap: 12px; padding: 10px 18px; text-decoration: none; color: #2d3440; }
.lesson-row:hover { background: #f6f8fc; }
.lesson-status { display: grid; place-items: center; width: 22px; color: #7b8aa4; }
.lesson-status .icon { width: 18px; }
.lesson-row.done .lesson-status { color: #4c8a5e; }
.lesson-row.locked { color: #6b7381; }
.lesson-row.locked .lesson-status { color: #9aa2b1; }
.lesson-row-title { flex: 1; min-width: 0; font-size: 14px; }
.lesson-row-title small { font-size: 12px; color: #6c7584; }
.lesson-tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.row-end { width: 15px; color: #a0a8b6; }
.empty-filter { padding: 30px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---- Lesson page: full-height workspace ------------------------------------ */
.lesson-page .main { max-width: none; padding: 12px; height: calc(100vh - var(--appbar)); }
.ide { display: flex; height: 100%; min-height: 0; --split: 44%; }
.pane { display: flex; flex-direction: column; min-height: 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.lesson-pane { flex: 0 0 var(--split); min-width: 320px; }
.pane-head { padding: 16px 20px 0; border-bottom: 1px solid var(--line); }
.pane-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.pane-title-text { min-width: 0; }
.pane-title h1 { font-size: 21px; font-weight: 650; letter-spacing: -.5px; line-height: 1.3; }
.lesson-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.done-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: #2f6b45; }
.done-badge .icon { width: 16px; }
.lesson-pager { display: flex; gap: 6px; flex-shrink: 0; }
.pane-tabs { display: flex; gap: 22px; margin-top: 12px; }
.pane-tab { position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 10px 1px 11px; font-size: 13px; color: #5f6878; }
.pane-tab .icon { width: 16px; }
.pane-tab:hover { color: #264d90; }
.pane-tab.selected { color: #264d90; font-weight: 600; }
.pane-tab.selected:after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--blue); }
.tab-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #e3e7ee; color: #4a5568; font-size: 10px; font-weight: 700; }
.pane-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 22px 28px; scrollbar-width: thin; }
.pane-note, .muted-note { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.resizer { flex: 0 0 12px; display: grid; place-items: center; cursor: col-resize; touch-action: none; }
.resizer span { width: 4px; height: 44px; border-radius: 2px; background: #cdd4df; transition: background .15s; }
.resizer:hover span, .resizer.dragging span, .resizer:focus-visible span { background: #7f9fe0; }
.ide.dragging { cursor: col-resize; user-select: none; }
.ide.dragging iframe { pointer-events: none; }
.ide.max .lesson-pane, .ide.max .resizer { display: none; }

/* Lesson statement (authored HTML from /problems) */
.statement { font-size: 14.5px; color: #3d4552; line-height: 1.75; overflow-wrap: anywhere; }
.statement p { margin: 0 0 10px; }
.statement ul, .statement ol { padding-left: 22px; margin: 8px 0 12px; }
.statement li { margin-bottom: 4px; }
.statement li > p { margin-bottom: 4px; }
.statement br + br { display: none; }
.statement hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.statement h4, .statement h5 { font-size: 15px; margin: 14px 0 8px; }
.statement img { max-width: 100%; height: auto; border-radius: 6px; }
.statement table { border-collapse: collapse; margin: 10px 0; font-size: 13px; display: block; overflow-x: auto; }
.statement td, .statement th { border: 1px solid var(--line); padding: 5px 9px; }
.statement pre, .source-code { margin: 8px 0 12px; padding: 12px 14px; overflow-x: auto; background: #f6f8fb; border: 1px solid #e4e8ef; border-radius: 7px; color: #2c3a4f; font: 13px/1.6 var(--mono); white-space: pre; tab-size: 4; }
.statement pre code { background: none; padding: 0; border: 0; color: inherit; }
.statement code, .hint-box code, .message-content code { font: 12.5px var(--mono); background: #eef2f8; border: 1px solid #e0e6ef; border-radius: 4px; padding: 1px 5px; color: #24406f; }
.statement [style] { max-width: 100%; }
.statement .inner-problem2 { margin: 0 !important; padding: 0 !important; }
.statement iframe { max-width: 100%; border: 0; }
.statement i.fa, .statement .fa { display: none; }
/* Highlighted lesson code, in the old app's prettify colours */
.statement .hl, .message-content code.hl { color: #1f2430; }
.hl .ace_keyword, .hl .ace_storage, .hl .ace_support.ace_function, .hl .ace_constant.ace_language { color: #000088; font-weight: 600; }
.hl .ace_string { color: #008800; }
.hl .ace_comment { color: #880000; font-style: italic; }
.hl .ace_constant.ace_numeric { color: #006666; }
.hl .ace_keyword.ace_operator, .hl .ace_paren, .hl .ace_punctuation { color: #666600; font-weight: 400; }
.hl .ace_variable.ace_language, .hl .ace_support.ace_type, .hl .ace_storage.ace_type, .hl .ace_entity.ace_name { color: #660066; }
.hl .ace_meta.ace_tag, .hl .ace_entity.ace_other.ace_attribute-name { color: #000088; }

/* Bootstrap-style collapses in the statements (Hints, Hint #1, Bonus Solution…) */
.statement .collapse:not(.show) { display: none; }
.statement [data-toggle="collapse"] { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; padding: 10px 14px; border: 1px solid #dfe5ee; border-radius: 8px; background: #f7f9fc; cursor: pointer; color: #2f4a77; text-decoration: none; user-select: none; }
.statement [data-toggle="collapse"]:hover { background: #eef3fb; border-color: #c9d6ec; }
.statement [data-toggle="collapse"] .container-fluid { display: flex; align-items: center; width: 100%; padding: 0; font-size: 14px !important; font-weight: 600 !important; }
.statement [data-toggle="collapse"]:after { content: ''; margin-left: auto; width: 7px; height: 7px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(45deg) translate(-2px, -2px); transition: transform .15s; flex-shrink: 0; }
.statement [data-toggle="collapse"].open:after { transform: rotate(225deg) translate(-2px, -2px); }
.statement .collapse { padding: 6px 4px 4px 14px; border-left: 2px solid #dfe5ee; margin: 6px 0 4px 8px; }
.statement .collapse .collapse { border-left-color: #e9edf3; }
.statement-video { margin: 8px 0 4px; }
.block-label { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 650; color: #4a3f8f; margin-bottom: 10px; }
.block-label .icon { width: 16px; }

/* Videos */
.video-list { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.video-group { flex-basis: 100%; font-size: 12px; color: #596578; font-weight: 600; }
.video-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border: 1px solid #d5cdf1; border-radius: 6px; font-size: 12px; color: #4f4396; background: #f6f3ff; }
.video-chip:hover, .video-chip.selected { background: #ece6ff; border-color: #a99ae0; }
.video-chip .icon { width: 15px; }
.video-frame { aspect-ratio: 16 / 9; margin-top: 14px; background: #111; border-radius: 8px; overflow: hidden; }
.video-frame iframe { width: 100%; height: 100%; border: 0; display: block; }

/* AI tutor tab */
.pane-chat { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-messages { flex: 1; min-height: 0; padding: 18px 20px 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; scrollbar-width: thin; }
.chat-message { display: flex; align-items: flex-start; gap: 11px; }
.message-avatar { display: grid; place-items: center; flex-shrink: 0; width: 28px; height: 28px; background: #edf2fa; color: #365d98; border-radius: 7px; }
.message-avatar .icon { width: 16px; }
.message-content { font-size: 14.5px; line-height: 1.7; color: #303641; white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0; }
.message-content pre { white-space: pre; overflow-x: auto; margin: 8px 0; padding: 10px 12px; background: #f6f8fb; border: 1px solid #e4e8ef; border-radius: 7px; font: 12.5px/1.6 var(--mono); }
.message-content pre code { background: none; border: 0; padding: 0; }
.chat-message.user .message-avatar { background: #e9ecf1; color: #49515f; font-size: 11px; font-weight: 650; }
.chat-message.user .message-content { background: #f3f5f8; border-radius: 0 8px 8px 8px; padding: 9px 12px; }
.chat-message.error .message-content { color: #874723; }
.loading-dots { display: inline-flex; gap: 5px; padding: 8px 0; }
.loading-dots i { width: 5px; height: 5px; background: #6b85b5; border-radius: 50%; animation: pulse 1.2s infinite; }
.loading-dots i:nth-child(2) { animation-delay: .2s; }
.loading-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes pulse { 50% { opacity: .3; } }
.quick-prompts { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 18px 0; border-top: 1px solid var(--line); }
.quick-prompt { padding: 5px 10px; border: 1px solid #d6dce6; border-radius: 999px; font-size: 12px; color: #3f5779; background: #fafbfd; }
.quick-prompt:hover { background: #eaf0fb; border-color: #a8bde3; }
.quick-prompt:disabled { opacity: .55; }
.composer { padding: 10px 16px 12px; }
.composer-box { border: 1px solid #aeb9ca; border-radius: 10px; background: #fff; box-shadow: 0 2px 5px #172c4910; overflow: hidden; }
.composer-box:focus-within { border-color: #5b82d9; box-shadow: 0 0 0 3px #e5edfc; }
.composer textarea { display: block; width: 100%; min-height: 56px; max-height: 200px; padding: 11px 14px 4px; resize: vertical; outline: none; border: 0; background: transparent; color: #232d3c; font-size: 14.5px; line-height: 1.6; }
.composer-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 4px 8px 8px 13px; }
.composer-note { display: flex; align-items: center; gap: 5px; font-size: 11px; color: #626d7f; }
.composer-note .icon { width: 13px; }
.send-button { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 7px; background: var(--blue); color: #fff; }
.send-button:hover { background: var(--blue-dark); }
.send-button:disabled { background: #dce2ed; color: #6b778c; }
.send-button .icon { width: 19px; }
.chat-caption { padding: 0 18px 12px; font-size: 11px; text-align: center; color: #656c79; }

/* ---- Code pane (dark) ------------------------------------------------------ */
.code-pane { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; min-height: 0; background: var(--code-bg); border: 1px solid #0b0e17; border-radius: 10px; overflow: hidden; color: var(--code-text); box-shadow: 0 6px 24px #0b10201f; }
.code-head { flex-shrink: 0; height: 46px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 8px 0 14px; background: var(--code-panel); border-bottom: 1px solid var(--code-line); }
.code-tabs { display: flex; align-self: stretch; gap: 18px; }
.code-tab { position: relative; display: inline-flex; align-items: center; gap: 7px; font: 12.5px var(--mono); color: var(--code-muted); }
.code-tab .icon { width: 15px; }
.code-tab:hover { color: #fff; }
.code-tab.selected { color: #fff; }
.code-tab.selected:after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--code-accent); }
.code-controls { display: flex; align-items: center; gap: 4px; }
.saved { display: inline-flex; align-items: center; gap: 4px; margin-right: 6px; font-size: 11px; color: #8fc9a4; white-space: nowrap; }
.saved .icon { width: 13px; }
.font-size { display: inline-flex; align-items: center; gap: 3px; padding: 0 4px; color: var(--code-muted); }
.font-size .icon { width: 15px; }
.font-size select { border: 0; background: transparent; font-size: 12px; color: var(--code-text); padding: 4px 0; cursor: pointer; }
.font-size select option { color: #111; }
.dark-icon-button { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 6px; color: #9aa3b5; }
.dark-icon-button .icon { width: 17px; }
.dark-icon-button:hover, .dark-icon-button[aria-pressed="true"] { background: var(--code-raised); color: #fff; }

.step-bar { flex-shrink: 0; display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 6px 10px 6px 16px; background: #141a2b; border-bottom: 1px solid var(--code-line); flex-wrap: wrap; }
.lesson-step { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 650; letter-spacing: .5px; color: #a9bbdf; white-space: nowrap; }
.lesson-step .icon { width: 15px; color: var(--code-accent); }
.step-track { list-style: none; display: flex; flex-wrap: wrap; gap: 5px; padding: 0; margin: 0; }
.step-track li { display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 6px; border: 1px solid #3a435b; font-size: 11px; font-weight: 600; color: #aab3c6; font-variant-numeric: tabular-nums; }
.step-track li.done { background: #1d3a2c; border-color: #3f6f55; color: #9fe0bd; }
.step-track li.current { background: #4a7cf0; border-color: #4a7cf0; color: #fff; }
.step-track li .icon { width: 12px; }
.step-bar-tools { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.bar-button { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 6px; font-size: 12px; color: var(--code-muted); }
.bar-button .icon { width: 15px; }
.bar-button:hover { background: var(--code-raised); color: #dbe6ff; }
.mode-switch { display: inline-flex; align-items: center; gap: 8px; margin-left: 6px; font-size: 12px; color: #aab3c6; cursor: pointer; user-select: none; }
.mode-switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch { position: relative; width: 30px; height: 17px; border-radius: 9px; background: #3a435b; transition: background .15s; }
.switch:after { content: ''; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: #fff; transition: transform .15s; }
.mode-switch input:checked + .switch { background: #4a7cf0; }
.mode-switch input:checked + .switch:after { transform: translateX(13px); }
.mode-switch.locked { cursor: not-allowed; color: #8d96ab; }
.mode-switch.locked .switch { background: #3f5a99; opacity: .7; }
.mode-switch.locked .lock-icon { width: 13px; margin-left: -3px; }
.mode-switch input:focus-visible + .switch { outline: 3px solid #7299f0; outline-offset: 2px; }

/* The step, docked right above the code */
.task-panel { flex-shrink: 0; max-height: 42%; overflow-y: auto; padding: 10px 12px 12px; background: #141a2b; border-bottom: 1px solid var(--code-line); scrollbar-width: thin; }
.task-card { padding: 10px 14px 11px; border-radius: 8px; background: #18223a; border: 1px solid #2f4170; box-shadow: inset 3px 0 0 #6f95e8; color: #e6eaf2; font-size: 14px; line-height: 1.55; transition: border-color .15s, background .15s; }
.task-panel:hover .task-card { border-color: #4a64a8; background: #1b2744; }
.task-card.solo { box-shadow: inset 3px 0 0 #3a435b; border-color: #2c3550; background: #161d30; }
.task-card.done { box-shadow: inset 3px 0 0 #5fae7f; }
.task-card.done .icon { width: 16px; color: #8fd3a8; vertical-align: -3px; }
.task-card-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 5px; }
.task-meta { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #8d96ab; }
.task-num, .tour-num { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 6px; background: #4a7cf0; color: #fff; font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tour-num { min-width: 18px; height: 18px; font-size: 11px; vertical-align: 1px; }
.task-card-step { font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: #9fbaf6; }
.step-size { display: inline-flex; align-items: center; height: 19px; padding: 0 7px; border-radius: 10px; background: #f2c46a; color: #2b2210; font-size: 11px; font-weight: 700; white-space: nowrap; }
.task-link { padding: 0 2px; font-size: 12px; color: #9fbaf6; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; }
.task-link:hover { color: #dbe6ff; text-decoration-style: solid; }
.task-card-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; margin: 8px 0 0 -7px; }
.task-card-tools button { display: inline-flex; align-items: center; gap: 5px; padding: 3px 7px; border-radius: 5px; font-size: 12px; color: #9aa4ba; }
.task-card-tools button:hover:not(:disabled) { background: #24314f; color: #dbe6ff; }
.task-card-tools button:disabled { color: #6f7890; }
.task-card-tools .icon { width: 14px; }
.task-card-text { font-size: 15px; line-height: 1.6; color: #eef1f7; }
.task-card-text p + p { margin-top: 5px; }
.task-card-text a { color: #9fbaf6; }
.task-card code, .task-ahead code { font: 12.5px var(--mono); background: #222b42; border: 1px solid #2e3853; border-radius: 4px; padding: 1px 5px; color: #c4d4fb; }
.task-card .hint-box { margin: 8px 0 0; padding: 8px 11px; border: 1px solid #5a4a24; border-radius: 6px; background: #262113; color: #f1dfad; font-size: 13.5px; }
.task-card .hint-box code { background: #3a3220; border-color: #5a4a24; color: #ffe6a6; }
.hint-item + .hint-item { margin-top: 7px; padding-top: 7px; border-top: 1px dashed #5a4a24; }
.hint-count { font-size: 10px; font-weight: 700; margin-bottom: 2px; letter-spacing: .5px; text-transform: uppercase; color: #d7bd77; }
.task-card-note { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 12.5px; color: #9fe0bd; }
.task-card-note .icon { width: 15px; }
.task-ahead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; padding: 8px 12px; border-radius: 8px; background: #2e2413; border: 1px solid #6a5322; color: #f3dfae; font-size: 13px; line-height: 1.45; }
.task-ahead > .icon { width: 16px; color: #f2c46a; }
.task-ahead > p { flex: 1 1 260px; }
.task-ahead .task-link { color: #ffe2a3; font-size: 13px; font-weight: 700; }
.task-ahead-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.task-ahead-actions button { padding: 3px 9px; border-radius: 5px; border: 1px solid #7a6230; background: #3a2e17; color: #ffe2a3; font-size: 12px; font-weight: 600; }
.task-ahead-actions button:hover { background: #4a3a1c; }
.task-ahead-actions button[data-check-all] { border-color: #34497a; background: #1f2b49; color: #c4d4fb; }
.console-ahead { display: flex; align-items: flex-start; gap: 7px; margin-top: 8px !important; color: #f3dfae !important; }
.console-ahead .icon { width: 16px; color: #f2c46a; flex-shrink: 0; margin-top: 1px; }

/* The step pinned in the lesson pane (light), above the tabs */
.step-dock { margin-top: 12px; }
.step-dock-near { display: none; }
.step-dock .task-card { background: #f4f7fd; border-color: #d8e2f4; box-shadow: inset 3px 0 0 #6f95e8; color: #303947; }
.step-dock:hover .task-card { border-color: #b9cbee; background: #eef3fc; }
.step-dock .task-link { color: #5a6b8c; }
.step-dock .task-meta { color: #6b7486; }
.step-dock .task-card-text { color: #1f2733; }
.step-dock .task-link:hover { color: #1d47a0; }
.step-dock .task-card-tools button { color: #56627a; }
.step-dock .task-card-tools button:hover:not(:disabled) { background: #e1e9f8; color: #1d47a0; }
.step-dock .task-card-tools button:disabled { color: #8a93a3; }
/* After a failed check of this step: the help becomes buttons. */
.step-dock .task-card.stuck .task-card-tools { gap: 6px; margin-left: 0; }
.step-dock .task-card.stuck .task-card-tools button { padding: 4px 10px; border: 1px solid #c5d3ee; background: #fff; color: #1d47a0; font-weight: 600; }
.step-dock .task-card.stuck .task-card-tools button:hover:not(:disabled) { background: #eef3fd; }
.step-dock .task-card code { background: #e6edf9; border-color: #d3ddf0; color: #24406f; }
.step-dock .task-card .hint-box { max-height: 180px; overflow-y: auto; background: #fff9ec; border-color: #e7d6a8; color: #66522b; }
.step-dock .task-card .hint-box code { background: #f5e9cc; border-color: #e7d6a8; color: #6b4f12; }
.step-dock .hint-item + .hint-item { border-top-color: #ead9ad; }
.step-dock .hint-count { color: #9a7a2c; }
.step-dock .task-card-note { color: #2f6b45; }
.step-dock .task-card.solo { background: #f6f7f9; border-color: #e0e3e8; box-shadow: inset 3px 0 0 #b9c1cf; }
.step-dock .task-card.done { box-shadow: inset 3px 0 0 #6aa47c; }
.step-dock .task-card.done .icon { color: #3c7f53; }
.step-dock .task-ahead { background: #fff6e8; border-color: #ecd3a3; color: #6b4f12; }
.step-dock .task-ahead > .icon { color: #c58a1d; }
.step-dock .task-ahead .task-link { color: #8a5a00; }
.step-dock .task-ahead-actions button { background: #fff; border-color: #e2c38a; color: #7a5410; }
.step-dock .task-ahead-actions button:hover { background: #fff3dc; }
.step-dock .task-ahead-actions button[data-check-all] { border-color: #c9d6ee; background: #fff; color: #2f5bb8; }
/* The card points at the editor: a tip on its right edge, and a curved arrow to the line. */
.step-dock .task-card:not(.solo) { position: relative; box-shadow: inset 4px 0 0 #4a7cf0; }
.step-dock .task-card:not(.solo):before, .step-dock .task-card:not(.solo):after { content: ''; position: absolute; top: 14px; border-style: solid; border-color: transparent; border-width: 9px 0 9px 10px; }
.step-dock .task-card:not(.solo):before { right: -11px; border-left-color: #d8e2f4; }
.step-dock .task-card:not(.solo):after { right: -9px; border-left-color: #f4f7fd; }
.step-dock:hover .task-card:not(.solo):before { border-left-color: #b9cbee; }
.step-dock:hover .task-card:not(.solo):after { border-left-color: #eef3fc; }
.step-link { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 40; pointer-events: none; overflow: visible; color: #5b86ee; }
.step-link-path { fill: none; stroke: currentColor; stroke-width: 2; stroke-dasharray: 6 4; stroke-linecap: round; opacity: .9; }
.step-link.active { color: #4a7cf0; }
.step-link.active .step-link-path { stroke-width: 2.4; stroke-dasharray: none; opacity: 1; }

/* Step bar dots: finished ones go back, the current one shows its line */
.step-track li:has(> button) { padding: 0; }
.step-track li > button { display: grid; place-items: center; width: 100%; height: 100%; min-width: 20px; padding: 0 4px; border-radius: 5px; color: inherit; font: inherit; }
.step-track li.done { cursor: pointer; }
.step-track li.done:hover { background: #26553e; border-color: #5fae7f; color: #c6f0d7; }
.step-track li.current > button:hover { background: #5b89f5; }
/* A passed step should be impossible to miss */
.step-track li.just-done { animation: dot-done .55s cubic-bezier(.3, 1.6, .5, 1); }
.step-track li.just-current { animation: dot-current 1.4s ease-out; }
@keyframes dot-done { 0% { transform: scale(.6); background: #5fae7f; } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }
@keyframes dot-current { 0% { box-shadow: 0 0 0 0 rgba(74, 124, 240, .9); } 70% { box-shadow: 0 0 0 9px rgba(74, 124, 240, 0); } 100% { box-shadow: 0 0 0 0 rgba(74, 124, 240, 0); } }
.lesson-step.step-advance { animation: label-flash 1.2s ease-out; }
@keyframes label-flash { 0%, 30% { color: #fff; text-shadow: 0 0 10px #86aafa; } 100% { color: #a9bbdf; text-shadow: none; } }
.task-card.step-advance { animation: card-glow 1.5s ease-out; }
.task-card.step-advance .task-card-text, .task-card.step-advance .task-card-head { animation: card-in .5s cubic-bezier(.2, .8, .2, 1); }
.task-card.step-advance .task-num { animation: num-pop .6s .15s cubic-bezier(.3, 1.8, .5, 1) both; }
@keyframes card-glow { 0% { box-shadow: inset 4px 0 0 #5fae7f, 0 0 0 0 rgba(95, 174, 127, .55); } 25% { box-shadow: inset 4px 0 0 #5fae7f, 0 0 0 7px rgba(95, 174, 127, .3); } 100% { box-shadow: inset 4px 0 0 #4a7cf0, 0 0 0 0 rgba(95, 174, 127, 0); } }
@keyframes card-in { 0% { opacity: 0; transform: translateX(16px); } 100% { opacity: 1; transform: none; } }
@keyframes num-pop { 0% { transform: scale(.4); } 70% { transform: scale(1.3); } 100% { transform: scale(1); } }

/* Full-width mode hides the lesson pane: show the step above the code, hints as an overlay. */
.task-panel.max-only { display: none; position: relative; max-height: none; overflow: visible; }
.ide.max .task-panel.max-only { display: block; }
.ide:not(.hints-open) .task-panel.max-only .hint-box { display: none; }
.task-panel.max-only .hint-box { position: absolute; left: 24px; right: 24px; top: calc(100% - 4px); z-index: 30; max-height: 45vh; overflow-y: auto; box-shadow: 0 14px 34px #000b; }

/* First-run spotlight tour (anno.js style) */
.tour-shade { position: fixed; inset: 0; z-index: 95; touch-action: none; }
.tour-hole { position: fixed; z-index: 96; border-radius: 10px; box-shadow: 0 0 0 9999px rgba(8, 12, 24, .62); outline: 2px solid #86aafa; pointer-events: none; transition: top .2s, left .2s, width .2s, height .2s; }
.tour-pop { position: fixed; z-index: 97; padding: 16px 18px 14px; border-radius: 12px; background: #fff; color: var(--ink); box-shadow: 0 18px 60px #0007; }
.tour-pop h4 { font-size: 16px; font-weight: 700; letter-spacing: -.2px; margin-bottom: 4px; }
.tour-pop p { font-size: 14px; color: #4a5363; line-height: 1.55; }
.tour-count { font-size: 11px !important; font-weight: 700; letter-spacing: .6px; color: #7a8394 !important; margin-bottom: 4px; }
.tour-label { margin-top: 10px; font-size: 12.5px !important; font-weight: 600; color: #2f4a77 !important; }
.tour-code { margin: 6px 0 0; padding: 10px 12px; border-radius: 7px; background: #101421; color: #e6eaf2; font: 14px/1.55 var(--mono); white-space: pre; overflow-x: auto; user-select: none; -webkit-user-select: none; }
.tour-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 14px; }
.tour-actions .primary { min-height: 34px; padding: 7px 16px; }
.tour-skip { font-size: 13px; color: #6a7487; padding: 6px 8px; }
.tour-skip:hover { color: var(--ink); }

/* Editor markers only: the step's number in the gutter, a placeholder (or an insertion
   line when the step goes between two lines), and amber lines written for later steps. */
.ace_marker-layer .step-line { position: absolute; z-index: 2; }
.ace_marker-layer .step-line.ghost { background: rgba(134, 170, 250, .07); }
.ace_marker-layer .step-line.ghost:after { content: var(--step-ghost); position: absolute; top: 0; left: var(--ghost-left, 10px); right: 16px; overflow: hidden; text-overflow: ellipsis; color: #7f9bd6; font-style: italic; white-space: pre; pointer-events: none; }
.ace_marker-layer .step-line.insert { background: none; }
.ace_marker-layer .step-line.typed { background: rgba(134, 170, 250, .06); }
.code-pane.linking .ace_marker-layer .step-line.ghost, .code-pane.linking .ace_marker-layer .step-line.typed { background: rgba(134, 170, 250, .2); box-shadow: inset 2px 0 0 #86aafa; }
.code-pane.linking .ace_marker-layer .step-line.insert { background: rgba(134, 170, 250, .12); }
.code-pane.step-flash .ace_marker-layer .step-line { animation: step-flash 1.6s ease-out; }
@keyframes step-flash { 0%, 35% { background: rgba(134, 170, 250, .38); } 100% { background: rgba(134, 170, 250, .07); } }
.ace_gutter-cell.step-here { position: relative; color: #fff; }
.ace_gutter-cell.step-here:before { content: var(--step-num, '▸'); position: absolute; left: 3px; top: 50%; transform: translateY(-50%); min-width: 15px; height: 15px; padding: 0 3px; border-radius: 4px; background: #4a7cf0; color: #fff; font: 700 10px/15px ui-sans-serif, system-ui, sans-serif; text-align: center; box-sizing: border-box; }
.ace_marker-layer .ahead-marker { position: absolute; z-index: 2; background: rgba(242, 196, 106, .13); box-shadow: inset 3px 0 0 #f2c46a; }
.ace_gutter-cell.ahead-line { color: #f2c46a; background: rgba(242, 196, 106, .16); }

.editor-body { position: relative; flex: 1 1 auto; min-height: 140px; background: var(--code-bg); }
.code-editor { position: absolute; inset: 0; font: 14px/1.55 var(--mono); }
.preview-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.ace_editor .ace_marker-layer .step-lines { position: absolute; background: rgba(134, 170, 250, .16); border-left: 2px solid #86aafa; }

.console { flex-shrink: 0; border-top: 1px solid var(--code-line); background: #0c101b; }
.console-head { display: flex; align-items: center; gap: 12px; width: 100%; height: 36px; padding: 0 14px; background: var(--code-panel); text-align: left; font-size: 12px; color: var(--code-muted); }
.console-head:hover { color: var(--code-text); }
.console-title { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; letter-spacing: .4px; text-transform: uppercase; font-size: 11px; color: #b7c2d8; }
.console-title .icon { width: 14px; }
.console-status { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.console-status.accepted { color: #8fd3a8; font-weight: 600; }
.console-status.accepted:before { content: '✓'; margin-right: 6px; }
.console-status.failed, .console-status.compile, .console-status.runtime, .console-status.timeout { color: #f2a28c; font-weight: 600; }
.console-chevron { margin-left: auto; width: 15px; transform: rotate(180deg); transition: transform .15s; }
.console.open .console-chevron { transform: none; }
.console-body { max-height: 38vh; overflow-y: auto; padding: 14px 16px 16px; scrollbar-width: thin; }
.console-body .check-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.console-body .check-heading h3 { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 650; color: #fff; }
.console-body .check-heading h3 .icon { width: 19px; }
.console-body.accepted .check-heading h3 { color: #8fd3a8; }
.console-body.failed .check-heading h3, .console-body.compile .check-heading h3, .console-body.runtime .check-heading h3, .console-body.timeout .check-heading h3 { color: #f2a28c; }
.console-body .check-heading > span { color: var(--code-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.console-body > p { color: #aab3c6; font-size: 13px; margin-top: 6px; }
.check-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.check-list li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #c5cad5; }
.check-list .icon { width: 16px; }
.check-list .passed { color: #8fd3a8; }
.check-list .failed { color: #f2a28c; }
.check-list .meta { margin-left: auto; font-size: 11px; color: var(--code-muted); font-variant-numeric: tabular-nums; }
.output-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.output-block h4 { font-size: 10.5px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--code-muted); margin: 14px 0 0; }
.output-grid .output-block h4 { margin-top: 0; }
.console .source-code { margin: 6px 0 0; max-height: 240px; white-space: pre-wrap; overflow-wrap: anywhere; background: #151a28; border-color: var(--code-line); color: var(--code-text); }
/* Errors read first: bigger, brighter text on a red-tinted panel, the message itself in bold. */
.console .source-code.errors { font-size: 14px; line-height: 1.7; color: #eef1f7; background: #1f1520; border-color: #4b2b36; }
.error-message { color: #ffb6a6; font-weight: 600; }
.error-line { padding: 0; border: 0; background: none; color: #a9c4ff; font: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.error-line:hover { color: #d2e0ff; }
.tests-table { width: 100%; max-width: 560px; margin-top: 12px; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.tests-table th { text-align: left; padding: 5px 10px; font-size: 10.5px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--code-muted); border-bottom: 1px solid var(--code-line); }
.tests-table td { padding: 6px 10px; border-bottom: 1px solid #1d2335; color: #c5cad5; }
.tests-table td:nth-child(2) { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.tests-table td .icon { width: 15px; }
.tests-table tr.passed td:nth-child(2) { color: #8fd3a8; }
.tests-table tr.failed td:nth-child(2) { color: #f2a28c; }
.diff-note { margin-top: 12px !important; font-size: 12.5px !important; color: #f3dfae !important; }
.console mark { border-radius: 3px; padding: 0 2px; color: inherit; }
.console mark.diff-yours { background: rgba(242, 120, 92, .28); }
.console mark.diff-expected { background: rgba(95, 174, 127, .28); }
.test-input { margin-top: 14px; }
.test-input summary { cursor: pointer; font-size: 10.5px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--code-muted); }
.test-input summary span { margin-left: 6px; font-weight: 400; letter-spacing: 0; text-transform: none; color: #6f7890; }
.test-input summary:hover { color: var(--code-text); }
.test-input .source-code { max-height: 200px; }
/* The first test a check got wrong, like the lesson's example: input, expected, the learner's output. */
.failed-test { margin-top: 12px; }
.failed-test h4 { margin: 0; font-size: 10.5px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: #f2a28c; }
.console .failed-test .source-code { font-size: 13px; line-height: 1.6; background: #1f1520; border-color: #4b2b36; }
.failed-test b { color: #f3dfae; font-weight: 600; }
.failed-test.passed h4 { color: #8fd3a8; }
.console .failed-test.passed .source-code { background: #151a28; border-color: var(--code-line); }
.all-tests .failed-test { margin-top: 10px; }
.failed-test em { color: var(--code-muted); }
.all-tests > summary { font-size: 11.5px; }
.all-tests[open] > summary { margin-bottom: 4px; }
.result-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
/* Long compiler output scrolls behind the actions, so "Ask the tutor" is always in view. */
.console-body .result-actions { position: sticky; bottom: -16px; z-index: 1; margin: 14px -16px -16px; padding: 10px 16px 14px; background: #0c101b; border-top: 1px solid var(--code-line); }
.check-button { display: inline-flex; align-items: center; gap: 7px; padding: 7px 11px; background: #1c2336; border: 1px solid #303a54; border-radius: 6px; color: #b7cbfa; font-size: 12px; }
.check-button:hover { background: #242d45; color: #dbe6ff; }
.check-button .icon { width: 15px; }
/* The first thing to try when a check fails: the tutor sees the step, the code and the error. */
.check-button.tutor-action { background: #5b47c9; border-color: #725ee6; color: #fff; font-weight: 600; }
.check-button.tutor-action:hover { background: #6a56da; color: #fff; }
.running { display: flex; align-items: center; gap: 10px; color: #aab3c6; font-size: 13px; }
.running .loading-dots i { background: #86aafa; }

.code-foot { flex-shrink: 0; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 10px 9px 16px; background: var(--code-panel); border-top: 1px solid var(--code-line); }
.code-foot kbd { background: #222b42; border-color: #34405e; color: #c5cad5; }
.kbd-note { font-size: 11px; color: var(--code-muted); }
.code-foot .primary { margin-left: auto; background: #3b6fe0; border-color: #3b6fe0; min-height: 38px; }
.code-foot .primary:hover { background: #4d7ff0; }
.code-foot .primary:disabled { background: #2a3248; border-color: #2a3248; color: #8d96ab; }

/* Reading lessons */
.reading-page .main { max-width: 900px; }
.reading-pane .pane-head { padding-bottom: 16px; }
.reading-pane .pane-scroll { overflow: visible; }
.reading-video { margin-bottom: 22px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.reading-actions { display: flex; gap: 10px; flex-wrap: wrap; padding-top: 18px; margin-top: 18px; border-top: 1px solid var(--line); }

/* ---- Dialogs, toast --------------------------------------------------------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 80; background: #18223677; display: flex; justify-content: center; align-items: center; padding: 24px; }
.modal { width: 560px; max-width: 100%; max-height: 88vh; overflow: auto; padding: 26px 28px; border: 1px solid #d3d9e4; border-radius: 12px; background: #fff; box-shadow: 0 24px 90px #121e3a33; }
.modal.wide { width: 860px; }
.modal-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.modal-top h2 { font-size: 21px; font-weight: 650; letter-spacing: -.4px; }
.modal > p { color: #586376; font-size: 15px; line-height: 1.7; margin: 10px 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.modal-actions.centered { justify-content: center; }
.checkpoint { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 0; border-top: 1px solid var(--line); }
.checkpoint h3 { font-size: 14px; margin: 0; }
.checkpoint p { font-size: 12px; color: #667183; margin-top: 4px; }
.checkpoint button, .checkpoint-link { font-size: 12px; border: 1px solid #cbd6e8; border-radius: 5px; padding: 7px 11px; color: #355788; background: #fff; text-decoration: none; white-space: nowrap; }
.checkpoint button:hover:not(:disabled), .checkpoint-link:hover { background: #eff4fc; }
.checkpoint button:disabled { color: #8a93a3; background: #f6f7f9; }
.celebration { display: grid; place-items: center; width: 64px; height: 64px; margin: 6px auto 16px; border-radius: 50%; background: #edf7f0; color: #3c7f53; }
.celebration .icon { width: 32px; height: 32px; }
.modal.complete { text-align: center; }
.modal.complete .modal-top, .modal.complete .modal-actions { justify-content: center; }
.stat-row { display: flex; justify-content: space-around; padding: 18px 0; margin: 18px 0 0; border-block: 1px solid var(--line); }
.stat-row strong { display: block; font-size: 24px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat-row span { display: block; margin-top: 4px; font-size: 12px; color: #627087; }
.step-code-editor { height: 380px; border: 1px solid #0b0e17; border-radius: 8px; overflow: hidden; font: 14px/1.55 var(--mono); }
.modal-note { font-size: 13px; color: #5f6878; margin: 0 0 12px; }
#toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); padding: 12px 18px; border: 1px solid #424e63; border-radius: 8px; background: #263348; color: #fff; font-size: 13px; box-shadow: 0 8px 25px #18264225; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 100; max-width: calc(100vw - 36px); }
#toast.visible { opacity: 1; transform: translate(-50%, 0); }

/* Locked lesson */
.empty-canvas { width: 162px; height: 111px; margin: 0 auto 26px; border: 1px solid #cdd7e7; border-radius: 8px; transform: rotate(-3deg); background: #fafcff; box-shadow: 7px 7px 0 #edf2fa; text-align: left; }
.canvas-toolbar { display: flex; gap: 4px; padding: 8px; border-bottom: 1px solid #dfe6f0; }
.canvas-toolbar i { width: 4px; height: 4px; border-radius: 50%; background: #b6c4da; }
.canvas-content { padding: 16px; position: relative; }
.canvas-content > span { display: block; height: 5px; background: #dde5f2; border-radius: 2px; width: 65%; margin-bottom: 7px; }
.canvas-content > span:first-child { height: 7px; width: 46%; background: #9fb7df; margin-bottom: 12px; }
.canvas-content > div { position: absolute; right: -12px; bottom: 4px; width: 33px; height: 33px; display: grid; place-items: center; border-radius: 8px; background: #e6eefc; border: 1px solid #c8d8f5; color: #416caf; }
.canvas-content > div .icon { width: 16px; }

/* ---- Paywall (old app: "Unlock full access with Pro") -------------------------- */
.modal.paywall-modal { padding: 0; overflow: auto; }
.paywall { display: grid; grid-template-columns: 1.05fr 1fr; text-align: left; }
.paywall-main { position: relative; padding: 30px 32px 28px; }
.paywall-close { position: absolute; top: 12px; right: 12px; }
.paywall h2 { font-size: 26px; font-weight: 650; letter-spacing: -.6px; line-height: 1.25; margin-top: 2px; }
.paywall-lead { margin-top: 10px; font-size: 14px; color: #4f5a6c; line-height: 1.65; }
.paywall-join { margin-top: 14px; font-size: 14px; color: #4f5a6c; }
.paywall strong { color: var(--ink); font-weight: 650; }
.paywall-benefits { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 11px; }
.paywall-benefits li { display: flex; gap: 11px; align-items: flex-start; }
.paywall-benefits strong { display: block; font-size: 14px; font-weight: 600; line-height: 1.35; }
.paywall-benefits small { display: block; font-size: 12px; color: #6a7486; margin-top: 1px; }
.paywall-tick { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #e6f2ea; color: #2f7247; margin-top: 1px; }
.paywall-tick .icon { width: 13px; height: 13px; stroke-width: 2.4; }
.paywall-actions { display: flex; align-items: center; gap: 18px; margin-top: 24px; flex-wrap: wrap; }
.paywall-side { padding: 30px 28px 26px; background: #f3f5f9; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; }
.paywall-video-label { font-size: 13px; color: #4f5a6c; padding-right: 28px; }
.paywall-video { position: relative; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #1b2232; box-shadow: 0 10px 24px -12px #1b223288; }
.paywall-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.paywall-quote { margin: 4px 0 0; padding: 14px 16px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.paywall-quote p { font-size: 13px; line-height: 1.65; color: #3f4a5c; }
.paywall-quote footer { margin-top: 8px; font-size: 12px; color: #6a7486; }
.paywall-done:not([hidden]) { margin: -6px 0 20px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.paywall-complete { display: flex; align-items: center; gap: 16px; padding-right: 30px; }
.paywall-complete .booly-meme { width: 112px; margin: 0; flex-shrink: 0; }
.paywall-complete .booly-meme figcaption { display: none; }
.paywall-complete .celebration { margin: 0; flex-shrink: 0; }
.paywall-complete h3 { font-size: 17px; font-weight: 650; }
.paywall-complete p { font-size: 13px; color: #5f6878; margin-top: 3px; }
.paywall-complete .text-button { margin-top: 4px; font-weight: 600; color: var(--blue); }

/* ---- Booly and share cards ------------------------------------------------------------ */
.booly-meme { width: min(260px, 70%); margin: 2px auto 16px; }
.booly-meme img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; object-position: 50% 30%; border-radius: 12px; box-shadow: 0 10px 26px -14px #1b223299; animation: booly-in .5s cubic-bezier(.2, .9, .3, 1.3) both; }
.booly-meme figcaption { margin-top: 10px; font-size: 14px; font-weight: 600; color: #343d4d; line-height: 1.45; }
@keyframes booly-in { from { opacity: 0; transform: scale(.85) rotate(-4deg); } to { opacity: 1; transform: none; } }
/* "Lesson complete": the share row under the stats, as noticeable as the stats themselves. */
.share-nudge { display: flex; align-items: center; gap: 14px; margin-top: 18px; padding: 14px 16px; border: 1px solid #c9d8f6; border-radius: 10px; background: #f2f6ff; text-align: left; }
.share-nudge-icon { display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%; background: #dfe8fd; color: var(--blue); }
.share-nudge-icon .icon { width: 20px; height: 20px; }
.share-nudge-text { flex: 1; min-width: 0; }
.share-nudge-text strong { display: block; font-size: 14px; font-weight: 650; color: #1f2a3d; }
.share-nudge-text span { display: block; margin-top: 2px; font-size: 12.5px; color: #5b6880; line-height: 1.45; }
.share-nudge .secondary { flex-shrink: 0; }
@media (max-width: 420px) { .share-nudge { flex-wrap: wrap; } .share-nudge .secondary { width: 100%; } }
/* The 7-day trial: after the first lessons (lesson complete), under the paywall's button. */
.trial-nudge { display: flex; align-items: center; gap: 14px; margin-top: 18px; padding: 14px 16px; border: 1px solid #f1d9a8; border-radius: 10px; background: #fff8ea; text-align: left; }
.trial-nudge-icon { display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%; background: #fdecc8; color: #a5650b; }
.trial-nudge-icon .icon { width: 20px; height: 20px; }
.trial-nudge-text { flex: 1; min-width: 0; }
.trial-nudge-text strong { display: block; font-size: 14px; font-weight: 650; color: #3a2a10; }
.trial-nudge-text span { display: block; margin-top: 2px; font-size: 12.5px; color: #6f5a35; line-height: 1.45; }
.trial-nudge .secondary { flex-shrink: 0; }
@media (max-width: 420px) { .trial-nudge { flex-wrap: wrap; } .trial-nudge .secondary { width: 100%; } }
.paywall-trial-note { margin-top: 10px; font-size: 12.5px; color: #5f6878; }

.modal.milestone, .modal.share-modal { width: 640px; }
.share-box { margin-top: 14px; text-align: left; }
.share-card { display: block; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #f5f6f8; aspect-ratio: 1200 / 630; animation: card-pop .45s ease-out both; }
.share-card img { display: block; width: 100%; height: 100%; object-fit: cover; transition: opacity .2s; }
.share-card img.loading { opacity: .35; }
@keyframes card-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.share-name { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 13px; color: #4f5a6c; cursor: pointer; }
.share-name input { width: 16px; height: 16px; accent-color: var(--blue); margin: 0; }
.share-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.share-button { display: inline-flex; align-items: center; min-height: 36px; padding: 7px 13px; border: 1px solid #cbd5e5; border-radius: 7px; background: #fff; color: #2d4670; font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer; }
.share-button:hover { background: #eff4fc; }
.share-button.linkedin { background: #0a66c2; border-color: #0a66c2; color: #fff; }
.share-button.linkedin:hover { background: #0857a6; }
.share-button.x { background: #14171a; border-color: #14171a; color: #fff; }
.share-button.x:hover { background: #000; }
.share-button.facebook { background: #1877f2; border-color: #1877f2; color: #fff; }
.share-button.facebook:hover { background: #0f66d8; }
.modal.milestone .modal-actions { margin-top: 18px; }
.intro-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.secondary.large { font-size: 14px; padding: 12px 18px; min-height: 46px; }

/* Public share page */
.share-page { background: #f5f6f8; }
.share-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 900px; margin: 0 auto; padding: 18px 20px; }
.share-top .logo { height: 30px; width: auto; display: block; }
.share-main { max-width: 860px; margin: 0 auto; padding: 18px 20px 60px; text-align: center; }
.share-main h1 { font-size: clamp(26px, 4.4vw, 40px); font-weight: 700; letter-spacing: -1px; line-height: 1.2; margin-top: 6px; }
.share-main h1 span { color: var(--blue); }
.share-card-image { display: block; width: 100%; height: auto; margin: 26px 0 0; border-radius: 14px; border: 1px solid var(--line); box-shadow: 0 24px 60px -30px #1b223277; }
.share-main .stat-row { margin-top: 24px; }
.share-pitch { margin-top: 30px; padding: 30px 28px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.share-pitch h2 { font-size: 22px; font-weight: 650; letter-spacing: -.4px; }
.share-pitch p { max-width: 600px; margin: 10px auto 20px; font-size: 15px; color: var(--muted); line-height: 1.7; }

/* ---- Sign in ----------------------------------------------------------------- */
.login-page { min-height: 100vh; background: #f5f6f8; }
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 32px 18px; }
.login-card { display: grid; grid-template-columns: 1fr 1.05fr; width: 940px; max-width: 100%; background: #fff; border: 1px solid #d9dfe8; border-radius: 14px; overflow: hidden; box-shadow: 0 24px 70px #1c315a14; }
.login-story { padding: 40px 36px; background: #20232b; color: #e1e4eb; display: flex; flex-direction: column; justify-content: center; }
.login-story .intro-kicker { color: #9fb0cc; }
.login-story h1 { font-size: 28px; font-weight: 650; letter-spacing: -.7px; line-height: 1.3; color: #fff; }
.login-points { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 16px; }
.login-points li { display: flex; gap: 12px; font-size: 14px; line-height: 1.6; color: #c5cad5; }
.login-points strong { color: #fff; font-weight: 600; }
.login-points .icon { color: #90b2fd; margin-top: 2px; }
.login-form { padding: 36px 36px 30px; display: flex; flex-direction: column; }
.login-brand { margin-bottom: 30px; }
.login-brand .logo { height: 36px; }
.login-form h2 { font-size: 24px; font-weight: 650; letter-spacing: -.5px; }
.login-sub { font-size: 14px; color: var(--muted); margin-top: 6px; }
.login-buttons { display: grid; gap: 12px; margin: 26px 0 16px; }
.google-slot { min-height: 44px; display: flex; justify-content: center; }
.facebook-button { display: flex; align-items: center; justify-content: center; gap: 10px; height: 44px; width: 100%; max-width: 320px; margin: 0 auto; border-radius: 4px; background: #1877f2; color: #fff; font-size: 14px; font-weight: 600; }
.facebook-button:hover { background: #166fe5; }
.facebook-button svg { width: 20px; height: 20px; }
.facebook-button:disabled { opacity: .7; }
.login-status { margin: 0 0 12px; padding: 10px 12px; border-radius: 6px; background: #fff4ed; border: 1px solid #e8c6ae; color: #874723; font-size: 13px; }
.account-note { font-size: 12px; color: #687182; line-height: 1.6; margin-top: 8px; }
.account-note a { color: #3e577a; }
.back-link { margin-top: auto; padding-top: 22px; align-self: flex-start; }
.error-card { width: 520px; max-width: 100%; padding: 36px; background: #fff; border: 1px solid var(--line); border-radius: 12px; text-align: center; }
.error-card h1 { font-size: 24px; font-weight: 650; }
.error-card p:not(.intro-kicker) { color: var(--muted); margin-top: 10px; }

/* ---- Responsive -------------------------------------------------------------- */
@media (max-width: 1180px) { .appbar-progress, .account-name { display: none; } }
@media (max-width: 1000px) {
  /* Stack the panes and let the page scroll. */
  .lesson-page .main { height: auto; padding: 10px; }
  .ide { flex-direction: column; height: auto; gap: 12px; }
  .lesson-pane { flex: none; min-width: 0; }
  .lesson-pane .pane-scroll { max-height: 60vh; }
  /* The tutor fills the screen under the app bar and the tabs (opening it scrolls the tabs up there).
     flex: none so the height holds: Safari otherwise shrinks the panel to its fixed parts and leaves
     the messages almost no room. */
  .pane-tabs { scroll-margin-top: var(--appbar); }
  .pane-chat { flex: none; height: calc(100vh - var(--appbar) - 54px); height: calc(100dvh - var(--appbar) - 54px); min-height: 360px; }
  .resizer, .maximize-button { display: none; }
  .code-pane { flex: none; height: 88vh; min-height: 560px; }
  /* The step card sits right above the editor, where the learner types, not above the lesson text. */
  .lesson-pane .step-dock { display: none; }
  .step-dock-near { display: block; margin: 0; }
  .step-dock-near .task-card:not(.solo):before, .step-dock-near .task-card:not(.solo):after { display: none; }
}
@media (max-width: 860px) { .login-card { grid-template-columns: 1fr; } .login-story { display: none; } .login-form { padding: 28px 22px 24px; } }
@media (max-width: 700px) {
  .appbar { padding: 0 12px; gap: 10px; }
  .appbar-left { gap: 8px; }
  .brand .logo { height: 24px; }
  .lessons-button span, .course-switch-name, .appbar-divider, .plan-badge { display: none; }
  .lessons-button { padding: 0 9px; }
  .top-actions { gap: 10px; }
  .main { padding: 18px 14px 40px; }
  .intro-row { flex-direction: column; align-items: stretch; }
  .intro-row h1, .home-intro h1 { font-size: 24px; }
  .home-intro { padding: 20px; }
  .menu.course-menu { width: min(400px, 92vw); left: -60px; }
  .lesson-tags .tag.muted { display: none; }
  .output-grid { grid-template-columns: 1fr; }
  .kbd-note { display: none; }
  .search-box input { width: 100%; }
  .curriculum-tools, .search-box { width: 100%; }
  .curriculum-notice { flex-wrap: wrap; }
  .pane-head { padding: 14px 14px 0; }
  .pane-scroll { padding: 14px; }
  /* Tutor: the suggestions become one row to swipe, and the input starts smaller. */
  .chat-messages { padding: 14px 14px 8px; }
  .quick-prompts { flex-wrap: nowrap; overflow-x: auto; padding: 10px 14px 2px; scrollbar-width: none; }
  .quick-prompts::-webkit-scrollbar { display: none; }
  .quick-prompt { flex: none; white-space: nowrap; }
  .composer { padding: 8px 12px 10px; }
  .composer textarea { min-height: 0; height: 48px; }
  .chat-caption { padding: 0 14px 10px; }
  .pane-title h1 { font-size: 19px; }
  .modal { padding: 22px 18px; }
  .stat-row strong { font-size: 20px; }
  .paywall { grid-template-columns: 1fr; }
  .paywall-main { padding: 24px 20px; }
  .paywall-side { padding: 20px; border-left: 0; border-top: 1px solid var(--line); }
  .paywall h2 { font-size: 22px; padding-right: 26px; }
  .paywall-complete { padding-right: 24px; }
  .paywall-complete .booly-meme { width: 80px; }
  .intro-actions { justify-content: stretch; }
  .part-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .part-progress { justify-items: start; grid-template-columns: auto 1fr; align-items: center; }
  .part-progress small { grid-column: 1 / -1; }
  .intro-actions > * { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* ---- Discount countdown, feedback, path question, code from another browser ---- */
.discount-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid #f0c9b8; border-radius: 999px; background: #fff4ee; color: #9a4325; font-size: 12px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.discount-pill:hover { background: #ffeadf; }
.discount-pill .icon { width: 14px; height: 14px; }
.discount-pill b, .paywall-discount b { font-variant-numeric: tabular-nums; }
.paywall-discount { display: flex; align-items: center; gap: 8px; margin-top: 18px; padding: 10px 14px; border-radius: 8px; background: #fff4ee; color: #9a4325; font-size: 14px; font-weight: 600; }
.feedback-form label { display: block; font-size: 14px; color: #3d4757; margin-bottom: 10px; }
.feedback-form textarea { display: block; width: 100%; min-height: 140px; padding: 10px 12px; margin-bottom: 10px; border: 1px solid #cfd5df; border-radius: 8px; resize: vertical; line-height: 1.55; }
.feedback-form textarea:focus { outline: 3px solid #c9d8fa; border-color: #7299f0; }
.path-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 6px; }
.path-choice { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 18px; text-align: left; border: 1px solid #d5dbe5; border-radius: 10px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.path-choice:hover, .path-choice:focus-visible { border-color: var(--blue); box-shadow: 0 4px 16px #245bd61f; }
.path-choice:disabled { opacity: .6; cursor: wait; }
.path-choice strong { font-size: 16px; }
.path-choice > span:last-child { font-size: 13px; color: var(--muted); line-height: 1.5; }
.path-icon { display: grid; place-items: center; width: 36px; height: 36px; margin-bottom: 4px; border-radius: 8px; background: #edf2fc; color: var(--blue); }
.path-foot { margin-top: 14px; font-size: 12.5px; color: var(--muted); }
.path-back { margin-top: 14px; }
.language-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 6px; }
.language-choice { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 12px 14px; border: 1px solid #d5dbe5; border-radius: 10px; background: #fff; color: inherit; font-size: 15px; font-weight: 600; text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.language-choice:hover, .language-choice:focus-visible { border-color: var(--blue); box-shadow: 0 4px 16px #245bd61f; }
.language-choice .course-dot { min-width: 34px; height: 30px; font-size: 12px; }
.restore-bar { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 16px; background: #1c2a1f; border-bottom: 1px solid #2c4232; color: #cfe3d4; font-size: 13px; line-height: 1.45; }
.restore-bar > span { flex: 1; }
.restore-bar strong { color: #fff; font-weight: 600; }
.restore-bar .icon { width: 16px; color: #84c495; }
.restore-load { padding: 6px 12px; border-radius: 6px; background: #3f8a55; color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; }
.restore-load:hover { background: #4a9a62; }
.restore-dismiss { color: #9db8a4; }
@media (max-width: 700px) {
  /* On a phone the timer takes the Upgrade link's place (it links to the plans too). */
  .discount-label, .discount-pill .countdown-seconds, .discount-pill ~ .upgrade-link { display: none; }
  .path-choices { grid-template-columns: 1fr; }
  .language-choices { gap: 8px; }
  .language-choice { gap: 8px; padding: 10px; font-size: 14px; }
  .language-choice .course-dot { min-width: 30px; height: 28px; }
  .restore-bar { flex-wrap: wrap; }
}

/* ---- Quizzes: options instead of an editor ---- */
.quiz { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); }
.quiz-options { display: grid; gap: 10px; margin-top: 12px; }
.quiz-option { position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 13px 16px; border: 1px solid #d5dbe5; border-radius: 10px; background: #fff; cursor: pointer; transition: border-color .15s, box-shadow .15s, background .15s; }
.quiz-option:hover { border-color: #9db5ec; }
.quiz-option input { position: absolute; opacity: 0; pointer-events: none; }
.quiz-option:has(input:focus-visible) { outline: 3px solid #7299f0; outline-offset: 2px; }
.quiz-letter { display: grid; place-items: center; flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; border: 1px solid #c7cfdc; color: #4a5568; font-size: 13px; font-weight: 650; }
.quiz-text { padding-top: 2px; font-size: 15px; line-height: 1.55; }
.quiz-text code { font: 13.5px var(--mono); padding: 1px 5px; border-radius: 4px; background: #f1f3f7; }
.quiz-option.selected { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); background: #f6f9ff; }
.quiz-option.selected .quiz-letter { background: var(--blue); border-color: var(--blue); color: #fff; }
.quiz-option.wrong { border-color: #d98b74; box-shadow: 0 0 0 1px #d98b74; background: #fff6f3; }
.quiz-option.wrong .quiz-letter { background: var(--red); border-color: var(--red); color: #fff; }
.quiz-option.right, .quiz-option.answer { border-color: #6aa77c; box-shadow: 0 0 0 1px #6aa77c; background: #f2faf4; }
.quiz-option.right .quiz-letter, .quiz-option.answer .quiz-letter { background: var(--green); border-color: var(--green); color: #fff; }
.quiz-feedback { margin-top: 16px; padding: 14px 16px; border-radius: 10px; font-size: 14.5px; line-height: 1.65; }
.quiz-feedback p + p { margin-top: 8px; }
.quiz-feedback.right, .quiz-feedback.reveal { background: #f2faf4; border: 1px solid #cfe6d6; }
.quiz-feedback.wrong { background: #fff6f3; border: 1px solid #f0d2c8; }
.quiz-verdict { display: flex; align-items: center; gap: 8px; font-weight: 650; }
.quiz-feedback.right .quiz-verdict, .quiz-feedback.reveal .quiz-verdict { color: var(--green); }
.quiz-feedback.wrong .quiz-verdict { color: var(--red); }
.quiz-note { color: var(--muted); font-size: 13px; }
.quiz-text pre { margin: 6px 0 0; padding: 7px 10px; border-radius: 6px; background: #f3f5f8; font: 13px/1.5 var(--mono); white-space: pre; overflow-x: auto; }
.quiz-text pre code { padding: 0; background: none; font: inherit; }
.quiz-option.selected .quiz-text pre { background: #e9effb; }

/* ---- Public lesson pages (link/): the workspace for visitors, then the lesson's article -------- */
.guest-login { font-size: 13px; font-weight: 600; color: #2d3a52; text-decoration: none; padding: 0 4px; }
.guest-login:hover { color: var(--blue); }
.guest-start { min-height: 36px; padding: 7px 14px; font-weight: 600; }
.guest-article { background: #fff; border-top: 1px solid var(--line); }
.guest-article-inner { max-width: 780px; margin: 0 auto; padding: 56px 24px 40px; }
.guest-article #article-title { font-size: 30px; line-height: 1.2; letter-spacing: -.6px; margin: 6px 0 26px; }
.guest-article-body h2 { font-size: 21px; line-height: 1.3; margin: 34px 0 10px; }
.guest-article-body h3 { font-size: 17px; margin: 24px 0 8px; }
.guest-article-body p, .guest-article-body li { color: #39404d; font-size: 16px; line-height: 1.75; }
.guest-article-body p { margin: 0 0 14px; }
.guest-article-body ul, .guest-article-body ol { padding-left: 22px; margin: 0 0 14px; }
.guest-article-body pre { margin: 0 0 16px; padding: 14px 16px; border-radius: 8px; background: var(--code-bg); color: var(--code-text); font: 13.5px/1.6 var(--mono); overflow-x: auto; }
.guest-article-body code { font-family: var(--mono); font-size: .9em; padding: 1px 5px; border-radius: 4px; background: #eef1f6; }
.guest-article-body pre code { padding: 0; background: none; color: inherit; font-size: inherit; }
/* The lesson title's link down to the article (public pages) */
.article-jump { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 5px; background: #eef3fe; color: var(--blue); font-size: 11px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.article-jump:hover { background: #dfe9fd; }
.article-jump svg { width: 12px; height: 12px; }
html:has(.guest-article) { scroll-behavior: smooth; }
.guest-article #article-title { scroll-margin-top: 84px; }
/* The article's code on its dark blocks, in the editor's colours */
.guest-article-body .hl .ace_keyword, .guest-article-body .hl .ace_storage, .guest-article-body .hl .ace_constant.ace_language { color: #ffd242; font-weight: 400; }
.guest-article-body .hl .ace_string { color: #a5e07a; }
.guest-article-body .hl .ace_comment { color: var(--code-muted); font-style: italic; }
.guest-article-body .hl .ace_constant.ace_numeric { color: #ae81ff; }
.guest-article-body .hl .ace_keyword.ace_operator, .guest-article-body .hl .ace_paren, .guest-article-body .hl .ace_punctuation { color: var(--code-text); }
.guest-article-body .hl .ace_support.ace_function, .guest-article-body .hl .ace_support.ace_type, .guest-article-body .hl .ace_storage.ace_type, .guest-article-body .hl .ace_entity.ace_name, .guest-article-body .hl .ace_support.ace_class { color: #87ffaf; }
.guest-article-body .hl .ace_variable.ace_language { color: #fd971f; }
.guest-article-body .hl .ace_meta.ace_tag, .guest-article-body .hl .ace_entity.ace_other.ace_attribute-name { color: #86aafa; }
.guest-article-body a { color: var(--blue); }
.guest-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 40px 0 24px; }
.guest-nav-link { display: block; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); font-weight: 600; text-decoration: none; }
.guest-nav-link:last-child { text-align: right; }
.guest-nav-link small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
.guest-nav-link:hover { border-color: var(--blue); }
.guest-cta { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 24px; border: 1px solid #d6e1f7; border-radius: 12px; background: #f1f5fd; }
.guest-cta strong { display: block; font-size: 16px; }
.guest-cta span { display: block; font-size: 14px; color: var(--muted); }
/* Public course overviews (link/?lang=py, link/) */
.link-overview { max-width: 1040px; margin: 0 auto; }
.link-overview-head { padding: 30px 32px; background: #fff; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 34px; }
.link-overview-head h1 { font-size: 32px; line-height: 1.2; letter-spacing: -.6px; margin: 4px 0 12px; }
.link-overview-lead { max-width: 720px; color: #4b5463; font-size: 16px; line-height: 1.7; }
.link-overview-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 20px; }
.link-overview-meta { font-size: 13px; color: var(--muted); }
.link-overview-missing { margin: 0 0 18px; padding: 10px 14px; border-radius: 8px; background: #fff6e6; color: #7a4b0c; font-size: 14px; }
.link-part { margin-bottom: 38px; }
.link-part h2 { font-size: 24px; letter-spacing: -.4px; margin: 2px 0 6px; }
.link-part-blurb { color: var(--muted); margin-bottom: 16px; }
.link-chapters { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.link-chapter { padding: 16px 18px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.link-chapter h3 { font-size: 15px; margin-bottom: 8px; }
.link-lessons { margin: 0; padding-left: 22px; }
.link-lessons li { font-size: 14px; line-height: 1.5; padding: 2px 0; color: #8a93a3; }
.link-lessons a { color: #2d3a52; text-decoration: none; }
.link-lessons a:hover { color: var(--blue); text-decoration: underline; }
.link-languages { padding: 22px 24px; border: 1px solid #d6e1f7; border-radius: 12px; background: #f1f5fd; }
.link-languages h2 { font-size: 17px; margin-bottom: 10px; }
.link-languages div { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.link-languages a { color: var(--blue); font-weight: 600; text-decoration: none; }
.link-language-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.link-language { display: flex; align-items: flex-start; gap: 14px; padding: 18px; background: #fff; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); text-decoration: none; }
.link-language:hover { border-color: var(--blue); }
.link-language .course-dot { min-width: 40px; height: 36px; font-size: 12px; }
.link-language strong { display: block; font-size: 17px; margin-bottom: 3px; }
.link-language small { display: block; font-size: 13.5px; line-height: 1.5; color: var(--muted); }
@media (max-width: 640px) {
  .link-overview-head { padding: 22px 18px; }
  .link-overview-head h1 { font-size: 25px; }
  .link-chapters, .link-language-grid { grid-template-columns: 1fr; }
}
.guest-footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px; padding: 22px 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.guest-footer a { color: inherit; }
.guest-signin { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px; background: rgba(15, 20, 33, .55); }
.guest-signin:not(.open) { visibility: hidden; opacity: 0; pointer-events: none; }
.guest-signin-card { position: relative; width: min(420px, 100%); padding: 30px 28px 22px; border-radius: 14px; background: #fff; text-align: center; box-shadow: 0 24px 60px rgba(0, 0, 0, .25); }
.guest-signin-card h2 { font-size: 22px; margin: 4px 0 8px; }
.guest-signin-text { font-size: 14px; color: var(--muted); }
.guest-signin-close { position: absolute; top: 10px; right: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 640px) {
  .guest-start { display: none; }
  .guest-nav { grid-template-columns: 1fr; }
  .guest-nav-link:last-child { text-align: left; }
  .guest-cta { flex-direction: column; align-items: flex-start; }
  .guest-article-inner { padding: 36px 16px 28px; }
  .guest-article #article-title { font-size: 24px; }
}
