/* ============================================================
   style.css — Online Test Platform Design System
   Aesthetic: Clean academic/editorial — dark navy with amber accents
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Roboto+Slab:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* ─── Design Tokens ────────────────────────────────────────── */
:root {
  --bg: #fafbfc;
  --bg-surface: #ffffff;
  --bg-elevated: #f3f4f6;
  --bg-card: #ffffff;
  --border: #d1d5db;
  --border-active: #2563eb;

  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;

  --accent: #2563eb;
  --accent-dim: rgba(37, 99, 235, 0.1);
  --accent-hover: #1d4ed8;

  --green: #059669;
  --green-dim: rgba(5, 150, 105, 0.1);
  --red: #dc2626;
  --red-dim: rgba(220, 38, 38, 0.1);
  --blue: #2563eb;
  --blue-dim: rgba(37, 99, 235, 0.1);
  --orange: #d97706;
  --purple: #7c3aed;

  --radius: 8px;
  --radius-lg: 12px;
  --font-display: 'Inter', sans-serif;
  --font-heading: 'Roboto Slab', serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  --shadow: 0 4px 20px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.12);

  --timer-warning: #d97706;
  --timer-danger: #dc2626;
}

/* ─── Reset & Base ──────────────────────────────────────────── */
*, *::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-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  background: linear-gradient(135deg, #f8fafc 0%, #eef2f6 100%);
}

/* ─── Page Sections ─────────────────────────────────────────── */
.page-section { display: none; min-height: 100vh; }
.page-section.active { display: block; }

/* ─── Header / Nav ──────────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.header-logo {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: #1e40af;
  letter-spacing: -0.3px;
  flex-shrink: 0;
}

.header-logo span { color: var(--text-secondary); font-weight: 400; }

.header-info {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
}

.header-user {
  font-size: 13px;
  color: var(--text-secondary);
}

.header-camera-preview {
  width: 64px;
  height: 42px;
  flex: 0 0 auto;
  object-fit: cover;
  background: #0f172a;
  border: 1px solid var(--border);
  border-radius: 6px;
}

/* ─── Timer ─────────────────────────────────────────────────── */
.timer-block {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 14px;
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 2px;
  color: var(--text-primary);
  transition: all 0.3s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.timer-block .timer-icon { font-size: 14px; }
.timer-block.warning { color: var(--timer-warning); border-color: var(--timer-warning); background: rgba(227, 179, 65, 0.08); }
.timer-block.danger { color: var(--timer-danger); border-color: var(--timer-danger); background: rgba(248, 81, 73, 0.08); animation: pulse-timer 1s infinite; }

@keyframes pulse-timer {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ─── Section Nav Tabs ──────────────────────────────────────── */
.section-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 4px;
}

.section-tab {
  padding: 5px 14px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-display);
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text-secondary);
  border: none;
  background: none;
  letter-spacing: 0.3px;
}

.section-tab:hover { color: var(--text-primary); background: var(--bg-elevated); }
.section-tab.active { background: var(--accent); color: #ffffff; }

/* ─── Welcome Page ──────────────────────────────────────────── */
.welcome-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 60px 24px;
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 60px;
  align-items: start;
}

.welcome-hero h1.hero-title {
  font-family: var(--font-display);
  font-size: clamp(40px, 9vw, 55px);
  font-weight: 500;
  line-height: 1.02;
  margin-bottom: 12px;
  letter-spacing: -0.9px;
  color: #56575a;
  max-width: 620px;
}

.welcome-hero h2.hero-subtitle {
  font-family: var(--font-display);
  font-size: clamp(24px, 5vw, 38px);
  font-weight: 500;
  line-height: 1.18;
  margin-bottom: 20px;
  color: var(--text-secondary);
  letter-spacing: -0.4px;
  max-width: 620px;
}

.welcome-hero h2.hero-subtitle .highlight {
  color: var(--accent);
}

