/* =============================================
   BAGRUT PAGE — Premium Redesign
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Rubik:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Tokens (bg-base/surface/card, accent-glow and text-primary/secondary
   are exact duplicates of the shared --mm- palette, so they alias it
   directly instead of redeclaring the values; the rest of these tokens
   are bagrut-specific and have no --mm- equivalent) ── */
:root {
  --bg-base:        var(--mm-bg);
  --bg-surface:     var(--mm-surface);
  --bg-card:        var(--mm-surface);
  --bg-deep:        #111827;
  --bg-input:       #111827;

  --border-subtle:  rgba(255, 255, 255, 0.06);
  --border-mid:     rgba(255, 255, 255, 0.1);
  --border-strong:  rgba(96, 165, 250, 0.45);

  --accent-primary: #3b82f6;
  --accent-glow:    var(--mm-accent);
  --accent-sky:     #60a5fa;
  --accent-danger:  #f87171;

  --text-primary:   var(--mm-text);
  --text-secondary: var(--mm-text-dim);
  --text-muted:     #64748b;
  --text-code:      #cbd5e1;

  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  20px;
  --radius-xl:  20px;
  --radius-pill: 999px;

  --shadow-card: 0 4px 24px rgba(0,0,0,0.28);
  --shadow-btn:  0 6px 16px rgba(37,99,235,0.25);
  --shadow-glow: 0 8px 20px rgba(37,99,235,0.3);

  --transition: 0.2s ease;

  --lang-accent: var(--accent-primary);
  --lang-accent-soft: rgba(59, 130, 246, 0.14);
}

.bagrut-page.java {
  --lang-accent: #ed8b00;
  --lang-accent-soft: rgba(237, 139, 0, 0.14);
}

.bagrut-page.csharp {
  --lang-accent: #9b4f96;
  --lang-accent-soft: rgba(155, 79, 150, 0.14);
}

/* ── Light Mode Tokens ── */
body.light-mode {
  --bg-deep:        #f1f5f9;
  --bg-input:       #f8fafc;

  --border-subtle:  rgba(15, 23, 42, 0.06);
  --border-mid:     rgba(15, 23, 42, 0.1);
  --border-strong:  rgba(37, 99, 235, 0.4);

  --accent-primary: #2563eb;

  --text-muted:     #94a3b8;
  --text-code:      #1d4ed8;

  --shadow-card: 0 4px 20px rgba(148,163,184,0.18);
  --shadow-btn:  0 4px 12px rgba(37,99,235,0.2);
  --shadow-glow: 0 8px 20px rgba(37,99,235,0.18);
}

/* ── Base ── */
body {
  position: relative;
  background-color: var(--bg-base);
  font-family: 'Rubik', sans-serif;
  transition: background-color 0.4s ease;
  min-height: 100vh;
}

/* Same dot-grid + soft glow treatment as the homepage hero and the shared
   .selection-page (lessons/quizzes/summaries/search/tests hub) - these
   bagrut pages were left with a flat background, which reads inconsistent
   right after clicking into them from the hub. Pinned to body (not
   .bagrut-page, which is just the narrow centered content column) so it
   reads full-bleed the same way it does elsewhere on the site. */
body::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
      linear-gradient(var(--border-subtle) 1px, transparent 1px),
      linear-gradient(90deg, var(--border-subtle) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent 60%);
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent 60%);
  opacity: 0.5;
  pointer-events: none;
  z-index: -1;
}

body::after {
  content: "";
  position: absolute;
  top: -80px;
  inset-inline-start: -120px;
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, rgba(96, 165, 250, 0.14), transparent 70%);
  filter: blur(10px);
  pointer-events: none;
  z-index: -1;
}

/* ── Page Layout ── */
.bagrut-page {
  position: relative;
  z-index: 1;
  width: min(860px, 100%);
  margin: 0 auto;
  padding: 28px 20px 40px;
}

