:root {
  --bg: #f4f1ea;
  --surface: rgba(255, 255, 255, 0.84);
  --surface-strong: #ffffff;
  --surface-muted: #eef3f2;
  --text: #183136;
  --text-soft: #4d6367;
  --border: rgba(24, 49, 54, 0.12);
  --primary: #0f6c73;
  --primary-deep: #0a4d52;
  --accent: #d86f3d;
  --danger: #b04435;
  --danger-bg: #f9e8e4;
  --shadow: 0 24px 60px rgba(24, 49, 54, 0.12);
  --axonal: #ba5a31;
  --demyelinating: #3b8f8b;
  --intact: #d8c48f;
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(216, 111, 61, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(15, 108, 115, 0.18), transparent 24%),
    linear-gradient(180deg, #faf7f1 0%, #f1ede4 100%);
}

button,
input {
  font: inherit;
}

.page-shell {
  width: min(1240px, calc(100% - 32px));
  margin: 32px auto;
}

.hero {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: 24px;
  align-items: stretch;
  margin-bottom: 24px;
}

.hero-copy,
.hero-note,
.panel {
  backdrop-filter: blur(18px);
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: var(--shadow);
}

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

.hero-note {
  padding: 32px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(15, 108, 115, 0.94), rgba(10, 77, 82, 0.96));
  color: #f4fbfa;
}

.eyebrow,
.section-kicker,
.result-label {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.76rem;
  font-weight: 700;
}

.eyebrow,
.section-kicker {
  color: var(--accent);
}

.hero h1,
.panel h2,
.report-card h3,
.chart-card h3,
.result-state h3 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-weight: 700;
  line-height: 1;
}

.hero h1 {
  font-size: clamp(2.4rem, 4vw, 4.5rem);
  margin-bottom: 18px;
}

.hero h2,
.panel h2 {
  font-size: 1.5rem;
}

.hero-text,
.section-copy,
.hero-note p,
.result-state p,
#reportSummary {
  margin: 0;
  line-height: 1.7;
  color: var(--text-soft);
}

.hero-note p,
.hero-note h2 {
  color: inherit;
}

.hero-note h2 {
  margin-bottom: 12px;
}

.workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

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

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

.calculator-form {
  display: grid;
  gap: 20px;
}

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

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 0.95rem;
  font-weight: 600;
}

.field input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  background: var(--surface-strong);
  color: var(--text);
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.field input:focus {
  outline: none;
  border-color: rgba(15, 108, 115, 0.65);
  box-shadow: 0 0 0 4px rgba(15, 108, 115, 0.12);
  transform: translateY(-1px);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.actions.compact {
  justify-content: flex-end;
}

.button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}

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

.button:active {
  transform: translateY(0);
}

.button-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  color: #f5fbfb;
  box-shadow: 0 12px 24px rgba(15, 108, 115, 0.24);
}

.button-secondary {
  background: #e4f0ef;
  color: var(--primary-deep);
}

.button-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.formula-card,
.report-card,
.chart-card,
.result-state {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(247, 249, 248, 0.92));
}

.formula-card {
  margin-top: 24px;
  padding: 22px;
}

.formula-card h3,
.report-card h3,
.chart-card h3,
.result-state h3 {
  margin-bottom: 14px;
  font-size: 1.35rem;
}

.formula-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--text-soft);
  line-height: 1.7;
}

.alert {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(176, 68, 53, 0.16);
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 600;
}

.result-state {
  min-height: 520px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 48px 24px;
}

.result-content {
  display: grid;
  gap: 20px;
}

.chart-card,
.report-card {
  padding: 24px;
}

.chart-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 20px;
}

.chart-layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) 1fr;
  gap: 24px;
  align-items: center;
}

.chart-frame {
  display: grid;
  place-items: center;
  padding: 16px;
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at 50% 30%, rgba(15, 108, 115, 0.08), transparent 56%),
    linear-gradient(180deg, #fcfcfa, #f3f1ea);
  min-height: 340px;
}

.chart-svg {
  max-width: 100%;
  height: auto;
}

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

.metric {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.metric h4,
.metric p {
  margin: 0;
}

.metric h4 {
  margin-bottom: 4px;
  font-size: 0.98rem;
}

.metric p {
  color: var(--text-soft);
  font-weight: 700;
  font-size: 1.1rem;
}

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.metric.axonal .swatch {
  background: var(--axonal);
}

.metric.demyelinating .swatch {
  background: var(--demyelinating);
}

.metric.intact .swatch {
  background: var(--intact);
}

.calc-details {
  display: grid;
  gap: 12px;
  margin: 18px 0 0;
}

.calc-details div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.calc-details dt {
  font-weight: 700;
}

.calc-details dd {
  margin: 0;
  color: var(--text-soft);
}

@media (max-width: 1040px) {
  .hero,
  .workspace,
  .field-grid,
  .chart-layout {
    grid-template-columns: 1fr;
  }

  .panel-heading,
  .chart-toolbar,
  .calc-details div {
    flex-direction: column;
  }

  .actions.compact {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 20px, 100%);
    margin: 12px auto 24px;
  }

  .hero-copy,
  .hero-note,
  .panel {
    padding: 22px;
  }

  .button {
    width: 100%;
    justify-content: center;
  }
}
