@page { margin: 0; }

:root {
  color-scheme: light;
  scroll-padding-top: 5rem;
  --ink: #172823;
  --muted: #4d6159;
  --paper: #fff;
  --surface: #f7f9f7;
  --line: #d6e0da;
  --brand: #075744;
  --brand-dark: #044535;
  --brand-tint: #e7f4ee;
  --focus: #08745a;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--surface);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: var(--brand); text-underline-offset: .2em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }

.icon { width: 1.25rem; height: 1.25rem; flex: none; }
.sr-only, .skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip-link:focus {
  position: fixed;
  z-index: 2;
  top: .5rem;
  left: .5rem;
  padding: .5rem 1rem;
  background: var(--paper);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.site-header-inner, .layout, .footer-inner {
  width: min(100% - 3rem, 71rem);
  margin-inline: auto;
}
.site-header-inner, .footer-inner {
  min-height: 4.3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  font-size: .99rem;
  font-weight: 760;
  letter-spacing: -.025em;
  text-decoration: none;
  color: var(--ink);
}
.brand img { display: block; flex: none; }
.site-header nav { display: flex; gap: .32rem; }
.site-header nav a {
  padding: .5rem .75rem;
  border-radius: .5rem;
  text-decoration: none;
  color: var(--muted);
  font-size: .94rem;
  font-weight: 650;
}
.site-header nav a:hover, .site-header nav a[aria-current="page"] {
  color: var(--brand-dark);
  background: var(--brand-tint);
}

.intro { padding: clamp(1.8rem, 5vw, 3.2rem) 0 1.65rem; }
.intro h1 {
  max-width: 18ch;
  font-size: clamp(2.4rem, 5.5vw, 4.2rem);
  font-weight: 760;
  line-height: 1.04;
  letter-spacing: -.068em;
  text-wrap: balance;
}
.intro p {
  margin-top: .7rem;
  color: var(--muted);
  font-size: clamp(1rem, 2.2vw, 1.15rem);
  line-height: 1.55;
}
.symptom-picks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  margin-top: 1.35rem;
}
.symptom-picks > span {
  margin-right: .25rem;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 650;
}
.symptom-picks button {
  min-height: 2.2rem;
  padding: .32rem .72rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--brand-dark);
  font-size: .9rem;
  font-weight: 620;
}
.symptom-picks button:hover:not(:disabled) {
  border-color: #87ac9d;
  background: var(--brand-tint);
}
.symptom-picks button:disabled { opacity: .6; }

.workspace {
  display: grid;
  grid-template-columns: minmax(17.5rem, .94fr) minmax(0, 1.56fr);
  align-items: stretch;
  gap: 1rem;
}
.controls, .preview, .guide-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 1.05rem;
  background: var(--paper);
}
.controls { padding: clamp(1rem, 2.2vw, 1.5rem); }
.controls fieldset { padding: 0; margin: 0; border: 0; min-inline-size: 0; }
.controls legend {
  padding: 0;
  margin: 0 0 .75rem;
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 750;
  letter-spacing: -.02em;
}
.pattern-options { display: grid; gap: .5rem; }
.pattern-option, .paper-option {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: .66rem;
  cursor: pointer;
}
.pattern-option { gap: .7rem; padding: .57rem .7rem; }
.pattern-option:hover, .paper-option:hover { border-color: #8aafa0; }
.pattern-option:has(:checked), .paper-option:has(:checked) {
  border-color: #4c8876;
  background: #edf7f1;
}
.pattern-option:has(:focus-visible), .paper-option:has(:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.pattern-option input, .paper-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
}
.pattern-icon, .guide-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  color: var(--brand);
  background: #eff5f1;
  border-radius: .52rem;
}
.pattern-option:has(:checked) .pattern-icon { background: #d9eee3; }
.option-copy {
  display: grid;
  flex: 1;
  gap: .1rem;
  line-height: 1.3;
}
.option-copy strong, .paper-option strong { font-size: .96rem; font-weight: 720; }
.option-copy > span, .paper-option small { font-size: .875rem; color: var(--muted); }
.radio-mark {
  width: .94rem;
  height: .94rem;
  flex: none;
  border: 1.5px solid #849f93;
  border-radius: 50%;
}
.pattern-option:has(:checked) .radio-mark {
  border: .27rem solid var(--brand);
  background: var(--paper);
}
.controls .paper-options { margin-top: 1.18rem; }
.paper-options-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
.paper-option {
  flex-direction: column;
  align-items: flex-start;
  gap: .1rem;
  padding: .55rem .65rem;
  line-height: 1.35;
}
.print-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  width: 100%;
  min-height: 3rem;
  border: 1px solid var(--brand);
  border-radius: .65rem;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
}
.print-button:hover:not(:disabled) { background: var(--brand-dark); }
.print-button:disabled { opacity: .6; }
.print-note { margin-top: .55rem; color: var(--muted); text-align: center; font-size: .875rem; line-height: 1.5; }
.tool-status:not(:empty) { margin-top: .65rem; font-size: .9rem; line-height: 1.45; }

