/* ─── Self-hosted fonts ──────────────────────────────────────────────────────
   Bundled with the app so the elegant fonts ALWAYS load — fast, private, and
   never blocked by a security policy or network. (Replaces the Google Fonts CDN.) */
@font-face { font-family:'Playfair Display'; font-style:normal; font-weight:400; font-display:swap;
  src:url('../fonts/playfair-display-v40-latin-regular.woff2') format('woff2'); }
@font-face { font-family:'Playfair Display'; font-style:normal; font-weight:600; font-display:swap;
  src:url('../fonts/playfair-display-v40-latin-600.woff2') format('woff2'); }
@font-face { font-family:'Playfair Display'; font-style:normal; font-weight:700; font-display:swap;
  src:url('../fonts/playfair-display-v40-latin-700.woff2') format('woff2'); }
@font-face { font-family:'Inter'; font-style:normal; font-weight:300; font-display:swap;
  src:url('../fonts/inter-v20-latin-300.woff2') format('woff2'); }
@font-face { font-family:'Inter'; font-style:normal; font-weight:400; font-display:swap;
  src:url('../fonts/inter-v20-latin-regular.woff2') format('woff2'); }
@font-face { font-family:'Inter'; font-style:normal; font-weight:500; font-display:swap;
  src:url('../fonts/inter-v20-latin-500.woff2') format('woff2'); }
@font-face { font-family:'Inter'; font-style:normal; font-weight:600; font-display:swap;
  src:url('../fonts/inter-v20-latin-600.woff2') format('woff2'); }

/* ─── Design tokens ──────────────────────────────────────────────────────── */
:root {
  --bg:          #faf9f7;
  --surface:     #ffffff;
  --text:        #2c2c2c;
  --text-muted:  #717171;
  /* BayRen brand (exact): navy #0B2A49 (the sea) + gold #D8B04C (the sun) */
  --accent:      #0B2A49;
  --accent-dark: #081f37;
  --accent-light:#eaeef3;
  --gold:        #D8B04C;
  --gold-dark:   #b08e30;
  --border:      #e4e1db;
  --shadow-sm:   0 1px 3px rgba(11,42,73,0.07);
  --shadow:      0 4px 16px rgba(11,42,73,0.10);
  --shadow-lg:   0 12px 40px rgba(11,42,73,0.16);
  --radius:      14px;
  --radius-sm:   9px;
  --navy-grad:   linear-gradient(160deg, #081f37 0%, #0B2A49 55%, #123a5e 100%);
  --font-heading:'Playfair Display', Georgia, serif;
  --font-body:   'Inter', system-ui, sans-serif;

  /* Error highlight colours */
  --err-grammar-bg:    #fde8e8;
  --err-grammar-line:  #d45555;
  --err-spell-bg:      #fff6d6;
  --err-spell-line:    #c8960a;
  --err-vocab-bg:      #ddeeff;
  --err-vocab-line:    #3d82c4;
  --err-other-bg:      #ecdeff;
  --err-other-line:    #7a44c4;
}

/* ─── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  font-size: 16px;
  /* Crisper, more elegant text rendering for the bundled fonts. */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ─── Friendly error pages (404 / 500) ───────────────────────────────────── */
.error-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.35rem;
  padding: 2rem;
  background: var(--bg);
}
.error-logo { width: 76px; height: auto; margin-bottom: 1.25rem; }
.error-code {
  font-family: var(--font-heading);
  font-size: clamp(4rem, 12vw, 6rem);
  font-weight: 700;
  line-height: 1;
  color: var(--gold);
}
.error-page h1 {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  color: var(--accent);
  margin: 0.25rem 0 0.5rem;
}
.error-page p { color: var(--text-muted); max-width: 30rem; margin-bottom: 1.5rem; }
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ─── Nav (deep navy bar) ────────────────────────────────────────────────── */
.nav {
  background: var(--navy-grad);
  border-bottom: 2px solid var(--gold);
  padding: 0 2rem;
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.25rem;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 12px rgba(20,44,74,0.35);
}
.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
  padding: 0.5rem 0;
}
.nav-brand span { color: var(--gold); }
.nav-brand:hover { text-decoration: none; }
.nav-logo {
  height: 44px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
  /* The logo art is navy + gold; on the navy bar the navy parts vanish, so it
     sits on a white rounded chip to stay crisp and visible. */
  background: #ffffff;
  border-radius: 9px;
  padding: 4px 7px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}
.nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.nav-user {
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255,255,255,0.65);
}
.nav-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255,255,255,0.85);
  padding: 0.35rem 0.8rem;
  border-radius: 99px;
  transition: background 0.18s, color 0.18s;
}
.nav-link:hover { background: rgba(255,255,255,0.12); text-decoration: none; color: #fff; }

/* ─── Flash messages ─────────────────────────────────────────────────────── */
.flash-wrap {
  max-width: 780px;
  margin: 1.25rem auto 0;
  padding: 0 1.5rem;
}
.flash {
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}
.flash-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.flash-error   { background: #fde8e8; color: #c62828; border: 1px solid #ef9a9a; }

/* ─── Layout ─────────────────────────────────────────────────────────────── */
.main-content {
  max-width: 860px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}
.page-title {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
  color: var(--accent);
}
.page-title::after {
  content: '';
  display: block;
  width: 52px;
  height: 3px;
  border-radius: 99px;
  background: var(--gold);
  margin-top: 0.5rem;
}
.page-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

/* ─── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 2rem;
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 1.5rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.18s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(11,42,73,0.25); }
.btn-primary:hover { background: var(--accent-dark); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(11,42,73,0.3); }
.btn-primary:disabled { background: #9fadc0; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-gold { background: var(--gold); color: var(--accent-dark); box-shadow: 0 2px 10px rgba(217,169,62,0.4); }
.btn-gold:hover { background: #e4b54d; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(217,169,62,0.5); }
.btn-outline-light { background: transparent; color: #fff; border: 1.5px solid rgba(255,255,255,0.6); }
.btn-outline-light:hover { background: rgba(255,255,255,0.12); border-color: #fff; }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg); }
.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.825rem; }
.btn-lg { padding: 0.9rem 2rem; font-size: 1rem; }

/* ─── Forms ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.45rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.form-input, .form-select, .form-textarea {
  font-family: var(--font-body);
  font-size: 0.95rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 1rem;
  width: 100%;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.18s, box-shadow 0.18s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(11,42,73,0.15);
}

/* ─── Login page ─────────────────────────────────────────────────────────── */
.login-wrap {
  min-height: calc(100vh - 62px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 2rem;
  background: var(--navy-grad);
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 3rem 2.5rem;
  width: 100%;
  max-width: 420px;
  text-align: center;
}
.login-logo {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}
.login-logo span { color: var(--gold); }
.login-logo-img {
  display: block;
  height: 84px;
  width: 84px;
  object-fit: contain;
  margin: 0 auto 0.85rem;
}
.login-tagline {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}
.login-card .form-input { text-align: center; font-size: 1rem; }

/* ─── Prompts page ───────────────────────────────────────────────────────── */
.task-section { margin-bottom: 2.5rem; }
.task-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.task-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.badge-task1 { background: #e0ecf8; color: #2d6a9f; }
.badge-task2 { background: #e8f4ec; color: #2d7a4a; }
.badge-task2-lg { background: #e8f4ec; color: #2d7a4a; }

.task-section-title {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 600;
}
.prompt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}
.prompt-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.18s, transform 0.18s;
  display: flex;
  flex-direction: column;
}
.prompt-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.prompt-card-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  flex: 1;
  line-height: 1.4;
}
.prompt-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.prompt-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 99px;
}
.chip-pending  { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.chip-submitted{ background: #fff9e6; color: #b08000; border: 1px solid #f0d070; }
.chip-results  { background: #e6f4ea; color: #2e7d32; border: 1px solid #8ec8a0; }
.empty-state { color: var(--text-muted); font-style: italic; padding: 2rem 0; }

/* ─── Write page ─────────────────────────────────────────────────────────── */
/* ─── Split-screen exam workspace ────────────────────────────────────────── */
.exam-split {
  --exam-zoom: 1;
  height: calc(100vh - 62px);          /* fill viewport below the nav */
  display: flex;
  flex-direction: column;
  padding: 0.9rem 1rem 1rem;
  gap: 0.75rem;
}
.exam-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  flex: 0 0 auto;
}
.exam-topbar-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}
.write-req {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.write-req strong { color: var(--text); }

.split-panes {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  align-items: stretch;
}
.pane {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.pane-question {
  flex: 0 0 50%;                        /* updated live by the divider drag */
  background: var(--accent-light);
  border-color: #c8d9ed;
}
.pane-answer {
  flex: 1 1 auto;
}
.pane-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 1.5rem 1.6rem;
}

.split-divider {
  flex: 0 0 12px;
  align-self: stretch;
  cursor: col-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  touch-action: none;
}
.split-divider-grip {
  width: 4px;
  height: 46px;
  max-height: 60%;
  border-radius: 99px;
  background: var(--border);
  transition: background 0.15s;
}
.split-divider:hover .split-divider-grip,
.split-divider:focus-visible .split-divider-grip,
.split-divider.dragging .split-divider-grip {
  background: var(--accent);
}
.split-divider:focus-visible { outline: none; }

.pane-answer-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
}
.pane-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-dark);
}
.zoom-controls { display: flex; gap: 0.35rem; }
.zoom-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  min-width: 34px;
  height: 30px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.zoom-btn:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.zoom-btn:disabled { opacity: 0.4; cursor: default; }

.answer-form {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0.9rem 1rem 1rem;
}

/* Question text scales with the zoom control AND, gently, with the viewport, so
   it no longer looks tiny beside a large chart on a wide screen (the clamp floors
   keep the previous size on small screens; the vw term grows it on large ones —
   all still multiplied by the A+/A- zoom). */
.pane-question .prompt-box-title { font-size: calc(clamp(1.25rem, 0.95rem + 0.6vw, 1.7rem) * var(--exam-zoom)); }
.pane-question .prompt-box-body  { font-size: calc(clamp(0.98rem, 0.86rem + 0.32vw, 1.22rem) * var(--exam-zoom)); }

/* Answer textarea fills the pane and scales with zoom (scoped so the mock
   exam writing page's own textarea is untouched) */
.pane-answer .response-textarea {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  resize: none;
  margin: 0;
  font-size: calc(1rem * var(--exam-zoom));
}

/* Responsive: stack the panes on small screens (phones/tablets) */
@media (max-width: 820px) {
  .exam-split { height: auto; }
  .split-panes { flex-direction: column; }
  .split-divider { display: none; }
  .pane-question { flex: 0 0 auto; }
  .pane-answer { flex: 0 0 auto; }
  .pane-answer .response-textarea { min-height: 320px; }
}

/* ─── Draft autosave: status pill + restore banner ───────────────────────── */
.head-right { display: flex; align-items: center; gap: 0.75rem; }
.draft-status {
  font-size: 0.78rem;
  font-weight: 600;
  color: #2e7d52;
  opacity: 0;
  transition: opacity 0.25s;
  white-space: nowrap;
}
.draft-status.is-visible { opacity: 1; }

.draft-restore {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  flex: 0 0 auto;
  background: #fff7e6;
  border: 1px solid #f0d28a;
  border-radius: var(--radius);
  padding: 0.7rem 1rem;
  font-size: 0.9rem;
  color: #7a5a12;
}
.draft-restore-actions { display: flex; gap: 0.45rem; flex-shrink: 0; }

/* ─── Smart submit confirmation modal ────────────────────────────────────── */
.submit-confirm {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.submit-confirm[hidden] { display: none; }
.submit-confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 31, 55, 0.55);
}
.submit-confirm-card {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border-top: 4px solid var(--gold);
  padding: 1.75rem;
  width: 100%;
  max-width: 440px;
}
.submit-confirm-title {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}
.submit-confirm-stats {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}
.submit-confirm-stats strong { color: var(--text); }
.submit-confirm-warn {
  background: #fff3cd;
  border: 1px solid #f0d28a;
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  font-size: 0.9rem;
  line-height: 1.55;
  color: #7a5a12;
  margin-bottom: 1.1rem;
}
.submit-confirm-warn[hidden] { display: none; }
.submit-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}

