/* ============================================================
   Scratch lesson-page styles
   Loaded alongside the site-wide styles.css.
   Mirrors the structure of arduino/lesson.css so the lesson-builder
   skill can produce Scratch lessons with the same section IDs and
   semantic classes — only the palette and a few block-specific
   tokens differ.
   ============================================================ */

:root {
  --scr:        #F4A21A;   /* Scratch signature orange */
  --scr-soft:   #FFF3D9;
  --scr-dark:   #C9760A;
  --scr-ink:    #3B1F00;

  /* Scratch 3.0 block-category colours — used inside .blk- spans and inline-SVG block fills.
     Primary values quoted from scratch-blocks master/core/colours.js and scratch-gui runtime
     category injection. Edge (tertiary) tokens are the stroke colours scratch-blocks uses
     around each block in the live editor. */
  --blk-motion:         #4C97FF;   /* Motion */
  --blk-motion-edge:    #3373CC;
  --blk-looks:          #9966FF;   /* Looks */
  --blk-looks-edge:     #774DCB;
  --blk-sound:          #D65CD6;   /* Sound (corrected from #CF63CF) */
  --blk-sound-edge:     #A63FA6;
  --blk-events:         #FFD500;   /* Events (corrected from #FFBF00) */
  --blk-events-edge:    #CCAA00;
  --blk-control:        #FFAB19;   /* Control */
  --blk-control-edge:   #CF8B17;
  --blk-sensing:        #5CB1D6;   /* Sensing */
  --blk-sensing-edge:   #2E8EB8;
  --blk-operators:      #59C059;   /* Operators */
  --blk-operators-edge: #389438;
  --blk-variables:      #FF8C1A;   /* Variables */
  --blk-variables-edge: #DB6E00;
  --blk-myblocks:       #FF6680;   /* My Blocks */
  --blk-myblocks-edge:  #FF3355;
  --blk-pen:            #0FBD8C;   /* Pen extension */
  --blk-pen-edge:       #0B8E69;
}

