:root {
  --paper: #f7f8fb;
  --panel: #ffffff;
  --ink: #162033;
  --muted: #68758a;
  --line: #d8dee9;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --green: #16a34a;
  --green-soft: #dff6e8;
  --gray-soft: #eef1f5;
  --amber: #f59e0b;
  --red: #dc2626;
  --shadow: 0 20px 60px rgba(18, 32, 58, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, #f7f8fb 0%, #eaf1f6 42%, #f8fafc 100%);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  min-height: 42px;
}

a {
  color: inherit;
  text-decoration: none;
}

.landing-page {
  min-height: 100vh;
  background: #f7f8fb;
}

.landing-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 14px clamp(18px, 4vw, 54px);
  background: rgba(247, 248, 251, 0.94);
  border-bottom: 1px solid rgba(216, 222, 233, 0.9);
  backdrop-filter: blur(12px);
}

.landing-brand,
.nav-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.landing-brand strong {
  font-size: 18px;
}

.nav-actions a {
  color: var(--muted);
  font-weight: 700;
}

.nav-cta,
.primary-cta,
.pay-button {
  background: var(--blue);
  color: #fff;
  padding: 0 18px;
  font-weight: 700;
}

.hero {
  min-height: calc(100vh - 82px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 520px);
  gap: clamp(28px, 6vw, 80px);
  align-items: center;
  padding: clamp(44px, 7vw, 84px) clamp(18px, 5vw, 72px) 46px;
  background: linear-gradient(130deg, #ffffff 0%, #edf6f5 54%, #f7f8fb 100%);
}

.hero-copy {
  max-width: 720px;
}

.hero-kicker,
.section-kicker {
  margin: 0 0 12px;
  color: var(--blue-dark);
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  font-size: 13px;
}

.hero h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(40px, 7vw, 76px);
  line-height: 0.98;
  color: #10233f;
}

.hero-text {
  max-width: 680px;
  margin: 24px 0 0;
  color: #536174;
  font-size: 19px;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.primary-cta,
.secondary-cta {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  padding: 0 20px;
}

.secondary-cta {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 700;
}

.hero-preview {
  border-radius: 8px;
  border: 1px solid #c7d7ea;
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.preview-top {
  display: flex;
  justify-content: space-between;
  padding: 16px;
  background: #12345a;
  color: #fff;
  font-weight: 700;
}

.preview-body {
  display: grid;
  grid-template-columns: 118px 1fr;
  min-height: 320px;
}

.preview-side {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 18px;
  background: #f1f5f9;
  border-right: 1px solid var(--line);
}

.preview-tab,
.preview-line,
.preview-option {
  display: block;
  border-radius: 6px;
  background: #dbe3ef;
}

.preview-tab {
  height: 42px;
}

.preview-tab.active {
  background: #dff6e8;
  border: 1px solid #86d6a4;
}

.preview-question {
  display: grid;
  align-content: center;
  gap: 16px;
  padding: 28px;
}

.preview-line {
  height: 14px;
  width: 88%;
}

.preview-line.short {
  width: 54%;
  background: #aac7ee;
}

.preview-option {
  height: 48px;
}

.preview-option.selected {
  background: #dff6e8;
  border: 1px solid #69c58d;
}

.benefits,
.pricing,
.exam-types {
  padding: 64px clamp(18px, 5vw, 72px);
}

.benefits {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  background: #fff;
}

.benefits article,
.price-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 24px;
}

.benefit-icon {
  display: inline-grid;
  place-items: center;
  min-width: 52px;
  height: 34px;
  padding: 0 10px;
  border-radius: 6px;
  background: #e7f0ff;
  color: var(--blue-dark);
  font-size: 13px;
  font-weight: 800;
}

.benefits h2,
.exam-types h2,
.pricing h2 {
  margin: 16px 0 8px;
  font-size: 30px;
  line-height: 1.15;
}

.benefits p,
.price-card p,
.payment-note {
  color: var(--muted);
  line-height: 1.6;
}

.exam-types {
  display: grid;
  grid-template-columns: minmax(260px, 430px) 1fr;
  gap: 34px;
  align-items: center;
  background: #eef6f4;
}

.type-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.type-list span {
  padding: 12px 14px;
  border: 1px solid #c5ddd7;
  border-radius: 7px;
  background: #fff;
  font-weight: 700;
}

.pricing-head {
  max-width: 620px;
}

.price-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.price-card {
  position: relative;
  display: grid;
  gap: 12px;
  align-content: start;
}

.price-card.featured {
  border-color: #86d6a4;
  box-shadow: 0 18px 44px rgba(22, 163, 74, 0.13);
}

.badge {
  justify-self: start;
  padding: 7px 10px;
  border-radius: 999px;
  background: #dff6e8;
  color: #126c34;
  font-size: 12px;
  font-weight: 800;
}

.price-card h3 {
  margin: 0;
  font-size: 24px;
}

.price {
  margin: 0;
  color: #10233f;
  font-size: 38px;
  font-weight: 800;
}

.pay-button {
  margin-top: 8px;
}

.back-home {
  min-width: 156px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.24);
  font-weight: 700;
}

.exam-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 18px;
  align-items: center;
  padding: 14px 22px;
  background: #12345a;
  color: #fff;
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-icon {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  background: #fff;
  padding: 4px;
}

