/* Schrijven A2 Examentrainer — Architectural Precision & Tactile Smooth UI (IT-RES Design System) */
:root {
  --bg: #f8f8f5;
  --surface: #ffffff;
  --surface-2: #f0f1ed;
  --sapphire-mist: #edf2fa;
  --obsidian: #0f172a;
  --ink: #0f172a;
  --ink-2: #475569;
  --ink-3: #64748b;
  --line: rgba(15, 23, 42, 0.09);
  --line-strong: rgba(15, 23, 42, 0.17);

  --accent: #1d3f8a;
  --accent-hover: #15316e;
  --accent-soft: rgba(29, 63, 138, 0.07);
  --accent-border: rgba(29, 63, 138, 0.22);

  --amber: #c25e00;
  --amber-bg: #fff6eb;
  --amber-border: rgba(194, 94, 0, 0.25);

  --ok: #0f766e;
  --ok-dot: #10b981;
  --ok-bg: rgba(15, 118, 110, 0.08);
  --ok-border: rgba(15, 118, 110, 0.28);

  --err: #b91c1c;
  --err-bg: #fef2f2;
  --err-border: #fecaca;

  --radius: 14px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --max: 1180px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 12px 28px -16px rgba(15, 23, 42, 0.11);
  --shadow-md: 0 2px 6px rgba(15, 23, 42, 0.05), 0 22px 44px -20px rgba(15, 23, 42, 0.15);
  --shadow-lg: 0 28px 70px rgba(15, 23, 42, 0.24);
  --font: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scrollbar-width: thin; }
html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  font-size: 16px;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.56;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

h1, h2, h3 { font-weight: 700; letter-spacing: -0.025em; line-height: 1.18; color: var(--ink); text-wrap: balance; }
.print-only { display: none; }

/* ===== FROSTED HEADER ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(248, 248, 245, 0.88);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.65rem 1.5rem;
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  flex-wrap: wrap;
}
.brand { display: inline-flex; align-items: center; gap: 0.7rem; cursor: pointer; user-select: none; }
.brand-flag {
  width: 32px; height: 32px; border-radius: 9px; background: #fff;
  display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--line-strong); box-shadow: var(--shadow-xs); flex-shrink: 0;
}
.brand-flag span { flex: 1; }
.brand-flag .f-red { background: #ae1c28; }
.brand-flag .f-white { background: #ffffff; }
.brand-flag .f-blue { background: #1d3f8a; }
.brand-title { font-weight: 700; font-size: 1rem; letter-spacing: -0.02em; line-height: 1.15; }
.brand-sub { font-size: 0.74rem; color: var(--ink-3); font-weight: 500; }

/* Segmented Nav */
.nav-tabs {
  display: inline-flex; gap: 3px; flex-wrap: wrap;
  background: var(--surface-2); padding: 4px; border-radius: 11px; border: 1px solid var(--line);
}
.nav-tab {
  background: transparent; color: var(--ink-2); border: 1px solid transparent;
  padding: 0.42rem 0.82rem; border-radius: var(--radius-sm);
  font-size: 0.85rem; font-weight: 600; cursor: pointer;
  transition: all 150ms var(--ease-out);
}
.nav-tab:active { transform: scale(0.97); }
.nav-tab.active {
  background: var(--surface); color: var(--ink); border-color: var(--line);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.09);
}

.header-tools { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.lang-pill {
  display: inline-flex; align-items: center; gap: 0.45rem;
  background: var(--surface); color: var(--ink);
  border: 1px solid rgba(15, 23, 42, 0.18);
  padding: 0.38rem 0.75rem; min-height: 36px; border-radius: var(--radius-sm);
  font-size: 0.8rem; font-weight: 600; cursor: pointer; text-decoration: none;
  box-shadow: 0 1.5px 0 rgba(15, 23, 42, 0.09), var(--shadow-xs);
  transition: all 150ms var(--ease-out);
}
.lang-pill:active { transform: translateY(1px) scale(0.98); box-shadow: none; }

.lang-switch {
  display: inline-flex;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid rgba(15, 23, 42, 0.16);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
  min-height: 36px;
}
.lang-btn {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.3rem 0.58rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 150ms var(--ease-out), color 150ms var(--ease-out);
}
.lang-btn.active {
  background: var(--accent);
  color: #fff;
}

.toggle-switch {
  width: 28px; height: 16px; border-radius: 999px; background: #cbd5e1;
  position: relative; flex-shrink: 0; transition: background-color 180ms var(--ease-out);
}
.toggle-switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.28);
  transition: transform 180ms var(--ease-out);
}
.toggle-switch.is-on { background: var(--accent); }
.toggle-switch.is-on::after { transform: translateX(12px); }

