/* ============================================================
   Swift-J Web Dev. Tutorial — styles
   Light theme: 3% black background (#f7f7f7), 90% black text
   (#1a1a1a), electric green (#00e676) accents. Buttons are
   black-with-green or green-with-black. No external deps.
   ============================================================ */

:root {
  color-scheme: light;
  --bg: #f7f7f7;            /* 3% black */
  --bg-soft: #f0f0f0;
  --panel: #ffffff;
  --panel-2: #eaeaea;
  --border: #d6d6d6;
  --border-soft: #e3e3e3;
  --text: #1a1a1a;          /* 90% black */
  --muted: #484848;
  --faint: #757575;
  --ink: #0a0a0a;           /* near-black for dark surfaces */
  --green: #00e676;         /* electric green */
  --green-2: #00c853;
  --green-dim: rgba(0, 230, 118, .15);
  --blue: #00b3ff;
  --amber: #f5a623;
  --rose: #f24b5e;
  --grad: linear-gradient(120deg, #0a0a0a, #00e676);
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 12px 32px rgba(10, 10, 10, .12);
  --maxw: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
::selection { background: rgba(0, 230, 118, .35); }

h1, h2, h3, h4 { text-wrap: balance; scroll-margin-top: 92px; }
p { text-wrap: pretty; }

/* ---------- focus & skip link ---------- */
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--green);
  padding: 10px 18px; border-radius: 0 0 12px 0;
  font-weight: 700; text-decoration: none;
}
.skip-link:focus { left: 0; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  padding: 0; overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ---------- scrollbars ---------- */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: #cfcfcf; border-radius: 8px; border: 3px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- header (near-black bar) ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10, 10, 10, .94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #232323;
}
.header-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 10px 22px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: #f5f5f5; font-weight: 800; letter-spacing: .3px;
}
.brand-logo { height: 30px; width: auto; display: block; }
.brand-text { font-size: 18px; }
.brand-accent { color: var(--green); }

.site-nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: 6px; }
.nav-link {
  background: none; border: none; color: #bdbdbd; cursor: pointer;
  font: inherit; font-size: 14.5px; font-weight: 600;
  padding: 7px 12px; border-radius: 999px;
  transition: color .15s ease, background-color .15s ease;
  touch-action: manipulation;
}
.nav-link:hover { color: #fff; background: #1f1f1f; }
.nav-link.active { color: var(--ink); background: var(--green); box-shadow: 0 4px 14px rgba(0, 230, 118, .35); }

.header-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.search-box { position: relative; }
.search-icon {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: #8a8a8a; pointer-events: none;
}
#search-input {
  width: 210px; max-width: 38vw;
  background: #1a1a1a; border: 1px solid #333; color: #f2f2f2;
  border-radius: 999px; padding: 8px 14px 8px 34px; font: inherit; font-size: 14px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, width .15s ease;
}
#search-input::placeholder { color: #8a8a8a; }
#search-input:focus { border-color: var(--green); width: 250px; }
#search-input:focus-visible { border-color: var(--green); box-shadow: 0 0 0 3px rgba(0, 230, 118, .35); }

.progress-pill {
  font-size: 13px; font-weight: 700; color: var(--green);
  background: #1a1a1a; border: 1px solid #333;
  padding: 6px 12px; border-radius: 999px; white-space: nowrap;
  min-width: 58px; text-align: center; font-variant-numeric: tabular-nums;
}
.progress-pill:not(:empty)::before { content: "▲ "; color: var(--green); }

/* ---------- layout ---------- */
.app { max-width: var(--maxw); margin: 0 auto; padding: 34px 22px 60px; min-height: calc(100vh - 180px); }
.app h1, .app h2, .app h3 { line-height: 1.25; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: none; cursor: pointer; font: inherit; font-weight: 700; font-size: 14.5px;
  padding: 10px 18px; border-radius: 10px; text-decoration: none;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease,
              transform .15s ease, box-shadow .15s ease;
  touch-action: manipulation;
}
.btn-primary { background: var(--ink); color: var(--green); box-shadow: 0 6px 18px rgba(10, 10, 10, .18); }
.btn-primary:hover { background: #000; color: #2bff95; transform: translateY(-1px); }
.btn-ghost {
  background: transparent; color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); }
