/* ==========================================================================
   ERP Made Simple — styles
   Tokens first; components after. Light + dark themes, 4 text sizes,
   reduced motion, print. No external fonts (privacy + speed).
   ========================================================================== */

:root {
  --bg: #f3f5fd;
  --surface: #ffffff;
  --surface-2: #eef1fb;
  --surface-3: #e2e7f6;
  --text: #1e1b4b;
  --text-2: #36345f;
  --muted: #55607a;
  --border: #dde3f3;
  --primary: #4f46e5;
  --primary-2: #4338ca;
  --primary-ink: #ffffff;
  --primary-soft: #eceaff;
  --cta: #ea580c;
  --cta-text: #b93d06;   /* --cta darkened for small text (WCAG AA on tinted cards) */
  --danger-ink: #fff;
  --success: #1c7c45;
  --success-soft: #e3f6ea;
  --warn: #a35a00;
  --warn-soft: #fff4e0;
  --danger: #c0262d;
  --danger-soft: #fdeaea;
  --kid-bg: #fff8dc;
  --kid-border: #f2c94c;
  --oracle: #b8402f;
  --oracle-soft: #fdeeea;
  --real-soft: #eaf6ff;
  --real: #0b6aa8;
  --mark: #fff0a6;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
  --shadow-lg: 0 10px 40px rgba(16, 24, 40, .12);
  --radius: 18px;
  --radius-sm: 10px;
  --accent: var(--primary);
  --font-display: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

* { --accent-ink: color-mix(in srgb, var(--accent) 85%, black); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1022; --surface: #181a33; --surface-2: #20233f; --surface-3: #2b2f52;
    --text: #eceefe; --text-2: #cdd0ee; --muted: #a2a8c8; --border: #2e3257;
    --primary: #a5b4fc; --primary-2: #c7d2fe; --primary-ink: #14123a; --primary-soft: #26244f; --cta: #fb923c; --cta-text: #fb923c; --danger-ink: #2a0a0c;
    --success: #5fd08f; --success-soft: #123224; --warn: #f3b25c; --warn-soft: #3a2a12;
    --danger: #ff7b80; --danger-soft: #3b1619; --kid-bg: #2c2612; --kid-border: #8a6d1c;
    --oracle: #ff8a73; --oracle-soft: #34191a; --real-soft: #10283a; --real: #7cc4f2; --mark: #5c4d00;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.25); --shadow-lg: 0 10px 40px rgba(0,0,0,.5);
    color-scheme: dark;
  }
  :root:not([data-theme="light"]) * { --accent-ink: color-mix(in srgb, var(--accent) 55%, white); }
}
:root[data-theme="dark"] * { --accent-ink: color-mix(in srgb, var(--accent) 55%, white); }
:root[data-theme="dark"] {
  --bg: #0f1022; --surface: #181a33; --surface-2: #20233f; --surface-3: #2b2f52;
  --text: #eceefe; --text-2: #cdd0ee; --muted: #a2a8c8; --border: #2e3257;
  --primary: #a5b4fc; --primary-2: #c7d2fe; --primary-ink: #14123a; --primary-soft: #26244f; --cta: #fb923c; --cta-text: #fb923c; --danger-ink: #2a0a0c;
  --success: #5fd08f; --success-soft: #123224; --warn: #f3b25c; --warn-soft: #3a2a12;
  --danger: #ff7b80; --danger-soft: #3b1619; --kid-bg: #2c2612; --kid-border: #8a6d1c;
  --oracle: #ff8a73; --oracle-soft: #34191a; --real-soft: #10283a; --real: #7cc4f2; --mark: #5c4d00;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.25); --shadow-lg: 0 10px 40px rgba(0,0,0,.5);
  color-scheme: dark;
}

/* text size */
html { font-size: 17px; }
html[data-text-size="s"] { font-size: 15px; }
html[data-text-size="l"] { font-size: 19px; }
html[data-text-size="xl"] { font-size: 21px; }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font);
  line-height: 1.65; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { max-width: 100%; }
a { color: var(--primary); text-underline-offset: 2px; }
a:hover { color: var(--primary-2); }
h1, h2, h3 { line-height: 1.25; letter-spacing: -0.01em; color: var(--text); font-family: var(--font-display); font-weight: 750; text-wrap: balance; }
a, button, summary, label, select { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
h1 { font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.6rem); margin: .2em 0 .35em; }
h2 { font-size: 1.35rem; margin: 0 0 .6em; }
h3 { font-size: 1.12rem; margin: 0 0 .5em; }
p { margin: 0 0 .9em; }
code { font-family: var(--mono); font-size: .88em; background: var(--surface-2); padding: .1em .35em; border-radius: 5px; border: 1px solid var(--border); word-break: break-word; }
kbd { font-family: var(--font); font-size: .85em; font-weight: 600; background: var(--surface); border: 1px solid var(--border); border-bottom-width: 2px; padding: .05em .45em; border-radius: 6px; white-space: nowrap; }
mark { background: var(--mark); color: var(--text); padding: 0 .1em; border-radius: 3px; }
.hl { background: linear-gradient(transparent 55%, var(--mark) 55%); font-weight: 600; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
h1:focus { outline: none; }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--primary); color: var(--primary-ink); padding: .6em 1em; border-radius: 8px; font-weight: 600; }
.skip-link:focus { top: 12px; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.center { text-align: center; }
.center .ring { margin: 1rem auto; }
.noscript { max-width: 640px; margin: 4rem auto; padding: 0 16px; }

.boot { min-height: 60vh; display: grid; place-items: center; }
.boot-mark { font-size: 3rem; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.12); opacity: .7; } }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  font: inherit; font-weight: 600; font-size: .95rem; line-height: 1.2;
  padding: .62em 1.05em; border-radius: 10px; cursor: pointer; text-decoration: none;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(16,24,40,.04); transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn { min-height: 44px; }
