/* ==================================================================== */
/* Claude Code Onboarding Lab -- base stylesheet                        */
/* Mobile-first: base rules target 360px width; min-width media queries */
/* progressively enhance for tablet/desktop. Plain CSS, no framework.   */
/*                                                                      */
/* Visual design ported from the "Visual Novel" design system           */
/* (https://raw.githubusercontent.com/GGPrompts/ggprompts/main/styles/  */
/* visual-novel.html): colors, typography, spacing scale, and component */
/* styles (cards, buttons/choices, badges, inputs). Deliberately NOT    */
/* ported: the animated bokeh/petal background and the dating-sim       */
/* content (affection meters, character cards, Japanese type) -- those  */
/* are decorative/thematic, not part of "colors, typography, spacing,   */
/* component styles", and would be tonally off for a training app.      */
/* ==================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Cinzel:wght@500;600;700&family=Quicksand:wght@400;500;600;700&display=swap");

/* --- tokens --- */
:root {
  /* Palette (ported from the reference system's CSS variables of the
     same intent -- kept these exact names so the rest of this file, and
     every view/lab file that touches inline style via CSS classes only,
     needed zero markup changes). */
  --color-bg: #1a1a2e; /* midnight */
  --color-bg-mid: #221b3a;
  --color-bg-deep: #2d1b4e;
  --color-surface: #23264a; /* a lighter-than-bg panel tone -- stands in for the
                                reference's blurred glass panels; blur alone does
                                nothing useful over a flat background, so this
                                app uses solid, slightly-lighter surfaces instead. */
  --color-surface-hover: #2b2f5c;
  --color-surface-2: #16213e; /* dusk -- header / dialog-style panels */
  --color-text: #f5f0e6; /* cream / moonlight */
  --color-text-muted: rgba(245, 240, 230, 0.64);
  --color-primary: #ff6b9d; /* rose -- primary interactive accent */
  --color-primary-2: #ffb7c5; /* sakura -- secondary accent, used in gradients */
  --color-primary-contrast: #1a1a2e;
  --color-lavender: #c8a2c8;
  --color-sky: #87ceeb;
  --color-gold: #d4af37;
  --color-success: #7fd8a0;
  --color-danger: #e94560; /* crimson */
  --color-border: rgba(255, 183, 197, 0.28);
  --color-border-strong: rgba(255, 183, 197, 0.55);
  --color-focus: #ff6b9d;

  --glow-primary: 0 0 18px rgba(255, 107, 157, 0.4);
  --glow-primary-soft: 0 0 14px rgba(255, 183, 197, 0.28);
  --gradient-accent: linear-gradient(135deg, var(--color-primary-2) 0%, var(--color-lavender) 100%);
  --gradient-accent-strong: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-2) 100%);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --font-sans: "Quicksand", system-ui, -apple-system, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  --font-display: "Cinzel", Georgia, "Times New Roman", serif;
  --font-size-base: 16px;

  --max-content-width: 720px;
}

/* --- reset / base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  /* Guard against any accidental overflow breaking the 360px layout. */
  max-width: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: 1.5;
  color: var(--color-text);
  background: linear-gradient(
    180deg,
    var(--color-bg) 0%,
    var(--color-bg-mid) 55%,
    var(--color-bg-deep) 100%
  );
  background-attachment: fixed;
  -webkit-text-size-adjust: 100%;
}

img,
svg {
  max-width: 100%;
  display: block;
}

a {
  color: var(--color-primary-2);
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  letter-spacing: 0.02em;
  color: var(--color-text);
}

h1,
h2,
h3,
p {
  margin: 0 0 var(--space-4) 0;
}

button {
  font: inherit;
}

/* --- focus visibility --- */
/* Never remove the native outline without an equally visible replacement.
   :focus-visible layers an extra, higher-contrast ring on top for
   keyboard users without adding a ring on mouse clicks. */
a:focus,
button:focus,
[tabindex]:focus {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

/* --- header --- */
#app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(22, 33, 62, 0.92);
  border-bottom: 1px solid var(--color-border);
}

.header-inner {
  max-width: var(--max-content-width);
  margin: 0 auto;
  padding: var(--space-3) var(--space-4);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
}

.course-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.05em;
  white-space: nowrap;
  color: var(--color-primary-2);
  text-shadow: 0 0 12px rgba(255, 183, 197, 0.35);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

