:root {
  --bg: #f3f8fc;
  --surface: #ffffff;
  --ink: #080b0f;
  --muted: #536475;
  --line: #d8e7f1;
  --line-strong: #b9cfdf;
  --accent: #1683d8;
  --accent-dark: #075c9f;
  --accent-soft: #e8f4ff;
  --accent-tint: #f4faff;
  --shadow: 0 20px 60px rgba(7, 50, 84, 0.14);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter,
    "Noto Sans Sinhala",
    "Noto Sans Tamil",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

body {
  min-height: 100vh;
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 0;
}

.hero-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100vh;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(250, 253, 255, 0.98) 58%, #f3f8fc 100%),
    radial-gradient(circle at 14% 0%, rgba(22, 131, 216, 0.15), transparent 36%),
    radial-gradient(circle at 94% 18%, rgba(8, 92, 159, 0.08), transparent 28%);
}

.hero-panel::before {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(22, 131, 216, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(22, 131, 216, 0.055) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 56%);
}

.topbar,
.intro,
.quiz,
.loading-screen,
.result-screen,
.trust-row {
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 14px;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: var(--accent-dark);
}

.brand-mark svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.brand-mark svg path:last-child {
  stroke: var(--ink);
}

.brand-label {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 800;
}

.trust-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 0 18px;
}

.trust-pill {
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(244, 250, 255, 0.88);
  color: var(--muted);
  font-size: clamp(0.66rem, 2.7vw, 0.75rem);
  font-weight: 700;
  line-height: 1.1;
  padding: 6px 8px;
  text-align: center;
}

.trust-pill svg {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  fill: none;
  stroke: var(--accent-dark);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.trust-pill span {
  min-width: 0;
}

.language-modal {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(246, 251, 255, 0.58) 0%, rgba(246, 251, 255, 0.92) 48%),
    rgba(8, 11, 15, 0.16);
  backdrop-filter: blur(12px);
}

.language-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  padding: 22px;
}

.language-card h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.8rem, 8vw, 2.45rem);
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.02;
}

.language-subtitle {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
  font-weight: 550;
  line-height: 1.45;
}

.language-options {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.language-button {
  display: flex;
  width: 100%;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--accent-tint);
  color: var(--ink);
  cursor: pointer;
  padding: 13px 14px;
  text-align: left;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.language-button::after {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  content: "";
  box-shadow: inset 0 0 0 4px #ffffff;
}

.language-button:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  box-shadow: 0 10px 28px rgba(22, 131, 216, 0.12);
}

.language-native,
.language-name {
  display: block;
}

.language-native {
  font-size: 1.02rem;
  font-weight: 800;
}

.language-name {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.intro {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  min-height: 560px;
  padding: 34px 18px 24px;
}

.hero-copy {
  display: flex;
  flex-direction: column;
}

.hero-visual {
  position: relative;
  order: -1;
  height: 220px;
  margin: 0 0 22px;
  overflow: visible;
}

.hero-visual img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 22px 34px rgba(7, 50, 84, 0.18));
}

.eyebrow,
.question-kicker,
.result-label {
  margin: 0 0 12px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 12ch;
  margin: 0;
  color: var(--ink);
  font-size: clamp(2.8rem, 15vw, 4.45rem);
  font-weight: 800;
  letter-spacing: 0;
  line-height: 0.9;
}

html[lang="si"] h1,
html[lang="ta"] h1 {
  max-width: 13ch;
  font-size: clamp(2.25rem, 11vw, 3.35rem);
  line-height: 1.04;
}

html[lang="si"] .subhead,
html[lang="ta"] .subhead,
html[lang="si"] .fine-print,
html[lang="ta"] .fine-print {
  line-height: 1.65;
}

.subhead {
  max-width: 35rem;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.55;
}

.fine-print {
  max-width: 34rem;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.language-link {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  align-self: center;
  margin: 18px auto 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(244, 250, 255, 0.78);
  color: var(--accent-dark);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 9px 12px;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    transform 160ms ease;
}

.language-link:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: var(--accent-tint);
}

.language-link svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 800;
  line-height: 1;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease;
}

.primary-button {
  width: 100%;
  margin-top: 28px;
  background: linear-gradient(135deg, #080b0f 0%, #0b3e67 100%);
  box-shadow: 0 14px 30px rgba(7, 50, 84, 0.18);
  color: #ffffff;
}

.primary-button svg,
.secondary-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.3;
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

.primary-button:active,
.secondary-button:active {
  transform: translateY(0);
}

.secondary-button {
  width: 38%;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  color: var(--ink);
}

.quiz {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 24px 18px;
}

.progress-block {
  margin-top: 10px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

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

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

.question-card {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  min-height: 430px;
  padding: 28px 0;
}

.question-card h2,
.result-screen h2,
.loading-screen h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.75rem, 8vw, 2.45rem);
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.02;
}

.options-grid {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.option-button {
  display: flex;
  width: 100%;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  cursor: pointer;
  font-weight: 750;
  padding: 14px 14px;
  text-align: left;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.option-button::after {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  content: "";
}

.option-button:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
}

.option-button.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 10px 28px rgba(22, 131, 216, 0.14);
}

