:root {
  --bg: #eef4ff;
  --surface: rgba(255, 250, 255, 0.84);
  --surface-strong: #fffaff;
  --text: #233052;
  --muted: #66759b;
  --line: rgba(95, 117, 193, 0.14);
  --teal: #4f7cff;
  --teal-deep: #3147a8;
  --sand: #ff8dc7;
  --coral: #ff7ab8;
  --shadow: 0 24px 60px rgba(74, 92, 166, 0.16);
  --radius-lg: 28px;
  --radius-md: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans SC", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(79, 124, 255, 0.24), transparent 32%),
    radial-gradient(circle at 86% 12%, rgba(255, 141, 199, 0.22), transparent 28%),
    linear-gradient(180deg, #ffffff 0%, #f8f1ff 38%, var(--bg) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.12) 1px, transparent 1px);
  background-size: 30px 30px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.2), transparent 85%);
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 48px;
}

.hero {
  margin-bottom: 24px;
}

.hero-copy,
.panel {
  backdrop-filter: blur(16px);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 34px;
  border-radius: var(--radius-lg);
}

.hero-copy h1,
.panel h2,
.result-card strong,
.stat-card strong {
  font-family: "Space Grotesk", "Noto Sans SC", sans-serif;
}

.hero-copy h1 {
  margin: 10px 0 14px;
  font-size: clamp(2.5rem, 5vw, 4.4rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
}

.hero-text {
  max-width: 44rem;
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.8;
  color: var(--muted);
}

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

.eyebrow,
.section-kicker,
.result-label,
.stat-label {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  font-weight: 700;
}

.eyebrow,
.section-kicker,
.stat-label {
  color: var(--teal);
}

.stat-card {
  padding: 20px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(244, 238, 255, 0.86));
  border: 1px solid rgba(95, 117, 193, 0.12);
}

.stat-card strong {
  display: block;
  margin: 10px 0 8px;
  font-size: 1.6rem;
}

.stat-card p,
.note,
.field small,
.result-card p,
.info-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

code {
  padding: 0.1em 0.38em;
  border-radius: 0.45em;
  background: rgba(79, 124, 255, 0.09);
  font-family: "Space Grotesk", "Noto Sans SC", sans-serif;
  font-size: 0.95em;
}

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

.panel {
  padding: 28px;
  border-radius: var(--radius-lg);
  min-width: 0;
}

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

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: start;
  margin-bottom: 24px;
}

.panel-head h2 {
  margin: 8px 0 0;
  font-size: clamp(1.5rem, 2vw, 2.15rem);
  letter-spacing: -0.04em;
}

.subpanel {
  margin-top: 22px;
  padding: 20px;
  border-radius: 22px;
  background: rgba(255, 248, 255, 0.72);
  border: 1px solid rgba(95, 117, 193, 0.1);
}

.subpanel-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: start;
}

.subpanel-head h3 {
  margin: 0 0 8px;
  font-size: 1.06rem;
}

.subpanel-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.toggle input {
  width: 18px;
  height: 18px;
}

.report-panel {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.report-panel-shell {
  position: relative;
  z-index: 1;
  width: min(860px, calc(100vw - 56px));
  max-height: min(82vh, 920px);
  overflow: auto;
  padding: 22px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 252, 255, 0.98), rgba(243, 247, 255, 0.97));
  border: 1px solid rgba(95, 117, 193, 0.14);
  box-shadow: 0 28px 70px rgba(58, 72, 146, 0.22);
  backdrop-filter: blur(18px);
}

.report-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(43, 56, 112, 0.28);
  backdrop-filter: blur(10px);
}

.field-toggle {
  justify-content: flex-start;
  grid-column: 2;
}

.field-toggle-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.field-toggle-row .secondary-button {
  min-height: 54px;
}

.field-toggle-row .secondary-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.toggle-box {
  min-height: 54px;
  padding: 0 16px;
  border: 1px solid rgba(95, 117, 193, 0.18);
  border-radius: 16px;
  background: rgba(255, 253, 255, 0.94);
  white-space: normal;
}

