/* ==========================================================================
   EXAM MODE — exam-mode.css
   A calm, premium, certification-style assessment UI.
   Completely separate from game/quiz styles — no flashy gradients or colors.
   ========================================================================== */

/* ── Reset scoped to exam layout ── */
.em-root {
  --em-bg:            #f4f5f7;
  --em-surface:       #ffffff;
  --em-surface-2:     #f9fafb;
  --em-border:        #e2e5ea;
  --em-text:          #1a1d23;
  --em-text-muted:    #6b7280;
  --em-text-subtle:   #9ca3af;
  --em-accent:        #2563eb;
  --em-accent-light:  #dbeafe;
  --em-accent-mid:    #93c5fd;
  --em-selected-bg:   #eff6ff;
  --em-selected-border: #2563eb;
  --em-answered-dot:  #2563eb;
  --em-unanswered-dot:#d1d5db;
  --em-current-dot:   #1d4ed8;
  --em-timer-ok:      #16a34a;
  --em-timer-warn:    #d97706;
  --em-timer-urgent:  #dc2626;
  --em-radius:        12px;
  --em-radius-sm:     8px;
  --em-shadow:        0 1px 4px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.05);
  --em-shadow-sm:     0 1px 3px rgba(0,0,0,0.06);
  --em-transition:    150ms ease;
  --em-sidebar-w:     248px;
  --em-header-h:      56px;
  --em-bar-h:         52px;

  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--em-bg);
  color: var(--em-text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Dark mode support */
[data-theme="dark"] .em-root {
  --em-bg:            #0f1117;
  --em-surface:       #1a1d27;
  --em-surface-2:     #1e2130;
  --em-border:        #2d3142;
  --em-text:          #e8eaf0;
  --em-text-muted:    #8b93a7;
  --em-text-subtle:   #5a6175;
  --em-accent-light:  #1e3a5f;
  --em-selected-bg:   #172545;
  --em-selected-border:#60a5fa;
  --em-unanswered-dot:#3a3f52;
  --em-surface-2:     #151820;
}

/* ── Fixed top bar ──────────────────────────────────────────────────────── */
.em-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--em-bar-h);
  background: var(--em-surface);
  border-bottom: 1px solid var(--em-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
  gap: 16px;
  box-shadow: var(--em-shadow-sm);
}

.em-topbar__left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.em-topbar__exam-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--em-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.em-topbar__participant {
  font-size: 0.8rem;
  color: var(--em-text-muted);
  white-space: nowrap;
}

.em-topbar__center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.em-topbar__right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* ── Timer ──────────────────────────────────────────────────────────────── */
.em-timer {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--em-timer-ok);
  background: transparent;
  padding: 5px 12px;
  border-radius: 20px;
  border: 2px solid currentColor;
  transition: color var(--em-transition), border-color var(--em-transition),
              background var(--em-transition);
  letter-spacing: 0.04em;
}

.em-timer--warn    { color: var(--em-timer-warn); }
.em-timer--urgent  {
  color: var(--em-timer-urgent);
  background: rgba(220,38,38,.06);
  animation: em-pulse-urgent 1s ease-in-out infinite;
}

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

.em-timer__icon { font-size: 0.95rem; }

/* ── Progress pill ──────────────────────────────────────────────────────── */
.em-progress-pill {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--em-text-muted);
  white-space: nowrap;
}

/* ── Body layout ────────────────────────────────────────────────────────── */
.em-layout {
  display: flex;
  padding-top: var(--em-bar-h);
  height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.em-sidebar {
  position: fixed;
  top: var(--em-bar-h);
  bottom: 0;
  left: 0;
  width: var(--em-sidebar-w);
  background: var(--em-surface);
  border-right: 1px solid var(--em-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 50;
}

.em-sidebar__header {
  padding: 16px 16px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--em-text-subtle);
  border-bottom: 1px solid var(--em-border);
  flex-shrink: 0;
}

.em-sidebar__stats {
  padding: 8px 16px 12px;
  border-bottom: 1px solid var(--em-border);
  flex-shrink: 0;
}

.em-stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--em-text-muted);
  margin-bottom: 6px;
}