.btn:active { transform: scale(.97); }
.btn-sm { min-height: 36px; padding: .35em .7em; font-size: .85rem; }
.btn-icon.btn-sm { width: 2.25rem; height: 2.25rem; min-height: 2.25rem; }
.is-disabled { opacity: .4; pointer-events: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--primary-ink); border-color: transparent; }
.btn-primary:hover { background: var(--primary-2); color: var(--primary-ink); }
.btn-danger { background: var(--danger); color: var(--danger-ink); border-color: transparent; }
.btn-danger:hover { background: var(--danger); filter: brightness(1.08); color: var(--danger-ink); }
.btn-danger-outline { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-danger-outline:hover { background: var(--danger-soft); color: var(--danger); }
.btn-lg { font-size: 1.02rem; padding: .8em 1.3em; border-radius: 12px; }
.btn-icon { padding: .5em; width: 2.5rem; height: 2.5rem; border-radius: 10px; }
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.icon { display: inline-flex; line-height: 0; }

/* ------------------------------------------------------------------ topbar */
.topbar { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border); }
.topbar-inner { max-width: 1240px; margin: 0 auto; padding: .55rem 16px; display: flex; align-items: center; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--text); margin-right: auto; min-width: 0; }
.brand:hover { color: var(--text); }
.brand-mark { width: 2.4rem; height: 2.4rem; flex: none; display: block; }
.brand-mark img { width: 100%; height: 100%; display: block; border-radius: 11px; }
.app-back { display: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text strong { font-size: 1.02rem; }
.brand-text small { color: var(--muted); font-size: .74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.main-nav { display: flex; gap: .15rem; }
.nav-link { display: inline-flex; align-items: center; gap: .4em; padding: .5em .75em; border-radius: 9px; color: var(--text-2); text-decoration: none; font-weight: 600; font-size: .92rem; }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link[aria-current="page"] { background: var(--primary-soft); color: var(--primary); }
.topbar-progress { display: flex; align-items: center; gap: .5rem; font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.topbar-progress .bar { width: 80px; }
.menu-btn { display: none; }
.read-progress { height: 3px; background: transparent; }
.read-progress::after { content: ""; display: block; height: 100%; width: var(--p, 0%); background: var(--accent, var(--primary)); transition: width .1s linear; }



/* ------------------------------------------------------------------ layout */
main { max-width: 1240px; margin: 0 auto; padding: 1.5rem 16px 4rem; min-height: 70vh; outline: none; }
.narrow { max-width: 820px; margin: 0 auto; }
.page-head { margin-bottom: 1.5rem; }
.kicker { font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-ink); margin: 0 0 .3rem; }
.lead { font-size: 1.12rem; color: var(--text-2); max-width: 62ch; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.4rem; box-shadow: var(--shadow); margin-bottom: 1.2rem; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: .8rem; }
.crumbs a { color: var(--muted); }
.chip { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; background: var(--primary-soft); color: var(--primary); padding: .2em .6em; border-radius: 999px; }
.pill { font-size: .72rem; font-weight: 700; padding: .15em .6em; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.pill.done { background: var(--success-soft); color: var(--success); }
.pill.started { background: var(--warn-soft); color: var(--warn); }

.bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar > span { display: block; height: 100%; width: var(--p, 0%); background: var(--c, var(--primary)); border-radius: 99px; transition: width .6s var(--ease); }

.ring { width: var(--size, 120px); height: var(--size, 120px); position: relative; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; }
.ring-bg { stroke: var(--surface-3); }
.ring-fg { stroke: var(--accent, var(--primary)); stroke-linecap: round; transition: stroke-dashoffset .8s var(--ease); }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.1; }
.ring-label strong { font-size: calc(var(--size, 120px) * .2); }
.ring-label span { font-size: .75rem; color: var(--muted); }

/* ------------------------------------------------------------------ home */
.hero { display: grid; grid-template-columns: 1fr auto; gap: 2rem; align-items: center; background: linear-gradient(135deg, var(--surface) 0%, var(--primary-soft) 140%); border: 1px solid var(--border); border-radius: 22px; padding: clamp(1.4rem, 1rem + 2.5vw, 3rem); box-shadow: var(--shadow); margin-bottom: 2rem; }
.hero h1 { max-width: 18ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.3rem; }
.hero-next { margin-top: .9rem; font-size: .92rem; }
.hero-progress { text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 1.2rem 1.6rem; }
.hero-progress p { margin: .3rem 0 0; }
.hero-progress .ring { margin: 0 auto .5rem; }
@media (max-width: 760px) { .hero { grid-template-columns: 1fr; } .hero-progress { display: flex; align-items: center; gap: 1rem; text-align: left; } .hero-progress .ring { --size: 96px !important; margin: 0; } }

.path { margin-bottom: 2.2rem; }
.path-steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.path-steps li { display: flex; gap: .9rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; }
.path-steps p { margin: .2rem 0 0; color: var(--muted); font-size: .92rem; }
.path-n { flex: none; width: 2.1rem; height: 2.1rem; border-radius: 50%; background: var(--primary); color: var(--primary-ink); display: grid; place-items: center; font-weight: 800; }
@media (max-width: 760px) { .path-steps { grid-template-columns: 1fr; } }

.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.module-card { display: flex; flex-direction: column; gap: .4rem; background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--accent); border-radius: var(--radius); padding: 1.1rem 1.2rem; text-decoration: none; color: var(--text); box-shadow: var(--shadow); transition: transform .15s var(--ease), box-shadow .15s; }
.module-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); color: var(--text); }
.module-card h3 { margin: .2rem 0 0; }
.module-card p { color: var(--muted); font-size: .9rem; margin: 0; flex: 1; }
.mc-top { display: flex; align-items: center; gap: .6rem; }
.mc-icon { font-size: 1.6rem; }
.mc-num { font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-right: auto; }
.mc-foot { margin-top: .6rem; font-size: .8rem; color: var(--muted); display: grid; gap: .4rem; }