/* --- nav badges --- */
/* The home link, the current-view indicator, and every "back/exit" link
   across the app (module-view.js's own back-to-modules-link, and each lab
   engine's own lab-exit-link/pb-back-link) share one pill-badge treatment,
   ported from the reference design's Badges & Indicators component --
   previously these were bare, unstyled <a> text links. */
.home-link,
.back-to-modules-link,
.lab-exit-link,
.pb-back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px var(--space-3);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  background: rgba(255, 107, 157, 0.12);
  border: 1px solid rgba(255, 107, 157, 0.35);
  color: var(--color-primary-2);
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.home-link:hover,
.back-to-modules-link:hover,
.lab-exit-link:hover,
.pb-back-link:hover {
  background: rgba(255, 107, 157, 0.22);
  border-color: var(--color-primary);
  box-shadow: var(--glow-primary-soft);
}

.back-to-modules-link,
.lab-exit-link,
.pb-back-link {
  margin-bottom: var(--space-3);
}

.crumb-sep {
  color: var(--color-border-strong);
  font-size: 0.75rem;
}

#current-view-label {
  display: inline-flex;
  align-items: center;
  padding: 3px var(--space-3);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--color-text-muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.overall-progress {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  min-height: 1em;
}

.saved-indicator {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-primary-2);
  letter-spacing: 0.03em;
}

.saved-indicator[hidden] {
  display: none;
}

/* --- header reset control --- */
/* The landing page has always had its own "Reset my progress" button, but
   it sits below the full 12-module list -- easy to miss and only reachable
   from "/". This mirrors it in the persistent header (built once in
   app.js, so it's present on every route) using the same muted/ghost
   treatment as .reset-progress-btn, just sized to sit inline with the
   other header chrome. */
.header-reset-btn {
  display: inline-flex;
  align-items: center;
  padding: 3px var(--space-3);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.header-reset-btn:hover {
  border-color: var(--color-danger);
  color: var(--color-danger);
}

/* --- header profile switcher --- */
/* Same ghost-pill treatment as .header-reset-btn, so the two read as a
   pair, but hovers toward the primary accent instead of danger -- this
   one isn't a destructive action, just "show me the picker again". */
.header-profile-btn {
  display: inline-flex;
  align-items: center;
  padding: 3px var(--space-3);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.header-profile-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary-2);
}

/* --- main --- */
#app-main {
  max-width: var(--max-content-width);
  margin: 0 auto;
  padding: var(--space-5) var(--space-4) var(--space-6);
  min-height: 60vh;
}

/* --- access gate --- */
/* Soft deterrent, not real auth (see app.js's GATE_PASSWORD comment) --
   styled to match the app's own design system so it doesn't look like a
   bolted-on afterthought. */
.gate {
  max-width: 420px;
  margin: var(--space-7) auto 0;
  padding: var(--space-6) var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  text-align: center;
}

.gate-title {
  font-size: 1.3rem;
  margin-bottom: var(--space-3);
}

.gate-intro {
  color: var(--color-text-muted);
  margin-bottom: var(--space-5);
}

.gate-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  text-align: left;
}

.gate-label {
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-primary-2);
}

.gate-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: var(--space-3);
  background: var(--color-surface-2);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font: inherit;
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.gate-input:focus {
  border-color: var(--color-primary);
  box-shadow: var(--glow-primary-soft);
}

.gate-submit {
  background: var(--gradient-accent-strong);
  color: var(--color-primary-contrast);
  border: none;
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-5);
  font-weight: 700;
  cursor: pointer;
  transition: box-shadow 0.2s ease, transform 0.15s ease;
}

.gate-submit:hover {
  box-shadow: var(--glow-primary);
  transform: translateY(-1px);
}

.gate-error {
  margin: 0;
  color: var(--color-danger);
  font-size: 0.9rem;
}

/* --- profile picker --- */
/* Reuses .gate for the outer card (same soft-deterrent-styled panel as the
   passphrase gate) -- just its own choice-button list underneath. */
.profile-choices {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.profile-choice {
  background: var(--gradient-accent-strong);
  color: var(--color-primary-contrast);
  border: none;
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-5);
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: box-shadow 0.2s ease, transform 0.15s ease;
}

.profile-choice:hover {
  box-shadow: var(--glow-primary);
  transform: translateY(-1px);
}