/* ─── Question browser: type filter chips + category groups ───────────────── */
.cat-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1.25rem;
}
.cat-chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.cat-chip:hover { border-color: var(--accent); }
.cat-chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.cat-count {
  opacity: 0.7;
  font-weight: 700;
  margin-left: 0.15rem;
}
.cat-group { margin-bottom: 1.75rem; }
.cat-group-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.cat-group-count {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--accent-light);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
}

/* ─── Admin question list: category tag ──────────────────────────────────── */
.cat-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--accent-dark);
  background: var(--accent-light);
  border-radius: 999px;
  padding: 0.12rem 0.55rem;
  margin-left: 0.4rem;
  vertical-align: middle;
}
.cat-tag-none {
  color: #9a6a00;
  background: #fff3cd;
}

.write-layout {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}
.prompt-box {
  background: var(--accent-light);
  border: 1px solid #c8d9ed;
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.5rem;
}
.prompt-box-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-dark);
  margin-bottom: 0.5rem;
}
.prompt-box-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}
.prompt-box-body {
  font-size: 0.95rem;
  line-height: 1.7;
  white-space: pre-wrap;
}
.prompt-box-image {
  margin-top: 1.1rem;
  text-align: center;
}
.prompt-box-image img {
  max-width: 100%;
  /* Let the chart be larger and clearer on big screens (was a flat 420px cap,
     which shrank charts and left the text looking stranded), while staying
     bounded on small ones. width/height:auto keeps the aspect ratio. */
  max-height: clamp(300px, 48vh, 640px);
  width: auto;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  object-fit: contain;
  background: #fff;
  cursor: zoom-in;                 /* click to enlarge (image_lightbox.js) */
}
.prompt-box-image-hint {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Click-to-enlarge lightbox for question/task images (image_lightbox.js) */
.img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: rgba(15, 27, 45, 0.85);
  cursor: zoom-out;
  opacity: 0;
  transition: opacity 0.2s;
}
.img-lightbox.is-open { opacity: 1; }
.img-lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  background: #fff;
}
.img-lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  width: 2.4rem;
  height: 2.4rem;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.img-lightbox-close:hover { background: rgba(255, 255, 255, 0.32); }
