:root {
  --homeShell: 1120px;
  --homeContent: 1040px;
  --pageBg: #e6eef7;
  --pageGlow: rgba(0, 33, 71, 0.14);
  --card: #ffffff;
  --ink: #0d1d36;
  --muted: #314866;
  --line: #9fb2cb;
  --line-soft: #d6e0eb;
  --accent: #001a36;
  --accentSoft: rgba(0, 26, 54, 0.12);
  --shadow: 0 18px 36px rgba(0, 33, 71, 0.12);
  --warning: #8d4c00;
  --warningBg: #fff3e6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Times New Roman", Times, "Nimbus Roman No9 L", serif;
  background:
    radial-gradient(circle at top right, var(--pageGlow), transparent 28%),
    linear-gradient(180deg, #f8fbff 0%, var(--pageBg) 100%);
  color: var(--ink);
  padding: 24px 16px 48px;
}

a {
  color: inherit;
}

.siteShell {
  max-width: var(--homeShell);
  margin: 0 auto;
}

.siteBar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
  padding: 16px 20px;
  border: 1px solid rgba(146, 166, 191, 0.95);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 28px rgba(0, 33, 71, 0.08);
  backdrop-filter: blur(10px);
}

.siteBrand {
  color: var(--accent);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
}

.siteTagline {
  margin: 0;
  max-width: 520px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
  text-align: right;
}

.app-shell {
  width: min(100%, var(--homeContent));
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.hero,
.panel,
.result-card,
.footer {
  background: var(--card);
  border: 1px solid #99aec9;
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.hero {
  padding: 30px 32px 34px;
  background:
    linear-gradient(135deg, rgba(0, 26, 54, 0.13), rgba(255, 255, 255, 0.99) 55%),
    var(--card);
  text-align: center;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  color: var(--accent);
  font-size: clamp(30px, 3.1vw, 42px);
  line-height: 1.08;
  letter-spacing: -0.015em;
}

.heroLead {
  margin: 14px auto 0;
  max-width: 760px;
  color: #213651;
  font-size: clamp(16px, 1rem + 0.35vw, 20px);
  line-height: 1.6;
}

.heroNote {
  margin: 10px auto 0;
  max-width: 780px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.form-panels,
.results {
  display: grid;
  gap: 16px;
}

.panel,
.result-card,
.footer {
  padding: 22px 24px;
}

.panel h2,
.result-card h2 {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 22px;
  line-height: 1.25;
}

.panel h3,
.result-card h3 {
  color: var(--accent);
}

.grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
  align-items: start;
}

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

label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

input,
select,
textarea {
  margin-top: 8px;
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(0, 33, 71, 0.55);
  box-shadow: 0 0 0 3px rgba(0, 33, 71, 0.12);
}

.hint {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
  color: #4e6581;
}

.checkbox-grid {
  align-items: start;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 10px;
  min-height: 100%;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fafd 100%);
  font-size: 14px;
  line-height: 1.4;
  text-align: left;
}

.checkbox-row input {
  width: auto;
  min-height: auto;
  margin: 2px 0 0;
  padding: 0;
  border-radius: 4px;
  box-shadow: none;
}

.inline-confirmation {
  align-items: center;
}

.calculator {
  margin-top: 14px;
  padding: 18px;
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  background: linear-gradient(180deg, #fbfdff 0%, #f4f8fc 100%);
}

.calc-title {
  margin: 0 0 8px;
  font-size: 17px;
}

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

.score-row {
  margin: 0;
  font-size: 14px;
}

.score-row select {
  margin-top: 6px;
}

.calc-actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.primary-btn,
.secondary-btn,
.ghost-btn {
  min-height: 46px;
  padding: 12px 16px;
  border-radius: 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

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

.primary-btn {
  border: 1px solid rgba(0, 26, 54, 0.6);
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 12px 20px rgba(0, 33, 71, 0.18);
}

.secondary-btn {
  border: 1px solid #7f97b7;
  background: #eef4fb;
  color: var(--accent);
}

.ghost-btn {
  border: 1px solid #bfd0dd;
  background: #f9fbfd;
  color: #355171;
}

.form-panels > .primary-btn {
  width: 100%;
}

.score-chip {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid #c0d6e8;
  border-radius: 999px;
  background: #eaf3fb;
  color: #14425f;
  font-size: 13px;
  font-weight: 700;
}

.mmrc-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: 10px;
}

.mmrc-row {
  margin: 0;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: #2f4559;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
}

.mmrc-row input {
  width: auto;
  min-height: auto;
  margin: 2px 0 0;
  padding: 0;
  box-shadow: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.result-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.result-card ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.result-card li {
  margin: 8px 0;
  color: var(--muted);
  line-height: 1.5;
}

.note-title {
  margin: 0;
}

.caution {
  border-left: 6px solid #d29a4a;
  background: linear-gradient(180deg, #ffffff 0%, var(--warningBg) 100%);
}

.hidden {
  display: none;
}

.note-output {
  margin-top: 12px;
  min-height: 320px;
  resize: vertical;
  background: #fcfeff;
  color: #21384c;
  font: 14px/1.5 "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
}

.footer {
  font-size: 15px;
  line-height: 1.55;
}

.footer p {
  margin: 0 0 10px;
  color: var(--muted);
}

.footer p:last-child {
  margin-bottom: 0;
}

.footer a {
  color: #0f4f96;
}

.warning {
  color: var(--warning);
  font-weight: 700;
}

@media (max-width: 900px) {
  .siteBar {
    flex-direction: column;
    align-items: flex-start;
  }

  .siteTagline {
    max-width: none;
    text-align: left;
  }

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

@media (max-width: 760px) {
  body {
    padding: 18px 12px 36px;
  }

  .hero,
  .panel,
  .result-card,
  .footer {
    padding: 20px;
    border-radius: 16px;
  }

  .hero h1 {
    font-size: clamp(28px, 8vw, 36px);
  }

  .heroLead {
    font-size: 16px;
  }

  .grid,
  .spirometry-grid,
  .score-grid {
    grid-template-columns: 1fr;
  }

  .calc-actions {
    align-items: flex-start;
  }

  .score-chip {
    width: auto;
  }
}