.preview { display: flex; flex-direction: column; overflow: hidden; }
.preview-bar {
  min-height: 3.05rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  padding: .62rem 1.05rem;
  border-bottom: 1px solid var(--line);
}
.preview-bar h2 { font-size: 1rem; font-weight: 740; letter-spacing: -.02em; }
.preview-bar span {
  color: var(--muted);
  font-size: .875rem;
  font-weight: 650;
  white-space: nowrap;
}
.preview-stage {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 1.18rem 1rem;
  background-color: #eaf1ed;
  background-image:
    linear-gradient(#dce7e0 1px, transparent 1px),
    linear-gradient(90deg, #dce7e0 1px, transparent 1px);
  background-size: 1rem 1rem;
  background-position: center;
}
.sheet {
  --sheet-width: 215.9mm;
  --sheet-height: 279.4mm;
  --aspect: 215.9 / 279.4;
  width: min(100%, 17.75rem);
  aspect-ratio: var(--aspect);
  background: #fff;
  box-shadow: 0 10px 26px #18352a23, 0 0 0 1px #bccbc2;
}
.sheet[data-paper="a4"] {
  --sheet-width: 210mm;
  --sheet-height: 297mm;
  --aspect: 210 / 297;
}
.sheet svg { display: block; width: 100%; height: 100%; }

.guides { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; padding-top: 1.25rem; }
.guide-card { padding: clamp(1rem, 2.2vw, 1.5rem); }
.guide-icon { margin-bottom: .7rem; }
.guide-card h2 { font-size: 1.26rem; letter-spacing: -.03em; font-weight: 750; }
.guide-card ul { padding-left: 1.15rem; margin: .55rem 0 0; }
.guide-card li + li { margin-top: .24rem; }
.guide-card p, .guide-card li { color: var(--muted); line-height: 1.6; }
.guide-card details { margin-top: .8rem; border-top: 1px solid var(--line); padding-top: .7rem; }
.guide-card details summary { color: var(--brand); cursor: pointer; font-weight: 650; }
.guide-card details p { margin-top: .45rem; }
.result-guide h3 { margin: .55rem 0 .23rem; font-size: 1rem; }
.result-guide p + p { margin-top: .46rem; }
.control-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .5rem;
  margin-top: 1.13rem;
}
.pdf-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 3rem;
  padding: .35rem .75rem;
  border: 1px solid #8aafa0;
  border-radius: .65rem;
  background: var(--paper);
  color: var(--brand-dark);
  font-size: .9rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.pdf-button:hover { background: var(--brand-tint); }
.article-guide {
  max-width: 51rem;
  margin: 0 auto;
  padding: clamp(2.3rem, 5vw, 3.6rem) 0 3rem;
  line-height: 1.68;
}
.article-header {
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--line);
}
.article-header h2 {
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  line-height: 1.12;
  font-weight: 760;
  letter-spacing: -.05em;
}
.article-guide p, .article-guide dd, .article-guide li { color: var(--muted); }
.article-guide p { margin: .55rem 0 0; }
.guide-links {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1.05rem;
  margin-top: .8rem;
}
.guide-links a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  font-weight: 650;
}
.article-guide section { padding-top: 1.45rem; scroll-margin-top: 1.3rem; }
.article-guide h3 { font-size: clamp(1.17rem, 2.7vw, 1.5rem); line-height: 1.25; letter-spacing: -.02em; }
.article-guide h4 { margin: 1.15rem 0 0; line-height: 1.35; font-size: 1rem; }
.article-guide ol, .article-guide ul { margin: .55rem 0 0; padding-inline-start: 1.4rem; }
.article-guide li + li { margin-top: .35rem; }
.test-reference {
  display: grid;
  gap: .65rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  margin: .85rem 0;
}
.test-reference div {
  padding: .65rem .85rem;
  border: 1px solid var(--line);
  border-radius: .66rem;
  background: var(--paper);
}
.test-reference dt, .pdf-library summary { color: var(--brand-dark); font-weight: 700; }
.test-reference dd { margin: .2rem 0 0; }
.pdf-library { margin-top: .85rem; }
.pdf-library summary { min-height: 2.75rem; padding-block: .45rem; cursor: pointer; }
.article-guide .article-return { margin-top: 1.35rem; font-weight: 650; }

