:root {
  --navy: #1a365d;
  --navy-ink: #12243f;
  --cream: #f6f1e8;
  --paper: #fffdf8;
  --line: #e4ddd0;
  --muted: #5c6570;
  --teal: #2d7a7a;
  --brick: #9b3d3d;
  --forest: #3d5a3d;
  --gold: #8a6a2f;
  --shadow: 0 10px 28px rgba(26, 54, 93, 0.07);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --tab: 64px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Apple SD Gothic Neo", "Noto Sans KR", "Pretendard", ui-sans-serif, system-ui, sans-serif;
  background: var(--cream);
  color: var(--navy-ink);
  line-height: 1.65;
  min-height: 100dvh;
  padding-bottom: calc(var(--tab) + var(--safe-b) + 16px);
}

.skip {
  position: absolute;
  left: -999px;
}
.skip:focus { left: 12px; top: 12px; background: #fff; padding: 8px 12px; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: calc(12px + var(--safe-t)) 20px 12px;
  background: rgba(246, 241, 232, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
a.brand { text-decoration: none; color: inherit; }
.brand img { border-radius: 7px; }
.brand strong { display: block; font-size: 15px; letter-spacing: -0.02em; }
.brand span { display: block; font-size: 12px; color: var(--muted); }

.topnav { display: none; gap: 6px; }
.topnav button,
.tabbar button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.topnav button {
  padding: 8px 14px;
  border-radius: 999px;
}
.topnav button.is-on {
  background: var(--navy);
  color: #fff;
}

.topnav .nav-a,
.nav-a {
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.topnav .nav-a:hover,
.topnav .nav-a[aria-current="page"],
.nav-a:hover,
.nav-a[aria-current="page"] {
  background: var(--navy);
  color: #fff;
}

.install {
  margin: 16px 20px 0;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  box-shadow: var(--shadow);
}
.install p { margin: 0; flex: 1; font-size: 14px; }
.install em { font-style: normal; font-weight: 700; color: var(--navy); }
.install button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  padding: 4px 0;
}

main { padding: 8px 20px 32px; max-width: 920px; margin: 0 auto; }
.view[hidden] { display: none; }
.view.is-on { display: block; }

.kicker {
  margin: 28px 0 8px;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal);
  font-weight: 700;
}
h1 {
  margin: 0 0 20px;
  font-size: 1.7rem;
  line-height: 1.3;
  letter-spacing: -0.03em;
}
h2.block-title {
  margin: 36px 0 14px;
  font-size: 1.05rem;
}

.messages {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}
.messages li {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 18px 18px 20px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--navy);
}
.messages strong { display: block; margin-bottom: 6px; }
.messages p { margin: 0; color: var(--muted); font-size: 15px; }

.counts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.count {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 16px;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  box-shadow: var(--shadow);
}
.count em {
  display: block;
  font-style: normal;
  font-size: 2rem;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 6px;
}
.count span { color: var(--muted); font-size: 13px; font-weight: 600; }
.count[data-j="NEJM AI"] em { color: var(--navy); }
.count[data-j="NEJM Catalyst"] em { color: var(--teal); }
.count[data-j="npj Digital Medicine"] em { color: var(--forest); }
.count[data-j="Lancet Digital Health"] em { color: var(--brick); }

.news-card {
  display: block;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 16px;
  text-align: left;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--navy);
}
.news-card em {
  display: block;
  font-style: normal;
  font-size: 2rem;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 6px;
  color: var(--navy);
}
.news-card span { color: var(--muted); font-size: 13px; font-weight: 600; }
.issue-list { display: grid; gap: 12px; }

.chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 12px;
  -webkit-overflow-scrolling: touch;
}
.chips button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--navy-ink);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.chips button.is-on {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.search input {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  font: inherit;
  font-size: 16px;
}
.meta { color: var(--muted); font-size: 13px; margin: 12px 0 8px; }

.list { display: grid; gap: 12px; }
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 16px 14px;
  box-shadow: var(--shadow);
}
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 3px 8px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.badge.ai { background: #e8eef6; color: var(--navy); }
.badge.cat { background: #e5f2f2; color: var(--teal); }
.badge.npj { background: #e8f0e8; color: var(--forest); }
.badge.ldh { background: #f6e8e8; color: var(--brick); }
.card h3 {
  margin: 0 0 6px;
  font-size: 1.02rem;
  line-height: 1.4;
  letter-spacing: -0.02em;
}
.authors { margin: 0 0 8px; color: var(--muted); font-size: 13px; }
.take {
  margin: 0;
  color: var(--navy-ink);
  font-size: 14.5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card.is-open .take {
  display: block;
  -webkit-line-clamp: unset;
}
.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}
.actions button, .actions a {
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.more {
  border: 0;
  background: transparent;
  color: var(--teal);
  cursor: pointer;
  padding: 0;
}
.pdf {
  display: inline-flex;
  align-items: center;
  background: var(--navy);
  color: #fff;
  padding: 8px 12px;
  border-radius: 10px;
}
.pdf-alt {
  display: inline-flex;
  align-items: center;
  color: var(--navy);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 4px;
}
.pdf-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.quote {
  margin: 0 0 24px;
  padding: 18px 18px 18px 20px;
  border-left: 4px solid var(--gold);
  background: var(--paper);
  border-radius: 0 14px 14px 0;
  color: var(--navy-ink);
}
.section {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.section h2 { margin: 0 0 12px; font-size: 1.1rem; }
.section p { margin: 0 0 12px; color: #2a3340; }
.section p:last-child { margin-bottom: 0; }
.empty {
  background: var(--paper);
  border: 1px dashed var(--line);
  border-radius: 16px;
  padding: 28px 20px;
  color: var(--muted);
}

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  background: #fffdf8;
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
}
.tabbar button {
  padding: 12px 8px 10px;
  min-height: var(--tab);
}
.tabbar button.is-on { color: var(--navy); }

.tabbar .nav-a {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 8px 10px;
  min-height: var(--tab);
  border-radius: 0;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  background: transparent;
}
.tabbar .nav-a:hover,
.tabbar .nav-a[aria-current="page"] {
  background: transparent;
  color: var(--navy);
}

@media (min-width: 800px) {
  body { padding-bottom: 40px; }
  .tabbar { display: none; }
  .topnav { display: flex; }
  h1 { font-size: 2rem; }
  .counts { grid-template-columns: repeat(4, 1fr); }
  main { padding-top: 16px; }
}