.toggle-slider {
  position: relative;
  min-height: 54px;
  padding: 0 18px 0 64px;
  border: 1px solid rgba(95, 117, 193, 0.18);
  border-radius: 16px;
  background: rgba(255, 252, 255, 0.96);
  white-space: normal;
  cursor: pointer;
}

.toggle-slider input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 50%;
  width: 38px;
  height: 22px;
  margin-top: -11px;
  border-radius: 999px;
  background: rgba(118, 137, 210, 0.38);
  transition: background 160ms ease;
}

.toggle-slider::after {
  content: "";
  position: absolute;
  left: 19px;
  top: 50%;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 10px rgba(61, 79, 156, 0.22);
  transition: transform 160ms ease;
}

.toggle-slider:has(input:checked)::before {
  background: linear-gradient(90deg, rgba(88, 130, 255, 0.9), rgba(255, 122, 184, 0.9));
}

.toggle-slider:has(input:checked)::after {
  transform: translateX(16px);
}

.toggle-slider:hover {
  background: rgba(250, 244, 255, 0.98);
}

.report-toggle {
  flex-shrink: 0;
}

.report-panel-actions {
  display: flex;
  gap: 10px;
  flex-direction: column;
  align-items: stretch;
  width: min(100%, 196px);
  min-width: 196px;
}

.report-panel-actions .secondary-button {
  width: 100%;
}

.report-table-wrap {
  overflow-x: auto;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
}

.report-table th,
.report-table td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid rgba(95, 117, 193, 0.12);
}

.report-table th {
  font-size: 0.9rem;
  color: var(--teal-deep);
  background: rgba(239, 244, 255, 0.76);
}

.report-input {
  min-width: 120px;
}

.report-actions {
  display: flex;
  gap: 12px;
  margin-top: 14px;
}

.secondary-button {
  border: 1px solid rgba(95, 117, 193, 0.16);
  border-radius: 14px;
  background: rgba(255, 250, 255, 0.94);
  color: var(--teal-deep);
  font: inherit;
  font-weight: 700;
  padding: 10px 14px;
  cursor: pointer;
}

.secondary-button:hover {
  background: rgba(245, 239, 255, 0.98);
}

.compact {
  margin-top: 14px;
}

.inline-select,
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.inline-select span,
.field span {
  font-weight: 700;
  font-size: 0.94rem;
}

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

input,
select {
  width: 100%;
  border: 1px solid rgba(95, 117, 193, 0.18);
  border-radius: 16px;
  background: rgba(255, 253, 255, 0.94);
  padding: 14px 16px;
  font: inherit;
  color: var(--text);
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: rgba(79, 124, 255, 0.62);
  box-shadow: 0 0 0 4px rgba(79, 124, 255, 0.14);
  transform: translateY(-1px);
}

.result-strip,
.result-stack,
.info-grid {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

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

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

.result-card {
  padding: 20px;
  border-radius: 22px;
  background: var(--surface-strong);
  border: 1px solid rgba(95, 117, 193, 0.12);
}

.result-card.accent {
  background:
    linear-gradient(135deg, rgba(86, 132, 255, 0.24), rgba(255, 214, 236, 0.82) 56%, rgba(255, 255, 255, 0.98)),
    var(--surface-strong);
  border-color: rgba(255, 122, 184, 0.26);
}

.result-card strong {
  display: block;
  margin: 10px 0 8px;
  font-size: clamp(1.5rem, 2vw, 2.2rem);
  letter-spacing: -0.04em;
}

.result-label {
  color: var(--teal-deep);
}

.note {
  margin-top: 18px;
  padding: 14px 16px;
  border-left: 4px solid var(--sand);
  background: linear-gradient(90deg, rgba(255, 141, 199, 0.14), rgba(255, 255, 255, 0.72));
  border-radius: 12px;
}

.info-grid {
  grid-template-columns: 1fr;
  align-items: start;
  gap: 18px;
}

.info-grid article {
  padding: 22px 22px 20px;
  border-radius: 20px;
  background: rgba(255, 251, 255, 0.72);
  border: 1px solid rgba(95, 117, 193, 0.1);
}

.info-grid h3 {
  margin: 0 0 10px;
  font-size: 1.05rem;
  line-height: 1.45;
  color: var(--teal-deep);
}

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

.info-intro {
  margin: 0 0 20px;
  color: var(--muted);
  line-height: 1.85;
  font-size: 0.98rem;
  max-width: 68rem;
}

.formula {
  margin: 0 0 12px;
  padding: 12px 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(86, 132, 255, 0.11), rgba(255, 214, 236, 0.18));
  color: var(--teal-deep);
  font-family: "Space Grotesk", "Noto Sans SC", sans-serif;
  line-height: 1.6;
  overflow-wrap: anywhere;
  border-left: 4px solid rgba(255, 122, 184, 0.42);
}

