/* === Variables (exact slide deck palette — ES_QL_Master_Slide_Template.md) === */
:root {
  /* Slide primary colors */
  --blue:       #0077CC;   /* Dark Blue — labels, syntax, links */
  --blue-dark:  #005FA3;   /* hover state */
  --light-blue: #1BA9F5;   /* icon circles, borders */
  --teal:       #24BBB1;   /* category chips, module headings */
  --lime:       #93C83E;   /* valid syntax / correct answer */
  --yellow:     #FED10A;   /* accent fills, explanation callout */
  --pink:       #EF5098;   /* callout icon, "why it matters" */

  /* Tints (15% opacity equivalents, fixed) */
  --light-blue-bg: #E8F6FE;
  --teal-bg:       #E6F8F7;
  --lime-bg:       #F0F8E2;
  --yellow-bg:     #FFFBEA;

  /* Web-only tokens */
  --red:        #DE350B;   /* wrong answer */
  --red-bg:     #FFEBE6;
  --text:       #1A1A1A;
  --text-mid:   #4A4A4A;
  --bg:         #F5F7FA;
  --card:       #FFFFFF;
  --border:     #DFE1E6;

  --radius:     8px;
  --shadow:     0 1px 3px rgba(0,0,0,0.10), 0 1px 2px rgba(0,0,0,0.06);
}

/* === Reset === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
button { cursor: pointer; font: inherit; border: none; background: none; }
ul { list-style: none; }

/* === Header === */
.app-header {
  background: var(--blue);
  color: #fff;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: 56px;
}
.app-logo {
  font-weight: 700;
  font-size: 1.1rem;
  background: rgba(255,255,255,0.2);
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.app-title {
  font-size: 1rem;
  font-weight: 500;
  color: rgba(255,255,255,0.9);
}
.breadcrumb {
  margin-left: auto;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.75);
  display: flex;
  gap: 0.4rem;
  align-items: center;
}
.breadcrumb span + span::before { content: "›"; margin-right: 0.4rem; }
.breadcrumb .bc-link {
  color: rgba(255,255,255,0.85);
  text-decoration: underline;
  cursor: pointer;
}

/* === Main === */
.app-main {
  max-width: 1400px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

/* === Views === */
.view { animation: fadeIn 0.15s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.view-heading {
  font-size: 1.4rem;
  color: var(--blue);
  font-weight: 600;
}
.view-subheading {
  color: var(--text-mid);
  margin-top: 0.4rem;
  font-size: 0.95rem;
}
.view-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

/* === Buttons === */
.btn-primary {
  background: var(--blue);
  color: #fff;
  padding: 0.55rem 1.25rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--blue-dark); }
.btn-ghost {
  color: var(--blue);
  font-size: 0.9rem;
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  transition: background 0.1s;
}
.btn-ghost:hover { background: var(--light-blue-bg); }

/* === Level Cards (home) === */
.view-home { padding-top: 0.5rem; }
.view-home .view-heading { margin-bottom: 0.4rem; }
.level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}
.level-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.level-card:hover { border-color: var(--light-blue); box-shadow: 0 4px 12px rgba(27,169,245,0.15); }
.level-badge {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--blue);
  line-height: 1;
}
.level-info h3 { font-size: 1.05rem; margin-bottom: 0.2rem; }
.level-info p { font-size: 0.85rem; color: var(--text-mid); }
.level-status { font-size: 0.8rem; color: var(--text-mid); margin-top: auto; padding-top: 0.5rem; border-top: 1px solid var(--border); }

/* === Lab List === */
.module-group { margin-bottom: 2rem; }
.module-heading {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--teal);
  font-weight: 700;
  margin-bottom: 0.6rem;
  padding: 0.2rem 0.6rem 0.2rem 0.5rem;
  background: var(--teal-bg);
  border-left: 3px solid var(--teal);
  border-radius: 0 4px 4px 0;
}
.lab-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  box-shadow: var(--shadow);
  transition: border-color 0.1s;
}
.lab-card:hover { border-color: var(--light-blue); }
.lab-card-id {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--blue);
  background: var(--light-blue-bg);
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}
.lab-card-title { flex: 1; font-size: 0.95rem; font-weight: 500; }
.lab-card-score {
  font-size: 0.8rem;
  color: var(--text-mid);
  white-space: nowrap;
}
.lab-card-score.done { color: var(--lime); font-weight: 600; }

