/* ============================================================================
   Agentic Learning Studio — host app chrome (NOT the generated artifact's CSS).
   Phase 1: electric-blue theme, animated neural hero, dropdown controls,
   dashboard, ratings, modify-the-plan chat.
   ============================================================================ */

:root {
  /* ---- Agentic Learning Studio theme: ONE blue palette + Plus Jakarta Sans, used identically by
     the host chrome, the Home tab (home.css) and the generated lessons (tokens.ts). ---- */
  --bg: #f5f8ff;
  --surface: #ffffff;
  --surface-2: #eef3fd;
  --ink: #0f1729;
  --ink-2: #3c4660;
  --muted: #56607a;
  --accent: #2563eb;
  --accent-2: #1d4ed8;
  --accent-3: #38bdf8;
  --accent-weak: #e8efff;
  --accent-glow: #38bdf8;
  --border: #e3e9f5;
  --border-strong: #d0d9ee;
  --border-2: #d0d9ee;
  --ok: #1d9e75;
  --warn: #b4791f;
  --grad: linear-gradient(110deg, var(--accent), var(--accent-2) 55%, var(--accent-3));
  --radius: 18px;
  --r-sm: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 41, 0.05), 0 10px 30px rgba(37, 99, 235, 0.08);
  --shadow-sm: 0 1px 2px rgba(15, 23, 41, 0.05), 0 8px 24px rgba(37, 99, 235, 0.07);
  --font: "Source Sans 3", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-body: var(--font);
  --font-head: var(--font);
  --font-mono: var(--mono);
  font-family: var(--font-body);
}

* { box-sizing: border-box; }
/* min-height (not height) so body grows with content — a fixed 100% height capped the
   sticky topbar's containing block to one viewport, so the nav scrolled away. */
html, body { min-height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); line-height: 1.6; }

.landing[hidden], .workspace[hidden], #viewer-frame[hidden], .viewer-empty[hidden],
.vbtn[hidden], .tabpanel[hidden], #tab-btn-dashboard[hidden], .rating[hidden],
.dash-empty[hidden], #auth-actions[hidden], .lib-empty[hidden], .chat[hidden] { display: none !important; }

/* ---- Top bar ---- */
.topbar {
  display: flex; align-items: center; gap: 22px;
  padding: 12px 22px; background: var(--surface); border-bottom: 1px solid var(--border);
  /* Keep the nav pinned to the top while any tab (incl. Home) scrolls. */
  position: sticky; top: 0; z-index: 50;
}
.brand { font-weight: 800; font-family: var(--font-head); display: flex; align-items: center; gap: 9px; }
.brand .dot { width: 11px; height: 11px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 4px rgba(109, 40, 217, 0.14); }
.brand .logo-img { width: 34px; height: 34px; object-fit: contain; }
.tabs { display: flex; gap: 3px; flex-wrap: wrap; }
.tab { border: none; background: transparent; color: var(--muted); font: inherit; font-weight: 600;
  font-size: 13px; padding: 5px 10px; border-radius: 8px; cursor: pointer; }