/* --- scroll-to-top --- */
.scroll-to-top {
  position: fixed;
  right: var(--space-4);
  bottom: var(--space-4);
  z-index: 20;
  background: var(--gradient-accent-strong);
  color: var(--color-primary-contrast);
  border: none;
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.scroll-to-top[hidden] {
  display: none;
}

/* --- responsive: tablet+ --- */
@media (min-width: 600px) {
  .header-inner {
    padding: var(--space-3) var(--space-5);
  }

  #app-main {
    padding: var(--space-6) var(--space-5);
  }
}

/* --- responsive: desktop+ --- */
@media (min-width: 900px) {
  :root {
    --max-content-width: 840px;
  }
}

/* --- landing view (WP02) --- */
.module-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.module-card {
  display: block;
  position: relative;
  padding: var(--space-4);
  padding-top: calc(var(--space-4) + 3px);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.module-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-accent);
}

.module-card:hover {
  border-color: var(--color-border-strong);
  transform: translateY(-3px);
  box-shadow: var(--glow-primary-soft), 0 10px 24px rgba(0, 0, 0, 0.35);
}

.module-card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.module-card-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
}

.module-card-summary {
  margin: var(--space-2) 0 0 0;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.status-badge {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px var(--space-3);
  border-radius: 999px;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-text-muted);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.status-badge--in_progress {
  background: rgba(135, 206, 235, 0.16);
  color: var(--color-sky);
  border-color: rgba(135, 206, 235, 0.35);
}

.status-badge--done {
  background: var(--gradient-accent-strong);
  color: var(--color-primary-contrast);
  border-color: transparent;
}

.reset-section {
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-4);
}

.reset-progress-btn {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.reset-progress-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary-2);
}

@media (min-width: 600px) {
  .module-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --- module content: pre-formatted worked examples (WP12 fix, T056) --- */
/* Modules 6/8/10 render <pre> blocks for "worked example" prompt templates.
   <pre> defaults to `white-space: pre`, which does not wrap -- at 360px
   this pushed the block to ~1300px wide and body's overflow-x: hidden
   silently clipped the right side of every line instead of showing it.
   Wrapping (rather than a horizontal scrollbar) keeps these readable on
   narrow screens without hiding content behind a scroll gesture. */
.module-content-body pre {
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: break-word;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  padding-right: calc(var(--space-3) + 28px);
  font-family: "Quicksand", monospace;
  font-size: 0.9rem;
}

/* --- copy-to-clipboard button on every <pre> command/prompt block --- */
/* Command-heavy modules (Yolan's CLI track especially) are full of <pre>
   blocks meant to be copied verbatim into a terminal or a Claude Code
   session -- a small icon button beats manual select-and-copy. */
.code-block-wrapper {
  position: relative;
}

.code-copy-button {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.code-copy-button:hover {
  color: var(--color-primary-2);
  border-color: var(--color-primary);
}

.code-copy-button:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.code-copy-button--copied,
.code-copy-button--copied:hover {
  color: var(--color-success);
  border-color: var(--color-success);
}

/* --- module content: sections, lists, glossary, tables (flow/spacing pass) --- */
/* The design-system port above covered labs, nav, and badges, but never
   reached the actual reading content: <ul>/<li> and <details>/<summary>
   (glossary terms) fell back to bare browser defaults -- near-zero gap
   between list items, and a glossary term sitting almost flush against
   whatever followed it -- and nothing separated one content section from
   the next section or from the lab mounted after it. That's what read as
   "scrunched": a bullet list crowding straight into the next heading, a
   collapsed glossary disclosure crowding straight into the lab's own
   "Exit to all modules" link below it. */
.module-content-section {
  margin-bottom: var(--space-6);
}

.module-content-body ul,
.module-content-body ol {
  margin: 0 0 var(--space-4) 0;
  padding-left: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.module-content-body li {
  line-height: 1.5;
}

.module-content-body code {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: "Quicksand", monospace;
  font-size: 0.9em;
}

.content-diagram {
  margin: var(--space-4) 0;
  border-radius: var(--radius-md);
}

.content-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 var(--space-4) 0;
  font-size: 0.9rem;
}

.content-table th,
.content-table td {
  text-align: left;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
}

.content-table thead th {
  background: var(--color-surface-2);
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--color-primary-2);
}

.content-table tbody th {
  background: var(--color-surface);
  font-weight: 600;
}

.glossary-terms {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.glossary-term {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
}

.glossary-term summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--color-primary-2);
}