/* === Lab View === */
.lab-meta-strip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.lab-id-badge {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--blue);
  background: var(--light-blue-bg);
  padding: 3px 8px;
  border-radius: 4px;
}
.concept-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.concept-tag {
  font-size: 0.75rem;
  background: var(--teal-bg);
  color: var(--teal);
  border: 1px solid var(--teal);
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
}
.lab-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.lab-section h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-mid);
  font-weight: 600;
  margin-bottom: 0.6rem;
}
.mission-text, .expected-text { font-size: 0.95rem; color: var(--text); }
.lab-actions { margin-top: 1.5rem; display: flex; justify-content: flex-end; }

/* === Hints === */
.hint-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  overflow: hidden;
}
.hint-summary {
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg);
  user-select: none;
}
.hint-summary::before { content: "▶"; font-size: 0.65rem; color: var(--blue); transition: transform 0.15s; }
details[open] .hint-summary::before { transform: rotate(90deg); }
.hint-summary::-webkit-details-marker { display: none; }
.hint-body {
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  line-height: 1.6;
  background: var(--card);
  border-top: 1px solid var(--border);
}

/* Fenced code blocks rendered by minMd() */
.code-block {
  background: #1a1e2e;
  color: #e2e8f0;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 0.5rem 0;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.83rem;
  line-height: 1.5;
}
.code-block code { background: none; color: inherit; padding: 0; font-size: inherit; }

/* Inline code in all content areas */
.mission-text code, .expected-text code,
.question-text code, .explanation-block code,
.hint-body code, .result-item code {
  background: var(--light-blue-bg);
  color: var(--blue);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.87em;
}
.hint-locked {
  padding: 0.65rem 1rem;
  font-size: 0.85rem;
  color: var(--text-mid);
  font-style: italic;
  background: var(--bg);
}

/* === Question === */
.question-progress {
  font-size: 0.85rem;
  color: var(--text-mid);
  margin-left: auto;
}
.level-score-chip, .lab-score-chip {
  font-size: 0.8rem;
  color: var(--text-mid);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 2px 10px;
  border-radius: 12px;
  margin-left: auto;
}
.question-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.question-text {
  font-size: 1rem;
  margin-bottom: 1.25rem;
  line-height: 1.65;
}
.choices { display: flex; flex-direction: column; gap: 0.5rem; }
.choice-btn {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  text-align: left;
  font-size: 0.9rem;
  transition: border-color 0.1s, background 0.1s;
  width: 100%;
  cursor: pointer;
}
.choice-btn:not([disabled]):hover { border-color: var(--blue); background: var(--light-blue-bg); }
.choice-btn[disabled] { cursor: default; }
.choice-label {
  font-weight: 700;
  color: var(--blue);
  min-width: 1.5rem;
  line-height: 1.5;
}
.choice-btn.correct {
  border-color: var(--lime);
  background: var(--lime-bg);
}
.choice-btn.correct .choice-label { color: var(--text); }  /* lime on lime-bg is ~1.8:1; use dark text */
.choice-btn.wrong {
  border-color: var(--red);
  background: var(--red-bg);
}
.choice-btn.wrong .choice-label { color: var(--text); }    /* red on red-bg is ~3.8:1; use dark text for AAA */

.explanation-block {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: var(--yellow-bg);
  border-left: 3px solid var(--yellow);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.88rem;
  line-height: 1.55;
}
.explanation-block strong { margin-right: 0.3rem; }
.question-actions { margin-top: 1rem; display: flex; justify-content: flex-end; }

/* === Results === */
.results-header { text-align: center; margin-bottom: 2rem; }
.results-score-ring {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 5px solid var(--teal);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--teal);
  margin: 0 auto 1rem;
}
.results-score-ring.large { width: 100px; height: 100px; font-size: 1.5rem; }
.results-header h2 { font-size: 1.3rem; margin-bottom: 0.3rem; }
.results-header p { color: var(--text-mid); font-size: 0.9rem; }

.results-list { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1.5rem; }
.result-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border);
  font-size: 0.875rem;
}
.result-icon { font-size: 1rem; line-height: 1.4; }
.result-item.correct-item { border-left: 3px solid var(--lime); }
.result-item.wrong-item { border-left: 3px solid var(--red); }