.eyebrow,
.candidate span,
.timer span,
#examName,
.prompt-label {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.topbar .eyebrow,
.topbar span {
  color: #c7d7ea;
}

h1 {
  margin: 2px 0 0;
  font-size: 24px;
  letter-spacing: 0;
}

.candidate,
.timer {
  display: grid;
  gap: 3px;
  padding: 8px 14px;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 8px;
  min-width: 148px;
}

.timer strong {
  font-size: 24px;
}

.exam-layout {
  display: grid;
  grid-template-columns: 330px 1fr;
  gap: 18px;
  padding: 18px;
  flex: 1;
  min-height: 0;
}

.sidebar,
.question-stage {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 34px rgba(18, 32, 58, 0.08);
}

.sidebar {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section-tabs {
  display: grid;
  gap: 8px;
}

.tab-button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: #f5f7fb;
  color: var(--ink);
  border: 1px solid transparent;
  text-align: left;
}

.tab-button.active {
  background: #e7f0ff;
  border-color: #9cc3ff;
  color: var(--blue-dark);
  font-weight: 700;
}

.tab-button.locked {
  background: #e5e7eb;
  color: #8a94a6;
  cursor: not-allowed;
}

.status-legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.status-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.dot.answered {
  background: #9ca3af;
}

.dot.active {
  background: var(--green);
}

.dot.unanswered {
  background: #e5e7eb;
  border: 1px solid #cbd5e1;
}

.flag-mini,
.flag-icon {
  width: 13px;
  height: 15px;
  display: inline-block;
  background: var(--amber);
  clip-path: polygon(0 0, 100% 16%, 70% 48%, 100% 80%, 0 64%);
}

.question-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.q-button {
  position: relative;
  height: 48px;
  background: #eef1f5;
  color: var(--ink);
  border: 1px solid #cfd7e4;
  font-weight: 700;
}

.q-button.answered {
  background: #d1d5db;
}

.q-button.active {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.q-button.flagged::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 12px;
  height: 14px;
  background: var(--amber);
  clip-path: polygon(0 0, 100% 16%, 70% 48%, 100% 80%, 0 64%);
}

.question-stage {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.question-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.question-header h2 {
  margin: 4px 0 0;
  font-size: 25px;
}

.question-number {
  min-width: 92px;
  padding: 10px 14px;
  background: #eef6ff;
  border-radius: 8px;
  color: var(--blue-dark);
  font-weight: 700;
  text-align: center;
}

.instruction-row {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 14px 22px 0;
}

.language-button {
  background: var(--blue);
  color: #fff;
  padding: 0 16px;
}

.flag-button {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff7ed;
  color: #8a5200;
  border: 1px solid #fed7aa;
  padding: 0 16px;
}

.flag-button[aria-pressed="true"] {
  background: #ffedd5;
  color: #713f12;
  font-weight: 700;
}

.question-card {
  margin: 18px 22px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  flex: 1;
  overflow: auto;
}

.audio-panel {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  margin-bottom: 18px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
}

.play-button {
  background: var(--blue);
  color: #fff;
  padding: 0 18px;
}

.play-button:disabled {
  background: #94a3b8;
  cursor: not-allowed;
}

.audio-panel p {
  margin: 3px 0 0;
  color: var(--muted);
}

.question-text {
  margin-top: 12px;
  font-size: 24px;
  line-height: 1.5;
}

.reading-box {
  padding: 16px;
  background: #f8fafc;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  font-size: 18px;
}

.choices {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.choice-button {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  align-items: center;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid #ccd6e5;
  color: var(--ink);
  text-align: left;
  min-height: 58px;
}

.choice-button:hover,
.choice-button.selected {
  background: var(--green-soft);
  border-color: var(--green);
}

.choice-key {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e2e8f0;
  font-weight: 700;
}

.choice-button.selected .choice-key {
  background: var(--green);
  color: #fff;
}

.navigation {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 0 22px 20px;
}

.navigation button {
  padding: 0 18px;
  background: #e5e7eb;
  color: var(--ink);
}

#nextButton,
#finishButton {
  background: var(--blue);
  color: #fff;
}

dialog {
  width: min(560px, calc(100% - 32px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.dialog-head h3 {
  margin: 0;
}

.dialog-head button {
  width: 38px;
  min-height: 38px;
  background: #eef1f5;
}

.language-dialog p,
#resultContent,
.payment-content {
  padding: 18px;
  margin: 0;
  line-height: 1.6;
}

.payment-content {
  display: grid;
  justify-items: center;
  gap: 14px;
  text-align: center;
}

.payment-plan {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
}

.fake-qr {
  width: 228px;
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  gap: 4px;
  padding: 14px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
}

.qr-cell {
  border-radius: 2px;
  background: #fff;
}

.qr-cell.dark {
  background: #111827;
}

.qr-cell.anchor {
  background: var(--blue-dark);
}

.score {
  font-size: 34px;
  font-weight: 700;
  color: var(--blue-dark);
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
}

.result-table th,
.result-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
}

@media (max-width: 900px) {
  .landing-nav {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero,
  .benefits,
  .exam-types,
  .price-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

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

  .exam-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    order: 2;
  }
}

@media (max-width: 560px) {
  .nav-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .hero h1 {
    font-size: 38px;
  }

  .preview-body {
    grid-template-columns: 86px 1fr;
  }

  .benefits,
  .pricing,
  .exam-types {
    padding: 42px 14px;
  }

  .exam-layout {
    padding: 10px;
  }

  h1 {
    font-size: 20px;
  }

  .question-header,
  .instruction-row,
  .navigation {
    flex-direction: column;
    align-items: stretch;
  }

  .question-card {
    margin: 14px;
    padding: 16px;
  }

  .question-text {
    font-size: 20px;
  }

  .audio-panel {
    grid-template-columns: 1fr;
  }
}