/* ===== CONTAINER & HERO ===== */
.container { max-width: var(--max); margin: 0 auto; padding: 1.75rem 1.5rem 3.5rem; animation: fadeSlideUp 200ms var(--ease-out); }
@keyframes fadeSlideUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.hero-card {
  background: var(--sapphire-mist);
  background-image: radial-gradient(rgba(29, 63, 138, 0.075) 1px, transparent 1px);
  background-size: 26px 26px;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  padding: 1.95rem 2.2rem;
  box-shadow: var(--shadow-sm);
  display: grid; grid-template-columns: 1.45fr 1fr; gap: 2rem; align-items: center;
  margin-bottom: 2rem;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 0.45rem;
  background: var(--surface); color: var(--accent); border: 1px solid var(--accent-border);
  font-size: 0.77rem; font-weight: 700; padding: 0.3rem 0.75rem; border-radius: 999px;
  margin-bottom: 0.85rem; box-shadow: var(--shadow-xs);
}
.hero-badge::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok-dot);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.22);
}
.hero-card h1 { margin: 0 0 0.65rem; font-size: clamp(1.5rem, 2.7vw, 2.1rem); letter-spacing: -0.03em; }
.hero-card p { margin: 0 0 1.25rem; color: var(--ink-2); font-size: 0.95rem; max-width: 58ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }

.hero-stats-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem;
  border-left: 1px solid rgba(29, 63, 138, 0.16); padding-left: 1.75rem;
}
.stat-tile {
  background: rgba(255, 255, 255, 0.85); border: 1px solid var(--line);
  border-radius: var(--radius-md); padding: 0.9rem 1rem; box-shadow: var(--shadow-xs);
}
.stat-tile .val { font-size: 1.45rem; font-weight: 800; color: var(--accent); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-tile .lbl { font-size: 0.77rem; color: var(--ink-2); margin-top: 0.28rem; font-weight: 500; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  padding: 0.62rem 1.15rem; min-height: 42px; border-radius: var(--radius-sm);
  font-size: 0.89rem; font-weight: 600; border: 1px solid transparent;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: all 150ms var(--ease-out);
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:not(:disabled):active { transform: translateY(1px) scale(0.97); box-shadow: none; }
.btn-primary { background: var(--obsidian); color: #fff; box-shadow: 0 1.5px 0 rgba(15, 23, 42, 0.3); }
.btn-accent { background: var(--accent); color: #fff; box-shadow: 0 6px 18px -8px rgba(29, 63, 138, 0.55); }
.btn-success { background: var(--ok); color: #fff; box-shadow: 0 6px 16px -8px rgba(15, 118, 110, 0.5); }
.btn-outline {
  background: var(--surface); color: var(--ink); border-color: rgba(15, 23, 42, 0.2);
  box-shadow: 0 1.5px 0 rgba(15, 23, 42, 0.09), var(--shadow-xs);
}
.btn-amber { background: var(--amber-bg); color: var(--amber); border-color: var(--amber-border); box-shadow: 0 1.5px 0 rgba(194, 94, 0, 0.14); }
.btn-sm { padding: 0.42rem 0.82rem; min-height: 36px; font-size: 0.82rem; }

/* ===== CARDS & SECTIONS ===== */
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; margin: 2rem 0 1rem; flex-wrap: wrap;
}
.section-head h2 { margin: 0; font-size: 1.24rem; }
.section-head .sub { font-size: 0.85rem; color: var(--ink-2); }

.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(295px, 1fr)); gap: 0.95rem; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 1.25rem 1.35rem; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 0.65rem;
  transition: transform 180ms var(--ease-out), border-color 180ms var(--ease-out), box-shadow 180ms var(--ease-out);
}
.card-meta-row { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; font-size: 0.79rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.card-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.25rem; }

.tag {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.74rem; font-weight: 700;
}
.tag-blue { background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(29, 63, 138, 0.15); }
.tag-orange { background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-border); }
.tag-green { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok-border); }
.tag-red { background: var(--err-bg); color: var(--err); border: 1px solid var(--err-border); }