.em-stat-row strong {
  color: var(--em-accent);
  font-weight: 700;
}

.em-progress-bar {
  height: 4px;
  background: var(--em-border);
  border-radius: 4px;
  overflow: hidden;
}

.em-progress-bar__fill {
  height: 100%;
  background: var(--em-accent);
  border-radius: 4px;
  transition: width 0.4s ease;
}

.em-sidebar__grid {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  align-content: start;
  scrollbar-width: thin;
  scrollbar-color: var(--em-border) transparent;
}

.em-q-dot {
  aspect-ratio: 1;
  border-radius: 6px;
  border: 2px solid var(--em-border);
  background: var(--em-surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--em-text-muted);
  cursor: pointer;
  transition: border-color var(--em-transition), background var(--em-transition),
              color var(--em-transition), transform var(--em-transition);
  user-select: none;
}

.em-q-dot:hover {
  border-color: var(--em-accent);
  color: var(--em-accent);
  transform: scale(1.08);
}

.em-q-dot--answered {
  border-color: var(--em-accent);
  background: var(--em-accent-light);
  color: var(--em-accent);
}

.em-q-dot--current {
  border-color: var(--em-accent);
  background: var(--em-accent);
  color: #fff;
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(37,99,235,.3);
}

.em-q-dot--answered.em-q-dot--current {
  background: var(--em-accent);
  color: #fff;
}

/* ── Main content ────────────────────────────────────────────────────────── */
.em-main {
  margin-left: var(--em-sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 24px calc(var(--em-bar-h) + 32px);
  min-width: 0;
  overflow-y: auto;
  height: 100%;
}

/* ── Question card ──────────────────────────────────────────────────────── */
.em-question {
  width: 100%;
  max-width: 760px;
  animation: em-fade-in 0.2s ease;
}

@keyframes em-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0);   }
}

.em-question__meta {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--em-text-subtle);
  margin-bottom: 10px;
}

.em-question__card {
  background: var(--em-surface);
  border: 1px solid var(--em-border);
  border-radius: var(--em-radius);
  padding: 28px 32px;
  box-shadow: var(--em-shadow);
  margin-bottom: 20px;
}

.em-question__text {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.55;
  color: var(--em-text);
  margin-bottom: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.em-question__image {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  border-radius: var(--em-radius-sm);
  margin-bottom: 16px;
  border: 1px solid var(--em-border);
}

/* ── Options list ───────────────────────────────────────────────────────── */
.em-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.em-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--em-surface);
  border: 2px solid var(--em-border);
  border-radius: var(--em-radius-sm);
  cursor: pointer;
  transition: border-color var(--em-transition), background var(--em-transition),
              box-shadow var(--em-transition);
  user-select: none;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.em-option:hover {
  border-color: var(--em-accent-mid);
  background: var(--em-surface-2);
}

.em-option--selected {
  border-color: var(--em-selected-border);
  background: var(--em-selected-bg);
  box-shadow: 0 0 0 1px var(--em-selected-border);
}

.em-option__radio {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--em-border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--em-transition), background var(--em-transition);
}

.em-option--selected .em-option__radio {
  border-color: var(--em-accent);
  background: var(--em-accent);
}

.em-option__radio::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  opacity: 0;
  transform: scale(0);
  transition: opacity var(--em-transition), transform var(--em-transition);
}

.em-option--selected .em-option__radio::after {
  opacity: 1;
  transform: scale(1);
}

.em-option__text {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--em-text);
  line-height: 1.45;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* Results reveal states */
.em-option--correct {
  border-color: #16a34a;
  background: #f0fdf4;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.em-option--incorrect {
  border-color: #dc2626;
  background: #fef2f2;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.em-option--correct .em-option__radio {
  border-color: #16a34a;
  background: #16a34a;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.em-option--incorrect .em-option__radio {
  border-color: #dc2626;
  background: #dc2626;
  word-break: break-word;
  overflow-wrap: anywhere;
}

[data-theme="dark"] .em-option--correct {
  border-color: #22c55e;
  background: rgba(34,197,94,.1);
  word-break: break-word;
  overflow-wrap: anywhere;
}

