/* ---------- Original design system ---------- */
:root {
  --bg: #f4eee3;          /* warm cream */
  --surface: #fffdf8;     /* warm white */
  --surface-2: #efe6d6;   /* sand */
  --ink: #211c15;         /* warm near-black */
  --muted: #7c7163;
  --line: #e7dccb;
  --accent: #b96b3c;      /* warm clay */
  --accent-dark: #8f4f29;
  --accent-soft: #f1e3d3;
  --btn: #221d16;         /* charcoal buttons */
  --btn-hover: #3b3127;
  --warn: #b4452f;
  --amber: #9a7415;
  --shadow: 0 6px 24px rgba(70, 50, 25, .08);
  --shadow-lg: 0 18px 50px rgba(70, 50, 25, .15);
  --radius: 18px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.hidden { display: none !important; }
.accent { color: var(--accent); }
em { font-style: normal; color: var(--accent-dark); font-weight: 600; }

/* buttons */
.btn {
  font: inherit; font-weight: 600; cursor: pointer; border: none;
  border-radius: 999px; padding: 13px 24px; transition: .18s ease; text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn-primary { background: var(--btn); color: #fff; }
.btn-primary:hover { background: var(--btn-hover); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-dark); }

/* header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(244, 238, 227, .85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 7px; font-weight: 800; font-size: 22px; color: var(--ink); text-decoration: none; letter-spacing: -.02em; white-space: nowrap; }
.brand-mark { color: var(--accent); font-size: .95em; line-height: 1; }
.header-nav { display: flex; align-items: center; gap: 18px; }
.header-nav a { color: var(--muted); text-decoration: none; font-weight: 500; white-space: nowrap; }
.header-nav a:hover { color: var(--ink); }

/* Phones: keep the brand, "How it works", and the Talk-to-AI button on one tidy row */
@media (max-width: 560px) {
  .wrap { padding: 0 14px; }
  .header-inner { height: 56px; gap: 10px; }
  .brand { font-size: 17px; gap: 5px; }
  .header-nav { gap: 10px; }
  .header-nav a { font-size: 13.5px; }
  .header-nav .btn-primary { padding: 8px 13px; font-size: 13px; gap: 5px; }
}
@media (max-width: 380px) {
  .header-nav a#nav-how { display: none; }  /* very narrow: drop the text link, keep the AI button */
}

/* hero */
.hero { padding: 72px 0 56px; text-align: center; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: 12px; font-weight: 700; color: var(--accent); margin: 0 0 14px; }
.hero h1 { font-size: clamp(34px, 6vw, 60px); line-height: 1.05; letter-spacing: -.03em; margin: 0 0 18px; font-weight: 800; }
.hero-sub { max-width: 620px; margin: 0 auto 30px; color: var(--muted); font-size: 18px; }

.search-bar {
  display: flex; align-items: center; gap: 8px; max-width: 660px; margin: 0 auto 18px;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 999px;
  padding: 6px 6px 6px 8px; box-shadow: var(--shadow); transition: .18s;
}
.search-bar:focus-within { border-color: var(--accent); box-shadow: var(--shadow-lg); }
.search-bar input { flex: 1; min-width: 0; border: none; outline: none; font: inherit; font-size: 16px; padding: 0 10px; background: transparent; color: var(--ink); }
.search-bar .btn { padding: 12px 24px; flex-shrink: 0; }

.pills { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; max-width: 720px; margin: 0 auto; }
.pill {
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 999px;
  padding: 9px 16px; font-size: 14px; font-weight: 500; cursor: pointer; transition: .15s; color: var(--ink);
}
.pill:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); }
.disclaimer-mini { margin-top: 22px; font-size: 13px; color: var(--muted); }

/* sections */
.section { padding: 30px 0; }
.section-title { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 6px; }
.section-sub { color: var(--muted); margin: 0 0 22px; font-size: 16px; }

/* card grids */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.featured-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 18px; }
@media (max-width: 820px) { .featured-grid { grid-template-columns: 1fr; } }