.results-table { width: 100%; border-collapse: collapse; margin-bottom: 1.5rem; font-size: 0.9rem; }
.results-table th, .results-table td { padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--border); text-align: left; }
.results-table th { background: var(--bg); font-weight: 600; color: var(--text-mid); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
.results-table td:last-child { font-weight: 600; }
.score-pass { color: var(--lime); }
.score-fail { color: var(--red); }

.results-actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; margin-top: 1rem; }

/* === Utilities === */
.hidden { display: none !important; }

/* === Loading / Error states === */
.state-msg {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-mid);
}
.state-msg .state-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.state-msg h3 { font-size: 1.1rem; margin-bottom: 0.4rem; color: var(--text); }
.state-msg p { font-size: 0.9rem; }
.state-msg code {
  background: var(--border);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.85em;
}

/* === Forms === */

/* Extra button variants */
.btn-secondary {
  background: var(--bg);
  color: var(--blue);
  border: 1.5px solid var(--blue);
  padding: 0.45rem 1rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.15s, color 0.15s;
}
.btn-secondary:hover { background: var(--light-blue-bg); }

.btn-danger {
  background: #DE350B;
  color: #fff;
  padding: 0.45rem 1rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.15s;
}
.btn-danger:hover { background: #b52d09; }

.btn-block { display: block; width: 100%; margin-top: 0.75rem; }

/* Header user chip */
.user-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  background: var(--light-blue-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.2rem 0.6rem 0.2rem 0.8rem;
  font-size: 0.82rem;
  flex-shrink: 0;
}
.user-chip-name { font-weight: 600; color: var(--text); }
.user-chip-id {
  color: var(--text-mid);
  font-size: 0.78rem;
  font-family: monospace;
  letter-spacing: 0.04em;
}
.btn-header {
  background: none;
  border: none;
  color: var(--blue);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0.15rem 0.3rem;
  border-radius: 4px;
  transition: background 0.1s;
}
.btn-header:hover { background: rgba(0,119,204,0.1); }
.btn-header:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* Form card */
.view-register,
.view-instructor-login {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 2.5rem;
}
.form-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2rem 2rem 1.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.form-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
  color: var(--blue);
}
.form-subtitle {
  color: var(--text-mid);
  font-size: 0.9rem;
  margin-bottom: 1.2rem;
}

/* Field rows */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 1rem;
}
.field label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}
.field input {
  padding: 0.5rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
  box-sizing: border-box;
}
.field input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0,119,204,0.12);
  outline: none;
}
.field input:focus-visible {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0,119,204,0.12);
  outline: none;
}
.field input::placeholder { color: #aab; }
.req { color: #DE350B; margin-left: 1px; }

/* Inline hints and toggles */
.form-hint {
  font-size: 0.8rem;
  color: var(--text-mid);
}
.form-toggle {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--text-mid);
  text-align: center;
}
.btn-link {
  background: none;
  border: none;
  color: var(--blue);
  cursor: pointer;
  font-size: inherit;
  text-decoration: underline;
  padding: 0;
}
.btn-link:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 2px; }

/* Error / success banners */
.form-error {
  background: #fff1f0;
  border: 1px solid #ffb3b3;
  border-radius: var(--radius);
  color: #DE350B;
  font-size: 0.88rem;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
}
.form-success {
  text-align: center;
  padding: 0.5rem 0;
}
.form-success p { margin-bottom: 0.5rem; font-size: 0.95rem; }

/* Monospace callout (student ID, join code) */
.code-callout {
  display: inline-block;
  background: var(--teal-bg);
  border: 1.5px solid var(--teal);
  color: var(--teal);
  font-family: monospace;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  padding: 0.3rem 1rem;
  border-radius: var(--radius);
  text-transform: uppercase;
}

