/* =====================================================================
   니코치 — Component reference CSS v1.0
   Requires tokens.css. Class names match public/app.js + index.html
   markup wherever possible. Items tagged  [MARKUP]  need a small
   markup/JS change — see CHANGELIST.md for the exact change.
   Order: base → shell → controls → content → map → flows → states → desktop
   ===================================================================== */

/* ---------- 0. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-ink);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  letter-spacing: var(--ls-body);
  word-break: keep-all;            /* Korean: never break inside a word */
  overflow-wrap: break-word;       /* …but never overflow the viewport. R1-03: NOT `anywhere` — that shrinks min-content and split the "10" pain cell into "1/0" at 360px */
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--color-primary-ink); text-underline-offset: 3px; }
button { font: inherit; color: inherit; letter-spacing: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: var(--lh-title-2); letter-spacing: var(--ls-title-3); }
p { margin: 0 0 var(--space-3); }
svg { flex: none; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; border-radius: var(--radius-sm); }
:is(h1, h2, h3)[tabindex="-1"]:focus, :is(h1, h2, h3)[tabindex="-1"]:focus-visible { outline: none; }   /* R2-04: headings that only receive programmatic focus (onboarding #discTitle, route titles) — not Tab stops, so no ring; screen readers still announce them. Controls keep the ring; the next Tab lands on the first control with the normal ring */
.sr-only { position: absolute !important; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.num { font-variant-numeric: tabular-nums; }

/* Icon mask library (Lucide paths) — used by ::before/::after decorations, no markup needed */
:root {
  --i-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  --i-chevron-right: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E");
  --i-alert: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3'/%3E%3Cpath d='M12 9v4'/%3E%3Cpath d='M12 17h.01'/%3E%3C/svg%3E");
  --i-info: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4'/%3E%3Cpath d='M12 8h.01'/%3E%3C/svg%3E");
  --i-clipboard: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230B5A54' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='8' height='4' x='8' y='2' rx='1' ry='1'/%3E%3Cpath d='M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2'/%3E%3Cpath d='M12 11h4'/%3E%3Cpath d='M12 16h4'/%3E%3Cpath d='M8 11h.01'/%3E%3Cpath d='M8 16h.01'/%3E%3C/svg%3E");
  --i-stethoscope: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23C62828' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 2v2'/%3E%3Cpath d='M5 2v2'/%3E%3Cpath d='M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1'/%3E%3Cpath d='M8 15a6 6 0 0 0 12 0v-3'/%3E%3Ccircle cx='20' cy='10' r='2'/%3E%3C/svg%3E");
}

/* ---------- 1. App shell ---------- */
.app { max-width: var(--container); margin: 0 auto; min-height: 100vh; min-height: 100dvh; background: var(--color-bg); position: relative; }
.view { padding: var(--space-4) var(--gutter) calc(var(--nav-h) + var(--space-7) + var(--safe-b)); outline: none; }
.view.has-action { padding-bottom: calc(var(--nav-h) + 120px + var(--safe-b)); }
.view.has-dock   { padding-bottom: calc(var(--nav-h) + 210px + var(--safe-b)); } /* [MARKUP] add when actionbar holds .dock */

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: var(--z-sticky);
  display: flex; align-items: center; gap: var(--space-1);
  height: var(--topbar-h); padding: 0 var(--space-2);
  background: var(--color-surface-glass);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--color-line);
}
.topbar h1 {
  flex: 1; min-width: 0; padding-left: var(--space-3);
  font-size: 17px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#backBtn:not([hidden]) + h1 { padding-left: 0; }
/* Condition pages: the name lives in .cond-head; the top-bar title fades in only after .cond-head scrolls out
   [MARKUP] header gets .title-on-scroll on #/c/* routes; an IntersectionObserver on .cond-head toggles .show-title */
.topbar.title-on-scroll h1 { opacity: 0; transform: translateY(4px); transition: opacity var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out); }
.topbar.title-on-scroll.show-title h1 { opacity: 1; transform: none; }
/* Home brand lockup  [MARKUP optional]: <h1 class="brand"><span class="brand-mark"></span>…</h1> */
.topbar h1.brand, .brand { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 800; letter-spacing: -0.025em; }   /* 니코치: tile 28 + gap 8 (0.42H) + wordmark 20px (46.5 wide), BRAND.md §3/§5 */
.brand-mark { width: 28px; height: 28px; flex: none; border-radius: 9px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 28'%3E%3Crect width='28' height='28' rx='9' fill='%230F766E'/%3E%3Cpath d='M11.5 5.5 16 14l-4.5 8.5' fill='none' stroke='%23fff' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3Ccircle cx='16' cy='14' r='3' fill='%23E2572F' stroke='%230F766E' stroke-width='1.2'/%3E%3C/svg%3E") center/100% no-repeat; } /* bent leg + coral knee dot; replace with assets/generated app icon when ready */

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: var(--tap-min); height: var(--tap-min); padding: 0;
  border: 0; border-radius: 12px; background: transparent; color: var(--color-ink);
  cursor: pointer; text-decoration: none;
  transition: background-color var(--dur-1) var(--ease-out);
}
.icon-btn svg { width: 24px; height: 24px; }
@media (hover: hover) and (pointer: fine) { .icon-btn:hover { background: var(--color-surface-sunken); } }  /* R1-16: no sticky hover on touch */
.icon-btn:active { background: var(--color-line); }
.rf-top { color: var(--color-danger); }
/* Home: labelled pill instead of icon-only (replaces the tall .rf-banner on mobile)  [MARKUP] <a class="icon-btn rf-top rf-pill" href="#/red"><svg/>적신호 확인</a> */
.icon-btn.rf-pill { position: relative; min-width: 0; height: 36px; margin-right: 4px; padding: 0 12px 0 10px; gap: 5px; border-radius: var(--radius-pill); background: var(--color-danger-soft); color: var(--color-danger-ink); box-shadow: inset 0 0 0 1px var(--color-danger-line); font-size: 13.5px; font-weight: 750; letter-spacing: -0.01em; white-space: nowrap; }
.icon-btn.rf-pill svg { width: 17px; height: 17px; color: var(--color-danger); }
.icon-btn.rf-pill::after { content: ""; position: absolute; inset: -4px 0; }
@media (hover: hover) and (pointer: fine) { .icon-btn.rf-pill:hover { background: var(--color-danger-line); } }  /* R1-16: no sticky hover on touch */

/* Bottom navigation — pill indicator behind active icon (no markup change) */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-nav);
  max-width: var(--container); margin: 0 auto;
  display: flex; height: calc(var(--nav-h) + var(--safe-b)); padding: 0 var(--space-1) var(--safe-b);
  background: color-mix(in srgb, var(--color-surface) 98%, transparent);   /* R1-21: 94% let content ghost through the labels */
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--color-line);
}
.bottomnav a {
  flex: 1; position: relative; min-height: var(--tap-min);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; color: var(--color-ink-3);
  font-size: var(--fs-nav); font-weight: 600; letter-spacing: -0.01em;
  transition: color var(--dur-2) var(--ease-out);
}
.bottomnav a::before {
  content: ""; position: absolute; top: 7px; left: 50%; width: 56px; height: 30px; margin-left: -28px;
  border-radius: var(--radius-pill); background: transparent; transform: scaleX(.6); opacity: 0;
  transition: transform var(--dur-3) var(--ease-spring), opacity var(--dur-2) var(--ease-out), background-color var(--dur-2);
}
.bottomnav svg { position: relative; width: 24px; height: 24px; }
.bottomnav span { position: relative; }
.bottomnav a.active { color: var(--color-primary-ink); font-weight: 750; }
.bottomnav a.active::before { background: var(--color-primary-soft); transform: scaleX(1); opacity: 1; }
.bottomnav a.nav-red svg { color: var(--color-danger); }        /* safety affordance: red icon, neutral label */
.bottomnav a.nav-red.active { color: var(--color-danger-ink); }
.bottomnav a.nav-red.active::before { background: var(--color-danger-soft); }
.bottomnav a:focus-visible { outline-offset: -4px; border-radius: 14px; }