/* popular explore cards — with subtle hover graphics */
.explore-card {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; cursor: pointer; box-shadow: var(--shadow);
  transition: transform .3s cubic-bezier(.2,.7,.2,1), box-shadow .3s, border-color .3s;
}
/* soft colored glow that grows from the corner on hover */
.explore-card::before {
  content: ""; position: absolute; right: -50px; top: -50px; width: 150px; height: 150px;
  border-radius: 50%; background: radial-gradient(circle, var(--card-glow, #f1e3d3), transparent 68%);
  opacity: .55; transform: scale(.7); transition: transform .45s cubic-bezier(.2,.7,.2,1), opacity .45s; z-index: 0;
}
.explore-card > * { position: relative; z-index: 1; }
.explore-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: transparent; }
.explore-card:hover::before { transform: scale(1.7); opacity: .9; }
.explore-emoji {
  display: inline-grid; place-items: center; width: 54px; height: 54px; border-radius: 16px;
  background: var(--accent-soft); font-size: 28px;
  transition: transform .3s cubic-bezier(.2,.7,.2,1), box-shadow .3s;
}
.explore-card:hover .explore-emoji { transform: translateY(-3px) rotate(-7deg); box-shadow: 0 8px 18px rgba(120,80,40,.18); }
.explore-card h3 { margin: 14px 0 4px; font-size: 18px; }
.explore-card p { margin: 0; color: var(--muted); font-size: 14px; }
.explore-card .go { display: inline-block; margin-top: 12px; font-weight: 600; font-size: 14px; color: var(--accent-dark);
  opacity: 0; transform: translateX(-6px); transition: opacity .25s, transform .25s; }
.explore-card:hover .go { opacity: 1; transform: translateX(0); }

/* how it works */
.how-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 820px) { .how-grid { grid-template-columns: 1fr; } }
.how-step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; }
.how-num { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-dark); font-weight: 800; }
.how-step h3 { margin: 14px 0 6px; }
.how-step p { margin: 0; color: var(--muted); font-size: 15px; }

/* loading */
.loading { text-align: center; padding: 90px 0; color: var(--muted); }
.spinner { width: 44px; height: 44px; border: 4px solid var(--accent-soft); border-top-color: var(--accent); border-radius: 50%; margin: 0 auto 18px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* result head */
.back-btn { margin: 26px 0 10px; }
.result-head { padding: 6px 0 10px; }
.result-head h2 { font-size: clamp(28px, 4vw, 40px); letter-spacing: -.025em; margin: 4px 0 10px; }
.result-rationale { color: var(--muted); max-width: 760px; font-size: 16px; margin: 0 0 14px; }
.targets-label { font-weight: 700; font-size: 15px; margin: 6px 0 2px; }
.targets-hint { color: var(--muted); font-size: 14px; margin: 0 0 10px; max-width: 720px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--accent-soft); color: var(--accent-dark); border-radius: 999px; padding: 6px 13px; font-size: 13px; font-weight: 600; }

/* curability / overview note */
.overview-note { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 16px; margin: 12px 0 4px; font-size: 15px; color: var(--ink); }

/* Learn More (evidence) inside the explain popup */
.learn-more { margin-top: 14px; }
.learn-out { margin-top: 12px; font-size: 14px; line-height: 1.6; }
.learn-studies { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.learn-studies li { margin-bottom: 6px; }
.learn-studies a { color: var(--accent-dark); }

/* summary card */
.summary-card { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius); padding: 24px 26px; margin: 18px 0 8px; box-shadow: var(--shadow); }
.summary-card h3 { margin: 0 0 10px; font-size: 18px; }
.summary-card p { margin: 0 0 10px; }
.summary-card h4 { margin: 14px 0 6px; font-size: 15px; color: var(--accent-dark); }
.summary-card ul { margin: 6px 0; padding-left: 20px; }