.glossary-term[open] summary {
  margin-bottom: var(--space-2);
}

.glossary-term p {
  margin: 0;
  color: var(--color-text-muted);
}

.module-labs {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  margin-top: var(--space-6);
}

/* --- shared "choice button" pattern --- */
/* The look every graded/self-marked option across checklist, match, quiz,
   and spot-mistake shares: a full-width, stacked, generously-padded row
   with a left accent bar and a glow on hover -- ported from the reference
   design system's .choice-btn. This is also the fix for "quizzes are too
   cluttered": before this rule set, quiz/spot-mistake options were raw
   unstyled <label><input type=radio></label> pairs with no spacing, and
   match/checklist had no visual separation between items either. */
.lab-score-banner {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

/* -- checklist -- */
.checklist-lab-list {
  list-style: none;
  margin: 0 0 var(--space-4) 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.checklist-lab-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.checklist-lab-item label {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
}

.checklist-lab-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  accent-color: var(--color-primary);
}

.checklist-lab-complete-note {
  color: var(--color-success);
  font-weight: 600;
}

/* -- quiz & spot-mistake (fieldset-based radio groups) -- */
.quiz-form,
.spot-mistake-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.quiz-item,
.spot-mistake-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  padding: var(--space-4);
  margin: 0;
}

.quiz-item legend,
.spot-mistake-item legend {
  /* A <legend> ignores its <fieldset>'s own padding on the block-start
     edge only (horizontal/bottom padding apply normally) -- by default
     it renders flush against the fieldset's top border so the border
     can "notch" around it. Left unaddressed, multi-line question text
     sits pressed right against the rounded top border with no
     clearance, reading as the text bleeding into the box edge.
     padding-top restores the same visual inset the fieldset already
     gives every other edge. */
  display: block;
  width: 100%;
  box-sizing: border-box;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  padding: var(--space-4) 0 var(--space-3) 0;
  color: var(--color-text);
}

.spot-mistake-item legend {
  /* Chat-snippet text reads better in the body font, not the display
     serif -- only the quiz question benefits from the heading treatment. */
  font-family: var(--font-sans);
  font-weight: 600;
}

.quiz-option,
.spot-mistake-choice {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-2);
  background: var(--color-surface-2);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.quiz-option:last-of-type,
.spot-mistake-choice:last-of-type {
  margin-bottom: 0;
}

.quiz-option:hover,
.spot-mistake-choice:hover {
  border-color: var(--color-border-strong);
  transform: translateX(4px);
  box-shadow: var(--glow-primary-soft);
}

.quiz-option:has(input:checked),
.spot-mistake-choice:has(input:checked) {
  border-color: var(--color-primary);
  box-shadow: var(--glow-primary);
}

.quiz-option input[type="radio"],
.spot-mistake-choice input[type="radio"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--color-primary);
}

.quiz-feedback,
.spot-mistake-feedback,
.match-lab-feedback {
  margin: var(--space-3) 0 0 0;
  font-size: 0.9rem;
  font-weight: 600;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
}

.quiz-feedback.is-correct,
.spot-mistake-feedback.is-correct,
.match-lab-feedback--correct {
  color: var(--color-success);
  background: rgba(127, 216, 160, 0.12);
}

.quiz-feedback.is-incorrect,
.spot-mistake-feedback.is-incorrect,
.match-lab-feedback--incorrect {
  color: var(--color-danger);
  background: rgba(233, 69, 96, 0.14);
}

.quiz-summary,
.spot-mistake-summary {
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--color-primary-2);
}

.quiz-form button[type="submit"],
.spot-mistake-form button[type="submit"],
.quiz-retry,
.spot-mistake-retry {
  align-self: flex-start;
  background: var(--gradient-accent-strong);
  color: var(--color-primary-contrast);
  border: none;
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-5);
  font-weight: 700;
  cursor: pointer;
  transition: box-shadow 0.2s ease, transform 0.15s ease;
}

.quiz-form button[type="submit"]:hover,
.spot-mistake-form button[type="submit"]:hover,
.quiz-retry:hover,
.spot-mistake-retry:hover {
  box-shadow: var(--glow-primary);
  transform: translateY(-1px);
}