/* Notice banner about paper exam */
.paper-notice {
  background: var(--amber-bg); border: 1px solid var(--amber-border); border-left: 4px solid var(--amber);
  border-radius: var(--radius-md); padding: 0.95rem 1.2rem; margin-bottom: 1.5rem;
  font-size: 0.89rem; color: var(--ink);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}

/* ===== EXAM WORKSPACE ===== */
.exam-shell { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.exam-topbar {
  background: rgba(248, 248, 245, 0.92);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
  padding: 0.65rem 1.5rem; position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap;
}
.exam-left, .exam-controls { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.timer-box {
  display: inline-flex; align-items: center; gap: 0.38rem;
  background: var(--obsidian); color: #fff; padding: 0.36rem 0.85rem;
  border-radius: var(--radius-sm); font-weight: 700; font-size: 0.94rem; font-variant-numeric: tabular-nums;
}
.timer-box.warn { background: var(--amber); }
.timer-box.danger { background: var(--err); }

.task-stepper {
  max-width: var(--max); width: 100%; margin: 1.15rem auto 0; padding: 0 1.5rem;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.55rem;
}
.step-pill {
  background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 0.55rem 0.8rem; cursor: pointer; text-align: left;
  box-shadow: 0 1.5px 0 rgba(15, 23, 42, 0.08);
  transition: all 150ms var(--ease-out);
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
}
.step-pill:active { transform: translateY(1px); box-shadow: none; }
.step-pill.current { border-color: var(--accent); background: var(--sapphire-mist); box-shadow: 0 0 0 3px rgba(29, 63, 138, 0.12); }
.step-pill.graded-ok { border-color: var(--ok); }
.step-pill.graded-err { border-color: var(--err); }
.step-pill-title { font-size: 0.82rem; font-weight: 700; color: var(--ink); }
.step-pill-sub { font-size: 0.72rem; color: var(--ink-3); }

.exam-main {
  flex: 1; max-width: var(--max); width: 100%; margin: 1.1rem auto 2rem; padding: 0 1.5rem;
  display: grid; grid-template-columns: 0.92fr 1.18fr; gap: 1.25rem; align-items: start;
}

/* Left Panel: DUO Instruction Sheet */
.prompt-panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.45rem 1.55rem; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 0.95rem;
}
.prompt-title { margin: 0; font-size: 1.22rem; color: var(--ink); }
.prompt-context { font-size: 0.96rem; color: var(--ink); line-height: 1.58; }
.prompt-ru {
  font-size: 0.86rem; color: var(--ink-2); background: var(--bg);
  border-left: 3px solid var(--accent-border); padding: 0.6rem 0.85rem; border-radius: var(--radius-xs);
}
.bullets-box {
  background: var(--sapphire-mist); border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm); padding: 0.85rem 1.05rem;
}
.bullets-box h4 { margin: 0 0 0.45rem; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--accent); }
.bullets-box ul { margin: 0; padding-left: 1.15rem; font-size: 0.92rem; }
.bullets-box li { margin-bottom: 0.35rem; }
.bullets-box .bullet-ru { display: block; font-size: 0.82rem; color: var(--ink-2); }

.picture-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 0.65rem;
}
.picture-tile svg { width: 100%; height: auto; display: block; border-radius: 10px; }