/* drug cards */
.drug-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); display: flex; flex-direction: column; cursor: pointer; transition: .16s; }
.drug-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.drug-card.featured { border: 1.5px solid var(--accent); }
.drug-card.prospective { border-style: dashed; }
.drug-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.drug-name { font-size: 19px; font-weight: 800; letter-spacing: -.01em; margin: 0; }
.rank-badge { font-size: 12px; font-weight: 700; color: var(--accent-dark); background: var(--accent-soft); padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.badge { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: #f1f3f2; color: #3c4744; }
.badge.good { background: var(--accent-soft); color: var(--accent-dark); }
.badge.warn { background: #fbeae6; color: var(--warn); }
.badge.trial { background: #e3ecec; color: #3c6a6a; }
.badge.prospect { background: #f6e8d2; color: var(--amber); }

.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 6px 0 14px; }
.metric { text-align: center; }
.metric .bar { height: 6px; border-radius: 999px; background: #ece3d4; overflow: hidden; margin-bottom: 6px; }
.metric .bar > span { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.metric .bar.safe > span { background: #6f8a4f; }
.metric .bar.conf > span { background: #b39875; }
.metric .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.metric .val { font-weight: 700; font-size: 14px; }

.drug-meta { font-size: 14px; color: var(--muted); margin: 2px 0; }
.drug-meta strong { color: var(--ink); font-weight: 600; }
.info-note { font-size: 13px; border-radius: var(--radius-sm); padding: 10px 12px; margin: 10px 0; }
.info-note.trial { background: #e6efef; color: #355f5f; }
.info-note.prospect { background: #f6e8d2; color: #8a6212; }
.trial-links { font-size: 13px; margin: 6px 0; }
.trial-links a { color: var(--accent-dark); }

.drug-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 14px; }
.mini-btn { font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; border: 1.5px solid var(--line); background: transparent; color: var(--ink); border-radius: 999px; padding: 8px 14px; transition: .15s; }
.mini-btn:hover { border-color: var(--accent); color: var(--accent-dark); }

.studies, .ask-box { margin-top: 12px; }
.studies ul { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.studies li { margin-bottom: 6px; }
.studies a { color: var(--accent-dark); }
.ask-row { display: flex; gap: 6px; margin-top: 8px; }
.ask-row input { flex: 1; border: 1.5px solid var(--line); border-radius: 999px; padding: 10px 15px; font: inherit; font-size: 13px; outline: none; transition: .18s; }
.ask-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ask-answer { margin-top: 10px; font-size: 14px; line-height: 1.6; background: var(--accent-soft); border-left: 3px solid var(--accent);
  border-radius: 12px; padding: 12px 15px; animation: msgIn .3s cubic-bezier(.2,.7,.2,1); }
.ask-answer strong { color: var(--accent-dark); }
.ask-answer p:first-child { margin-top: 0; } .ask-answer p:last-child { margin-bottom: 0; }

/* study list: clean, uppercase titles, one per line */
.study-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.study-list li { line-height: 1.4; }
.study-list a { color: var(--accent-dark); text-decoration: none; font-weight: 600; font-size: 12.5px; letter-spacing: .01em; }
.study-list a:hover { text-decoration: underline; }
.ask-answer ul { margin: 6px 0; padding-left: 18px; }
.muted-sm { font-size: 13px; color: var(--muted); }

.empty { color: var(--muted); font-style: italic; }

/* AI call-to-action in hero (replaces the old pills row) */
.ai-cta {
  display: flex; align-items: center; gap: 18px; width: 100%; max-width: 620px;
  margin: 6px auto 0; padding: 22px 28px; cursor: pointer; text-align: left;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); transition: .2s cubic-bezier(.2,.7,.2,1); font: inherit; color: var(--ink);
}
.ai-cta:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--accent); }
.ai-cta-emoji { font-size: 34px; display: grid; place-items: center; width: 60px; height: 60px;
  border-radius: 16px; background: var(--accent-soft); flex-shrink: 0; }
.ai-cta-text { display: flex; flex-direction: column; flex: 1; }
.ai-cta-text strong { font-size: 19px; }
.ai-cta-text span { color: var(--muted); font-size: 15px; }
.ai-cta-arrow { font-size: 24px; color: var(--accent); transition: transform .2s; }
.ai-cta:hover .ai-cta-arrow { transform: translateX(4px); }

/* "Show all N" toggle under a drug section */
.show-more { margin: 14px auto 0; display: block; }

/* docked chat popup (top-right button) — floats over the page so you can still see results */
.chat-modal { position: fixed; bottom: 22px; right: 22px; z-index: 95;
  width: 400px; max-width: calc(100vw - 32px); height: 580px; max-height: calc(100vh - 110px);
  animation: chatPop .28s cubic-bezier(.2,.7,.2,1); }
@keyframes chatPop { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }
.chat-panel { display: flex; flex-direction: column; height: 100%; background: var(--surface);
  border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-lg); overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 11px; padding: 14px 16px; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark)); }
.chat-head .chat-head-avatar { width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.22);
  display: grid; place-items: center; font-weight: 800; font-size: 16px; flex-shrink: 0; }
.chat-head-title { display: flex; flex-direction: column; line-height: 1.2; flex: 1; }
.chat-head-title strong { font-size: 15px; }
.chat-head-title span { font-size: 12px; opacity: .85; }
.chat-head .modal-close { position: static; width: 32px; height: 32px; background: rgba(255,255,255,.2); color: #fff; }
.chat-head .modal-close:hover { background: rgba(255,255,255,.38); color: #fff; }
.chat-modal .ai-messages { flex: 1; max-height: none; background: var(--bg); }
.chat-modal .ai-chat-form { padding: 12px; border-top: 1px solid var(--line); margin-top: 0; background: var(--surface); }
@media (max-width: 480px) { .chat-modal { left: 8px; right: 8px; bottom: 8px; width: auto; } }

/* AI page */
.ai-page-actions { display: flex; align-items: center; gap: 10px; margin: 26px 0 10px; flex-wrap: wrap; }
.ai-page-actions .back-btn { margin: 0; }
.ai-hero { text-align: center; padding: 20px 0 10px; }
.ai-hero h2 { font-size: clamp(28px, 4vw, 40px); letter-spacing: -.025em; margin: 6px 0 12px; }
.ai-sub { max-width: 640px; margin: 0 auto; color: var(--muted); font-size: 17px; }
.ai-caps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 26px 0; }
@media (max-width: 780px) { .ai-caps { grid-template-columns: 1fr; } }
.cap-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); transition: .18s; }
.cap-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.cap-emoji { font-size: 26px; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--accent-soft); }
.cap-card h3 { margin: 12px 0 6px; }
.cap-card p { margin: 0; color: var(--muted); font-size: 15px; }

/* chat threads (page + popup + per-drug Ask) */
.ai-chat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.ai-messages { min-height: 240px; max-height: 46vh; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 12px 8px; scroll-behavior: smooth; }
.ai-row { display: flex; gap: 8px; align-items: flex-end; animation: msgIn .3s cubic-bezier(.2,.7,.2,1); }
.ai-row.user { flex-direction: row-reverse; }
.ai-avatar { width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
  font-size: 14px; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  box-shadow: 0 2px 6px rgba(120,80,40,.28); }
.ai-msg { max-width: 82%; padding: 11px 15px; border-radius: 18px; font-size: 15px; line-height: 1.55; white-space: pre-wrap;
  box-shadow: 0 1px 2px rgba(60,40,20,.06); word-wrap: break-word; overflow-wrap: anywhere; }
.ai-msg.bot { background: var(--surface); border: 1px solid var(--line); color: var(--ink); border-bottom-left-radius: 5px; max-width: 90%; }
.ai-msg.user { background: linear-gradient(135deg, var(--accent), var(--accent-dark)); color: #fff; border-bottom-right-radius: 5px; }
.ai-msg.bot strong { color: var(--accent-dark); }
.ai-msg p:first-child { margin-top: 0; } .ai-msg p:last-child { margin-bottom: 0; }
.ai-msg ul, .ai-msg ol { margin: 6px 0; padding-left: 18px; }
/* topic heading (from #/##) and subtopic heading (from ###/bold-line) */
.ai-msg h3, .ask-answer h3 { margin: 14px 0 6px; font-size: 16.5px; font-weight: 800; letter-spacing: -.01em;
  color: var(--accent-dark); padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.ai-msg h4, .ask-answer h4 { margin: 10px 0 4px; font-size: 15px; font-weight: 700; color: var(--ink); }
.ai-msg h3:first-child, .ai-msg h4:first-child, .ask-answer h3:first-child, .ask-answer h4:first-child { margin-top: 0; }
.ai-msg li { margin: 2px 0; }

/* comparison tables */
.ai-table-wrap { overflow-x: auto; margin: 10px 0; -webkit-overflow-scrolling: touch; }
.ai-msg table, .ask-answer table { border-collapse: collapse; width: 100%; font-size: 13.5px; white-space: normal; }
.ai-msg th, .ai-msg td, .ask-answer th, .ask-answer td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; vertical-align: top; }
.ai-msg thead th, .ask-answer thead th { background: var(--bg); color: var(--accent-dark); font-weight: 700; }
.ai-msg tbody tr:nth-child(even) td { background: rgba(0,0,0,.02); }
@keyframes msgIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

/* typing indicator */
.ai-msg.typing { display: flex; gap: 5px; align-items: center; padding: 15px 16px; }
.ai-msg.typing .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: typingBounce 1.3s infinite ease-in-out; }
.ai-msg.typing .dot:nth-child(2) { animation-delay: .18s; }
.ai-msg.typing .dot:nth-child(3) { animation-delay: .36s; }
@keyframes typingBounce { 0%, 70%, 100% { transform: translateY(0); opacity: .35; } 35% { transform: translateY(-6px); opacity: 1; } }

/* "thinking" status pill (shown after ~3s of waiting) with a shimmering, rotating message */
.ai-msg.status { display: inline-flex; align-items: center; gap: 10px; padding: 12px 12px 12px 15px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0;
  animation: statusPulse 1.2s ease-in-out infinite; }
@keyframes statusPulse { 0%, 100% { opacity: .3; transform: scale(.75); } 50% { opacity: 1; transform: scale(1); } }
.status-text { font-size: 14px; font-weight: 500; white-space: nowrap; transition: opacity .25s ease;
  background: linear-gradient(90deg, var(--muted) 35%, var(--ink) 50%, var(--muted) 65%);
  background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: statusShimmer 2.2s linear infinite; }
@keyframes statusShimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.status-x { flex-shrink: 0; width: 20px; height: 20px; border: none; border-radius: 50%; cursor: pointer;
  background: var(--surface-2); color: var(--muted); font-size: 15px; line-height: 1; display: grid; place-items: center;
  transition: background .15s, color .15s; }
.status-x:hover { background: var(--accent-soft); color: var(--accent-dark); }
.ai-row.fade-out { opacity: 0; transform: translateY(-4px); transition: opacity .22s ease, transform .22s ease; }
@media (prefers-reduced-motion: reduce) { .status-dot, .status-text { animation: none; } }

.ai-chat-form { display: flex; gap: 8px; margin-top: 14px; align-items: flex-end; }
.ai-chat-form textarea { flex: 1; min-width: 0; border: 1.5px solid var(--line); border-radius: 20px; padding: 13px 16px; font: inherit;
  font-size: 15px; line-height: 1.45; outline: none; background: var(--surface); resize: none; min-height: 50px; max-height: 150px;
  overflow-y: auto; transition: border-color .18s, box-shadow .18s; }
.ai-chat-form textarea::placeholder { font-size: 14px; }
.ai-chat-form textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.ai-chat-form .btn { border-radius: 999px; padding: 13px 22px; flex-shrink: 0; }

/* scroll-reveal: elements fade + rise as they enter the viewport */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity .55s ease, transform .55s cubic-bezier(.2,.7,.2,1); }
.reveal.revealed { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* clickable badges + confidence, and split-screen wrap safety */
.badge.clickable, .rank-badge.clickable { cursor: pointer; }
.badge.clickable:hover { box-shadow: 0 0 0 2px rgba(120, 80, 40, .18); }
.rank-badge.clickable:hover { background: var(--accent); color: #fff; }
.drug-top { flex-wrap: wrap; }
.drug-name { min-width: 0; overflow-wrap: anywhere; }
.badges { max-width: 100%; }
@media (max-width: 900px) { .featured-grid { grid-template-columns: 1fr; } }

/* explanation popup */
.explain-modal { max-width: 460px; }
.explain-label { font-size: 21px; margin: 4px 0 12px; letter-spacing: -.01em; }
#explain-text { font-size: 15px; line-height: 1.6; }
#explain-text p { margin: 0 0 8px; }

/* modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(20, 30, 27, .5); backdrop-filter: blur(4px); z-index: 100; display: grid; place-items: center; padding: 24px; }
.modal { background: var(--surface); border-radius: 22px; max-width: 640px; width: 100%; max-height: 88vh; overflow-y: auto; padding: 30px; position: relative; box-shadow: var(--shadow-lg); }
.modal-close { position: absolute; top: 16px; right: 16px; width: 38px; height: 38px; border-radius: 999px; border: none; background: #f1f3f2; font-size: 22px; line-height: 1; cursor: pointer; color: var(--ink); transition: .15s; }
.modal-close:hover { background: var(--accent-soft); color: var(--accent-dark); }
.modal-name { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin: 0 6px 10px 0; padding-right: 40px; }
.modal-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.modal-images { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.modal-images a { display: inline-block; line-height: 0; transition: transform .15s; }
.modal-images a:hover { transform: scale(1.03); }
.modal-images img { max-height: 170px; max-width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--line); background: #fff; padding: 6px; object-fit: contain; cursor: zoom-in; }
.modal-summary { font-size: 16px; margin-bottom: 16px; }
.modal-brand { display: inline-block; background: var(--accent-soft); color: var(--accent-dark); padding: 6px 12px; border-radius: 999px; font-size: 14px; margin: 0 0 12px; }
.modal-summary p { margin: 0 0 8px; }
.modal-facts { border-top: 1px solid var(--line); padding-top: 14px; margin-bottom: 8px; }
.modal-actions { display: flex; gap: 8px; margin: 8px 0; }

/* footer */
.site-footer { margin-top: 50px; border-top: 1px solid var(--line); background: var(--surface-2); padding: 36px 0 50px; }
.foot-brand { font-weight: 800; font-size: 20px; margin: 0 0 10px; }
.foot-disc { color: var(--muted); font-size: 13px; max-width: 760px; margin: 0; }
