/* ============================================================================
   TYPECODE - VIEW: EXAM STUDENT (UTS & UAS WORKSPACE)
   Fully Theme-Adaptive · Uses CSS Custom Properties from variables.css
   ============================================================================ */

/* ============================================================================
   A. Root Container
   ============================================================================ */
.exam-student-container {
  width: 100%;
  max-width: 1380px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ============================================================================
   A1. Full Viewport Layout - Exam Workspace Active
   Mirrors practice-view full-layout: body + app-layout lock to 100dvh,
   content-area + exam-view fill remaining space, container spans 100%.
   ============================================================================ */
@media (min-height: 480px) {
  body:has(#exam-view.active) {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  body:has(#exam-view.active) .app-layout {
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  body:has(#exam-view.active) .app-footer {
    display: none;
  }

  body:has(#exam-view.active) .content-area {
    flex: 1 1 auto;
    min-height: 0;
    padding-top: 8px;
    padding-bottom: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  body:has(#exam-view.active) #exam-view.active {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  body:has(#exam-view.active) .exam-student-container {
    flex: 1 1 auto;
    min-height: 0;
    max-width: 100%;
    padding: 8px 20px 8px;
    overflow: hidden;
  }

  /* Pastikan question card mengisi sisa ruang secara vertikal */
  body:has(#exam-view.active) .exam-question-card {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }

  body:has(#exam-view.active) .exam-qcard-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
  }
}

/* ============================================================================
   B. Hero / Empty State Cards  (No Session · Briefing · Submitted · Error)
   ============================================================================ */
.exam-hero-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl, 16px);
  padding: 2.5rem 2rem;
  max-width: 760px;
  margin: 2rem auto;
  box-shadow: var(--box-shadow-modal);
  text-align: center;
}

/* Icon Circle */
.exam-hero-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--brand-indigo-glow);
  color: var(--brand-indigo);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto 1.5rem;
}

.exam-hero-icon.warning {
  background: rgba(230, 172, 75, 0.15);
  color: var(--accent-amber);
}

.exam-hero-icon.success {
  background: rgba(94, 184, 134, 0.15);
  color: var(--accent-emerald);
}

/* Title & Sub */
.exam-hero-title {
  font-size: 1.75rem;
  font-weight: var(--font-weight-bold, 700);
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  line-height: var(--line-height-tight, 1.25);
}

.exam-hero-sub {
  color: var(--text-secondary);
  font-size: var(--font-size-md, 14px);
  line-height: var(--line-height-relaxed, 1.7);
  margin-bottom: 1.75rem;
}

/* Spec Grid (Durasi, Soal, Kelas) */
.exam-briefing-specs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
  text-align: left;
}

.exam-spec-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md, 8px);
  padding: 0.9rem 1rem;
  transition: border-color var(--transition-fast);
}

.exam-spec-label {
  font-size: var(--font-size-xs, 12px);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: var(--font-weight-medium, 500);
  margin-bottom: 5px;
}

.exam-spec-val {
  font-size: 1.05rem;
  font-weight: var(--font-weight-semibold, 600);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Rules / Tata Tertib Box */
.exam-rules-list {
  background: rgba(230, 172, 75, 0.07);
  border: 1px solid rgba(230, 172, 75, 0.22);
  border-radius: var(--radius-md, 8px);
  padding: 1.1rem 1.4rem;
  margin-bottom: 1.75rem;
  text-align: left;
  font-size: var(--font-size-sm, 13px);
  color: var(--text-secondary);
  line-height: var(--line-height-relaxed, 1.7);
}

.exam-rules-list h4 {
  color: var(--accent-amber);
  margin: 0 0 8px;
  font-size: var(--font-size-md, 14px);
  font-weight: var(--font-weight-semibold, 600);
  display: flex;
  align-items: center;
  gap: 8px;
}

.exam-rules-list ol {
  margin: 0;
  padding-left: 1.2rem;
}

.exam-rules-list li {
  margin-bottom: 4px;
}

/* Info box variant */
.exam-rules-list.info-box {
  background: var(--brand-indigo-glow);
  border-color: rgba(100, 160, 220, 0.25);
}

.exam-rules-list.info-box h4 {
  color: var(--brand-indigo);
}

/* ============================================================================
   C. Active Exam Workspace Header
   ============================================================================ */
.exam-workspace-header {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg, 12px);
  padding: 0.75rem 1.25rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin-bottom: 0.875rem;
  box-shadow: var(--shadow-nav);
}