.site-footer { border-top: 1px solid var(--line); color: var(--muted); }
.footer-inner { min-height: 3.7rem; font-size: .9rem; }

@media (max-width: 49rem) {
  .workspace { grid-template-columns: minmax(15.75rem, .98fr) minmax(0, 1.02fr); }
}
@media (max-width: 41rem) {
  .site-header-inner, .layout, .footer-inner { width: min(100% - 1.5rem, 71rem); }
  .workspace, .guides { grid-template-columns: 1fr; }
  .site-header-inner { min-height: 3.55rem; }
  .brand { gap: .45rem; }
  .brand img { width: 2rem; height: 2rem; }
  .site-header nav a { padding: .45rem .5rem; }
  .intro { padding: 1.45rem 0 1.05rem; }
  .intro p { margin-top: .55rem; line-height: 1.45; }
  .symptom-picks {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .35rem;
    margin-top: .75rem;
  }
  .symptom-picks > span { grid-column: 1 / -1; }
  .symptom-picks button {
    min-height: 2.75rem;
    padding: .24rem .35rem;
    font-size: .875rem;
    line-height: 1.2;
  }
  .controls legend { margin-bottom: .55rem; }
  .pattern-option { padding-block: .45rem; }
  .controls .paper-options { margin-top: .88rem; }
  .control-actions { margin-top: .85rem; }
  .controls { padding: 1.1rem; }
  .preview-stage { padding-block: 1.4rem; }
}
@media (max-width: 22rem) {
  .site-header-inner { gap: .4rem; }
  .site-header nav { gap: 0; }
  .control-actions .icon { display: none; }
  .site-header nav a { font-size: .88rem; padding-inline: .38rem; }
}
@media (forced-colors: active) {
  .pattern-option:has(:checked), .paper-option:has(:checked) { outline: 2px solid Highlight; }
}

@media print {
  :root, body { margin: 0; padding: 0; background: #fff; }
  .skip-link, .site-header, .intro, .controls, .preview-bar, .guides, .article-guide, .site-footer {
    display: none !important;
  }
  .layout, .workspace, .preview, .preview-stage {
    display: block;
    width: auto;
    min-width: 0;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: none;
    overflow: visible;
  }
  .sheet {
    position: relative;
    width: var(--sheet-width);
    /* Keep the flow box clear of the page-break threshold after unit rounding. */
    height: calc(var(--sheet-height) - 1mm);
    aspect-ratio: auto;
    overflow: visible;
    box-shadow: none;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
  .sheet svg {
    position: absolute;
    inset: 0 auto auto 0;
    width: var(--sheet-width);
    height: var(--sheet-height);
  }
}