[data-theme="dark"] .em-option--incorrect {
  border-color: #ef4444;
  background: rgba(239,68,68,.1);
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* ── Save indicator ─────────────────────────────────────────────────────── */
.em-save-indicator {
  font-size: 0.78rem;
  color: var(--em-text-subtle);
  transition: color var(--em-transition), opacity var(--em-transition);
  min-width: 80px;
  text-align: right;
}

.em-save-indicator--saving { color: var(--em-text-muted); }
.em-save-indicator--saved  { color: var(--em-timer-ok);  }
.em-save-indicator--error  { color: var(--em-timer-urgent); }

/* ── Bottom navigation bar ──────────────────────────────────────────────── */
.em-nav-bar {
  position: fixed;
  bottom: 0;
  left: var(--em-sidebar-w);
  right: 0;
  height: var(--em-bar-h);
  background: var(--em-surface);
  border-top: 1px solid var(--em-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 50;
  gap: 12px;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.04);
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.em-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--em-radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  border: 2px solid transparent;
  cursor: pointer;
  transition: background var(--em-transition), border-color var(--em-transition),
              color var(--em-transition), transform 100ms;
  font-family: inherit;
  white-space: nowrap;
  text-decoration: none;
}

.em-btn:active { transform: scale(0.97); }
.em-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.em-btn--ghost {
  background: transparent;
  border-color: var(--em-border);
  color: var(--em-text-muted);
}

.em-btn--ghost:hover:not(:disabled) {
  border-color: var(--em-accent-mid);
  color: var(--em-accent);
}

.em-btn--primary {
  background: var(--em-accent);
  border-color: var(--em-accent);
  color: #fff;
}

.em-btn--primary:hover:not(:disabled) {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.em-btn--danger {
  background: transparent;
  border-color: #dc2626;
  color: #dc2626;
}

.em-btn--danger:hover:not(:disabled) {
  background: #dc2626;
  color: #fff;
}

.em-btn--submit {
  background: #16a34a;
  border-color: #16a34a;
  color: #fff;
  padding: 8px 24px;
}

.em-btn--submit:hover:not(:disabled) {
  background: #15803d;
  border-color: #15803d;
}

/* ── Confirmation modal ─────────────────────────────────────────────────── */
.em-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 24px;
  animation: em-backdrop-in 0.15s ease;
}

@keyframes em-backdrop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.em-modal-backdrop[hidden] { display: none !important; }

.em-modal {
  background: var(--em-surface);
  border: 1px solid var(--em-border);
  border-radius: var(--em-radius);
  padding: 32px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: em-modal-in 0.2s cubic-bezier(0.34,1.3,0.64,1);
}

@keyframes em-modal-in {
  from { opacity: 0; transform: scale(0.94) translateY(8px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);   }
}

.em-modal__title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--em-text);
  margin-bottom: 10px;
}

.em-modal__body {
  font-size: 0.9rem;
  color: var(--em-text-muted);
  line-height: 1.6;
  margin-bottom: 24px;
}

.em-modal__stat {
  background: var(--em-surface-2);
  border: 1px solid var(--em-border);
  border-radius: var(--em-radius-sm);
  padding: 12px 16px;
  margin: 12px 0;
  font-size: 0.875rem;
}

.em-modal__stat strong {
  color: var(--em-text);
  font-weight: 700;
}

.em-modal__actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ── Static pages: join, waiting ─────────────────────────────────────────── */
.em-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.em-page-card {
  background: var(--em-surface);
  border: 1px solid var(--em-border);
  border-radius: var(--em-radius);
  padding: 40px 48px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--em-shadow);
  text-align: center;
}

.em-page-card__logo {
  font-size: 2.5rem;
  margin-bottom: 16px;
  line-height: 1;
}

.em-page-card__title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--em-text);
  margin-bottom: 4px;
}

.em-page-card__subtitle {
  font-size: 0.875rem;
  color: var(--em-text-muted);
  margin-bottom: 28px;
  line-height: 1.5;
}

.em-form-group {
  text-align: left;
  margin-bottom: 16px;
}