.formula-sub {
  margin-top: -4px;
  padding: 9px 14px;
  background: rgba(255, 214, 236, 0.24);
  font-size: 0.95rem;
  border-left-width: 2px;
}

.formula-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.75;
}

.formula-list li + li {
  margin-top: 6px;
}

.info-card h3 {
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(95, 117, 193, 0.1);
  margin-bottom: 14px;
}

.reference-block {
  margin-top: 20px;
  padding: 20px;
  border-radius: 20px;
  background: rgba(255, 251, 255, 0.74);
  border: 1px solid rgba(95, 117, 193, 0.1);
}

.reference-block h3 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

.reference-intro {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.75;
}

.reference-section + .reference-section {
  margin-top: 18px;
}

.reference-section h4 {
  margin: 0 0 10px;
  font-size: 0.98rem;
  color: var(--teal-deep);
  letter-spacing: 0.01em;
}

.reference-citations {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.8;
}

.reference-citations li + li {
  margin-top: 10px;
}

.reference-citations em {
  color: var(--text);
}

.reference-citations a {
  color: var(--teal-deep);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.18em;
}

.reference-note {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.75;
}

.site-footer {
  margin-top: 28px;
  padding: 18px 22px 24px;
  border-top: 1px solid rgba(95, 117, 193, 0.14);
  color: var(--muted);
}

.footer-copy strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-family: "Space Grotesk", "Noto Sans SC", sans-serif;
  font-size: 1rem;
}

.footer-copy p {
  margin: 0;
  line-height: 1.75;
}

.footer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 14px;
  font-size: 0.94rem;
}

.footer-meta span {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 252, 255, 0.76);
  border: 1px solid rgba(95, 117, 193, 0.12);
}

.footer-credits {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(95, 117, 193, 0.1);
  font-size: 0.92rem;
}

.footer-credits p {
  margin: 0;
  line-height: 1.7;
}

.hidden {
  display: none;
}

body.report-modal-open {
  overflow: hidden;
}

@media (max-width: 960px) {
  .content-grid,
  .result-strip,
  .result-stack,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .info-grid,
  .formula-grid {
    grid-template-columns: 1fr;
  }

  .hero-stats {
    grid-template-columns: 1fr;
  }

  .panel-head {
    flex-direction: column;
  }

  .subpanel-head,
  .report-actions {
    flex-direction: column;
  }

  .report-panel-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .field-toggle {
    grid-column: auto;
  }

  .field-toggle-row {
    flex-direction: column;
    align-items: stretch;
  }

  .report-panel {
    padding: 18px;
  }

  .report-panel-shell {
    width: min(100%, 720px);
    max-height: 88vh;
  }

  .site-footer {
    padding-left: 0;
    padding-right: 0;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .hero-copy,
  .panel {
    animation: rise-in 520ms ease both;
  }

  .content-grid > .panel:nth-child(1) {
    animation-delay: 180ms;
  }

  .content-grid > .panel:nth-child(2) {
    animation-delay: 260ms;
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}
