:root {
  color-scheme: light;
  --bg: #ebeef3;
  --surface: #ffffff;
  --surface-2: #f2f3f7;
  --border: #d4d8e1;
  --text: #1b1b27;
  --muted: #626779;
  --purple: #843dc1;
  --purple-on-dark: #c77cf5;
  --purple-soft: #aa79d1;
  --cyan: #178698;
  --amber: #c65911;
  --danger: #b42338;
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: linear-gradient(180deg, #23142e 0 315px, var(--bg) 315px);
  color: var(--text);
  line-height: 1.55;
}

button, input, select { font: inherit; }
button, summary, select { cursor: pointer; }
a { color: var(--cyan); }

.page-shell {
  width: min(1160px, calc(100% - 34px));
  margin: 0 auto;
}

.hero {
  min-height: 245px;
  padding: 54px 0 36px;
  color: #fff;
  text-align: center;
}

.eyebrow, .hero-subtitle, .result-label {
  margin: 0;
  color: var(--cyan);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .24em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 8px 0 2px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3.2rem, 9vw, 7rem);
  line-height: .95;
  letter-spacing: -.035em;
  text-transform: uppercase;
}

.hero h1 span { color: var(--purple-on-dark); }
.hero-subtitle { margin-top: 18px; color: #c9c1cf; }
.eyebrow { color: #d4a8ef; }

.accordion, .form-card, .result-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 34px rgba(38, 31, 48, .08);
}

.accordion { margin-bottom: 22px; overflow: hidden; }
.accordion.important { margin-top: -28px; border: 0; box-shadow: 0 16px 40px rgba(25, 17, 31, .17); }

.accordion summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 26px;
  color: #292333;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: .98rem;
  font-weight: 700;
  letter-spacing: .08em;
  list-style: none;
  text-transform: uppercase;
}

.accordion summary::-webkit-details-marker { display: none; }
.accordion summary::after { content: "+"; margin-left: auto; color: var(--cyan); font-family: ui-sans-serif, system-ui; font-size: 1.5rem; font-weight: 400; }
.accordion[open] summary::after { content: "−"; }
.summary-icon { display: inline-grid; width: 28px; height: 28px; place-items: center; border: 1px solid var(--purple); border-radius: 50%; color: var(--purple); font-family: Georgia, serif; }

.accordion-content {
  padding: 2px 28px 26px;
  border-top: 1px solid #e0e2e8;
}