/* Right Panel: Authentic DUO Writing Surface */
.sheet-panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.45rem 1.55rem; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 1rem;
}

/* Authentic DUO E-mail Frame */
.duo-email-frame {
  border: 1.5px solid #94a3b8; border-radius: 10px; overflow: hidden; background: #fff;
}
.duo-email-bar {
  background: #1d3f8a; color: #fff; padding: 0.48rem 0.9rem;
  font-size: 0.84rem; font-weight: 700; display: flex; justify-content: space-between; align-items: center;
}
.duo-email-meta {
  background: #f8fafc; border-bottom: 1px solid #cbd5e1;
  padding: 0.55rem 0.9rem; font-size: 0.83rem; display: grid; grid-template-columns: 82px 1fr; gap: 0.25rem 0.6rem;
}
.duo-email-meta .k { color: var(--ink-3); font-weight: 700; }
.duo-email-body { padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: 0.65rem; }
.duo-fixed-line { font-size: 0.96rem; font-weight: 600; color: var(--ink); white-space: pre-line; }

/* Authentic DUO Form Table */
.duo-form-frame { border: 1.5px solid #94a3b8; border-radius: 10px; overflow: hidden; background: #fff; }
.duo-form-head { background: #1e293b; color: #fff; padding: 0.6rem 1rem; font-weight: 700; font-size: 0.92rem; }
.duo-form-row { padding: 0.72rem 1rem; border-bottom: 1px solid #e2e8f0; display: flex; flex-direction: column; gap: 0.35rem; }
.duo-form-row:last-child { border-bottom: none; }
.duo-form-label { font-size: 0.86rem; font-weight: 700; color: var(--ink); }
.duo-form-label-ru { font-size: 0.78rem; color: var(--ink-3); font-weight: 500; }
.duo-radio-list { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.15rem; }
.duo-radio-opt {
  display: flex; align-items: center; gap: 0.55rem; padding: 0.45rem 0.65rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius-xs); cursor: pointer; font-size: 0.88rem;
  transition: background-color 140ms var(--ease-out), border-color 140ms var(--ease-out);
}
.duo-radio-opt.selected { background: var(--sapphire-mist); border-color: var(--accent); font-weight: 600; }

/* Inputs / Writing Textarea */
.write-textarea, .write-input {
  width: 100%; border: 1.5px solid #cbd5e1; border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem; font-size: 0.98rem; line-height: 1.6;
  color: var(--ink); background: #fff;
  transition: border-color 150ms var(--ease-out), box-shadow 150ms var(--ease-out);
}
.write-textarea { min-height: 175px; resize: vertical; }
.write-textarea.compact { min-height: 82px; }
.write-textarea:focus, .write-input:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(29, 63, 138, 0.13);
}
.sig-row { display: flex; align-items: center; gap: 0.6rem; max-width: 300px; }

.write-statusbar {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap;
  font-size: 0.8rem; color: var(--ink-3); font-variant-numeric: tabular-nums;
}

/* Action & Grading Bar */
.check-actions { display: flex; gap: 0.55rem; flex-wrap: wrap; align-items: center; }
.photo-upload-label {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.42rem 0.82rem; min-height: 36px; border-radius: var(--radius-sm);
  font-size: 0.82rem; font-weight: 600; cursor: pointer;
  background: var(--surface); color: var(--ink); border: 1px solid rgba(15, 23, 42, 0.2);
  box-shadow: 0 1.5px 0 rgba(15, 23, 42, 0.09);
}
.photo-preview {
  display: flex; align-items: center; gap: 0.75rem; background: var(--bg);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 0.55rem 0.75rem;
}
.photo-preview img { width: 72px; height: 54px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }

/* ===== EVALUATION / RUBRIC CARD ===== */
.eval-box {
  border-radius: var(--radius-md); border: 1px solid var(--line-strong);
  background: #fafaf8; padding: 1.15rem 1.25rem;
  display: flex; flex-direction: column; gap: 0.85rem;
  animation: fadeSlideUp 180ms var(--ease-out);
}
.eval-box.pass { border-left: 4px solid var(--ok); background: #f3fbf8; }
.eval-box.fail { border-left: 4px solid var(--err); background: #fff6f6; }
.eval-box.neutral { border-left: 4px solid var(--accent); background: #f8faff; }

.rubric-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.5rem;
}
.rubric-cell {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem; display: flex; flex-direction: column; gap: 0.32rem;
}
.rubric-cell-head { display: flex; justify-content: space-between; font-size: 0.76rem; font-weight: 700; color: var(--ink-2); }
.rubric-btns { display: flex; gap: 4px; }
.rubric-pt-btn {
  flex: 1; padding: 0.26rem 0; border-radius: 6px; border: 1px solid var(--line-strong);
  background: var(--bg); font-size: 0.78rem; font-weight: 700; cursor: pointer; color: var(--ink);
  transition: all 130ms var(--ease-out);
}
.rubric-pt-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.rubric-pt-btn.active.zero { background: var(--err); border-color: var(--err); }

.check-list { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.85rem; }
.check-item { padding: 0.38rem 0.6rem; border-radius: var(--radius-xs); }
.check-item.ok { background: var(--ok-bg); color: var(--ok); }
.check-item.warn { background: var(--amber-bg); color: var(--amber); }
.check-item.err { background: var(--err-bg); color: var(--err); }

.model-box {
  background: #fff; border: 1px solid var(--accent-border); border-radius: var(--radius-sm);
  padding: 0.85rem 1rem; font-size: 0.88rem;
}
.model-box-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-bottom: 0.45rem; }

.correction-item {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-xs);
  padding: 0.55rem 0.75rem; font-size: 0.84rem;
}
.correction-item .bad { color: var(--err); text-decoration: line-through; }
.correction-item .good { color: var(--ok); font-weight: 700; }

/* ===== DRILLS & PHRASE BANK ===== */
.drill-option {
  width: 100%; text-align: left; padding: 0.75rem 0.95rem;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); cursor: pointer; font-size: 0.92rem; font-weight: 500;
  box-shadow: 0 1.5px 0 rgba(15, 23, 42, 0.07);
  transition: all 140ms var(--ease-out);
}
.drill-option.correct { border-color: var(--ok); background: var(--ok-bg); color: var(--ok); font-weight: 700; }
.drill-option.wrong { border-color: var(--err); background: var(--err-bg); color: var(--err); }

