/* ==========================================================================
   MODERN ASSESSMENT PLATFORM - DESIGN SYSTEM & STYLESHEET
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Color Palette - Dark Slate & Electric Accents */
  --bg-primary: #0a0e17;
  --bg-secondary: #101726;
  --bg-card: #151f32;
  --bg-card-hover: #1c2a44;
  --bg-glass: rgba(21, 31, 50, 0.85);
  
  --border-subtle: #223049;
  --border-strong: #33476a;
  --border-focus: #4f46e5;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0b1120;

  --accent-primary: #4f46e5;
  --accent-primary-hover: #6366f1;
  --accent-gradient: linear-gradient(135deg, #4f46e5 0%, #3b82f6 50%, #06b6d4 100%);
  --accent-glow: rgba(79, 70, 229, 0.25);

  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --success-border: rgba(16, 185, 129, 0.35);

  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --warning-border: rgba(245, 158, 11, 0.35);

  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --danger-border: rgba(239, 68, 68, 0.35);

  --review: #a855f7;
  --review-bg: rgba(168, 85, 247, 0.15);
  --review-border: rgba(168, 85, 247, 0.4);

  --cyan: #06b6d4;
  --cyan-bg: rgba(6, 182, 212, 0.12);

  /* Elevation Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 24px var(--accent-glow);

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Typography */
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Layout */
  --header-height: 72px;
  --sidebar-width: 320px;
  --transition-fast: 0.15s ease;
  --transition-smooth: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Global */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  height: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Subtle background glowing mesh */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 20%;
  width: 60vw;
  height: 40vh;
  background: radial-gradient(circle, rgba(79, 70, 229, 0.08) 0%, transparent 70%);
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}

/* Container */
.app-container {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   HEADER / TOP NAVBAR
   ========================================================================== */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  transition: var(--transition-smooth);
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
  cursor: pointer;
}

.brand-icon {
  width: 38px;
  height: 38px;
  background: var(--accent-gradient);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow);
}

.brand-icon svg {
  width: 22px;
  height: 22px;
  fill: #ffffff;
}

.brand-name {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 40%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-tag {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--accent-glow);
  color: var(--cyan);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Action Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition-smooth);
  text-decoration: none;
  user-select: none;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #4338ca 0%, #2563eb 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.5);
}

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

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
  color: #ffffff;
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-subtle);
}

.btn-outline:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-warning {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: var(--warning-border);
}

.btn-warning:hover:not(:disabled) {
  background: rgba(245, 158, 11, 0.2);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-border);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.25);
}

.btn-success {
  background: var(--success);
  color: #ffffff;
}

.btn-success:hover:not(:disabled) {
  background: #059669;
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 0.9rem 2rem;
  font-size: 1.05rem;
}

/* ==========================================================================
   VIEW CONTAINERS
   ========================================================================== */
.view-section {
  display: none;
  flex: 1;
  width: 100%;
}

.view-section.active {
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   VIEW 1: REGISTRATION & ONBOARDING
   ========================================================================== */
.registration-container {
  max-width: 1080px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  width: 100%;
}

.hero-banner {
  text-align: center;
  margin-bottom: 2.5rem;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(79, 70, 229, 0.12);
  border: 1px solid rgba(79, 70, 229, 0.3);
  padding: 0.35rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-primary-hover);
  margin-bottom: 1.25rem;
}

.hero-pill-dot {
  width: 8px;
  height: 8px;
  background: var(--cyan);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--cyan);
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 1rem;
}

.hero-highlight {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 680px;
  margin: 0 auto;
}

.registration-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-label-required {
  color: var(--danger);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-muted);
  pointer-events: none;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.form-input {
  width: 100%;
  background: var(--bg-secondary);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem 0.85rem 2.85rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--text-primary);
  outline: none;
  transition: var(--transition-smooth);
}

.form-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px var(--accent-glow);
  background: #111a2e;
}

.form-input.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px var(--danger-bg);
}

.input-error-msg {
  font-size: 0.8rem;
  color: var(--danger);
  min-height: 1.2rem;
  display: none;
}

.input-error-msg.visible {
  display: block;
}