@media (prefers-reduced-motion: reduce) { .img-lightbox { transition: none; } }
.write-meta {
  display: flex;
  gap: 1.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.write-meta strong { color: var(--text); }
.response-textarea {
  width: 100%;
  min-height: 340px;
  resize: vertical;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.75;
  padding: 1.25rem 1.5rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.18s, box-shadow 0.18s;
}
.response-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(11,42,73,0.15);
}
.counter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.65rem;
  margin-bottom: 1.25rem;
}
.word-counter {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: color 0.2s;
}
.word-counter.near-limit { color: #c08020; }
.word-counter.at-limit   { color: #c62828; }
.word-counter.flash      { animation: flash-red 0.4s; }
@keyframes flash-red {
  0%,100% { color: #c62828; }
  50%      { color: #ff0000; font-size: 1rem; }
}
.word-bar-wrap {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 99px;
  margin: 0 1rem;
  overflow: hidden;
}
.word-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--accent);
  width: 0;
  transition: width 0.15s, background 0.2s;
}
.word-bar-fill.near { background: #c08020; }
.word-bar-fill.limit { background: #c62828; }

/* ─── Submitted page ─────────────────────────────────────────────────────── */
.submitted-wrap {
  min-height: calc(100vh - 62px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.submitted-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 3rem 2.5rem;
  width: 100%;
  max-width: 480px;
  text-align: center;
}
.submitted-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #e6f4ea;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
  font-size: 1.75rem;
}
.submitted-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.submitted-detail {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
  line-height: 1.6;
}
.submitted-actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }

/* ─── Results page ───────────────────────────────────────────────────────── */
.results-layout { max-width: 860px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }
.results-header {
  display: flex;
  align-items: flex-start;
  gap: 2rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}
.band-score-badge {
  flex-shrink: 0;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
}
.band-score-badge.score-low    { background: #fde8e8; border: 3px solid #d45555; }
.band-score-badge.score-mid    { background: #fff6d6; border: 3px solid #c8960a; }
.band-score-badge.score-good   { background: #ddeeff; border: 3px solid #3d82c4; }
.band-score-badge.score-high   { background: #e6f4ea; border: 3px solid #3d9e5a; }
.band-number {
  font-family: var(--font-heading);
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1;
}
.band-label { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.results-meta { flex: 1; }
.results-meta h1 { font-family: var(--font-heading); font-size: 1.5rem; font-weight: 700; margin-bottom: 0.25rem; }
.results-meta p  { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 0.25rem; }

.feedback-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem; }
.feedback-card h2 { font-family: var(--font-heading); font-size: 1.1rem; font-weight: 600; margin-bottom: 0.75rem; }
.feedback-card p  { font-size: 0.95rem; line-height: 1.7; white-space: pre-wrap; }
.corrected-version-card { border-color: #3d9e5a; background: #f4fbf6; }
.corrected-version-card h2 { color: #2a7a44; }
.corrected-version-text { font-size: 0.95rem; line-height: 1.85; white-space: pre-wrap; color: var(--text-main); }

.essay-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.75rem; margin-bottom: 1.5rem; }
.essay-card h2 { font-family: var(--font-heading); font-size: 1.1rem; font-weight: 600; margin-bottom: 1rem; }
#essay-display {
  font-size: 0.975rem;
  line-height: 1.85;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Error highlights */
mark {
  cursor: pointer;
  border-radius: 3px;
  padding: 1px 2px;
  transition: opacity 0.15s;
}
mark:hover { opacity: 0.8; }
mark.error-grammar    { background: var(--err-grammar-bg); border-bottom: 2px solid var(--err-grammar-line); }
mark.error-spelling   { background: var(--err-spell-bg);   border-bottom: 2px solid var(--err-spell-line); }
mark.error-vocabulary { background: var(--err-vocab-bg);   border-bottom: 2px solid var(--err-vocab-line); }
mark.error-other      { background: var(--err-other-bg);   border-bottom: 2px solid var(--err-other-line); }

.legend { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1.5rem; }
.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 500;
}
.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}
.dot-grammar    { background: var(--err-grammar-bg); border: 1.5px solid var(--err-grammar-line); }
.dot-spelling   { background: var(--err-spell-bg);   border: 1.5px solid var(--err-spell-line); }
.dot-vocabulary { background: var(--err-vocab-bg);   border: 1.5px solid var(--err-vocab-line); }
.dot-other      { background: var(--err-other-bg);   border: 1.5px solid var(--err-other-line); }

.annotations-section h2 { font-family: var(--font-heading); font-size: 1.1rem; font-weight: 600; margin-bottom: 1rem; }
.annotation-card-result {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.25rem;
  margin-bottom: 0.75rem;
  transition: box-shadow 0.2s;
}
.annotation-card-result.active { box-shadow: 0 0 0 2px var(--accent); }
.ann-top {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}
.ann-index {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}
.err-type-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.55rem;
  border-radius: 99px;
}
.badge-grammar    { background: var(--err-grammar-bg); color: var(--err-grammar-line); }
.badge-spelling   { background: var(--err-spell-bg);   color: #8a6200; }
.badge-vocabulary { background: var(--err-vocab-bg);   color: var(--err-vocab-line); }
.badge-other      { background: var(--err-other-bg);   color: var(--err-other-line); }

.ann-error-text {
  font-size: 0.875rem;
  margin-bottom: 0.3rem;
}
.ann-error-text s { color: #c62828; }
.ann-correction   { font-size: 0.875rem; color: #2e7d32; font-weight: 600; margin-bottom: 0.4rem; }
.ann-explanation  { font-size: 0.875rem; color: var(--text-muted); line-height: 1.55; }

/* ─── Four criteria display (results page) ───────────────────────────────── */
.criteria-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.75rem;
  margin-bottom: 1.5rem;
}
.criteria-card h2 { font-family: var(--font-heading); font-size: 1.1rem; font-weight: 600; margin-bottom: 0.9rem; }
.criteria-grid-display {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}
@media (max-width: 540px) { .criteria-grid-display { grid-template-columns: 1fr; } }
.criterion-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.9rem;
}
.criterion-label { font-size: 0.82rem; color: var(--text-muted); }
.criterion-score { font-family: var(--font-heading); font-size: 1.4rem; font-weight: 700; }

/* ─── Re-attempt notice (write page) ────────────────────────────────────── */
.reattempt-notice {
  background: #eef3f9;
  border: 1px solid #c8d9ed;
  border-radius: var(--radius-sm);
  padding: 0.7rem 1rem;
  font-size: 0.875rem;
  margin-bottom: 1rem;
  color: var(--accent-dark);
}

/* ─── Attempt history (submitted page) ──────────────────────────────────── */
.attempts-history {
  margin-top: 1.75rem;
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
  text-align: left;
}
.attempts-history h3 {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}
.attempts-history table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.attempts-history th {
  background: var(--bg);
  padding: 0.5rem 0.65rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.attempts-history td { padding: 0.55rem 0.65rem; border-bottom: 1px solid var(--border); }
.attempts-history tr:last-child td { border-bottom: none; }
.attempts-history .current-row td { background: var(--accent-light); }

/* ─── Form hint text ─────────────────────────────────────────────────────── */
.form-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.3rem; }
.req { color: #d45555; font-weight: 600; }

/* ─── Pending results ────────────────────────────────────────────────────── */
.pending-wrap {
  min-height: calc(100vh - 62px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.pending-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 3rem 2.5rem;
  width: 100%;
  max-width: 460px;
  text-align: center;
}
.pending-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}
.pending-title { font-family: var(--font-heading); font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem; }
.pending-desc { font-size: 0.9rem; color: var(--text-muted); line-height: 1.65; }

/* ─── Exam timer (write page) ────────────────────────────────────────────── */
.exam-timer {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-light);
  border: 1px solid #c8d4e4;
  border-radius: 99px;
  padding: 0.35rem 1rem;
}
.exam-timer .timer-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.exam-timer.timer-warn  { color: #b07010; background: #fff6d6; border-color: #f0d070; }
.exam-timer.timer-over  { color: #c62828; background: #fde8e8; border-color: #ef9a9a; }

/* ─── Target band progress (dashboard) ───────────────────────────────────── */
.target-progress-card {
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow);
}
.target-progress-card h2 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.85rem;
}
.target-stats {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.target-stat .stat-value {
  font-family: var(--font-heading);
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1.2;
}
.target-stat .stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.75);
}
.target-bar-track {
  height: 10px;
  background: rgba(255,255,255,0.18);
  border-radius: 99px;
  overflow: hidden;
}
.target-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--gold);
  transition: width 0.4s ease;
}
.target-progress-note {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.85);
  margin-top: 0.6rem;
}

/* ─── Band-over-time chart (dashboard) ───────────────────────────────────── */
.band-chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.75rem;
  margin-bottom: 1.75rem;
}
.band-chart-card h2 {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}
.band-chart-card svg { display: block; width: 100%; height: auto; }

/* ─── Band guide (results page) ──────────────────────────────────────────── */
.band-guide {
  margin-top: 0.6rem;
  border-top: 1px dashed var(--border);
  padding-top: 0.5rem;
}
.band-guide summary {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  user-select: none;
}
.band-guide summary:hover { color: var(--accent-dark); }
.band-guide-body { margin-top: 0.5rem; font-size: 0.82rem; line-height: 1.6; color: var(--text); }
.band-guide-body p { margin-bottom: 0.4rem; }
.band-guide-body .guide-improve { color: var(--text-muted); }
.band-guide-body .guide-improve strong { color: var(--gold-dark); }
.overall-band-summary {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  line-height: 1.6;
}

/* Criterion cards stack their content when the guide is present */
.criterion-item.with-guide {
  flex-direction: column;
  align-items: stretch;
}
.criterion-item.with-guide .criterion-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ─── Accessibility: visible focus rings ─────────────────────────────────── */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

/* ─── Dashboard hero: countdown, study plan, badges ──────────────────────── */
.target-progress-card { background: var(--navy-grad); }
.hero-top {
  display: flex;
  gap: 1.75rem;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
}
.hero-main { flex: 1; min-width: 260px; }
.exam-countdown {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.15rem;
  min-width: 118px;
  min-height: 118px;
  padding: 0.85rem;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 2.5px solid var(--gold);
}
.exam-countdown .countdown-number {
  font-family: var(--font-heading);
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
}
.exam-countdown .countdown-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255,255,255,0.85);
  line-height: 1.4;
}
.exam-countdown.urgent { border-color: #ef9a9a; }
.exam-countdown.urgent .countdown-number { color: #ffb3ab; }
.exam-countdown.unset { border-style: dashed; border-color: rgba(255,255,255,0.35); }
.exam-countdown.unset a { color: var(--gold); text-transform: none; letter-spacing: 0; }

/* Profile page reuses the countdown on a light card */
.profile-identity {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.profile-identity .exam-countdown { background: var(--accent-light); }
.profile-identity .exam-countdown .countdown-number { color: var(--accent); }
.profile-identity .exam-countdown .countdown-label { color: var(--text-muted); }
.profile-name { font-family: var(--font-heading); font-size: 1.45rem; font-weight: 700; color: var(--accent); }
.profile-email { font-size: 0.9rem; color: var(--text-muted); }
.profile-section-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 1.1rem;
  color: var(--accent);
}

.study-plan {
  margin-top: 1.25rem;
  padding-top: 1.1rem;
  border-top: 1px solid rgba(255,255,255,0.15);
}
.study-plan-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--gold);
  margin-bottom: 0.5rem;
}
.study-plan-estimate {
  font-size: 0.92rem;
  line-height: 1.65;
  color: rgba(255,255,255,0.92);
  margin-bottom: 0.9rem;
}
.study-plan-estimate strong { color: var(--gold); }
.focus-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem;
}
.focus-card {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
}
.focus-head { font-size: 0.85rem; color: #fff; margin-bottom: 0.3rem; }
.focus-head strong { color: var(--gold); }
.focus-avg {
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(255,255,255,0.12);
  border-radius: 99px;
  padding: 0.1rem 0.5rem;
  margin-left: 0.3rem;
  color: rgba(255,255,255,0.85);
}
.focus-tip { font-size: 0.82rem; line-height: 1.55; color: rgba(255,255,255,0.82); }

.badges-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1.1rem;
}
.badge-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 99px;
  padding: 0.3rem 0.8rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.45);
}
.badge-chip.earned {
  background: rgba(217,169,62,0.18);
  border-color: var(--gold);
  color: #fff;
}

