:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #eaf0f8;
  --text: #0f2138;
  --muted: #56718f;
  --primary: #006dcb;
  --primary-2: #0b8ee8;
  --success: #178a5c;
  --danger: #c0392b;
  --warning: #b36f00;
  --border: #d0dce8;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', 'Trebuchet MS', sans-serif;
  background: linear-gradient(160deg, #f6fbff 0%, #eef4fb 60%, #e8f1fb 100%);
  color: var(--text);
}

a {
  color: var(--primary);
}

.page {
  width: min(1200px, 96vw);
  margin: 0 auto;
  padding: 20px 0 40px;
}

.hero {
  background: linear-gradient(130deg, #0b5fa5 0%, #1f8ad3 55%, #41afe7 100%);
  color: #fff;
  padding: 18px 20px;
  border-radius: var(--radius);
  box-shadow: 0 10px 22px rgba(6, 44, 89, 0.2);
  margin-bottom: 16px;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(1.3rem, 2vw, 1.9rem);
}

.hero p {
  margin: 0;
  opacity: 0.96;
}

.grid {
  display: grid;
  gap: 14px;
}

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

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: 0 6px 16px rgba(22, 60, 98, 0.08);
}

.card h2,
.card h3 {
  margin: 0 0 10px;
}

label {
  font-weight: 600;
  font-size: 0.92rem;
  display: block;
  margin-bottom: 6px;
}

input,
textarea,
select,
button {
  font: inherit;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: #fff;
  color: var(--text);
}

textarea {
  min-height: 84px;
  resize: vertical;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  color: #fff;
  cursor: pointer;
  background: var(--primary);
}

button:hover {
  filter: brightness(1.03);
}

button.secondary {
  background: #415c76;
}

button.success {
  background: var(--success);
}

button.warn {
  background: var(--warning);
}

button.danger {
  background: var(--danger);
}

button:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}

.status {
  margin-top: 8px;
  padding: 10px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.status.error {
  background: #fdecea;
  border-color: #f5c2bb;
  color: #8e1f12;
}

.status.ok {
  background: #e8f6ef;
  border-color: #b7e3ca;
  color: #0c5d3a;
}

.list {
  display: grid;
  gap: 8px;
}

.item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: #fff;
}

.item strong {
  display: block;
  margin-bottom: 4px;
}

.scoreboard {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}

.score {
  text-align: center;
  padding: 14px;
  border-radius: 12px;
  background: #f8fbff;
  border: 1px solid var(--border);
}

.score .name {
  font-size: 1rem;
  color: var(--muted);
}

.score .value {
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 800;
  line-height: 1;
  margin-top: 6px;
}

.vs {
  font-weight: 800;
  color: #365879;
}

.question-box {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 14px;
}

.options {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.options button {
  width: 100%;
  text-align: left;
  padding: 14px;
  font-size: 1rem;
  background: #f7fbff;
  color: var(--text);
  border: 1px solid #c5d7ea;
}

.options button.active {
  background: #d9ecff;
  border-color: #8fbff0;
}

.options button.correct {
  background: #daf3e7;
  border-color: #77cc9f;
}

.options button.wrong {
  background: #fce4e1;
  border-color: #f0a5a0;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 0.92rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #b8cee6;
  border-radius: 999px;
  padding: 4px 10px;
  background: #f2f8ff;
  color: #274f77;
  font-size: 0.85rem;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 8px;
  text-align: left;
  vertical-align: top;
}

th {
  font-size: 0.84rem;
  color: var(--muted);
  text-transform: uppercase;
}

.center {
  text-align: center;
}

.hidden {
  display: none !important;
}

.big-code {
  font-size: clamp(1.8rem, 5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: 0.16em;
  text-align: center;
  margin: 6px 0;
}

.timer {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 800;
  color: #0c5ea6;
}

.screen-layout {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 14px;
}

@media (max-width: 980px) {
  .grid-2,
  .grid-3,
  .screen-layout {
    grid-template-columns: 1fr;
  }

  .page {
    width: min(900px, 94vw);
  }
}

@media (max-width: 640px) {
  body {
    font-size: 15px;
  }

  button {
    width: 100%;
    padding: 13px 14px;
  }

  .actions {
    flex-direction: column;
  }

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

  .vs {
    text-align: center;
  }
}