/* ── Page Header ── */
.bagrut-header {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.bagrut-title {
  color: var(--text-primary);
  margin: 0 0 6px;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.bagrut-subtitle {
  color: var(--text-secondary);
  margin: 0;
  font-size: 0.97rem;
  font-weight: 400;
  line-height: 1.5;
}

/* ── Language Toggle ── */
.bagrut-lang-toggle {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 18px;
  margin-inline-start: 10px;
  padding: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-pill);
}

.lang-toggle-btn {
  padding: 5px 16px;
  border: none;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.lang-toggle-btn.active {
  background: var(--lang-accent);
  color: #ffffff;
}

/* ── Progress Indicator ── */
.bagrut-progress {
  display: inline-flex;
  margin-bottom: 18px;
  padding: 6px 16px;
  color: var(--lang-accent);
  background: var(--lang-accent-soft);
  border: 1px solid var(--lang-accent-soft);
  border-radius: var(--radius-pill);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ── Main Card ── */
.bagrut-card {
  position: relative;
  background: linear-gradient(165deg, var(--bg-card) 0%, rgba(255, 255, 255, 0.02) 100%);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  animation: slideUp 0.4s ease both;
}

.bagrut-card::before {
  content: '';
  position: absolute;
  top: 0;
  inset-inline: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--lang-accent), transparent 140%);
  z-index: 1;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Card header strip */
.card-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-body {
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Question Topic / Badge ── */
.bagrut-badge {
  display: inline-flex;
  align-self: flex-start;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--lang-accent-soft);
  color: var(--lang-accent);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.bagrut-question-text {
  font-size: 1.5rem;
  line-height: 1.6;
  color: var(--text-primary);
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}

/* ── Section Titles ── */
.bagrut-section-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.bagrut-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

/* ── Given context (scenario / trace code / given classes / method table) ── */
.bagrut-given-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bagrut-given-container:empty {
  display: none;
}

.bagrut-scenario {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.7;
}

.bagrut-given-code,
.bagrut-given-state {
  margin: 0 !important;
  padding: 16px 18px !important;
  background: var(--bg-deep) !important;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-md);
  color: var(--text-code);
  direction: ltr;
  text-align: left;
  overflow-x: auto;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.88rem;
  line-height: 1.7;
  white-space: pre-wrap;
}

/* Fake terminal bar for the plain "given" code/state blocks, matching the
   look of .solution-container so the given/solution pair reads as one
   consistent code-panel language across the page. */
.given-code-container {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-mid);
}

.given-code-container::before {
  content: 'Given';
  display: flex;
  align-items: center;
  padding: 8px 16px;
  background: #111827;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: #64748b;
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.given-code-container .bagrut-given-code,
.given-code-container .bagrut-given-state {
  border: none !important;
  border-radius: 0 !important;
}

.bagrut-given-class h4 {
  margin: 0 0 8px;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 700;
  direction: ltr;
  text-align: left;
}

.bagrut-table-scroll {
  overflow-x: auto;
}

.bagrut-method-table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-md);
  overflow: hidden;
  font-size: 0.88rem;
}

.bagrut-method-table th,
.bagrut-method-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: right;
  vertical-align: top;
}

.bagrut-method-table th {
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.bagrut-method-table td {
  color: var(--text-secondary);
}

.bagrut-method-table td[dir="ltr"] {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-code);
}

.bagrut-method-table tr:last-child td {
  border-bottom: none;
}

/* ── Parts (sub-questions א/ב/ג or 1/2) ── */
.bagrut-parts-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.bagrut-part {
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
}

.bagrut-part:first-child {
  padding-top: 0;
  border-top: none;
}

.bagrut-part-prompt {
  margin: 0 0 12px;
  color: var(--text-primary);
  line-height: 1.7;
}

.bagrut-part-label {
  font-weight: 700;
  color: var(--lang-accent);
  margin-inline-end: 6px;
}

.bagrut-part-requirements {
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.6;
}

.bagrut-part-requirements li {
  position: relative;
  padding-inline-start: 22px;
}

.bagrut-part-requirements li::before {
  content: '✓';
  position: absolute;
  inset-inline-start: 0;
  color: var(--lang-accent);
  font-weight: 700;
}

/* ── Answer textarea ── */
.bagrut-answer-input {
  width: 100%;
  box-sizing: border-box;
  min-height: 120px;
  background: var(--bg-input);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 16px 18px;
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.92rem;
  line-height: 1.7;
  resize: vertical;
  direction: ltr;
  text-align: left;
  outline: none;
  caret-color: var(--accent-glow);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.bagrut-answer-input:focus {
  border-color: var(--lang-accent);
  box-shadow: 0 0 0 3px var(--lang-accent-soft);
}

.bagrut-answer-input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

/* ── Solution Block ── */
.bagrut-solution-wrapper {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.3s ease,
              margin-top 0.3s ease;
}

.bagrut-solution-wrapper.visible {
  max-height: 1200px;
  opacity: 1;
  margin-top: 16px;
}

.solution-container {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-mid);
}