/* Join code callout bar (dashboard) */
.join-callout {
  background: var(--teal-bg);
  border: 1px solid var(--teal);
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Instructor login accent */
.view-instructor-login .form-title { color: var(--pink); }
.btn-instr { background: var(--pink); }
.btn-instr:hover { background: #c9307b; }


/* === Dashboard === */

.view-dashboard { padding-bottom: 2rem; }

.dash-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.dash-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  flex-wrap: wrap;
}
.dash-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-mid);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.dash-select {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.3rem 0.5rem;
  font-size: 0.85rem;
  background: #fff;
  color: var(--text);
}
.dash-select:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* Stat tiles */
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.stat-tile {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  text-align: center;
}
.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--blue);
  line-height: 1.1;
}
.stat-label {
  font-size: 0.75rem;
  color: var(--text-mid);
  margin-top: 0.15rem;
}

/* Scrollable table wrapper */
.dash-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}
.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  white-space: nowrap;
}
.dash-table th {
  background: var(--bg);
  color: var(--text-mid);
  font-weight: 600;
  font-size: 0.78rem;
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
}
.dash-table td {
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.dash-table tr:last-child td { border-bottom: none; }
.dash-table tr:hover td { background: var(--light-blue-bg); cursor: pointer; }

/* Sticky first column (student name) */
.dash-table th:first-child,
.dash-table td:first-child {
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 1;
  border-right: 1px solid var(--border);
}
.dash-table th:first-child { background: var(--bg); }

/* Lab progress cells */
.lab-cell-done {
  color: #2d7d46;
  font-weight: 700;
  text-align: center;
}
.lab-cell-partial {
  background: var(--yellow-bg);
  color: var(--text);   /* dark text on yellow — never yellow text on white */
  font-weight: 600;
  font-size: 0.78rem;
  text-align: center;
  border-radius: 3px;
  padding: 1px 4px;
}
.lab-cell-empty {
  color: var(--border);
  text-align: center;
}
.lab-cell-retake {
  color: var(--teal);
  font-size: 0.75rem;
  text-align: center;
}

/* Cohort status badge (in join callout) */
.cohort-status-badge {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 10px;
  letter-spacing: 0.03em;
}
.badge-open   { background: var(--lime-bg);  color: #2d7d46; }
.badge-closed { background: var(--bg);       color: var(--text-mid); border: 1px solid var(--border); }

/* Danger outline button (close cohort) */
.btn-danger-outline {
  color: var(--red);
  border-color: var(--red);
}
.btn-danger-outline:hover { background: #fff1f0; }

/* Small button variant */
.btn-sm { font-size: 0.82rem; padding: 0.3rem 0.65rem; }

/* Online/idle indicator dots */
.dot-online, .dot-idle {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}
.dot-online { background: var(--lime); }
.dot-idle   { background: var(--border); }

/* Student detail view */
.view-student-detail { padding-bottom: 2rem; }
.text-mid { color: var(--text-mid); font-size: 0.9rem; margin-bottom: 1rem; }

.attempt-block {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 1rem;
  overflow: hidden;
}
.attempt-header {
  background: var(--bg);
  padding: 0.5rem 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-mid);
  border-bottom: 1px solid var(--border);
}
.attempt-answer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 1rem;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border);
}
.attempt-answer:last-child { border-bottom: none; }
.ans-correct { color: var(--lime); font-weight: 700; }
.ans-wrong   { color: #DE350B; font-weight: 700; }
.ans-q { flex: 1; color: var(--text); }
.ans-chosen { font-family: monospace; }


/* === Lab question modal === */

.lab-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 200;
  padding: 80px 1rem 1rem;
}
.lab-modal-panel {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  width: 550px;
  max-height: calc(100vh - 100px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.lab-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: #fff;
  flex-shrink: 0;
}
.lab-modal-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--blue);
  line-height: 1.3;
}
.lab-modal-subtitle {
  font-size: 0.78rem;
  color: var(--text-mid);
  margin-top: 0.1rem;
}
.lab-modal-close {
  font-size: 1rem;
  color: var(--text-mid);
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  flex-shrink: 0;
  line-height: 1;
}
.lab-modal-close:hover { background: var(--bg); color: var(--text); }
.lab-modal-close:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.lab-modal-body {
  overflow-y: auto;
  padding: 0.75rem 1.25rem 1.25rem;
  flex: 1;
}
.modal-loading { color: var(--text-mid); padding: 0.5rem 0; font-size: 0.9rem; }

