/* =========================================================
   NST 영양지원 학습 — 공통 디자인 시스템
   순수 CSS · 외부 의존성 없음
   ========================================================= */

/* ---------- Fonts ---------- */
@font-face {
  font-family: "SCDream";
  src: url("../fonts/SCDream5.otf") format("opentype");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "SCDream";
  src: url("../fonts/SCDream6.otf") format("opentype");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "OmyuPretty";
  src: url("../fonts/omyu pretty.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

/* ---------- Design tokens ---------- */
:root {
  /* Base palette */
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #eef3f8;
  --ink: #1f2b3a;
  --ink-soft: #4a5a6d;
  --ink-faint: #7b8aa0;
  --line: #dfe6ee;
  --line-strong: #c7d2df;

  /* Brand — NST 청록 그라디언트 */
  --brand: #0e8c7e;
  --brand-dark: #0a6b5f;
  --brand-soft: #e0f5f2;

  /* NST 도메인 색상 토큰 */
  --nst-energy: #e0872a;
  --nst-energy-soft: #fef3e2;
  --nst-protein: #0f9d8e;
  --nst-protein-soft: #dcf5f1;
  --nst-fluid: #2f6fed;
  --nst-fluid-soft: #e6efff;
  --nst-elec: #8b5cf6;
  --nst-elec-soft: #efe8fe;
  --nst-alert: #e5484d;
  --nst-alert-soft: #fce8e9;

  /* Card accents */
  --key: #2f6fed;
  --key-soft: #e6efff;
  --pharm: #0f9d8e;
  --pharm-soft: #dcf5f1;
  --nst: #7c5cf0;
  --nst-soft: #efe8fe;
  --case: #e0872a;
  --case-soft: #fef3e2;
  --caution: #e5484d;
  --caution-soft: #fce8e9;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(28,45,66,.06), 0 8px 24px rgba(28,45,66,.06);
  --shadow-sm: 0 1px 3px rgba(28,45,66,.08);

  --sidebar-w: 268px;
  --maxw: 900px;

  --font-body: "SCDream", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  --font-cute: "OmyuPretty", var(--font-body);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.72;
  font-size: clamp(15px, 1.4vw + 8px, 17px);
  letter-spacing: -0.01em;
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-weight: 700; line-height: 1.3; color: var(--ink); }
strong, b { font-weight: 700; }
code, .mono {
  font-family: ui-monospace, SFMono-Regular, "Cascadia Code", Consolas, monospace;
  font-size: .92em;
}

/* =========================================================
   LAYOUT
   ========================================================= */
.app { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 22px 16px 40px;
}
.sidebar__brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}
.sidebar__logo {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--nst-elec));
  color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 13px; flex: 0 0 auto;
}
.sidebar__title { font-size: 15px; font-weight: 700; }
.sidebar__title small { display: block; font-weight: 500; color: var(--ink-faint); font-size: 11.5px; }