/* ─── Landing page ───────────────────────────────────────────────────────── */
.landing-body { background: var(--bg); }
.landing-hero {
  background: var(--navy-grad);
  border-bottom: 3px solid var(--gold);
  text-align: center;
  padding: 4.5rem 1.5rem 4rem;
}
.landing-logo {
  height: auto;
  width: 230px;
  max-width: 70vw;
  object-fit: contain;
  border-radius: 22px;
  background: #fff;
  padding: 1.5rem 1.75rem;
  box-shadow: var(--shadow-lg);
  margin-bottom: 1.75rem;
}
.landing-title {
  font-family: var(--font-heading);
  font-size: clamp(2.1rem, 5vw, 3.2rem);
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}
.landing-sub {
  font-size: 1.05rem;
  line-height: 1.7;
  color: rgba(255,255,255,0.85);
  max-width: 560px;
  margin: 0 auto 2rem;
}
.landing-sub strong { color: var(--gold); }
.landing-cta { display: flex; gap: 0.85rem; justify-content: center; flex-wrap: wrap; }
.landing-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  max-width: 1020px;
  margin: -2rem auto 0;
  padding: 0 1.5rem 3rem;
  position: relative;
}
.landing-feature {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem 1.5rem;
  text-align: center;
  transition: transform 0.18s, box-shadow 0.18s;
}
.landing-feature:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.feature-icon { font-size: 2rem; margin-bottom: 0.75rem; }
.landing-feature h2 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.5rem;
}
.landing-feature p { font-size: 0.9rem; line-height: 1.65; color: var(--text-muted); }
.landing-bottom { text-align: center; padding: 2.5rem 1.5rem 3.5rem; }
.landing-bottom h2 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 1.25rem;
}
.landing-footer {
  background: var(--accent-dark);
  text-align: center;
  padding: 1.25rem;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.7);
}
.landing-footer a { color: var(--gold); }

