:root {
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #132238;
  --muted: #64748b;
  --primary: #0f2f59;
  --primary-dark: #0a2344;
  --primary-light: #e8eef7;
  --accent: #b78b2f;
  --success: #0f8a4b;
  --danger: #c53030;
  --warning: #b7791f;
  --border: #d8e0ec;
  --border-strong: #bdc8d8;
  --shadow: 0 18px 45px rgba(15, 47, 89, 0.11);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --font: Tahoma, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(15, 47, 89, 0.05), transparent 360px),
    radial-gradient(circle at 16% 8%, rgba(183, 139, 47, 0.12), transparent 320px),
    var(--bg);
}

button,
input {
  font-family: inherit;
}

button {
  cursor: pointer;
}

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

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 50px;
}

.screen {
  display: none;
  animation: fadeIn 0.24s ease forwards;
}

.screen.active {
  display: block;
}

.hidden {
  display: none !important;
}

.landing-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
  padding: 18px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 32px rgba(15, 47, 89, 0.07);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  font-weight: 900;
  letter-spacing: 0.5px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.16);
}

.brand-block strong {
  display: block;
  margin-bottom: 4px;
  color: var(--primary-dark);
  font-size: 15px;
}

.brand-block span,
.header-meta {
  color: var(--muted);
  font-size: 13px;
}

.header-meta {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  white-space: nowrap;
}

.hero-card,
.setup-card,
.exam-topbar,
.question-card,
.result-hero,
.stat-card,
.review-item {
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-card {
  position: relative;
  overflow: hidden;
  min-height: 330px;
  border-radius: 30px;
  padding: 42px;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 30px;
}

.hero-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-top: 5px solid var(--primary);
  background:
    linear-gradient(90deg, rgba(15, 47, 89, 0.055), transparent 55%),
    linear-gradient(180deg, rgba(183, 139, 47, 0.06), transparent 42%);
  pointer-events: none;
}

.hero-card::after {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  left: -120px;
  bottom: -145px;
  border: 42px solid rgba(15, 47, 89, 0.045);
  border-radius: 50%;
}

.hero-copy,
.hero-stat-board {
  position: relative;
  z-index: 1;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  gap: 8px;
  color: var(--primary-dark);
  background: var(--primary-light);
  border: 1px solid #d7e2f3;
  border-radius: 999px;
  padding: 8px 13px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.hero-copy h1 {
  margin: 22px 0 16px;
  font-size: clamp(31px, 4vw, 54px);
  line-height: 1.25;
  color: var(--primary-dark);
  letter-spacing: -1px;
}

.hero-copy p {
  margin: 0;
  max-width: 720px;
  color: #40516a;
  font-size: 16px;
  line-height: 2.05;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.hero-badges span {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: #27364d;
  font-size: 13px;
  font-weight: 700;
}

.hero-stat-board {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  border-radius: 22px;
  border: 1px solid var(--border-strong);
  background: linear-gradient(180deg, #ffffff, #f7f9fc);
}

.board-title {
  padding-bottom: 12px;
  margin-bottom: 2px;
  color: var(--primary-dark);
  border-bottom: 1px solid var(--border);
  font-weight: 900;
}

.board-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #edf1f6;
}

.board-row span {
  color: var(--muted);
  font-size: 13px;
}

.board-row strong {
  color: var(--primary-dark);
  font-size: 15px;
  white-space: nowrap;
}

.board-note {
  margin-top: 8px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #fff8e8;
  border: 1px solid rgba(183, 139, 47, 0.25);
  color: #745214;
  font-size: 13px;
  line-height: 1.8;
}

.setup-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 20px;
  margin-top: 22px;
}

.setup-card {
  border-radius: var(--radius-xl);
  padding: 26px;
}

.wide-card {
  grid-column: 1 / -1;
}

.section-title {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 20px;
}

.section-title > span {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  font-weight: 900;
}

.section-title h2,
.start-card h2,
.exam-topbar h2,
.result-hero h2,
.review-title h3 {
  margin: 0 0 7px;
  line-height: 1.35;
  color: var(--primary-dark);
}

.section-title p,
.start-card p,
.review-title p,
.result-hero p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
  font-size: 13px;
}