.option-button.is-selected::after {
  border: 5px solid var(--accent);
  background: #ffffff;
}

.quiz-actions {
  display: flex;
  gap: 10px;
  margin-top: auto;
}

.quiz-actions .primary-button {
  flex: 1;
  margin-top: 0;
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  transform: none;
}

.loading-screen,
.result-screen {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  min-height: 620px;
  padding: 28px 18px;
}

.loader {
  width: 56px;
  height: 56px;
  margin-bottom: 24px;
  border: 4px solid #dcebf6;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

.loading-screen p,
.result-subtitle {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 1.04rem;
  font-weight: 650;
  line-height: 1.45;
}

.result-icon {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  margin-bottom: 22px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.result-icon svg {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.is-hidden {
  display: none;
}

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

@media (min-width: 560px) {
  .app-shell {
    padding: 28px;
  }

  .hero-panel {
    width: min(100%, 430px);
    min-height: min(860px, calc(100vh - 56px));
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
  }

  .intro,
  .quiz,
  .loading-screen,
  .result-screen {
    padding-right: 24px;
    padding-left: 24px;
  }

  .topbar,
  .trust-row {
    padding-right: 24px;
    padding-left: 24px;
  }
}

@media (min-width: 760px) {
  .app-shell {
    padding: 36px;
  }

  .hero-panel {
    width: min(100%, 680px);
    min-height: min(820px, calc(100vh - 72px));
  }

  .topbar,
  .trust-row,
  .intro,
  .quiz,
  .loading-screen,
  .result-screen {
    padding-right: 42px;
    padding-left: 42px;
  }

  .topbar {
    padding-top: 28px;
  }

  .trust-row {
    gap: 10px;
  }

  .trust-pill {
    min-height: 40px;
    font-size: 0.8rem;
  }

  .intro {
    min-height: 520px;
    padding-top: 48px;
  }

  .hero-visual {
    height: 330px;
    margin-bottom: 28px;
  }

  h1 {
    max-width: 13ch;
    font-size: clamp(4.2rem, 9vw, 5.35rem);
  }

  html[lang="si"] h1,
  html[lang="ta"] h1 {
    max-width: 16ch;
    font-size: clamp(3rem, 6.8vw, 4.4rem);
  }

  .subhead {
    max-width: 38rem;
    font-size: 1.08rem;
  }

  .primary-button {
    max-width: 460px;
  }

  .language-link {
    align-self: flex-start;
    margin-right: 0;
    margin-left: 0;
  }

  .language-modal {
    align-items: center;
    padding: 32px;
  }

  .language-card {
    max-width: 520px;
    padding: 28px;
  }

  .language-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .language-button {
    min-height: 96px;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
  }

  .language-button::after {
    display: none;
  }

  .question-card {
    min-height: 390px;
  }

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

  .option-button {
    min-height: 72px;
  }

  .quiz-actions .primary-button {
    max-width: none;
  }

  .loading-screen,
  .result-screen {
    min-height: 540px;
  }
}

@media (min-width: 1080px) {
  .app-shell {
    padding: 48px;
  }

  .hero-panel {
    width: min(1120px, 100%);
    min-height: min(760px, calc(100vh - 96px));
    border-radius: 28px;
  }

  .hero-panel::before {
    background-size: 42px 42px;
  }

  .topbar,
  .trust-row,
  .intro,
  .quiz,
  .loading-screen,
  .result-screen {
    padding-right: 56px;
    padding-left: 56px;
  }

  .topbar {
    padding-top: 32px;
  }

  .trust-row {
    max-width: 560px;
  }

  .intro {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(300px, 0.82fr);
    gap: 54px;
    align-items: center;
    max-width: none;
    min-height: 560px;
    padding-top: 58px;
    padding-bottom: 44px;
  }

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

  .hero-visual {
    order: 0;
    height: min(560px, 62vh);
    min-height: 440px;
    margin: 0;
  }

  h1 {
    max-width: 13ch;
    font-size: clamp(4.6rem, 6vw, 6.2rem);
  }

  html[lang="si"] h1,
  html[lang="ta"] h1 {
    max-width: 18ch;
    font-size: clamp(3.7rem, 5vw, 5.25rem);
  }

  .subhead {
    max-width: 46rem;
    font-size: 1.12rem;
  }

  .fine-print {
    max-width: 42rem;
  }

  .quiz {
    max-width: 760px;
    min-height: 560px;
  }

  .progress-block {
    margin-top: 18px;
  }

  .question-card h2,
  .result-screen h2,
  .loading-screen h2 {
    max-width: 16ch;
    font-size: clamp(2.4rem, 4vw, 3.35rem);
  }

  .question-card {
    min-height: 360px;
  }

  .loading-screen,
  .result-screen {
    max-width: 720px;
    min-height: 560px;
  }
}

@media (max-height: 680px) {
  .intro,
  .loading-screen,
  .result-screen {
    min-height: 500px;
    justify-content: flex-start;
    padding-top: 36px;
  }

  .question-card {
    min-height: 340px;
    justify-content: flex-start;
  }

  .hero-visual {
    height: 170px;
    margin-bottom: 16px;
  }

  h1 {
    font-size: clamp(2.55rem, 13vw, 3.65rem);
  }
}