/* ─── Print: clean result report ─────────────────────────────────────────── */
/* Print-only elements are hidden on screen and revealed in the print stylesheet. */
.print-only { display: none; }

@media print {
  @page { margin: 1.4cm; }

  /* Force the brand colours to print (most browsers honour this). */
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }

  body { background: #fff; color: #1a1a1a; font-size: 10.5pt; line-height: 1.5; }

  /* Hide everything that's screen-only chrome. */
  .nav, .flash-wrap, .btn, .band-guide, .attempts-history, .legend,
  .results-header, .overall-band-summary { display: none !important; }

  .results-layout { max-width: 100%; margin: 0; padding: 0; }

  /* ---- Branded letterhead ---- */
  .print-report-head {
    display: flex !important;
    align-items: center;
    gap: 16px;
    padding-bottom: 12px;
    margin-bottom: 0;
    border-bottom: 3px solid #0B2A49;
  }
  .print-logo { height: 70px; width: auto; }
  .print-report-titles { flex: 1; }
  .print-org {
    font-family: var(--font-heading);
    font-size: 19pt;
    font-weight: 700;
    color: #0B2A49;
    line-height: 1.1;
  }
  .print-doc {
    font-size: 9.5pt;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #6a6a6a;
    margin-top: 2px;
  }
  .print-band {
    text-align: center;
    border: 2.5px solid #D8B04C;
    border-radius: 10px;
    padding: 6px 16px;
    min-width: 74px;
  }
  .print-band-num {
    font-family: var(--font-heading);
    font-size: 26pt;
    font-weight: 700;
    color: #0B2A49;
    line-height: 1;
  }
  .print-band-lbl {
    font-size: 7pt;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6a6a6a;
    margin-top: 2px;
  }

  /* ---- Student / assessment facts ---- */
  .print-meta-table {
    display: table !important;
    width: 100%;
    border-collapse: collapse;
    margin: 14px 0 20px;
    font-size: 9.5pt;
  }
  .print-meta-table td { padding: 5px 9px; border: 1px solid #d8d8d8; }
  .print-meta-table td.k {
    background: #f1f4f7;
    font-weight: 600;
    color: #0B2A49;
    width: 13%;
    white-space: nowrap;
    text-transform: uppercase;
    font-size: 8pt;
    letter-spacing: 0.04em;
  }

  /* ---- Section cards become clean, flat, page-break-aware ---- */
  .criteria-card, .feedback-card, .essay-card, .annotations-section,
  .corrected-version-card {
    box-shadow: none !important;
    border: 1px solid #d8d8d8 !important;
    border-radius: 8px;
    padding: 14px 16px !important;
    margin-bottom: 14px !important;
    break-inside: avoid;
  }
  .criteria-card h2, .feedback-card h2, .essay-card h2,
  .annotations-section h2, .corrected-version-card h2 {
    font-family: var(--font-heading);
    font-size: 12pt;
    color: #0B2A49;
    border-bottom: 1px solid #eee;
    padding-bottom: 4px;
    margin-bottom: 10px;
  }

  /* Criteria grid: tidy two-column boxes with a gold score */
  .criteria-grid-display { display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px; }
  .criterion-item {
    border: 1px solid #e0e0e0 !important;
    border-radius: 6px;
    padding: 7px 11px !important;
    break-inside: avoid;
  }
  .criterion-item.with-guide { flex-direction: row; align-items: center; }
  .criterion-item .criterion-head { width: 100%; }
  .criterion-label { font-size: 9.5pt; color: #333; }
  .criterion-score { font-family: var(--font-heading); font-size: 15pt; color: #0B2A49; }

  .feedback-card p, .corrected-version-text { font-size: 10pt; line-height: 1.6; }

  /* Essay: corrections as clean underlines (background tints rarely print well) */
  #essay-display { font-size: 10pt; line-height: 1.7; }
  mark { background: none !important; border-bottom: 1.2px solid #c0392b !important;
         color: #1a1a1a !important; padding: 0 !important; }

  /* Detailed corrections list */
  .annotation-card-result {
    border: 1px solid #e0e0e0 !important;
    box-shadow: none !important;
    border-radius: 6px;
    padding: 9px 12px !important;
    margin-bottom: 8px !important;
    break-inside: avoid;
  }
  .err-type-badge { border: 1px solid #ccc; }
  .corrected-version-card { border-color: #2a7a44 !important; }

  /* ---- Footer line ---- */
  .print-footer {
    display: block !important;
    margin-top: 18px;
    padding-top: 8px;
    border-top: 1px solid #d8d8d8;
    font-size: 8pt;
    color: #888;
    text-align: center;
    letter-spacing: 0.03em;
  }
}

/* ── Speaking booking calendar ─────────────────────────────────────────── */
.cal-table { width: 100%; border-collapse: collapse; }
.cal-table th {
  font-size: 0.78rem; color: var(--text-muted); font-weight: 500;
  padding: 0.4rem 0; text-align: center;
}
.cal-cell {
  text-align: center; height: 2.6rem; width: 14.28%;
  border: 1px solid var(--border);
}
.cal-cell span, .cal-cell a {
  display: flex; align-items: center; justify-content: center;
  height: 100%; width: 100%; text-decoration: none;
}
.cal-cell span { color: var(--text-muted); }
.cal-other { background: #faf9f7; }
.cal-other span { opacity: 0.4; }
.cal-available { background: #eef5ee; }
.cal-available a { color: var(--accent); font-weight: 600; }
.cal-available a:hover { background: var(--accent); color: #fff; text-decoration: none; }
.cal-selected { outline: 2px solid var(--gold); outline-offset: -2px; }
.cal-legend { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.6rem; display: flex; align-items: center; gap: 0.4rem; }
.cal-dot { display: inline-block; width: 0.9rem; height: 0.9rem; background: #eef5ee; border: 1px solid var(--border); border-radius: 3px; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); gap: 0.5rem; }
.slot-btn {
  width: 100%; padding: 0.55rem 0; border: 1px solid var(--accent);
  background: #fff; color: var(--accent); border-radius: var(--radius-sm);
  font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer;
}
.slot-btn:hover { background: var(--accent); color: #fff; }

/* ── Student results: "please revise" banner ─────────────────────────────── */
.revision-banner {
  background: #fff4e6;
  border: 1px solid #f0c48a;
  border-left: 5px solid #b5651d;
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.75rem;
}
.revision-banner-head {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 600;
  color: #7a4410;
  margin-bottom: 0.5rem;
}
.revision-banner-note {
  font-size: 1rem;
  font-style: italic;
  color: #5a3208;
  margin: 0 0 0.5rem;
}
.revision-banner-help {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
}