/* ------------------------------------------------------------------ module page */
.module-head { background: var(--surface); border: 1px solid var(--border); border-left: 6px solid var(--accent); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: var(--shadow); }
.module-head-row { display: flex; gap: 2rem; align-items: center; justify-content: space-between; }
@media (max-width: 640px) { .module-head-row { flex-direction: column-reverse; align-items: flex-start; } }
.lesson-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .7rem; }
.lesson-row { display: flex; gap: 1rem; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; text-decoration: none; color: var(--text); transition: border-color .15s, box-shadow .15s; }
.lesson-row:hover { border-color: var(--primary); box-shadow: var(--shadow); color: var(--text); }
.lr-status { flex: none; width: 2.2rem; height: 2.2rem; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--surface-2); color: var(--muted); border: 2px solid var(--border); }
.lesson-row.done .lr-status { background: var(--success); border-color: var(--success); color: #fff; }
.lesson-row.started .lr-status { border-color: var(--warn); color: var(--warn); }
.lr-body { display: grid; gap: .25rem; min-width: 0; }
.lr-title { font-weight: 700; }
.lr-summary { color: var(--text-2); font-size: .92rem; }
.lr-meta { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; font-size: .8rem; color: var(--muted); }
.lr-meta .icon { vertical-align: -2px; }

/* ------------------------------------------------------------------ lesson */
.lesson-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 2.6rem; align-items: start; max-width: 1110px; margin: 0 auto; }
.lesson-side { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow: auto; padding: .4rem .2rem 1rem 0; font-size: .9rem; }
.side-module { display: block; font-weight: 700; color: var(--text); text-decoration: none; margin-bottom: .6rem; padding: .3rem .4rem; }
.lesson-side ol { list-style: none; margin: 0; padding: 0; display: grid; gap: .15rem; }
.side-link { display: flex; gap: .6rem; align-items: flex-start; padding: .45rem .5rem; border-radius: 9px; color: var(--text-2); text-decoration: none; line-height: 1.35; }
.side-link:hover { background: var(--surface-2); color: var(--text); }
.side-link[aria-current="page"] { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.side-dot { flex: none; width: 1.45rem; height: 1.45rem; border-radius: 50%; display: grid; place-items: center; font-size: .72rem; font-weight: 700; background: var(--surface-2); border: 1.5px solid var(--border); color: var(--muted); }
.side-link.done .side-dot { background: var(--success); border-color: var(--success); color: #fff; }
.side-link.started .side-dot { border-color: var(--warn); color: var(--warn); }
@media (max-width: 980px) {
  .lesson-layout { grid-template-columns: 1fr; gap: 1rem; }
  .lesson-side { position: static; max-height: none; order: 2; border-top: 1px solid var(--border); padding-top: 1.2rem; }
}

.lesson { max-width: 800px; min-width: 0; }
.lesson-head { margin-bottom: 1.4rem; }
.lesson-meta { display: flex; gap: 1rem; align-items: center; color: var(--muted); font-size: .9rem; }
.lesson-meta .icon { vertical-align: -3px; }
.objectives { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.3rem; margin-bottom: 1.6rem; }
.objectives h2 { font-size: 1.05rem; margin-bottom: .4rem; }
.objectives ul { margin: 0; padding-left: 1.2rem; }

.blk { margin: 0 0 1.8rem; }
.blk h2 { font-size: 1.3rem; }
.prose > :last-child { margin-bottom: 0; }
.prose ul, .prose ol { padding-left: 1.3rem; margin: 0 0 .9em; }
.prose li { margin-bottom: .3em; }
.prose li > ul, .prose li > ol { margin-top: .3em; }

.blk-kid { background: var(--kid-bg); border: 2px dashed var(--kid-border); border-radius: 18px; padding: 1.3rem 1.4rem; }
.kid-badge { display: inline-flex; gap: .3em; font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; background: var(--surface); border: 1px solid var(--kid-border); border-radius: 999px; padding: .2em .8em; margin-bottom: .6rem; }
.kid-title { font-size: 1.25rem; }

.callout { border-radius: var(--radius); padding: 1rem 1.2rem; border: 1px solid var(--border); border-left-width: 5px; background: var(--surface); }
.callout-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem; margin-bottom: .45rem; }
.callout-emoji { font-size: 1.1rem; }
.callout-kicker { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.callout-title { font-size: 1.02rem; }
.callout-tip { border-left-color: var(--success); background: var(--success-soft); }
.callout-warning { border-left-color: var(--warn); background: var(--warn-soft); }
.callout-info { border-left-color: var(--primary); background: var(--primary-soft); }
.callout-oracle { border-left-color: var(--oracle); background: var(--oracle-soft); }
.callout-real { border-left-color: var(--real); background: var(--real-soft); }

/* slides */
.blk-slides { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.blk-slides:focus-visible { outline-offset: 4px; }
.slides-head { padding: 1rem 1.3rem .2rem; }
.slides-head h2 { margin: 0; font-size: 1.15rem; }
.slides-kicker, .example-kicker, .journal-kicker, .steps-kicker, .quiz-kicker { font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--accent-ink); display: block; margin-bottom: .25rem; }
.slides-bar { height: 3px; background: var(--surface-3); margin: .8rem 1.3rem 0; border-radius: 99px; overflow: hidden; }
.slides-bar::after { content: ""; display: block; height: 100%; width: var(--p, 0%); background: var(--accent, var(--primary)); transition: width .3s var(--ease); }
.slides-track { min-height: 15rem; display: grid; }
.slide { padding: 1.5rem 1.6rem 1rem; animation: slideIn .35s var(--ease); }
@keyframes slideIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
.slide-icon { font-size: 2.6rem; line-height: 1; margin-bottom: .6rem; }
.slide-title { font-size: 1.25rem; }
.slides-nav { display: flex; align-items: center; gap: .8rem; padding: .8rem 1.3rem 1rem; border-top: 1px solid var(--border); background: var(--surface-2); }
.slides-dots { display: flex; gap: .35rem; flex-wrap: wrap; margin-right: auto; }
.dot { flex: none; box-sizing: border-box; width: 24px; height: 24px; padding: 6px; background-clip: content-box; border-radius: 50%; border: none; background-color: var(--surface-3); cursor: pointer; } /* 24px target (WCAG 2.2), 12px dot */
.dot.active { background-color: var(--accent, var(--primary)); padding: 4.5px; }
.slides-counter { font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* flow */
.flow { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 1.6rem .4rem; counter-reset: flow; }
.flow-step { flex: 1 1 140px; position: relative; display: flex; }
.flow-step:not(:last-child)::after { content: "➜"; position: absolute; right: -.95rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 1.1rem; }
.flow-card { flex: 1; background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--accent, var(--primary)); border-radius: 12px; padding: .8rem .8rem .9rem; margin-right: .8rem; box-shadow: var(--shadow); }
.flow-num { font-size: 1.5rem; line-height: 1; margin-bottom: .35rem; }
.flow-label { font-weight: 700; line-height: 1.3; }
.flow-detail { font-size: .86rem; color: var(--muted); margin-top: .25rem; line-height: 1.45; }
.flow-note { margin-top: 1rem; }
@media (max-width: 640px) {
  .flow { flex-direction: column; gap: 1.4rem; }
  .flow-step:not(:last-child)::after { content: "⬇"; right: auto; left: 1.2rem; top: auto; bottom: -1.35rem; transform: none; }
  .flow-card { margin-right: 0; }
}

/* long flows (5+ steps) read better as a vertical timeline */
.flow.flow-long { flex-direction: column; gap: .9rem; }
.flow.flow-long .flow-step { flex: none; }
.flow.flow-long .flow-step:not(:last-child)::after { content: ""; position: absolute; left: 1.55rem; top: 3.2rem; bottom: -.9rem; right: auto; transform: none; width: 2px; background: var(--border); }
.flow.flow-long .flow-card { display: grid; grid-template-columns: 3.1rem 1fr; column-gap: .9rem; margin-right: 0; border-top: 1px solid var(--border); border-left: 4px solid var(--accent, var(--primary)); padding: .8rem 1rem; }
.flow.flow-long .flow-num { grid-row: span 2; width: 2.6rem; height: 2.6rem; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: 1.3rem; margin: 0; position: relative; z-index: 1; }
.flow.flow-long .flow-detail { margin-top: .1rem; }

/* example */
.blk-example { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 1.3rem 1.4rem; box-shadow: var(--shadow); position: relative; }
.blk-example::before { content: "🍋"; position: absolute; right: 1rem; top: .8rem; font-size: 1.6rem; opacity: .35; }
.example-steps { padding-left: 0; list-style: none; counter-reset: ex; margin: 1rem 0; display: grid; gap: .6rem; }
.example-steps li { counter-increment: ex; position: relative; padding: .7rem .9rem .7rem 3rem; background: var(--surface-2); border-radius: 10px; }
.example-steps li::before { content: counter(ex); position: absolute; left: .8rem; top: .7rem; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--accent, var(--primary)); color: #fff; display: grid; place-items: center; font-size: .8rem; font-weight: 800; }
.example-result { background: var(--success-soft); border-radius: 10px; padding: .8rem 1rem; display: flex; gap: .2rem; }
.example-result p { margin: 0; }

/* tables + journal */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: .93rem; }
caption { text-align: left; font-weight: 700; padding: .8rem 1rem; font-size: 1rem; caption-side: top; }
th, td { padding: .65rem .9rem; border-top: 1px solid var(--border); text-align: left; vertical-align: top; }
thead th { background: var(--surface-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); border-top: none; }
tbody th { font-weight: 600; }
tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: .9rem; white-space: nowrap; }
.journal tbody td:first-child { font-family: var(--mono); font-size: .88rem; }
.journal tr.is-credit td:first-child { padding-left: 2.2rem; }
.journal tfoot th, .journal tfoot td { font-weight: 800; border-top: 2px solid var(--text-2); background: var(--surface-2); }
.journal-check { font-size: .85rem; margin: .5rem 0 0; font-weight: 600; }
.journal-check.ok { color: var(--success); }
.journal-check.bad { color: var(--danger); }