/* Individual question block */
.modal-question {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}
.modal-question:last-child { border-bottom: none; padding-bottom: 0; }
.modal-q-num { color: var(--text-mid); font-weight: 400; margin-right: 0.2rem; }
.modal-q-text {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
  line-height: 1.45;
}
.modal-choice {
  display: flex;
  gap: 0.45rem;
  font-size: 0.83rem;
  padding: 0.22rem 0.4rem;
  border-radius: 4px;
  margin-bottom: 0.15rem;
  line-height: 1.4;
}
.modal-choice-label {
  font-weight: 700;
  min-width: 1.1rem;
  flex-shrink: 0;
}
.modal-choice-correct {
  background: var(--lime-bg);
  color: #2d7d46;
  font-weight: 600;
}
.modal-explanation {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-mid);
  padding: 0.4rem 0.6rem;
  background: var(--yellow-bg);
  border-radius: 4px;
  line-height: 1.4;
}

/* Clickable lab column headers */
.lab-col-header {
  cursor: pointer;
  user-select: none;
}
.lab-col-header:hover {
  color: var(--blue);
  text-decoration: underline;
}

/* === Cohorts management === */

.view-cohorts { padding-bottom: 2rem; }

.cohorts-table { margin-top: 0.5rem; }
.cohorts-table td { vertical-align: middle; }

.cohort-code {
  font-family: monospace;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  background: var(--teal-bg);
  border: 1px solid var(--teal);
  color: var(--teal);
  padding: 1px 6px;
  border-radius: 3px;
}

.cohort-copy-btn {
  font-size: 0.78rem;
  margin-left: 0.4rem;
  vertical-align: middle;
}

/* === Responsive === */
@media (max-width: 600px) {
  .app-main { padding: 0 1rem; margin: 1rem auto; }
  .level-grid { grid-template-columns: 1fr; }
  .header-inner { gap: 0.5rem; }
  .app-title { display: none; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .form-card { padding: 1.5rem 1rem; }
  .dash-toolbar { flex-direction: column; align-items: flex-start; }
  .dash-controls { margin-left: 0; }
}

/* === Read-only browse mode ================================================
   Anonymous visitors reading the course without a login. Nothing here is
   interactive except links — choices deliberately carry no affordance.       */

.readonly-banner {
  background: var(--light-blue-bg);
  border: 1px solid var(--light-blue);
  border-left-width: 4px;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  color: var(--text);
}

.readonly-note {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-mid);
  font-style: italic;
}

.readonly-callout {
  background: var(--yellow-bg);
  border: 1px solid var(--yellow);
  border-left-width: 4px;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-top: 1rem;
  font-size: 0.9rem;
}
.readonly-callout .btn-secondary { margin-top: 0.5rem; }

/* Static choice: same layout as .choice-btn, none of the interactivity.
   No hover, no pointer cursor — nothing suggests it can be clicked. */
.choice-static {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  text-align: left;
  font-size: 0.9rem;
  width: 100%;
  cursor: default;
}

/* Linked question index on the lab view */
.question-index { list-style: decimal inside; margin: 0.5rem 0 0; }
.question-index li {
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 0;
}
.question-index li:last-child { border-bottom: none; }
.question-index-link {
  color: var(--blue);
  text-decoration: none;
  font-size: 0.92rem;
}
.question-index-link:hover { text-decoration: underline; }

/* Prev / numbered strip / Next on the read-only question page */
.question-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}
.question-strip { display: flex; gap: 0.35rem; align-items: center; }
.question-strip-link,
.question-strip-current {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  min-height: 2rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  text-decoration: none;
}
.question-strip-link {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--blue);
}
.question-strip-link:hover { border-color: var(--blue); }
.question-strip-current {
  border: 1px solid var(--blue);
  background: var(--blue);
  color: #fff;
  font-weight: 600;
}
/* Anchors styled as buttons need the button box model back */
.question-nav .btn-primary,
.question-nav .btn-ghost {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

/* Shareable read-only link row in the instructor join-code callout */
.browse-link-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
  padding: 0.6rem 0.85rem;
  background: var(--light-blue-bg);
  border: 1px solid var(--light-blue);
  border-radius: var(--radius);
}
.browse-link-label { font-size: 0.85rem; color: var(--text-mid); }
.browse-link-url {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.2rem 0.45rem;
  word-break: break-all;
  color: var(--blue);
}
.browse-link-warn {
  flex-basis: 100%;
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--text-mid);
}