.compact-title {
  margin-bottom: 18px;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.choice-card {
  position: relative;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
  transition: 0.2s ease;
}

.choice-card input,
.pill-option input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.choice-card:hover,
.choice-card.active {
  border-color: var(--primary);
  box-shadow: 0 14px 32px rgba(15, 47, 89, 0.12);
  transform: translateY(-2px);
}

.choice-card.active {
  background: linear-gradient(180deg, #ffffff, #f6f9fd);
  outline: 3px solid rgba(15, 47, 89, 0.07);
}

.choice-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: var(--primary-dark);
  background: var(--primary-light);
  font-weight: 900;
}

.choice-card strong {
  font-size: 18px;
  color: var(--primary-dark);
}

.choice-card small {
  color: var(--muted);
  line-height: 1.7;
}

.language-switch {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-soft);
}

.pill-option {
  position: relative;
  min-height: 54px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: var(--muted);
  font-weight: 800;
  transition: 0.2s ease;
}

.pill-option.active {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 10px 24px rgba(15, 47, 89, 0.2);
}

.field-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.field-stack:last-child {
  margin-bottom: 0;
}

.field-stack label {
  color: var(--primary-dark);
  font-weight: 900;
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
}

.number-control {
  display: grid;
  grid-template-columns: 54px 1fr 54px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 17px;
  background: var(--surface-soft);
}

.number-control button {
  border: 0;
  background: #edf2f8;
  color: var(--primary-dark);
  font-size: 24px;
  font-weight: 900;
}

.number-control input {
  width: 100%;
  border: 0;
  outline: none;
  background: #fff;
  color: var(--text);
  text-align: center;
  font-size: 20px;
  font-weight: 900;
  padding: 14px;
}

.start-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  justify-content: space-between;
  background: linear-gradient(180deg, #ffffff, #f7f9fc);
}

.policy-list {
  margin: 0;
  padding: 0 18px 0 0;
  color: #4b5c74;
  line-height: 2;
  font-size: 13px;
}

.primary-button,
.secondary-button {
  min-height: 52px;
  border: 0;
  border-radius: 15px;
  padding: 0 22px;
  font-weight: 900;
  transition: 0.2s ease;
}

.primary-button {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 14px 28px rgba(15, 47, 89, 0.2);
}

.primary-button:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.secondary-button {
  color: var(--primary-dark);
  background: #fff;
  border: 1px solid var(--border-strong);
}

.secondary-button:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-light);
}

.exam-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-radius: var(--radius-xl);
  padding: 24px 26px;
}

.timer-box {
  min-width: 180px;
  display: grid;
  gap: 7px;
  justify-items: center;
  padding: 14px 18px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--primary-light);
  color: var(--primary-dark);
}

.timer-box span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.timer-box strong {
  font-size: 30px;
  direction: ltr;
  letter-spacing: 1px;
}

.timer-box.danger {
  background: #fff1f1;
  border-color: rgba(197, 48, 48, 0.25);
  color: var(--danger);
}

.progress-wrap {
  margin: 22px 0;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e3e9f3;
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 0.25s ease;
}

.question-card {
  border-radius: 28px;
  padding: 30px;
}

.question-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.question-tag,
.question-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border-radius: 999px;
  padding: 8px 13px;
  font-size: 12px;
  font-weight: 900;
}

.question-tag {
  color: var(--primary-dark);
  background: var(--primary-light);
  border: 1px solid #d7e2f3;
}

.question-number {
  color: #775412;
  background: #fff8e8;
  border: 1px solid rgba(183, 139, 47, 0.25);
}