.exam-title-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  justify-self: start;
}

.exam-session-title {
  font-weight: var(--font-weight-bold, 700);
  font-size: 1.05rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}

/* UTS / UAS Pill Badge */
.exam-type-pill {
  background: var(--brand-indigo);
  color: #ffffff;
  font-weight: var(--font-weight-bold, 700);
  font-size: var(--font-size-xs, 12px);
  padding: 4px 10px;
  border-radius: var(--radius-sm, 6px);
  letter-spacing: 0.06em;
  white-space: nowrap;
  flex-shrink: 0;
}

.exam-type-pill.uas {
  background: var(--accent-indigo);
}

/* Timer - Centered & Dynamic */
.exam-timer-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  padding: 6px 16px;
  border-radius: var(--radius-md, 8px);
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: var(--font-weight-bold, 700);
  color: var(--brand-indigo);
  flex-shrink: 0;
  justify-self: center;
  margin: 0 auto;
  transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.exam-timer-box.warning {
  border-color: var(--accent-amber);
  color: var(--accent-amber);
  animation: timer-pulse 1.5s infinite ease-in-out;
}

.exam-timer-box.danger {
  border-color: var(--danger);
  color: var(--danger);
  animation: timer-pulse 0.8s infinite ease-in-out;
}

@keyframes timer-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.72; transform: scale(1.03); }
}

/* Right side: autosave + violations + submit */
.exam-meta-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  justify-self: end;
}

@media (max-width: 900px) {
  .exam-workspace-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
  }
  .exam-title-badge {
    justify-content: center;
    text-align: center;
  }
  .exam-meta-actions {
    justify-content: center;
  }
}

.violation-pill {
  font-size: var(--font-size-sm, 13px);
  color: var(--text-secondary);
  background: rgba(224, 90, 71, 0.08);
  border: 1px solid rgba(224, 90, 71, 0.22);
  padding: 4px 10px;
  border-radius: var(--radius-sm, 6px);
  display: flex;
  align-items: center;
  gap: 6px;
}

.violation-pill b {
  color: var(--danger);
}

.exam-autosave-status {
  font-size: var(--font-size-sm, 13px);
  color: var(--accent-emerald);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color var(--transition-fast);
}

.exam-autosave-status.saving {
  color: var(--accent-amber);
}

/* ============================================================================
   D. Question Strip  (Modern Question Strip Navigation)
   ============================================================================ */
.question-strip,
.exam-qnav-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-surface, #1C1C1C);
  border: 1px solid var(--border-strong, #2E2E2E);
  border-radius: 16px;
  overflow-x: auto;
  /* Scrollbar tipis terlihat (bukan disembunyikan): strip memuat puluhan
     pill soal - tanpa affordance scroll, soal 37+ tak terjangkau desktop. */
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong, #505050) transparent;
  margin-bottom: 0.875rem;
  flex-shrink: 0;
}

.question-strip::-webkit-scrollbar,
.exam-qnav-bar::-webkit-scrollbar {
  display: block;
  height: 6px;
}