/* Fake terminal bar — always dark, matches the other read-only code
   panels across the site (hero, quiz, lessons) regardless of page theme */
.solution-container::before {
  content: 'Solution';
  display: flex;
  align-items: center;
  padding: 8px 16px;
  background: #111827;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: #64748b;
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.bagrut-code {
  margin: 0 !important;
  padding: 20px 20px !important;
  background: #0b1220 !important;
  color: #cbd5e1;
  direction: ltr;
  text-align: left;
  overflow-x: auto;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.9rem;
  line-height: 1.75;
}

/* ── Actions Footer ── */
.bagrut-actions {
  padding: 20px 32px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.secondary-actions {
  display: flex;
  gap: 8px;
  margin-right: auto;
  flex-wrap: wrap;
}

.action-divider {
  width: 1px;
  height: 28px;
  background: var(--border-subtle);
  flex-shrink: 0;
}

/* ── Buttons ── */
.bagrut-action-btn {
  all: unset;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  font-family: 'Rubik', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  border: 1px solid var(--border-mid);
  color: var(--text-secondary);
  background: transparent;
  transition: var(--transition);
  white-space: nowrap;
}

.bagrut-action-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: rgba(99,179,237,0.06);
  transform: translateY(-1px);
}

.bagrut-action-btn:active {
  transform: translateY(0);
}

/* Primary CTA */
.bagrut-action-btn.primary {
  background: var(--lang-accent);
  color: #ffffff;
  border: none;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.bagrut-action-btn.primary:hover {
  filter: brightness(0.9);
  color: #fff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  transform: translateY(-1px);
}

/* Secondary (next/random) */
.bagrut-action-btn.secondary {
  border-color: var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.82rem;
}

.bagrut-action-btn.secondary:hover {
  color: var(--text-primary);
  border-color: var(--border-mid);
}

/* Hide button */
#hide-bagrut-solution-btn {
  border-color: rgba(248,113,113,0.3);
  color: #fca5a5;
}

#hide-bagrut-solution-btn:hover {
  background: rgba(248,113,113,0.08);
  border-color: rgba(248,113,113,0.5);
  color: #fca5a5;
}

/* ── Footer Note ── */
.bagrut-footer-note {
  margin-top: 20px;
  text-align: center;
}

.bagrut-note {
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.5;
  margin: 0;
}

/* ── Language Tabs (if used) ── */
.bagrut-language-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
}

.bagrut-lang-btn {
  all: unset;
  cursor: pointer;
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-mid);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: 'Rubik', sans-serif;
  transition: var(--transition);
}

.bagrut-lang-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.bagrut-lang-btn.active {
  background: rgba(59,142,240,0.15);
  border-color: var(--border-strong);
  color: var(--accent-glow);
}

/* =============================================
   TIMED EXAM MODE
   ============================================= */

/* ── Intro screen ── */
.exam-intro-card {
  background: linear-gradient(165deg, var(--bg-card) 0%, rgba(255, 255, 255, 0.02) 100%);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  padding: 36px 32px;
  text-align: center;
}

.exam-intro-card h2 {
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0 0 10px;
}

.exam-intro-card > p {
  color: var(--text-secondary);
  line-height: 1.7;
  margin: 0 0 24px;
}

.exam-format-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 24px;
  text-align: right;
}

.exam-format-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}

.exam-format-item h4 {
  margin: 0 0 6px;
  color: var(--lang-accent);
  font-size: 0.95rem;
  font-weight: 700;
}

.exam-format-item p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.6;
}

.exam-intro-lang-label {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.exam-start-btn {
  all: unset;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding: 13px 32px;
  border-radius: var(--radius-pill);
  background: var(--lang-accent);
  color: #fff;
  font-family: 'Rubik', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  box-shadow: var(--shadow-glow);
  transition: filter 0.2s, transform 0.2s;
}

.exam-start-btn:hover {
  filter: brightness(0.92);
  transform: translateY(-1px);
}

/* ── Sticky timer bar ── */
.exam-timer-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
  padding: 12px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  flex-wrap: wrap;
}

