@layer base, components, wide, print;

@layer base {
  :root {
    color-scheme: light;
    --ink: #2c2928;
    --muted: #625a57;
    --accent: #913d51;
    --accent-dark: #702b3c;
    --rose: #f8e8e8;
    --pale: #fcf6f3;
    --line: #e4dcd6;
    --body-face: Arial, Helvetica, sans-serif;
    --heading-face: "Avenir Next", "Segoe UI", sans-serif;
    --note-face: Georgia, "Times New Roman", serif;
  }
  * { box-sizing: border-box; }
  html { background: #fff; scroll-padding-top: 24px; }
  body { margin: 0; color: var(--ink); font: 18px/1.65 var(--body-face); -webkit-text-size-adjust: 100%; }
  h1, h2, h3, p, ul, ol, figure, dl, dd { margin: 0; }
  h1, h2, h3, .checklist-prompt { font-family: var(--heading-face); }
  h1 { font-size: clamp(35px, 7vw, 58px); font-weight: 650; line-height: 1.13; letter-spacing: -1.3px; overflow-wrap: break-word; }
  h2, .section-title { font-size: clamp(25px, 4vw, 32px); line-height: 1.25; font-weight: 650; letter-spacing: -.45px; }
  h3:not(.section-title), .checklist-prompt { font-size: 20px; line-height: 1.35; font-weight: 650; }
  p { max-width: 70ch; }
  a { color: var(--accent-dark); text-decoration-thickness: 1px; text-underline-offset: 4px; display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; max-width: 100%; overflow-wrap: anywhere; }
  a:hover { text-decoration-thickness: 2px; }
  a:focus-visible, button:focus-visible, summary:focus-visible { outline: 3px solid #1c696e; outline-offset: 5px; border-radius: 5px; }
  button { font: inherit; cursor: pointer; }
  [hidden] { display: none !important; }
  section { min-width: 0; }
  main:focus { outline: none; }
  main { max-width: 1232px; padding-inline: 24px; margin-inline: auto; }
  ::selection { background: #f1cbd1; color: #342026; }
}

@layer components {
  .skip-link { position: absolute; z-index: 20; top: 8px; left: 16px; padding: 12px 20px; background: #fff; border: 2px solid var(--accent); transform: translateY(-180%); }
  .skip-link:focus { transform: translateY(0); }
  .site-header { background: #fff; border-bottom: 1px solid var(--line); }
  .header-inner { max-width: 1232px; padding: 20px 24px 16px; margin-inline: auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
  .site-name { gap: 10px; font: 650 18px/1.3 var(--heading-face); color: var(--ink); text-decoration: none; min-width: 0; }
  .site-name small { display: block; font: 400 16px/1.5 var(--body-face); color: var(--muted); margin-top: 3px; }
  .site-symbol { width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center; border: 2px solid var(--accent); border-radius: 14px; color: var(--accent); font-size: 27px; }
  .index-link { display: none; text-decoration: none; font-weight: 600; padding: 12px 18px; border: 1px solid var(--line); border-radius: 99px; }
  .question-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 6px; max-width: 1232px; margin-inline: auto; padding: 6px 18px 14px; }
  .question-tabs a { font-size: 16px; line-height: 1.3; min-height: 48px; justify-content: center; text-align: center; padding: 10px 7px; text-decoration: none; color: var(--muted); border-radius: 16px; }
  .question-tabs a:hover { background: var(--pale); color: var(--ink); }
  .question-tabs .current-question { color: var(--accent-dark); background: var(--rose); font-weight: 600; }
  .page-label { font-size: 16px; line-height: 1.5; color: var(--accent); font-weight: 600; margin-bottom: 18px; }
  .home-hero { padding-block: 36px 40px; display: grid; gap: 36px; }
  .hero-copy h1 { max-width: 21ch; }
  .hero-copy h1 span { display: block; color: var(--accent); margin-top: 5px; }
  .hero-intro { margin-top: 24px; color: var(--muted); max-width: 48ch; font-size: 18px; line-height: 1.6; }
  .hero-actions { display: flex; align-items: flex-start; flex-direction: column; gap: 10px; margin-top: 27px; }
  .primary-link { border-radius: 15px; padding: 15px 23px; background: var(--accent); color: #fff; font-size: 17px; font-weight: 600; text-decoration: none; min-height: 54px; justify-content: center; line-height: 1.4; }
  .primary-link:hover { background: var(--accent-dark); }
  .text-link { padding-block: 10px; font-size: 17px; font-weight: 600; gap: 12px; line-height: 1.5; }
  .text-link::after { content: "→"; text-decoration: none; flex-shrink: 0; font-size: 22px; }
  .hero-diagram { background: var(--pale); border-radius: 32px; padding: 28px 20px 22px; position: relative; }
  .hero-diagram figcaption { max-width: 19ch; margin: 0 auto 25px; text-align: center; font: 400 27px/1.2 var(--note-face); color: #614a44; }
  .answer-map { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .map-item { padding: 20px 12px 18px; background: #fff; border-radius: 22px; box-shadow: 0 6px 15px #5d463309; min-width: 0; }
  .map-item strong { display: block; font: 650 18px/1.4 var(--heading-face); margin-block: 12px 3px; }
  .map-item > span:last-child { font-size: 16px; line-height: 1.4; color: var(--muted); display: block; }
  .map-person { background: #f3e0dc; }
  .map-medicine { background: #f2eadb; }
  .map-bill { background: #edf0e6; }
  .map-follow { background: #ece9f1; }
  .map-icon { display: block; width: 36px; height: 36px; position: relative; color: #62504a; }
  .person-icon::before { content: ""; position: absolute; border: 2px solid currentColor; width: 13px; height: 13px; border-radius: 50%; top: 0; left: 10px; }
  .person-icon::after { content: ""; position: absolute; border: 2px solid currentColor; border-radius: 18px 18px 8px 8px; width: 30px; height: 17px; bottom: 0; left: 2px; }
  .page-icon::before, .bill-icon::before { content: ""; position: absolute; inset: 1px 5px; border: 2px solid currentColor; border-radius: 5px; }
  .page-icon::after { content: "✓"; position: absolute; font-size: 25px; line-height: 34px; left: 9px; }
  .bill-icon::after { content: ""; position: absolute; left: 11px; top: 11px; width: 14px; height: 2px; background: currentColor; box-shadow: 0 7px currentColor, 0 14px currentColor; }
  .chat-icon::before { content: ""; position: absolute; inset: 2px 0 7px; border: 2px solid currentColor; border-radius: 12px 12px 12px 2px; }
  .chat-icon::after { content: ""; position: absolute; width: 17px; height: 2px; background: currentColor; top: 15px; left: 9px; }
  .hero-diagram > p { font-size: 16px; text-align: center; color: #62504a; margin-top: 23px; line-height: 1.5; }
  .home-note { padding: 24px; background: var(--rose); border-radius: 24px; display: flex; align-items: flex-start; flex-wrap: wrap; column-gap: 16px; row-gap: 8px; }
  .note-mark { font-size: 24px; color: var(--accent); flex: 0 0 26px; line-height: 1.4; }
  .home-note p { flex: 1; min-width: 180px; font-size: 18px; line-height: 1.5; }
  .home-note .text-link { margin-left: 42px; }
  .home-content { margin-block: 48px 72px; }
  .home-content > section + section { margin-top: 50px; }
  .home-content > section > h2 { margin-bottom: 25px; }
  .home-content > section:not(.all-checklists) { max-width: 800px; }
  .section-heading { margin-bottom: 26px; }
  .section-heading p { margin-top: 12px; color: var(--muted); }
  .question-grid { display: grid; gap: 14px; }
  .question-card { display: flex; align-items: flex-start; flex-direction: column; padding: 26px 58px 26px 25px; border: 1px solid var(--line); border-radius: 23px; text-decoration: none; color: var(--ink); position: relative; min-height: 151px; background: #fff; }
  .question-card:hover { border-color: #b8828b; background: var(--pale); }
  .question-card > span:first-child { font-size: 16px; line-height: 1.5; color: var(--accent); margin-bottom: 10px; }
  .question-card strong { font: 650 23px/1.3 var(--heading-face); max-width: 24ch; }
  .question-card .card-arrow { position: absolute; right: 24px; bottom: 25px; font-size: 24px; line-height: 1.3; color: var(--accent); }
  .page-intro { padding-block: 38px 34px; max-width: 890px; }
  .page-intro h1 { max-width: 22ch; }
  .lead { font-size: 20px; line-height: 1.6; max-width: 61ch; margin-top: 24px; color: var(--muted); }
  .reading-layout { padding-bottom: 64px; display: grid; gap: 38px; }
  .reading-column { min-width: 0; }
  .reading-column > section + section, .section-note { margin-top: 42px; }
  .reading-column > section > h2, .section-note > .section-title { margin-bottom: 22px; }
  .reading-column > section > p + p { margin-top: 18px; }
  .checklist { list-style: none; padding: 0; }
  .checklist li { display: grid; grid-template-columns: 25px minmax(0, 1fr); gap: 17px; padding-block: 22px; border-bottom: 1px solid var(--line); }
  .checklist li:first-child { padding-top: 5px; }
  .checklist li:last-child { border-bottom: 0; padding-bottom: 0; }
  .checklist h3, .checklist .checklist-prompt { margin-bottom: 7px; }
  .checklist p:not(.checklist-prompt) { color: var(--muted); }
  .check-box { height: 25px; width: 25px; border: 2px solid #b69b96; border-radius: 7px; margin-top: 2px; background: var(--pale); }
  .claim-pair { padding-block: 20px; }
  .claim-pair + .claim-pair { border-top: 1px solid var(--line); }
  .claim-text p + p { margin-top: 13px; }
  .claim-source { margin-top: 16px; border-left: 3px solid #d4aaa9; padding-left: 17px; }
  .claim-source a { display: flex; width: fit-content; font-size: 16px; line-height: 1.4; padding-block: 10px; }
  .source-date { color: var(--muted); font-size: 16px; line-height: 1.5; }
  .takeaway { background: var(--pale); border-radius: 26px; padding: 30px 26px; position: relative; overflow: hidden; align-self: start; }
  .takeaway h2 { font-size: 26px; line-height: 1.25; margin-block: 10px 18px; max-width: 16ch; }
  .takeaway p { font-size: 17px; line-height: 1.6; }
  .takeaway .note-label { color: var(--accent); font-size: 16px; }
  .takeaway .text-link { margin-top: 15px; }
  .note-fold { width: 40px; height: 40px; background: #ecddd6; position: absolute; top: 0; right: 0; border-radius: 0 0 0 24px; }
  .process-diagram { background: var(--pale); padding: 27px; border-radius: 25px; margin-block: 35px; }
  .process-diagram figcaption { font: 650 24px/1.3 var(--heading-face); margin-bottom: 25px; }
  .process-diagram ol { list-style: none; padding: 0; display: grid; gap: 27px; }
  .process-diagram li { position: relative; padding-left: 30px; }
  .process-diagram strong { display: block; font-size: 18px; line-height: 1.4; }
  .process-diagram li > span:last-child { display: block; font-size: 16px; color: var(--muted); }
  .diagram-dot { width: 13px; height: 13px; background: #c2888d; border: 3px solid #f4d9db; border-radius: 50%; position: absolute; top: 5px; left: 0; }
  .process-diagram li:not(:last-child)::after { content: ""; position: absolute; left: 5px; top: 25px; bottom: -16px; width: 2px; background: #d9c5bd; }
  .process-diagram > p { margin-top: 26px; font-size: 17px; line-height: 1.6; }
  .term-list { margin-top: 24px; }
  .term-list > div { padding-block: 22px; border-bottom: 1px solid var(--line); }
  .term-list > div:last-child { border-bottom: 0; }
  .term-list dt { font: 650 22px/1.4 var(--heading-face); margin-bottom: 6px; }
  .term-list dd p { font-size: 18px; }
  .term-source a { font-size: 16px; line-height: 1.5; padding-block: 10px; }
  .urgent-note { background: #fbefdd; padding: 27px 24px; border-radius: 26px; border: 1px solid #e7ceac; }
  .urgent-note .claim-pair { padding-block: 0; }
  .urgent-note .claim-source { border-color: #b79a71; }
  .myth-section > p { margin-bottom: 24px; color: var(--muted); }
  .myth { padding: 26px; border: 1px solid var(--line); border-radius: 24px; margin-top: 16px; }
  .myth h3 { font-size: 22px; max-width: 30ch; }
  .myth-button { margin-top: 16px; min-height: 48px; color: var(--accent-dark); font-size: 17px; padding: 10px 18px; background: var(--rose); border: 1px solid #d4aaa9; border-radius: 13px; }
  .myth-button:hover { background: #f3d6da; }
  .myth-answer .claim-pair { padding-bottom: 0; }
  .site-footer { background: var(--pale); border-top: 1px solid var(--line); }
  .footer-inner { max-width: 1232px; margin-inline: auto; padding: 38px 24px 30px; }
  .footer-name { font: 400 27px/1.3 var(--note-face); }
  .footer-inner nav { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 16px; margin-block: 20px 22px; }
  .footer-inner nav a { padding-block: 10px; font-size: 16px; line-height: 1.5; }
  .guide-line { font-size: 17px; color: var(--muted); max-width: 70ch; }
  .domain-name { margin-top: 16px; color: var(--muted); font-size: 16px; overflow-wrap: anywhere; }
  .error-page { padding-bottom: 70px; }
}

@layer wide {
  @media (min-width: 600px) {
    main { padding-inline: 32px; }
    .header-inner { padding-inline: 32px; }
    .index-link { display: inline-flex; font-size: 16px; }
    .hero-actions { flex-direction: row; align-items: center; gap: 24px; }
    .hero-diagram { padding: 35px; }
    .answer-map { gap: 18px; }
    .map-item { padding: 25px; }
    .question-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .question-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); padding-inline: 25px; }
    .home-note .text-link { margin-left: 42px; }
    .footer-inner { padding-inline: 32px; }
    .footer-inner nav { display: flex; flex-wrap: wrap; column-gap: 30px; }
    .bill-diagram ol { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
    .bill-diagram li { padding-left: 0; padding-top: 27px; }
    .bill-diagram li:not(:last-child)::after { left: 23px; right: 0; top: 11px; height: 2px; width: auto; bottom: auto; }
  }
  @media (min-width: 960px) {
    .header-inner { padding-block: 23px 18px; }
    .site-name { font-size: 20px; }
    .site-symbol { width: 46px; height: 46px; flex-basis: 46px; }
    .question-tabs { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; padding-bottom: 15px; }
    .question-tabs a { font-size: 16px; padding-inline: 9px; }
    .home-hero { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 58px; align-items: center; padding-block: 64px; }
    .hero-copy h1 { font-size: clamp(45px, 4.05vw, 58px); }
    .hero-actions { flex-direction: column; align-items: flex-start; gap: 4px; }
    .hero-diagram { padding: 36px 26px 28px; border-radius: 40px; }
    .hero-diagram figcaption { font-size: 32px; margin-bottom: 29px; }
    .map-item { padding: 24px 19px; }
    .map-person { transform: translateY(-4px); }
    .map-medicine { transform: translateY(5px); }
    .map-bill { transform: translateY(-4px); }
    .map-follow { transform: translateY(5px); }
    .home-note { padding: 25px 32px; align-items: center; }
    .home-note p { max-width: 60ch; }
    .home-note .text-link { margin-left: auto; }
    .home-content { margin-block: 67px 92px; }
    .home-content > section + section { margin-top: 64px; }
    .question-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
    .page-intro { padding-block: 61px 46px; }
    .page-intro h1 { max-width: 23ch; }
    .reading-layout { grid-template-columns: minmax(0, 730px) minmax(240px, 300px); gap: clamp(48px, 6vw, 100px); align-items: start; padding-bottom: 86px; }
    .reading-column { max-width: 70ch; }
    .reading-column > section + section, .section-note { margin-top: 46px; }
    .takeaway { position: sticky; top: 30px; }
    .footer-inner { padding-block: 44px 35px; }
  }
  @media (min-width: 1200px) {
    .hero-actions { flex-direction: row; align-items: center; gap: 22px; }
    .hero-actions .text-link { font-size: 16px; }
    .home-hero { gap: 65px; }
  }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  }
}

@layer print {
  @media print {
    body { font-size: 12pt; line-height: 1.5; }
    .site-header, .site-footer, .takeaway, .skip-link, .hero-actions, .myth-button { display: none !important; }
    main { max-width: none; padding: 0; }
    .page-intro { padding-top: 0; }
    .reading-layout { display: block; }
    .reading-column { max-width: none; }
    .myth-answer[hidden] { display: block !important; }
    .checklist li, .claim-pair, .myth { break-inside: avoid; }
    h1 { font-size: 30pt; }
    h2, .section-title { font-size: 20pt; }
    a { color: #222; }
    .home-hero { display: block; }
    .hero-diagram { margin-top: 25px; }
  }
}