/* steps */
.blk-steps { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 1.3rem 1.4rem; }
.steps { margin: 0; padding-left: 1.4rem; display: grid; gap: .5rem; }
.steps li::marker { font-weight: 800; color: var(--accent-ink); }
.steps-note { margin-top: .9rem; font-size: .88rem; color: var(--muted); }

/* terms */
.terms { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .7rem; margin: 0; }
.term { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .8rem 1rem; }
.term dt { font-weight: 800; color: var(--accent-ink); }
.term dd { margin: .2rem 0 0; font-size: .92rem; color: var(--text-2); }

/* quiz */
.blk-quiz { background: var(--surface); border: 2px solid var(--accent, var(--primary)); border-radius: 18px; padding: 1.4rem; }
.quiz-q { border: none; margin: 0 0 1.4rem; padding: 0; min-width: 0; }
.quiz-q legend { font-weight: 700; margin-bottom: .6rem; display: flex; gap: .6rem; padding: 0; }
.quiz-n { flex: none; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-size: .82rem; }
.quiz-opts { display: grid; gap: .45rem; }
.quiz-opt { display: flex; gap: .7rem; align-items: flex-start; border: 1.5px solid var(--border); border-radius: 10px; padding: .65rem .85rem; cursor: pointer; background: var(--surface); transition: border-color .15s, background .15s; }
.quiz-opt:hover { border-color: var(--primary); }
.quiz-opt input { margin-top: .3rem; accent-color: var(--primary); flex: none; }
.quiz-opt:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.quiz-opt.correct, .quiz-opt.correct:has(input:checked) { border-color: var(--success); background: var(--success-soft); }
.quiz-opt.wrong, .quiz-opt.wrong:has(input:checked) { border-color: var(--danger); background: var(--danger-soft); }
.quiz-opt:has(input:disabled) { cursor: default; }
.quiz-feedback { margin-top: .6rem; padding: .7rem .9rem; border-radius: 10px; font-size: .93rem; }
.quiz-feedback.ok { background: var(--success-soft); }
.quiz-feedback.bad { background: var(--warn-soft); }
.quiz-actions { display: flex; gap: .6rem; }
.quiz-result { margin-top: 1rem; font-weight: 700; }
.quiz-result:empty { display: none; }
.quiz-result.pass { color: var(--success); }
.quiz-result.fail, .quiz-result.warn { color: var(--warn); }

