:root {
  color-scheme: light;
  --ink: #172026;
  --muted: #63707a;
  --line: #d7dde2;
  --surface: #ffffff;
  --wash: #f3f6f8;
  --brand: #166534;
  --brand-dark: #0f4d27;
  --danger: #b42318;
  --ok: #176b43;
  --focus: #2f80ed;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--wash);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
}

a {
  color: var(--brand-dark);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar__inner,
.page {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar__inner {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  color: var(--ink);
  font-size: 21px;
  font-weight: 700;
  text-decoration: none;
}

.page {
  padding: 28px 0 48px;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
}

.panel,
.question,
.result-line {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel {
  padding: 20px;
}

.panel h1,
.panel h2,
.question h2 {
  margin: 0 0 14px;
  line-height: 1.2;
}

.muted {
  color: var(--muted);
}

.form-grid {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 7px;
}

label,
.label {
  color: #2c3840;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid #b9c2ca;
  border-radius: 6px;
  padding: 9px 11px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

input:focus,
select:focus {
  border-color: var(--focus);
  outline: 3px solid rgba(47, 128, 237, 0.16);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  padding: 10px 16px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
}

.button:hover {
  background: var(--brand-dark);
}

.button--secondary {
  background: #334155;
}

.button--secondary:hover {
  background: #1f2937;
}

.alert {
  margin-bottom: 16px;
  border: 1px solid #f5b5ae;
  border-radius: 8px;
  background: #fff5f3;
  color: var(--danger);
  padding: 12px 14px;
}

.language-strip {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.language-strip img {
  width: 100%;
  height: 88px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
}

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

.timer {
  min-width: 108px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 9px 12px;
  font-size: 24px;
  font-weight: 700;
  text-align: center;
}

.timer.is-expiring {
  color: var(--danger);
}

.question-list {
  display: grid;
  gap: 16px;
}

.question {
  padding: 18px;
}

.question__meta {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.question__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 18px;
}

.question__image {
  width: 100%;
  max-height: 150px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.answers {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.answer {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  font-weight: 400;
}

.answer input {
  width: 18px;
  min-height: 18px;
  margin-top: 3px;
}

.answer.is-correct {
  border-color: #76b892;
  background: #f0fff6;
}

.answer.is-wrong {
  border-color: #ec9c94;
  background: #fff5f3;
}

.result-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.result-line {
  padding: 14px;
}

.result-line strong {
  display: block;
  font-size: 28px;
}

.sticky-actions {
  position: sticky;
  bottom: 0;
  margin-top: 18px;
  padding: 14px 0 0;
  background: linear-gradient(180deg, rgba(243, 246, 248, 0), var(--wash) 28%);
}

@media (max-width: 820px) {
  .workbench,
  .question__body,
  .result-summary {
    grid-template-columns: 1fr;
  }

  .test-header {
    align-items: flex-start;
    flex-direction: column;
  }
}