.prose { color: #4f5260; }
.prose p { max-width: none; }
.accordion-content.prose p { text-align: left; hyphens: none; }
.prose h3 { margin: 26px 0 8px; color: #292b36; font-size: 1rem; }
.prose li { margin: 6px 0; }

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

.form-card { padding: 0 28px 28px; overflow: visible; }
.section-heading { display: flex; align-items: center; gap: 14px; margin: 0 -28px 26px; padding: 20px 28px; border: 0; border-radius: 18px 18px 0 0; background: #282332; color: #fff; }
.section-heading > span { display: inline-grid; width: 36px; height: 36px; place-items: center; border: 1px solid var(--purple-on-dark); border-radius: 50%; background: var(--purple); color: #fff; font-weight: 800; }
.section-heading h2 { margin: 0; font-family: Inter, ui-sans-serif, system-ui, sans-serif; font-size: 1.34rem; }

.field { position: relative; margin: 0 0 22px; }
.field:last-child { margin-bottom: 0; }
.field > label { display: flex; min-height: 2.6rem; margin-bottom: 10px; align-items: flex-end; gap: .45em; flex-wrap: wrap; }
.field label { color: #3f4250; font-size: .79rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.unit { color: var(--muted); font-size: .72rem; text-transform: none; white-space: nowrap; }

input, select {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid #bdc2cc;
  border-radius: 12px;
  outline: none;
  background: #f9fafb;
  color: var(--text);
}

input:focus, select:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(132, 61, 193, .12); background: #fff; }
input[aria-invalid="true"] { border-color: var(--danger); }
input::placeholder { color: #868c98; }
.field-error { min-height: 20px; margin: 4px 0 0; color: var(--danger); font-size: .82rem; }
.field-error:empty { min-height: 0; margin-top: 0; }
.form-error { padding: 12px 16px; border: 1px solid rgba(180,35,56,.35); border-radius: 10px; background: #fff1f3; color: #8f1830; }

.label-row { position: relative; display: flex; min-height: 2.6rem; align-items: flex-end; gap: 8px; margin-bottom: 10px; }
.label-row label { margin: 0 auto 0 0; }
.info-button { display: inline-grid; width: 20px; height: 20px; padding: 0; place-items: center; border: 1px solid var(--purple); border-radius: 50%; background: transparent; color: var(--purple); font-size: .72rem; font-weight: 800; }
.info-button:focus { outline: 2px solid var(--purple); outline-offset: 2px; }
.info-popover { position: absolute; z-index: 5; right: 0; top: 30px; width: min(330px, 85vw); padding: 12px 14px; border: 1px solid #d1d4dc; border-radius: 10px; background: #fff; color: #30323b; box-shadow: 0 12px 28px rgba(33,29,40,.15); font-size: .86rem; }

.calculate-button {
  width: 100%;
  min-height: 62px;
  margin: 0 0 34px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(100deg, #23142e, var(--purple));
  color: white;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  box-shadow: 0 12px 24px rgba(71, 31, 102, .22);
}
.calculate-button:hover { filter: brightness(1.08); }
.calculate-button:focus { outline: 3px solid var(--purple-soft); outline-offset: 3px; }
.calculate-button:disabled { cursor: wait; opacity: .7; }
.privacy-note { margin: -18px 0 34px; color: var(--muted); font-size: .82rem; text-align: center; }

.result-card { --result-color: var(--cyan); position: relative; overflow: hidden; margin: 0 0 34px; padding: clamp(28px, 6vw, 58px); border-left: 8px solid var(--result-color); text-align: center; scroll-margin-top: 20px; }
.result-card:focus { outline: none; }
.result-high { --result-color: var(--purple); background: linear-gradient(110deg, #f1e6f8, #fff 48%); }
.result-intermediate { --result-color: var(--amber); background: linear-gradient(110deg, #faeadf, #fff 48%); }
.result-low { --result-color: var(--cyan); background: linear-gradient(110deg, #e2f2f4, #fff 48%); }
.result-label { padding-left: .24em; color: var(--muted); }
.result-card h2 { margin: 16px 0 2px; color: var(--result-color); font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.45rem, 5vw, 4.35rem); line-height: 1; letter-spacing: .06em; }
.score-line { margin: 0 0 24px; color: var(--muted); }
.score-line strong { display: block; color: #22232b; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.2rem, 6vw, 4.5rem); font-weight: 500; line-height: 1.1; }

.scale { width: min(800px, 100%); margin: 0 auto 26px; }
.scale-track { position: relative; height: 14px; overflow: hidden; border: 1px solid #bdc2cc; border-radius: 999px; background: #e5e7ec; }
.scale-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--result-color); transition: width .5s ease; }
.scale-track .mark { position: absolute; top: -4px; bottom: -4px; width: 2px; background: rgba(45,48,57,.52); }
.mark-low { left: 7.5%; }
.mark-high { left: 75%; }
.scale-labels { position: relative; display: flex; justify-content: space-between; margin-top: 7px; color: #666b77; font-size: .78rem; }
.scale-labels .label-low, .scale-labels .label-high { position: absolute; transform: translateX(-50%); }
.label-low { left: 7.5%; }
.label-high { left: 75%; }
.result-guidance { max-width: 880px; margin: 12px auto 24px; padding: 18px 20px; border-left: 5px solid var(--result-color); background: rgba(255,255,255,.66); color: #2f3139; font-size: 1.06rem; font-weight: 650; line-height: 1.65; text-align: left; }
.result-notes { max-width: 860px; margin: 22px auto; padding: 16px 4px 0; border-top: 1px solid #d7dae1; background: transparent; color: #5b606b; font-size: .91rem; line-height: 1.55; text-align: left; }
.result-notes p { margin: 0 0 10px; }
.result-actions { display: flex; justify-content: center; align-items: center; gap: 14px; flex-wrap: wrap; }
.secondary-button { min-height: 44px; padding: 9px 18px; border: 1px solid #8b8f9b; border-radius: 10px; background: transparent; color: #292b33; }
.copy-status { color: var(--muted); font-size: .86rem; }

.information-sections { margin-top: 10px; }
.evidence-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 22px 0; }
.evidence-grid article { padding: 18px; border: 1px solid #dadde4; border-radius: 14px; background: #f5f6f8; }
.evidence-grid h3 { margin-top: 0; color: var(--cyan); }
.references { padding-left: 22px; }

footer { padding: 34px 12px 46px; border-top: 1px solid #d4d8e1; color: #686d79; text-align: center; font-size: .85rem; }

@media (min-width: 781px) and (max-width: 900px) {
  .section-heading h2 { font-size: 1.12rem; }
}

@media (max-width: 780px) {
  .page-shell { width: min(100% - 20px, 680px); }
  body { background: linear-gradient(180deg, #23142e 0 280px, var(--bg) 280px); }
  .hero { min-height: 220px; padding: 42px 0 30px; }
  .hero h1 { font-size: clamp(2.8rem, 15vw, 5rem); }
  .form-grid, .evidence-grid { grid-template-columns: 1fr; }
  .form-card { padding: 0 18px 22px; }
  .section-heading { margin-inline: -18px; padding-inline: 18px; }
  .field > label, .label-row { min-height: 0; }
  .accordion summary { padding: 18px; font-size: .95rem; }
  .accordion-content { padding: 2px 18px 20px; }
  .accordion-content.prose p { text-align: left; }
  .result-card { padding-inline: 18px; }
  .result-intermediate h2 { font-size: clamp(1.75rem, 8.2vw, 2.15rem); letter-spacing: .035em; }
  .result-guidance { padding: 15px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
