/* =============================================================
   Advaslearning Hub — Python/python_styles.css
   Python-only styles — loaded by:
     • python.html               (course landing page)
     • Python/level-<N>/L<N>-<NN>-*.html      (core lessons)
     • Python/Optional/<module>/*.html        (optional modules)

   Always loaded **after** the shared root styles.css so its rules
   override and extend it. Tokens like --accent / --accent-soft /
   --accent-dark are defined per level by `.level--<N>` in styles.css.
   ============================================================= */

/* ---------- 1. Lesson card → clickable overlay link ----------
   Pattern: keep <li class="lesson-card"> on the python.html grid,
   add an absolutely-positioned <a class="lesson-card__link"> inside
   so the entire card is one big tap target. Accessible labels are
   provided by the card's <h3> title (read by screen readers via
   aria-label on the link).
   --------------------------------------------------------------- */
.lesson-card { position: relative; }
.lesson-card__link {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  text-decoration: none;
  color: inherit;
  z-index: 2;
}
.lesson-card__link:hover { text-decoration: none; }
.lesson-card__link:focus-visible {
  outline: 3px solid var(--accent, var(--brand));
  outline-offset: 2px;
}
/* Inline links inside a card (rare) sit above the overlay */
.lesson-card a:not(.lesson-card__link) {
  position: relative;
  z-index: 3;
}

/* ---------- 2. Lesson page (single-lesson view) ---------- */
.lesson-page { background: var(--bg); }

.lesson-hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(900px 320px at 80% -120px,
      color-mix(in srgb, var(--accent, var(--brand)) 22%, transparent), transparent 60%),
    radial-gradient(800px 320px at 0% 110%,
      color-mix(in srgb, var(--accent, var(--brand)) 14%, transparent), transparent 60%),
    linear-gradient(180deg, #FFFFFF 0%,
      var(--accent-soft, var(--brand-soft)) 100%);
}
.lesson-hero__inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 56px 24px 44px;
}
.lesson-hero__crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-dark, var(--brand-deep));
  margin: 0 0 14px;
}
.lesson-hero__crumbs a {
  color: var(--accent-dark, var(--brand-deep));
  text-decoration: none;
}
.lesson-hero__crumbs a:hover { text-decoration: underline; }
.lesson-hero__crumbs .sep  { color: var(--muted); }
.lesson-hero__crumbs .here { color: var(--muted); font-weight: 600; }

.lesson-hero__num {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--accent, var(--brand));
  color: #fff;
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 16px;
}
.lesson-hero__title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  margin: 0 0 12px;
  color: var(--ink);
}
.lesson-hero__sub {
  font-size: 1.05rem;
  color: var(--ink-soft);
  max-width: 60ch;
  margin: 0 0 22px;
}
.lesson-hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.lesson-hero__meta-pill {
  background: rgba(255,255,255,0.85);
  border: 1px solid var(--border);
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 6px 12px;
  border-radius: 999px;
}

/* ---------- 3. Lesson body — section blocks ---------- */
.lesson-body {
  max-width: 880px;
  margin: 0 auto;
  padding: 40px 24px 72px;
}

