/* Общие настройки */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: #F3F4F6;
  color: #1F2937;
  line-height: 1.5;
}

/* Сетка приложения */
.app { display: flex; min-height: 100vh; flex-direction: column; }

/* Навигация (Header) */
.nav-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 25px;
  background: #4C1D95; /* Ваш фиолетовый */
  color: white;
  position: sticky;
  top: 0;
  z-index: 1000;
  height: 70px; /* Фиксированная высота шапки */
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

#timer {
  font-variant-numeric: tabular-nums; /* Чтобы цифры не дергались при изменении */
  text-shadow: 0 0 10px rgba(245, 158, 11, 0.5); /* Легкое свечение оранжевым */
}

/* На мобилках уменьшаем размер */
@media (max-width: 600px) {
  #timer {
    font-size: 18px;
  }
  .nav-header {
    padding: 5px 15px;
  }
}

.logo-block { display: flex; align-items: center; gap: 12px; }
.logo-circle {
  width: 45px; height: 45px; background: white; border-radius: 50%;
  border: 2px solid #F59E0B; display: flex; align-items: center; justify-content: center;
  font-weight: 900; color: #4C1D95; font-size: 14px;
}
.logo-text { display: flex; flex-direction: column; text-transform: uppercase; }
.logo-main { font-weight: 900; font-size: 18px; letter-spacing: -0.5px; line-height: 1; }
.logo-sub { font-size: 10px; color: #F59E0B; font-weight: 700; letter-spacing: 2px; }

/* Контейнер контента */
.content-wrapper {
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  padding: 30px 20px;
  gap: 30px;
}

/* Боковая панель */
.sidebar {
  width: 300px;
  flex-shrink: 0;
}

.sidebar-card {
  background: white;
  border-radius: 24px;
  padding: 24px;
  border: 1px solid #E5E7EB;
  position: sticky;
  top: 100px;
}

.sidebar h3 {
  font-size: 10px; text-transform: uppercase; letter-spacing: 2px;
  color: #9CA3AF; margin-bottom: 15px; font-weight: 800;
}

/* Таймер и нарушения */
.timer-box { margin-bottom: 25px; }
.timer { font-size: 28px; font-weight: 900; color: #4C1D95; margin: 4px 0; }
#violationsLabel { font-size: 11px; font-weight: 800; text-transform: uppercase; color: #EF4444; }

/* Основная область */
.main { flex: 1; min-width: 0; }

/* Карточки заданий и Интро */
.question-card {
  background: white;
  border-radius: 40px;
  padding: 40px;
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.05);
  border: 1px solid #F3F4F6;
}

.question-title { font-size: 28px; font-weight: 900; color: #4C1D95; margin-bottom: 10px; }
.divider { height: 6px; width: 42%; background: #F59E0B; border-radius: 10px; margin-bottom: 30px; }

/* Поля ввода */
.intro-grid { display: grid; gap: 20px; margin: 30px 0; }
.intro-grid label { font-size: 10px; font-weight: 800; text-transform: uppercase; color: #9CA3AF; padding-left: 10px; }
.intro-grid input, .intro-grid select {
  width: 100%; padding: 16px 20px; border-radius: 18px; border: 2px solid #F3F4F6;
  background: #F9FAFB; font-weight: 600; outline: none; transition: 0.2s;
}
.intro-grid input:focus { border-color: #F59E0B; background: white; }

/* Кнопки */
.btn {
  border-radius: 20px; font-weight: 800; text-transform: uppercase; 
  letter-spacing: 1px; cursor: pointer; transition: 0.3s; border: none;
}
.btn-primary { 
  background: #F59E0B; color: white; padding: 18px 30px; font-size: 16px;
  box-shadow: 0 10px 20px rgba(245, 158, 11, 0.3);
}
.btn-primary:hover { transform: translateY(-2px); background: #D97706; }
.btn-ghost { background: #4C1D95; color: white; padding: 12px 24px; margin-left: 10px;}

/* Сетка вопросов */
.questions-list { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.q-btn {
  aspect-ratio: 1; border: none; border-radius: 12px; background: #F3F4F6;
  font-weight: 700; color: #4C1D95; cursor: pointer;
}
.q-btn.active { background: #4C1D95; color: white; }

/* Видео-контейнеры */
.draggable {
  position: fixed; z-index: 2000; border-radius: 20px; overflow: hidden;
  border: 3px solid #4C1D95; background: black; cursor: move; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.2);
}
#video-container { width: 160px; height: 120px; bottom: 20px; right: 20px; }
#desk-container { width: 220px; height: 165px; bottom: 160px; right: 20px; border-color: #F59E0B; }
.status-badge {
  position: absolute; bottom: 0; width: 100%; background: rgba(0,0,0,0.7);
  color: white; font-size: 9px; text-align: center; padding: 4px; font-weight: 700;
}

/* Экран блокировки */
#warning-screen {
  position: fixed; inset: 0; background: rgba(76, 29, 149, 0.98);
  z-index: 9999; display: none; align-items: center; justify-content: center;
  flex-direction: column; color: white; padding: 40px; text-align: center;
}

/* Мобильная адаптация */
@media (max-width: 768px) {
  .content-wrapper { flex-direction: column; padding: 15px; }
  .sidebar { width: 100%; order: 2; }
  .main { order: 1; }
  .question-card { padding: 25px; border-radius: 30px; }
  .logo-main { font-size: 15px; }
}

/* В style.css добавьте это в конец */

#exam { 
  display: none; /* Обязательно скрываем до старта */
}

/* Если кнопки Назад/Далее не нажимаются, возможно они перекрыты. 
   Уменьшим область захвата у видео-контейнеров */
.draggable {
  pointer-events: auto;
}
video {
  pointer-events: none; /* Чтобы клик проходил сквозь видео к кнопкам, если они рядом */
}

/* Исправление для отображения кнопок управления */
#examControls {
  display: none; 
  justify-content: space-between;
  align-items: center;
}

/* В файле style.css */

#webcam-video, #desk-video {
  width: 100%;
  height: 100%;
  /* Было: object-fit: cover; — это создавало "зум" */
  object-fit: contain; 
  background: #000; /* Черный фон для пустых полей, если видео не на весь блок */
}

/* Для фронтальной камеры оставляем зеркальное отображение, 
   но следим, чтобы оно не накладывалось на другие свойства */
#webcam-video {
  transform: scaleX(-1); 
}

.mode-option input:checked + .mode-card {
  background: white;
  color: #4C1D95;
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.mode-card {
  background: transparent;
  color: #9CA3AF;
}

.mode-option:hover .mode-card {
  color: #4C1D95;
}