:root {
  color-scheme: light;
  --paper: #f4f1e9;
  --paper-deep: #ebe6da;
  --ink: #183128;
  --muted: #68746e;
  --line: #cfd5ce;
  --card: rgba(255, 255, 255, 0.78);
  --accent: #d65f3a;
  --accent-dark: #a84429;
  --accent-soft: #f5ded3;
  --focus: #245e4a;
  --shadow: 0 18px 55px rgba(31, 50, 42, 0.09);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 8%, rgba(255, 255, 255, 0.92), transparent 30rem),
    linear-gradient(150deg, var(--paper) 0%, #f7f4ed 54%, var(--paper-deep) 100%);
}

button {
  font: inherit;
}

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

.topbar {
  display: grid;
  grid-template-columns: auto minmax(80px, 1fr) auto;
  gap: 20px;
  align-items: center;
  width: min(1080px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0 12px;
}

.wordmark {
  direction: ltr;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.wordmark span {
  color: var(--accent);
}

.progress-track {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(24, 49, 40, 0.1);
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 280ms ease;
}

.progress-label {
  min-width: 66px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: right;
  text-transform: uppercase;
}

.topbar-end {
  min-width: 112px;
  text-align: end;
}

.language-control select {
  max-width: 160px;
  min-height: 42px;
  padding: 8px 34px 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
}

.language-control select:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 45%, transparent);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app {
  width: min(940px, calc(100% - 36px));
  margin: auto;
  padding: 48px 0 56px;
}

.screen {
  animation: enter 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

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

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1,
h2 {
  max-width: 800px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(3rem, 8vw, 6.4rem);
  line-height: 0.98;
}

h2 {
  font-size: clamp(2rem, 5vw, 3.7rem);
  line-height: 1.04;
}

.lede {
  max-width: 610px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  line-height: 1.55;
}

.start-button,
.retry-button {
  min-width: 180px;
  min-height: 62px;
  margin-top: 34px;
  padding: 15px 28px;
  border: 0;
  border-radius: 999px;
  color: white;
  background: var(--ink);
  box-shadow: var(--shadow);
  cursor: pointer;
  font-size: 1.05rem;
  font-weight: 750;
  transition: transform 150ms ease, background 150ms ease;
}

.start-button:hover,
.retry-button:hover {
  background: var(--focus);
  transform: translateY(-2px);
}

.start-button:focus-visible,
.retry-button:focus-visible,
.choice:focus-visible,
.back-button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 45%, transparent);
  outline-offset: 3px;
}

.time-note {
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.9rem;
}

.question-heading {
  margin-bottom: 28px;
}

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

.choice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: start;
  width: 100%;
  min-height: 76px;
  padding: 21px 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--ink);
  background: var(--card);
  box-shadow: 0 5px 22px rgba(31, 50, 42, 0.035);
  cursor: pointer;
  line-height: 1.5;
  text-align: left;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.choice:hover {
  border-color: color-mix(in srgb, var(--accent) 62%, var(--line));
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.choice-key {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-top: 1px;
  border-radius: 10px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 0.82rem;
  font-weight: 850;
}

.choice-text {
  font-size: clamp(1rem, 1.8vw, 1.14rem);
}

.choice-copy {
  display: grid;
  gap: 10px;
}

.choice.compact {
  align-items: center;
  min-height: 68px;
  font-weight: 700;
}

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

.answer-choices {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 32px;
}

.answer-choices .choice {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 90px;
  padding: 18px;
  font-size: 1.08rem;
  font-weight: 800;
  text-align: center;
}

.followup-copy {
  max-width: 760px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}

.comparison-statements {
  display: grid;
  gap: 12px;
  margin: 28px 0 24px;
}

.statement-reference {
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
}

.statement-reference.selected {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  background: var(--accent-soft);
}

.statement-reference-heading {
  display: flex;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.statement-reference.selected .statement-reference-heading {
  color: var(--accent-dark);
}

.statement-reference p {
  margin: 16px 0 0;
  font-size: 1rem;
  line-height: 1.55;
}

.alternatives-label {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 700;
}

.result-number {
  display: block;
  margin: 8px 0 16px;
  color: var(--accent);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(8rem, 28vw, 17rem);
  font-weight: 500;
  line-height: 0.8;
}

.result-description {
  max-width: 780px;
  margin: 26px 0 0;
  color: var(--ink);
  font-size: clamp(1.05rem, 2vw, 1.22rem);
  line-height: 1.7;
}

.all-types {
  margin-top: clamp(72px, 11vw, 130px);
  padding-top: clamp(44px, 7vw, 76px);
  border-top: 1px solid var(--line);
}

.all-types h2 {
  font-size: clamp(2.2rem, 5vw, 4rem);
}

.type-list {
  display: grid;
  gap: 16px;
  margin-top: 30px;
}

.type-card {
  padding: clamp(22px, 4vw, 34px);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
}

.type-card.selected {
  border: 2px solid var(--accent);
  background: color-mix(in srgb, var(--accent-soft) 58%, white);
  box-shadow: var(--shadow);
}

.type-card-heading {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}

.type-card-number {
  color: var(--accent);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.5rem;
  line-height: 1;
}

.type-card h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 500;
}

.type-card p {
  margin: 16px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.type-badge {
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.status-card {
  max-width: 720px;
  padding: clamp(26px, 6vw, 54px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.loading-mark {
  width: 52px;
  height: 52px;
  margin-bottom: 28px;
  border: 5px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 850ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.navigation {
  width: min(940px, calc(100% - 36px));
  margin: 0 auto;
  padding: 0 0 max(22px, env(safe-area-inset-bottom));
}

.back-button {
  padding: 12px 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 750;
}

.back-button:hover {
  color: var(--ink);
}

@media (max-width: 640px) {
  .topbar {
    grid-template-columns: auto minmax(40px, 1fr) auto;
    width: min(100% - 28px, 1080px);
    gap: 10px;
    padding-top: 18px;
  }

  .progress-label {
    display: none;
  }

  .topbar-end {
    min-width: auto;
  }

  .language-control select {
    width: 132px;
    max-width: 36vw;
  }

  .app {
    width: min(100% - 28px, 940px);
    padding: 34px 0 42px;
  }

  .choice {
    gap: 13px;
    padding: 18px;
    border-radius: 15px;
  }

  .choice-key {
    width: 31px;
    height: 31px;
  }

  .statement-reference {
    padding: 18px;
  }

  .answer-choices {
    grid-template-columns: 1fr;
  }

  .closeness-answers {
    grid-template-columns: 1fr;
  }

  .answer-choices .choice {
    min-height: 66px;
  }

  .navigation {
    width: min(100% - 28px, 940px);
  }
}

[dir="rtl"] .choice,
[dir="rtl"] .statement-reference,
[dir="rtl"] .type-card {
  text-align: right;
}

[dir="rtl"] .language-control select {
  padding: 8px 12px 8px 34px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