.welcome-hero .subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 40px;
  max-width: 560px;
  line-height: 1.7;
}

.instructions-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.instructions-header {
  background: var(--accent);
  padding: 16px 20px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #ffffff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.instructions-body {
  padding: 20px;
}

.instruction-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.instruction-item:last-child { border-bottom: none; }

.instruction-item .icon {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

.test-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 24px 0;
}

.meta-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.meta-card .value {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 500;
  color: var(--accent);
  display: block;
  margin-bottom: 4px;
}

.meta-card .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 600;
}

/* ─── Auth Form ─────────────────────────────────────────────── */
.auth-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  position: sticky;
  top: 80px;
  box-shadow: var(--shadow-lg);
}

.auth-card h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.auth-card .auth-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 16px;
}

.form-note {
  font-size: 13px;
  color: var(--text-secondary);
  margin: -8px 0 18px;
  line-height: 1.5;
  padding-left: 4px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
  font-family: var(--font-display);
}

.form-group input,
.form-group textarea {
  width: 100%;
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--text-primary);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
  background: #ffffff;
}

.form-group input::placeholder { color: var(--text-muted); }

.auth-toggle {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-secondary);
}

.auth-toggle a {
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
}

.auth-toggle a:hover { color: var(--accent-hover); }

.auth-error {
  background: var(--red-dim);
  border: 1px solid var(--red);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--red);
  margin-bottom: 16px;
  display: none;
}

.auth-error.show { display: block; }

/* ─── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  outline: none;
  letter-spacing: 0.2px;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  width: 100%;
  padding: 12px;
  font-size: 15px;
}

.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(37,99,235,0.3); }
.btn-primary:active { transform: translateY(0); }

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover { border-color: var(--text-secondary); background: var(--bg-elevated); }

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn-outline:hover { background: var(--accent-dim); }

.btn-danger {
  background: var(--red);
  color: white;
}

.btn-danger:hover { background: #ff6b6b; }

.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }

/* ─── MCQ Section ───────────────────────────────────────────── */
.test-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 0;
  min-height: calc(100vh - 60px);
}

.test-main {
  padding: 32px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  background: #ffffff;
}

.test-sidebar {
  padding: 24px 20px;
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
}

.question-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}

.question-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 10px;
  background: var(--bg-elevated);
  border-radius: 4px;
  border: 1px solid var(--border);
  flex-shrink: 0;
  margin-top: 4px;
}

.question-section-tag {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--blue);
  background: var(--blue-dim);
  padding: 3px 10px;
  border-radius: 4px;
}

.question-text {
  font-size: 18px;
  font-weight: 400;
  line-height: 1.7;
  color: var(--text-primary);
  margin-bottom: 28px;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 32px;
}

.option-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  background: #ffffff;
}

.option-item:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.option-item.selected {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.option-item.selected .option-letter {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.option-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
  transition: all 0.15s;
  color: var(--text-secondary);
}

.option-text {
  font-size: 14px;
  line-height: 1.5;
  padding-top: 4px;
}

.question-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* ─── Question Palette ──────────────────────────────────────── */
.palette-title {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.palette-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 20px;
}

.palette-btn {
  aspect-ratio: 1;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.1s;
  background: #ffffff;
  color: var(--text-secondary);
}

.palette-btn:hover { border-color: var(--text-secondary); color: var(--text-primary); }
.palette-btn.current { border-color: var(--blue); color: var(--blue); background: var(--blue-dim); }
.palette-btn.answered { background: var(--green-dim); border-color: var(--green); color: var(--green); }
.palette-btn.flagged { background: rgba(227,179,65,0.12); border-color: var(--orange); color: var(--orange); }
.palette-btn.flagged-answered { background: rgba(227,179,65,0.2); border-color: var(--orange); color: var(--orange); }

.palette-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
  padding: 14px;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-secondary);
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.legend-dot.answered { background: var(--green); }
.legend-dot.unanswered { background: var(--bg-elevated); border: 1px solid var(--border); }
.legend-dot.flagged { background: var(--orange); }
.legend-dot.current { background: var(--blue); }