.em-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--em-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.em-input {
  width: 100%;
  padding: 11px 14px;
  border: 2px solid var(--em-border);
  border-radius: var(--em-radius-sm);
  font-size: 1rem;
  font-family: inherit;
  color: var(--em-text);
  background: var(--em-surface);
  transition: border-color var(--em-transition), box-shadow var(--em-transition);
  outline: none;
  box-sizing: border-box;
}

.em-input:focus {
  border-color: var(--em-accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.em-input--code {
  font-size: 1.6rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.em-error {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: var(--em-radius-sm);
  color: #dc2626;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 10px 14px;
  margin-bottom: 16px;
  text-align: left;
}

[data-theme="dark"] .em-error {
  background: rgba(239,68,68,.1);
  border-color: #7f1d1d;
  color: #f87171;
}

/* ── Info strip ─────────────────────────────────────────────────────────── */
.em-info-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--em-accent-light);
  border: 1px solid var(--em-accent-mid);
  border-radius: var(--em-radius-sm);
  padding: 10px 14px;
  margin-bottom: 20px;
  font-size: 0.85rem;
  color: var(--em-accent);
  font-weight: 500;
}

/* ── Results page ────────────────────────────────────────────────────────── */
.em-results {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 24px 60px;
}

.em-results__header {
  text-align: center;
  margin-bottom: 40px;
}

.em-score-ring {
  width: 140px;
  height: 140px;
  margin: 0 auto 20px;
  position: relative;
}

.em-score-ring svg {
  transform: rotate(-90deg);
  overflow: visible;
}

.em-score-ring__track { fill: none; stroke: var(--em-border); stroke-width: 10; }
.em-score-ring__fill  {
  fill: none;
  stroke: var(--em-accent);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s cubic-bezier(0.4,0,0.2,1);
}

.em-score-ring__label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--em-text);
  line-height: 1;
}

.em-score-ring__pct {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--em-text-muted);
  margin-top: 2px;
}

.em-results__title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--em-text);
  margin-bottom: 4px;
}

.em-results__meta {
  font-size: 0.875rem;
  color: var(--em-text-muted);
}

.em-results__breakdown {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 28px 0;
}

.em-stat-card {
  background: var(--em-surface);
  border: 1px solid var(--em-border);
  border-radius: var(--em-radius-sm);
  padding: 16px;
  text-align: center;
  box-shadow: var(--em-shadow-sm);
}

.em-stat-card__value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--em-text);
  margin-bottom: 2px;
}

.em-stat-card__label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--em-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.em-review-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.em-review-item {
  background: var(--em-surface);
  border: 1px solid var(--em-border);
  border-radius: var(--em-radius-sm);
  padding: 18px 20px;
  box-shadow: var(--em-shadow-sm);
}