/* Action bar (fixed CTA above nav) */
.actionbar {
  position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b)); z-index: var(--z-dock);
  max-width: var(--container); margin: 0 auto;
  display: flex; gap: var(--space-2);
  padding: var(--space-3) var(--gutter) var(--space-3);
  background: var(--color-bg);                                  /* R1-04: solid — text in the old 58% gradient overlapped content behind it */
  box-shadow: 0 -1px 0 var(--color-line);
  pointer-events: none;
}
.actionbar::before { content: ""; position: absolute; left: 0; right: 0; top: -16px; height: 16px; background: linear-gradient(to top, var(--color-bg), transparent); pointer-events: none; }   /* soft 16px edge above the solid bar */
.actionbar > * { pointer-events: auto; }
.cta-stack { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.cta-help { min-height: 20px; margin: 0; text-align: center; font-size: 13.5px; font-weight: 600; line-height: 20px; color: var(--color-ink-3); }   /* R1-04: ALWAYS rendered (reserve 20px) → no CLS when the first symptom is picked */
.cta-help[data-off] { visibility: hidden; }   /* [MARKUP] set data-off when ≥1 symptom is selected instead of removing the <p> */
.actionbar:has(.dock) { background: linear-gradient(to top, var(--color-bg) 30%, transparent); box-shadow: none; padding-top: var(--space-4); padding-left: 12px; padding-right: 12px; }
/* Selection dock  [MARKUP] <div class="dock" aria-live="polite">…</div> rendered into #actionbar by updateSel() */
.dock {
  flex: 1; display: grid; gap: var(--space-3);
  padding: 14px 14px 14px 18px; border-radius: 24px;
  background: var(--color-surface); border: 1px solid var(--color-line); box-shadow: var(--shadow-3);
  animation: dock-in var(--dur-3) var(--ease-out);
}
.dock-head { display: flex; align-items: flex-start; gap: var(--space-3); }
.dock-head > div { flex: 1; min-width: 0; }
.dock-meta { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 650; color: var(--color-ink-3); line-height: 1.3; }
.dock-meta .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-soft); }
.dock-name { font-size: 19px; font-weight: 800; letter-spacing: -0.025em; line-height: 1.35; }
.dock-desc { font-size: 14px; color: var(--color-ink-2); line-height: 1.5; margin-top: 1px; }
.dock-count { flex: none; font-size: 12.5px; font-weight: 750; color: var(--color-primary-ink); background: var(--color-primary-soft); border-radius: var(--radius-pill); padding: 4px 10px; }
@keyframes dock-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- 2. Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 52px; padding: 0 var(--space-5);
  border-radius: var(--radius-md); border: 1px solid var(--color-line-strong);
  background: var(--color-surface); color: var(--color-ink);
  font-size: 16px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.3;
  text-align: center; text-decoration: none; cursor: pointer;
  transition: background-color var(--dur-1) var(--ease-out), border-color var(--dur-1), transform var(--dur-1) var(--ease-out), box-shadow var(--dur-1);
}
.btn svg { width: 20px; height: 20px; }
@media (hover: hover) and (pointer: fine) { .btn:hover { background: var(--color-surface-muted); } }  /* R1-16: no sticky hover on touch */
.btn:active { transform: scale(.985); }
.btn:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; border-radius: var(--radius-md); }
.btn.primary { flex: 1; background: var(--color-primary); border-color: var(--color-primary); color: var(--color-on-primary); box-shadow: 0 8px 18px -10px color-mix(in srgb, var(--color-primary) 80%, transparent); }
@media (hover: hover) and (pointer: fine) { .btn.primary:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); } }  /* R1-16: no sticky hover on touch */
.btn.primary:active { background: var(--color-primary-press); }
.btn[disabled], .btn[aria-disabled="true"],
.btn.primary[disabled], .btn.primary[aria-disabled="true"] {
  background: var(--color-surface-sunken); border-color: var(--color-line); color: var(--color-ink-3);
  box-shadow: none; pointer-events: none; cursor: not-allowed;
}
.btn.block { display: flex; width: 100%; }
.btn.danger { background: var(--color-danger); border-color: var(--color-danger); color: #fff; }
@media (hover: hover) and (pointer: fine) { .btn.danger:hover { background: var(--color-danger-press); } }  /* R1-16: no sticky hover on touch */
.btn.secondary { background: var(--color-primary-soft); border-color: transparent; color: var(--color-primary-ink); }
@media (hover: hover) and (pointer: fine) { .btn.secondary:hover { background: var(--color-primary-soft-2); } }  /* R1-16: no sticky hover on touch */
.btn.ghost { background: transparent; border-color: transparent; color: var(--color-ink-2); font-weight: 600; }
@media (hover: hover) and (pointer: fine) { .btn.ghost:hover { background: var(--color-surface-sunken); } }  /* R1-16: no sticky hover on touch */
.btn.small, .btn.sm { min-height: var(--tap-min); font-size: 15px; padding: 0 var(--space-4); }
.btn .arrow { transition: transform var(--dur-2) var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .btn:hover .arrow { transform: translateX(2px); } }  /* R1-16: no sticky hover on touch */
.link44 { display: flex; align-items: center; gap: 4px; min-height: var(--tap-min); font-weight: 700; font-size: 15px; text-decoration: none; color: var(--color-primary-ink); }
.link44.inline { display: inline-flex; padding: 0 4px; }

/* ---------- 3. Chips & tags ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 26px; padding: 2px 10px; border-radius: var(--radius-pill);
  font-size: var(--fs-caption); font-weight: 650; line-height: 1.4; letter-spacing: -0.005em;
  background: var(--color-surface-sunken); color: var(--color-ink-2); text-decoration: none; white-space: nowrap;
}
.chip svg { width: 14px; height: 14px; }
.chip.pri   { background: var(--color-primary-soft); color: var(--color-primary-ink); }
.chip.red   { background: var(--color-danger-soft);  color: var(--color-danger-ink); }
.chip.red.urgent { background: var(--color-danger); color: #fff; }   /* [MARKUP] urgencyChip(): add .urgent for /즉시|응급/ */
.chip.amber { background: var(--color-caution-soft); color: var(--color-caution-ink); }
.chip.green { background: var(--color-ok-soft);      color: var(--color-ok-ink); }
.chip.accent{ background: var(--color-accent-soft);  color: var(--color-accent-ink); }
.chip.outline { background: var(--color-surface); box-shadow: inset 0 0 0 1px var(--color-line-strong); }

/* Selectable chips (region list) */
.chips-grid { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chips-grid button, .chips-grid a.chip {
  position: relative; min-height: var(--tap-min); padding: 0 var(--space-4);
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: var(--radius-pill); border: 1px solid var(--color-line-strong); background: var(--color-surface);
  font-size: 15px; font-weight: 600; color: var(--color-ink-2); line-height: 1.3; cursor: pointer; text-align: left; text-decoration: none;
  transition: background-color var(--dur-2), border-color var(--dur-2), color var(--dur-2);
}
@media (hover: hover) and (pointer: fine) { .chips-grid button:hover { border-color: var(--color-control-border); color: var(--color-ink); } }  /* R1-16: no sticky hover on touch */
.chips-grid button[aria-pressed="true"] {
  background: var(--color-primary-soft); border-color: var(--color-primary); color: var(--color-primary-ink); font-weight: 750;
  box-shadow: inset 0 0 0 1px var(--color-primary);
}
.chips-grid button[aria-pressed="true"]::before {
  content: ""; width: 16px; height: 16px; margin-left: -4px; background: currentColor;
  -webkit-mask: var(--i-check) center/16px no-repeat; mask: var(--i-check) center/16px no-repeat;
}
/* related-area chips (F45) are secondary: 36px visual, 44px hit */
.chips-grid a.chip.pri { min-height: 36px; padding: 0 12px; font-size: 14px; border: 0; background: var(--color-primary-soft); color: var(--color-primary-ink); }
.chips-grid a.chip.pri::after { content: ""; position: absolute; inset: -4px 0; }

/* Source / reference chips — quiet, 30px visual, 44px hit area */
.refs { margin-top: var(--space-3); display: flex; flex-wrap: wrap; gap: 6px; }
.refs a, .refs a.chip {
  position: relative; min-height: 30px; padding: 0 10px; display: inline-flex; align-items: center; gap: 5px;
  border-radius: var(--radius-pill); background: var(--color-surface-muted); box-shadow: inset 0 0 0 1px var(--color-line);
  font-size: 12.5px; font-weight: 600; color: var(--color-ink-3); text-decoration: none; white-space: normal; max-width: 100%;
}
.refs a::after { content: ""; position: absolute; inset: -7px -3px; }
.refs a.chip.pri { background: var(--color-primary-soft); box-shadow: none; color: var(--color-primary-ink); }
@media (hover: hover) and (pointer: fine) { .refs a:hover { color: var(--color-ink); } }  /* R1-16: no sticky hover on touch */

/* ---------- 4. Cards, text, boxes ---------- */
.card {
  background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-lg);
  padding: var(--space-5); margin: 0 0 var(--space-3); box-shadow: var(--shadow-1);
}
.card h2 { font-size: var(--fs-title-2); font-weight: 750; letter-spacing: var(--ls-title-2); line-height: var(--lh-title-2); margin-bottom: var(--space-3); }
.card h3 { font-size: 17px; font-weight: 750; letter-spacing: -0.015em; line-height: 1.45; margin: var(--space-6) 0 var(--space-2); }
.card h3:first-child { margin-top: 0; }
.card p { font-size: var(--fs-body-lg); line-height: var(--lh-body-lg); max-inline-size: var(--measure); }
.muted { color: var(--color-ink-3); }
.small { font-size: 14.5px; line-height: 1.6; }
.lead { font-size: 15px; line-height: 1.6; color: var(--color-ink-2); margin: var(--space-1) 2px var(--space-4); }
.overline { font-size: var(--fs-overline); font-weight: var(--fw-overline); letter-spacing: var(--ls-overline); color: var(--color-ink-3); line-height: var(--lh-overline); }

/* Page section header. An inline <span> inside becomes a caption line. */
.section-title { font-size: 17px; font-weight: 750; letter-spacing: -0.015em; color: var(--color-ink); margin: var(--space-7) 2px var(--space-3); line-height: 1.4; }
.section-title span { display: block; margin-top: 2px; font-size: var(--fs-caption); font-weight: 500 !important; color: var(--color-ink-3); letter-spacing: 0; }
.section-title span.count, .sel-count { display: inline-flex; align-items: center; margin: 0 0 0 6px; padding: 1px 8px; border-radius: var(--radius-pill); background: var(--color-primary-soft); color: var(--color-primary-ink); font-size: 12.5px; font-weight: 750 !important; vertical-align: 2px; }

/* Lists (long-form) */
ul.list, ol.list { margin: 0; padding-left: 1.2em; }
ul.list li, ol.list li { margin: var(--space-2) 0; padding-left: 2px; }
ul.list li::marker { color: var(--color-primary); }
.card ul.list li, .card ol.list li { font-size: var(--fs-body-lg); line-height: var(--lh-body-lg); }
.card .box ul.list li, .card .caution ul.list li, .box ul.list li { font-size: 15px; line-height: 1.6; }
/* Numbered steps (exercise "방법") */
.ex ol.list { list-style: none; padding: 0; counter-reset: step; }
.ex ol.list li { counter-increment: step; display: grid; grid-template-columns: 26px 1fr; gap: var(--space-3); margin: var(--space-3) 0; font-size: 16.5px; line-height: 1.65; }
.ex ol.list li::before {
  content: counter(step); width: 26px; height: 26px; margin-top: 1px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--color-surface-sunken); color: var(--color-ink-2); font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums;
}

/* Info boxes */
.box { border-radius: var(--radius-md); padding: 14px 16px; margin: var(--space-3) 0; font-size: 15px; line-height: 1.65; }
.box h4 { display: flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 750; margin-bottom: 4px; }
.box.red   { background: var(--color-danger-soft);  border: 1px solid var(--color-danger-line); }
.box.red h4, .box.red > h3:first-child { color: var(--color-danger-ink); }
.box.red > h3:first-child { display: flex; align-items: center; gap: 6px; }  /* /guide/ red-box heading is an h3 (heading order): same icon row as h4, keeps the guide h3 type size */
.box.red h4::before, .box.red > h3:first-child::before, .box.amber h4::before { content: ""; width: 18px; height: 18px; flex: none; align-self: flex-start; margin-top: calc(0.725em - 9px); margin-top: calc((1lh - 18px) / 2); background: currentColor; -webkit-mask: var(--i-alert) center/18px no-repeat; mask: var(--i-alert) center/18px no-repeat; }
.box.amber { background: var(--color-caution-soft); border: 1px solid var(--color-caution-line); }
.box.amber b { color: var(--color-caution-ink); }
.box.pri   { background: var(--color-primary-soft); border: 1px solid var(--color-primary-soft-2); }
.box.pri h4 { color: var(--color-primary-ink); }
.box.gray  { background: var(--color-surface-muted); border: 1px solid var(--color-line); color: var(--color-ink-2); }
.box ul.list { padding-left: 1.1em; }
.box ul.list li { margin: 4px 0; }
.box.red ul.list li::marker { color: var(--color-danger); }