.question-card h3 {
  margin: 0 0 22px;
  color: var(--text);
  font-size: clamp(20px, 2.2vw, 27px);
  line-height: 1.75;
  direction: auto;
}

.options-list {
  display: grid;
  gap: 12px;
}

.option-button {
  display: grid;
  grid-template-columns: 46px 1fr;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 62px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
  color: var(--text);
  text-align: start;
  font-size: 15px;
  line-height: 1.7;
  transition: 0.2s ease;
}

.option-button:hover,
.option-button.selected {
  border-color: var(--primary);
  background: #f7faff;
}

.option-button.selected {
  box-shadow: inset 0 0 0 2px rgba(15, 47, 89, 0.1);
}

.option-letter {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 900;
}

.option-button.selected .option-letter {
  background: var(--primary);
  color: #fff;
}

.exam-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-top: 20px;
}

.action-group {
  display: flex;
  gap: 12px;
}

.result-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-radius: var(--radius-xl);
  padding: 28px;
}

.score-ring {
  --score-deg: 0deg;
  width: 146px;
  height: 146px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #fff 0 56%, transparent 57%),
    conic-gradient(var(--primary) var(--score-deg), #e1e7f0 0);
}

.score-ring strong,
.score-ring span {
  grid-area: 1 / 1;
}

.score-ring strong {
  transform: translateY(-12px);
  color: var(--primary-dark);
  font-size: 32px;
}

.score-ring span {
  transform: translateY(22px);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.stat-card {
  border-radius: var(--radius-lg);
  padding: 20px;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}

.stat-card strong {
  color: var(--primary-dark);
  font-size: 30px;
}

.review-section {
  margin-top: 22px;
}

.review-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  margin-bottom: 14px;
}

.review-list {
  display: grid;
  gap: 14px;
}

.review-item {
  border-radius: var(--radius-lg);
  padding: 18px;
  border-right: 5px solid var(--border-strong);
}

.review-item.correct {
  border-right-color: var(--success);
}

.review-item.wrong {
  border-right-color: var(--danger);
}

.review-item.empty {
  border-right-color: var(--warning);
}

.review-question {
  margin-bottom: 14px;
  color: var(--text);
  font-weight: 900;
  line-height: 1.8;
  direction: auto;
}

.review-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.review-answer {
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
  color: #27364d;
  line-height: 1.7;
  direction: auto;
}

.review-answer span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.explanation {
  margin-top: 12px;
  padding: 12px 13px;
  border-radius: 14px;
  color: #4b5c74;
  background: #fff;
  border: 1px dashed var(--border-strong);
  line-height: 1.8;
  direction: auto;
}

.result-actions {
  display: flex;
  justify-content: center;
  margin-top: 22px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .landing-header,
  .hero-card,
  .exam-topbar,
  .result-hero,
  .review-title,
  .exam-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-card {
    grid-template-columns: 1fr;
    padding: 28px;
  }

  .hero-stat-board {
    min-width: 0;
  }

  .setup-grid,
  .choice-grid,
  .stats-grid,
  .review-grid {
    grid-template-columns: 1fr;
  }

  .timer-box {
    min-width: 0;
  }

  .action-group {
    width: 100%;
    flex-direction: column;
  }

  .exam-actions > button,
  .action-group button,
  .primary-button,
  .secondary-button {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 14px;
  }

  .landing-header,
  .hero-card,
  .setup-card,
  .exam-topbar,
  .question-card,
  .result-hero {
    padding: 20px;
    border-radius: 20px;
  }

  .brand-block {
    align-items: flex-start;
  }

  .header-meta {
    width: 100%;
    text-align: center;
  }

  .hero-copy h1 {
    font-size: 28px;
  }

  .number-control {
    grid-template-columns: 48px 1fr 48px;
  }

  .option-button {
    grid-template-columns: 40px 1fr;
  }
}