.exam-timer-clock {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.03em;
}

.exam-timer-clock.warning { color: #facc15; }
.exam-timer-clock.critical { color: var(--accent-danger); }

.exam-timer-label {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.exam-finish-btn {
  all: unset;
  cursor: pointer;
  padding: 8px 20px;
  border-radius: var(--radius-pill);
  background: transparent;
  border: 1px solid var(--accent-danger);
  color: var(--accent-danger);
  font-family: 'Rubik', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  transition: background 0.2s, color 0.2s;
}

.exam-finish-btn:hover {
  background: var(--accent-danger);
  color: #fff;
}

/* ── Part section header ── */
.exam-part-header {
  margin: 32px 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.exam-part-header:first-of-type {
  margin-top: 0;
}

.exam-part-header h3 {
  margin: 0 0 4px;
  color: var(--text-primary);
  font-size: 1.15rem;
  font-weight: 700;
}

.exam-part-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ── Question cards inside the exam (reuse .bagrut-card visuals, stacked) ── */
.exam-question-card {
  margin-bottom: 20px;
}

.exam-question-card .bagrut-answer-input:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* ── Finished banner ── */
.exam-finished-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding: 16px 20px;
  background: var(--lang-accent-soft);
  border: 1px solid var(--lang-accent);
  border-radius: var(--radius-md);
  color: var(--text-primary);
}

.exam-finished-banner p {
  margin: 0;
  font-weight: 600;
}

.exam-restart-btn {
  all: unset;
  cursor: pointer;
  padding: 8px 20px;
  border-radius: var(--radius-pill);
  background: var(--lang-accent);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  order: 2;
}

.exam-finished-banner > p { order: 1; flex: 1 1 auto; }

/* ── Self-graded score, shown once the exam finishes ── */
.exam-save-result {
  order: 3;
  flex-basis: 100%;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--lang-accent);
}

.exam-save-result label {
  display: block;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.exam-save-result-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.exam-self-score-input {
  width: 100px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-mid);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
}

.exam-self-score-input:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.exam-save-score-btn {
  all: unset;
  cursor: pointer;
  padding: 8px 20px;
  border-radius: var(--radius-pill);
  background: var(--lang-accent);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  transition: filter 0.2s;
}

.exam-save-score-btn:hover:not(:disabled) { filter: brightness(0.92); }
.exam-save-score-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.exam-save-status {
  margin: 8px 0 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ── Past-attempts history, shown on the intro screen ── */
.exam-history {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
  text-align: right;
}

.exam-history h3 {
  margin: 0 0 10px;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 700;
}

.exam-history-empty {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.exam-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.exam-history-item {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
}

.exam-history-score {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: var(--lang-accent);
  min-width: 52px;
}

.exam-history-lang {
  color: var(--text-primary);
  font-weight: 600;
}

.exam-history-date {
  color: var(--text-muted);
  margin-inline-start: auto;
}

.exam-history-duration {
  color: var(--text-muted);
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .exam-format-grid { grid-template-columns: 1fr; }
  .exam-timer-bar { justify-content: center; text-align: center; }
  .exam-save-result-row { flex-direction: column; align-items: stretch; }
  .exam-self-score-input { width: 100%; }
  .exam-history-date { margin-inline-start: 0; }
}

@media (max-width: 600px) {
  .card-header,
  .card-body { padding: 20px 18px; }

  .bagrut-actions {
    padding: 16px 18px;
    flex-direction: column;
    align-items: stretch;
  }

  .primary-actions,
  .secondary-actions {
    width: 100%;
    justify-content: center;
  }

  .secondary-actions {
    margin-right: 0;
  }

  .action-divider {
    width: 100%;
    height: 1px;
  }

  .bagrut-title { font-size: 1.6rem; }
  .bagrut-question-text { font-size: 1.1rem; }
}

/* admin-only link to the bagrut question manager, shown on the exam hub page */
.quiz-admin-link {
  display: inline-flex;
  margin: 18px 0 0;
  padding: 10px 16px;
  border: 1px solid var(--mm-border);
  border-radius: 10px;
  color: var(--mm-accent);
  text-decoration: none;
  font-weight: 700;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.quiz-admin-link:hover {
  border-color: var(--mm-accent);
  background: rgba(96, 165, 250, 0.08);
}