body.lesson {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background: #FFFCF6;
  color: var(--ink, #0F172A);
  margin: 0;
  line-height: 1.55;
}

/* Per-level accent strip — keeps the same level-tinting as Arduino */
body.lesson--level-1 { --lvl: #10B981; --lvl-soft: #E7FBF3; }
body.lesson--level-2 { --lvl: #3B82F6; --lvl-soft: #E8F1FE; }
body.lesson--level-3 { --lvl: #F59E0B; --lvl-soft: #FEF4E0; }
body.lesson--level-4 { --lvl: #EC4899; --lvl-soft: #FDE8F1; }

/* ---------- Header ---------- */
.lesson-header {
  background: linear-gradient(135deg, var(--scr) 0%, var(--scr-dark) 100%);
  color: #fff;
  padding: 48px 32px 40px;
  border-bottom: 6px solid var(--lvl, var(--scr));
}
.lesson-header .lesson-tag {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: rgba(255,255,255,0.22);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
  backdrop-filter: blur(4px);
}
.lesson-header h1 {
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  max-width: 900px;
}
.lesson-header .lesson-sub {
  font-size: 0.95rem;
  opacity: 0.9;
  margin: 0;
}

/* ---------- Main column ---------- */
main {
  max-width: 880px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

/* ---------- Sections ---------- */
.lesson-section {
  background: #fff;
  border: 1px solid #F3E5C9;
  border-radius: 16px;
  padding: 28px 28px 24px;
  margin-bottom: 22px;
  position: relative;
  overflow: hidden;
}
.lesson-section::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--lvl, var(--scr));
}
.lesson-section h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0 0 16px;
  color: var(--scr-ink);
}
.lesson-section h2 .time {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--scr-soft);
  color: var(--scr-dark);
  padding: 3px 10px;
  border-radius: 999px;
  margin-left: auto;
}
.lesson-section h3 {
  font-size: 1.02rem;
  font-weight: 700;
  margin: 18px 0 8px;
  color: var(--scr-ink);
}
.lesson-section p,
.lesson-section li,
.lesson-section dd { font-size: 0.95rem; }

/* ---------- Lists ---------- */
.lesson-section ul,
.lesson-section ol { padding-left: 22px; }
.lesson-section li { margin-bottom: 6px; }

/* ---------- Block stack (Scratch's visual code) ----------
   Scratch lessons should render code as a stack of coloured pill-shaped
   "blocks" rather than as text. Use:

     <div class="block-stack">
       <span class="blk blk-events">when [flag] clicked</span>
       <span class="blk blk-motion">move (10) steps</span>
       <span class="blk blk-control">wait (1) seconds</span>
     </div>

   The colours match Scratch 3's category palette via --blk-* tokens.
   ---------------------------------------------------------------- */
.block-stack {
  background: #F8F5EF;
  border: 1px solid #E8DFCC;
  border-left: 4px solid var(--scr);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 14px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
}
.blk {
  display: inline-block;
  align-self: flex-start;
  padding: 6px 14px;
  border-radius: 6px;
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 1px 0 rgba(0,0,0,0.15);
  position: relative;
  line-height: 1.3;
}
.blk-motion    { background: var(--blk-motion); }
.blk-looks     { background: var(--blk-looks); }
.blk-sound     { background: var(--blk-sound); }
.blk-events    { background: var(--blk-events); color: #5A4500; }
.blk-control   { background: var(--blk-control); color: #6B3D00; }
.blk-sensing   { background: var(--blk-sensing); }
.blk-operators { background: var(--blk-operators); color: #1F4A1F; }
.blk-variables { background: var(--blk-variables); }
.blk-myblocks  { background: var(--blk-myblocks); }
.blk-pen       { background: var(--blk-pen); }
/* Hat-block (top of a stack — e.g. "when flag clicked") gets a rounded top */
.blk-hat { border-top-left-radius: 16px; border-top-right-radius: 16px; }

/* Inline code (e.g. variable names mid-paragraph) */
code:not(pre code) {
  background: #FFF3D9;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.85em;
  color: var(--scr-ink);
}

/* ---------- Generic code/pseudocode pre (rarely used in Scratch) ---------- */
pre.code {
  background: #FFFFFF;
  color: #3B1F00;
  padding: 16px 18px;
  border: 1px solid #F3E5C9;
  border-left: 4px solid var(--scr);
  border-radius: 8px;
  overflow-x: auto;
  font-family: 'JetBrains Mono', 'Courier New', ui-monospace, monospace;
  font-size: 0.86rem;
  line-height: 1.55;
  margin: 14px 0;
  white-space: pre;
}
pre.code code { font-family: inherit; color: inherit; background: none; padding: 0; }

/* ---------- Reference tables ---------- */
table.ref {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 0.9rem;
}
table.ref th,
table.ref td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid #F3E5C9;
}
table.ref thead th {
  background: var(--scr-soft);
  color: var(--scr-dark);
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* ---------- Callouts ---------- */
.callout {
  background: #FEF3C7;
  border-left: 4px solid #F59E0B;
  padding: 14px 18px;
  border-radius: 8px;
  margin: 16px 0;
  font-size: 0.92rem;
}
.callout strong { color: #92400E; }

/* ---------- 🚀 Mission / Boss Challenge callout (skill §4.6b) ---------- */
.callout.mission {
  background: #F5F0FF;
  border-left: 4px solid #9966FF;
}
.callout.mission strong { color: #6D28D9; }
.callout.mission .mission-success {
  display: block;
  margin-top: 8px;
  padding: 8px 12px;
  background: #FFFFFF;
  border: 1px dashed #C4B5FD;
  border-radius: 8px;
  color: #4C1D95;
  font-size: 0.88rem;
}

/* ---------- Arc progress banner (Project Arc, skill §7.2) ---------- */
.arc-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: linear-gradient(90deg, #ECFDF5, #F0FDFA);
  border: 1px solid #A7F3D0;
  border-radius: 12px;
  padding: 10px 16px;
  margin: 14px 0;
  font-size: 0.9rem;
  color: #065F46;
}
.arc-banner .arc-pill {
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  background: #10B981;
  color: #FFFFFF;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.arc-banner .arc-name { font-weight: 700; }
.arc-banner .arc-step { color: #047857; }

/* ---------- Curated illustrative images (sprite art, game-outlook, real-life — skill §5.7) ---------- */
figure.lesson-figure {
  background: #FFFFFF;
  border: 1px solid #F3E5C9;
  border-radius: 14px;
  padding: 16px;
  margin: 16px 0;
  text-align: center;
}
figure.lesson-figure img,
figure.lesson-figure svg {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}
figure.lesson-figure.outlook { border-color: #C4B5FD; background: #FBFAFF; }
figure.lesson-figure figcaption {
  margin-top: 12px;
  font-size: 0.9rem;
  color: #6B5A35;
  text-align: left;
}
/* "✏️ code me" badge — drawn inline in SVG stage-plans; this is the HTML fallback chip */
.codeme-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  background: #FFD500;
  color: #5A4500;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #CCAA00;
}

/* ---------- Reveal blocks (text answer reveals) ---------- */
details {
  background: var(--scr-soft);
  border-radius: 10px;
  padding: 10px 16px;
  margin: 12px 0;
}
details summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--scr-dark);
}
details[open] summary { margin-bottom: 8px; }

/* ---------- Stage / sprite mock-up (Scratch's project canvas) ---------- */
figure.stage-diagram {
  background: #FFFFFF;
  border: 1px solid #F3E5C9;
  border-radius: 14px;
  padding: 18px;
  margin: 16px 0;
  text-align: center;
}
figure.stage-diagram svg {
  max-width: 100%;
  height: auto;
  border: 1px solid #E8DFCC;
  border-radius: 8px;
  background: #FFFFFF;
}
figure.stage-diagram figcaption {
  margin-top: 12px;
  font-size: 0.9rem;
  color: #6B5A35;
  text-align: left;
}

/* ---------- Try-It-Yourself tasks (same easy/medium/stretch as Arduino) ---------- */
.task {
  border: 1px solid #F3E5C9;
  border-radius: 12px;
  padding: 16px 18px;
  margin: 14px 0;
  background: #FFFCF6;
}
.task-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.task--easy    .task-tag { background: #DCFCE7; color: #166534; }
.task--medium  .task-tag { background: #FEF3C7; color: #92400E; }
.task--stretch .task-tag { background: #FEE2E2; color: #991B1B; }

/* ---------- Vocabulary card ---------- */
dl.vocab {
  background: var(--scr-soft);
  border-radius: 12px;
  padding: 16px 20px;
  margin: 16px 0 0;
}
dl.vocab dt {
  font-weight: 700;
  color: var(--scr-dark);
  margin-top: 8px;
}
dl.vocab dt:first-child { margin-top: 0; }
dl.vocab dd {
  margin: 2px 0 0 0;
  color: var(--ink, #0F172A);
}

/* ---------- Footer ---------- */
.lesson-footer {
  text-align: center;
  padding: 24px;
  border-top: 1px solid #F3E5C9;
  background: #fff;
}
.lesson-footer a {
  color: var(--scr-dark);
  font-weight: 600;
  text-decoration: none;
}
.lesson-footer a:hover { text-decoration: underline; }

/* ============================================================
   Lesson chrome added during Next.js / TSX migration
   - .lesson-crumbs : breadcrumb above the orange title, white on gradient
   - .lesson-foot   : prev/next navigation card pair below the lesson body
   These mirror the Python lesson-page conventions.
   ============================================================ */

.lesson-header .lesson-crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
  margin: 0 0 14px;
}
.lesson-header .lesson-crumbs a {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
}
.lesson-header .lesson-crumbs a:hover {
  color: #fff;
  text-decoration: underline;
}
.lesson-header .lesson-crumbs .sep { opacity: 0.55; }
.lesson-header .lesson-crumbs .here { color: #fff; font-weight: 600; }

.lesson-foot {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin: 36px 32px 48px;
  max-width: 980px;
}
.lesson-foot__btn {
  flex: 1;
  min-width: 220px;
  padding: 16px 18px;
  border: 1px solid var(--border, #E2E8F0);
  background: #fff;
  border-radius: 14px;
  text-decoration: none;
  color: var(--ink, #0F172A);
  display: block;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.lesson-foot__btn:hover {
  transform: translateY(-2px);
  border-color: var(--scr);
  box-shadow: 0 10px 24px -16px rgba(244, 162, 26, 0.5);
  text-decoration: none;
}
.lesson-foot__btn[aria-disabled="true"] {
  opacity: 0.55;
  pointer-events: none;
}
.lesson-foot__dir {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted, #64748B);
  margin-bottom: 4px;
}
.lesson-foot__title {
  display: block;
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink, #0F172A);
}
.lesson-foot__btn--next { text-align: right; }

@media (max-width: 720px) {
  .lesson-foot { flex-direction: column; margin: 28px 18px 36px; }
  .lesson-foot__btn--next { text-align: left; }
}

/* ============================================================
   Assessment runner (SCR-L01-assessment)
   Class prefix: .as-*  ·  Multi-screen single-page flow.
   ============================================================ */

.hide { display: none !important; }

.as-shell {
  max-width: 880px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

.as-card {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  padding: 28px;
  margin-bottom: 22px;
  position: relative;
  overflow: hidden;
}
.as-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
  color: var(--scr-ink);
}
.as-sub {
  font-size: 0.95rem;
  color: #475569;
  margin: 0 0 14px;
}
.as-card h3 { font-size: 1.02rem; font-weight: 700; color: var(--scr-ink); }
.as-card h4 { font-size: 0.92rem; font-weight: 700; color: var(--scr-ink); margin: 0 0 10px; }
.as-card ul { padding-left: 22px; }
.as-card ul li { margin-bottom: 6px; font-size: 0.95rem; }

.as-warn {
  background: #FEF3C7;
  border-left: 4px solid #F59E0B;
  padding: 12px 16px;
  border-radius: 8px;
  margin: 16px 0 0;
  font-size: 0.92rem;
  color: #78350F;
}
.as-warn strong { color: #78350F; }

.as-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 12px 18px;
  margin-bottom: 14px;
  font-size: 0.9rem;
  color: #334155;
}
.as-progress {
  flex: 1;
  height: 8px;
  background: #E2E8F0;
  border-radius: 999px;
  overflow: hidden;
}
.as-progress > div {
  height: 100%;
  background: linear-gradient(90deg, var(--scr) 0%, var(--scr-dark) 100%);
  width: 0%;
  transition: width .25s ease;
}
.as-timer {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--scr-dark);
  background: var(--scr-soft);
  padding: 4px 10px;
  border-radius: 6px;
  letter-spacing: 0.04em;
}

.as-part-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: 14px;
  background: #E2E8F0;
  color: #334155;
}
.as-part-banner.A { background: #DBEAFE; color: #1E40AF; }
.as-part-banner.B { background: #FFF3D9; color: #C9760A; }
.as-part-banner.C { background: #FCE7F3; color: #9D174D; }

.as-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
  flex-wrap: wrap;
}

.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;
  line-height: 1.2;
}
.as-btn:hover { transform: translateY(-1px); }
.as-btn.primary { background: var(--scr); color: #fff; }
.as-btn.primary:hover { background: var(--scr-dark); }
.as-btn.ghost { background: #fff; color: var(--scr-dark); border-color: #CBD5E1; }
.as-btn.ghost:hover { border-color: var(--scr); color: var(--scr); }
.as-btn.warn { background: #B45309; color: #fff; }
.as-btn.warn:hover { background: #92400E; }

.as-rev-section { margin-bottom: 18px; }
.as-rev-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
  gap: 8px;
  margin-top: 6px;
}
.as-rev-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  border: 1px solid transparent;
  background: #FEF3C7;
  color: #92400E;
  transition: transform .12s ease, border-color .12s ease;
}
.as-rev-cell.answered { background: #DCFCE7; color: #166534; }
.as-rev-cell:hover { transform: translateY(-1px); border-color: var(--scr); }

.as-score {
  display: flex;
  align-items: baseline;
  gap: 18px;
  flex-wrap: wrap;
  background: var(--scr-soft);
  border-radius: 12px;
  padding: 18px 20px;
  margin-top: 6px;
}
.as-score .num {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 2rem;
  font-weight: 800;
  color: var(--scr-dark);
  line-height: 1;
}
.as-score .pct { font-size: 0.95rem; color: #334155; }
.as-score .pct strong { color: var(--scr-ink); }

.as-part-totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 6px;
}
.as-part-totals > div {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 14px 16px;
  text-align: center;
}
.pt-big {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--scr-ink);
  line-height: 1.1;
}
.pt-lbl {
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748B;
  margin-top: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.as-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 999px;
  margin-top: 6px;
  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; }

.as-modal-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 50;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.as-modal-bg.show { display: flex; }
.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(--scr-ink); }
.as-modal p  { margin: 0 0 18px; font-size: 0.95rem; color: #475569; }
.as-modal-acts { display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Runner-emitted classes ---------- */
.as-q-stem { margin: 0 0 14px; font-size: 0.98rem; color: #1E293B; }
.as-q-title { margin: 0 0 10px; font-size: 1.05rem; font-weight: 700; color: var(--scr-ink); }

/* Inline scratchblocks rendered inside assessment stems / options.
   The scratchblocks library replaces <pre class="blocks"> contents with
   an SVG; we just keep the wrapper tight so it sits flush with prose. */
.as-q-stem  pre.blocks,
.as-opt     pre.blocks,
.as-mark-block pre.blocks {
  display: block;
  margin: 8px 0;
  padding: 0;
  background: transparent;
  border: 0;
  overflow: visible;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.2;
  white-space: pre;
}
.as-opt pre.blocks { margin: 6px 0 2px; }
.as-q-stem pre.blocks svg,
.as-opt    pre.blocks svg,
.as-mark-block pre.blocks svg { max-width: 100%; height: auto; }

.as-opts { display: flex; flex-direction: column; gap: 8px; margin: 14px 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(--scr); background: #fff; }
.as-opt input[type="radio"] { margin-top: 3px; accent-color: var(--scr); }
.as-opt:has(input:checked) { border-color: var(--scr); background: var(--scr-soft); }

/* ---------- Part B / Part C upload UI ---------- */
.as-upload-row { margin-top: 14px; }
.as-upload {
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
}
.as-upload input[type="file"] { display: none; }
.as-upload-btn {
  display: inline-block;
  background: var(--scr);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 11px 22px;
  border-radius: 999px;
  user-select: none;
  transition: background .15s ease, transform .15s ease;
  align-self: flex-start;
}
.as-upload:hover .as-upload-btn { background: var(--scr-dark); transform: translateY(-1px); }
.as-upload-hint { font-size: 0.82rem; color: #64748B; }
.as-upload-empty {
  margin: 10px 0 0;
  padding: 14px 16px;
  border: 2px dashed #CBD5E1;
  border-radius: 10px;
  text-align: center;
  font-size: 0.9rem;
  color: #64748B;
  background: #FAFCFD;
}

/* Guidance callout shown above each Part B / Part C upload zone */
.as-upload-note {
  background: var(--scr-soft);
  border-left: 4px solid var(--scr);
  padding: 12px 16px;
  border-radius: 8px;
  margin: 14px 0;
  font-size: 0.9rem;
  color: #475569;
  line-height: 1.5;
}
.as-upload-note strong { color: var(--scr-ink); }
.as-upload-note p { margin: 0; }
.as-upload-note ul { margin: 6px 0 0; padding-left: 22px; }
.as-upload-note li { margin-bottom: 4px; }
.as-upload-note kbd {
  display: inline-block;
  padding: 1px 6px;
  background: #fff;
  border: 1px solid #CBD5E1;
  border-bottom-width: 2px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.84em;
  color: #334155;
  line-height: 1.4;
}
.as-upload-note code {
  background: #fff;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.84em;
  color: var(--scr-ink);
}

/* Drag-and-drop zone wraps the file-picker button + hint */
.as-dropzone {
  margin-top: 12px;
  padding: 18px 20px;
  border: 2px dashed #CBD5E1;
  border-radius: 12px;
  background: #FAFCFD;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  transition: border-color .12s ease, background .12s ease, transform .12s ease;
}
.as-dropzone.drag-active {
  border-color: var(--scr);
  background: var(--scr-soft);
  transform: scale(1.01);
}
.as-dropzone .as-upload { align-items: center; }
.as-dropzone .as-upload-btn { align-self: center; }
.as-dropzone .as-upload-hint { margin: 0; text-align: center; max-width: 460px; }

/* Thumbnail grid — Part B uploaded screenshots */
.as-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.as-thumb {
  position: relative;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.as-thumb a { display: block; }
.as-thumb img {
  display: block;
  width: 100%;
  height: 120px;
  object-fit: contain;
  background: #F8FAFC;
}
.as-thumb-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  font-size: 0.78rem;
  color: #475569;
  border-top: 1px solid #E2E8F0;
}
.as-thumb-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
  color: #1E293B;
}
.as-thumb-size { color: #94A3B8; font-family: 'JetBrains Mono', ui-monospace, monospace; }
.as-thumb-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 0;
  background: rgba(15, 23, 42, 0.7);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .12s ease;
}
.as-thumb-remove:hover { background: #DC2626; }

/* .sb3 file pill — Part C */
.as-file-pill {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  background: var(--scr-soft);
  flex-wrap: wrap;
}
.as-file-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.as-file-name {
  font-weight: 700;
  color: var(--scr-ink);
  word-break: break-all;
}
.as-file-size {
  font-size: 0.82rem;
  color: #64748B;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.as-file-download,
.as-file-replace {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--scr-dark);
  color: #fff;
  font-weight: 700;
  font-size: 0.88rem;
  padding: 8px 16px;
  border-radius: 999px;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  transition: background .12s ease;
}
.as-file-download:hover,
.as-file-replace:hover { background: var(--scr-ink); }

.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; }

.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(--scr-ink); }
.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;
}

.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(--scr); }
.as-rubric-max { color: #94A3B8; }

@media (max-width: 600px) {
  .as-shell { padding: 20px 14px 60px; }
  .as-card { padding: 20px 18px; }
  .as-bar { flex-wrap: wrap; }
  .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; }
}

@media print {
  .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-shell { padding: 0; }
}