.complete-box { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.3rem; margin: 2rem 0; }
.complete-box p { margin: .2rem 0 0; font-size: .9rem; }
.complete-box.is-done { background: var(--success-soft); border-color: var(--success); }

.lesson-sources { border-top: 1px solid var(--border); padding-top: 1.4rem; margin-top: 1rem; }
.lesson-sources h2 { font-size: 1.1rem; }
.lesson-sources ol { padding-left: 1.3rem; font-size: .92rem; }
.lesson-sources li { margin-bottom: .35rem; }
.lesson-sources .icon, .credit-list .icon { vertical-align: -2px; }

.lesson-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 2rem; }
.nav-card { display: grid; gap: .2rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1.1rem; text-decoration: none; color: var(--text); font-weight: 600; }
.nav-card:hover { border-color: var(--primary); color: var(--text); }
.nav-card.next { text-align: right; grid-column: 2; }
@media (max-width: 560px) { .lesson-nav { grid-template-columns: 1fr; } .nav-card.next { grid-column: 1; } }

/* ------------------------------------------------------------------ search, glossary, credits */
.input { font: inherit; width: 100%; padding: .7em .9em; border-radius: 10px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text); }
.input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
.input-lg { font-size: 1.1rem; padding: .85em 1em; margin-bottom: 1rem; }
.search-results { display: grid; gap: .7rem; }
.search-hit { display: grid; gap: .2rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1.1rem; text-decoration: none; color: var(--text); }
.search-hit:hover { border-color: var(--primary); color: var(--text); }
.search-hit .kicker { margin: 0; }
.snippet { font-size: .9rem; color: var(--muted); }

.glossary-tools { position: sticky; top: 64px; z-index: 5; background: var(--bg); padding: .5rem 0 .7rem; display: grid; gap: .6rem; }
.letters { display: flex; flex-wrap: wrap; gap: .25rem; }
.letters a { font-weight: 700; font-size: .85rem; padding: .2em .55em; border-radius: 6px; text-decoration: none; background: var(--surface); border: 1px solid var(--border); }
.glossary { margin: 0; }
.g-letter { font-size: 1.4rem; margin: 1.4rem 0 .5rem; color: var(--primary); scroll-margin-top: 170px; }
.g-item { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .8rem 1rem; margin-bottom: .5rem; }
.g-item dt { font-weight: 800; }
.g-item dd { margin: .2rem 0 0; color: var(--text-2); }
.g-links { display: block; font-size: .8rem; color: var(--muted); margin-top: .3rem; }

.credit-group { margin-top: 1.8rem; }
.credit-group h2 { font-size: 1.15rem; }
.credit-list { padding-left: 1.2rem; }
.credit-list li { margin-bottom: .55rem; }