.btn-ghost.completed { border-color: var(--green); color: #007a3d; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }

/* ---------- home / hero ---------- */
.hero { text-align: center; padding: 46px 10px 34px; }
.hero .kicker {
  display: inline-block; font-size: 13px; font-weight: 700; letter-spacing: 1.2px;
  text-transform: uppercase; color: #007a3d;
  border: 1px solid rgba(0, 230, 118, .45); background: var(--green-dim);
  padding: 6px 14px; border-radius: 999px; margin-bottom: 22px;
}
.hero h1 {
  font-size: clamp(30px, 5vw, 52px); margin: 0 0 16px; font-weight: 800;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.lead { font-size: clamp(16px, 2.2vw, 19px); color: var(--muted); max-width: 760px; margin: 0 auto 30px; }
.stat-row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-bottom: 14px; }
.stat {
  background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 14px 26px; min-width: 120px;
}
.stat b { display: block; font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat b .num { color: #00a34f; }
.stat span { font-size: 12.5px; color: var(--muted); font-weight: 600; letter-spacing: .4px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }

.hero-img {
  max-width: 860px; margin: 34px auto 0;
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); background: var(--panel);
}
.hero-img img { display: block; width: 100%; height: auto; }
.hero-img figcaption {
  font-size: 13px; color: var(--muted); padding: 10px 14px;
  border-top: 1px solid var(--border-soft); background: var(--panel);
}

.section-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 20px; font-weight: 800; margin: 44px 0 6px;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- track cards ---------- */
.track-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(255px, 1fr)); gap: 16px; margin-top: 16px; }
.track-card {
  position: relative; display: flex; flex-direction: column; gap: 12px;
  background: var(--panel);
  border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 18px 20px 20px; cursor: pointer; text-align: left; color: var(--text);
  overflow: hidden; font: inherit;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
  touch-action: manipulation;
}
.track-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--tc, var(--grad));
}
.track-card:hover { transform: translateY(-3px); border-color: var(--border); box-shadow: var(--shadow); }
.track-thumb {
  width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover;
  border-radius: var(--radius-sm); border: 1px solid var(--border-soft);
  margin-top: 4px;
}
.track-emoji { font-size: 30px; line-height: 1; }
.track-card h3 { margin: 0; font-size: 18.5px; }
.track-card p { margin: 0; color: var(--muted); font-size: 14px; flex: 1; }
.track-meta { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--faint); font-weight: 600; }
.track-meta .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--faint); flex: 0 0 auto; }