.phrase-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 0.65rem;
  padding: 0.62rem 0; border-bottom: 1px solid var(--line);
}
.phrase-row:last-child { border-bottom: none; }

/* ===== MODAL ===== */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(5px); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 1.25rem;
}
.modal-card {
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius);
  max-width: 560px; width: 100%; max-height: 88dvh; overflow-y: auto;
  box-shadow: var(--shadow-lg); padding: 1.5rem 1.65rem;
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 0.8rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 1.12rem; }

/* ===== RESULTS BANNER ===== */
.result-banner {
  border-radius: var(--radius); padding: 1.8rem 2.1rem; border: 1px solid var(--line-strong);
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap;
  margin-bottom: 1.5rem; box-shadow: var(--shadow-sm);
}
.result-banner.passed { background: #edf9f5; border-color: var(--ok-border); }
.result-banner.passed h1, .result-banner.passed .big-grade { color: var(--ok); }
.result-banner.failed { background: #fff5f5; border-color: var(--err-border); }
.result-banner.failed h1, .result-banner.failed .big-grade { color: var(--err); }
.result-banner.neutral { background: var(--sapphire-mist); border-color: var(--accent-border); }
.result-banner.neutral h1, .result-banner.neutral .big-grade { color: var(--accent); }
.big-grade { font-size: 2.75rem; font-weight: 800; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }

/* ===== COMPACT SITE FOOTER ===== */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  margin-top: 1.5rem;
}
.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.35rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-size: 0.83rem;
  color: var(--ink-2);
}
.footer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  flex-wrap: wrap;
}
.footer-links {
  display: flex;
  align-items: center;
  gap: 0.95rem;
  flex-wrap: wrap;
}
.footer-links a {
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 600;
  transition: color 150ms var(--ease-out);
}
.footer-links a:hover { color: var(--accent); text-decoration: underline; }
.footer-disclaimer {
  font-size: 0.77rem;
  color: var(--ink-3);
}
.footer-disclaimer a { color: var(--accent); text-decoration: none; }
.footer-disclaimer a:hover { text-decoration: underline; }