/* Field Selection Cards */
.tracks-selection-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.track-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.track-card {
  position: relative;
  background: var(--bg-secondary);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.track-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.track-card.selected {
  border-color: var(--accent-primary);
  background: rgba(79, 70, 229, 0.08);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.track-card input[type="radio"] {
  position: absolute;
  opacity: 0;
}

.track-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.track-badge-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.track-badge-icon svg {
  width: 24px;
  height: 24px;
}

.track-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.track-card.selected .track-check {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.track-check svg {
  width: 14px;
  height: 14px;
  fill: #ffffff;
  display: none;
}

.track-card.selected .track-check svg {
  display: block;
}

.track-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: var(--text-primary);
}

.track-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1.2rem;
  line-height: 1.45;
}

.track-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tech-tag {
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
}

/* Track Color Variances */
.track-da .track-badge-icon {
  background: rgba(6, 182, 212, 0.15);
  color: #06b6d4;
}
.track-cs .track-badge-icon {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}
.track-fs .track-badge-icon {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

/* Assessment Guidelines List */
.rules-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
}

.rules-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.rule-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.rule-icon {
  color: var(--accent-primary-hover);
  flex-shrink: 0;
  margin-top: 2px;
}

.rule-text strong {
  display: block;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.rule-text span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.start-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

.disclaimer-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* ==========================================================================
   VIEW 2: TEST ENGINE / ASSESSMENT PORTAL
   ========================================================================== */
.test-view-container {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--header-height));
}

/* Sub-Header / Test Control Bar */
.test-control-bar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  position: sticky;
  top: var(--header-height);
  z-index: 90;
}

.test-candidate-info {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.candidate-avatar {
  width: 38px;
  height: 38px;
  background: var(--accent-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: #ffffff;
}

.candidate-meta h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.candidate-meta p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.test-progress-center {
  flex: 1;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.progress-bar-track {
  height: 8px;
  background: var(--bg-primary);
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-gradient);
  border-radius: var(--radius-full);
  transition: width 0.35s ease;
}

.test-stats-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* 30-Minute Timer Badge */
.timer-badge {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-primary);
  border: 1.5px solid var(--border-strong);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.05em;
  transition: var(--transition-fast);
}

.timer-badge.warning {
  border-color: var(--warning);
  color: var(--warning);
  background: var(--warning-bg);
  animation: pulseTimer 1.5s infinite;
}

.timer-badge.danger {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-bg);
  animation: pulseTimerFast 0.8s infinite;
}