/* ---------- track view ---------- */
.track-head { display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; margin-bottom: 22px; }
.track-head .track-emoji { font-size: 44px; line-height: 1; }
.track-head h1 { margin: 0; font-size: clamp(24px, 4vw, 34px); }
.track-head p { margin: 6px 0 0; color: var(--muted); max-width: 640px; }
.track-head .pill-track { align-self: flex-start; }

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.chip {
  border: 1px solid var(--border); background: transparent; color: var(--muted);
  font: inherit; font-size: 13.5px; font-weight: 700; padding: 7px 14px; border-radius: 999px;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background-color .15s ease;
  touch-action: manipulation;
}
.chip:hover { color: var(--text); border-color: var(--faint); }
.chip.active { border-color: transparent; }
.chip.active[data-level="all"] { background: var(--ink); color: var(--green); }
.chip.active[data-level="beginner"] { background: var(--green); color: #052e1a; }
.chip.active[data-level="intermediate"] { background: var(--amber); color: #3a2400; }
.chip.active[data-level="advanced"] { background: var(--rose); color: #2a0407; }

.lesson-group h2 {
  font-size: 15px; text-transform: uppercase; letter-spacing: 1px; color: var(--faint);
  margin: 26px 0 10px; font-weight: 800;
}
.lesson-list { display: flex; flex-direction: column; gap: 10px; }
.lesson-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 14px 16px; cursor: pointer; text-align: left; color: var(--text); font: inherit;
  width: 100%;
  transition: border-color .15s ease, transform .15s ease, background-color .15s ease;
  touch-action: manipulation;
}
.lesson-card:hover { border-color: var(--green); transform: translateX(3px); }
.lesson-card .num {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 9px;
  background: var(--panel-2); border: 1px solid var(--border-soft);
  display: grid; place-items: center; font-weight: 800; font-size: 13.5px; color: var(--muted);
}
.lesson-card .lesson-info { flex: 1; min-width: 0; }
.lesson-card .lesson-title { font-weight: 700; font-size: 15.5px; }
.lesson-card .lesson-desc { color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lesson-card .lesson-meta { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; font-size: 12.5px; color: var(--faint); }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 800; letter-spacing: .4px;
  padding: 3px 10px; border-radius: 999px; border: 1px solid transparent; text-transform: uppercase;
}
.badge.beginner { color: #00693b; border-color: rgba(0, 166, 89, .35); background: var(--green-dim); }
.badge.intermediate { color: #92400e; border-color: rgba(245, 166, 35, .4); background: rgba(245, 166, 35, .14); }
.badge.advanced { color: #be123c; border-color: rgba(242, 75, 94, .38); background: rgba(242, 75, 94, .12); }
.badge.track { color: #0077a8; border-color: rgba(0, 179, 255, .35); background: rgba(0, 179, 255, .12); }
.badge.done { color: #052e1a; background: var(--green); border-color: var(--green); }

/* ---------- lesson view ---------- */
.lesson-layout { display: grid; grid-template-columns: 268px 1fr; gap: 26px; align-items: start; }
.lesson-sidebar {
  position: sticky; top: 78px; max-height: calc(100vh - 100px); overflow: auto;
  overscroll-behavior: contain;
  background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 14px; display: flex; flex-direction: column; gap: 4px;
}
.lesson-sidebar .side-title { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--faint); font-weight: 800; margin: 4px 6px 8px; }
.side-item {
  display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--muted);
  font-size: 13.5px; font-weight: 600; padding: 7px 10px; border-radius: 8px;
  border: none; background: none; cursor: pointer; text-align: left; font-family: inherit; width: 100%;
  transition: color .12s ease, background-color .12s ease;
  touch-action: manipulation;
}
.side-item:hover { color: var(--text); background: var(--panel-2); }
.side-item.active { color: var(--green); background: var(--ink); }
.side-item .side-num { font-size: 11px; opacity: .7; min-width: 16px; }
.side-item .side-check { margin-left: auto; color: var(--green); }

.lesson-main { min-width: 0; }
.crumb { font-size: 13px; color: var(--faint); margin-bottom: 14px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.crumb a, .crumb button {
  color: #007a3d; text-decoration: none; font-weight: 600; background: none; border: none; cursor: pointer; font: inherit; font-size: 13px;
}
.crumb a:hover, .crumb button:hover { text-decoration: underline; }
.lesson-head { margin-bottom: 8px; }
.lesson-head .badges { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.lesson-head h1 { margin: 0 0 12px; font-size: clamp(23px, 3.4vw, 33px); font-weight: 800; }
.lesson-head .lede { color: var(--muted); font-size: 16px; max-width: 720px; }

.lesson-toolbar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 12px 14px; margin: 18px 0 26px;
}
.lesson-toolbar .meta-words { color: var(--faint); font-size: 13px; margin-left: auto; }

.track-toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 14px; }

/* ---------- content blocks ---------- */
.block { margin: 18px 0; }
.block h3 { font-size: 21px; font-weight: 800; margin: 26px 0 10px; }
.block h4 { font-size: 17px; font-weight: 800; margin: 20px 0 8px; color: #0077a8; }
.block p { color: #2b2b2b; }
.block strong { color: var(--ink); }
.block ul, .block ol { padding-left: 22px; color: #2b2b2b; }
.block li { margin: 6px 0; }
.block code.inline {
  background: #e7e7e7; border: 1px solid #d5d5d5; color: #007a3d;
  padding: 1.5px 6px; border-radius: 6px; font-size: .88em;
  font-family: "Cascadia Code", Consolas, "SF Mono", Menlo, monospace;
}
.block a { color: #007a3d; text-decoration: underline; text-underline-offset: 2px; }
.block a:hover { color: var(--green-2); }
.block hr { border: 0; border-top: 1px dashed var(--border); margin: 26px 0; }

.callout {
  border-radius: var(--radius-sm); padding: 14px 16px; margin: 18px 0;
  font-size: 14.5px; border-left: 4px solid var(--cc, var(--green)); background: var(--cb, var(--green-dim));
}
.callout .callout-title { font-weight: 800; font-size: 12.5px; text-transform: uppercase; letter-spacing: .8px; color: var(--cc, var(--green)); margin-bottom: 4px; }
.callout p { margin: 0; color: #2b2b2b; } .callout p + p { margin-top: 8px; }
.callout.tip { --cc: #00a34f; --cb: rgba(0, 230, 118, .1); }
.callout.note { --cc: #0077a8; --cb: rgba(0, 179, 255, .08); }
.callout.warn { --cc: #b45309; --cb: rgba(245, 166, 35, .12); }

/* ---------- code blocks (dark on light) ---------- */
.code-block { position: relative; }
.code-title {
  display: flex; align-items: center; justify-content: space-between;
  background: #0d0d0d; border: 1px solid #1d1d1d; border-bottom: 0;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0; padding: 8px 14px;
}
.code-title .ct-lang { font-size: 12px; font-weight: 800; letter-spacing: .6px; color: var(--green); text-transform: uppercase; }
.copy-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: #1c1c1c; color: #bdbdbd; border: 1px solid #2c2c2c;
  font: inherit; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 7px;
  cursor: pointer;
  transition: color .12s ease, border-color .12s ease, background-color .12s ease;
  touch-action: manipulation;
}
.copy-btn:hover { color: #fff; border-color: var(--green); }
.copy-btn.copied { color: #052e1a; background: var(--green); border-color: var(--green); }
.code-block pre {
  background: #0d0d0d; border: 1px solid #1d1d1d; border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  padding: 16px 18px; overflow-x: auto; margin: 0; max-height: 520px;
}
.code-block pre code {
  font-family: "Cascadia Code", Consolas, "SF Mono", Menlo, monospace;
  font-size: 13.5px; line-height: 1.6; color: #d8f3e4;
}
.code-block.plain pre { border-radius: var(--radius-sm); }

/* ---------- prompt blocks (black, green glow) ---------- */
.prompt-block { position: relative; margin: 20px 0; }
.prompt-inner {
  position: relative;
  background: radial-gradient(120% 140% at 0% 0%, rgba(0, 230, 118, .18), rgba(10, 10, 10, 0) 55%),
              linear-gradient(180deg, #131313, #0a0a0a);
  border: 1px solid rgba(0, 230, 118, .5); border-radius: var(--radius);
  padding: 14px 16px 14px 18px; overflow: hidden;
}
.prompt-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--green); margin-bottom: 8px;
}
.prompt-title .p-ico {
  width: 18px; height: 18px; border-radius: 5px; background: var(--green); color: var(--ink);
  display: grid; place-items: center; flex: 0 0 auto;
}
.prompt-title .p-ico svg { width: 10px; height: 10px; }
.prompt-copy { position: absolute; top: 12px; right: 12px; }
.prompt-text { color: #e6f6ee; font-size: 14.5px; line-height: 1.7; white-space: pre-wrap; user-select: text; }
.prompt-text code { color: var(--green); }

/* ---------- prev / next ---------- */
.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 44px; }
.pn-card {
  background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 16px 18px; text-decoration: none; color: var(--text); display: block;
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
  touch-action: manipulation;
}
.pn-card:hover { border-color: var(--green); transform: translateY(-2px); box-shadow: var(--shadow); }
.pn-card.next { text-align: right; }
.pn-label { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--faint); font-weight: 800; }
.pn-title { font-weight: 700; margin-top: 4px; }

/* ---------- search results ---------- */
.search-info { color: var(--muted); margin-bottom: 16px; }
.search-info b { color: var(--text); }

/* ---------- empty / misc ---------- */
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.empty-ish { text-align: center; color: var(--text); background: var(--panel); border: 1px dashed var(--border); border-radius: var(--radius); padding: 40px 20px; margin: 24px 0; }
.empty-ish strong { display: block; margin-bottom: 6px; }
.reset-link { color: var(--faint); font-size: 12.5px; text-decoration: underline; cursor: pointer; background: none; border: none; font: inherit; }

/* ---------- access gate (accredited students only) ---------- */
.access-gate {
  max-width: 620px; margin: 30px auto; text-align: center;
  background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 42px 30px;
}
.gate-icon { font-size: 48px; line-height: 1; margin-bottom: 12px; }
.access-gate h1 { font-size: 24px; margin: 0 0 10px; }
.access-gate p { color: var(--muted); font-size: 15px; margin: 0 auto 20px; max-width: 480px; line-height: 1.55; }
.access-gate .btn { margin-bottom: 14px; }
.gate-hint { font-size: 12.5px !important; color: var(--faint) !important; margin-bottom: 0 !important; }

.unlock-list { text-align: left; margin: 16px auto 0; max-width: 460px; display: grid; gap: 8px; list-style: none; padding: 0; }
.unlock-list li { background: var(--panel); border: 1px solid var(--border-soft); border-radius: 10px; padding: 10px 14px; font-size: 14.5px; }

/* ---------- header sign-in chip ---------- */
.auth-chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 999px;
  padding: 7px 13px; font: inherit; font-size: 13.5px; font-weight: 700; color: var(--text);
  cursor: pointer; transition: border-color .15s ease, transform .15s ease; white-space: nowrap;
}
.auth-chip:hover { border-color: var(--green); transform: translateY(-1px); }
.auth-chip svg { width: 15px; height: 15px; opacity: .8; flex: none; }
.auth-chip.signed-in { background: rgba(0, 230, 118, .12); border-color: var(--green); color: #005c2e; }
.auth-chip.signed-in svg { opacity: 1; }

/* ---------- milestones ---------- */
.milestones { margin-top: 4px; }
.milestone-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.milestone-card {
  display: block; text-align: left; cursor: pointer;
  background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 16px 18px; color: var(--text); font: inherit; transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.milestone-card:hover { border-color: var(--green); transform: translateY(-2px); box-shadow: var(--shadow); }
.milestone-card.passed { border-color: var(--green); background: rgba(0, 230, 118, .07); }
.milestone-card .m-emoji { font-size: 26px; line-height: 1; }
.milestone-card h4 { margin: 10px 0 4px; font-size: 16px; }
.milestone-card p { margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.m-status { display: inline-block; font-size: 12px; font-weight: 800; padding: 4px 10px; border-radius: 999px; }
.m-status.pass { background: rgba(0, 230, 118, .18); color: #005c2e; }
.m-status.fail { background: rgba(255, 90, 95, .14); color: #a63a3e; }
.m-status.ready { background: var(--ink); color: var(--green); }
.m-status.locked { background: var(--border-soft); color: var(--faint); }
.milestones-hint { color: var(--faint); font-size: 13px; margin-top: 10px; }

/* ---------- certificate promo (home) ---------- */
.cert-promo {
  display: flex; align-items: center; gap: 22px;
  background: linear-gradient(120deg, var(--ink), #1a1a1a);
  color: #fff; border-radius: var(--radius); padding: 26px 28px; margin-top: 6px;
}
.cert-promo-text h3 { margin: 0 0 8px; font-size: 20px; }
.cert-promo-text p { margin: 0 0 16px; color: #bbb; font-size: 14.5px; }
.cert-promo-text .btn { margin-right: 8px; }
.cert-promo-art { font-size: 56px; flex: none; }

/* ---------- exam views ---------- */
.exam-head { margin: 4px 0 10px; }
.exam-head h1 { margin: 8px 0 6px; }
.exam-head p { color: var(--muted); margin: 0; max-width: 760px; }
.signin-note {
  background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 14px 16px; margin: 14px 0; font-size: 14px; color: var(--text);
}
.signin-note.ok { border-color: var(--green); background: rgba(0, 230, 118, .07); }
.signin-note .btn { margin-left: 6px; }

.quiz-form { margin-top: 18px; }
.quiz-q {
  border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--panel);
  padding: 16px 18px 18px; margin-bottom: 14px;
}
.quiz-q legend { font-weight: 800; font-size: 15.5px; padding: 0 4px; color: var(--text); }
.quiz-opts { margin-top: 10px; display: grid; gap: 8px; }
.quiz-opt {
  display: flex; gap: 10px; align-items: flex-start; cursor: pointer;
  border: 1px solid var(--border-soft); border-radius: 10px; padding: 11px 13px;
  font-size: 14.5px; color: var(--text); background: #fff; transition: border-color .12s ease, background .12s ease;
}
.quiz-opt:hover { border-color: var(--green); }
.quiz-opt input { margin-top: 2px; accent-color: var(--green); flex: none; }
.quiz-opt.right { border-color: var(--green); background: rgba(0, 230, 118, .12); }
.quiz-opt.wrong { border-color: #ff5a5f; background: rgba(255, 90, 95, .08); }
.quiz-why { margin: 10px 0 0; font-size: 13.5px; border-radius: 8px; padding: 10px 12px; }
.quiz-why.ok { background: rgba(0, 230, 118, .14); color: #005c2e; }
.quiz-why.no { background: rgba(255, 90, 95, .1); color: #8a2c2f; }

.exam-result { display: flex; gap: 16px; align-items: flex-start; border-radius: var(--radius); padding: 20px 22px; margin: 18px 0 4px; }
.exam-result.pass { background: rgba(0, 230, 118, .14); border: 1px solid var(--green); }
.exam-result.fail { background: rgba(255, 90, 95, .1); border: 1px solid #ff8a8e; }
.exam-result .r-emoji { font-size: 34px; line-height: 1.1; flex: none; }
.exam-result h2 { margin: 0 0 4px; font-size: 20px; }
.exam-result p { margin: 0; color: var(--text); opacity: .9; }
.exam-actions { margin: 14px 0 0; }

/* ---------- certificate panel ---------- */
.cert-panel {
  background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 22px 24px; margin-top: 18px;
}
.cert-head { display: flex; gap: 18px; align-items: flex-start; }
.cert-head .m-emoji { font-size: 40px; line-height: 1; flex: none; }
.cert-head h2 { margin: 0 0 6px; font-size: 21px; }
.cert-head p { margin: 0; color: var(--muted); font-size: 14.5px; max-width: 720px; }
.cert-stage { margin: 18px 0 14px; }
.cert-preview {
  width: 100%; max-width: 640px; height: auto; display: block;
  border-radius: 10px; border: 1px solid var(--border);
  box-shadow: 0 10px 30px rgba(10, 10, 10, .16);
}
.cert-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.cert-note { margin: 14px 0 0; font-size: 13.5px; color: var(--muted); min-height: 1.2em; }

/* ---------- auth modal ---------- */
.auth-modal {
  position: fixed; inset: 0; z-index: 90; background: rgba(10, 10, 10, .55);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.auth-card {
  position: relative; width: 100%; max-width: 420px; background: #fff; color: var(--text);
  border-radius: 16px; padding: 28px 26px; box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
  animation: crease .18s ease;
}
.auth-close {
  position: absolute; top: 12px; right: 14px; background: none; border: none;
  font-size: 24px; line-height: 1; cursor: pointer; color: var(--faint);
}
.auth-card h2 { margin: 6px 0 10px; font-size: 21px; }
.auth-sub { color: var(--muted); font-size: 14px; margin: 0 0 16px; }
.auth-gsi { min-height: 44px; display: flex; justify-content: center; }
.auth-or { text-align: center; color: var(--faint); font-size: 13px; margin: 12px 0; }
.auth-form { display: grid; gap: 10px; }
.auth-form label { font-size: 13.5px; font-weight: 700; color: var(--text); }
.auth-form input {
  width: 100%; box-sizing: border-box; margin-top: 4px;
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
  font: inherit; font-size: 14.5px; background: #fff; color: var(--text);
}
.auth-form input:focus { outline: 2px solid var(--green); border-color: transparent; }
.auth-form .btn { justify-content: center; }
.btn-block { width: 100%; }
.google-btn { display: flex; align-items: center; justify-content: center; gap: 10px; }
.google-btn svg { flex: none; }
.auth-hint { margin-top: 10px; font-size: 12.5px; color: var(--faint); }
.auth-captcha { display: flex; justify-content: center; min-height: 65px; margin: 2px 0 0; }
.auth-note { min-height: 1.2em; color: #005c2e; font-size: 13px; margin: 8px 0 0; }
@media (max-width: 480px) { .auth-card { padding: 22px 18px; } }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 20px; }
.footer-inner { max-width: var(--maxw); margin: 0 auto; padding: 26px 22px 40px; color: var(--muted); font-size: 14px; }
.footer-inner strong { color: var(--text); }
.footer-meta { font-size: 12.5px; color: var(--faint); margin-top: 6px; }
.footer-legal { font-size: 12.5px; color: var(--faint); margin-top: 8px; }
.footer-legal a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.footer-legal a:hover { color: var(--green); }

/* ---------- content protection (js/guards.js) ---------- */
.no-select, .no-select * {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
/* keep forms, code blocks and Copy buttons fully usable */
.no-select input, .no-select textarea, .no-select select,
.no-select code, .no-select [data-copy], .no-select .copyable,
.no-select [contenteditable] {
  -webkit-user-select: text;
  user-select: text;
}
#protect-toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  background: rgba(10, 10, 10, .95);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .35);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
  z-index: 1200;
  max-width: 90vw;
  text-align: center;
}
#protect-toast.show { opacity: 1; }
#protect-toast.warn { background: #a33; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .lesson-layout { grid-template-columns: 1fr; }
  .lesson-sidebar { position: static; max-height: none; }
}
@media (max-width: 720px) {
  .app { padding: 24px 16px 50px; }
  .header-inner { padding: 10px 14px; gap: 10px; }
  .site-nav { order: 3; width: 100%; }
  .nav-link { padding: 6px 10px; font-size: 13.5px; }
  .header-actions { margin-left: auto; }
  #search-input { width: 150px; }
  #search-input:focus, #search-input:focus-visible { width: 170px; }
  .prevnext { grid-template-columns: 1fr; }
  .lesson-toolbar .meta-words { display: none; }
  .hero { padding-top: 30px; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

@media print {
  body * { display: none !important; }
  body::after {
    content: "© Swift-J Learn — this page is protected and printing is disabled. For help, message us from the support chat on learn.swift-j.com.";
    display: flex !important;
    align-items: center;
    justify-content: center;
    position: fixed;
    inset: 0;
    text-align: center;
    font: 500 16px/1.5 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    color: #111;
    background: #fff;
    padding: 20px;
  }
}