/* ===== HOVER (HOVER-CAPABLE ONLY) ===== */
@media (hover: hover) {
  .nav-tab:not(.active):hover { background: rgba(255, 255, 255, 0.65); color: var(--ink); }
  .lang-btn:not(.active):hover { background: rgba(255, 255, 255, 0.75); color: var(--ink); }
  .lang-pill:hover, .btn-outline:hover, .photo-upload-label:hover { border-color: var(--accent); color: var(--accent); background: #f8faff; transform: translateY(-1px); }
  .btn:not(:disabled):hover { transform: translateY(-1px); }
  .btn-primary:hover { background: #1e293b; }
  .btn-accent:hover { background: var(--accent-hover); }
  .card:hover { border-color: var(--accent-border); box-shadow: var(--shadow-md); }
  .step-pill:hover { border-color: var(--accent); }
  .drill-option:not(.correct):not(.wrong):hover { border-color: var(--accent); background: #f8faff; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 920px) {
  .hero-card { grid-template-columns: 1fr; padding: 1.45rem; }
  .hero-stats-grid { border-left: 0; padding-left: 0; border-top: 1px solid rgba(29, 63, 138, 0.16); padding-top: 1.15rem; }
  .exam-main { grid-template-columns: 1fr; }
  .task-stepper { grid-template-columns: repeat(2, 1fr); }
}

/* ===== AUTHENTIC DUO A4 PAPER BOOKLET PRINT MODE ===== */
@page {
  size: A4 portrait;
  margin: 12mm;
}
@media print {
  html, body { margin: 0 !important; padding: 0 !important; background: #fff !important; }
  #app { display: none !important; }
  .print-only { display: block !important; color: #000; font-family: Arial, Helvetica, sans-serif; font-size: 10.5pt; line-height: 1.42; }
  .print-page {
    box-sizing: border-box;
    height: 266mm;
    max-height: 266mm;
    padding: 2mm 0;
    display: flex;
    flex-direction: column;
    break-after: page;
    page-break-after: always;
    break-inside: avoid;
    page-break-inside: avoid;
    overflow: hidden;
  }
  .print-page:last-child { break-after: auto; page-break-after: auto; }
  .print-cover { justify-content: flex-start; padding-top: 24mm; }
  .print-cover h2 { margin: 0 0 6mm; font-size: 16pt; }
  .print-cover p { margin: 0 0 4mm; }
  .print-page h3 { margin: 0 0 2.5mm; font-size: 13pt; }
  .print-page p { margin: 0 0 2.5mm; }
  .print-page ul { margin: 0 0 2.5mm; padding-left: 5.5mm; }
  .print-page li { margin-bottom: 1mm; }
  .print-box {
    flex: 1 1 auto;
    min-height: 85mm;
    border: 1.5px solid #000;
    padding: 7mm 8mm;
    margin-top: 4mm;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-sizing: border-box;
  }
  .print-box-top p, .print-box-bottom p { margin: 0 0 2mm; }
  .print-box-bottom p:last-child { margin-bottom: 0; }
  .print-form-table { width: 100%; border-collapse: collapse; margin-top: 3mm; font-size: 9.8pt; }
  .print-form-table td, .print-form-table th { border: 1px solid #000; padding: 2.5mm 3mm; text-align: left; vertical-align: top; }
  .print-form-table th { background: #f1f5f9 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-form-table .open-cell { height: 22mm; }
  .print-pics { display: flex; gap: 6mm; margin: 3mm 0 3.5mm; flex-wrap: nowrap; }
  .print-pics svg { width: 42mm; max-height: 29mm; height: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