/* Commercial-readiness notices (phase 1, app.js eduNotice()/careCta()) — calm, never alarming */
.edu-note { position: relative; padding: 14px 16px 14px 44px; font-size: 14.5px; line-height: 1.65; color: var(--color-ink-2); }
.edu-note::before { content: ""; position: absolute; left: 16px; top: 16px; width: 18px; height: 18px; background: var(--color-primary-ink); -webkit-mask: var(--i-info) center/18px no-repeat; mask: var(--i-info) center/18px no-repeat; }
.edu-note > b:first-child { display: block; color: var(--color-primary-ink); font-size: 14.5px; font-weight: 800; margin-bottom: 2px; }
.edu-note > b:first-child + br { display: none; }
.edu-note .mfds-line { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--color-primary-soft-2); font-size: 13.5px; font-weight: 600; color: var(--color-ink-2); }
.care-cta { display: grid; grid-template-columns: 40px minmax(0, 1fr); column-gap: 12px; align-items: start; padding: 14px 16px; font-size: 15px; line-height: 1.6; color: var(--color-ink); }
.care-cta::before { content: ""; grid-row: 1 / span 2; width: 40px; height: 40px; border-radius: 12px; background: var(--color-surface) var(--i-stethoscope) center/20px no-repeat; box-shadow: inset 0 0 0 1px var(--color-line); }
.care-cta > * { grid-column: 2; }
.care-cta .link44 { min-height: var(--tap-min); margin: 2px 0 -8px; color: var(--color-danger-ink); font-size: 14.5px; }
.care-cta .link44 svg { width: 16px; height: 16px; }
.card-note { margin: -4px 0 10px; font-size: 13.5px; line-height: 1.55; color: var(--color-ink-3); }   /* "일반적인 자기 관리 정보예요…" under card h2 */
.chip.edu { background: var(--color-primary-soft); color: var(--color-primary-ink); }
.chip.edu svg { width: 13px; height: 13px; }
.draft-banner { margin: 0 0 var(--space-3); padding: 12px 14px 12px 42px; position: relative; border-radius: var(--radius-md); background: var(--color-caution-soft); border: 1px solid var(--color-caution-line); color: var(--color-caution-ink); font-size: 14.5px; line-height: 1.6; }
.draft-banner::before { content: ""; position: absolute; left: 14px; top: 14px; width: 18px; height: 18px; background: currentColor; -webkit-mask: var(--i-alert) center/18px no-repeat; mask: var(--i-alert) center/18px no-repeat; }
.legal .card p { margin: 0 0 8px; font-size: 15px; line-height: 1.75; }
.legal .card p:last-child { margin-bottom: 0; }

/* Citation spans inside long text  [MARKUP] JS wraps "(Brodie 01:34–02:35)" — the text itself is unchanged */
.cite { font-size: .8em; font-weight: 500; color: var(--color-ink-3); letter-spacing: 0; }
.aside-note { display: block; margin-top: var(--space-3); padding: 10px 14px; border-radius: var(--radius-sm); background: var(--color-surface-muted); font-size: 14.5px; line-height: 1.6; color: var(--color-ink-2); }

/* Progressive disclosure for long paragraphs  [MARKUP] */
.clamp { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 5; overflow: hidden; }
.clamp-toggle { display: inline-flex; align-items: center; gap: 4px; min-height: var(--tap-min); padding: 0; border: 0; background: none; color: var(--color-primary-ink); font-weight: 700; font-size: 15px; cursor: pointer; }
.clamp-toggle svg { width: 18px; height: 18px; }

/* ---------- 5. Segmented controls, tabs, stepper ---------- */
.seg { display: flex; gap: 2px; margin: 0 0 var(--space-3); padding: 3px; border-radius: var(--radius-md); background: var(--color-surface-sunken); }
.seg button {
  flex: 1; min-height: var(--tap-min); padding: 0 var(--space-2);
  border: 0; border-radius: 11px; background: transparent; cursor: pointer;
  font-size: 15px; font-weight: 600; color: var(--color-ink-3); letter-spacing: -0.01em;
  transition: background-color var(--dur-2) var(--ease-out), color var(--dur-2), box-shadow var(--dur-2);
}
@media (hover: hover) and (pointer: fine) { .seg button:hover { color: var(--color-ink); } }  /* R1-16: no sticky hover on touch */
.seg button[aria-pressed="true"] { background: var(--color-surface); color: var(--color-ink); font-weight: 750; box-shadow: 0 1px 2px rgba(20,24,31,.08), 0 2px 8px -2px rgba(20,24,31,.10); }
/* Side (L/R) — compact toggle in the map heading row  [MARKUP] move .seg.side into .map-head .row; labels 왼쪽/오른쪽 + aria-label "왼쪽 무릎"/"오른쪽 무릎" */
.seg.side { display: inline-flex; margin: 0; }
.seg.side button { flex: none; min-width: 58px; padding: 0 12px; font-size: 14.5px; }
.seg.side button[aria-pressed="true"] { background: var(--color-ink); color: var(--color-ink-inverse); box-shadow: none; } /* a mode switch, not an action → ink, never teal */

/* Condition tabs — sticky underline tabs with overflow fade */
.tabs {
  position: sticky; top: var(--topbar-h); z-index: 10;
  display: flex; gap: 0; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity;
  margin: 0 calc(var(--gutter) * -1) var(--space-4); padding: 0 calc(var(--gutter) - 12px);
  background: var(--color-surface-glass); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  box-shadow: inset 0 -1px 0 var(--color-line);
}
.tabs.fade-r { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); } /* JS toggles when more content to the right */
.tabs.fade-l { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 36px), transparent); } /* R1-26: JS toggles while scrollLeft > 4 */
.tabs.fade-l.fade-r { -webkit-mask-image: linear-gradient(to right, transparent, #000 36px, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, transparent, #000 36px, #000 calc(100% - 36px), transparent); }
.tabs::-webkit-scrollbar { display: none; }
/* Exercise library index (SCREENS §14, R1-15). [MARKUP] <nav class="lib-index" aria-label="운동 목록"><div class="seg">…group buttons…</div><div class="lib-chips fade-r">…<a class="chip" href="#ex-{id}">name</a>…</div></nav> */
.lib-index { position: sticky; top: var(--topbar-h); z-index: 9; margin: 0 calc(var(--gutter) * -1) var(--space-4); padding: var(--space-2) var(--gutter) var(--space-2); background: var(--color-surface-glass); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: inset 0 -1px 0 var(--color-line); }
.lib-index .seg { margin-bottom: var(--space-2); }
/* R2-05 scroll-spy: JS (IntersectionObserver, rootMargin '-120px 0px -60% 0px') sets aria-current="true" on the chip of the card in view and on its group button */
.lib-index .seg button[aria-current="true"] { background: var(--color-surface); color: var(--color-ink); font-weight: 750; box-shadow: 0 1px 2px rgba(20,24,31,.08), 0 2px 8px -2px rgba(20,24,31,.10); }
.lib-chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(var(--gutter) * -1); padding: 4px var(--gutter); scroll-padding-inline: 44px; }   /* R2b: scrollIntoView({inline:'nearest'}) keeps the current chip 44px from each edge, clear of the 36px fade-l/fade-r masks (0/46 positions under a fade at 390 and 1280; was 44/46 and 38/46) */
.lib-chips::-webkit-scrollbar { display: none; }
.lib-chips .chip { position: relative; flex: none; min-height: 36px; padding: 0 12px; font-size: 14px; background: var(--color-surface); box-shadow: inset 0 0 0 1px var(--color-line-strong); color: var(--color-ink-2); }
.lib-chips .chip::after { content: ""; position: absolute; inset: -4px 0; }   /* 44px hit */
.lib-chips .chip[aria-current="true"] { background: var(--color-primary-soft); box-shadow: inset 0 0 0 2px var(--color-primary); color: var(--color-primary-ink); font-weight: 700; }   /* R2-05: not colour alone — 2px border + weight */
.lib-chips.fade-r { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); }
.lib-chips.fade-l.fade-r { -webkit-mask-image: linear-gradient(to right, transparent, #000 36px, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, transparent, #000 36px, #000 calc(100% - 36px), transparent); }
.view[data-route="lib"] .card.ex, .view[data-route="lib"] .section-title { scroll-margin-top: calc(var(--topbar-h) + 124px); }
.tabs a {
  position: relative; flex: none; scroll-snap-align: center;
  min-height: 50px; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px;
  border: 0; border-radius: 0; background: none; text-decoration: none;
  color: var(--color-ink-3); font-weight: 600; font-size: 15px; letter-spacing: -0.01em; white-space: nowrap;
  transition: color var(--dur-2);
}
.tabs a::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 0; height: 2.5px; border-radius: 2px 2px 0 0; background: var(--color-ink); transform: scaleX(0); transition: transform var(--dur-2) var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .tabs a:hover { color: var(--color-ink); } }  /* R1-16: no sticky hover on touch */
.tabs a.active { color: var(--color-ink); font-weight: 750; background: none; border: 0; }
.tabs a.active::after { transform: scaleX(1); }
.tabs a .count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-pill); display: inline-flex; align-items: center; justify-content: center; background: var(--color-surface-sunken); color: var(--color-ink-3); font-size: 12px; font-weight: 750; font-variant-numeric: tabular-nums; } /* [MARKUP] wrap count in <span class="count"> */
.tabs a.active .count { background: var(--color-primary-soft); color: var(--color-primary-ink); }

/* Stepper  [MARKUP] replaces .steps-head */
.stepper { list-style: none; margin: 0 0 var(--space-5); padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.stepper li { display: flex; flex-direction: column; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--color-ink-3); line-height: 1.3; letter-spacing: -0.01em; }
.stepper li::before { content: ""; height: 4px; border-radius: 4px; background: var(--color-line); }
.stepper li.done::before { background: var(--color-primary-soft-2); }
.stepper li[aria-current="step"] { color: var(--color-primary-ink); font-weight: 750; }
.stepper li[aria-current="step"]::before { background: var(--color-primary); }
.steps-head { display: flex; gap: 6px; align-items: center; font-size: 12.5px; font-weight: 600; color: var(--color-ink-3); margin: 0 2px var(--space-4); } /* legacy fallback */