.em-review-item--correct { border-left: 4px solid #16a34a; }
.em-review-item--incorrect { border-left: 4px solid #dc2626; }
.em-review-item--skipped { border-left: 4px solid var(--em-border); }

.em-review-item__question {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--em-text);
  margin-bottom: 10px;
  line-height: 1.45;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.em-review-item__qnum {
  font-size: 0.72rem;
  color: var(--em-text-subtle);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.em-review-item__answers {
  display: flex;
  flex-direction: column;
  gap: 5px;
  word-break: break-all;
  overflow-wrap: anywhere;
  white-space: normal;
}

.em-answer-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.83rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  width: fit-content;
  max-width: 100%;
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: normal;
}

.em-answer-tag--selected-correct {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.em-answer-tag--selected-incorrect {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

.em-answer-tag--correct-key {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.em-answer-tag--skipped {
  background: var(--em-surface-2);
  color: var(--em-text-muted);
  border: 1px solid var(--em-border);
}

[data-theme="dark"] .em-answer-tag--selected-correct  { background: rgba(22,163,74,.15); border-color: rgba(22,163,74,.3); color: #4ade80; }
[data-theme="dark"] .em-answer-tag--selected-incorrect { background: rgba(220,38,38,.15); border-color: rgba(220,38,38,.3); color: #f87171; }
[data-theme="dark"] .em-answer-tag--correct-key        { background: rgba(22,163,74,.10); border-color: rgba(22,163,74,.2); color: #86efac; }

/* ── Lobby / Host UI ──────────────────────────────────────────────────────── */
.em-lobby {
  max-width: 800px;
  margin: 0 auto;
  padding: 48px 24px;
}

.em-lobby__header {
  margin-bottom: 32px;
}

.em-lobby__code {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--em-accent-light);
  border: 2px solid var(--em-accent-mid);
  border-radius: var(--em-radius-sm);
  padding: 8px 18px;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--em-accent);
  margin-bottom: 12px;
}

.em-lobby__title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--em-text);
  margin-bottom: 4px;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.em-lobby__meta {
  font-size: 0.875rem;
  color: var(--em-text-muted);
}

.em-participant-list {
  background: var(--em-surface);
  border: 1px solid var(--em-border);
  border-radius: var(--em-radius);
  overflow: hidden;
  box-shadow: var(--em-shadow-sm);
}

.em-participant-list__header {
  padding: 14px 18px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--em-text-subtle);
  border-bottom: 1px solid var(--em-border);
  background: var(--em-surface-2);
}

.em-participant-row {
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--em-border);
  font-size: 0.9rem;
}

.em-participant-row:last-child { border-bottom: none; }

.em-participant-row__name {
  font-weight: 600;
  color: var(--em-text);
  word-break: break-word;
  overflow-wrap: anywhere;
  min-width: 0;
}

.em-participant-row__status {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}

.em-badge--submitted {
  background: #dcfce7;
  color: #15803d;
}

.em-badge--pending {
  background: var(--em-surface-2);
  color: var(--em-text-muted);
  border: 1px solid var(--em-border);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .em-root {
    --em-sidebar-w: 0px;
  }

  .em-sidebar {
    display: none;
  }

  .em-main {
    margin-left: 0;
    padding: 24px 16px calc(var(--em-bar-h) + 24px);
  }

  .em-nav-bar {
    left: 0;
  }

  .em-topbar__exam-title { max-width: 120px; }

  .em-question__card { padding: 20px; }

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

  .em-page-card { padding: 28px 20px; }

  .em-modal { padding: 24px 20px; }
}

@media (max-width: 480px) {
  .em-results__breakdown { grid-template-columns: 1fr; }
  .em-topbar__participant { display: none; }
}

/* ==========================================================================
   HOST RESULTS PAGE
   ========================================================================== */

/* matrix — always hidden, replaced by cards */
.em-matrix-wrapper { display: none; }

/* score badges */
.em-score-badge { display:inline-block;padding:3px 10px;border-radius:20px;font-weight:700;font-size:0.82rem;white-space:nowrap; }
.em-score-badge--high { background:#dcfce7;color:#15803d; }
.em-score-badge--mid  { background:#fef9c3;color:#854d0e; }
.em-score-badge--low  { background:#fee2e2;color:#b91c1c; }
[data-theme="dark"] .em-score-badge--high { background:rgba(22,163,74,.15);color:#4ade80; }
[data-theme="dark"] .em-score-badge--mid  { background:rgba(234,179,8,.12);color:#fde047; }
[data-theme="dark"] .em-score-badge--low  { background:rgba(220,38,38,.15);color:#f87171; }

/* tabs */
.em-tabs { display:flex;gap:4px;border-bottom:2px solid var(--em-border);margin-bottom:24px;overflow-x:auto; }
.em-tab {
  padding:10px 22px;
  font-size:0.88rem;
  font-weight:700;
  color:var(--em-text-muted);
  text-decoration:none;
  border-radius:8px 8px 0 0;
  border:2px solid transparent;
  border-bottom:none;
  transition:color 120ms,background 120ms;
  cursor:pointer;
  white-space:nowrap;
}
.em-tab:hover { color:var(--em-primary);background:var(--em-surface-2); }
.em-tab--active {
  color:var(--em-primary);
  background:var(--em-surface);
  border-color:var(--em-border) var(--em-border) var(--em-surface) var(--em-border);
  margin-bottom:-2px;
}

/* results wide container */
.em-root .em-lobby.em-results-wide { max-width:1200px; }

/* participant cards */
.em-part-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.em-part-card {
  background:var(--em-surface);
  border:1px solid var(--em-border);
  border-radius:var(--em-radius);
  padding:24px 28px;
  box-shadow:var(--em-shadow-sm);
}
.em-part-card__header {
  display:flex;justify-content:space-between;align-items:center;
  margin-bottom:16px;gap:8px;
}
.em-part-card__name {
  font-weight:700;font-size:1.05rem;color:var(--em-text);
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.em-part-card__grid {
  display:grid;grid-template-columns:1fr 1fr 1fr;gap:10px 14px;
  margin-bottom:16px;
}
.em-part-card__item { text-align:center; }
.em-part-card__val { font-size:1.5rem;font-weight:800;display:block; }
.em-part-card__val--correct   { color:#16a34a; }
.em-part-card__val--incorrect { color:#dc2626; }
.em-part-card__val--skipped   { color:var(--em-text-muted); }
.em-part-card__lbl { font-size:0.78rem;color:var(--em-text-muted);text-transform:uppercase;letter-spacing:.04em;margin-top:2px; }
.em-part-card__footer {
  display:flex;justify-content:space-between;align-items:center;
  border-top:1px solid var(--em-border);padding-top:10px;font-size:0.88rem;color:var(--em-text-muted);
}

/* per-question cards */
.em-q-card {
  background:var(--em-surface);
  border:1px solid var(--em-border);
  border-radius:var(--em-radius);
  padding:24px 28px;
  margin-bottom:16px;
  box-shadow:var(--em-shadow-sm);
}
.em-q-title { font-size:1.05rem;font-weight:700;color:var(--em-text);margin-bottom:18px;line-height:1.4;word-break:break-word;overflow-wrap:anywhere; }
.em-q-number {
  display:inline-flex;align-items:center;justify-content:center;
  background:var(--em-primary);color:#fff;border-radius:50%;
  width:28px;height:28px;font-size:0.8rem;font-weight:800;
  margin-right:10px;flex-shrink:0;vertical-align:middle;
}
.em-opt-row { display:flex;flex-wrap:wrap;align-items:center;gap:2px 8px;margin-bottom:14px; }
.em-opt-label { font-size:0.88rem;color:var(--em-text);flex:1 1 0;min-width:0;line-height:1.3;word-break:break-word;overflow-wrap:anywhere; }
.em-opt-bar-wrap { flex:0 0 100%;background:var(--em-border);border-radius:8px;height:28px;overflow:hidden;margin-top:6px; }
.em-opt-bar { height:100%;border-radius:8px;transition:width .4s ease;min-width:4px; }
.em-opt-bar--correct   { background:#22c55e; }
.em-opt-bar--incorrect { background:#94a3b8; }
.em-opt-count { font-size:0.84rem;font-weight:700;color:var(--em-text-muted);white-space:nowrap;margin-left:auto; }
.em-q-correct-pct { font-size:0.84rem;font-weight:600;color:#15803d;margin-top:14px; }
[data-theme="dark"] .em-q-correct-pct { color:#4ade80; }
.em-q-skipped { font-size:0.78rem;color:var(--em-text-subtle);margin-top:4px; }

@media (max-width: 720px) {
  .em-root .em-lobby.em-results-wide { padding:16px 12px; }
  .em-part-cards { grid-template-columns:1fr;gap:12px; }
  .em-part-card { padding:16px 18px; }
  .em-part-card__name { font-size:0.92rem; }
  .em-part-card__val { font-size:1.2rem; }
  .em-part-card__lbl { font-size:0.7rem; }
  .em-tab { padding:8px 14px;font-size:0.82rem; }
  .em-q-card { padding:16px 18px; }
  .em-q-title { font-size:0.9rem; }
  .em-opt-label { font-size:0.8rem; }
  .em-opt-bar-wrap { height:22px; }
  .em-opt-count { font-size:0.78rem; }
}

/* ==========================================================================
   PARTICIPANT DETAIL PAGE
   ========================================================================== */

.pd-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}
.pd-header { margin-bottom: 28px; }
.pd-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--em-text-muted);
  text-decoration: none;
  margin-bottom: 16px;
  transition: color 120ms;
}
.pd-back:hover { color: var(--em-primary); }
.pd-name {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--em-text);
  margin: 0 0 4px;
}
.pd-meta { font-size: 0.85rem; color: var(--em-text-muted); }
.pd-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}
.pd-stat {
  background: var(--em-surface);
  border: 1px solid var(--em-border);
  border-radius: var(--em-radius);
  padding: 14px 16px;
  text-align: center;
  box-shadow: var(--em-shadow-sm);
}
.pd-stat__val {
  font-size: 1.6rem;
  font-weight: 800;
  display: block;
  line-height: 1.1;
  margin-bottom: 4px;
}
.pd-stat__val--score  { color: var(--em-primary); }
.pd-stat__val--ok     { color: #16a34a; }
.pd-stat__val--fail   { color: #dc2626; }
.pd-stat__val--skip   { color: var(--em-text-muted); }
[data-theme="dark"] .pd-stat__val--ok   { color: #4ade80; }
[data-theme="dark"] .pd-stat__val--fail { color: #f87171; }
.pd-stat__lbl {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--em-text-muted);
  font-weight: 600;
}
.pd-progress-wrap {
  background: var(--em-border);
  border-radius: 8px;
  height: 10px;
  margin-bottom: 28px;
  overflow: hidden;
}
.pd-progress-bar {
  height: 100%;
  border-radius: 8px;
  background: var(--em-primary);
  transition: width .4s ease;
}
.pd-q-card {
  background: var(--em-surface);
  border: 1px solid var(--em-border);
  border-radius: var(--em-radius);
  padding: 20px 24px;
  margin-bottom: 14px;
  box-shadow: var(--em-shadow-sm);
}
.pd-q-card--correct   { border-left: 4px solid #22c55e; }
.pd-q-card--incorrect { border-left: 4px solid #ef4444; }
.pd-q-card--skipped   { border-left: 4px solid var(--em-border); }
.pd-q-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}
.pd-q-num {
  flex-shrink: 0;
  background: var(--em-primary);
  color: #fff;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
}
.pd-q-text {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--em-text);
  line-height: 1.45;
  flex: 1;
  min-width: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.pd-q-result-badge {
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
}
.pd-q-result-badge--correct   { background: #dcfce7; color: #15803d; }
.pd-q-result-badge--incorrect { background: #fee2e2; color: #b91c1c; }
.pd-q-result-badge--skipped   { background: var(--em-surface-2); color: var(--em-text-muted); }
[data-theme="dark"] .pd-q-result-badge--correct   { background: rgba(22,163,74,.15); color: #4ade80; }
[data-theme="dark"] .pd-q-result-badge--incorrect { background: rgba(220,38,38,.15); color: #f87171; }
.pd-options { display: flex; flex-direction: column; gap: 8px; }
.pd-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1.5px solid var(--em-border);
  background: var(--em-surface-2);
  font-size: 0.88rem;
  color: var(--em-text);
  transition: background 100ms;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.pd-option--selected-correct {
  border-color: #22c55e;
  background: #f0fdf4;
  font-weight: 700;
}
.pd-option--selected-wrong {
  border-color: #ef4444;
  background: #fef2f2;
  font-weight: 700;
}
.pd-option--correct-only {
  border-color: #22c55e;
  background: #f0fdf4;
  font-weight: 600;
  opacity: .75;
}
[data-theme="dark"] .pd-option--selected-correct { background: rgba(22,163,74,.12); }
[data-theme="dark"] .pd-option--selected-wrong   { background: rgba(220,38,38,.12); }
[data-theme="dark"] .pd-option--correct-only     { background: rgba(22,163,74,.08); }
.pd-option__icon { font-size: 0.95rem; flex-shrink: 0; width: 20px; text-align: center; }
.pd-option__pts {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 700;
  color: #15803d;
  white-space: nowrap;
}
[data-theme="dark"] .pd-option__pts { color: #4ade80; }

@media (max-width: 600px) {
  .pd-page { padding: 16px 12px 48px; }
  .pd-name { font-size: 1.2rem; }
  .pd-summary { grid-template-columns: 1fr 1fr; }
  .pd-q-card { padding: 15px 14px; }
  .pd-q-text { font-size: 0.88rem; }
}

/* ==========================================================================
   EXAM PLAY PAGE — full-screen overrides
   ========================================================================== */

.exam-play .qa-header  { display: none !important; }
.exam-play footer      { display: none !important; }
.exam-play .container  { max-width: 100% !important; padding: 0 !important; margin: 0 !important; }
.exam-play .content-card {
  background: transparent !important;
  padding: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  margin: 0 !important;
}

/* ==========================================================================
   SESSIONS LIST PAGE
   ========================================================================== */

.sl-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px;
}
.sl-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 28px;
}
.sl-header__left h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--em-text);
  margin: 0 0 4px;
}
.sl-header__left p {
  font-size: 0.875rem;
  color: var(--em-text-muted);
  margin: 0;
}
.sl-header__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.sl-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.sl-stat {
  background: var(--em-surface);
  border: 1px solid var(--em-border);
  border-radius: var(--em-radius-sm);
  padding: 14px 22px;
  flex: 1 1 120px;
  min-width: 100px;
  box-shadow: var(--em-shadow-sm);
}
.sl-stat__val {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--em-accent);
  line-height: 1;
}
.sl-stat__lbl {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--em-text-muted);
  margin-top: 4px;
}
.sl-table-wrap {
  border: 1px solid var(--em-border);
  border-radius: var(--em-radius);
  box-shadow: var(--em-shadow-sm);
  overflow: hidden;
}
.sl-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.sl-table thead th {
  background: var(--em-surface-2);
  color: var(--em-text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 11px 16px;
  border-bottom: 2px solid var(--em-border);
  white-space: nowrap;
}
.sl-table thead th.c { text-align: center; }
.sl-table tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--em-border);
  vertical-align: middle;
  color: var(--em-text);
}
.sl-table tbody tr:last-child td { border-bottom: none; }
.sl-table tbody tr:hover td { background: var(--em-surface-2); }
.sl-table td.c { text-align: center; }
.sl-code {
  font-family: 'Fira Mono', 'Consolas', monospace;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--em-accent);
}
.sl-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}
.sl-badge--pending  { background: #fef9c3; color: #854d0e; }
.sl-badge--active   { background: #dcfce7; color: #15803d; }
.sl-badge--finished { background: #e0e7ff; color: #3730a3; }
[data-theme="dark"] .sl-badge--pending  { background: rgba(234,179,8,.15);  color: #fde047; }
[data-theme="dark"] .sl-badge--active   { background: rgba(22,163,74,.15);  color: #4ade80; }
[data-theme="dark"] .sl-badge--finished { background: rgba(99,102,241,.15); color: #a5b4fc; }
.sl-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.sl-actions .em-btn { font-size: 0.78rem; padding: 6px 14px; white-space: nowrap; }
.sl-cards { display: none; }
.sl-card {
  background: var(--em-surface);
  border: 1px solid var(--em-border);
  border-radius: var(--em-radius);
  padding: 16px;
  box-shadow: var(--em-shadow-sm);
  margin-bottom: 12px;
}
.sl-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 8px;
}
.sl-card__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  margin-bottom: 14px;
  font-size: 0.82rem;
}
.sl-card__item { display: flex; flex-direction: column; gap: 1px; }
.sl-card__item-lbl { font-size: 0.68rem; text-transform: uppercase; letter-spacing: .04em; color: var(--em-text-muted); font-weight: 600; }
.sl-card__item-val { color: var(--em-text); font-weight: 500; }
.sl-card__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sl-card__actions .em-btn { flex: 1; justify-content: center; font-size: 0.8rem; }
.sl-empty { text-align: center; padding: 72px 24px; color: var(--em-text-muted); }
.sl-empty__icon { font-size: 3.5rem; margin-bottom: 14px; }
.sl-empty p { margin-bottom: 18px; font-size: 0.95rem; }

@media (max-width: 720px) {
  .sl-page { padding: 20px 14px; }
  .sl-header { flex-direction: column; }
  .sl-header__actions { width: 100%; }
  .sl-header__actions .em-btn { flex: 1; justify-content: center; }
  .sl-stats { gap: 8px; }
  .sl-stat { padding: 12px 14px; }
  .sl-table-wrap { display: none; }
  .sl-cards { display: block; }
}
