:root {
  --text: #222;
  --muted: #666;
  --rule: #e5e5e5;
  --bg-alt: #fafafa;
  --link: #1a5fb4;
  --warn-bg: #fff8e1;
  --warn-border: #f0ad4e;
  --warn-text: #7a4f00;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #fff;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 688px;
  margin: 0 auto;
  padding: 56px 32px 96px;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 34px; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 22px; font-weight: 600; margin-bottom: 20px; }
p { margin: 0 0 16px; }

.hero { text-align: center; padding-bottom: 8px; }
.hero h1 { margin-bottom: 18px; }
.authors { font-size: 17px; margin-bottom: 6px; }
.authors sup { font-size: 0.7em; }
.affiliations { font-size: 14px; color: var(--muted); font-style: italic; margin-bottom: 24px; }

.summary {
  text-align: left;
  margin: 28px 0 0;
  font-size: 18px;
  line-height: 1.7;
  color: #333;
}

.disclaimer {
  background: var(--warn-bg);
  color: var(--warn-text);
  border-left: 4px solid var(--warn-border);
  padding: 12px 16px;
  font-weight: 600;
  text-align: left;
  margin: 16px 0 0;
  border-radius: 2px;
}

section {
  border-top: 1px solid var(--rule);
  padding-top: 40px;
  margin-top: 48px;
}

.row-2, .row-3 {
  display: grid;
  gap: 24px;
  margin-bottom: 20px;
}
.row-2 { grid-template-columns: 1fr 1fr; }
.row-3 { grid-template-columns: 1fr 1fr 1fr; }

.gradcam-stack {
  display: flex;
  flex-direction: column;
  gap: 44px;
}
.gradcam-item p:last-child {
  margin-bottom: 0;
}

@media (max-width: 720px) {
  main { padding: 36px 20px 64px; }
  h1 { font-size: 28px; }
  .row-2, .row-3 { grid-template-columns: 1fr; }
}

.figure img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
}

.carousel {
  position: relative;
  user-select: none;
  outline: none;
}
.carousel .frame {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #fafafa;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.06);
  overflow: hidden;
  cursor: pointer;
}
.carousel .frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 120ms ease;
}
.carousel.gradcam-carousel .frame {
  aspect-ratio: auto;
  min-height: 0;
}
.carousel.gradcam-carousel .frame img {
  width: 100%;
  height: auto;
  max-width: 100%;
  object-fit: contain;
}
.carousel-label {
  text-align: left;
  font-size: 13px;
  font-style: italic;
  color: var(--muted);
  margin-top: 6px;
}
.carousel-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}
.carousel-btn {
  appearance: none;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 4px 10px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
}
.carousel-btn:hover { background: var(--bg-alt); }
.carousel-btn:disabled { opacity: 0.4; cursor: default; }
.carousel-counter { font-variant-numeric: tabular-nums; }

table.stats {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
table.stats th, table.stats td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
table.stats th {
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
table.stats tbody tr:nth-child(even) td { background: var(--bg-alt); }
table.stats tr.macro td { font-weight: 600; border-top: 1px solid #d0d0d0; }
table.stats caption {
  caption-side: top;
  text-align: left;
  font-size: 13px;
  color: var(--muted);
  padding-bottom: 6px;
}

.row-device {
  display: grid;
  grid-template-columns: 0.9fr 0.75fr 1.5fr;
  gap: 16px;
  align-items: stretch;
  margin-bottom: 20px;
}
.row-device .db-figure svg {
  width: 100%;
  height: 100%;
  max-height: 100%;
}
.device-col { display: flex; flex-direction: column; }
.fig-label {
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-top: 6px;
}
.row-device .equal-height {
  height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.row-device .equal-height img {
  max-height: 100%;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

@media (max-width: 720px) {
  .row-device { grid-template-columns: 1fr; }
  .row-device .equal-height { height: auto; }
  .row-device .equal-height img { width: 100%; height: auto; }
  .row-device .db-figure svg { max-height: 120px; }
}

.results-grid { align-items: start; }
.results-col { display: flex; flex-direction: column; gap: 12px; }
.fig-title {
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  margin: 0;
  color: var(--text);
}
.gradcam-heading.fig-title {
  text-align: left;
  margin-bottom: 14px;
}
.results-col .figure {
  height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.results-col .figure img {
  max-height: 100%;
  max-width: 100%;
  width: auto;
  object-fit: contain;
}

@media (max-width: 720px) {
  .results-col .figure { height: auto; }
  .results-col .figure img { width: 100%; height: auto; }
}

.morph-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  align-items: start;
}
.morph-grid .col-header {
  text-align: center;
  font-weight: 600;
  font-size: 14px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.morph-grid img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
}
.morph-carousel .frame {
  aspect-ratio: auto;
  height: auto;
  background: transparent;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.morph-carousel .frame img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

.morph-toggle-row {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}
.morph-toggle-btn {
  padding: 6px 16px;
  font-size: 14px;
}

@media (max-width: 720px) {
  .morph-grid { grid-template-columns: 1fr; }
  .morph-grid .col-header { text-align: left; padding: 0; }
}

.note {
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
  margin-top: -8px;
}

.ref-cite {
  font-size: 0.75em;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
  top: -0.35em;
}
.ref-cite a {
  color: var(--link);
  text-decoration: none;
  font-weight: 600;
}
.ref-cite a:hover { text-decoration: underline; }

.references .ref-list {
  margin: 0;
  padding-left: 1.35em;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
}
.references .ref-list li {
  margin-bottom: 10px;
  padding-left: 0.35em;
}
.references .ref-list li::marker {
  font-weight: 600;
}

footer {
  border-top: 1px solid var(--rule);
  margin-top: 56px;
  padding-top: 24px;
  font-size: 14px;
  color: var(--muted);
}
footer ul { list-style: none; padding: 0; margin: 0 0 12px; }
footer li { margin-bottom: 4px; }
footer .attribution { font-size: 12px; color: var(--muted); margin-top: 8px; }