.lesson-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 28px 24px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
  scroll-margin-top: 16px;
}
.lesson-section__head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
  margin-bottom: 18px;
}
.lesson-section__num {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent, var(--brand));
  background: var(--accent-soft, var(--brand-soft));
  padding: 4px 10px;
  border-radius: 999px;
}
.lesson-section__title {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  flex: 1;
  margin: 0;
}
.lesson-section__time {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.lesson-section__body p { margin: 0 0 12px; }
.lesson-section__body p:last-child { margin-bottom: 0; }
.lesson-section__body h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 18px 0 10px;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.lesson-section__body ul:not(.goals) {
  list-style: disc;
  padding-left: 22px;
  margin: 0 0 12px;
  color: var(--ink-soft);
}
.lesson-section__body ul:not(.goals) li { margin-bottom: 4px; }
.lesson-section__body ol:not(.setup-steps) {
  list-style: decimal;
  padding-left: 22px;
  margin: 0 0 12px;
  color: var(--ink-soft);
}
.lesson-section__body ol:not(.setup-steps) li { margin-bottom: 6px; }

/* Learning-goals tick list */
.goals { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.goals li {
  position: relative;
  padding: 12px 14px 12px 46px;
  background: var(--accent-soft, var(--brand-soft));
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-weight: 500;
}
.goals li::before {
  content: "\2713";
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  width: 22px; height: 22px;
  border-radius: 999px;
  background: var(--accent, var(--brand));
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ---------- 4. Code blocks ---------- */
pre.code-block {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  background: var(--code-bg);
  color: var(--code-ink);
  border-radius: var(--radius);
  padding: 16px 18px;
  overflow-x: auto;
  line-height: 1.6;
  margin: 12px 0;
}
pre.code-block .out { color: #94A3B8; }

/* Python code blocks — VS Code Dark+ palette on black background */
pre.code-block--py {
  background: #000000;
  color: #d4d4d4;
  border: 1px solid #2d2d2d;
}
pre.code-block--py .py-kw      { color: #569cd6; }                       /* keywords */
pre.code-block--py .py-builtin { color: #4ec9b0; }                       /* built-ins */
pre.code-block--py .py-fn      { color: #dcdcaa; }                       /* function names */
pre.code-block--py .py-name    { color: #9cdcfe; }                       /* user identifiers */
pre.code-block--py .py-string  { color: #ce9178; }                       /* strings */
pre.code-block--py .py-number  { color: #b5cea8; }                       /* numbers */
pre.code-block--py .py-comment { color: #6a9955; font-style: italic; }   /* comments */
pre.code-block--py .py-op      { color: #d4d4d4; }                       /* operators / punctuation */

pre.code-block--output {
  background: #111827;
  color: #FBBF24;
  border-left: 4px solid var(--game-2);
}

.code-block-label {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 14px 0 4px !important;
}

.lesson-body code {
  background: #F1F5F9;
  color: var(--ink);
  font-size: 0.86em;
}

/* ---------- 5. Callouts ---------- */
.callout {
  border-left: 4px solid var(--accent, var(--brand));
  background: var(--accent-soft, var(--brand-soft));
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  margin: 14px 0;
}
.callout strong {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-dark, var(--brand-deep));
  margin-bottom: 4px;
}
.callout p:last-child { margin-bottom: 0; }

/* ---------- 6. Try-It-Yourself exercises ---------- */
.exercise {
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  margin: 12px 0;
  background: #FAFBFE;
}
.exercise__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-weight: 700;
  color: var(--ink);
}
.exercise__num {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--accent, var(--brand));
  color: #fff;
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.04em;
}
.exercise details { margin-top: 8px; }
.exercise summary {
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--accent-dark, var(--brand-deep));
  font-weight: 600;
  user-select: none;
}
.exercise summary:hover { text-decoration: underline; }
.exercise[open] summary { margin-bottom: 6px; }

/* ---------- 6b. Setup prelude (one-time install steps) ---------- */
.lesson-section--setup {
  background: linear-gradient(180deg, var(--brand-soft) 0%, var(--surface) 80%);
  border-color: color-mix(in srgb, var(--brand) 25%, var(--border));
}
.lesson-section--setup .lesson-section__num {
  background: var(--brand);
  color: #fff;
}

.setup-paths {
  display: grid;
  gap: 18px;
  margin: 14px 0 6px;
}
.setup-path {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.setup-path__tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--brand);
  color: #fff;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.setup-path--online .setup-path__tag {
  background: var(--accent, var(--brand));
}
.setup-path h3 {
  margin: 0 0 4px !important;
  font-size: 1.1rem !important;
}
.setup-path__lede {
  margin: 0 0 12px !important;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.setup-steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}
.setup-steps > li {
  position: relative;
  padding: 12px 14px 12px 56px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  counter-increment: step;
  color: var(--ink-soft);
}
.setup-steps > li::before {
  content: counter(step);
  position: absolute;
  left: 14px; top: 14px;
  width: 28px; height: 28px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.setup-steps > li strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-weight: 700;
}
.setup-steps ul {
  list-style: disc;
  padding-left: 20px;
  margin: 6px 0 0;
}
.setup-steps ul li { margin-bottom: 2px; }
.setup-steps a { color: var(--brand-deep); font-weight: 600; }

/* ---------- 6c. Homework answer gate (every Python lesson) ---------- */
.homework-gate {
  margin-top: 18px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px dashed var(--game-border);
  border-radius: var(--radius);
}
.homework-gate__btn {
  font: inherit;
  font-weight: 700;
  background: linear-gradient(135deg, var(--game-1) 0%, var(--game-2) 100%);
  color: #fff;
  border: 0;
  padding: 10px 20px;
  border-radius: 999px;
  cursor: pointer;
  letter-spacing: -0.005em;
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.homework-gate__btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  filter: brightness(1.05);
}
.homework-gate__btn:focus-visible {
  outline: 3px solid var(--game-2);
  outline-offset: 2px;
}

.homework-gate__form { margin: 0; }
.homework-gate__label {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--ink);
  margin-bottom: 8px;
}
.homework-gate__row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.homework-gate__row input {
  flex: 1;
  min-width: 200px;
  padding: 10px 14px;
  font: inherit;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: 0;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.homework-gate__row input:focus {
  border-color: var(--game-2);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--game-2) 25%, transparent);
}
.homework-gate__submit {
  font: inherit;
  font-weight: 700;
  background: var(--game-2);
  color: #fff;
  border: 0;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: filter .15s ease;
}
.homework-gate__submit:hover { filter: brightness(1.08); }

.homework-gate__error {
  margin: 8px 0 0 !important;
  color: var(--challenge-1);
  font-size: 0.9rem;
  font-weight: 600;
}

.homework-gate__answer {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-top: 12px;
}
.homework-gate__answer h3 {
  margin: 0 0 8px !important;
  font-size: 1rem !important;
  color: var(--game-2);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}
.homework-gate__answer p:last-child { margin-bottom: 0; }
.homework-gate__hint {
  display: block;
  margin-top: 8px;
  font-size: 0.86rem;
  color: var(--muted);
  font-style: italic;
}

/* Note: print rules for the homework gate live in the consolidated
   @media print block at the end of this file. */

/* ---------- 7. Mini-challenge & homework variants ---------- */
.lesson-section--challenge {
  background: linear-gradient(180deg, var(--challenge-soft) 0%, var(--surface) 80%);
  border-color: var(--challenge-border);
}
.lesson-section--challenge .lesson-section__num {
  background: #fff;
  color: var(--challenge-1);
}
.lesson-section--homework {
  background: linear-gradient(180deg, var(--game-soft) 0%, var(--surface) 80%);
  border-color: var(--game-border);
}
.lesson-section--homework .lesson-section__num {
  background: #fff;
  color: var(--game-2);
}

/* ---------- 8. Vocabulary card ---------- */
.vocab-card {
  background: var(--accent-soft, var(--brand-soft));
  border: 1px solid color-mix(in srgb, var(--accent, var(--brand)) 35%, var(--border));
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 14px 0;
}
.vocab-card h4 {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-dark, var(--brand-deep));
  margin: 0 0 10px;
}
.vocab-card dl { margin: 0; display: grid; gap: 10px; }
.vocab-card dt {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--ink);
}
.vocab-card dd {
  margin: 2px 0 0;
  color: var(--ink-soft);
  font-size: 0.94rem;
}

/* ---------- 9. Lesson foot — prev / next ---------- */
.lesson-foot {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 24px;
}
.lesson-foot__btn {
  flex: 1;
  min-width: 220px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
  display: block;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.lesson-foot__btn:hover {
  transform: translateY(-2px);
  border-color: var(--accent, var(--brand));
  box-shadow: var(--shadow);
  text-decoration: none;
}
.lesson-foot__btn[aria-disabled="true"] {
  opacity: 0.55;
  pointer-events: none;
}
.lesson-foot__dir {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.lesson-foot__title {
  display: block;
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
}
.lesson-foot__btn--next { text-align: right; }

/* ---------- 10. Responsive ---------- */
@media (max-width: 720px) {
  .lesson-hero__inner    { padding: 44px 20px 32px; }
  .lesson-body           { padding: 28px 16px 56px; }
  .lesson-section        { padding: 22px 18px 18px; }
  .lesson-section__head  { gap: 8px; }
  .lesson-section__title { font-size: 1.15rem; }
  .lesson-foot           { flex-direction: column; }
  .lesson-foot__btn--next { text-align: left; }
}

/* ============================================================
   Assessment runner (PY-L1-assessment)
   Class prefix: .as-*  (BEM modifiers used: --lg, --ghost, --danger)
   Uses --accent / --accent-dark / --accent-soft from .level--1.
   ============================================================ */

.hide { display: none !important; }

.as-wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 22px 80px;
}

/* ---------- Sticky top bar ---------- */
.as-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 22px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #E2E8F0;
  box-shadow: 0 2px 10px -8px rgba(15, 23, 42, 0.18);
}
.as-bar__title {
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--accent-dark, var(--brand-deep));
}
.as-bar__progress {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.88rem;
  color: #475569;
}
.as-bar__timer {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent-dark, var(--brand-deep));
  background: var(--accent-soft, var(--brand-soft));
  padding: 5px 12px;
  border-radius: 6px;
  letter-spacing: 0.04em;
}

/* ---------- Card ---------- */
.as-card {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  padding: 28px;
  margin-bottom: 20px;
  position: relative;
}
.as-card h2 {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0 0 14px;
  color: var(--accent-dark, var(--brand-deep));
}
.as-card h3 {
  font-size: 1.02rem;
  font-weight: 700;
  margin: 18px 0 8px;
  color: var(--accent-dark, var(--brand-deep));
}
.as-card p  { font-size: 0.95rem; }
.as-card ul { padding-left: 22px; }
.as-card ul li { margin-bottom: 6px; font-size: 0.95rem; }

/* ---------- Welcome-card table ---------- */
.as-table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 0.92rem;
}
.as-table th,
.as-table td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid #E2E8F0;
}
.as-table thead th {
  background: var(--accent-soft, var(--brand-soft));
  color: var(--accent-dark, var(--brand-deep));
  font-weight: 700;
}
.as-table tbody th { background: #F8FAFC; }

/* ---------- Grade pills on welcome card ---------- */
.as-grades {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.as-grade {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
  background: #F1F5F9;
  color: #334155;
}
.as-grade--dist { background: #FEF3C7; color: #92400E; }
.as-grade--pass { background: #DCFCE7; color: #166534; }
.as-grade--fail { background: #FEE2E2; color: #991B1B; }

/* ---------- Buttons ---------- */
.as-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, transform .15s ease, border-color .15s ease;
  user-select: none;
  background: var(--accent, var(--brand));
  color: #fff;
  line-height: 1.2;
}
.as-btn:hover { transform: translateY(-1px); background: var(--accent-dark, var(--brand-deep)); }
.as-btn--lg     { padding: 14px 26px; font-size: 1rem; }
.as-btn--ghost  { background: #fff; color: var(--accent-dark, var(--brand-deep)); border-color: #CBD5E1; }
.as-btn--ghost:hover { background: #fff; border-color: var(--accent, var(--brand)); color: var(--accent, var(--brand)); }
.as-btn--danger { background: #B45309; }
.as-btn--danger:hover { background: #92400E; }
.as-btn:disabled { opacity: 0.45; pointer-events: none; }

/* ---------- Navigation row ---------- */
.as-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.as-nav__right { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Review grid ---------- */
.as-review-section { margin-bottom: 18px; }
.as-review-section h3 { margin-bottom: 8px; }
.as-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
  gap: 8px;
}
.as-grid > button {
  height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  background: #FEF3C7;
  color: #92400E;
  transition: transform .12s ease, border-color .12s ease;
}
.as-grid > button.answered { background: #DCFCE7; color: #166534; }
.as-grid > button:hover    { transform: translateY(-1px); border-color: var(--accent, var(--brand)); }

/* ---------- Results header / badge ---------- */
.as-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.as-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: 999px;
  background: #E2E8F0;
  color: #334155;
}
.as-badge--pending     { background: #E2E8F0; color: #475569; }
.as-badge--pass        { background: #DCFCE7; color: #166534; }
.as-badge--distinction { background: #FEF3C7; color: #92400E; }
.as-badge--fail        { background: #FEE2E2; color: #991B1B; }

/* ---------- Teacher banner ---------- */
.as-teacher-banner {
  background: #FEF3C7;
  border-left: 4px solid #FBBF24;
  padding: 14px 18px;
  border-radius: 10px;
  margin: 14px 0 18px;
  font-size: 0.92rem;
  color: #78350F;
}

/* ---------- Modal ---------- */
.as-modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.as-modal-bg.hide { display: none; }
.as-modal {
  background: #fff;
  border-radius: 14px;
  padding: 24px 26px;
  max-width: 460px;
  width: 100%;
  box-shadow: 0 24px 48px -16px rgba(15, 23, 42, 0.35);
}
.as-modal h3 { margin: 0 0 8px; font-size: 1.1rem; color: var(--accent-dark, var(--brand-deep)); }
.as-modal p  { margin: 0 0 18px; font-size: 0.95rem; color: #475569; }
.as-modal__actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Runner-emitted classes ---------- */
.as-q-banner {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
  background: #E2E8F0;
  color: #334155;
}
.as-q-banner.A { background: #DBEAFE; color: #1E40AF; }
.as-q-banner.B { background: var(--accent-soft, #DCFCE7); color: var(--accent-dark, #166534); }
.as-q-banner.C { background: #FCE7F3; color: #9D174D; }
.as-q-title { margin: 0 0 10px; font-size: 1.1rem; font-weight: 700; color: var(--accent-dark, var(--brand-deep)); }
.as-q-stem  { margin: 0 0 14px; font-size: 0.98rem; color: #1E293B; }
.as-q-stem code,
.as-q-title code {
  background: #F1F5F9;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.86em;
}

.as-opts { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 4px; }
.as-opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  cursor: pointer;
  background: #FAFCFD;
  font-size: 0.95rem;
  line-height: 1.5;
  transition: border-color .12s ease, background .12s ease;
}
.as-opt:hover { border-color: var(--accent, var(--brand)); background: #fff; }
.as-opt input[type="radio"] { margin-top: 3px; accent-color: var(--accent, var(--brand)); }
.as-opt:has(input:checked) { border-color: var(--accent, var(--brand)); background: var(--accent-soft, var(--brand-soft)); }

/* IDLE-style answer textarea — white bg, Courier-family monospace, 4-space tabs */
.as-textarea {
  display: block;
  width: 100%;
  min-height: 340px;
  margin-top: 10px;
  padding: 14px 16px;
  border: 1px solid #94A3B8;
  border-radius: 6px;
  background: #FFFFFF;
  color: #000000;
  font-family: 'Courier New', 'Consolas', 'Cascadia Code', 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.95rem;
  line-height: 1.5;
  resize: vertical;
  box-sizing: border-box;
  tab-size: 4;
  -moz-tab-size: 4;
  caret-color: #0EA5E9;
  white-space: pre;
  overflow: auto;
}
.as-textarea::placeholder { color: #94A3B8; font-style: italic; }
.as-textarea:focus {
  outline: 2px solid var(--accent, var(--brand));
  outline-offset: -1px;
  border-color: var(--accent, var(--brand));
}

/* "Run in any IDE first" hint above the answer box */
.as-note {
  margin: 14px 0 8px;
  padding: 10px 14px;
  background: #FEF9C3;
  border-left: 4px solid #EAB308;
  border-radius: 6px;
  color: #713F12;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Expected-output reference block (Part B + C) */
.as-example {
  margin: 14px 0;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  overflow: hidden;
  background: #F8FAFC;
}
.as-example__label {
  background: #1E293B;
  color: #FBBF24;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 12px;
}
.as-example pre {
  margin: 0;
  padding: 12px 14px;
  background: #FFFFFF;
  color: #0F172A;
  font-family: 'Courier New', 'Consolas', 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre;
  overflow-x: auto;
}

/* Broken-code reference shown above the answer textarea (Part B debug items).
   Deliberately plain — no syntax highlighting, no dark theme — so the bug
   isn't given away by styling. Matches the IDLE-style answer textarea so the
   student sees both blocks as the same "raw editor" surface. */
.as-code {
  background: #FFFFFF;
  color: #000000;
  padding: 14px 16px;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  font-family: 'Courier New', 'Consolas', 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.92rem;
  line-height: 1.5;
  overflow-x: auto;
  margin: 12px 0;
  white-space: pre;
  tab-size: 4;
  -moz-tab-size: 4;
}
.as-code code {
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  padding: 0;
}

/* Part A per-question result rows */
.as-result-row {
  display: grid;
  grid-template-columns: 32px 1fr 28px;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  margin-bottom: 8px;
  align-items: start;
  background: #fff;
}
.as-result-row--ok  { background: #F0FDF4; border-color: #BBF7D0; }
.as-result-row--bad { background: #FEF2F2; border-color: #FECACA; }
.as-result-num { font-family: 'JetBrains Mono', ui-monospace, monospace; font-weight: 700; color: #475569; }
.as-result-q p { margin: 0 0 4px; font-size: 0.92rem; }
.as-result-line { color: #475569; font-size: 0.9rem; }
.as-result-line--ok { color: #166534; }
.as-result-mark { text-align: right; font-size: 1.25rem; font-weight: 700; }
.as-result-row--ok  .as-result-mark { color: #16A34A; }
.as-result-row--bad .as-result-mark { color: #DC2626; }

/* Teacher mark blocks */
.as-mark-block {
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 14px;
  background: #FAFCFD;
}
.as-mark-block h4 { margin: 0 0 8px; font-size: 1rem; color: var(--accent-dark, var(--brand-deep)); }
.as-student-label {
  margin-top: 14px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748B;
}
.as-student-answer {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 12px 14px;
  margin: 6px 0 14px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.86rem;
  line-height: 1.55;
  white-space: pre-wrap;
  max-height: 360px;
  overflow: auto;
  color: #0F172A;
}

/* ---------- Scratch file uploads (.sb3 + screenshot) ---------- */
.as-uploads {
  display: grid;
  gap: 12px;
  margin: 12px 0 4px;
}
.as-upload {
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  padding: 12px 14px;
  background: #F8FAFC;
}
.as-upload__head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.as-upload__label { font-weight: 600; color: #0F172A; }
.as-upload__badge {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.8rem;
  color: #166534;
  background: #DCFCE7;
  border: 1px solid #86EFAC;
  border-radius: 999px;
  padding: 2px 10px;
}
.as-upload__hint { margin: 4px 0 8px; font-size: 0.84rem; color: #64748B; line-height: 1.45; }
.as-upload__row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.as-upload__input { font-size: 0.86rem; max-width: 100%; }
.as-upload__status { font-size: 0.84rem; color: var(--accent, var(--brand)); }
.as-upload__error { margin: 8px 0 0; font-size: 0.84rem; color: #B91C1C; }
.as-btn--sm { padding: 4px 12px; font-size: 0.82rem; }
.as-notes-label { display: block; margin-top: 14px; font-weight: 600; color: #0F172A; }

/* ---------- Submitted-file download links (mark + record views) ---------- */
.as-student-files { margin: 0 0 14px; font-size: 0.9rem; }
.as-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.as-files__empty { margin: 6px 0 0; font-size: 0.85rem; color: #94A3B8; }
.as-file-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid #CBD5E1;
  border-radius: 999px;
  background: #fff;
  color: var(--accent-dark, var(--brand-deep));
  font-size: 0.84rem;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  text-decoration: none;
}
.as-file-link:hover { border-color: var(--accent, var(--brand)); background: #F1F5F9; }

.as-rubric {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px dashed #CBD5E1;
}
.as-rubric-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  background: #fff;
  border-radius: 8px;
  font-size: 0.9rem;
}
.as-rubric-label { color: #1E293B; flex: 1; }
.as-rubric-input {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #475569;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.as-rubric-input input {
  width: 56px;
  padding: 6px 8px;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.92rem;
  text-align: center;
}
.as-rubric-input input:focus { outline: 2px solid var(--accent, var(--brand)); }
.as-rubric-max { color: #94A3B8; }

/* Final-row strip */
.as-final-rows {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 12px 0;
}
.as-final-rows > div {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 14px 16px;
  text-align: center;
}
.as-final-rows .big {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent-dark, var(--brand-deep));
  line-height: 1.1;
}
.as-final-rows .lbl {
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748B;
  margin-top: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.as-final-rows .grand {
  background: var(--accent-soft, var(--brand-soft));
  border-color: var(--accent, var(--brand));
}

/* Small-screen tweaks */
@media (max-width: 600px) {
  .as-wrap { padding: 18px 14px 60px; }
  .as-card { padding: 20px 18px; }
  .as-bar  { padding: 10px 14px; }
  .as-nav  { flex-direction: column-reverse; align-items: stretch; }
  .as-nav .as-btn { width: 100%; justify-content: center; }
  .as-rubric-row  { flex-direction: column; align-items: flex-start; }
}

/* ============================================================
   Consolidated print rules — lesson pages AND assessment
   ============================================================ */
@media print {
  /* Lesson-page rules (was §10) */
  .lesson-hero      { background: #fff !important; }
  .lesson-section   { box-shadow: none; break-inside: avoid; }
  .lesson-foot,
  .topnav-back      { display: none; }
  pre.code-block,
  pre.code-block--output {
    background: #f5f5f5 !important;
    color: #000 !important;
    border: 1px solid #ddd !important;
  }
  pre.code-block .out { color: #555 !important; }

  /* Homework-gate (was §6c) — answer keys are printed separately by the teacher */
  .homework-gate { display: none !important; }

  /* Assessment runner — only the results screen survives to give the teacher a clean PDF record */
  .topnav, .site-footer,
  .as-bar, .as-nav,
  #screen-start, #screen-q, #screen-review { display: none !important; }
  .as-modal-bg { display: none !important; }
  .as-card     { border-color: #94A3B8; break-inside: avoid; }
  .as-wrap     { padding: 0; }
}