/* ---------- 6. Knee map ---------- */
.map-head { margin: 0 0 var(--space-3); }
.map-head .row { display: flex; align-items: center; gap: var(--space-3); }
.map-head h2 { flex: 1; min-width: 0; padding-left: 2px; font-size: 22px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.3; }
.hint { display: flex; align-items: flex-start; gap: 6px; font-size: 14px; line-height: 1.55; color: var(--color-ink-3); margin: 6px 2px 0; }
.hint svg { width: 16px; height: 16px; margin-top: 2px; }
.hint b { color: var(--color-ink-2); font-weight: 700; }
.map-wrap {
  position: relative; overflow: hidden; margin-bottom: var(--space-3);
  background: var(--map-bg); border: 1px solid var(--color-line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.knee-svg { display: block; width: 100%; height: auto; aspect-ratio: 9 / 10; touch-action: manipulation; cursor: pointer; user-select: none; -webkit-user-select: none; }
/* Regions: CSS overrides the rainbow fill/stroke attributes coming from overlay._colors */
.knee-svg .reg {
  fill: var(--map-accent); fill-opacity: .07;
  stroke: var(--map-accent); stroke-opacity: .5; stroke-width: 1.6; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke;
  transition: fill-opacity var(--dur-2) var(--ease-out), stroke-opacity var(--dur-2);
}
@media (hover: hover) and (pointer: fine) { .knee-svg .reg:hover { fill-opacity: .15; stroke-opacity: .9; } }  /* R1-16: no sticky hover on touch */
.knee-svg .reg.sel {
  fill-opacity: .28; stroke-opacity: 1; stroke-width: 3; stroke-dasharray: none;
  filter: drop-shadow(0 2px 6px rgba(15,118,110,.35)); stroke: var(--map-accent);
  animation: reg-pulse 2.4s var(--ease-in-out) infinite;
}
@keyframes reg-pulse { 50% { fill-opacity: .18; } }
.knee-svg .badge { display: none; }   /* manual region numbers (1–7e) carry no meaning for users */
.knee-svg .lbl { font-family: var(--font-sans); font-size: 28px; font-weight: 600; letter-spacing: -0.01em; fill: var(--map-label); paint-order: stroke; stroke: var(--map-label-halo); stroke-width: 8px; stroke-linejoin: round; pointer-events: none; }
.knee-svg .seltag { font-family: var(--font-sans); font-size: 40px; font-weight: 800; letter-spacing: -0.02em; fill: #0B5A54; paint-order: stroke; stroke: #fff; stroke-width: 12px; stroke-linejoin: round; pointer-events: none; }
/* Direction row — pinned inside the card bottom as pills */
.dir-row { position: absolute; left: var(--space-3); right: var(--space-3); bottom: var(--space-3); z-index: 2; display: flex; justify-content: space-between; padding: 0; pointer-events: none; }
.dir-row span { display: inline-flex; align-items: center; gap: 2px; padding: 4px 10px; border-radius: var(--radius-pill); background: rgba(255,255,255,.92); box-shadow: 0 0 0 1px rgba(20,24,31,.07); font-size: 12.5px; font-weight: 700; color: #3B424D; }
.dir-row svg { width: 14px; height: 14px; }
.side-tag { position: absolute; top: calc(var(--space-3) + 11px); right: var(--space-3); z-index: 2; background: rgba(255,255,255,.92); box-shadow: 0 0 0 1px rgba(20,24,31,.07); border-radius: var(--radius-pill); padding: 3px 10px; font-size: 12px; font-weight: 700; color: #5E6570; display: inline-flex; align-items: center; gap: 4px; }
.side-tag svg { width: 13px; height: 13px; }

/* Selected region card (inline — desktop; on mobile its content lives in .dock) */
.sel-card { display: flex; flex-direction: column; gap: 4px; }
.sel-card .name { font-size: var(--fs-title-1); font-weight: 800; letter-spacing: -0.025em; line-height: 1.35; }

/* "무릎 전체가 아파요" row  [MARKUP] replace 🦵 emoji with .ic-disc icon + trailing chevron */
.whole-btn { width: 100%; min-height: 72px; justify-content: flex-start; text-align: left; gap: 14px; padding: 12px 14px 12px 14px; margin: 0; border-radius: var(--radius-lg); border-color: var(--color-line); box-shadow: var(--shadow-1); font-size: 16px; }
.whole-btn small { display: block; margin-top: 2px; font-weight: 500; font-size: 13.5px; line-height: 1.45; color: var(--color-ink-3); }
.whole-btn .grow { flex: 1; min-width: 0; }
.ic-disc { width: 42px; height: 42px; border-radius: 13px; display: inline-flex; align-items: center; justify-content: center; background: var(--color-primary-soft); color: var(--color-primary-ink); flex: none; }
.ic-disc svg { width: 22px; height: 22px; }
.ic-disc.red { background: var(--color-danger-soft); color: var(--color-danger); }
.chev { width: 20px; height: 20px; color: var(--color-ink-4); flex: none; }

/* Red-flag strip on home */
.rf-banner {
  display: flex; gap: 10px; align-items: center; min-height: 48px; margin: 0 0 var(--space-4); padding: 10px 12px 10px 14px;
  border-radius: var(--radius-md); background: var(--color-danger-soft); border: 1px solid var(--color-danger-line);
  color: var(--color-danger-ink); font-weight: 700; font-size: 15px; line-height: 1.4; text-decoration: none;
}
.rf-banner svg { width: 20px; height: 20px; }
.rf-banner span { flex: 1; }

/* ---------- 7. Symptom options (checkbox rows) ---------- */
.opt {
  display: flex; gap: 14px; align-items: flex-start; width: 100%; min-height: 60px; margin: 0 0 10px; padding: 17px 16px;
  border: 1px solid var(--color-line); border-radius: var(--radius-md); background: var(--color-surface); box-shadow: var(--shadow-1);
  font-size: 16.5px; font-weight: 600; line-height: 1.5; letter-spacing: -0.012em; text-align: left; cursor: pointer; color: var(--color-ink);
  transition: background-color var(--dur-2) var(--ease-out), border-color var(--dur-2), box-shadow var(--dur-2);
}
@media (hover: hover) and (pointer: fine) { .opt:hover { border-color: var(--color-line-strong); } }  /* R1-16: no sticky hover on touch */
.opt:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; border-radius: var(--radius-md); }
.opt .tick {
  flex: none; width: 24px; height: 24px; margin-top: 0; border-radius: 7px;
  border: 1.5px solid var(--color-control-border); background: var(--color-surface);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background-color var(--dur-2) var(--ease-out), border-color var(--dur-2);
}
.opt[aria-checked="true"] { border-color: var(--color-primary); background: var(--color-primary-soft); box-shadow: inset 0 0 0 1px var(--color-primary); }
.opt[aria-checked="true"] .tick { background: var(--color-primary); border-color: var(--color-primary); }
.opt[aria-checked="true"] .tick::after { content: ""; width: 14px; height: 14px; background: #fff; -webkit-mask: var(--i-check) center/14px no-repeat; mask: var(--i-check) center/14px no-repeat; border: 0; transform: none; animation: tick-in var(--dur-2) var(--ease-spring); }
@keyframes tick-in { from { transform: scale(.4); opacity: 0; } }

/* Region header on symptom page (replaces white card)  [MARKUP] */
.region-head { display: flex; gap: 14px; align-items: center; margin: 0 0 var(--space-2); }
.region-thumb { width: 68px; height: 68px; flex: none; border-radius: 18px; background: var(--map-bg); border: 1px solid var(--color-line); overflow: hidden; }
.region-thumb svg { width: 100%; height: 100%; display: block; }
.region-head .t { flex: 1; min-width: 0; }
.region-head .k { font-size: 12.5px; font-weight: 650; color: var(--color-ink-3); }
.region-head h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.028em; line-height: 1.3; margin: 2px 0 3px; }
.region-head .d { font-size: 14.5px; color: var(--color-ink-2); line-height: 1.5; }
.alias-note { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; line-height: 1.55; color: var(--color-primary-ink); background: var(--color-primary-soft); border-radius: var(--radius-sm); padding: 10px 12px; margin: var(--space-3) 0 0; }
.alias-note svg { width: 18px; height: 18px; margin-top: 1px; }
#allCauses.btn.ghost, .none-fit { min-height: var(--tap-min); font-size: 15px; font-weight: 600; color: var(--color-ink-2); text-decoration: underline; text-decoration-color: var(--color-line-strong); text-underline-offset: 5px; background: none; border: 0; }

/* ---------- 8. Causes (accordion) ---------- */
.picked { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.picked .chip { min-height: 32px; padding: 0 12px; font-size: 14px; background: var(--color-surface); box-shadow: inset 0 0 0 1px var(--color-line-strong); color: var(--color-ink); white-space: normal; }
.picked .chip svg { color: var(--color-primary); }
.summary-bar { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: var(--radius-lg); background: var(--color-surface-muted); border: 1px solid var(--color-line); }
.summary-bar .t { flex: 1; min-width: 0; }
.summary-bar .k { font-size: 12.5px; font-weight: 650; color: var(--color-ink-3); }
.summary-bar.compact { align-items: center; min-height: 56px; padding: 6px 8px 6px 16px; }   /* R1-11: one row (was ~129px with chips) */
.summary-bar.compact .t { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.summary-bar.compact .k { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.summary-bar.compact b { flex: none; font-size: 15px; font-weight: 700; color: var(--color-ink); }
.edu-note.compact { padding: 12px 14px 12px 42px; font-size: 14px; line-height: 1.6; }   /* R1-11: same text, tighter type (−~20px) */
.edu-note.compact::before { left: 14px; top: 14px; }
.edu-note.compact > b:first-child { font-size: 14px; }
.edu-note.compact .mfds-line { margin-top: 8px; padding-top: 8px; font-size: 13px; }
.summary-bar a { flex: none; font-size: 14px; font-weight: 700; color: var(--color-primary-ink); text-decoration: none; min-height: var(--tap-min); display: inline-flex; align-items: center; margin: -10px -4px -10px 0; padding: 0 4px; }
details.cond { background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-lg); margin: 0 0 var(--space-3); overflow: hidden; box-shadow: var(--shadow-1); transition: box-shadow var(--dur-2); }
details.cond[open] { box-shadow: var(--shadow-2); }
details.cond > summary { list-style: none; cursor: pointer; display: flex; gap: 12px; align-items: flex-start; min-height: 64px; padding: 18px 16px 18px 20px; }
details.cond > summary::-webkit-details-marker { display: none; }
details.cond > summary:focus-visible { outline-offset: -3px; border-radius: var(--radius-lg); }
details.cond > summary .t { flex: 1; min-width: 0; }
details.cond > summary .t b { display: block; font-size: 18.5px; font-weight: 800; letter-spacing: -0.025em; line-height: 1.4; }
details.cond > summary .t .en, details.cond > summary .t .small.muted { display: block; font-size: 13px; color: var(--color-ink-3); margin-top: 1px; line-height: 1.45; }
details.cond > summary .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
details.cond > summary .arrow { flex: none; width: 32px; height: 32px; padding: 6px; margin-top: 0; border-radius: 50%; background: var(--color-surface-sunken); color: var(--color-ink-2); transition: transform var(--dur-3) var(--ease-out); }
details.cond[open] > summary .arrow { transform: rotate(180deg); }
details.cond .body { padding: 0 20px 20px; border-top: 1px solid var(--color-line); }
details.cond .body > p, .cond-prose { font-size: var(--fs-body-lg); line-height: var(--lh-body-lg); margin: 0; max-inline-size: var(--measure); }
.evidence { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--color-ink-2); background: var(--color-surface-sunken); border-radius: var(--radius-pill); padding: 3px 10px; white-space: normal; line-height: 1.4; }
.evidence svg { width: 13px; height: 13px; flex: none; color: var(--color-ink-3); }
.preview { margin-top: 10px; font-size: 15px; line-height: 1.6; color: var(--color-ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
details.cond[open] .preview { display: none; }
/* (.match meter removed: commercial-readiness phase 1 forbids ranking/likelihood cues such as "선택 증상 N개 일치". Keep data order.) */
/* In-card TOC  [MARKUP] h3 ids + anchor chips */
.toc { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -20px; padding: 16px 20px 2px; }
.toc::-webkit-scrollbar { display: none; }
.toc a { flex: none; position: relative; min-height: 32px; padding: 0 12px; display: inline-flex; align-items: center; border-radius: var(--radius-pill); background: var(--color-surface-muted); box-shadow: inset 0 0 0 1px var(--color-line); font-size: 13.5px; font-weight: 650; color: var(--color-ink-2); text-decoration: none; }
.toc a::after { content: ""; position: absolute; inset: -6px -2px; }
.toc a.red { color: var(--color-danger-ink); background: var(--color-danger-soft); box-shadow: none; }
.sec { scroll-margin-top: calc(var(--topbar-h) + 64px); }
.card h3.sec-h, details.cond h3, .sec-h { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 800; color: var(--color-ink); margin: var(--space-6) 0 var(--space-2); letter-spacing: -0.015em; line-height: 1.45; }
.sec-h::before, details.cond h3::before { content: ""; flex: none; width: 3px; height: 15px; border-radius: 2px; background: var(--color-primary); }

/* Situation grid (table.grid) → definition rows */
table.grid { width: 100%; border-collapse: collapse; font-size: 15.5px; line-height: 1.55; }
table.grid th, table.grid td { text-align: left; vertical-align: top; padding: 12px 0; border-top: 1px solid var(--color-line); }
table.grid tr:first-child th, table.grid tr:first-child td { border-top: 0; }
table.grid th { width: 42%; padding-right: 12px; color: var(--color-ink-2); font-weight: 650; font-size: 14.5px; }
table.grid th .gi { display: inline-flex; vertical-align: -3px; width: 17px; height: 17px; margin-right: 7px; color: var(--color-ink-3); } /* optional icon [MARKUP] */
table.grid td { color: var(--color-ink); }
@media (max-width: 479px) {   /* stacked rows on phones: label line + value line */
  table.grid, table.grid tbody, table.grid tr, table.grid th, table.grid td { display: block; width: 100%; }
  table.grid tr { padding: 12px 0; border-top: 1px solid var(--color-line); }
  table.grid tr:first-child { border-top: 0; padding-top: 4px; }
  table.grid th, table.grid td { border: 0; padding: 0; }
  table.grid th { font-size: 13.5px; font-weight: 700; color: var(--color-ink-3); margin-bottom: 3px; }
  table.grid td { font-size: 16px; line-height: 1.6; }
}

/* Generic art placeholder (until assets/generated/* is ready). NOTE: named .art-ph because app.js/legal.js already use .ph for inline [자리표시자] text */
.art-ph { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 12px; text-align: center; color: #8D929A; font-size: 11.5px; font-weight: 600; letter-spacing: .01em; background-image: radial-gradient(circle at 1px 1px, rgba(20,24,31,.08) 1px, transparent 0); background-size: 14px 14px; }
.art-ph svg { width: 30px; height: 30px; opacity: .8; }

/* ---------- 9. Condition page ---------- */
.card.cond-head, .cond-head { background: none; border: 0; box-shadow: none; padding: var(--space-1) 2px var(--space-2); margin: 0; }
.cond-head h2 { font-size: var(--fs-title-1); font-weight: 800; letter-spacing: -0.03em; line-height: var(--lh-title-1); margin: 0; }
.cond-head .en { font-size: 14px; color: var(--color-ink-3); margin-top: 2px; }
.cond-head .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: var(--space-3); }

/* Exercise card */
.card.ex, .ex { padding: 0; overflow: hidden; border-left: 1px solid var(--color-line); }
.ex-media { position: relative; margin: 0; width: 100%; aspect-ratio: 4 / 3; max-height: 420px; background: var(--ex-media-bg, linear-gradient(180deg, #F5F2EB, #EEEAE1)); border-bottom: 1px solid var(--color-line); } /* [MARKUP] <figure class="ex-media"><img …></figure> */
@media (max-width: 1023px) and (max-height: 760px) { .ex-media { aspect-ratio: 16 / 10; max-height: clamp(120px, calc(100vh - 570px), 420px); max-height: clamp(120px, calc(100svh - 570px), 420px); } }   /* R2-03: mobile slot 4:3 (390×844 → 348×261); on short screens 16:10, capped by the visible height (svh = with browser toolbars; 360×740 → 318×170, 375×667 → 335×120) so the first card title clears the action bar and its 16px fade; width:100% keeps the cap from narrowing the slot; art stays contained on --ex-media-bg, never cropped. Replaces app.css .ex-media{aspect-ratio:var(--ar)} */
.ex-media img { width: 100%; height: 100%; object-fit: contain; padding: 8px 12px 4px; display: block; } /* art is 1:1 or 4:3 (see image_brief.md) → use exercises/transparent/<id>.png, contained on the warm gradient */
.ex-media .kind { position: absolute; left: 12px; top: 12px; background: rgba(255,255,255,.94); box-shadow: 0 0 0 1px rgba(20,24,31,.06); color: #3B424D; }
.ex-media .idx { position: absolute; right: 12px; top: 12px; font-size: 12px; font-weight: 750; color: #5E6570; background: rgba(255,255,255,.94); border-radius: var(--radius-pill); padding: 2px 9px; box-shadow: 0 0 0 1px rgba(20,24,31,.06); font-variant-numeric: tabular-nums; }
.ex-body { padding: 18px var(--space-5) var(--space-5); }
/* Neutral info chips under the exercise name (owner-approved, presentation only): ex_split_squat_iso → "60초 유지". (st_glute_side "서서 하는 방법" dropped 2026-09-26: the standing version is now step 1 in the data.)
   [MARKUP] <h3>…</h3><div class="ex-tags"><span class="chip">60초 유지</span></div><div class="dose">…  Never inside .ex-media (keeps the figure clear), never teal/coral. */
.ex-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 var(--space-3); }
.ex-tags .chip { min-height: 26px; }   /* = base .chip: surface-sunken fill, ink-2 13/650 (light 8.9:1, dark 10.6:1) */
/* '관련:' condition links under a library card (R2-06)  [MARKUP] <div class="ex-rel small muted" style="margin-top:8px">관련: <a>…</a>, <a>…</a></div>
   Each link is a 44px-tall inline box, so wrapped rows are 44px apart and tap areas never overlap; text size and colour unchanged. */
.ex-rel { line-height: 1.5; }
.ex-rel a { display: inline-flex; align-items: center; min-height: 44px; }
/* /guide/ reading pages: exercise art (R2b)  [MARKUP] <figure class="guide-ex-img" style="--ar:…"><picture>…<img></picture></figure>
   One slot size for every card whatever the art ratio (--ar is no longer used): 4:3, art contained and centred on the light media backing in both themes.
   Replaces app.css .guide-ex-img { aspect-ratio: var(--ar, 4 / 3); max-height: min(60vh, 400px) } and @media (min-width: 900px) { .guide-ex-img { max-height: 300px } } */
.guide-ex-img { aspect-ratio: 4 / 3; max-height: none; background: var(--ex-media-bg, linear-gradient(180deg, #F5F2EB, #EEEAE1)); }
.guide-ex-img img { width: 100%; height: 100%; object-fit: contain; object-position: center; }
@media (min-width: 900px) { .guide-ex-img { aspect-ratio: auto; height: 280px; max-height: none; } }   /* full card width × 280 (1280: 662×280), same height as the app's desktop slot */
[data-theme="dark"] .ex-media .kind, [data-theme="dark"] .ex-media .idx { color: #3B424D; }   /* chips sit on the light art backing in both themes */
.ex h3 { font-size: 19px; font-weight: 800; letter-spacing: -0.025em; line-height: 1.4; margin: 0 0 var(--space-3); }
.dose {
  display: flex; gap: 12px; align-items: flex-start; width: 100%;
  margin: 0 0 var(--space-4); padding: 12px 14px; border-radius: var(--radius-md);
  background: var(--color-primary-soft); color: var(--color-primary-ink);
  font-size: 16px; font-weight: 750; line-height: 1.5; letter-spacing: -0.01em; font-variant-numeric: tabular-nums;
}
.dose > svg { width: 20px; height: 20px; margin-top: 2px; }
.dose .dl { display: block; font-size: 12px; font-weight: 750; letter-spacing: .03em; opacity: .75; margin-bottom: 2px; }
.dose small { display: block; font-size: 13px; font-weight: 500; opacity: .85; margin-top: 2px; letter-spacing: 0; }
.dose-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; } /* [MARKUP] dose split on "→" (presentation only) */
.dose-steps li { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: baseline; }
.dose-steps li .n { font-size: 11px; font-weight: 800; padding: 1px 6px; border-radius: 6px; background: rgba(15,118,110,.13); letter-spacing: .02em; }
.ex .subhead { font-size: 12.5px; font-weight: 750; letter-spacing: .04em; color: var(--color-ink-3); margin: var(--space-1) 0 0; }
.caution { margin-top: var(--space-4); padding: 12px 14px; border-radius: var(--radius-md); background: var(--color-caution-soft); font-size: 15px; line-height: 1.6; }
.caution b { display: flex; align-items: center; gap: 6px; color: var(--color-caution-ink); font-size: 14px; font-weight: 800; }
.caution b::before { content: ""; width: 16px; height: 16px; background: currentColor; -webkit-mask: var(--i-alert) center/16px no-repeat; mask: var(--i-alert) center/16px no-repeat; }
.caution ul.list { margin-top: 2px; }
.caution ul.list li { color: var(--color-ink); }
.caution ul.list li::marker { color: var(--color-caution-ink); }

/* ---------- 10. Flowchart ---------- */
.trail { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 var(--space-4); font-size: 0; color: transparent; } /* font-size:0 hides legacy '›' separators */
.trail span { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 10px 0 4px; border-radius: var(--radius-pill); background: var(--color-surface); box-shadow: inset 0 0 0 1px var(--color-line); font-size: 13px; font-weight: 600; color: var(--color-ink-2); }
.trail span i { font-style: normal; width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--color-surface-sunken); font-size: 11px; font-weight: 800; color: var(--color-ink-3); }
.trail span.more { padding: 0 10px; color: var(--color-ink-3); }
.flow-card { padding: var(--space-6) var(--space-5) var(--space-5); }
.qn { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 750; color: var(--color-primary-ink); background: var(--color-primary-soft); padding: 3px 10px; border-radius: var(--radius-pill); }
.flow-q { font-size: 21px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.45; margin: var(--space-3) 0 var(--space-5); }
.flow-q small { display: block; margin-top: var(--space-2); font-size: 15px; font-weight: 500; line-height: 1.65; color: var(--color-ink-2); letter-spacing: -0.005em; } /* [MARKUP] parenthetical split */
.flow-opts { display: flex; flex-direction: column; gap: 10px; }
.flow-opts .btn { min-height: 60px; justify-content: space-between; padding: 0 16px 0 20px; font-size: 17px; font-weight: 700; border-color: var(--color-line-strong); }
.flow-opts .btn::after { content: ""; flex: none; width: 20px; height: 20px; background: var(--color-ink-4); -webkit-mask: var(--i-chevron-right) center/20px no-repeat; mask: var(--i-chevron-right) center/20px no-repeat; }
@media (hover: hover) and (pointer: fine) { .flow-opts .btn:hover { border-color: var(--color-primary); background: var(--color-primary-soft); } }  /* R1-16: no sticky hover on touch */

.outcome { position: relative; border-radius: var(--radius-xl); padding: var(--space-6) var(--space-5); margin-bottom: var(--space-4); border: 1px solid; overflow: hidden; }
.outcome .kind { display: flex; align-items: center; gap: 12px; margin-bottom: var(--space-4); font-size: 17px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.3; }
.outcome .kind .oi { width: 46px; height: 46px; border-radius: 15px; display: inline-flex; align-items: center; justify-content: center; color: #fff; flex: none; box-shadow: inset 0 -2px 0 rgba(0,0,0,.12); } /* [MARKUP] replaces emoji */
.outcome .kind .oi svg { width: 24px; height: 24px; }
.outcome .kind small { display: block; font-size: 12px; font-weight: 700; letter-spacing: .04em; opacity: .85; margin-bottom: 2px; }
.outcome .txt { font-size: 20px; font-weight: 750; line-height: 1.55; letter-spacing: -0.025em; color: var(--color-ink); }
.outcome.run        { background: var(--color-ok-soft);      border-color: var(--color-ok-line);      color: var(--color-ok-ink); }
.outcome.run .oi    { background: var(--color-ok); }
.outcome.modify     { background: var(--color-caution-soft); border-color: var(--color-caution-line); color: var(--color-caution-ink); }
.outcome.modify .oi { background: var(--color-caution); color: var(--color-ink); }
.outcome.stop       { background: var(--color-stop-soft);    border-color: var(--color-stop-line);    color: var(--color-stop-ink); }
.outcome.stop .oi   { background: var(--color-stop); }
.outcome.see_doctor { background: var(--color-danger-soft);  border-color: var(--color-danger-line);  color: var(--color-danger-ink); }
.outcome.see_doctor .oi { background: var(--color-danger); }
.restart { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: var(--tap-min); margin-top: var(--space-1); border: 0; background: none; color: var(--color-ink-2); font-size: 15px; font-weight: 650; text-decoration: none; }
.restart svg { width: 17px; height: 17px; }

/* ---------- 11. Pain traffic light ---------- */
.score-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: var(--space-3) 0 var(--space-1); }
.score-grid button {
  width: calc((100% - 40px) / 6); min-height: 54px; position: relative;
  border-radius: var(--radius-md); border: 1px solid var(--color-line-strong); background: var(--color-surface);
  font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--color-ink); cursor: pointer; padding-bottom: 4px;
  transition: background-color var(--dur-2), color var(--dur-2), transform var(--dur-1), box-shadow var(--dur-2);
}
.score-grid button::after { content: ""; position: absolute; left: 50%; width: 14px; margin-left: -7px; bottom: 8px; height: 3px; border-radius: 2px; background: var(--color-danger); }
.score-grid button:is([data-n="0"],[data-n="1"],[data-n="2"])::after { background: var(--color-ok-dot); }
.score-grid button:is([data-n="3"],[data-n="4"])::after { background: var(--color-caution-dot); }
.score-grid button:active { transform: scale(.96); }
.score-grid button[aria-pressed="true"] { border-color: transparent; color: #fff; background: var(--color-danger); box-shadow: var(--shadow-2); }
.score-grid button[aria-pressed="true"]::after { background: rgba(255,255,255,.75); }
.score-grid button[aria-pressed="true"]:is([data-n="0"],[data-n="1"],[data-n="2"]) { background: var(--color-ok); }
.score-grid button[aria-pressed="true"]:is([data-n="3"],[data-n="4"]) { background: var(--color-caution); color: var(--color-ink); }
.score-grid button[aria-pressed="true"]:is([data-n="3"],[data-n="4"])::after { background: rgba(20,24,31,.5); }
.zone-legend { display: flex; justify-content: center; gap: 16px; font-size: 12.5px; font-weight: 600; color: var(--color-ink-3); margin: var(--space-2) 0 0; }
.zone-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }
.check-row { display: flex; gap: 12px; align-items: center; min-height: 56px; margin-top: var(--space-4); padding: 10px 14px; border-radius: var(--radius-md); background: var(--color-surface-muted); border: 1px solid var(--color-line); font-size: 15.5px; font-weight: 600; line-height: 1.45; cursor: pointer; }
.check-row input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--color-danger); }

.light { display: flex; gap: 14px; align-items: center; margin: 0 0 10px; padding: 14px 16px; border-radius: var(--radius-lg); background: var(--color-surface); border: 1px solid var(--color-line); box-shadow: var(--shadow-1); transition: opacity var(--dur-2), background-color var(--dur-2), box-shadow var(--dur-2); }
.light .dot { flex: none; width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 13.5px; letter-spacing: -0.01em; box-shadow: inset 0 -2px 0 rgba(0,0,0,.12); }
.light.green  .dot { background: var(--color-ok); }
.light.yellow .dot { background: var(--color-caution); color: var(--color-ink); }
.light.red    .dot { background: var(--color-danger); }
.light .range { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.4; font-variant-numeric: tabular-nums; }
.light .range + div { font-size: 15px; line-height: 1.55; color: var(--color-ink-2); margin-top: 2px; }
.light.on { border-color: transparent; }
.light.on.green  { background: var(--color-ok-soft);      box-shadow: inset 0 0 0 2px var(--color-ok); }
.light.on.yellow { background: var(--color-caution-soft); box-shadow: inset 0 0 0 2px var(--color-caution-dot); }
.light.on.red    { background: var(--color-danger-soft);  box-shadow: inset 0 0 0 2px var(--color-danger); }
.light .now { margin-left: auto; align-self: flex-start; flex: none; font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: var(--radius-pill); background: var(--color-ink); color: #fff; } /* [MARKUP] JS adds <span class="now">지금</span> to .light.on */
#lights:has(.on) .light:not(.on) { background: var(--color-surface-muted); box-shadow: none; }
#lights:has(.on) .light:not(.on) .dot { background: var(--color-surface); color: var(--color-ink-2); box-shadow: inset 0 0 0 2.5px var(--color-danger); }   /* muted: ring only, label stays AA */
#lights:has(.on) .light.green:not(.on) .dot { box-shadow: inset 0 0 0 2.5px var(--color-ok-dot); }
#lights:has(.on) .light.yellow:not(.on) .dot { box-shadow: inset 0 0 0 2.5px var(--color-caution-dot); }
.card .light { box-shadow: none; background: var(--color-surface-muted); padding: 10px 12px; }   /* mini lights (care tab) */
.card .light .dot { width: 40px; height: 40px; font-size: 12.5px; }

/* ---------- 12. Red flags ---------- */
.rf-hero { display: flex; gap: 14px; align-items: flex-start; margin-bottom: var(--space-2); padding: var(--space-5); border-radius: var(--radius-xl); background: var(--color-danger-soft); border: 1px solid var(--color-danger-line); color: var(--color-ink); }
.rf-hero .ic { width: 46px; height: 46px; border-radius: 15px; flex: none; display: inline-flex; align-items: center; justify-content: center; background: var(--color-danger); color: #fff; box-shadow: inset 0 -2px 0 rgba(0,0,0,.14); } /* [MARKUP optional] */
.rf-hero .ic svg { width: 24px; height: 24px; }
.rf-hero h2 { font-size: var(--fs-title-2); font-weight: 800; letter-spacing: -0.025em; line-height: 1.4; margin-bottom: 4px; color: var(--color-danger-ink); }
.rf-hero h2 + div { font-size: 15px; line-height: 1.6; color: var(--color-ink-2); }
.rf-group-h { display: flex; align-items: center; gap: 8px; margin: var(--space-6) 2px var(--space-3); font-size: 16px; font-weight: 800; color: var(--color-ink); letter-spacing: -0.01em; } /* [MARKUP optional] urgency grouping */
.rf-group-h .bar { width: 10px; height: 10px; border-radius: 3px; background: var(--color-danger); }
.rf-group-h .bar.mid { background: var(--color-stop); }
.rf-group-h .bar.low { background: var(--color-caution-dot); }
.rf-group-h small { font-weight: 600; color: var(--color-ink-3); font-size: 13px; }   /* R1-13: group heading 14→16px so it outranks the 17px item labels as a section, count 12.5→13px */
.rf-group-h .bar { width: 12px; height: 12px; }
.rf-item { display: flex; gap: 14px; align-items: flex-start; margin: 0 0 10px; padding: 16px 16px 14px; border-radius: var(--radius-lg); background: var(--color-surface); border: 1px solid var(--color-line); box-shadow: var(--shadow-1); }
.rf-item .n { flex: none; width: 28px; height: 28px; margin-top: 1px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--color-danger-soft); color: var(--color-danger-ink); font-weight: 800; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.rf-item .l { font-size: 17px; font-weight: 700; line-height: 1.5; letter-spacing: -0.018em; }
.rf-item .refs { margin-top: 8px; gap: 0; }
.rf-item .refs a { background: transparent; box-shadow: none; padding: 0 8px 0 0; min-height: 24px; color: var(--color-ink-3); font-weight: 500; font-size: 12.5px; }
.rf-item .refs a + a::before { content: "·"; margin-right: 8px; color: var(--color-ink-4); }
.rf-item .refs::before { content: "출처"; font-size: 12.5px; font-weight: 700; color: var(--color-ink-4); margin-right: 8px; line-height: 24px; } /* UI label (non-medical) */

/* ---------- 13. Menu (grouped list) ---------- */
.menu { background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-1); margin-bottom: var(--space-4); }
.menu a { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 16px 12px 20px; margin: 0; border: 0; border-radius: 0; background: none; text-decoration: none; color: var(--color-ink); font-weight: 700; font-size: 0; letter-spacing: -0.01em; } /* font-size:0 hides legacy '›' text */
.menu a .t { flex: 1; font-size: 16px; line-height: 1.4; }
.menu a small { display: block; margin-top: 2px; font-weight: 500; font-size: 13.5px; color: var(--color-ink-3); }
.menu a::after { content: ""; flex: none; width: 20px; height: 20px; background: var(--color-ink-4); -webkit-mask: var(--i-chevron-right) center/20px no-repeat; mask: var(--i-chevron-right) center/20px no-repeat; }
.menu a + a { box-shadow: inset 0 1px 0 var(--color-line); }
@media (hover: hover) and (pointer: fine) { .menu a:hover { background: var(--color-surface-muted); } }  /* R1-16: no sticky hover on touch */

/* ---------- 14. Disclaimer, modal, onboarding, toast, empty, loading ---------- */
.footer-disc { display: grid; grid-template-columns: 16px minmax(0, 1fr); column-gap: 10px; margin: var(--space-7) 0 0; padding: 14px 16px; border-radius: var(--radius-md); background: var(--color-surface-muted); border: 1px solid var(--color-line); color: var(--color-ink-3); font-size: 13px; line-height: 1.65; }
.footer-disc::before { content: ""; grid-row: 1 / span 3; width: 16px; height: 16px; margin-top: 3px; background: var(--color-ink-3); -webkit-mask: var(--i-info) center/16px no-repeat; mask: var(--i-info) center/16px no-repeat; }
.footer-disc > * { grid-column: 2; }
.footer-disc p { margin: 0; }
.footer-disc b { color: var(--color-ink-2); font-weight: 750; }
.footer-disc .mfds { display: block; margin-top: 6px; font-weight: 600; color: var(--color-ink-2); }   /* MFDS notice — never hide or shrink below 13px */
.footer-disc strong.mfds { display: inline; margin: 0; }   /* R1-06: when the disclaimer already contains the MFDS sentence, it is emphasised in place (shown once), not repeated as a block */
.onb-body strong.onb-mfds-inline { font-weight: 700; color: var(--color-ink); }   /* R1-06: onboarding — same sentence, in place, full contrast; no separate .onb-mfds */
.legal-links { display: flex; flex-wrap: wrap; gap: 0 2px; margin: 8px -6px 0; }
.legal-links a, .footer-disc .link44.inline { position: relative; min-height: 32px; padding: 0 6px; display: inline-flex; align-items: center; font-size: 12.5px; font-weight: 600; color: var(--color-ink-2); text-decoration: underline; text-decoration-color: var(--color-line-strong); text-underline-offset: 3px; }
.legal-links a::after { content: ""; position: absolute; inset: -6px 0; }   /* 44px hit */
@media (hover: hover) and (pointer: fine) { .legal-links a:hover { color: var(--color-ink); text-decoration-color: currentColor; } }  /* R1-16: no sticky hover on touch */
.footer-disc .biz { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--color-line); font-size: 12.5px; line-height: 1.6; }   /* home footer only (see SCREENS §2) */
.footer-disc .biz-i { display: inline-block; margin-right: 10px; }
.ph { color: var(--color-caution-ink); background: var(--color-caution-soft); border-radius: 4px; padding: 0 4px; font-weight: 600; }   /* legal.js inline [자리표시자] */
.ph-note { color: var(--color-ink-3); font-weight: 500; }

.modal { position: fixed; inset: 0; z-index: var(--z-modal); display: flex; align-items: flex-end; justify-content: center; background: var(--color-scrim); animation: fade-in var(--dur-3) var(--ease-out); }
.sheet { position: relative; width: 100%; max-width: var(--container); max-height: 94vh; overflow: auto; padding: var(--space-7) var(--gutter) calc(var(--space-5) + var(--safe-b)); background: var(--color-surface); border-radius: var(--radius-xl) var(--radius-xl) 0 0; box-shadow: var(--shadow-3); animation: sheet-in var(--dur-3) var(--ease-out); }
.sheet::before { content: ""; position: absolute; top: 10px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--color-line-strong); z-index: 2; }
.sheet h2 { font-size: var(--fs-title-1); font-weight: 800; letter-spacing: -0.03em; line-height: 1.35; margin-bottom: var(--space-3); }
.sheet > p { font-size: 16px; line-height: 1.7; color: var(--color-ink-2); }
@keyframes fade-in { from { opacity: 0; } }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } }

/* Onboarding / first-open disclaimer  [MARKUP] */
.onb { min-height: 100dvh; display: flex; flex-direction: column; background: var(--color-surface); }
.onb-art { position: relative; aspect-ratio: 390 / 210; background: linear-gradient(160deg, #DDEFEA 0%, #F4EFE6 100%); overflow: hidden; }
.onb-art img { width: 100%; height: 100%; object-fit: contain; display: block; } /* onboarding/transparent/onboard_*.png is 1:1 → contained, centred on the gradient */
.onb-body { flex: 1; padding: var(--space-6) var(--gutter) 0; }
.onb-kicker { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 750; color: var(--color-primary-ink); background: var(--color-primary-soft); border-radius: var(--radius-pill); padding: 4px 10px 4px 8px; margin-bottom: var(--space-3); }
.onb-kicker svg { width: 15px; height: 15px; }
.onb h2 { font-size: 26px; font-weight: 800; letter-spacing: -0.035em; line-height: 1.32; margin-bottom: var(--space-3); }
.onb-body > p { font-size: 16px; line-height: 1.75; color: var(--color-ink-2); margin: 0; }
.onb-mfds { margin: 10px 0 0 !important; font-size: 14.5px !important; line-height: 1.65 !important; font-weight: 650; color: var(--color-ink) !important; }
.onb-legal { margin-top: 12px; }
.onb-rf { margin-top: var(--space-5); border-radius: var(--radius-lg); border: 1px solid var(--color-danger-line); background: var(--color-surface); overflow: hidden; }
.onb-rf-h { display: flex; align-items: center; gap: 8px; padding: 12px 16px; background: var(--color-danger-soft); color: var(--color-danger-ink); font-size: 15px; font-weight: 800; }
.onb-rf-h svg { width: 18px; height: 18px; }
.onb-rf-h a { margin-left: auto; font-size: 13.5px; font-weight: 700; color: var(--color-danger-ink); text-decoration: none; display: inline-flex; align-items: center; min-height: var(--tap-min); margin-top: -12px; margin-bottom: -12px; }
.onb-rf ul { list-style: none; margin: 0; padding: 2px 16px; }
.onb-rf li { display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; padding: 10px 0; font-size: 14.5px; line-height: 1.5; font-weight: 600; color: var(--color-ink); }
.onb-rf li + li { border-top: 1px solid var(--color-line); }
.onb-rf li .u { flex: none; margin-top: 1px; font-size: 12px; font-weight: 750; color: var(--color-danger-ink); background: var(--color-danger-soft); border-radius: var(--radius-pill); padding: 1px 8px; white-space: nowrap; }
.onb-rf li .u.hi { background: var(--color-danger); color: #fff; }
.onb-rf li .u.lo { background: var(--color-surface-sunken); color: var(--color-ink-2); }
.onb-foot { position: sticky; bottom: 0; padding: var(--space-4) var(--gutter) calc(var(--space-4) + var(--safe-b)); background: var(--color-surface); border-top: 1px solid var(--color-line); box-shadow: 0 -10px 20px -14px rgba(20, 24, 31, .22); }   /* R1-09: solid, no text showing through */
.sheet:has(.onb-foot) { padding-bottom: 0; }   /* R1-09: the foot is the last thing in the sheet; no strip under it */
/* Brand line (R1-07) — first row of .onb-body. Wordmark/mark come from design/brand/. [MARKUP] <div class="onb-brand"><span class="brand-mark" aria-hidden="true"></span><img class="onb-wordmark" src="brand/wordmark.svg" alt="니코치"></div> */
.onb-brand { display: flex; align-items: center; gap: 8px; height: 28px; margin: 0 0 var(--space-4); }
.onb-brand .brand-mark { width: 28px; height: 28px; border-radius: 9px; }
.onb-wordmark { height: 20px; width: auto; display: block; }
.onb-brand b { font-size: 17px; font-weight: 800; letter-spacing: -0.03em; color: var(--color-ink); }   /* text fallback until the wordmark ships */
/* 3-card intro inside .onb-art (R1b-6/7/8) */
.onb-cards { display: flex; gap: 12px; height: 100%; margin: 0; padding: 16px var(--gutter) 28px; list-style: none; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 var(--gutter); scrollbar-width: none; }
.onb-cards::-webkit-scrollbar { display: none; }
.onb-card { flex: 0 0 78%; scroll-snap-align: center; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 12px 14px; border-radius: var(--radius-lg); background: #FBFAF7; box-shadow: 0 0 0 1px rgba(20,24,31,.05); }
.onb-card img { flex: 1; min-height: 0; width: 100%; object-fit: contain; }
.onb-card p { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14.5px; font-weight: 700; color: #14181F; }
.onb-card p b { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--color-primary); color: var(--color-on-primary); font-size: 12.5px; }
.onb-dots { position: absolute; left: 0; right: 0; bottom: 10px; display: flex; justify-content: center; gap: 6px; }   /* [MARKUP] <div class="onb-dots" aria-hidden="true"><span aria-current="true"></span><span></span><span></span></div>, synced on scroll */
.onb-dots span { width: 6px; height: 6px; border-radius: 3px; background: rgba(20, 24, 31, .22); transition: width var(--dur-2) var(--ease-out); }
.onb-dots span[aria-current] { width: 18px; background: var(--color-primary); }
[data-theme="dark"] .onb-card { background: #F4F1EA; }   /* R1b-8: opaque — the .92 alpha turned muddy grey on the dark gradient */
[data-theme="dark"] .onb-dots span { background: rgba(255, 255, 255, .28); }
@media (max-height: 760px) { .onb-art { aspect-ratio: auto; height: 176px; } }   /* R1b-7: 360×740 — keep the red-flag box header above the fold */
@media (min-width: 900px) {   /* R1b-6: all 3 cards visible. R2-01: the strip grows to fit the cards (was a fixed 220px that clipped the 2-line captions) */
  .onb-art { aspect-ratio: auto; height: auto; }
  .onb-cards { display: grid; grid-template-columns: repeat(3, 1fr); height: auto; overflow: visible; padding: 16px var(--gutter); }
  .onb-card { justify-content: flex-start; padding: 12px 10px 14px; }
  .onb-card img { flex: none; height: 120px; max-height: 120px; }
  .onb-card p { align-items: flex-start; font-size: 13.5px; line-height: 1.4; }
  .onb-card p b { flex: none; }
  .onb-dots { display: none; }
}
.onb-foot .fine { text-align: center; font-size: 12.5px; color: var(--color-ink-3); margin: var(--space-2) 0 0; }

.toast {   /* R1-01: sits 12px above whatever is fixed at the bottom (nav + action bar/dock, via --actionbar-h on :root); transform reset beats legacy styles.css translateX(-50%) */
  position: fixed; left: 20px; right: 20px; margin: 0 auto; width: fit-content; bottom: calc(var(--nav-h) + var(--safe-b) + var(--actionbar-h, 96px) + 12px); transform: none; pointer-events: none; z-index: var(--z-toast);   /* [MARKUP] JS keeps --actionbar-h on document.documentElement (:root) = #actionbar.offsetHeight (ResizeObserver; 0px when empty). Not on .app: the toast is appended to <body>, outside .app, so it never inherits it (R2-02) */
  display: flex; align-items: center; gap: 8px; max-width: min(calc(100% - 40px), 420px);
  padding: 12px 18px 12px 14px; border-radius: var(--radius-pill);
  background: rgba(20, 24, 31, .94); color: #fff; box-shadow: var(--shadow-3);
  font-size: 15px; font-weight: 600; line-height: 1.4; text-align: left;
  animation: toast-in var(--dur-3) var(--ease-spring);
}
.toast::before { content: ""; flex: none; width: 18px; height: 18px; background: #7FD6CB; -webkit-mask: var(--i-info) center/18px no-repeat; mask: var(--i-info) center/18px no-repeat; }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } }

.empty-msg { text-align: center; padding: var(--space-7) var(--space-5) var(--space-5) !important; }
.empty-msg::before { content: ""; display: block; width: 56px; height: 56px; margin: 0 auto var(--space-4); border-radius: 18px; background: var(--color-primary-soft) var(--i-clipboard) center/26px no-repeat; }
.empty-msg[data-msg="doctor_first"]::before { background: var(--color-danger-soft) var(--i-stethoscope) center/26px no-repeat; }
.empty-msg p { font-size: 17px !important; line-height: 1.6 !important; font-weight: 700 !important; color: var(--color-ink); max-inline-size: 20em; margin: 0 auto var(--space-5) !important; letter-spacing: -0.02em; }
.empty-msg > div { gap: 8px !important; }
.empty-msg .btn { flex: 1; min-height: 50px; }

.loading { padding: var(--space-9) var(--space-5); text-align: center; color: var(--color-ink-3); font-size: 15px; }
.skeleton { background: linear-gradient(90deg, var(--color-surface-sunken) 0%, var(--color-surface-muted) 50%, var(--color-surface-sunken) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { to { background-position: -200% 0; } }
.src { scroll-margin-top: 72px; }
.src.hl { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* ---------- 15. Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .knee-svg .reg.sel { animation: none; }
}

/* ---------- 16. Tablet (≥700px) ---------- */
@media (min-width: 700px) {
  body { background: var(--color-surface-sunken); }
  .app { box-shadow: 0 0 0 1px var(--color-line), 0 20px 60px -20px rgba(20,24,31,.12); }
  .modal { align-items: center; }
  .sheet { border-radius: var(--radius-xl); max-width: 520px; }
  .sheet::before { display: none; }
  .knee-svg { max-height: 62vh; }
}

/* ---------- 17. Desktop (≥1024px) — two-column  [MARKUP] data-route on #view + .map-col/.side-col wrappers ---------- */
@media (min-width: 1024px) {
  body { background: var(--color-bg); }
  .app { max-width: none; box-shadow: none; }
  .topbar { height: 64px; padding: 0 max(var(--gutter-desktop), calc((100% - var(--container-wide)) / 2 + var(--gutter-desktop) - 12px)); }   /* R1-32: 100% (= the bar's container) instead of 100vw, so a narrowed bar (/guide/ 760px) lines up with its own column */
  .topbar .rf-top { display: none; }                        /* nav carries 적신호 on desktop */
  .bottomnav {                                               /* becomes top-right nav — no DOM move */
    top: 0; bottom: auto; left: auto; right: max(var(--gutter-desktop), calc((100vw - var(--container-wide)) / 2 + var(--gutter-desktop) - 8px));
    max-width: none; width: auto; height: 64px; padding: 0; gap: 2px; align-items: center;
    background: transparent; border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  .bottomnav a { flex: none; flex-direction: row; gap: 7px; padding: 0 14px; height: 40px; min-height: 40px; border-radius: var(--radius-pill); font-size: 14.5px; }
  .bottomnav a::before { top: 0; left: 0; width: 100%; height: 100%; margin: 0; border-radius: var(--radius-pill); }
  .bottomnav svg { width: 18px; height: 18px; }
  .view { max-width: var(--container-wide); margin: 0 auto; padding: var(--space-7) var(--gutter-desktop) var(--space-10); }
  .view:not([data-route="map"]) > * { max-width: 760px; margin-left: auto; margin-right: auto; }
  .view.has-action, .view.has-dock { padding-bottom: 120px; }
  .actionbar { max-width: 760px; bottom: 0; background: linear-gradient(to top, var(--color-bg) calc(100% - 12px), transparent); box-shadow: none; padding: 12px var(--gutter-desktop) 16px; }   /* R1-17: backed strip. R2-07: fade only in the top 12px, strip 80px tall (was 104px with a 29px fade over the first dose box) */
  .actionbar::before { display: none; }
  .view[data-route="map"] { display: grid; grid-template-columns: minmax(0, 500px) minmax(0, 1fr); column-gap: 56px; align-items: start; }
  .view[data-route="map"] .map-col { position: sticky; top: 88px; }
  .view[data-route="map"] .side-col { padding-top: 0; }
  .view[data-route="map"] .side-col .rf-banner { margin-bottom: var(--space-4); }
  .topbar .rf-pill { display: none; }
  .view[data-route="map"] .knee-svg { max-height: calc(100vh - 250px); }
  .view[data-route="map"] .footer-disc { grid-column: 1 / -1; }
  .app:has(.view[data-route="map"]) .actionbar { display: none; }   /* CTA lives in .sel-card on desktop */
  .sel-card .desk-only { display: flex; }
  .map-head h2 { font-size: var(--fs-display); }
  .tabs { margin-left: 0; margin-right: 0; }
  .ex-media { aspect-ratio: auto; height: clamp(160px, calc(100vh - 560px), 280px); max-height: none; }   /* R1b-3/R1-17/R2-07: first card title, '60초 유지' chip and dose box end above the 80px action bar (1280×820 → 260px, 1024×768 → 208px, 1280×720 → 160px, ≥840 tall → 280px); art is contained, never cropped */
  .view.has-action { padding-bottom: 140px; }
}
@media (max-width: 1023px) {
  .map-col, .side-col { display: contents; }
  .sel-card .desk-only { display: none; }
  .view.has-dock #selCard, .view.has-dock .sel-card { display: none; }   /* mobile: the selection lives in .dock (#actionbar) */
}

/* Pain page: the "점수는 저장되지 않아요" notice (#noAutoAdjust) sits directly under the lights (layout move only, text unchanged) */
.no-auto, #noAutoAdjust { position: relative; padding-left: 42px; font-size: 13.5px; line-height: 1.6; }
.no-auto::before, #noAutoAdjust::before { content: ""; position: absolute; left: 16px; top: 15px; width: 16px; height: 16px; background: var(--color-ink-3); -webkit-mask: var(--i-info) center/16px no-repeat; mask: var(--i-info) center/16px no-repeat; }

/* side info (sources, red-flag lists, videos, legal) folded by default */
details.side-fold > summary, details.legal-fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; min-height: 44px; }
details.side-fold > summary::-webkit-details-marker, details.legal-fold > summary::-webkit-details-marker { display: none; }
details.side-fold > summary h3, details.side-fold > summary h4 { flex: 1; margin: 0; }
details.side-fold > summary > b { flex: none; }
details.side-fold > summary > .muted { flex: 1; }
details.side-fold > summary .arrow { flex: none; margin-left: auto; width: 24px; height: 24px; transition: transform var(--dur-3) var(--ease-out); }
details.side-fold[open] > summary .arrow { transform: rotate(180deg); }
details.side-fold > summary:focus-visible, details.legal-fold > summary:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; border-radius: 8px; }
details.side-fold[open] > summary { margin-bottom: 8px; }
details.refs-sec { background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-lg); padding: 6px 16px; margin: 0 0 var(--space-3); }
details.refs-sec > summary { font-weight: 800; font-size: 16px; }
details.refs-sec > .ref-list { padding-bottom: 12px; }
details.legal-fold > summary { font-size: 12.5px; font-weight: 700; color: var(--color-ink-2); min-height: 44px; }
details.legal-fold > summary::after { content: "▾"; margin-left: 4px; }
details.legal-fold[open] > summary::after { content: "▴"; }
details.vid-fold { border-top: 1px solid var(--color-line); margin-top: 12px; padding-top: 4px; }
details.vid-fold > summary h3 { font-size: 15px; }