.palette-stats {
  background: var(--bg-surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 14px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 12px;
}

.stat-row .stat-label { color: var(--text-secondary); }
.stat-row .stat-val { font-family: var(--font-mono); font-weight: 600; color: var(--text-primary); }
.stat-row .stat-val.green { color: var(--green); }
.stat-row .stat-val.orange { color: var(--orange); }

/* ─── Coding Section ────────────────────────────────────────── */
.coding-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: calc(100vh - 60px);
}

.problem-panel {
  padding: 32px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  max-height: calc(100vh - 60px);
  background: #ffffff;
}

.editor-panel {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 60px);
}

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  flex-shrink: 0;
}

.language-label {
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--text-primary);
  white-space: nowrap;
}

.language-label strong {
  color: var(--accent);
}

.language-select {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}

.language-select:focus { border-color: var(--accent); }

.editor-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.save-status {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 6px;
}

.save-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.3s;
}

.save-dot.saving { background: var(--orange); animation: blink 0.8s infinite; }
.save-dot.saved { background: var(--green); }

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.code-editor {
  flex: 1;
  background: #ffffff;
  border: none;
  color: #1f2937;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.7;
  padding: 20px;
  resize: none;
  outline: none;
  tab-size: 2;
  width: 100%;
  min-height: 400px;
  border: 1px solid var(--border);
}

.code-editor::placeholder { color: #484f58; }

.problem-nav {
  display: flex;
  gap: 6px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.prob-nav-btn {
  padding: 6px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 12px;
  font-family: var(--font-display);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  background: #ffffff;
  color: var(--text-secondary);
}

.prob-nav-btn:hover { border-color: var(--text-secondary); color: var(--text-primary); }
.prob-nav-btn.active { background: var(--green-dim); border-color: var(--green); color: var(--green); }
.prob-nav-btn.attempted { background: var(--green-dim); border-color: var(--green); color: var(--green); }

.problem-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
}

.difficulty-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}

.difficulty-tag.easy { background: var(--green-dim); color: var(--green); }
.difficulty-tag.medium { background: rgba(227,179,65,0.15); color: var(--orange); }
.difficulty-tag.hard { background: var(--red-dim); color: var(--red); }

.problem-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 24px;
}

.problem-desc code {
  font-family: var(--font-mono);
  background: var(--bg-card);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--accent);
}

.examples-section { margin-bottom: 24px; }

.examples-section h4 {
  font-family: var(--font-display);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-weight: 700;
}

.example-block {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  font-family: var(--font-mono);
  font-size: 13px;
}

.example-block .ex-row { margin-bottom: 4px; color: var(--text-secondary); }
.example-block .ex-row strong { color: var(--text-primary); }
.example-block .ex-row .ex-val { color: var(--green); }
.example-block .ex-note { font-size: 11px; color: var(--text-muted); margin-top: 6px; font-family: var(--font-body); }

.constraints-list {
  list-style: none;
  padding: 0;
}

.constraints-list li {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  padding: 3px 0;
}

.constraints-list li::before {
  content: '• ';
  color: var(--accent);
}

/* ─── Submit Page ───────────────────────────────────────────── */
.submit-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 60px 24px;
}

.submit-page h1 {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
  color: #111827;
}

.submit-page .sub {
  color: var(--text-secondary);
  margin-bottom: 40px;
  font-size: 15px;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 32px;
}

.summary-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.summary-card h3 {
  font-family: var(--font-display);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 16px;
  font-weight: 700;
}

.summary-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.summary-stat:last-child { border-bottom: none; }
.summary-stat .s-label { color: var(--text-secondary); }
.summary-stat .s-val { font-family: var(--font-mono); font-weight: 600; }
.summary-stat .s-val.green { color: var(--green); }
.summary-stat .s-val.red { color: var(--red); }
.summary-stat .s-val.orange { color: var(--orange); }