.question-strip::-webkit-scrollbar-thumb,
.exam-qnav-bar::-webkit-scrollbar-thumb {
  background: var(--border-strong, #505050);
  border-radius: 3px;
}

.question-strip::-webkit-scrollbar-track,
.exam-qnav-bar::-webkit-scrollbar-track {
  background: transparent;
}

/* ===== Question Item ===== */
.question,
.exam-qnav-btn {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  min-width: 44px !important;
  border: 1px solid var(--border-subtle, #3A3A3A);
  border-radius: 12px;
  background: var(--bg-elevated, #262626);
  color: var(--text-secondary, #CFCFCF);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-code, monospace);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: none;
  transition: all 0.2s ease;
  position: relative;
}

/* Hover */
.question:hover,
.exam-qnav-btn:hover {
  background: var(--bg-hover, #313131);
  border-color: var(--border-strong, #505050);
  color: var(--text-primary, #FFFFFF);
  transform: translateY(-1px);
}

/* Soal aktif */
.question.active,
.exam-qnav-btn.active {
  background: #0F766E !important;
  border-color: #14B8A6 !important;
  color: #FFFFFF !important;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.25) !important;
}

/* Sudah dijawab */
.question.answered:not(.active),
.exam-qnav-btn.answered:not(.active) {
  background: #1D4ED8 !important;
  border-color: #3B82F6 !important;
  color: #FFFFFF !important;
}

/* Ditandai (review) */
.question.review:not(.active),
.exam-qnav-btn.review:not(.active) {
  background: #B45309 !important;
  border-color: #F59E0B !important;
  color: #FFFFFF !important;
}

/* Disable */
.question:disabled,
.exam-qnav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

/* ============================================================================
   E. Question Card
   ============================================================================ */
.exam-question-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg, 12px);
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  box-shadow: var(--shadow-nav);
}

.exam-qcard-header {
  padding: 0.85rem 1.4rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  background: var(--bg-elevated);
}

.exam-qcard-title {
  font-weight: var(--font-weight-bold, 700);
  font-size: 1.1rem;
  color: var(--text-primary);
}

.exam-qcard-hint {
  font-size: var(--font-size-sm, 13px);
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.exam-qcard-body {
  padding: 1.25rem 1.4rem;
  flex: 1 1 auto;
  box-sizing: border-box;
  animation: examCardFadeSlide 0.18s ease-out;
}

/* ============================================================================
   F. Split Layout - Tahap 3 & Tahap 4
   Uniform 38:62 Ratio for Perfect Stability during Question Switching
   ============================================================================ */
/* Tahap 3 & 4 Split Grid - Uniform Ratio Across All Questions */
.exam-split-grid {
  display: grid;
  grid-template-columns: 38fr 62fr;
  gap: 1.25rem;
  align-items: stretch;
  min-height: 0;
  height: 100%;
}

@media (max-width: 1024px) {
  .exam-split-grid,
  .exam-split-grid.stage-3-grid,
  .exam-split-grid.stage-4-grid {
    grid-template-columns: 1fr;
    min-height: unset;
  }
}

.exam-split-col {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  min-height: 0;
}

/* Tahap 3: Left & Right Columns */
.stage-3-left-col,
.stage-3-right-col,
.stage-4-left-col,
.stage-4-right-col {
  height: 100%;
  min-height: 0;
}

/* Tahap 4: Left Column Structure (Description + Output Textarea) */
.stage-4-left-col {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  height: 100%;
  min-height: 0;
}

.stage-4-desc-box {
  flex: 1 1 auto;
  min-height: 160px;
  box-sizing: border-box;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
  scrollbar-gutter: stable;
}

.stage-4-output-wrap {
  flex: 0 0 auto;
}

/* Description box - Ukuran font 15px agar nyaman dan mudah dibaca */
.exam-desc-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md, 8px);
  padding: 1.2rem 1.3rem;
  font-size: 15px;
  line-height: 1.75;
  color: var(--text-secondary);
}

.exam-desc-box h4 {
  margin: 0 0 10px;
  font-size: 15.5px;
  font-weight: var(--font-weight-semibold, 600);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.stage-3-desc-box {
  height: 100%;
  box-sizing: border-box;
  overflow-y: auto;
  font-size: 15px !important;
  line-height: 1.75;
  padding: 1.35rem 1.45rem;
  border-radius: var(--radius-lg, 12px);
  box-shadow: var(--shadow-sm);
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.stage-3-desc-box h4 {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.stage-3-desc-content {
  font-size: 15px !important;
  line-height: 1.75;
  color: var(--text-secondary);
}

/* Target output monospace box */
.exam-target-output-box {
  background: var(--bg-editor);
  border: 1px solid var(--border-editor);
  border-radius: var(--radius-md, 8px);
  padding: 0.9rem 1.1rem;
  font-family: var(--font-mono);
  font-size: var(--font-size-sm, 13px);
  color: var(--brand-indigo);
  white-space: pre-wrap;
  line-height: 1.55;
  overflow-x: auto;
}

/* Terminal Console Mockup (Student Output Preview) */
.exam-terminal-card {
  width: 100%;
  border: 1px solid var(--border-editor, var(--border-strong));
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-editor, #18181B);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.exam-terminal-card:focus-within {
  border-color: var(--brand-indigo);
  box-shadow: 0 0 0 2px var(--brand-indigo-glow);
}

.exam-terminal-header {
  height: 38px;
  background: var(--bg-elevated, #202023);
  border-bottom: 1px solid var(--border-editor, var(--border-subtle));
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  user-select: none;
  flex-shrink: 0;
}

.exam-terminal-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.exam-terminal-title {
  font-family: var(--font-mono, monospace);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 6px;
}

.exam-terminal-title i {
  color: var(--accent-emerald, #10B981);
  font-size: 12px;
}

.exam-terminal-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.exam-terminal-badge {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--bg-surface, #27272A);
  color: var(--text-tertiary);
  border: 1px solid var(--border-subtle);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.exam-terminal-body {
  position: relative;
  background: var(--bg-editor, #18181B);
  padding: 0;
  display: flex;
}

/* Mahasiswa output textarea - PINNED 18px per user decision */
.exam-student-output-preview {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0.85rem 1.1rem;
  font-family: var(--font-mono);
  font-size: 18px !important;
  color: var(--accent-emerald, #4ADE80);
  min-height: 130px;
  max-height: 220px;
  white-space: pre-wrap;
  line-height: 1.6;
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  outline: none;
  box-shadow: none !important;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.exam-student-output-preview::placeholder {
  color: var(--text-muted, #71717A);
  font-size: 15px;
  font-style: italic;
  opacity: 0.75;
}

.exam-student-output-preview:focus {
  outline: none;
  box-shadow: none !important;
}

/* ============================================================================
   G. Professional Code Editor Component (UTS & UAS Workspace)
   Theme-Adaptive · Powered by CSS Variables from variables.css
   ============================================================================ */
.editor-card {
  --bg: var(--bg-surface);
  --panel: var(--bg-elevated);
  --editor: var(--bg-editor);
  --border: var(--border-editor, var(--border-subtle));
  --text: var(--text-primary);
  --muted: var(--text-tertiary);
  --gold: var(--accent-amber);
  --green: var(--accent-emerald);
  --blue: var(--brand-indigo);
  --purple: var(--accent-indigo);
  --red: var(--accent-rose);
  --orange: var(--accent-amber);

  width: 100%;
  border: 1px solid var(--border-editor, var(--border-strong));
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-editor);
  display: flex;
  flex-direction: column;
  box-shadow: var(--box-shadow-editor, var(--shadow-md));
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.editor-card:focus-within {
  border-color: var(--brand-indigo);
  box-shadow: 0 0 0 2px var(--brand-indigo-glow), var(--box-shadow-editor, var(--shadow-md));
}

.editor-card.stage-4 {
  min-height: 580px;
  height: 100%;
}

.editor-card.stage-3 {
  min-height: 580px;
  height: 100%;
}

/* HEADER / TOP BAR */
.editor-top {
  height: 44px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-editor, var(--border-subtle));
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  user-select: none;
  flex-shrink: 0;
}

.editor-top .left-tools,
.editor-top .right-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: inline-block;
}

.dot.red { background: #ff5f56; }
.dot.yellow { background: #ffbd2e; }
.dot.green { background: #27c93f; }

.file-tab {
  margin-left: 8px;
  background: var(--bg-editor);
  color: var(--text-primary);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-mono, monospace);
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border-editor, var(--border-subtle));
}

.editor-card .badge {
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  padding: 4px 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-ui, sans-serif);
  letter-spacing: 0.02em;
  transition: all 0.2s ease;
}

.editor-card .badge.success {
  color: var(--accent-emerald);
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.28);
}

.editor-card .badge.warning {
  color: var(--accent-amber);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.28);
}

.editor-card .badge.danger {
  color: var(--accent-rose);
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.28);
}

/* BODY */
.editor-card .editor-body,
.editor-body {
  flex: 1 1 auto !important;
  display: flex !important;
  flex-direction: row !important;
  overflow: hidden !important;
  position: relative !important;
  min-height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  background: var(--bg-editor) !important;
}

/* line numbers gutter */
.editor-card .gutter,
.gutter {
  width: 58px !important;
  background: var(--bg-elevated) !important;
  border-right: 1px solid var(--border-editor, var(--border-subtle)) !important;
  color: var(--text-tertiary) !important;
  font: 14px/24px var(--font-mono, monospace) !important;
  line-height: 24px !important;
  padding: 12px 0 !important;
  margin: 0 !important;
  text-align: right !important;
  user-select: none !important;
  overflow: hidden !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
}

.editor-card .gutter div,
.gutter div {
  padding-right: 12px !important;
  height: 24px !important;
  line-height: 24px !important;
  box-sizing: border-box !important;
}

/* editor wrap */
.editor-card .editor-wrap,
.editor-wrap {
  flex: 1 1 auto !important;
  position: relative !important;
  background: var(--bg-editor) !important;
  overflow: hidden !important;
  min-height: 0 !important;
  height: 100% !important;
  width: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
}

.editor-card .editor-wrap pre,
.editor-card .editor-wrap textarea,
.editor-card .editor-wrap textarea.exam-editor-textarea,
.editor-wrap pre,
.editor-wrap textarea {
  margin: 0 !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  padding: 12px 16px !important;
  font-family: var(--font-mono, monospace) !important;
  font-size: 14px !important;
  line-height: 24px !important;
  white-space: pre !important;
  box-sizing: border-box !important;
  tab-size: 4 !important;
  -moz-tab-size: 4 !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  word-break: normal !important;
  word-wrap: normal !important;
}

.editor-card .editor-wrap pre,
.editor-wrap pre {
  pointer-events: none !important;
  color: var(--text-primary) !important;
  background: transparent !important;
  z-index: 1 !important;
  overflow: hidden !important;
  user-select: none !important;
}

.editor-card .editor-wrap textarea,
.editor-card .editor-wrap textarea.exam-editor-textarea,
.editor-wrap textarea {
  background: transparent !important;
  background-color: transparent !important;
  color: transparent !important;
  caret-color: var(--caret-color, var(--brand-indigo)) !important;
  border: none !important;
  outline: none !important;
  resize: none !important;
  z-index: 2 !important;
  overflow: auto !important;
  scrollbar-width: thin !important;
  scrollbar-color: var(--border-strong) transparent !important;
}

.editor-card .editor-wrap textarea::-webkit-scrollbar {
  width: 10px !important;
  height: 10px !important;
}

.editor-card .editor-wrap textarea::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.15) !important;
  border-radius: 6px !important;
}

.editor-card .editor-wrap textarea::-webkit-scrollbar-thumb {
  background: var(--border-strong, #64748b) !important;
  border-radius: 6px !important;
  border: 2px solid transparent !important;
  background-clip: padding-box !important;
}

.editor-card .editor-wrap textarea::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary, #94a3b8) !important;
}

.editor-card .editor-wrap textarea:focus,
.editor-card .editor-wrap textarea.exam-editor-textarea:focus,
.editor-wrap textarea:focus {
  outline: none !important;
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  background-color: transparent !important;
}

.editor-card .editor-wrap textarea::selection,
.editor-card .editor-wrap textarea.exam-editor-textarea::selection,
.editor-wrap textarea::selection {
  background: var(--brand-indigo-glow, rgba(59, 130, 246, 0.35)) !important;
  color: transparent !important;
}

/* ============================================================================
   Tahap 3 & Tahap 4 Terminal / Code Editor: Font 16px, Line-height 26px & Scrolldown Padding
   ============================================================================ */
.editor-card.stage-3 .gutter,
.editor-card.stage-4 .gutter {
  width: 62px !important;
  font: 16px/26px var(--font-mono, monospace) !important;
  line-height: 26px !important;
  padding: 14px 0 80px 0 !important;
}

.editor-card.stage-3 .gutter div,
.editor-card.stage-4 .gutter div {
  height: 26px !important;
  line-height: 26px !important;
  font-size: 16px !important;
  padding-right: 14px !important;
}

.editor-card.stage-3 .editor-wrap pre,
.editor-card.stage-3 .editor-wrap textarea,
.editor-card.stage-3 .editor-wrap textarea.exam-editor-textarea,
.editor-card.stage-4 .editor-wrap pre,
.editor-card.stage-4 .editor-wrap textarea,
.editor-card.stage-4 .editor-wrap textarea.exam-editor-textarea {
  font-size: 16px !important;
  line-height: 26px !important;
  padding: 14px 18px 80px 18px !important;
}

/* minimap */
.minimap {
  width: 42px;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border-editor, var(--border-subtle));
  position: relative;
  flex-shrink: 0;
}

.minimap::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 10px;
  width: 22px;
  height: 90%;
  background: repeating-linear-gradient(
    to bottom,
    var(--brand-indigo) 0px,
    var(--brand-indigo) 2px,
    transparent 2px,
    transparent 9px
  );
  opacity: 0.25;
}

@media (max-width: 640px) {
  .minimap {
    display: none;
  }
}

/* status bar */
.statusbar {
  height: 30px;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border-editor, var(--border-subtle));
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  font-size: 12px;
  color: var(--text-secondary);
  font-family: var(--font-mono, monospace);
  user-select: none;
  flex-shrink: 0;
}

.status-left {
  display: flex;
  gap: 16px;
  align-items: center;
}

.status-right {
  color: var(--brand-indigo);
  font-size: 11px;
  font-weight: 500;
}

/* syntax highlight - Dark Theme Defaults */
.editor-card .keyword, .keyword { color: #60a5fa !important; font-weight: 600 !important; }
.editor-card .type, .type { color: #7dd3fc !important; }
.editor-card .number, .number { color: #f59e0b !important; }
.editor-card .string, .string { color: #86efac !important; }
.editor-card .comment, .comment { color: #8fae7f !important; font-style: italic !important; }
.editor-card .func, .func { color: #fbbf24 !important; font-weight: 600 !important; }
.editor-card .preproc, .preproc { color: #c084fc !important; font-weight: 600 !important; }

/* syntax highlight - Light Themes (Light, Minimal, ChatGPT, Sakura-Light) */
[data-theme="light"] .editor-card .keyword,
[data-theme="minimal"] .editor-card .keyword,
[data-theme="chatgpt"] .editor-card .keyword,
[data-theme="sakura-light"] .editor-card .keyword {
  color: var(--brand-indigo, #1d4e89) !important;
  font-weight: 600 !important;
}

[data-theme="light"] .editor-card .type,
[data-theme="minimal"] .editor-card .type,
[data-theme="chatgpt"] .editor-card .type,
[data-theme="sakura-light"] .editor-card .type {
  color: #1d6f8a !important;
}

[data-theme="light"] .editor-card .number,
[data-theme="minimal"] .editor-card .number,
[data-theme="chatgpt"] .editor-card .number,
[data-theme="sakura-light"] .editor-card .number {
  color: #1e7a45 !important;
}

[data-theme="light"] .editor-card .string,
[data-theme="minimal"] .editor-card .string,
[data-theme="chatgpt"] .editor-card .string,
[data-theme="sakura-light"] .editor-card .string {
  color: #b03a2e !important;
}

[data-theme="light"] .editor-card .comment,
[data-theme="minimal"] .editor-card .comment,
[data-theme="chatgpt"] .editor-card .comment,
[data-theme="sakura-light"] .editor-card .comment {
  color: #57524a !important;
  font-style: italic !important;
  opacity: 0.8 !important;
}

[data-theme="light"] .editor-card .func,
[data-theme="minimal"] .editor-card .func,
[data-theme="chatgpt"] .editor-card .func,
[data-theme="sakura-light"] .editor-card .func {
  color: #94691f !important;
  font-weight: 600 !important;
}

[data-theme="light"] .editor-card .preproc,
[data-theme="minimal"] .editor-card .preproc,
[data-theme="chatgpt"] .editor-card .preproc,
[data-theme="sakura-light"] .editor-card .preproc {
  color: #6b21a8 !important;
  font-weight: 600 !important;
}

.editor-card .blank-slot, .blank-slot {
  background: rgba(212, 167, 44, 0.25) !important;
  color: #d97706 !important;
  outline: 1px dashed #d97706 !important;
  outline-offset: -1px !important;
  border: none !important;
  border-radius: 2px !important;
  padding: 0 2px !important;
  margin: 0 !important;
  font-weight: 600 !important;
  letter-spacing: normal !important;
  display: inline !important;
}

[data-theme="dark"] .editor-card .blank-slot,
[data-theme="navy"] .editor-card .blank-slot,
[data-theme="chatgpt-dark"] .editor-card .blank-slot,
[data-theme="sakura-dark"] .editor-card .blank-slot {
  background: rgba(212, 167, 44, 0.35) !important;
  color: #ffd15c !important;
  outline: 1px dashed #ffd15c !important;
}

.editor-card .btn-editor-action {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  transition: all 0.2s ease;
}

.editor-card .btn-editor-action:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.editor-card .btn-editor-action:active {
  transform: translateY(1px);
}

.editor-card .badge.info {
  color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.28);
}

/* Backward compatibility fallbacks */
.exam-code-editor-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 380px;
  background: var(--bg-editor);
  border: 1px solid var(--border-editor);
  border-radius: var(--radius-md, 8px);
  overflow: hidden;
}

.exam-code-textarea {
  width: 100%;
  flex: 1;
  background: var(--bg-editor);
  color: var(--text-primary);
  border: none;
  outline: none;
  padding: 12px 15px;
  font-family: var(--font-mono);
  font-size: var(--font-size-sm, 13px);
  line-height: 1.65;
  resize: none;
  tab-size: 4;
  caret-color: var(--caret-color);
  box-sizing: border-box;
}

/* ============================================================================
   H. Question Card Footer  (Prev / Next nav)
   ============================================================================ */
.exam-qcard-footer {
  padding: 0.9rem 1.4rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-elevated);
  gap: 12px;
}

.exam-qcard-footer-center {
  font-size: var(--font-size-sm, 13px);
  color: var(--text-tertiary);
}

/* ============================================================================
   I. Published Score Report
   ============================================================================ */
.exam-score-hero {
  background: var(--bg-surface);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-xl, 16px);
  padding: 2.5rem 2rem;
  text-align: center;
  margin-bottom: 1.5rem;
  box-shadow: var(--box-shadow-modal);
}

.exam-score-report-label {
  font-size: var(--font-size-sm, 13px);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: var(--font-weight-semibold, 600);
}

.exam-score-report-title {
  margin: 6px 0 1rem;
  font-size: 1.6rem;
  font-weight: var(--font-weight-bold, 700);
  color: var(--text-primary);
}

.exam-final-grade-badge {
  font-size: 3.5rem;
  font-weight: var(--font-weight-extrabold, 800);
  font-family: var(--font-mono);
  color: var(--brand-indigo);
  line-height: 1;
  margin: 0.75rem 0 0.35rem;
}

.exam-score-scale {
  font-size: var(--font-size-sm, 13px);
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

.exam-score-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.exam-score-pill-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md, 8px);
  padding: 1.1rem;
  text-align: center;
}

.exam-score-pill-card h4 {
  margin: 0 0 6px;
  font-size: var(--font-size-sm, 13px);
  font-weight: var(--font-weight-medium, 500);
  color: var(--text-secondary);
}

.exam-score-pill-card .score-num {
  font-size: 1.8rem;
  font-weight: var(--font-weight-bold, 700);
  color: var(--text-primary);
  font-family: var(--font-mono);
  line-height: 1;
}

/* Readonly report code card - same look as exam text editor (editor-card
   shell + gutter + highlight), static flow: dynamic height, no clipping,
   no <code> element (avoids global badge styling). */
.editor-card.exam-report-code {
  min-height: 0;
  height: auto;
  margin-top: 2px;
}

.editor-card.exam-report-code .exam-report-body {
  display: flex;
  flex-direction: row;
  background: var(--bg-editor);
}

.editor-card.exam-report-code .gutter {
  font-size: 15px !important;
  line-height: 27px !important;
  align-self: stretch;
}

.editor-card.exam-report-code .gutter div {
  height: 27px !important;
  line-height: 27px !important;
}

.editor-card.exam-report-code .exam-report-pre {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 12px 16px;
  font-family: var(--font-mono, monospace);
  font-size: 15px;
  line-height: 27px;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  tab-size: 4;
  color: var(--text-primary);
  background: transparent;
  border: none;
  user-select: text;
}

/* Per-question rubric breakdown row */
.exam-rubric-aspects {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin: 8px 0;
  font-size: var(--font-size-sm, 13px);
  background: var(--bg-elevated);
  padding: 8px 12px;
  border-radius: var(--radius-sm, 6px);
  color: var(--text-secondary);
}

.exam-rubric-aspects span b {
  color: var(--text-primary);
}

.exam-grader-note {
  margin-top: 6px;
  font-size: var(--font-size-sm, 13px);
  color: var(--brand-indigo);
  background: var(--brand-indigo-glow);
  padding: 8px 12px;
  border-radius: var(--radius-sm, 6px);
}

/* Container Scroll untuk Daftar Soal Laporan Ujian (Rapi untuk 50+ Soal) */
.exam-report-scroll-container {
  max-height: clamp(380px, 55vh, 560px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.exam-report-scroll-container::-webkit-scrollbar {
  width: 6px;
}

.exam-report-scroll-container::-webkit-scrollbar-track {
  background: transparent;
}

.exam-report-scroll-container::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}

.exam-report-scroll-container::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ============================================================================
   J. Utility colour helpers
   ============================================================================ */
.text-amber   { color: var(--accent-amber) !important; }
.text-blue    { color: var(--accent-blue, #7EAFBA) !important; }
.text-emerald { color: var(--accent-emerald) !important; }
.text-danger  { color: var(--danger) !important; }
.text-secondary { color: var(--text-secondary) !important; }

.color-blue   { color: var(--accent-blue, #7EAFBA) !important; }
.color-amber  { color: var(--accent-amber) !important; }
.color-emerald{ color: var(--accent-emerald) !important; }

/* ============================================================================
   K. Markdown Prose Styling (Zero-dependency Renderer Styles)
   ============================================================================ */
.md-prose {
  color: var(--text-secondary);
  font-size: 14.5px;
  line-height: 1.7;
  word-break: break-word;
}

.md-prose .md-p {
  margin: 0 0 10px 0;
  line-height: 1.7;
}

.md-prose .md-p:last-child {
  margin-bottom: 0;
}

.md-prose .md-heading {
  margin: 16px 0 8px 0;
  font-weight: var(--font-weight-semibold, 600);
  color: var(--text-primary);
  line-height: 1.35;
}

.md-prose .md-heading:first-child {
  margin-top: 0;
}

.md-prose .md-h1 { font-size: 1.18rem; }
.md-prose .md-h2 { font-size: 1.08rem; }
.md-prose .md-h3 { font-size: 1.00rem; }
.md-prose .md-h4 { font-size: 0.94rem; }
.md-prose .md-h5 { font-size: 0.88rem; }
.md-prose .md-h6 { font-size: 0.84rem; }

.md-prose .md-list {
  margin: 6px 0 12px 0;
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.md-prose .md-list li {
  line-height: 1.6;
  color: var(--text-secondary);
}

.md-prose .md-inline-code {
  font-family: var(--font-code, monospace);
  background: var(--bg-surface-elevated, var(--bg-surface));
  border: 1px solid var(--border-subtle);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.88em;
  color: var(--accent-emerald, #10b981);
}

.md-prose .md-code-wrap {
  margin: 12px 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md, 8px);
  background: var(--bg-editor, var(--bg-surface));
  overflow: hidden;
}

.md-prose .md-code-lang {
  font-size: 11px;
  font-family: var(--font-mono, monospace);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-tertiary);
  font-weight: 600;
}

.md-prose .md-code-block {
  margin: 0;
  padding: 10px 14px;
  font-family: var(--font-mono, monospace);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-primary);
  overflow-x: auto;
  white-space: pre;
}

.md-prose .md-blockquote {
  margin: 12px 0;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md, 8px);
  color: var(--text-secondary);
}

.md-prose .md-blockquote p {
  margin: 0;
  line-height: 1.65;
}

.md-prose .md-table-wrap {
  margin: 12px 0;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md, 8px);
}

.md-prose .md-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.md-prose .md-table th {
  padding: 9px 12px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 600;
  color: var(--text-primary);
}

.md-prose .md-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.md-prose .md-table tr:last-child td {
  border-bottom: none;
}

.md-prose .md-hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 16px 0;
}

.md-prose .md-link {
  color: var(--brand-indigo, #6366f1);
  text-decoration: underline;
  text-underline-offset: 2px;
}


/* Hero states (kartu info/briefing/staf) selalu vertikal-tengah,
   konsisten dengan overlay practice-view. Workspace & rapor skor
   tidak kena (wadahnya bukan .exam-hero-card langsung). */
.exam-student-container:has(> .exam-hero-card) {
  justify-content: center;
}

/* Header kartu soal: baris badge+judul boleh membungkus di viewport sempit
   (zoom besar / HP) agar pill "Soal X dari Y - Tahap ..." tidak meluber
   keluar kartu. Berlaku global - tanpa efek saat ruang cukup. */
.exam-qcard-header > div:first-child {
  flex-wrap: wrap;
  min-width: 0;
  flex: 1 1 auto;
  row-gap: 8px;
}

.exam-qcard-header .badge {
  white-space: normal;
  line-height: 1.5;
  max-width: 100%;
}

.exam-qcard-title {
  min-width: 0;
  overflow-wrap: anywhere;
}

.exam-qcard-footer {
  flex-wrap: wrap;
  row-gap: 8px;
}

@media (max-width: 640px) {
  .exam-qcard-header,
  .exam-qcard-footer,
  .exam-qcard-body {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .exam-qcard-title {
    font-size: 1rem;
  }
}

/* Header kartu soal: tinggi konsisten antar soal (tidak mengecil/membesar
   saat pindah soal karena panjang judul berbeda). Konten ter-center vertikal. */
.exam-qcard-header {
  min-height: 3.4rem;
}

/* Stabilkan cangkang kartu antar soal (Tahap 3 ramping vs Tahap 4 tinggi):
   kartu mengisi penuh ruang container yang terkunci viewport; hanya body
   yang scroll internal sehingga pindah soal tidak me-resize halaman.
   Header/footer selalu terlihat (timer & navigasi tak ikut kegulung). */
body:has(#exam-view.active) .exam-question-card {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

body:has(#exam-view.active) .exam-qcard-body {
  overflow-y: auto;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
  scrollbar-gutter: stable;
}
