/* =========================================
   서리단내과 환자 안내문 공유 디자인 시스템
   hpylori에서 추출 + Gemini 컨설팅 반영
   ========================================= */

:root {
  --brand: #f26522;
  --brand2: #ff8a4a;
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --ok: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --shadow: 0 10px 22px rgba(2,6,23,.10);
  --radius: 14px;
  --radiusSm: 10px;
  --max: 760px;
  --safeB: env(safe-area-inset-bottom);
}

/* === Reset === */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: radial-gradient(900px 340px at 20% 0%, rgba(242, 101, 34, .10), transparent 60%),
              radial-gradient(900px 340px at 90% 10%, rgba(14, 165, 233, .10), transparent 55%),
              var(--bg);
  color: var(--text);
  padding-bottom: calc(62px + var(--safeB));
}
a { color: inherit; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 16px 14px 0; }

/* === Topbar === */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(248, 250, 252, .86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(226, 232, 240, .75);
}
.topbar-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.logoImg {
  height: 34px;
  width: auto;
  display: block;
  object-fit: contain;
}
.brand-title {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.brand-title strong {
  font-size: 13px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-title span {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brandRight {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.8);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: #9a3412;
  flex: 0 0 auto;
}
.chip-dot {
  width: 8px; height: 8px;
  border-radius: 999px;
  background: var(--brand);
  box-shadow: 0 0 0 4px rgba(242,101,34,.16);
}

/* === Hero === */
.hero {
  padding: 14px 0 6px;
  position: relative;
}
h1 {
  font-size: clamp(20px, 4.4vw, 30px);
  letter-spacing: -0.02em;
  margin-top: 10px;
}
.subtitle {
  margin-top: 6px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}
.pillrow {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.85);
  font-size: 13px;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.pill b { font-weight: 900; }
.pill .k {
  width: 18px; height: 18px;
  border-radius: 6px;
  display: grid; place-items: center;
  color: white;
  background: linear-gradient(135deg, var(--brand), var(--brand2));
  font-size: 12px;
  font-weight: 900;
}

/* === Key Summary (신규) === */
.key-summary {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(242, 101, 34, .25);
  background: linear-gradient(135deg, rgba(242,101,34,.08), rgba(255,255,255,.95));
  border-radius: var(--radius);
}
.key-summary strong {
  display: block;
  font-size: 15px;
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}
.key-summary ul {
  list-style: none;
  display: grid;
  gap: 8px;
}
.key-summary li {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 8px;
  align-items: start;
  font-size: 15px;
  line-height: 1.5;
  font-weight: 600;
}
.key-summary li::before {
  content: counter(ks);
  counter-increment: ks;
  width: 22px; height: 22px;
  border-radius: 7px;
  display: grid; place-items: center;
  font-size: 12px;
  font-weight: 900;
  color: white;
  background: linear-gradient(135deg, var(--brand), var(--brand2));
}
.key-summary ul { counter-reset: ks; }

/* === Grid / Card === */
.grid {
  margin-top: 14px;
  display: grid;
  gap: 12px;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  overflow: hidden;
}
.card-inner { padding: 14px; }
.card-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.card-title h2 {
  font-size: 16px;
  letter-spacing: -0.01em;
}
.badge {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--muted);
  flex: 0 0 auto;
}
.badge.ok { background: #f0fdf4; color: #065f46; border-color: #bbf7d0; }
.badge.warn { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.badge.danger { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.text { font-size: 16px; line-height: 1.7; color: #0f172a; }
.muted { color: var(--muted); }

/* === Callout === */
.callout {
  border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(242,101,34,.10), rgba(255,255,255,1));
  border-radius: var(--radiusSm);
  padding: 12px;
  margin-top: 10px;
}
.callout strong { display: block; margin-bottom: 6px; }

/* === List === */
.list {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}
.li {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}
.li .dot {
  width: 18px; height: 18px;
  border-radius: 6px;
  display: grid; place-items: center;
  font-size: 12px;
  font-weight: 900;
  color: white;
  background: #94a3b8;
}
.li.ok .dot { background: var(--ok); }
.li.warn .dot { background: var(--warn); }
.li.danger .dot { background: var(--danger); }

/* === Reveal Animations === */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s cubic-bezier(0.2, 0.8, 0.2, 1),
              transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: opacity, transform;
}
.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* === Roadmap === */
.roadmap {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin: 20px 0 10px;
  position: relative;
  padding: 0 10px;
}
.roadmap::before {
  content: "";
  position: absolute;
  top: 20px;
  left: 40px;
  right: 40px;
  height: 2px;
  background: var(--border);
  z-index: 0;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 1.2s cubic-bezier(0.4, 0, 0.2, 1);
  transition-delay: 0.3s;
}
.roadmap.active::before {
  transform: scaleX(1);
}
.step {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 33.33%;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.roadmap.active .step:nth-child(1) { transition-delay: 0.1s; opacity: 1; transform: scale(1); }
.roadmap.active .step:nth-child(2) { transition-delay: 0.6s; opacity: 1; transform: scale(1); }
.roadmap.active .step:nth-child(3) { transition-delay: 1.1s; opacity: 1; transform: scale(1); }
.step-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--card);
  border: 2px solid var(--border);
  display: grid;
  place-items: center;
  margin-bottom: 8px;
  transition: all 0.3s ease;
}
.step.active .step-icon {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
  box-shadow: 0 0 0 4px rgba(242,101,34,.15);
}
.step-title {
  font-size: 13px;
  font-weight: 900;
  color: var(--text);
  word-break: keep-all;
}
.step-desc {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  word-break: keep-all;
}

/* === O/X Grid === */
.ox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}
@media (max-width: 400px) {
  .ox-grid { grid-template-columns: 1fr; }
}
.ox-card {
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
}
.ox-card.do {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}
.ox-card.dont {
  background: #fef2f2;
  border: 1px solid #fecaca;
}
.ox-badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 14px;
}
.do .ox-badge { background: var(--ok); color: white; }
.dont .ox-badge { background: var(--danger); color: white; }
.ox-text {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
}