.confirm-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.confirm-box h3 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
}

.warning-list {
  list-style: none;
  margin-bottom: 20px;
}

.warning-list li {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 5px 0;
  display: flex;
  gap: 8px;
}

.warning-list li::before { content: '⚠️'; }

.confirm-check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  font-size: 14px;
}

.confirm-check input[type=checkbox] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  flex-shrink: 0;
  margin-top: 2px;
  cursor: pointer;
}

.submit-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* ─── Submitted State ───────────────────────────────────────── */
.submitted-banner {
  background: var(--green-dim);
  border: 1px solid var(--green);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
}

.submitted-banner h2 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  color: var(--green);
  margin-bottom: 12px;
}

.submitted-banner p {
  color: var(--text-secondary);
  font-size: 15px;
}

/* ─── Loading Spinner ───────────────────────────────────────── */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Tab Warning ───────────────────────────────────────────── */
#tab-warning {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.tab-warning-inner {
  background: var(--red);
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-lg);
}

.tab-warning-inner button {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

/* ─── Toast Notification ────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  max-width: 320px;
}

.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--blue); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ─── Progress Bar ──────────────────────────────────────────── */
.progress-bar-wrap {
  height: 3px;
  background: var(--bg-elevated);
  border-radius: 2px;
  margin-bottom: 20px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 900px) {
  .welcome-page { grid-template-columns: 1fr; }
  .auth-card { position: static; }
  .test-layout { grid-template-columns: 1fr; }
  .test-sidebar { position: static; height: auto; border-top: 1px solid var(--border); background: #f9fafb; }
  .coding-layout { grid-template-columns: 1fr; }
  .problem-panel { max-height: none; border-right: none; border-bottom: 1px solid var(--border); background: #ffffff; }
  .editor-panel { max-height: 500px; }
  .summary-grid { grid-template-columns: 1fr; }
  .section-tabs { display: none; }
  .header-logo span { display: none; }
}

@media (max-width: 600px) {
  .test-main { padding: 20px 16px; }
  .submit-page { padding: 32px 16px; }
  .submit-actions { flex-direction: column; }
  .welcome-page { padding: 32px 16px; }
  .header-camera-preview { width: 48px; height: 32px; }
}

/* ─── Utility ───────────────────────────────────────────────── */
.hidden { display: none !important; }

.proctoring-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.72);
}
.proctoring-dialog, .camera-block-card {
  width: min(620px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 24px;
  border-radius: 16px;
  background: var(--bg-surface);
  box-shadow: var(--shadow-lg);
}
.proctoring-dialog h2 { margin-bottom: 10px; }
.proctoring-dialog > p, #proctoring-face-status { margin-bottom: 12px; color: var(--text-secondary); }
#proctoring-setup-message.error { color: var(--red); }
.proctoring-dialog label { display: block; margin: 12px 0 6px; font-weight: 600; }
.proctoring-otp-actions, .proctoring-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.proctoring-otp-actions input { min-width: 130px; flex: 1 1 130px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); }
#proctoring-preview { display: block; width: min(100%, 480px); max-height: 360px; margin: 12px auto; border-radius: var(--radius-lg); background: #0f172a; object-fit: cover; }
.proctoring-captured-photo { display: block; width: 120px; height: 120px; margin: 0 auto 12px; border-radius: 50%; object-fit: cover; }
.camera-block-overlay { position: fixed; inset: 0; z-index: 2500; display: grid; place-items: center; padding: 18px; background: rgba(15, 23, 42, 0.88); }
.camera-block-card { text-align: center; }
.camera-block-card strong { display: block; margin-bottom: 8px; font-size: 1.25rem; }
.camera-block-card p { margin-bottom: 16px; }
.mt-16 { margin-top: 16px; }
.text-muted { color: var(--text-secondary); }
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