.tab.active { color: var(--accent-2); background: var(--accent-weak); }
.tab:disabled { color: #aab; cursor: not-allowed; display: flex; align-items: center; gap: 7px; }
.soon { font-size: 10px; font-weight: 700; text-transform: uppercase; background: #eceef6; color: #8b90a6; padding: 2px 6px; border-radius: 999px; }
.tab-free { font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; vertical-align: middle;
  background: #e7f7ee; color: #15935a; padding: 2px 6px; border-radius: 999px; margin-left: 5px; }
.topbar-spacer { flex: 1; }
.auth-actions { display: flex; align-items: center; gap: 8px; }

/* Mobile header (≤640px): the 9-tab bar used to wrap/stack and overflow the logo +
   credit pill (257px overflow, no hamburger). Reflow to TWO rows — brand + actions on
   top, the tabs as a single horizontal-scroll strip below — so nothing overlaps and
   there's no horizontal page overflow. CSS-only; no markup/JS change. */
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: 8px 10px; padding: 10px 14px; }
  .brand { margin-right: auto; }
  .topbar-spacer { display: none; }
  .tabs { order: 5; flex-basis: 100%; flex-wrap: nowrap; overflow-x: auto; gap: 4px;
    -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 2px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 0 0 auto; white-space: nowrap; }
  .tab-dd { flex: 0 0 auto; }
}
.auth-who { font-size: 12.5px; color: var(--muted); margin-right: 4px; }
.auth-who[hidden], #logout[hidden] { display: none; }

/* ---- Buttons ---- */
.generate { border: none; background: var(--accent); color: #fff; font: inherit; font-weight: 600;
  padding: 11px 20px; border-radius: 11px; cursor: pointer; transition: filter 0.12s, transform 0.08s; }
.generate:hover { filter: brightness(1.07); transform: translateY(-1px); }
.generate:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.generate.sm { padding: 7px 14px; border-radius: 9px; font-size: 13px; }
.ghost { border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 13px; padding: 7px 13px; border-radius: 9px; cursor: pointer; }
.ghost:hover { border-color: var(--accent); color: var(--accent-2); }

/* ---- Landing: hero band with animated neural net ---- */
.landing { display: flex; flex-direction: column; align-items: center; padding-bottom: 48px; }
.hero-band {
  position: relative; width: 100%; overflow: hidden;
  background: radial-gradient(120% 140% at 50% -20%, #1e3a8a 0%, #0b1530 55%, #070b1b 100%);
  padding: 52px 20px 64px; text-align: center;
}
.neural { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hero-content { position: relative; z-index: 1; max-width: 720px; margin: 0 auto; }
.hero-content h1, .hero-content .hero-title {
  font-family: var(--font-head); font-size: 40px; font-weight: 700; letter-spacing: -0.02em;
  margin: 0 0 12px; color: #fff;
  text-shadow: 0 2px 30px rgba(56, 189, 248, 0.25);
}
.hero-content .sub { color: #b8c4e6; font-size: 16.5px; max-width: 600px; margin: 0 auto; line-height: 1.55; }

.landing-inner { width: 100%; max-width: 880px; padding: 0 20px; margin-top: -34px; position: relative; z-index: 2; }

/* Lesson Builder fits the viewport — kill the PAGE scroll (same class of fix as the Trainer
   .workspace / Ask-chat one): the panel is exactly viewport-minus-the-MEASURED-topbar, and the
   landing scrolls INTERNALLY only if a very short viewport can't fit it — so at normal heights
   the "Suggested for you" row is visible with no scroll at all. Trimmed hero/landing padding
   reclaims the ~67px that overflowed once suggestions appear (measured at 1440×900, topbar 73px).
   Scoped to #tab-configurator so the LLM-Skills landing (shared .landing) is untouched. */
#tab-configurator { height: calc(100dvh - var(--topbarH, 73px)); overflow: hidden; }
#tab-configurator #landing { height: 100%; overflow-y: auto; padding-bottom: 18px; }
#tab-configurator .hero-band { padding: 30px 20px 38px; }

/* ---- Dashboard tab ---- */
.dash-panel { padding: 32px 20px 48px; }
.dash-wrap { max-width: 980px; margin: 0 auto; background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; box-shadow: var(--shadow); padding: 22px 24px; }
.dash-empty { color: var(--muted); font-size: 14px; padding: 18px 4px; }
.dash-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.dash-head h2 { font-family: var(--font-head); font-size: 18px; margin: 0; }
.dash-note { font-size: 12.5px; color: var(--muted); }
/* My Lessons = one ROW per course: title + meta + % progress, with Open/Download/Share. */
.dash-grid { display: flex; flex-direction: column; gap: 10px; }
.lesson-row { border: 1px solid var(--border-strong); border-radius: 13px; padding: 13px 15px;
  display: flex; align-items: center; gap: 16px; background: var(--surface); transition: border-color 0.12s, box-shadow 0.12s; }
.lesson-row:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.lr-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.lr-title { font-weight: 600; font-size: 15px; line-height: 1.3; }
.lr-meta { font-size: 11.5px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.lr-prog { display: flex; align-items: center; gap: 9px; }
.lr-bar { flex: 0 1 200px; height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; }
.lr-bar > i { display: block; height: 100%; width: 0; background: var(--ok, #1d9e75); border-radius: 999px; }
.lr-pct { font-size: 11px; color: var(--muted); white-space: nowrap; }
.lr-actions { flex: none; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.lr-actions .ghost { font-size: 12.5px; padding: 7px 12px; }
/* Item (d): "Open" is disabled until a lesson is ≥50% built — read it clearly as inert. */
.lr-actions .ghost:disabled { opacity: 0.45; cursor: not-allowed; }
.lr-actions .ghost:disabled:hover { border-color: var(--border-strong); color: var(--ink); }
.lr-share { font: inherit; font-size: 12.5px; font-weight: 700; padding: 7px 13px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent); color: #fff; white-space: nowrap; }
.lr-share:hover { filter: brightness(1.06); }
.lr-share.shared { background: var(--ok-weak, #e6f6ef); color: #0f6e56; border-color: transparent; cursor: default; }
.lc-badge { background: var(--accent-weak); color: var(--accent-2); font-weight: 600; border-radius: 999px; padding: 1px 8px; }
.lc-badge.warn { background: #fdeede; color: #b9770a; }
.lc-stars { color: #f2b01e; letter-spacing: 1px; }
@media (max-width: 640px) { .lesson-row { flex-direction: column; align-items: stretch; } .lr-actions { justify-content: flex-start; } }

/* Community tiles = Library course-tiles + a "shared by" credit + a like button. The card is a
   div (so the like button isn't nested in the cover button); .lib-open is the cover click target. */
.comm-card { padding: 0; }
.comm-card .lib-open { display: block; width: 100%; border: none; background: none; padding: 0; margin: 0; cursor: pointer; font: inherit; color: inherit; text-align: left; }
.comm-by { font-size: 11px; color: var(--muted); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 50%; }
.comm-like { margin-left: auto; border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted);
  font: inherit; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
.comm-like:hover { border-color: var(--danger, #d2433a); color: var(--danger, #d2433a); }
.comm-like.liked { background: var(--danger-weak, #fcebea); color: var(--danger, #d2433a); border-color: transparent; cursor: default; }
.comm-report { border: none; background: none; color: var(--faint, #8893ab); font: inherit; font-size: 12px; cursor: pointer; padding: 3px 6px; border-radius: 6px; }
.comm-report:hover { color: var(--danger, #d2433a); background: var(--danger-weak, #fcebea); }
.comm-report[disabled] { opacity: 0.6; cursor: default; }
.comm-featured { margin-bottom: 22px; }
.comm-feat-h, .comm-all-h { font-size: 13px; font-weight: 700; color: var(--ink); margin: 0 0 11px; }

/* ---- Dashboard in-progress jobs ---- */
.dash-active { display: flex; flex-direction: column; gap: 12px; }
.dash-active:not(:empty) { margin-bottom: 16px; }
.job-card { border: 1px solid var(--accent); background: var(--accent-weak); border-radius: 13px; padding: 14px 16px; }
.job-title { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.job-spin { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--accent); animation: spin 0.8s linear infinite; flex: none; }
.job-bar { height: 7px; background: #fff; border-radius: 99px; overflow: hidden; margin: 10px 0 8px; }
.job-bar > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width 0.4s ease; }
.job-meta { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.job-parts { margin-top: 10px; display: flex; flex-direction: column; gap: 5px; }
.job-part { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.job-part .jp-ico { width: 15px; text-align: center; flex: none; }
.job-part.done { color: var(--ink); }
.job-open { border: none; background: var(--accent); color: #fff; font: inherit; font-size: 12.5px; font-weight: 600; padding: 6px 14px; border-radius: 8px; cursor: pointer; }
.job-open[disabled] { opacity: 0.5; cursor: default; }

/* Open-lessons DROPDOWN under the "Trainer" main tab (Fix 4 — was a visible bar that ate width). */
.tab-dd { position: relative; display: inline-flex; align-items: center; }
.tab-caret { border: none; background: transparent; color: var(--ink-2); font: inherit; font-size: 16px; font-weight: 400; line-height: 1;
  padding: 4px 6px; margin-left: -2px; border-radius: 8px; cursor: pointer; }
.tab-caret[hidden] { display: none; }
.tab-caret:hover, .tab-dd.open .tab-caret { color: var(--accent-2); background: var(--accent-weak); }
.tab-dd-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 60; min-width: 230px; max-width: 320px;
  display: flex; flex-direction: column; gap: 4px; padding: 6px; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: 0 12px 34px rgba(20, 22, 40, 0.16); }
.tab-dd-menu[hidden] { display: none; }
.lesson-tab { width: 100%; border: 1px solid transparent; background: transparent; color: var(--ink, #1d2030); font: inherit;
  font-size: 13px; font-weight: 600; padding: 7px 10px; border-radius: 8px; cursor: pointer; text-align: left;
  display: flex; align-items: center; gap: 7px; }
.lesson-tab:hover { background: var(--accent-weak); }
.lesson-tab.active { background: var(--accent-weak); border-color: var(--accent); color: var(--accent-2); }
.lesson-tab:disabled { opacity: 0.55; cursor: default; }
.lt-title { flex: 1 1 auto; max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lt-x { margin-left: auto; padding: 0 5px; border-radius: 5px; color: var(--muted); font-size: 15px; line-height: 1; }
.lt-x:hover { background: var(--danger-weak, #fde7e7); color: var(--danger, #c0392b); }
.lt-add { color: var(--muted); font-weight: 700; margin-top: 2px; border-top: 1px solid var(--border); border-radius: 0 0 8px 8px; }
.lt-add:hover { color: var(--accent-2); }
.lt-spin { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--accent); animation: spin 0.8s linear infinite; flex: none; display: inline-block; }
.lc-badge.building { background: var(--accent-weak); color: var(--accent-2); display: inline-flex; align-items: center; gap: 5px; }

/* ---- Library tab ---- */
.lib-panel { padding: 28px 22px 56px; }
.lib-wrap { max-width: 1280px; margin: 0 auto; }
.lib-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 14px; }
.lib-head h2 { font-family: var(--font-head); font-size: 22px; margin: 0; }
.lib-sub { color: var(--muted); font-size: 13.5px; margin: 4px 0 0; }
.lib-search { position: relative; display: flex; align-items: center; min-width: 240px; }
.lib-search-ico { position: absolute; left: 12px; width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.lib-search input { width: 100%; border: 1px solid var(--border-strong); background: var(--surface); border-radius: 11px; padding: 10px 12px 10px 36px; font: inherit; font-size: 14px; outline: none; }
.lib-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.lib-cats { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; }
.lib-cat { border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 600; padding: 6px 13px; border-radius: 999px; cursor: pointer; }
.lib-cat:hover { border-color: var(--accent); color: var(--accent-2); }
.lib-cat.active { background: var(--accent); border-color: var(--accent); color: #fff; }
/* Image-free "course tile" cards: a flat category-colored notebook cover (icon watermark +
   title + 2-line description) over a compact meta row. Portrait covers → fewer per row. */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
.lib-empty { color: var(--muted); font-size: 14px; padding: 28px 4px; }
.lib-card { border: 1px solid var(--border); border-radius: 14px; cursor: pointer; display: flex; flex-direction: column; padding: 0; overflow: hidden; background: var(--surface); transition: border-color 0.12s, transform 0.1s, box-shadow 0.12s; text-align: left; font: inherit; }
.lib-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }
/* The cover: a flat category fill (no gradient/image/shadow). Swap the aspect-ratio line
   below for 4/5 if the grid feels too tall. */
.lib-cover { position: relative; aspect-ratio: 3 / 4; padding: 16px; display: flex; align-items: flex-end; overflow: hidden; background-color: var(--cov-bg, #eef2f6); background-image: var(--cov-img, none); background-size: cover; background-position: center; background-repeat: no-repeat; }
/* Legibility scrim: tint the bottom (where title/desc sit) toward the category color so the
   dark title stays readable over the image, while the top of the image shows through. With no
   --cov-img the tint matches --cov-bg, so image-free cards look unchanged. */
.lib-cover::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(to top, color-mix(in srgb, var(--cov-bg, #eef2f6) 94%, transparent), color-mix(in srgb, var(--cov-bg, #eef2f6) 55%, transparent) 38%, transparent 72%); }
.lib-ico { position: absolute; top: 12px; right: 12px; width: 58px; height: 58px; color: var(--cov-icon, #64748b); opacity: 0.4; pointer-events: none; }
.lib-ico svg { width: 100%; height: 100%; display: block; }
.lib-cover-text { position: relative; z-index: 1; width: 100%; }
.lib-title { font-family: var(--font-head); font-weight: 700; font-size: 16px; line-height: 1.25; color: var(--cov-text, #1f2937);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.lib-desc { margin-top: 6px; font-size: 12.5px; line-height: 1.4; color: color-mix(in srgb, var(--cov-text, #334155), var(--cov-bg, #eef2f6) 32%);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lib-foot { display: flex; gap: 7px; align-items: center; padding: 11px 14px 12px; font-size: 11px; color: var(--muted); flex-wrap: wrap; }
.lib-pill { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 3px 9px; border-radius: 999px; background: var(--cov-bg, #eef2f6); color: var(--cov-text, #334155); }
.lib-foot .lib-lvl { text-transform: capitalize; font-weight: 600; color: var(--ink); }
.lib-foot .lib-dot { color: var(--border-strong); }

/* ---- Prompt card ---- */
.prompt-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  box-shadow: var(--shadow); padding: 18px; text-align: left; }
#prompt { width: 100%; border: none; outline: none; resize: vertical; font: inherit; font-size: 16px;
  color: var(--ink); padding: 8px 6px; min-height: 70px; background: transparent; }
#prompt::placeholder { color: #9aa0b4; }

/* ---- Optional-selections note (above the dropdowns) ---- */
.opts-note { font-size: 12.5px; color: var(--muted); margin: 14px 0 0; padding-top: 14px; border-top: 1px solid var(--border); }

/* ---- Dropdowns: 2 per row ---- */
.dd-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 10px 0 4px; }
/* Code-framework dd is a contextual follow-on (shown only when Examples=Code). Span the
   full row so its appearing/disappearing never shuffles the other dropdowns, and tag it
   with an accent label so it reads as "because you picked Code". */
#dd-framework { grid-column: 1 / -1; }
#dd-framework .dd-btn { border-color: var(--accent); background: var(--accent-weak); }
#dd-framework .dd-label { color: var(--accent-2); }
#dd-framework .dd-label::after { content: " · for your code examples"; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--muted); }
.dd.dd-spotlight .dd-btn { animation: ddspot 1.1s ease; }
@keyframes ddspot { 0% { box-shadow: 0 0 0 0 var(--accent-weak); } 30% { box-shadow: 0 0 0 4px var(--accent-weak); } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .dd.dd-spotlight .dd-btn { animation: none; } }

/* ---- GitHub repo input row ---- */
.repo-row { display: flex; gap: 8px; margin-top: 10px; }
.repo-row input { flex: 1; min-width: 0; border: 1px solid var(--border-strong); border-radius: 10px; padding: 8px 11px; font: inherit; font-size: 13.5px; outline: none; }
.repo-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.repo-row .ghost { flex: none; }
.dd { position: relative; }
.dd-btn { width: 100%; display: flex; align-items: center; gap: 8px; text-align: left;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink);
  font: inherit; padding: 10px 12px; border-radius: 11px; cursor: pointer; transition: border-color 0.12s; }
.dd-btn:hover { border-color: var(--accent); }
.dd.open .dd-btn { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.dd-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.dd-value { flex: 1; font-size: 13.5px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd.is-set .dd-value { color: var(--accent-2); }
.chev { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.15s; }
.dd.open .chev { transform: rotate(180deg); }
.dd-menu { position: absolute; z-index: 30; top: calc(100% + 5px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 11px;
  box-shadow: var(--shadow); padding: 5px; display: flex; flex-direction: column; gap: 2px; }
.dd-menu[hidden] { display: none; }
.dd-opt { text-align: left; border: none; background: transparent; color: var(--ink); font: inherit;
  font-size: 13.5px; padding: 8px 10px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.dd-opt:hover { background: var(--accent-weak); }
.dd-opt.sel { color: var(--accent-2); font-weight: 600; }
.dd-opt.sel::before { content: "✓"; font-weight: 700; }
.dd-opt:not(.sel)::before { content: ""; width: 11px; display: inline-block; }

/* ---- Context fields ---- */
.ctx-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 10px 0 4px; }
.ctx { display: flex; flex-direction: column; gap: 5px; }
.ctx-label { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.ctx input { border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 14px; padding: 9px 12px; border-radius: 11px; outline: none; }
.ctx input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }

/* ---- Uploads ---- */
.uploads { margin: 14px 0 4px; padding-top: 14px; border-top: 1px solid var(--border); }
.uploads-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.refer-only { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); cursor: pointer; }
.refer-only input { accent-color: var(--accent); width: 15px; height: 15px; }
.refer-only strong { color: var(--ink); }
.upload-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.upload-chips:empty { margin-top: 0; }
.chip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border-strong); background: var(--surface); border-radius: 999px; padding: 5px 6px 5px 12px; font-size: 12.5px; }
.chip-name { font-weight: 600; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-meta { color: var(--muted); font-size: 11.5px; }
.chip.uploading { opacity: 0.7; }
.chip.failed { border-color: #e0a3a0; }
.chip.failed .chip-meta { color: #c0392b; }
.chip-x { border: none; background: transparent; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer; padding: 0 4px; border-radius: 50%; }
.chip-x:hover { background: var(--accent-weak); color: var(--accent); }
.upload-hint { font-size: 12.5px; color: var(--muted); margin-top: 8px; }

.prompt-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; gap: 12px; }
.hint { font-size: 12.5px; color: var(--muted); }

/* ---- Workspace: full-screen lesson; "Ask more" chat slides in on the RIGHT ---- */
/* height uses the MEASURED topbar height (set by app.js as --topbarH) — the old hardcoded
   57px undershot the real ~73px bar, leaving a 16px page scroll that showed when the Ask
   chat opened. Fallback keeps the old value for safety. */
.workspace { display: grid; grid-template-columns: 1fr 0; height: calc(100dvh - var(--topbarH, 57px)); transition: grid-template-columns 0.2s ease; overflow: hidden; }
.workspace.chat-open { grid-template-columns: 1fr minmax(320px, 32%); }
.chat { border-left: 1px solid var(--border); display: flex; flex-direction: column; background: var(--surface); min-width: 0; overflow: hidden; }
.chat[hidden] { display: none; }
.chat-head { padding: 11px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.chat-title { font-weight: 600; font-size: 14px; font-family: var(--font-head); }
.chat-close { border: none; background: none; font-size: 20px; line-height: 1; color: var(--muted); cursor: pointer; }
.chat-close:hover { color: var(--ink); }
.chat-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.vbtn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.vbtn.primary:hover { filter: brightness(1.07); color: #fff; }

/* Generation overlay (shown on the viewer while the lesson builds) */
.gen-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; padding: 24px; background: var(--bg); }
.gen-overlay[hidden] { display: none; }
.gen-spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--border-strong); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
.gen-label { font-size: 16px; font-weight: 600; color: var(--accent-2); font-family: var(--font-head); }
.gen-sub { font-size: 13px; color: var(--muted); max-width: 360px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Ask-answer "add to lesson" button + suggested chips */
.add-to-lesson { margin-top: 8px; border: 1px solid var(--accent); background: var(--accent-weak); color: var(--accent-2); font: inherit; font-size: 12.5px; font-weight: 600; padding: 6px 11px; border-radius: 8px; cursor: pointer; }
.add-to-lesson:hover { background: var(--accent); color: #fff; }
.add-to-lesson[disabled] { opacity: 0.6; cursor: default; }
.sugg-srcs { font-size: 11px; color: var(--muted); margin-top: 6px; }

.suggested { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.suggested[hidden] { display: none; }
.sugg-lab { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.sugg-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
.sugg-chip { border: 1px solid var(--border-strong); background: var(--surface); color: var(--accent-2); font: inherit; font-size: 13px; padding: 7px 13px; border-radius: 999px; cursor: pointer; }
.sugg-chip:hover { border-color: var(--accent); background: var(--accent-weak); }

/* Onboarding */
.onboard .ob-step { margin: 4px 0 14px; }
.onboard .ob-step input { width: 100%; border: 1px solid var(--border-strong); border-radius: 11px; padding: 11px 13px; font: inherit; font-size: 15px; outline: none; margin-top: 6px; }
.onboard .ob-step input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.ob-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }

.msg { border: 1px solid var(--border); border-radius: 13px; padding: 11px 13px; font-size: 14.5px; animation: fade 0.18s ease; }
.msg.user { background: var(--accent-weak); border-color: #cfe0ff; }
.msg .who { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent-2); font-weight: 700; margin-bottom: 5px; }
.msg strong { color: var(--ink); }
.status { align-self: flex-start; color: var(--muted); font-size: 13px; display: flex; gap: 9px; align-items: center;
  background: var(--accent-weak); border-radius: 10px; padding: 9px 12px; }
.status .spin { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); animation: pulse 1s infinite; }
.status .label { color: var(--accent-2); font-weight: 500; }

/* Modify-the-plan composer */
.chat-compose { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); align-items: flex-end; }
#chat-input { flex: 1; resize: none; border: 1px solid var(--border-strong); border-radius: 11px;
  font: inherit; font-size: 14px; padding: 9px 12px; outline: none; max-height: 120px; }
#chat-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
#chat-input:disabled { background: var(--bg); color: #aab; }

/* ---- Viewer ---- */
.viewer { display: flex; flex-direction: column; min-width: 0; }
.viewer-bar { display: flex; align-items: center; justify-content: space-between; padding: 11px 18px; border-bottom: none; box-shadow: 0 1px 0 var(--border); background: var(--surface); gap: 10px; }
.viewer-title { font-weight: 700; font-size: 16.5px; letter-spacing: -0.01em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-actions { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }
/* "generating…" pill shown in the Trainer bar while a background job runs (links to My Lessons) */
.gen-status { margin-left: auto; margin-right: 6px; flex-shrink: 0; font-size: 12px; font-weight: 600; color: var(--accent-2); background: var(--accent-weak); border-radius: 99px; padding: 4px 11px; cursor: pointer; white-space: nowrap; }
.gen-status:hover { background: var(--accent); color: #fff; }
.gen-status[hidden] { display: none; }
.vbtn { border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 9px; cursor: pointer; text-decoration: none; }
.vbtn:hover { border-color: var(--accent); color: var(--accent-2); }
.viewer-body { flex: 1; position: relative; background: var(--bg); }
.viewer-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 14px; }
#viewer-frame { width: 100%; height: 100%; border: none; background: #fff; }

/* Rating stars */
.rating { display: flex; align-items: center; gap: 6px; }
.rate-label { font-size: 12px; color: var(--muted); }
.stars { display: inline-flex; }
.star { border: none; background: none; cursor: pointer; font-size: 18px; line-height: 1; color: #d4dae8; padding: 0 1px; transition: color 0.1s, transform 0.08s; }
.star:hover { transform: scale(1.15); }
.star.on { color: #f2b01e; }
.rate-thanks { font-size: 12px; color: var(--ok); font-weight: 600; }
.rate-thanks[hidden] { display: none; }

@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

@media (max-width: 760px) {
  .workspace { grid-template-columns: 1fr; grid-template-rows: 38% 62%; }
  .hero-content h1, .hero-content .hero-title { font-size: 30px; }
}
/* Keep the option dropdowns + context fields 2-up until quite narrow. */
@media (max-width: 540px) {
  .dd-grid, .ctx-grid { grid-template-columns: 1fr; }
}

/* ---- Auth modal ---- */
.auth-overlay { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(9, 14, 30, 0.55); backdrop-filter: blur(6px); }
.auth-overlay[hidden] { display: none; }
.auth-card { position: relative; width: 100%; max-width: 392px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 24px 60px rgba(9, 14, 30, 0.35); padding: 28px 26px; }
.auth-close { position: absolute; top: 14px; right: 16px; border: none; background: none; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; }
.auth-close:hover { color: var(--ink); }
.auth-card .brand { font-weight: 700; font-family: var(--font-head); display: flex; align-items: center; gap: 9px; margin-bottom: 16px; }
.auth-loading { color: var(--muted); font-size: 14px; padding: 8px 0; }
.auth-loading[hidden] { display: none; }
.auth-form h2 { font-family: var(--font-head); font-size: 22px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 4px; }
.auth-form[hidden] { display: none; }
.auth-sub { color: var(--muted); font-size: 14px; margin: 0 0 16px; }
.auth-form input { width: 100%; border: 1px solid var(--border-strong); border-radius: 11px; padding: 11px 13px; font: inherit; font-size: 15px; margin-bottom: 10px; outline: none; }
.auth-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.auth-form .generate { width: 100%; margin-top: 4px; }
.auth-msg { font-size: 13px; margin: 4px 0 10px; padding: 9px 12px; border-radius: 9px; }
.auth-msg[hidden] { display: none; }
.auth-msg.err { background: #fcebea; color: #c0392b; }
.auth-msg.ok { background: var(--accent-weak); color: var(--accent-2); }
.auth-switch { margin-top: 14px; font-size: 13px; color: var(--muted); text-align: center; }
.linkbtn { border: none; background: none; color: var(--accent); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 0 0 0 4px; }
.linkbtn:hover { text-decoration: underline; }

/* Community share modal — wider popup + a prominent display-name field. */
.share-card { max-width: 468px; padding: 32px 30px; }
.share-card .auth-sub { font-size: 14.5px; line-height: 1.5; margin-bottom: 20px; }
.share-name { width: 100%; border: 1px solid var(--border-strong); border-radius: 12px; padding: 14px 16px;
  font: inherit; font-size: 16px; margin-bottom: 12px; outline: none; }
.share-name:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.share-card .generate { width: 100%; font-size: 15px; padding-top: 13px; padding-bottom: 13px; justify-content: center; }

/* ---- Auth as a full page (#tab-auth): 50/50 split, story left + form right ---- */
.auth-page { padding: 0; }
.auth-split { display: grid; grid-template-columns: 1fr 1fr; min-height: calc(100vh - 60px); }
.auth-aside { display: flex; align-items: center; padding: 56px 48px; color: #fff;
  background: radial-gradient(120% 120% at 0% 0%, #2b3da8 0%, #1d4ed8 45%, #2563eb 100%); }
.auth-aside-in { max-width: 440px; margin: 0 auto; }
.auth-brand { color: #fff; font-size: 20px; margin-bottom: 30px; }
.auth-brand .logo-img { width: 30px; height: 30px; }
.auth-aside-h { font-family: var(--font-head); font-size: 33px; font-weight: 800; line-height: 1.14; letter-spacing: -0.01em; margin: 0 0 16px; }
.auth-aside-sub { font-size: 15px; line-height: 1.6; color: rgba(255,255,255,.86); margin: 0 0 26px; }
.auth-aside-feats { list-style: none; padding: 0; margin: 0; display: grid; gap: 13px; }
.auth-aside-feats li { display: flex; gap: 11px; align-items: flex-start; font-size: 14.5px; color: rgba(255,255,255,.94); }
.auth-aside-feats .ck { font-weight: 800; color: #bcd0ff; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 48px 32px; background: var(--surface); }
.auth-panel-in { width: 100%; max-width: 380px; }
.auth-panel .auth-form h2 { font-family: var(--font-head); font-size: 26px; font-weight: 800; letter-spacing: -0.01em; margin: 0 0 4px; }
.auth-panel .auth-sub { color: var(--muted); font-size: 14.5px; margin: 0 0 20px; }
.oauth-row { display: grid; gap: 10px; margin: 4px 0 16px; }
/* class display would beat the UA [hidden] rule, so disabled providers stay visible otherwise */
.oauth-row[hidden], .oauth-btn[hidden], .auth-or[hidden] { display: none; }
.oauth-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 600; font-size: 14.5px; padding: 11px 14px; border-radius: 11px;
  cursor: pointer; transition: border-color .15s, background .15s; }
.oauth-btn:hover { border-color: var(--accent); background: var(--accent-weak); }
.oauth-btn svg { width: 18px; height: 18px; flex: none; }
.auth-or { display: flex; align-items: center; text-align: center; color: var(--muted); font-size: 12.5px; margin: 2px 0 14px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-or span { padding: 0 12px; }
.auth-consent { display: flex; gap: 9px; align-items: flex-start; margin: 6px 0 12px; font-size: 13px; color: var(--muted); line-height: 1.45; cursor: pointer; }
.auth-consent[hidden] { display: none; }
.auth-consent input { width: 16px; height: 16px; margin-top: 1px; flex: none; }
.auth-consent a { color: var(--accent); font-weight: 600; }
@media (max-width: 860px) { .auth-split { grid-template-columns: 1fr; } .auth-aside { display: none; } }

/* ===== About page ===== */
.about-wrap { max-width: 860px; margin: 0 auto; }
.about-hero { padding: 6px 0 8px; }
.about-hero h1 { font-family: var(--font-head); font-size: 32px; line-height: 1.18; margin: 8px 0 12px; }
.about-hero h1 em { color: var(--accent-2); font-style: italic; }
.about-lede { font-size: 17px; line-height: 1.55; color: var(--ink-soft); margin: 0; }
.about-sec { margin-top: 30px; }
.about-sec h2 { font-family: var(--font-head); font-size: 20px; margin: 0 0 10px; }
.about-sec p { font-size: 15px; line-height: 1.65; color: var(--ink-soft); margin: 0 0 10px; }
.about-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 4px; }
.about-card { border: 1px solid var(--border); border-radius: 13px; background: var(--surface); padding: 16px 16px 14px; box-shadow: var(--shadow); }
.about-card .ac-n { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: 14px; margin-bottom: 10px; }
.about-card h3 { font-family: var(--font-head); font-size: 15.5px; margin: 0 0 5px; }
.about-card p { font-size: 13.5px; line-height: 1.55; color: var(--muted); margin: 0; }
.about-principles { margin: 0; padding-left: 20px; }
.about-principles li { font-size: 15px; line-height: 1.6; color: var(--ink-soft); margin: 7px 0; }
.about-contrib { border-left: 3px solid var(--accent); background: var(--accent-weak); border-radius: 0 12px 12px 0; padding: 16px 18px; }
.about-contrib h2 { margin-top: 0; }
.about-foot { margin: 30px 0 0; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 14px; }

/* ===== Community sub-tabs (Courses | Drivers) ===== */
.comm-subtabs { display: inline-flex; gap: 4px; background: var(--accent-weak); padding: 4px; border-radius: 11px; margin-bottom: 18px; }
.comm-subtab { border: none; background: transparent; color: var(--accent-2); font: inherit; font-size: 13px; font-weight: 700; padding: 7px 16px; border-radius: 8px; cursor: pointer; }
.comm-subtab.active { background: var(--surface); box-shadow: var(--shadow); }

/* .lib-grid sets display:grid, which beats the UA [hidden] rule — re-assert it for the
   toggled drivers grid + sub-views so hiding actually hides. */
#drivers-grid[hidden], #comm-sub-courses[hidden], #comm-sub-drivers[hidden], #driver-profile[hidden] { display: none !important; }

/* ===== Community Drivers (contributor cards + profile) ===== */
.driver-card { text-align: left; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); padding: 16px; cursor: pointer; font: inherit; color: inherit;
  display: flex; flex-direction: column; gap: 9px; transition: border-color 0.12s, transform 0.1s, box-shadow 0.12s; }
.driver-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.dc-top { display: flex; align-items: center; gap: 11px; }
.dc-avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 800; font-size: 15px; display: flex; align-items: center; justify-content: center; }
.dc-avatar.lg { width: 56px; height: 56px; font-size: 20px; }
.dc-id { min-width: 0; }
.dc-name { display: block; font-weight: 700; font-size: 15px; line-height: 1.2; }
.dc-exp { display: block; font-size: 12px; color: var(--accent-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dc-bio { font-size: 13px; color: var(--muted); line-height: 1.45; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dc-stats { display: flex; gap: 7px; align-items: center; font-size: 12px; color: var(--muted); margin-top: auto; }
/* profile view */
.dp-back { margin-bottom: 16px; }
.dp-head { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.dp-name { font-family: var(--font-head); font-size: 22px; margin: 0 0 3px; }
.dp-exp { font-size: 13.5px; color: var(--accent-2); font-weight: 600; }
.dp-link { display: inline-block; margin-top: 3px; font-size: 13px; }
.dp-bio { font-size: 15px; line-height: 1.6; color: var(--ink-soft); max-width: 760px; margin: 0 0 10px; }
.dp-motiv { font-size: 13px; color: var(--muted); margin-bottom: 18px; }

/* ===== Build for Community form ===== */
.bc-wrap { max-width: 760px; margin: 0 auto; }
.bc-form { display: flex; flex-direction: column; gap: 6px; }
.bc-label { font-size: 13px; font-weight: 700; color: var(--ink); margin-top: 14px; }
.bc-req { color: var(--danger, #d2433a); }
.bc-opt { color: var(--muted); font-weight: 500; }
.bc-form input[type="text"], .bc-form input[type="url"], .bc-form textarea, .bc-form select {
  width: 100%; border: 1px solid var(--border-strong); background: var(--surface); border-radius: 10px;
  padding: 10px 12px; font: inherit; font-size: 14px; outline: none; }
.bc-form input:focus, .bc-form textarea:focus, .bc-form select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.bc-form textarea { resize: vertical; }
.bc-row { display: flex; gap: 12px; }
.bc-row > div:first-child { flex: 1 1 auto; }
.bc-row > div:last-child { flex: 0 0 150px; }
.bc-motiv { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 4px 0; }
.bc-motiv label { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink-soft); cursor: pointer; }
.bc-agree { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; color: var(--ink-soft); line-height: 1.5; margin-top: 16px; cursor: pointer; }
.bc-agree input { margin-top: 2px; }
.bc-uploads { padding: 4px 0; }
.bc-msg { margin-top: 12px; font-size: 13px; padding: 9px 12px; border-radius: 9px; }
.bc-msg.err { background: #fcebea; color: #c0392b; }
.bc-form .generate { margin-top: 18px; align-self: flex-start; }

/* ===== Lesson credits — nav pill + Pricing tab ===== */
/* Borderless to match the rest of the nav (no boxed chips up there). */
.credit-pill { display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border: none; background: none; color: var(--accent-2);
  font: inherit; font-weight: 700; font-size: 13px; padding: 6px 8px; border-radius: 8px;
  margin-right: 6px; text-decoration: none; transition: color .15s, background .15s; }
.credit-pill:hover { color: var(--accent); background: var(--accent-weak); }
.credit-pill.empty { color: var(--warn); background: none; }
.credit-pill.empty:hover { background: #fff5e9; }
/* class display would otherwise beat the UA [hidden] rule, leaving these visible when hidden */
.credit-pill[hidden], .pricing-bal[hidden] { display: none; }
.credit-ico { width: 16px; height: 16px; fill: currentColor; }

.pricing-wrap { max-width: 920px; margin: 0 auto; }
.pricing-head h2 { margin: 0 0 4px; }
.pricing-sub { color: var(--muted); margin: 0 0 22px; max-width: 640px; }
.pricing-bal { display: inline-block; margin-left: 4px; font-weight: 600; color: var(--accent-2); }
.pricing-bal.low { color: var(--warn); }

.pricing-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 760px) { .pricing-cards { grid-template-columns: 1fr; } }
.price-card { position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px 22px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; }
.price-card.featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.price-badge { position: absolute; top: -11px; left: 22px; background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px; letter-spacing: .02em; }
.price-tag { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.price-amount { font-size: 40px; font-weight: 800; color: var(--ink); margin: 6px 0 2px; line-height: 1; }
.price-per { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.price-slider-label { font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 8px; }
.price-slider { width: 100%; accent-color: var(--accent); margin: 2px 0 4px; }
.price-slider-row { display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; color: var(--muted); margin-bottom: 16px; }
.price-slider-row strong { font-size: 17px; color: var(--accent-2); }
.price-card .generate { width: 100%; justify-content: center; margin-top: auto; }
.price-feats { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-direction: column; gap: 8px; }
.price-feats li { position: relative; padding-left: 24px; font-size: 13.5px; color: var(--ink); }
.price-feats li::before { content: "✓"; position: absolute; left: 0; top: 0; color: var(--ok); font-weight: 800; }

.pricing-signin, .pricing-soon { margin-top: 16px; font-size: 13.5px; padding: 11px 14px; border-radius: 10px;
  background: var(--accent-weak); color: var(--accent-2); }
.pricing-soon { background: #fff5e9; color: var(--warn); }
.pricing-signin a { color: var(--accent); font-weight: 600; }

.pricing-terms { margin-top: 34px; border-top: 1px solid var(--border); padding-top: 24px; }
.pricing-terms h3 { font-size: 15px; margin: 0 0 8px; }
.pricing-terms ul { margin: 0 0 20px; padding-left: 20px; color: var(--muted); font-size: 13.5px; line-height: 1.65; }
.pricing-terms strong { color: var(--ink); }

/* ===== Profile menu (top-right) + Account modal ===== */
.profile-wrap { position: relative; }
.profile-wrap[hidden] { display: none; }
.profile-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; background: none;
  border: none; cursor: pointer; padding: 2px 4px; font: inherit; }
.profile-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.profile-label { font-size: 10px; color: var(--muted); font-weight: 600; line-height: 1; }
.profile-btn:hover .profile-avatar { filter: brightness(1.08); }
.profile-menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 70; min-width: 170px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; }
.profile-menu[hidden] { display: none; }
.profile-item { display: block; width: 100%; text-align: left; background: none; border: none; font: inherit;
  font-size: 13.5px; color: var(--ink); padding: 9px 12px; border-radius: 8px; cursor: pointer; }
.profile-item:hover { background: var(--accent-weak); color: var(--accent-2); }

/* Account page (/account) — full-width, same chrome as .lib-panel / .dash-panel. */
.acct-panel { padding: 32px 22px 64px; }
.acct-wrap { max-width: 920px; margin: 0 auto; }
.acct-header { margin-bottom: 22px; }
.acct-h1 { margin: 0 0 6px; font-size: 28px; font-weight: 800; letter-spacing: -0.01em; color: var(--ink); }
.acct-lede { margin: 0; color: var(--muted); font-size: 14.5px; }
.acct-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.acct-card2 { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px 22px 24px; }
.acct-card-h { margin: 0 0 8px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.acct-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 11px 0;
  border-bottom: 1px solid var(--border); font-size: 14px; }
.acct-row:last-of-type { border-bottom: none; }
.acct-k { color: var(--muted); }
.acct-v { color: var(--ink); font-weight: 600; text-align: right; word-break: break-all; }
.acct-v.acct-credits { color: var(--accent-2); }
.acct-card2 .generate { margin-top: 18px; width: 100%; justify-content: center; }
.acct-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 4px 0 10px; }
.acct-stat { background: var(--accent-weak); border-radius: 12px; padding: 16px 12px; text-align: center; }
.acct-stat-n { display: block; font-size: 26px; font-weight: 800; color: var(--accent-2); line-height: 1.1; }
.acct-stat-l { display: block; margin-top: 4px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
@media (max-width: 720px) { .acct-grid { grid-template-columns: 1fr; } }

/* Admin · add credits card (hidden unless /api/account says isAdmin) */
.admin-note { margin: 0 0 12px; font-size: 12.5px; color: var(--muted); }
.admin-input { width: 100%; border: 1px solid var(--border-strong); border-radius: 11px; padding: 10px 13px;
  font: inherit; font-size: 14.5px; outline: none; background: var(--surface); color: var(--ink); }
.admin-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.admin-form-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.admin-input.admin-num { width: 92px; flex: none; }
.admin-form-row .linkbtn { flex: none; }
.acct-card2 .generate.admin-add { margin-top: 0; width: auto; flex: 1; }
.admin-msg { margin-top: 12px; font-size: 13px; font-weight: 600; color: var(--danger, #d2433a); }
.admin-msg.ok { color: var(--accent-2); }

.pricing-note { margin-top: 14px; font-size: 12.5px; color: var(--muted); }

.acct-v.acct-uuid { font-family: var(--mono); font-size: 11.5px; font-weight: 500; max-width: 230px; }

/* ===== Item 4 — "while you wait" library suggestions inside the generating overlay =====
   Cards reuse the Library card's cover treatment (.lib-card/.lib-cover/.lib-ico/.lib-foot, built
   in showWhileYouWait) so they show the SAME category thumbnail. The only difference: the cover is
   height-capped here (Library covers are tall 3/4 portraits) so spinner + heading + 4 cards all fit
   inside the viewer area with no scroll. Heights use vh-aware clamps + a short-viewport fallback. */
.gen-suggest { margin-top: clamp(10px, 2.2vh, 18px); width: 100%; max-width: 760px; }
.gen-suggest[hidden] { display: none; }
.gen-suggest-h { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: clamp(6px, 1.4vh, 10px); }
.gen-suggest-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 720px) { .gen-suggest-grid { grid-template-columns: repeat(4, 1fr); } }
/* Cap the reused Library cover so the whole overlay stack stays on one screen. */
.gen-suggest-grid .lib-cover { aspect-ratio: auto; height: clamp(74px, 13vh, 124px); padding: 11px 12px; }
.gen-suggest-grid .lib-ico { width: 40px; height: 40px; top: 9px; right: 9px; }
.gen-suggest-grid .lib-title { font-size: 13.5px; -webkit-line-clamp: 2; }
.gen-suggest-grid .lib-foot { padding: 8px 11px 9px; font-size: 10.5px; }
.gen-suggest-grid .lib-pill { font-size: 9.5px; padding: 2px 7px; }
/* Short viewers: shrink the spinner block spacing + covers so nothing runs below the fold. */
@media (max-height: 720px) {
  .gen-overlay { gap: 8px; padding: 16px; }
  .gen-overlay .gen-sub { display: none; }
  .gen-suggest-grid .lib-cover { height: clamp(58px, 10vh, 86px); }
  .gen-suggest-grid .lib-title { -webkit-line-clamp: 1; }
}

/* ===== Item 3 — out-of-credits "buy a plan" popup ===== */
.buy-modal { position: fixed; inset: 0; z-index: 120; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(9, 14, 30, 0.55); backdrop-filter: blur(6px); }
.buy-modal[hidden] { display: none; }
.buy-card { position: relative; width: 100%; max-width: 380px; background: var(--card, #fff); border-radius: var(--radius); padding: 28px 26px 22px; text-align: center; box-shadow: 0 24px 60px rgba(9, 14, 30, .35); }
.buy-x { position: absolute; top: 10px; right: 13px; border: 0; background: none; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; }
.buy-emoji { font-size: 34px; }
.buy-card h3 { margin: 8px 0 6px; font-family: var(--font-head); color: var(--ink); font-size: 20px; }
.buy-msg { color: var(--muted); font-size: 14px; margin: 0 0 18px; line-height: 1.45; }
.buy-go { width: 100%; margin-bottom: 8px; }
.buy-later { width: 100%; }

/* ===== Small-screen "best on desktop" notice (shown once per session via app.js on narrow viewports) ===== */
.mobile-notice { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center; padding: 22px; background: rgba(10, 16, 38, 0.55); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.mobile-notice[hidden] { display: none; }
.mobile-notice-card { background: var(--surface, #fff); border: 1px solid var(--border, #e3e9f5); border-radius: 16px; max-width: 360px; width: 100%; padding: 26px 22px; text-align: center; box-shadow: 0 18px 50px rgba(10, 16, 38, 0.28); }
.mobile-notice-card .mn-emoji { font-size: 40px; line-height: 1; margin-bottom: 10px; }
.mobile-notice-card h2 { font-family: var(--font-head, inherit); font-size: 19px; margin: 0 0 8px; color: var(--ink, #0f1729); }
.mobile-notice-card p { font-size: 14px; line-height: 1.5; color: var(--muted, #56607a); margin: 0 0 18px; }
.mn-dismiss { font: inherit; font-size: 13.5px; font-weight: 600; padding: 11px 16px; border-radius: 10px; border: 1px solid var(--border-strong, #d0d9ee); background: var(--bg, #f5f8ff); color: var(--ink, #0f1729); cursor: pointer; width: 100%; }
.mn-dismiss:hover { border-color: var(--accent, #2563eb); color: var(--accent-2, #1d4ed8); }

/* ===== Free-beta launch: hide pricing/checkout entry points (logic kept; re-enable by removing these) ===== */
#tab-btn-pricing,
#credit-pill,
#acct-topup,
#tab-pricing .price-card,
#buy-modal-go { display: none !important; }
/* Beta banner in the Home hero */
.beta-banner { display: inline-flex; align-items: center; gap: 8px; margin: 0 auto 14px; padding: 8px 16px; border-radius: 999px; background: var(--accent-weak, #eaf0ff); border: 1px solid var(--accent, #2563eb); color: var(--accent-2, #1d4ed8); font: 600 13.5px var(--font); }
.beta-banner strong { font-weight: 800; }
/* Non-prominent footer disclaimer */
.foot-disclaimer { margin-top: 6px; font-size: 11.5px; color: var(--muted, #56607a); opacity: 0.85; }

/* ===== Beta feedback: floating button + free-text popup ===== */
.feedback-fab { position: fixed; right: 16px; bottom: 16px; z-index: 60; border: 1px solid var(--border-strong, #d0d9ee); background: var(--surface, #fff); color: var(--ink, #0f1729); font: 600 13px var(--font); padding: 9px 14px; border-radius: 999px; cursor: pointer; box-shadow: 0 6px 18px rgba(15,23,41,.12); }
.feedback-fab:hover { border-color: var(--accent, #2563eb); color: var(--accent-2, #1d4ed8); }
.feedback-modal { position: fixed; inset: 0; z-index: 10001; display: flex; align-items: center; justify-content: center; padding: 22px; background: rgba(10,16,38,.55); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.feedback-modal[hidden] { display: none; }
.feedback-card { position: relative; background: var(--surface, #fff); border: 1px solid var(--border, #e3e9f5); border-radius: 16px; max-width: 440px; width: 100%; padding: 24px 22px; box-shadow: 0 18px 50px rgba(10,16,38,.28); }
.feedback-card h3 { font-family: var(--font-head, inherit); font-size: 18px; margin: 0 0 6px; color: var(--ink, #0f1729); }
.feedback-card .fb-sub { font-size: 13px; line-height: 1.5; color: var(--muted, #56607a); margin: 0 0 14px; }
.feedback-card textarea { width: 100%; box-sizing: border-box; resize: vertical; font: inherit; font-size: 14px; padding: 11px 12px; border: 1px solid var(--border-strong, #d0d9ee); border-radius: 10px; background: var(--bg, #f5f8ff); color: var(--ink, #0f1729); }
.feedback-card textarea:focus { outline: none; border-color: var(--accent, #2563eb); }
.fb-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.fb-x { position: absolute; top: 10px; right: 12px; border: none; background: transparent; font-size: 20px; line-height: 1; color: var(--muted, #56607a); cursor: pointer; }
.fb-thanks { margin-top: 12px; font-size: 14px; font-weight: 600; color: var(--ok, #1d9e75); }

/* Quick-read toggle (Builder) — 4 short modules, minimal text, ~2-min build */
.quick-toggle { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600;
  color: var(--ink-soft); border: 1px solid var(--border-strong); border-radius: 10px; padding: 9px 13px;
  cursor: pointer; user-select: none; background: var(--surface); }
.quick-toggle:hover { border-color: var(--accent); color: var(--accent-2); }
.quick-toggle:has(input:checked) { border-color: var(--accent); background: var(--accent-weak); color: var(--accent-2); }
.quick-toggle input { accent-color: var(--accent); }