/* === Timeline === */
.time-flow {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 15px 0;
  padding-left: 5px;
}
.time-item {
  display: grid;
  grid-template-columns: 75px 1fr;
  gap: 15px;
  position: relative;
  padding-bottom: 20px;
}
.time-item::before {
  content: "";
  position: absolute;
  top: 24px;
  left: 89px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.time-item:last-child::before { display: none; }
.time-label {
  font-size: 12px;
  font-weight: 900;
  color: var(--brand);
  text-align: right;
  padding-top: 4px;
}
.time-content {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 15px;
  line-height: 1.6;
}
.time-dot {
  position: absolute;
  left: 85px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  border: 2px solid white;
  z-index: 1;
}
.time-item.active .time-dot { background: var(--brand); }

/* === Info Grid === */
.infoGrid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
@media (max-width: 520px) {
  .infoGrid { grid-template-columns: 1fr; }
}
.infoCard {
  border: 1px solid var(--border);
  background: rgba(255,255,255,.9);
  border-radius: 14px;
  padding: 12px;
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 10px;
  align-items: center;
}
.infoIcon {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 20px;
}
.infoIcon svg { width: 22px; height: 22px; }
.infoTitle {
  font-weight: 900;
  letter-spacing: -0.01em;
  font-size: 14px;
  line-height: 1.2;
}
.infoDesc {
  margin-top: 3px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}
.infoGrid4 {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (max-width: 520px) {
  .infoGrid4 { grid-template-columns: 1fr; }
}
.infoCard.compact {
  grid-template-columns: 34px 1fr;
  padding: 10px;
  border-radius: 12px;
}
.infoIcon.compact {
  width: 34px;
  height: 34px;
  border-radius: 12px;
}
.infoIcon.compact svg { width: 20px; height: 20px; }
.infoCard.warn {
  background: #fffbeb;
  border-color: #fde68a;
}
.infoIcon.warn {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

/* === Accordion === */
details {
  border-top: 1px solid var(--border);
}
details:first-of-type { border-top: none; }
summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 900;
  font-size: 15px;
  letter-spacing: -0.01em;
}
summary::-webkit-details-marker { display: none; }
.chev {
  width: 26px; height: 26px;
  border-radius: 10px;
  border: 1px solid var(--border);
  display: grid; place-items: center;
  background: #fff;
  flex: 0 0 auto;
  transition: transform .2s ease;
}
details[open] .chev { transform: rotate(180deg); }
.panel {
  padding: 0 14px 14px;
  color: #0f172a;
  font-size: 15px;
  line-height: 1.7;
}
.qa {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
}
.qa .qTitle { display: block; margin-bottom: 4px; }
.qa b:not(.qTitle),
.qa strong:not(.qTitle) {
  display: inline !important;
  white-space: normal;
}
.bullets {
  margin: 8px 0 0 1.1rem;
  padding: 0;
}
.bullets li {
  margin: 6px 0;
}
.bullets li small {
  color: var(--muted);
}
.note {
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

/* === Disclaimer (신규) === */
.disclaimer {
  margin-top: 16px;
  padding: 12px;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius);
  background: rgba(248,250,252,.8);
}
.disclaimer strong {
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
  color: var(--muted);
}
.disclaimer p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

/* === Bottom Bar === */
.bottomBar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  padding: 10px 12px calc(10px + var(--safeB));
  background: rgba(255,255,255,.90);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(226, 232, 240, .85);
  z-index: 60;
}
.bottomInner {
  max-width: var(--max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.btn {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--border);
  background: #fff;
  color: #0f172a;
  border-radius: 14px;
  padding: 12px 12px;
  font-weight: 900;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.btnPrimary {
  border-color: rgba(242,101,34,.25);
  background: linear-gradient(135deg, var(--brand), var(--brand2));
  color: white;
  box-shadow: 0 16px 26px rgba(242,101,34,.18);
}
.btnDanger {
  border-color: rgba(239,68,68,.25);
  background: #fff;
  color: #991b1b;
}
.btn:active { transform: translateY(1px); }

/* === Footer === */
.footer {
  padding: 6px 0 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}
.footer .smallCard {
  margin-top: 10px;
  padding: 12px;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  background: rgba(255,255,255,.7);
}
.kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  padding: 1px 6px;
  border: 1px solid #cbd5e1;
  border-bottom-width: 2px;
  border-radius: 6px;
  background: #fff;
  color: #334155;
}

/* === Print === */
@media print {
  .topbar, .bottomBar { display: none !important; }
  body {
    background: white !important;
    padding-bottom: 0 !important;
  }
  .card {
    box-shadow: none !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
  .roadmap .step {
    opacity: 1 !important;
    transform: scale(1) !important;
  }
  .roadmap::before {
    transform: scaleX(1) !important;
  }
  .key-summary {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  h1 { font-size: 22px !important; }
  .text { font-size: 14px !important; }
}