@keyframes pulseTimer {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

@keyframes pulseTimerFast {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Two-column Test Portal Layout */
.test-layout {
  display: flex;
  flex: 1;
  width: 100%;
  position: relative;
}

.question-canvas {
  flex: 1;
  padding: 2rem;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.question-header-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.q-indices {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.q-number-pill {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
}

.q-meta-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-easy {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-foundational {
  background: rgba(6, 182, 212, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.badge-hard {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-medium {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-expert {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.badge-category {
  background: rgba(79, 70, 229, 0.15);
  color: #818cf8;
  border: 1px solid rgba(79, 70, 229, 0.3);
}

/* Question Text & Code Snippet Box */
.question-prompt {
  font-size: 1.18rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.code-container {
  background: #060910;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 1.75rem;
  overflow: hidden;
}

.code-header {
  background: #0d131f;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.code-dots {
  display: flex;
  gap: 6px;
}

.code-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.dot-red { background: #ef4444; }
.dot-yellow { background: #f59e0b; }
.dot-green { background: #10b981; }

.code-lang-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.code-pre {
  padding: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: #e2e8f0;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Options Selector List */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 2.5rem;
}

.option-item {
  position: relative;
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  gap: 1rem;
  user-select: none;
}

.option-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
  transform: translateX(4px);
}

.option-item.selected {
  background: rgba(79, 70, 229, 0.12);
  border-color: var(--accent-primary-hover);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.option-key {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: var(--transition-fast);
}

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

.option-text {
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.5;
  flex: 1;
}

/* Bottom Question Action Controls */
.question-nav-bar {
  margin-top: auto;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav-left-group {
  display: flex;
  gap: 0.75rem;
}

.nav-right-group {
  display: flex;
  gap: 0.75rem;
}

/* Keyboard Hints Row */
.shortcuts-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.75rem;
}

.kbd-badge {
  background: var(--bg-secondary);
  border: 1px solid var(--border-strong);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-secondary);
}

/* Question Palette Sidebar */
.palette-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-subtle);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  max-height: calc(100vh - var(--header-height) - 58px);
}

.palette-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Palette Legend */
.palette-legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.76rem;
  color: var(--text-secondary);
}

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

.ind-answered { background: var(--success); }
.ind-unanswered { background: var(--bg-card); border: 1px solid var(--border-strong); }
.ind-marked { background: var(--warning); }
.ind-current { background: var(--accent-primary); box-shadow: 0 0 6px var(--accent-primary); }

/* Palette Numbers Grid */
.palette-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.palette-btn {
  height: 40px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
  position: relative;
}

.palette-btn:hover {
  border-color: var(--border-strong);
  color: #ffffff;
}

.palette-btn.active {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--accent-glow);
  font-weight: 800;
  color: #ffffff;
}

.palette-btn.answered {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success);
}

.palette-btn.marked {
  background: var(--warning-bg);
  border-color: var(--warning-border);
  color: var(--warning);
}

.palette-btn.marked::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warning);
}

.palette-submit-btn {
  margin-top: auto;
  width: 100%;
}

/* Mobile Drawer Controls */
.mobile-palette-toggle {
  display: none;
  align-items: center;
  gap: 0.4rem;
}

.drawer-close-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.25rem;
}

/* ==========================================================================
   VIEW 3: RESULTS & EXPLANATIONS
   ========================================================================== */
.results-container {
  max-width: 1080px;
  margin: 2rem auto;
  padding: 0 1.5rem 4rem;
  width: 100%;
}

.results-hero-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-lg);
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2.5rem;
  align-items: center;
}

.score-visual-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.score-circle {
  width: 170px;
  height: 170px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, #182338 0%, #0d1424 100%);
  border: 6px solid var(--accent-primary);
  box-shadow: 0 0 25px var(--accent-glow);
  margin-bottom: 1rem;
}

.score-number {
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1;
  color: #ffffff;
}

.score-total {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 600;
}

.score-status-badge {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.35rem 1rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-passed {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.badge-failed {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.score-details-col {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.candidate-summary-header {
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 1rem;
}

.candidate-summary-header h2 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
}

.candidate-summary-header p {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.stats-metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.metric-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.metric-card-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.metric-card-val {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.results-action-row {
  display: flex;
  gap: 1rem;
}

/* Question Review Section */
.review-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.review-filter-tabs {
  display: flex;
  background: var(--bg-card);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.review-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.45rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.review-tab-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
}

.review-cards-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.review-item-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.review-item-card.is-correct {
  border-left: 5px solid var(--success);
}

.review-item-card.is-incorrect {
  border-left: 5px solid var(--danger);
}

.review-item-card.is-unanswered {
  border-left: 5px solid var(--warning);
}

.review-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.review-status-tag {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
}

.tag-correct {
  background: var(--success-bg);
  color: var(--success);
}

.tag-wrong {
  background: var(--danger-bg);
  color: var(--danger);
}

.tag-skipped {
  background: var(--warning-bg);
  color: var(--warning);
}

.review-prompt {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.55;
  margin-bottom: 1rem;
}

.review-options-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.review-opt {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
}

.review-opt.user-chosen-wrong {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: #fca5a5;
}

.review-opt.correct-answer {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: #86efac;
  font-weight: 600;
}

/* Explanation Box */
.explanation-box {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(79, 70, 229, 0.3);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.explanation-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--cyan);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.explanation-content {
  font-size: 0.9rem;
  color: #cbd5e1;
  line-height: 1.6;
}

/* ==========================================================================
   VIEW 4: ADMIN DASHBOARD
   ========================================================================== */
.admin-container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1.5rem 4rem;
  width: 100%;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.admin-title-group h2 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
}

.admin-title-group p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.admin-top-actions {
  display: flex;
  gap: 0.75rem;
}

/* KPI Summary Cards */
.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-icon.kpi-blue { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.kpi-icon.kpi-green { background: var(--success-bg); color: var(--success); }
.kpi-icon.kpi-purple { background: var(--review-bg); color: var(--review); }
.kpi-icon.kpi-orange { background: var(--warning-bg); color: var(--warning); }

.kpi-content h3 {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.kpi-content p {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

/* Admin Tabs */
.admin-tabs {
  display: flex;
  gap: 1rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1.5rem;
}

.admin-tab {
  background: transparent;
  border: none;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.75rem 0.5rem;
  cursor: pointer;
  position: relative;
  transition: var(--transition-fast);
}

.admin-tab:hover {
  color: var(--text-primary);
}

.admin-tab.active {
  color: var(--accent-primary-hover);
}

.admin-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2.5px;
  background: var(--accent-primary-hover);
  border-radius: var(--radius-full);
}

/* Candidate Table Controls */
.table-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.search-input-wrapper {
  position: relative;
  max-width: 340px;
  width: 100%;
}

.search-input-wrapper input {
  padding-left: 2.4rem;
}

.search-input-wrapper svg {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.filter-select {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 0.65rem 1rem;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  outline: none;
}

/* Data Table Styling */
.table-responsive {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.data-table th {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 700;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.data-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.candidate-cell {
  display: flex;
  flex-direction: column;
}

.candidate-cell strong {
  font-weight: 700;
  color: var(--text-primary);
}

.candidate-cell span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.score-pill {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
}

.score-pill.high { background: var(--success-bg); color: var(--success); }
.score-pill.medium { background: var(--warning-bg); color: var(--warning); }
.score-pill.low { background: var(--danger-bg); color: var(--danger); }

/* Empty state */
.empty-table-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

/* ==========================================================================
   MODALS
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 15, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  max-width: 480px;
  width: 100%;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  position: relative;
  animation: modalScale 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  margin-bottom: 1.25rem;
}

.modal-header h3 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.modal-header p {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  pointer-events: auto;
  animation: toastSlide 0.25s ease;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--cyan); }

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

/* ==========================================================================
   RESPONSIVE DESIGN (TABLET & MOBILE)
   ========================================================================== */
@media (max-width: 1024px) {
  .track-cards-grid {
    grid-template-columns: 1fr;
  }
  
  .rules-grid {
    grid-template-columns: 1fr 1fr;
  }

  .results-hero-card {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .score-details-col {
    align-items: center;
  }

  .stats-metric-grid {
    grid-template-columns: repeat(2, 1fr);
    width: 100%;
  }

  .admin-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  :root {
    --header-height: 64px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .registration-card {
    padding: 1.5rem;
  }

  .rules-grid {
    grid-template-columns: 1fr;
  }

  .start-action-row {
    flex-direction: column;
    align-items: stretch;
  }

  /* Test Engine Mobile Adjustments */
  .test-control-bar {
    padding: 0.6rem 1rem;
  }

  .test-candidate-info {
    display: none;
  }

  .timer-badge {
    font-size: 0.95rem;
    padding: 0.35rem 0.75rem;
  }

  .question-canvas {
    padding: 1.25rem;
  }

  .question-prompt {
    font-size: 1.05rem;
  }

  /* Question Palette as Slide-out Drawer on Mobile */
  .mobile-palette-toggle {
    display: flex;
  }

  .drawer-close-btn {
    display: block;
  }

  .palette-sidebar {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 320px;
    height: 100vh;
    max-height: 100vh;
    z-index: 150;
    transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-lg);
    border-left: 1px solid var(--border-strong);
  }

  .palette-sidebar.drawer-open {
    right: 0;
  }

  /* Mobile Drawer Backdrop */
  .palette-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 140;
  }

  .palette-backdrop.active {
    display: block;
  }

  .question-nav-bar {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .nav-left-group, .nav-right-group {
    width: 100%;
    justify-content: space-between;
  }

  .shortcuts-hint {
    display: none;
  }

  .admin-kpi-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   PRINT / PDF STYLESHEET (A4 REPORT CARD GENERATION)
   ========================================================================== */
@media print {
  /* Hide interactive web UI chrome */
  .top-nav,
  .nav-actions,
  .results-action-row,
  .review-filter-tabs,
  .modal-overlay,
  .toast-container,
  .shortcuts-hint,
  .question-nav-bar,
  .admin-top-actions,
  .table-filter-bar,
  .btn {
    display: none !important;
  }

  body {
    background: #ffffff !important;
    color: #0f172a !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 12pt;
  }

  body::before {
    display: none !important;
  }

  /* When printing individual student card from Admin */
  body.printing-report-card .app-container {
    display: none !important;
  }

  body.printing-report-card #printable-report-card {
    display: block !important;
    position: relative !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 24px !important;
    background: #ffffff !important;
    color: #0f172a !important;
  }

  /* Results view print adjustments */
  .results-container {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .results-hero-card {
    background: #f8fafc !important;
    border: 2px solid #cbd5e1 !important;
    box-shadow: none !important;
    color: #0f172a !important;
    page-break-inside: avoid;
  }

  .score-circle {
    background: #f1f5f9 !important;
    border-color: #4f46e5 !important;
  }

  .score-number {
    color: #0f172a !important;
  }

  .metric-card {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
  }

  .metric-card-val {
    color: #0f172a !important;
  }

  .review-item-card {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
    box-shadow: none !important;
    page-break-inside: avoid;
    margin-bottom: 12px !important;
  }

  .explanation-box {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    color: #334155 !important;
  }

  .explanation-content {
    color: #334155 !important;
  }

  .code-container {
    background: #f1f5f9 !important;
    border: 1px solid #cbd5e1 !important;
  }

  .code-pre {
    color: #0f172a !important;
  }
}

/* Printable Report Card Layout */
.report-card-sheet {
  background: #ffffff;
  color: #0f172a;
  font-family: var(--font-sans);
  padding: 32px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  max-width: 800px;
  margin: 0 auto;
}

.report-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 3px solid #4f46e5;
  padding-bottom: 20px;
  margin-bottom: 24px;
}

.report-brand h2 {
  font-size: 24px;
  font-weight: 800;
  color: #1e1b4b;
  margin-bottom: 4px;
}

.report-brand p {
  font-size: 13px;
  color: #64748b;
  font-weight: 600;
}

.report-meta-box {
  text-align: right;
  font-size: 12px;
  color: #475569;
}

.report-student-banner {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px 20px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.report-info-col h4 {
  font-size: 11px;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 4px;
  font-weight: 700;
}

.report-info-col p {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}

.report-score-section {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 24px;
  align-items: center;
}

.report-score-box {
  text-align: center;
  border-right: 2px solid #cbd5e1;
  padding-right: 20px;
}

.report-score-value {
  font-size: 40px;
  font-weight: 800;
  color: #4f46e5;
  line-height: 1;
}

.report-score-sub {
  font-size: 13px;
  color: #64748b;
  font-weight: 600;
  margin-top: 4px;
}

.report-guidance-box h3 {
  font-size: 16px;
  font-weight: 800;
  color: #1e1b4b;
  margin-bottom: 6px;
}

.report-guidance-box p {
  font-size: 13px;
  color: #334155;
  line-height: 1.5;
}

.report-guidance-steps {
  margin-top: 10px;
  padding-left: 18px;
  font-size: 12px;
  color: #334155;
}

.report-guidance-steps li {
  margin-bottom: 4px;
}

.report-breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-bottom: 28px;
}

.report-breakdown-table th {
  background: #f8fafc;
  border-bottom: 2px solid #cbd5e1;
  padding: 8px 12px;
  text-align: left;
  font-weight: 700;
  color: #475569;
}

.report-breakdown-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #e2e8f0;
  color: #1e293b;
}

.report-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-top: 1px solid #cbd5e1;
  padding-top: 20px;
  font-size: 11px;
  color: #64748b;
}

.report-sig-line {
  width: 180px;
  border-top: 1px solid #94a3b8;
  margin-top: 36px;
  text-align: center;
  padding-top: 4px;
}

