* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f5f7fb url('/background.png') center/cover no-repeat fixed;
  color: #1f2937;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 80px 16px 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

body.test-mode .container {
  margin: 20px auto 40px;
  padding: 0 16px;
  display: block;
}

h1 {
  text-align: center;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
  margin-top: 16px;
}

.hero-title {
  color: #ff9800;
  font-size: 42px;
  font-weight: 800;
  margin-bottom: 8px;
  text-align: center;
  line-height: 1.2;
}

/* Главная: строки в столбик и по центру */
.hero-title .hero-line1,
.hero-title .hero-line2 {
  display: block;
}

body.test-mode .hero-title {
  font-size: 32px;
  margin-bottom: 12px;
}

body.test-mode .hero-title .hero-line1,
body.test-mode .hero-title .hero-line2 {
  display: inline;
}

body.test-mode .hero-title .hero-line2 {
  margin-left: 6px;
}

.auth-card {
  width: 100%;
  max-width: 540px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(255, 170, 0, 0.18);
  border: none;
  margin: 0 auto;
}

.auth-title {
  margin: 0;
  padding: 16px 20px;
  background: linear-gradient(135deg, #ffb000, #ff8800);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
}

.auth-card .auth-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px 16px;
  padding: 18px 20px 6px;
}

.auth-actions {
  padding: 0 20px 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.auth-card label {
  color: #ffaa00;
}

.auth-card input,
.auth-card select {
  border: 1px solid #ffaa00;
  padding: 5px 8px;
}

.auth-card button.primary {
  background: linear-gradient(135deg, #ffb800, #ff7a00);
  color: #fff;
  box-shadow: 0 10px 24px rgba(255, 138, 0, 0.35);
}

.auth-card button.primary.big {
  border-radius: 12px;
  font-size: 16px;
  padding: 10px 16px;
}

.hidden {
  display: none;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

label {
  font-weight: 600;
  color: #1f2937;
}

input,
select,
textarea {
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  width: 100%;
}

/* Подправляем стрелку select: сдвигаем немного влево и центрируем по вертикали */
select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23262626' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 8px;
  padding-right: 36px;
}

button {
  padding: 10px 14px;
  border: none;
  border-radius: 8px;
  background: #e5e7eb;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
}

button.primary {
  background: #ffaa00;
  color: #fff;
}

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

.actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.error {
  color: #b91c1c;
  font-size: 14px;
}

.test-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.timer {
  font-size: 18px;
  font-weight: 700;
  color: #ffaa00;
}

.layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 16px;
  align-items: flex-start;
}

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

.nav button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 40px;
  border: 1px solid transparent;
  background: #f3f4f6;
  padding: 0;
  line-height: 1;
  font-size: 14px;
}

.nav button.active {
  background: #ffaa00;
  color: #fff;
}

.nav button.answered {
  border-color: #10b981;
}

.question-area {
  border-left: 1px solid #e5e7eb;
  padding-left: 12px;
  min-height: 420px;
}

.question-text {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.45;
  margin-bottom: 10px;
  text-align: left;
  overflow-wrap: anywhere;
}

.question-text p {
  margin: 0 0 14px;
}

.question-text p:last-child {
  margin-bottom: 0;
}

.question-number {
  font-weight: 700;
  white-space: nowrap;
}

.question-image img {
  max-width: 100%;
  margin: 8px 0 14px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}

.question-text img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 12px auto;
}

.question-table-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 14px 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.question-text .question-table-wrap table {
  display: table;
  width: max-content;
  min-width: 0;
  max-width: none;
  height: auto !important;
  margin: 0 auto;
  border-collapse: collapse;
  table-layout: auto;
}

.question-text tbody,
.question-text tr {
  height: auto !important;
}

.question-text th,
.question-text td {
  min-width: 42px;
  height: auto !important;
  padding: 6px 10px;
  border: 1px solid #777;
  line-height: 1.25;
  text-align: center;
  vertical-align: middle;
}

.task-file {
  margin: 16px 0 4px;
}

.task-file-link {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 9px 14px;
  border-radius: 8px;
  background: #165dff;
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

.task-file-link:hover {
  background: #0f49cc;
}

.question-actions {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  margin-top: 16px;
}

.answer-option {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 10px;
  align-items: center;
  padding: 6px 0;
  width: 100%;
  line-height: 1.3;
  white-space: normal;
}

.answer-option input {
  margin-top: 0;
  flex-shrink: 0;
}

#answers {
  text-align: left;
}

.answers-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  max-width: 720px;
  width: 100%;
}

.matching-block {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.matching-section-title {
  margin-top: 4px;
  font-weight: 700;
  color: #111827;
}

.matching-options {
  margin: 0 0 8px;
  padding-left: 30px;
}

.matching-options li {
  margin-bottom: 5px;
  line-height: 1.35;
}

.matching-hint {
  color: #4b5563;
  font-size: 14px;
}

.matching-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.matching-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.matching-left {
  min-width: 0;
  line-height: 1.35;
}

.matching-select {
  width: 88px;
  min-width: 88px;
  font-weight: 700;
  text-align: center;
}

@media (max-width: 640px) {
  .matching-row {
    grid-template-columns: minmax(0, 1fr) 76px;
    gap: 8px;
    padding: 9px;
  }

  .matching-select {
    width: 76px;
    min-width: 76px;
  }
}

.banner {
  background: #fff7ed;
  border: 1px solid #fb923c;
  color: #9a3412;
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 10px;
}

.no-select {
  user-select: none;
}

.no-select * {
  user-select: none !important;
}


.no-select {
  user-select: none;
}

.no-select * {
  user-select: none !important;
}


#result-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pro-hint {
  background: #fff7ed;
  border: 1px dashed #f59e0b;
  color: #92400e;
  font-size: 13px;
  padding: 6px 8px;
  border-radius: 6px;
  margin-bottom: 8px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: #fff;
  border-radius: 12px;
  padding: 18px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 14px;
}

@media (max-width: 600px) {
  .auth-card {
    margin-top: 10px;
  }

  .hero-title {
    font-size: 26px;
  }
}

@media (max-width: 768px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .question-area {
    border-left: none;
    padding-left: 0;
  }
}
