:root {
  --bg: #f0f4f9;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --ok: #16a34a;
  --danger: #dc2626;
  --ring: #e2e8f0;
}

body {
  margin: 0;
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px;
}

.hero {
  background: linear-gradient(135deg, #3b82f6, #60a5fa);
  color: #fff;
  text-align: center;
  padding: 32px 16px;
  border-bottom: 4px solid var(--primary-dark);
}
.hero.small {
  padding: 20px 16px;
}
.hero h1 {
  margin: 0 0 8px;
  font-size: 48px;
}
.hero p {
  margin: 0;
  font-size: 24px;
  opacity: 1;
}

.card {
  background: var(--card);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  margin-top: -40px;
}

/* Блок авторизации */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.auth-form .fields {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.auth-form input {
  flex: 1;
  padding: 14px 16px;
  font-size: 16px;
  border: 2px solid var(--ring);
  border-radius: 12px;
  transition: border-color 0.2s ease;
}
.auth-form input:focus {
  outline: none;
  border-color: var(--primary);
}
.auth-form .actions {
  display: flex;
  justify-content: center;
}
.auth-form .actions button {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 12px;
}

/* Таймер */
#timerBox {
  background: #f3f4f6;
  color: var(--text);
  text-align: center;
  font-size: 20px;
  font-weight: 600;
  padding: 12px;
  border-radius: 12px;
  margin: 20px 0;
}

/* Информация о пользователе */
.user-info {
  text-align: center;
  font-size: 20px;
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 16px;
}

/* Прогресс-бар */
.progress {
  width: 100%;
  height: 14px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
  margin: 20px 0;
}
#progressBar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  transition: width 0.4s ease;
}

/* Вопросы */
.q-meta {
  display: inline-block;
  background: #f3f4f6;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.q-text {
  font-size: 22px;
  margin-bottom: 24px;
  line-height: 1.5;
}
.options {
  display: grid;
  gap: 12px;
}
.option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border: 2px solid var(--ring);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.option:hover {
  border-color: var(--primary);
  background: #f0f9ff;
}
.option input {
  transform: scale(1.3);
}

/* Кнопки */
.actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 24px;
  gap: 12px;
}
.btn {
  padding: 12px 22px;
  border-radius: 12px;
  border: none;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.btn.primary {
  background: var(--primary);
  color: #fff;
}
.btn.primary:hover {
  background: var(--primary-dark);
  transform: scale(1.02);
}

/* Результаты */
.result {
  display: flex;
  justify-content: space-around;
  margin-top: 24px;
}
.result div {
  background: #f9fafb;
  border-radius: 12px;
  padding: 20px;
  flex: 1;
  margin: 0 8px;
  text-align: center;
  box-shadow: inset 0 0 6px rgba(0,0,0,0.05);
}
.result span {
  display: block;
  color: var(--muted);
  margin-bottom: 6px;
}
.result b {
  font-size: 26px;
  color: var(--primary-dark);
}

/* Таблица результатов */
.table-wrap {
  max-height: 500px;
  overflow-y: auto;
  border: 1px solid var(--ring);
  border-radius: 12px;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.table thead th {
  position: sticky;
  top: 0;
  background: #f1f5f9;
  color: var(--text);
  font-weight: 600;
  text-align: left;
  padding: 10px;
  border-bottom: 2px solid var(--ring);
  cursor: pointer;
  user-select: none;
}
.table tbody td {
  padding: 10px;
  border-bottom: 1px solid var(--ring);
}
.table tbody tr:nth-child(even) {
  background: #f9fafb;
}
.table tbody tr:hover {
  background: #e0f2fe;
}
.table tbody tr.success {
  background: #dcfce7 !important;
}
.table th.asc::after {
  content: " ▲";
  font-size: 12px;
  color: var(--primary-dark);
}
.table th.desc::after {
  content: " ▼";
  font-size: 12px;
  color: var(--primary-dark);
}

.stat {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 24px;
}
.stat div {
  flex: 1;
  padding: 20px;
  border-radius: 12px;
  text-align: center;
  box-shadow: inset 0 0 6px rgba(0,0,0,0.05);
}
.stat span {
  display: block;
  margin-bottom: 6px;
  font-size: 15px;
  color: var(--muted);
}
.stat b {
  font-size: 28px;
}
.stat .good {
  background: #ecfdf5;
  color: #16a34a;
}
.stat .bad {
  background: #fef2f2;
  color: #dc2626;
}
.stat .time {
  background: #eff6ff;
  color: #2563eb;
}

/* Текст над формой */
.note {
  text-align: center;
  font-size: 25px;
  color: var(--muted);
  margin-bottom: 16px;
}

/* обёртка для input + label */
.input-wrap {
  position: relative;
  width: 100%;
}

.input-wrap input {
    width: 100%;
    padding: 20px 14px 6px;
    font-size: 18px;
    border: 2px solid var(--ring);
    border-radius: 12px;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.input-wrap input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.2);
  outline: none;
}

.input-wrap label {
  position: absolute;
  left: 14px;
  top: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  pointer-events: none;
  transition: color 0.2s ease;
}

.input-wrap input:focus + label {
  color: var(--primary-dark);
}

/* Кнопка */
.auth-form .actions {
  display: flex;
  justify-content: center;
}

.auth-form .actions .btn {
  width: 100%;
  font-size: 20px;
  padding: 16px;
  font-weight: 600;
  border-radius: 12px;
}