.toc { list-style: none; margin: 0; padding: 0; }
.toc a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 10px;
  color: var(--ink-soft); font-size: 14px; font-weight: 500;
  transition: background .15s, color .15s;
}
.toc a:hover { background: var(--surface-2); text-decoration: none; }
.toc a.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; }
.toc a .num {
  width: 22px; height: 22px; border-radius: 6px; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 12px;
  background: var(--surface-2); color: var(--ink-faint);
}
.toc a.active .num { background: var(--brand); color: #fff; }
.sidebar__back {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 18px; padding: 8px 11px; font-size: 13px;
  color: var(--ink-faint);
}
.sidebar__back:hover { color: var(--ink); text-decoration: none; }

/* Content */
.content { flex: 1 1 auto; min-width: 0; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 40px 28px 140px; }

/* Mobile top bar */
.topbar {
  display: none;
  position: sticky; top: 0; z-index: 40;
  align-items: center; gap: 12px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 10px 16px;
}
.topbar__title { font-weight: 700; font-size: 15px; flex: 1; }
.hamburger {
  width: 40px; height: 40px; border: 1px solid var(--line);
  background: var(--surface); border-radius: 10px;
  display: grid; place-items: center; cursor: pointer; flex: 0 0 auto;
}
.hamburger span, .hamburger span::before, .hamburger span::after {
  content: ""; display: block; width: 18px; height: 2px;
  background: var(--ink); border-radius: 2px; position: relative;
}
.hamburger span::before { position: absolute; top: -6px; }
.hamburger span::after { position: absolute; top: 6px; }
.scrim {
  display: none; position: fixed; inset: 0; z-index: 45;
  background: rgba(20,30,45,.42);
}

/* Bottom nav */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  padding: 8px 12px;
  gap: 8px;
}
.bn-btn {
  flex: 1; padding: 10px 4px; border-radius: 10px;
  font-family: var(--font-body); font-size: 13.5px; font-weight: 700;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-soft); cursor: pointer;
  text-align: center; transition: all .15s;
  text-decoration: none; display: flex; align-items: center; justify-content: center;
}
.bn-btn:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.bn-btn--brand { background: var(--brand); color: #fff; border-color: var(--brand); }

/* =========================================================
   TYPOGRAPHY BLOCKS
   ========================================================= */
.lesson-hero {
  background: linear-gradient(135deg, #0a4f48, #0e8c7e 55%, #2f6fed);
  color: #fff; border-radius: 20px;
  padding: 34px 30px; margin-bottom: 34px;
  box-shadow: var(--shadow);
}
.lesson-hero .kicker {
  font-family: var(--font-cute);
  font-size: 15px; opacity: .9; letter-spacing: .02em;
}
.lesson-hero h1 { color: #fff; font-size: clamp(22px, 3.4vw, 30px); margin: 6px 0 10px; }
.lesson-hero p { margin: 0; opacity: .92; font-size: 15px; }

.section { scroll-margin-top: 76px; margin: 46px 0; }
.section > h2 {
  font-size: clamp(19px, 2.4vw, 25px);
  padding-bottom: 12px; margin: 0 0 20px;
  border-bottom: 2px solid var(--line);
  display: flex; align-items: baseline; gap: 12px;
}
.section > h2 .sec-no {
  font-family: var(--font-cute);
  color: var(--brand); font-size: .7em; font-weight: 400;
}
.section h3 { font-size: 18px; margin: 26px 0 10px; }
.section h4 { font-size: 15.5px; margin: 18px 0 8px; color: var(--ink-soft); }
.section p { margin: 12px 0; }
.lead { font-size: 1.05em; color: var(--ink-soft); }

.oneline {
  font-family: var(--font-cute);
  font-size: 1.15em; color: var(--brand-dark);
  background: var(--brand-soft);
  border-radius: 12px; padding: 14px 18px; margin: 18px 0;
  display: flex; gap: 10px; align-items: flex-start;
  line-height: 1.55;
}
.oneline::before { content: "✎"; font-size: 1.1em; }

.pearl {
  font-family: var(--font-cute);
  font-size: 1.1em; color: #7a4f00;
  background: #fff8e6;
  border-left: 4px solid #f0b429;
  border-radius: 0 12px 12px 0;
  padding: 14px 18px; margin: 18px 0;
  line-height: 1.6;
}
.pearl::before { content: "💡 "; }

blockquote {
  margin: 16px 0; padding: 12px 18px;
  border-left: 4px solid var(--brand);
  background: var(--surface); border-radius: 0 10px 10px 0;
  color: var(--ink-soft); box-shadow: var(--shadow-sm);
}

ul.clean { list-style: none; padding-left: 0; margin: 12px 0; }
ul.clean li { padding: 5px 0 5px 26px; position: relative; }
ul.clean li::before {
  content: ""; position: absolute; left: 6px; top: 14px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--brand);
}

.ref { font-size: 12px; color: var(--ink-faint); font-style: normal; }
.ref-inline { font-size: 12px; color: var(--ink-faint); }

/* =========================================================
   CARDS
   ========================================================= */
.card {
  --accent: var(--key);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: var(--radius);
  padding: 18px 20px; margin: 20px 0;
  box-shadow: var(--shadow-sm);
}
.card__label {
  font-family: var(--font-cute);
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13.5px; letter-spacing: .04em;
  color: var(--accent); font-weight: 700; margin-bottom: 8px;
}
.card__label .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.card p:first-of-type { margin-top: 4px; }
.card p:last-child { margin-bottom: 0; }
.card--key   { --accent: var(--key); }
.card--pharm { --accent: var(--pharm); }
.card--nst   { --accent: var(--nst); }
.card--case  { --accent: var(--case); }
.card--caution { --accent: var(--caution); background: #fffaf9; }

/* =========================================================
   FIGURE wrapper
   ========================================================= */
.figure {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px;
  margin: 22px 0; box-shadow: var(--shadow-sm);
}
.figure__title {
  font-weight: 700; font-size: 15px; margin: 0 0 14px;
  display: flex; align-items: center; gap: 8px;
}
.figure__title::before { content: "▨"; color: var(--brand); font-size: 14px; }
.figure__cap { font-size: 13px; color: var(--ink-faint); margin-top: 12px; text-align: center; }

/* =========================================================
   FLOWCHART (세로 step)
   ========================================================= */
.flow { display: flex; flex-direction: column; align-items: stretch; gap: 0; }
.flow-step {
  display: flex; align-items: flex-start; gap: 14px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.flow-step__no {
  width: 32px; height: 32px; border-radius: 50%; flex: 0 0 auto;
  background: var(--brand); color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 15px;
}
.flow-step__body { flex: 1; }
.flow-step__body strong { display: block; font-size: 15px; margin-bottom: 2px; }
.flow-step__body p { margin: 4px 0 0; font-size: 14px; color: var(--ink-soft); }
.flow-arrow {
  text-align: center; font-size: 20px; color: var(--brand);
  padding: 4px 0; line-height: 1;
}
.flow-step--active { border-color: var(--brand); background: var(--brand-soft); }

/* 가로 분기 트리 */
.route-tree { display: grid; gap: 12px; }
.route-node {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 16px;
  font-size: 15px;
}
.route-node--question {
  background: linear-gradient(135deg, var(--brand-soft), #e8f4ff);
  border-color: var(--brand); font-weight: 700; text-align: center;
}
.route-node--oral { border-top: 3px solid var(--nst-protein); }
.route-node--en   { border-top: 3px solid var(--nst-energy); }
.route-node--pn   { border-top: 3px solid var(--nst-fluid); }
.route-branch {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}

/* =========================================================
   TEAM DIAGRAM (4-card grid)
   ========================================================= */
.team-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin: 16px 0;
}
.team-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px;
  box-shadow: var(--shadow-sm);
}
.team-card__icon { font-size: 26px; margin-bottom: 6px; }
.team-card__role { font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.team-card__desc { font-size: 13.5px; color: var(--ink-soft); line-height: 1.55; }
.team-card--doctor  { border-top: 3px solid #2f6fed; }
.team-card--nurse   { border-top: 3px solid #0f9d8e; }
.team-card--dietitian { border-top: 3px solid #e0872a; }
.team-card--pharm   { border-top: 3px solid #7c5cf0; }
.team-center {
  grid-column: 1 / -1; text-align: center;
  background: linear-gradient(135deg, #0e8c7e, #2f6fed);
  color: #fff; border-radius: 12px; padding: 16px;
  font-weight: 700; font-size: 16px;
}

/* =========================================================
   WHY NST 버튼 그룹
   ========================================================= */
.why-btns {
  display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0;
}
.why-btn {
  flex: 1 1 calc(50% - 5px); min-width: 120px; padding: 12px 14px;
  border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--surface); color: var(--ink);
  font-family: var(--font-body); font-size: 14.5px; font-weight: 700;
  cursor: pointer; transition: all .15s; text-align: center;
}
.why-btn:hover { border-color: var(--brand); background: var(--brand-soft); }
.why-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.why-panel { margin: 4px 0 12px; }

/* =========================================================
   ACCORDION
   ========================================================= */
.accordion { margin: 10px 0; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.accordion__btn {
  width: 100%; text-align: left; padding: 15px 18px;
  background: var(--surface); border: none; cursor: pointer;
  font-family: var(--font-body); font-size: 15px; font-weight: 700; color: var(--ink);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  transition: background .15s;
}
.accordion__btn:hover { background: var(--surface-2); }
.accordion__btn[aria-expanded="true"] { background: var(--brand-soft); color: var(--brand-dark); }
.accordion__ico { font-size: 13px; transition: transform .2s; flex: 0 0 auto; }
.accordion__btn[aria-expanded="true"] .accordion__ico { transform: rotate(180deg); }
.accordion__body { padding: 16px 18px; background: var(--surface); border-top: 1px solid var(--line); }
.accordion__body p:first-child { margin-top: 0; }
.accordion__body p:last-child { margin-bottom: 0; }

/* 렌즈 accordion (Pharmacist View) */
.lens-accordion { margin: 8px 0; }
.lens-accordion .accordion__btn { border-radius: 12px 12px 0 0; }
.lens-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--brand); color: #fff; font-size: 14px; flex: 0 0 auto;
}

/* =========================================================
   REVEAL BUTTON
   ========================================================= */
.reveal-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px; border-radius: 10px;
  border: 1.5px solid var(--brand); background: var(--brand-soft);
  color: var(--brand-dark); font-family: var(--font-body);
  font-size: 14.5px; font-weight: 700; cursor: pointer;
  transition: all .15s; margin: 12px 0;
}
.reveal-btn:hover { background: var(--brand); color: #fff; }
.reveal-panel {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 18px; margin: 8px 0 16px;
  animation: fadeIn .2s ease;
}
.reveal-panel p:first-child { margin-top: 0; }
.reveal-panel p:last-child { margin-bottom: 0; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* =========================================================
   GOAL BAR (목표 vs 실제)
   ========================================================= */
.goal-bars { display: grid; gap: 14px; margin: 18px 0; }
.goal-bar-row { display: grid; grid-template-columns: 60px 1fr 140px; align-items: center; gap: 12px; }
.goal-bar-label { font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.goal-bar {
  height: 22px; background: var(--surface-2); border-radius: 999px;
  overflow: hidden; border: 1px solid var(--line);
}
.goal-bar__fill {
  height: 100%; border-radius: 999px;
  width: var(--pct); transition: width .5s ease;
}
.goal-bar__fill--target { background: linear-gradient(90deg, var(--brand), #2f6fed); }
.goal-bar__fill--actual { background: linear-gradient(90deg, var(--nst-energy), #f5a623); }
.goal-bar-value { font-size: 13.5px; font-weight: 700; color: var(--ink-soft); text-align: right; }

/* =========================================================
   CHECKLIST
   ========================================================= */
.checklist { display: grid; gap: 16px; margin: 16px 0; }
.checklist__group {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden;
}
.checklist__title {
  background: var(--surface-2); padding: 10px 16px;
  font-weight: 700; font-size: 13px; letter-spacing: .06em;
  color: var(--ink-soft); border-bottom: 1px solid var(--line);
}
.check-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; font-size: 14.5px; cursor: pointer;
  border-bottom: 1px solid var(--line); transition: background .12s;
  min-height: 44px;
}
.check-item:last-child { border-bottom: none; }
.check-item:hover { background: var(--surface-2); }
.check-item input[type="checkbox"] {
  width: 18px; height: 18px; flex: 0 0 auto;
  accent-color: var(--brand); cursor: pointer;
}
.check-item.checked { color: var(--ink-faint); text-decoration: line-through; }
.checklist__progress {
  padding: 10px 16px; font-size: 13px; color: var(--ink-faint);
  display: flex; align-items: center; gap: 8px;
}
.checklist__progress-bar {
  flex: 1; height: 6px; background: var(--line); border-radius: 999px; overflow: hidden;
}
.checklist__progress-fill { height: 100%; background: var(--brand); border-radius: 999px; transition: width .3s; }

/* =========================================================
   PATIENT CARD
   ========================================================= */
.patient-card {
  background: var(--surface); border: 1.5px solid var(--brand);
  border-radius: var(--radius); padding: 20px;
  margin: 20px 0; box-shadow: var(--shadow);
}
.patient-card__header {
  display: flex; align-items: center; gap: 14px;
  padding-bottom: 14px; margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.patient-card__icon { font-size: 36px; flex: 0 0 auto; }
.patient-card__name { font-weight: 700; font-size: 17px; }
.patient-card__dx { font-size: 14px; color: var(--ink-soft); margin-top: 2px; }
.patient-card__body { display: grid; gap: 6px; }
.patient-card__row {
  display: flex; align-items: center; gap: 10px;
  font-size: 14.5px; padding: 4px 0;
  border-bottom: 1px solid var(--line);
}
.patient-card__row:last-child { border-bottom: none; }
.patient-card__row .label {
  min-width: 90px; font-weight: 700; font-size: 13px;
  color: var(--ink-soft); flex: 0 0 auto;
}
.patient-card__section { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.patient-card__section-title { font-weight: 700; font-size: 13px; color: var(--ink-faint); margin-bottom: 8px; letter-spacing: .06em; }

/* =========================================================
   LAB TABLE
   ========================================================= */
.table-wrap { overflow-x: auto; margin: 16px 0; border-radius: var(--radius); }
.lab-table {
  width: 100%; border-collapse: collapse; font-size: 14.5px;
  background: var(--surface); border-radius: var(--radius); overflow: hidden;
}
.lab-table th {
  background: var(--surface-2); padding: 10px 14px;
  text-align: left; font-weight: 700; font-size: 13px;
  color: var(--ink-soft); border-bottom: 2px solid var(--line);
}
.lab-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.lab-table tr:last-child td { border-bottom: none; }
.lab-table tr:hover td { background: var(--surface-2); }
.lab-abnormal td { color: var(--nst-alert); font-weight: 700; }
.lab-low td:nth-child(2) { color: var(--nst-alert); }
.lab-high td:nth-child(2) { color: var(--nst-energy); }

/* =========================================================
   LOCKED FEATURE
   ========================================================= */
.locked-grid { display: grid; gap: 8px; margin: 16px 0; }
.locked-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--surface); border: 1px dashed var(--line);
  border-radius: 10px; padding: 12px 16px;
  opacity: .65;
}
.locked-card__title { font-size: 14.5px; font-weight: 700; color: var(--ink-soft); }
.locked-card__badge {
  font-size: 12.5px; font-weight: 700; color: var(--ink-faint);
  background: var(--surface-2); padding: 4px 10px; border-radius: 999px;
  white-space: nowrap;
}

/* =========================================================
   TWOPANEL / COMPARISON
   ========================================================= */
.twopanel { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 16px 0; }
.panel {
  border-radius: 12px; padding: 16px; border: 1px solid var(--line);
}
.panel--wrong { background: var(--nst-alert-soft); border-color: var(--nst-alert); }
.panel--right { background: var(--brand-soft); border-color: var(--brand); }
.panel h5 { margin: 0 0 10px; font-size: 14px; }

/* =========================================================
   NST LOOP (원형 다이어그램 — CSS 구현)
   ========================================================= */
.nst-loop {
  display: flex; flex-direction: column; align-items: center; gap: 0;
  max-width: 320px; margin: 20px auto;
}
.loop-item {
  display: flex; flex-direction: column; align-items: center; gap: 0;
  width: 100%;
}
.loop-box {
  width: 100%; background: var(--surface); border: 1.5px solid var(--brand);
  border-radius: 12px; padding: 12px 18px; text-align: center;
  font-weight: 700; font-size: 15px; box-shadow: var(--shadow-sm);
}
.loop-box--patient {
  background: linear-gradient(135deg, var(--brand), #2f6fed);
  color: #fff; border-color: transparent;
}
.loop-arrow-down { font-size: 22px; color: var(--brand); line-height: 1; padding: 4px 0; }
.loop-arrow-back {
  align-self: flex-end; font-size: 13px; color: var(--brand-dark);
  font-weight: 700; padding: 6px 10px 6px 0;
}

/* =========================================================
   STEP COMPARISON (잘못된 사고 vs NST 사고)
   ========================================================= */
.thinking-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 16px 0; }
.thinking-box {
  border-radius: 12px; padding: 16px; border: 1px solid var(--line);
}
.thinking-box--wrong { background: var(--nst-alert-soft); border-color: var(--nst-alert); }
.thinking-box--nst   { background: var(--brand-soft); border-color: var(--brand); }
.thinking-box__title {
  font-weight: 700; font-size: 13.5px; margin-bottom: 10px;
  padding-bottom: 8px; border-bottom: 1px solid rgba(0,0,0,.08);
}
.thinking-box--wrong .thinking-box__title { color: var(--nst-alert); }
.thinking-box--nst   .thinking-box__title { color: var(--brand-dark); }
.thinking-step { font-size: 14px; padding: 5px 0 5px 20px; position: relative; }
.thinking-step::before {
  content: "▸"; position: absolute; left: 0; color: var(--brand);
}
.thinking-box--wrong .thinking-step::before { color: var(--nst-alert); }

/* =========================================================
   INFO CHIPS
   ========================================================= */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 700; white-space: nowrap;
}
.chip .sw { width: 9px; height: 9px; border-radius: 50%; }
.chip--energy  { background: var(--nst-energy-soft); color: var(--nst-energy); }
.chip--energy .sw  { background: var(--nst-energy); }
.chip--protein { background: var(--nst-protein-soft); color: var(--nst-protein); }
.chip--protein .sw { background: var(--nst-protein); }
.chip--fluid   { background: var(--nst-fluid-soft); color: var(--nst-fluid); }
.chip--fluid .sw   { background: var(--nst-fluid); }
.chip--elec    { background: var(--nst-elec-soft); color: var(--nst-elec); }
.chip--elec .sw    { background: var(--nst-elec); }
.chip--alert   { background: var(--nst-alert-soft); color: var(--nst-alert); }
.chip--alert .sw   { background: var(--nst-alert); }
.chip--brand   { background: var(--brand-soft); color: var(--brand-dark); }
.chip--brand .sw   { background: var(--brand); }
.legend { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }

/* =========================================================
   HUB PAGE
   ========================================================= */
.hub { max-width: 900px; margin: 0 auto; padding: 32px 24px 80px; }
.hub__hero {
  background: linear-gradient(135deg, #0a4f48, #0e8c7e 55%, #2f6fed);
  color: #fff; border-radius: 20px; padding: 36px 32px; margin-bottom: 28px;
  box-shadow: var(--shadow);
}
.hub__hero .badge {
  display: inline-block; background: rgba(255,255,255,.22);
  border-radius: 999px; padding: 4px 14px; font-size: 13px;
  font-weight: 700; letter-spacing: .04em; margin-bottom: 14px;
}
.hub__hero h1 { color: #fff; font-size: clamp(24px, 4vw, 34px); margin: 0 0 12px; }
.hub__hero p  { margin: 0; opacity: .9; font-size: 15.5px; line-height: 1.6; }

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.lesson-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px;
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: var(--shadow-sm); transition: box-shadow .2s, transform .2s;
  text-decoration: none; color: var(--ink);
}
.lesson-card:hover { box-shadow: var(--shadow); transform: translateY(-3px); text-decoration: none; }
.lesson-card.disabled { opacity: .55; pointer-events: none; }
.lc-no {
  font-family: var(--font-cute); font-size: 13px; color: var(--brand);
  font-weight: 400;
}
.lesson-card h3 { margin: 0; font-size: 16px; line-height: 1.35; }
.lesson-card p { margin: 0; font-size: 13.5px; color: var(--ink-soft); line-height: 1.5; flex: 1; }
.lc-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.lc-tag {
  font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-dark);
}
.lc-status { font-size: 13.5px; font-weight: 700; color: var(--brand); margin-top: 4px; }

/* =========================================================
   NST 7-STEP SUMMARY (1강 마지막 카드)
   ========================================================= */
.step7 { display: grid; gap: 0; margin: 16px 0; }
.step7-item {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 16px; background: var(--surface);
  border: 1px solid var(--line); border-top: none;
}
.step7-item:first-child { border-top: 1px solid var(--line); border-radius: 12px 12px 0 0; }
.step7-item:last-child  { border-radius: 0 0 12px 12px; }
.step7-no {
  width: 28px; height: 28px; border-radius: 50%; flex: 0 0 auto;
  background: var(--brand); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.step7-body strong { display: block; font-size: 15px; margin-bottom: 2px; }
.step7-body p { margin: 0; font-size: 13.5px; color: var(--ink-soft); }

/* =========================================================
   CHEAT SHEET
   ========================================================= */
.cheatsheet {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px; margin: 16px 0;
}
.cs-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.cs-card__no {
  width: 24px; height: 24px; border-radius: 7px; margin-bottom: 8px;
  background: var(--brand); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.cs-card__title { font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.cs-card ul { margin: 0; padding-left: 16px; font-size: 13px; color: var(--ink-soft); }
.cs-card ul li { margin: 2px 0; }

/* =========================================================
   CALCULATOR (BMI, Weight Loss 등)
   ========================================================= */
.calculator {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; margin: 16px 0;
  box-shadow: var(--shadow-sm);
}
.calculator__title {
  font-weight: 700; font-size: 15px; margin: 0 0 16px;
  display: flex; align-items: center; gap: 8px; color: var(--brand-dark);
}
.calculator__title::before { content: "🧮"; font-size: 16px; }
.calc-row {
  display: flex; align-items: center; gap: 10px; margin: 10px 0;
}
.calc-row label { min-width: 110px; font-weight: 700; font-size: 14px; flex: 0 0 auto; }
.calc-input {
  flex: 1; padding: 11px 14px; border-radius: 10px;
  border: 1.5px solid var(--line); font-family: var(--font-body);
  font-size: 16px; font-weight: 700; background: var(--surface);
  color: var(--ink); transition: border-color .15s;
  -webkit-appearance: none;
}
.calc-input:focus { outline: none; border-color: var(--brand); }
.calc-unit { font-size: 14px; color: var(--ink-faint); white-space: nowrap; flex: 0 0 auto; }
.calc-select {
  flex: 1; padding: 11px 14px; border-radius: 10px;
  border: 1.5px solid var(--line); font-family: var(--font-body);
  font-size: 14.5px; background: var(--surface); color: var(--ink);
}
.calc-btn {
  width: 100%; padding: 13px; border-radius: 12px;
  background: var(--brand); color: #fff; border: none;
  font-family: var(--font-body); font-size: 15px; font-weight: 700;
  cursor: pointer; margin-top: 14px; transition: background .15s;
}
.calc-btn:hover { background: var(--brand-dark); }
.calc-result {
  margin-top: 14px; padding: 16px 18px;
  background: var(--brand-soft); border-radius: 12px;
  border: 1px solid var(--brand);
}
.calc-result__main { font-size: 22px; font-weight: 700; color: var(--brand-dark); margin-bottom: 6px; }
.calc-result__note { font-size: 13.5px; color: var(--ink-soft); line-height: 1.5; }
.calc-result--warn { background: var(--nst-alert-soft); border-color: var(--nst-alert); }
.calc-result--warn .calc-result__main { color: var(--nst-alert); }
.calc-result--caution { background: var(--nst-energy-soft); border-color: var(--nst-energy); }
.calc-result--caution .calc-result__main { color: var(--nst-energy); }

/* =========================================================
   TIMELINE
   ========================================================= */
.timeline {
  display: flex; flex-direction: column; margin: 16px 0;
  position: relative; padding-left: 34px;
}
.timeline::before {
  content: ""; position: absolute; left: 13px; top: 8px; bottom: 8px;
  width: 2px; background: var(--line);
}
.tl-item {
  position: relative; padding: 8px 0 14px 0;
}
.tl-item::before {
  content: ""; position: absolute; left: -23px; top: 13px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--brand); box-shadow: 0 0 0 3px var(--bg);
}
.tl-item--alert::before { background: var(--nst-alert); }
.tl-item--warn::before  { background: var(--nst-energy); }
.tl-item--ok::before    { background: var(--nst-protein); }
.tl-item__time { font-size: 12px; font-weight: 700; color: var(--ink-faint); margin-bottom: 3px; letter-spacing: .04em; }
.tl-item__body { font-size: 14.5px; }

/* =========================================================
   FUNNEL (Screening → Assessment → Diagnosis)
   ========================================================= */
.funnel { display: flex; flex-direction: column; align-items: center; gap: 0; margin: 20px auto; max-width: 340px; }
.funnel-top {
  font-weight: 700; font-size: 14px; padding: 10px 24px;
  background: var(--surface-2); border-radius: 12px;
  border: 1px solid var(--line); margin-bottom: 6px;
}
.funnel-step {
  border-radius: 12px; padding: 14px 20px; text-align: center;
  border: 1.5px solid; transition: box-shadow .15s;
}
.funnel-step--1 { width: 100%; background: var(--brand-soft); border-color: var(--brand); }
.funnel-step--2 { width: 84%; background: var(--nst-protein-soft); border-color: var(--nst-protein); margin-top: 0; }
.funnel-step--3 { width: 68%; background: var(--nst-elec-soft); border-color: var(--nst-elec); }
.funnel-step__label { font-weight: 700; font-size: 15.5px; }
.funnel-step--1 .funnel-step__label { color: var(--brand-dark); }
.funnel-step--2 .funnel-step__label { color: var(--nst-protein); }
.funnel-step--3 .funnel-step__label { color: var(--nst-elec); }
.funnel-step__q { font-size: 13px; color: var(--ink-soft); margin-top: 3px; }
.funnel-arrow { font-size: 14px; font-weight: 700; color: var(--ink-faint); padding: 5px 0; line-height: 1; }

/* =========================================================
   GLIM CHECKER
   ========================================================= */
.glim-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }
.glim-col { background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; padding: 16px; }
.glim-col--phenotypic { border-top: 3px solid var(--nst-protein); }
.glim-col--etiologic  { border-top: 3px solid var(--nst-fluid); }
.glim-col__title { font-weight: 700; font-size: 13.5px; margin-bottom: 12px; }
.glim-col--phenotypic .glim-col__title { color: var(--nst-protein); }
.glim-col--etiologic  .glim-col__title { color: var(--nst-fluid); }
.glim-check {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--line);
  font-size: 14px; cursor: pointer; min-height: 44px;
}
.glim-check:last-child { border-bottom: none; }
.glim-check input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--brand); flex: 0 0 auto; margin-top: 2px; }
.glim-result {
  margin-top: 14px; padding: 16px 18px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line);
  text-align: center; font-weight: 700; font-size: 15px;
  transition: all .3s;
}
.glim-result--positive { background: var(--nst-alert-soft); border-color: var(--nst-alert); color: var(--nst-alert); }
.glim-result--partial  { background: var(--nst-energy-soft); border-color: var(--nst-energy); color: var(--nst-energy); }

/* =========================================================
   NUTRITION SNAPSHOT CARD
   ========================================================= */
.snapshot-card {
  background: linear-gradient(135deg, #0a4f48 0%, #0e8c7e 55%, #1a5fa8 100%);
  color: #fff; border-radius: var(--radius); padding: 22px; margin: 16px 0;
  box-shadow: var(--shadow);
}
.snapshot-card__title {
  font-size: 13px; font-weight: 700; letter-spacing: .1em;
  opacity: .82; margin-bottom: 14px;
}
.snapshot-row {
  display: flex; align-items: baseline; gap: 12px;
  padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.15);
  font-size: 14.5px;
}
.snapshot-row:last-of-type { border-bottom: none; }
.snapshot-row .label { min-width: 100px; font-weight: 700; font-size: 12.5px; opacity: .78; flex: 0 0 auto; }
.snapshot-alert {
  margin-top: 14px; padding: 11px 14px;
  background: rgba(255,255,255,.16); border-radius: 10px;
  font-size: 13.5px; font-weight: 700;
}

/* =========================================================
   W-I-D-B FRAMEWORK
   ========================================================= */
.widb { display: grid; gap: 0; margin: 16px 0; }
.widb-item {
  display: flex; gap: 14px; padding: 16px;
  background: var(--surface); border: 1px solid var(--line); border-top: none;
}
.widb-item:first-child { border-top: 1px solid var(--line); border-radius: 12px 12px 0 0; }
.widb-item:last-child  { border-radius: 0 0 12px 12px; }
.widb-badge {
  width: 36px; height: 36px; border-radius: 10px; flex: 0 0 auto;
  display: grid; place-items: center; font-family: var(--font-cute);
  font-size: 18px; font-weight: 700; color: #fff;
}
.widb-badge--w { background: var(--nst-energy); }
.widb-badge--i { background: var(--nst-protein); }
.widb-badge--d { background: var(--nst-fluid); }
.widb-badge--b { background: var(--nst-elec); }
.widb-body strong { display: block; font-size: 15px; margin-bottom: 4px; }
.widb-body ul { margin: 0; padding-left: 18px; font-size: 13.5px; color: var(--ink-soft); }

/* =========================================================
   NST PATIENT ANALYZER (강의별 해제 표시)
   ========================================================= */
.analyzer { display: grid; gap: 6px; margin: 16px 0; }
.analyzer-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 14.5px;
}
.analyzer-item--unlocked {
  border-color: var(--brand); background: var(--brand-soft);
}
.analyzer-icon { font-size: 16px; flex: 0 0 auto; }
.analyzer-title { flex: 1; font-weight: 700; }
.analyzer-badge {
  font-size: 12px; font-weight: 700; padding: 3px 10px;
  border-radius: 999px; white-space: nowrap;
}
.analyzer-badge.unlocked { background: var(--brand); color: #fff; }
.analyzer-badge.locked { background: var(--surface-2); color: var(--ink-faint); }

/* =========================================================
   COMPARE CARDS (환자 비교 등)
   ========================================================= */
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }
.compare-card {
  background: var(--surface); border: 1.5px solid var(--line);
  border-radius: 12px; padding: 16px;
}
.compare-card__label { font-size: 12.5px; font-weight: 700; color: var(--ink-faint); margin-bottom: 8px; letter-spacing: .06em; }
.compare-card__main  { font-size: 22px; font-weight: 700; color: var(--brand-dark); margin-bottom: 6px; }
.compare-card__sub   { font-size: 13.5px; color: var(--ink-soft); }
.compare-card--concern { border-color: var(--nst-alert); background: var(--nst-alert-soft); }
.compare-card--concern .compare-card__main { color: var(--nst-alert); }

/* =========================================================
   LESSON 03 — Energy · Protein · Fluid Calculators
   ========================================================= */

/* EPF 3-pillar cards */
.epf-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.epf-card { background: var(--surface-2); border-radius: 12px; padding: 14px 10px; text-align: center; border-top: 3px solid transparent; }
.epf-card--energy  { border-top-color: var(--nst-energy); }
.epf-card--protein { border-top-color: var(--nst-protein); }
.epf-card--fluid   { border-top-color: var(--nst-fluid); }
.epf-card__icon  { font-size: 22px; line-height: 1; }
.epf-card__label { font-weight: 700; font-size: 11px; letter-spacing: .07em; margin: 6px 0 2px; text-transform: uppercase; }
.epf-card__unit  { font-size: 11px; color: var(--ink-faint); }

/* Target vs Actual grid */
.tva-grid { border-radius: 12px; overflow: hidden; border: 1px solid var(--line); margin: 14px 0; }
.tva-grid__header { display: grid; grid-template-columns: auto 1fr 1fr; background: var(--surface-2); }
.tva-grid__th { padding: 10px 14px; font-weight: 700; font-size: 12.5px; letter-spacing: .05em; }
.tva-grid__th--label { color: var(--ink-faint); border-right: 1px solid var(--line); }
.tva-grid__th--target { color: var(--brand); border-right: 1px solid var(--line); }
.tva-grid__th--actual { color: var(--nst-energy); }
.tva-grid__row { display: grid; grid-template-columns: auto 1fr 1fr; border-top: 1px solid var(--line); }
.tva-grid__td { padding: 10px 14px; font-size: 14px; }
.tva-grid__td--label { font-weight: 700; color: var(--ink-faint); font-size: 13px; border-right: 1px solid var(--line); white-space: nowrap; }
.tva-grid__td--target { border-right: 1px solid var(--line); }
.tva-grid__td--q { color: var(--ink-faint); font-style: italic; }

/* Energy range display */
.range-display { background: var(--surface-2); border-radius: 12px; padding: 16px 16px 20px; margin: 16px 0; }
.range-display__title { font-size: 13px; font-weight: 700; color: var(--ink-faint); margin-bottom: 14px; letter-spacing: .05em; text-transform: uppercase; }
.range-pts { display: flex; justify-content: space-between; align-items: flex-end; gap: 4px; }
.range-pt { flex: 1; text-align: center; }
.range-pt__factor { font-size: 13px; color: var(--ink-soft); margin-bottom: 4px; }
.range-pt__bar { background: var(--brand); border-radius: 4px 4px 0 0; margin: 0 auto; width: 60%; transition: height .35s ease; }
.range-pt__bar--lo  { height: 36px; opacity: .5; }
.range-pt__bar--mid { height: 54px; opacity: .75; }
.range-pt__bar--hi  { height: 72px; }
.range-pt__kcal { font-weight: 700; font-size: 14px; color: var(--brand-dark); margin-top: 4px; }
.range-track-row { display: flex; align-items: center; gap: 0; margin: 4px 0 8px; }
.range-track-line { flex: 1; height: 2px; background: var(--brand); opacity: .3; }

/* Dual gauge (Energy + Protein achievement) */
.dual-gauge { display: flex; flex-direction: column; gap: 12px; margin: 16px 0; }
.gauge-row { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; }
.gauge-row__header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 2px; }
.gauge-row__label { font-weight: 700; font-size: 14px; }
.gauge-row__pct   { font-weight: 700; font-size: 18px; }
.gauge-row__pct--warn { color: var(--nst-alert); }
.gauge-row__sub   { font-size: 12px; color: var(--ink-faint); margin-bottom: 8px; }
.gauge-bar  { height: 10px; background: var(--line); border-radius: 5px; overflow: hidden; }
.gauge-fill { height: 100%; border-radius: 5px; transition: width .4s ease; }
.gauge-fill--energy  { background: var(--nst-energy); }
.gauge-fill--protein { background: var(--nst-protein); }

/* Req stages: Estimated → Prescribed → Delivered */
.req-stages { display: flex; flex-direction: column; gap: 0; margin: 16px 0; }
.req-stage { display: grid; grid-template-columns: 90px 80px 1fr; align-items: center; gap: 12px; padding: 12px 16px; background: var(--surface-2); }
.req-stage:first-child { border-radius: 12px 12px 0 0; }
.req-stage:last-child  { border-radius: 0 0 12px 12px; }
.req-stage + .req-stage { border-top: 1px solid var(--line); }
.req-stage__label { font-size: 11.5px; font-weight: 700; color: var(--ink-faint); letter-spacing: .04em; text-transform: uppercase; }
.req-stage__val   { font-weight: 700; font-size: 15px; }
.req-stage__bar   { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.req-stage__fill  { height: 100%; border-radius: 4px; }
.req-stage--estimated .req-stage__fill  { background: var(--brand); width: 100%; }
.req-stage--prescribed .req-stage__fill { background: var(--nst-energy); }
.req-stage--delivered  .req-stage__fill { background: var(--nst-protein); }

/* Weight reliability checklist */
.weight-check { background: var(--nst-alert-soft); border: 1px solid var(--nst-alert); border-radius: 12px; padding: 14px 16px; margin: 14px 0; }
.weight-check__title { font-size: 13px; font-weight: 700; color: var(--nst-alert); margin-bottom: 10px; letter-spacing: .04em; }
.weight-check ul { margin: 0; padding: 0; list-style: none; }
.weight-check li { padding: 5px 0 5px 22px; position: relative; font-size: 14px; border-bottom: 1px dashed rgba(229,72,77,.2); }
.weight-check li:last-child { border-bottom: none; }
.weight-check li::before { content: "□"; position: absolute; left: 0; color: var(--nst-alert); }

/* Speed drill */
.speed-drill { display: flex; flex-direction: column; gap: 14px; margin: 16px 0; }
.drill-q { background: var(--surface-2); border-radius: 10px; padding: 14px 16px; }
.drill-q__no  { font-size: 12px; font-weight: 700; color: var(--ink-faint); margin-bottom: 6px; letter-spacing: .06em; }
.drill-q__prompt { font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.drill-q__formula { text-align: center; font-size: 15px; color: var(--ink-soft); margin: 8px 0; padding: 8px; background: var(--surface); border-radius: 6px; }
.drill-q__btn { background: transparent; border: 1px solid var(--line); border-radius: 6px; padding: 6px 14px; font-size: 13px; cursor: pointer; color: var(--ink-soft); margin-top: 4px; }
.drill-q__answer { display: none; background: var(--brand-soft); border-radius: 6px; padding: 10px 14px; margin-top: 8px; font-weight: 700; font-size: 16px; color: var(--brand-dark); text-align: center; }
.drill-q__answer.show { display: block; }

/* =========================================================
   RESPONSIVE — 모바일 860px 기준
   ========================================================= */
@media (max-width: 860px) {
  .topbar   { display: flex; }
  .bottom-nav { display: flex; }

  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; z-index: 50;
    transform: translateX(-100%); transition: transform .25s ease;
    box-shadow: 4px 0 24px rgba(20,40,70,.14);
  }
  .sidebar.open { transform: none; }
  .scrim.show { display: block; }

  .wrap { padding: 20px 16px 120px; }

  .twopanel   { grid-template-columns: 1fr; }
  .team-grid  { grid-template-columns: 1fr 1fr; }
  .req-stage  { grid-template-columns: 80px 70px 1fr; }
  .route-branch { grid-template-columns: 1fr; }
  .thinking-compare { grid-template-columns: 1fr; }
  .goal-bar-row { grid-template-columns: 50px 1fr 110px; }
}

@media (max-width: 480px) {
  .team-grid  { grid-template-columns: 1fr; }
  .epf-cards  { grid-template-columns: 1fr 1fr 1fr; }
  .cheatsheet { grid-template-columns: 1fr; }
  .goal-bar-row { grid-template-columns: 50px 1fr; }
  .goal-bar-value { display: none; }
  .lesson-grid { grid-template-columns: 1fr; }
}