/* -- match lab (button-based options) -- */
.match-lab-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.match-lab-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  padding: var(--space-4);
}

.match-lab-prompt {
  font-weight: 600;
  margin-bottom: var(--space-3);
}

.match-lab-visual {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  font-size: 0.85rem;
  white-space: pre-wrap;
  margin: 0 0 var(--space-3) 0;
}

.match-lab-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.match-lab-option {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--color-surface-2);
  color: var(--color-text);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.match-lab-option:hover {
  border-color: var(--color-border-strong);
  transform: translateX(4px);
  box-shadow: var(--glow-primary-soft);
}

.match-lab-option.selected {
  border-color: var(--color-primary);
  box-shadow: var(--glow-primary);
}

/* -- download lab -- */
.download-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.download-list a {
  display: block;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  color: var(--color-text);
  text-decoration: none;
  font-weight: 600;
  transition: border-color 0.2s ease, transform 0.15s ease;
}

.download-lab-list a:hover {
  border-color: var(--color-primary);
  transform: translateX(4px);
}

/* --- prompt builder lab (WP12 fix, T056; restyled) --- */
.prompt-builder-lab {
  margin-top: var(--space-5);
}

.pb-intro {
  color: var(--color-text-muted);
}

/* The module-specific mission (lab.config.task) -- previously the only
   place this lived was inside the Context field's placeholder text,
   which disappears the moment you start typing. Styled distinctly from
   .pb-intro (which only explains the tool's mechanics) so the actual
   task can't be mistaken for another line of generic instructions. */
.pb-mission {
  background: var(--color-surface);
  border-left: 3px solid var(--color-primary);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  margin: 0 0 var(--space-4) 0;
}

.pb-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
}

.pb-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.pb-field-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.pb-field-label {
  display: block;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-primary-2);
}

.pb-field-badge {
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
  color: var(--color-text-muted);
}

.pb-field-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: var(--space-3);
  background: var(--color-surface-2);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font: inherit;
  font-size: 0.95rem;
  resize: vertical;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.pb-field-input:focus {
  border-color: var(--color-primary);
  box-shadow: var(--glow-primary-soft);
}

.pb-preview-pane {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

.pb-missing-hint {
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.pb-preview {
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: break-word;
  font-family: "Quicksand", monospace;
  font-size: 0.9rem;
  margin: 0 0 var(--space-3) 0;
}

.pb-copy-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.pb-copy-button {
  background: var(--gradient-accent-strong);
  color: var(--color-primary-contrast);
  border: none;
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-4);
  font-weight: 700;
  cursor: pointer;
  transition: box-shadow 0.2s ease, transform 0.15s ease;
}

.pb-copy-button:hover {
  box-shadow: var(--glow-primary);
  transform: translateY(-1px);
}

.pb-copy-status {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin: 0;
}

/* "graded: false" means nothing in this app checks whether the built
   prompt is actually good -- there's no backend/AI call here to grade
   free text against. This callout is the answer to "how do I know I
   did a good job": a quick self-check, then an explicit, hard-to-miss
   instruction to get a real second opinion from the AI the prompt is
   actually for. */
.pb-review-callout {
  margin-top: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-gold);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

.pb-review-callout h3 {
  margin: 0 0 var(--space-3) 0;
  color: var(--color-gold);
}

.pb-review-callout p {
  margin: 0 0 var(--space-3) 0;
  color: var(--color-text-muted);
}

.pb-review-callout p:last-child {
  margin-bottom: 0;
}

.pb-review-required {
  color: var(--color-text);
}

.pb-review-required strong {
  color: var(--color-gold);
}

@media (min-width: 900px) {
  .pb-layout {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

/* --- module pager (prev/next module navigation) --- */
/* Added after feedback that reaching the next lesson always required
   going back through the landing view -- module-view.js computes the
   adjacent module(s) from MODULES' existing order and renders this. */
.module-pager {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-border);
}

.module-pager-link {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--color-text);
  min-width: 0;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.module-pager-link:hover {
  border-color: var(--color-primary);
  box-shadow: var(--glow-primary-soft);
  transform: translateY(-2px);
}

.module-pager-link--next {
  text-align: right;
  align-items: flex-end;
}

.module-pager-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-primary-2);
  font-weight: 700;
}

.module-pager-title {
  font-weight: 600;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