/* settings */
.seg { border: none; padding: 0; margin: 0 0 1.1rem; }
.seg legend { font-weight: 700; margin-bottom: .45rem; padding: 0; }
.seg-opts { display: flex; flex-wrap: wrap; gap: .45rem; }
.seg-opt { position: relative; }
.seg-opt input { position: absolute; opacity: 0; inset: 0; }
.seg-opt span { display: inline-block; padding: .5em .95em; border: 1.5px solid var(--border); border-radius: 999px; cursor: pointer; font-weight: 600; font-size: .92rem; background: var(--surface); }
.seg-opt input:checked + span { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.seg-opt input:focus-visible + span { outline: 3px solid var(--primary); outline-offset: 2px; }
.check { display: flex; gap: .6rem; align-items: flex-start; margin: .3rem 0 .9rem; cursor: pointer; }
.check input { margin-top: .35rem; width: 1.05rem; height: 1.05rem; accent-color: var(--primary); flex: none; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }

.dialog { border: none; border-radius: 16px; padding: 1.5rem; max-width: 440px; width: calc(100% - 32px); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
.dialog::backdrop { background: rgba(10, 14, 25, .55); backdrop-filter: blur(2px); }
.dialog-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.2rem; }

/* certificate */
.cert-tools { display: flex; gap: .7rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.cert-tools .input { flex: 1 1 240px; width: auto; }
.certificate { background: #fffdf6; color: #1d2433; border-radius: 10px; padding: 14px; box-shadow: var(--shadow-lg); }
.cert-inner { border: 3px double #c9a227; border-radius: 6px; padding: clamp(1.5rem, 4vw, 3.5rem) 1.5rem; text-align: center; }
.cert-kicker { font-size: .9rem; letter-spacing: .3em; text-transform: uppercase; color: #8a6d1c; font-weight: 800; }
.cert-name { font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.8rem, 1.2rem + 3vw, 3rem); margin: .5rem 0 1rem; border-bottom: 2px solid #c9a227; display: inline-block; padding: 0 1.5rem .2rem; min-width: 60%; }
.cert-course { font-weight: 800; font-size: 1.2rem; }
.certificate .muted { color: #5b6578; }
.cert-note { font-size: .78rem; color: #5b6578; margin-top: 1.5rem; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 140%); background: var(--text); color: var(--bg); padding: .7em 1.2em; border-radius: 12px; font-weight: 600; box-shadow: var(--shadow-lg); transition: transform .3s var(--ease); z-index: 200; max-width: calc(100% - 32px); }
#toast.show { transform: translate(-50%, 0); }

/* footer */
.footer { border-top: 1px solid var(--border); background: var(--surface); }
.footer-inner { max-width: 1240px; margin: 0 auto; padding: 1.5rem 16px 2rem; font-size: .9rem; }

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

/* print: lessons print cleanly; certificate prints alone */
@media print {
  .topbar, .footer, .lesson-side, .lesson-nav, .complete-box, .skip-link, .no-print, .quiz-actions, .slides-nav, .slides-bar, #toast { display: none !important; }
  body { background: #fff; color: #000; }
  main { padding: 0; max-width: none; }
  .lesson-layout { display: block; }
  .slide[hidden] { display: block !important; }
  .slide { border-top: 1px dashed #ccc; }
  .blk, .card { break-inside: avoid; box-shadow: none; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .8em; word-break: break-all; }
  .certificate { box-shadow: none; }
  .certificate a::after { content: none; }
  .narrow > .page-head { display: none; }
}

/* ==========================================================================
   Mobile app shell: compact app bar + bottom tab bar
   ========================================================================== */
.tabbar { display: none; }
@media (max-width: 860px) {
  .main-nav, .topbar-progress { display: none; }
  .topbar-inner { padding: .45rem 12px; gap: .5rem; min-height: 56px; }
  .app-back:not([hidden]) { display: inline-flex; }
  .brand-text strong { font-size: .98rem; }
  main { padding: 1rem 16px calc(var(--tabbar-h) + var(--safe-b) + 2rem); }
  .footer { padding-bottom: calc(var(--tabbar-h) + var(--safe-b)); }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
    border-top: 1px solid var(--border);
  }
  .tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); text-decoration: none; font-size: .7rem; font-weight: 650; position: relative; min-height: 48px; }
  .tab .icon { padding: 3px 16px; border-radius: 999px; transition: background .2s var(--ease), color .2s; }
  .tab[aria-current="page"] { color: var(--primary); }
  .tab[aria-current="page"] .icon { background: var(--primary-soft); }
  .tab:active .icon { transform: scale(.92); }
  /* inside a lesson the step bar replaces the tab bar (focused flow); back arrow returns to the module */
  body[data-route="lesson"] .tabbar { display: none; }
  body[data-route="lesson"] main { padding-bottom: calc(84px + var(--safe-b)); }
  body[data-route="lesson"] .footer { display: none; }
  .hero { border-radius: 22px; padding: 1.4rem; }
  h1 { font-size: 1.7rem; }
}
@media (max-width: 380px) { .brand-text small { display: none; } }

/* page enter animation (subtle) */
main > * { animation: pageIn .28s var(--ease); }
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.narrow-wide { max-width: 1040px; margin: 0 auto; }
.footer-links { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; }
.ticks { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.ticks li { position: relative; padding-left: 1.7rem; }
.ticks li::before { content: ""; position: absolute; left: 0; top: .35em; width: 1.1rem; height: 1.1rem; border-radius: 50%; background: var(--success-soft); border: 2px solid var(--success); }
.ticks li::after { content: ""; position: absolute; left: .38rem; top: .55em; width: .3rem; height: .55rem; border: solid var(--success); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.module-card:active, .lesson-row:active, .lab-card:active, .nav-card:active { transform: scale(.985); }

/* ==========================================================================
   Codelab-style steps
   ========================================================================== */
.steps-layout { grid-template-columns: 290px minmax(0, 1fr); }
.step-side { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow: auto; padding: .2rem .2rem 1rem 0; }
.step-side .side-module { display: inline-flex; align-items: center; gap: .3rem; color: var(--muted); font-weight: 650; font-size: .88rem; padding: 0; margin-bottom: .6rem; text-decoration: none; }
.step-side-title { font-family: var(--font-display); font-weight: 750; font-size: 1.05rem; line-height: 1.3; margin: 0 0 .7rem; }
.step-side .bar { margin-bottom: .35rem; }
.step-list { list-style: none; margin: .8rem 0 0; padding: 0; display: grid; gap: 2px; counter-reset: s; }
.step-link { display: flex; gap: .65rem; align-items: center; padding: .5rem .55rem; border-radius: 12px; color: var(--text-2); text-decoration: none; font-size: .9rem; line-height: 1.3; min-height: 44px; }
.step-link:hover { background: var(--surface-2); color: var(--text); }
.step-link.is-current { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.step-num { flex: none; width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; font-weight: 800; background: var(--surface); border: 2px solid var(--border); color: var(--muted); }
.step-link.is-current .step-num { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.step-link.is-done .step-num { background: var(--success); border-color: var(--success); color: #fff; }
.step-name { flex: 1; }
.step-tag { color: var(--cta); flex: none; }
.codelab-step { background: var(--surface); border: 1px solid var(--border); border-radius: 24px; padding: clamp(1.1rem, .6rem + 2vw, 2.2rem); box-shadow: var(--shadow); }
.codelab-step .blk-slides, .codelab-step .blk-example, .codelab-step .blk-steps, .codelab-step .blk-quiz, .codelab-step .blk-exercise, .codelab-step .blk-lab { box-shadow: none; }
.step-title { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.75rem); margin: 0 0 1.2rem; outline: none; }
.step-kicker { margin-bottom: .4rem; }
.step-picker { display: none; }
.step-bar { display: flex; align-items: center; gap: .8rem; margin-top: 2rem; padding-top: 1.2rem; border-top: 1px solid var(--border); }
.step-count { flex: 1; display: grid; gap: .25rem; justify-items: center; font-variant-numeric: tabular-nums; color: var(--muted); }
.step-count .bar { width: 100%; max-width: 220px; height: 6px; }
.step-next { min-width: 8.5rem; }
.recap { background: var(--success-soft); border-radius: var(--radius); padding: 1.1rem 1.3rem; margin-bottom: 1.2rem; }
.next-lesson { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .1rem 1rem; background: var(--primary); color: var(--primary-ink); border-radius: var(--radius); padding: 1rem 1.2rem; text-decoration: none; margin: 1rem 0 1.6rem; }
.next-lesson:hover { color: var(--primary-ink); background: var(--primary-2); }
.next-lesson .muted { color: inherit; opacity: .85; grid-column: 1; }
.next-lesson strong { grid-column: 1; font-size: 1.08rem; }
.next-lesson .icon { grid-column: 2; grid-row: 1 / span 2; }
.needs { margin-top: 1rem; }
@media (max-width: 980px) {
  .steps-layout { grid-template-columns: 1fr; }
  .step-side { display: none; }
  .step-picker { display: block; margin: 0 0 1rem; background: var(--surface-2); border-radius: 14px; }
  .step-picker summary { display: flex; justify-content: space-between; align-items: center; padding: .7rem 1rem; cursor: pointer; font-weight: 700; min-height: 44px; list-style: none; }
  .step-picker summary::-webkit-details-marker { display: none; }
  .step-picker summary::after { content: "▾"; margin-left: .5rem; color: var(--muted); }
  .step-picker[open] summary::after { content: "▴"; }
  .step-picker .step-list { margin: 0; padding: 0 .4rem .5rem; }
}
@media (max-width: 860px) {
  .codelab-step { border: none; box-shadow: none; background: transparent; padding: 0; border-radius: 0; }
  .step-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; margin: 0;
    padding: .6rem 12px calc(.6rem + var(--safe-b));
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
    border-top: 1px solid var(--border);
  }
  .step-back span:last-child { display: none; }
  .step-back { width: 48px; padding: 0; }
  .step-next { min-width: 0; flex: 0 0 auto; padding-inline: 1.2rem; }
}

/* ==========================================================================
   Hands-on exercises
   ========================================================================== */
.blk-exercise, .blk-lab { background: var(--surface); border: 2px solid color-mix(in srgb, var(--cta) 45%, var(--border)); border-radius: 22px; padding: 1.3rem 1.4rem; box-shadow: var(--shadow); }
.ex-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .25rem; }
.ex-kicker { font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: color-mix(in srgb, var(--cta) 80%, var(--text)); }
.ex-instructions { margin-bottom: 1rem; }
.ex-body { margin-bottom: 1rem; }
.ex-actions { margin-top: .4rem; }
.ex-feedback { margin-top: .9rem; font-weight: 650; padding: .7rem .9rem; border-radius: 12px; }
.ex-feedback:empty { display: none; }
.ex-feedback.ok { background: var(--success-soft); color: var(--success); }
.ex-feedback.bad { background: var(--warn-soft); color: var(--warn); }
.ex-explain { margin-top: .7rem; background: var(--surface-2); border-radius: 12px; padding: .8rem 1rem; }
.is-ok { border-color: var(--success) !important; background-color: var(--success-soft) !important; }
.is-bad { border-color: var(--danger) !important; background-color: var(--danger-soft) !important; }

.input { min-height: 44px; font-size: 1rem; }
select.input { appearance: none; -webkit-appearance: none; padding-right: 2.2rem; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 12px) 55%; background-size: 6px 6px; background-repeat: no-repeat; }
.blank { font: inherit; font-weight: 650; min-height: 40px; width: auto; max-width: 100%; padding: .25em .5em; margin: .15em .1em; border: 2px dashed var(--primary); border-radius: 10px; background: var(--primary-soft); color: var(--text); text-align: center; }
.blank:focus { outline: none; border-style: solid; box-shadow: 0 0 0 3px var(--primary-soft); }
.fill p { line-height: 2.2; }

.order-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; counter-reset: o; }
.order-item { counter-increment: o; display: flex; align-items: center; gap: .6rem; background: var(--surface); border: 2px solid var(--border); border-radius: 14px; padding: .45rem .5rem .45rem .7rem; cursor: grab; user-select: none; min-height: 52px; }
.order-item::before { content: counter(o); flex: none; width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .8rem; background: var(--surface-2); color: var(--muted); }
.order-item.dragging { opacity: .5; }
.order-item.drag-over { border-color: var(--primary); border-style: dashed; }
.order-grip { color: var(--muted); letter-spacing: -2px; }
.order-text { flex: 1; font-weight: 600; }
.order-btns { display: flex; gap: .3rem; }

.match-grid { display: grid; gap: .55rem; }
.match-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.2fr); gap: .6rem; align-items: center; }
.match-left { font-weight: 650; background: var(--surface-2); border-radius: 12px; padding: .55rem .8rem; }
.match-arrow { color: var(--muted); }
.classify-cats { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
@media (max-width: 560px) { .match-row { grid-template-columns: 1fr; gap: .3rem; } .match-arrow { display: none; } }

.journal-editor .table-wrap { margin-bottom: .6rem; }
.je td { padding: .4rem; vertical-align: middle; }
.je select, .je input { width: 100%; min-width: 0; }
.je td:first-child { min-width: 200px; }
.je td:nth-child(2), .je td:nth-child(3) { min-width: 96px; }
.je tbody tr.is-ok td, .je tbody tr.is-bad td { background: transparent; }
.je tbody tr.is-ok { box-shadow: inset 4px 0 0 var(--success); }
.je tbody tr.is-bad { box-shadow: inset 4px 0 0 var(--danger); }
.journal-editor .journal-check { margin: 0; }

.practice-form { border: 1px solid var(--border); border-radius: 16px; overflow: hidden; background: var(--surface); }
.pf-bar { display: flex; align-items: center; gap: .7rem; padding: .6rem 1rem; background: var(--surface-2); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.pf-dots { display: inline-flex; gap: 5px; }
.pf-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--surface-3); display: block; }
.pf-tag { margin-left: auto; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--cta-text); }
.pf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .9rem 1rem; padding: 1rem; }
.fld { display: grid; gap: .3rem; align-content: start; }
.fld label { font-size: .85rem; font-weight: 700; color: var(--text-2); }
.fld small { font-size: .78rem; }
.req { color: var(--danger); }
.is-given .input { background: var(--surface-2); color: var(--text-2); border-style: dashed; }

/* ==========================================================================
   Labs
   ========================================================================== */
.blk-lab { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
.blk-lab .ex-kicker { color: var(--primary); }
.lab-grid { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 1.4rem; margin-top: .8rem; }
.lab-wide .lab-grid { grid-template-columns: 1fr; }
@media (max-width: 760px) { .lab-grid { grid-template-columns: 1fr; } }
.lab-controls { display: grid; gap: .7rem; align-content: start; }
.lab-set { border: 1px solid var(--border); border-radius: 14px; padding: .6rem .8rem .8rem; margin: 0; display: grid; gap: .6rem; }
.lab-set legend { font-weight: 750; font-size: .88rem; padding: 0 .3rem; }
.lab-output { display: grid; grid-template-columns: minmax(0, 1fr); gap: .6rem; align-content: start; min-width: 0; }
.lab-row { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem .8rem; background: var(--surface-2); border-radius: 12px; font-variant-numeric: tabular-nums; }
.lab-row.warn strong { color: var(--warn); }
.lab-row.good strong { color: var(--success); }
.verdict { display: grid; gap: .25rem; padding: .9rem 1rem; border-radius: 14px; font-weight: 800; font-size: 1.02rem; }
.verdict small { font-weight: 500; font-size: .86rem; color: var(--text-2); }
.verdict.ok { background: var(--success-soft); color: var(--success); }
.verdict.bad { background: var(--danger-soft); color: var(--danger); }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.checklist li { display: grid; gap: .1rem; padding: .5rem .8rem; border-radius: 12px; border: 1px solid var(--border); font-size: .9rem; }
.checklist li.ok strong { color: var(--success); }
.checklist li.bad { border-color: var(--danger); }
.checklist li.bad strong { color: var(--danger); }
.checklist span { color: var(--muted); font-size: .84rem; }
.bad-text { color: var(--danger); font-weight: 650; }
.mini-journal { font-family: var(--mono); font-size: .84rem; background: var(--surface-2); border-radius: 12px; padding: .7rem .9rem; overflow-wrap: anywhere; }
.mini-journal strong { font-family: var(--font); }
.combo { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; font-family: var(--mono); font-size: clamp(1.1rem, .9rem + 1.2vw, 1.6rem); font-weight: 800; }
.combo-seg { background: var(--primary-soft); color: var(--primary); padding: .15em .45em; border-radius: 10px; }
.combo-sep { color: var(--muted); }
.combo-desc { color: var(--text-2); font-size: .9rem; margin: 0; }
.effects { list-style: none; padding: 0; margin: 0; display: grid; gap: .45rem; }
.effects li { display: grid; gap: .15rem; padding: .6rem .8rem; border-radius: 12px; border-left: 4px solid var(--border); background: var(--surface-2); font-size: .9rem; }
.effects li.up { border-left-color: var(--success); }
.effects li.down { border-left-color: var(--warn); }
.effects span { color: var(--text-2); font-size: .85rem; }

.lab-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.lab-card { display: grid; gap: .4rem; align-content: start; background: var(--surface); border: 1px solid var(--border); border-radius: 22px; padding: 1.2rem 1.3rem; text-decoration: none; color: var(--text); box-shadow: var(--shadow); transition: transform .15s var(--ease), box-shadow .15s; }
.lab-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); color: var(--text); }
.lab-card-icon { font-size: 1.8rem; width: 3rem; height: 3rem; display: grid; place-items: center; background: var(--primary-soft); border-radius: 14px; }
.lab-card strong { font-family: var(--font-display); font-size: 1.1rem; }
.lab-card-go { color: var(--primary); font-weight: 700; display: inline-flex; align-items: center; gap: .3rem; margin-top: .3rem; }

/* the step heading already names the block: hide the block's own first heading */
.codelab-step .step-title + .blk h2:first-of-type { display: none; }
.codelab-step .step-title + .blk-slides .slides-head { padding-bottom: 0; }
.lab-wide .lab-grid { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 760px) { .lab-grid { grid-template-columns: minmax(0, 1fr); } }
.je td:first-child, .je select { font-family: var(--font); font-size: .95rem; }

/* journal editor becomes stacked cards on phones */
@media (max-width: 560px) {
  .journal-editor .table-wrap { border: none; background: transparent; overflow: visible; }
  .je, .je tbody, .je tfoot { display: block; }
  .je thead { display: none; }
  .je tbody tr { display: grid; grid-template-columns: 1fr 1fr auto; gap: .4rem; padding: .6rem; margin-bottom: .55rem; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
  .je tbody td { display: block; border: none; padding: 0; min-width: 0 !important; }
  .je tbody td:first-child { grid-column: 1 / -1; }
  .je tbody td:nth-child(2)::before { content: "Debit"; }
  .je tbody td:nth-child(3)::before { content: "Credit"; }
  .je tbody td:nth-child(2)::before, .je tbody td:nth-child(3)::before { display: block; font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: .15rem; }
  .je tbody td:last-child { align-self: end; }
  .je tfoot tr { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .4rem; padding: .6rem; border-radius: 14px; background: var(--surface-2); }
  .je tfoot th, .je tfoot td { border: none; padding: 0; background: transparent; }
  .je tfoot td:last-child { display: none; }
}
@media (max-width: 560px) {
  .blk-exercise, .blk-lab, .blk-quiz, .blk-example, .blk-steps, .blk-kid { padding: 1rem; border-radius: 18px; }
  .pf-grid { grid-template-columns: 1fr; padding: .8rem; }
  .lab-set { padding: .5rem .6rem .7rem; }
}

.home-labs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 22px; padding: clamp(1.2rem, 1rem + 1.5vw, 2rem); margin-bottom: 2.2rem; box-shadow: var(--shadow); }
.home-lab-chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.lab-chip { display: inline-flex; align-items: center; gap: .45rem; min-height: 44px; padding: .5rem .9rem; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-weight: 650; text-decoration: none; font-size: .92rem; }
.lab-chip:hover { background: var(--surface-3); color: var(--primary); }
@media (max-width: 760px) { .home-labs { grid-template-columns: 1fr; } }

/* Oracle release badge (home hero) */
.release-badge { display: inline-flex; align-items: center; gap: .4em; margin: 0 0 1rem; padding: .35em .85em; min-height: 32px; border-radius: 999px; font-size: .85rem; font-weight: 700; text-decoration: none; background: var(--success-soft); color: var(--success); }
.release-badge:hover { text-decoration: underline; }
