:root {
  --accent: #0056d6;
  --accent-dark: #00369f;
  --accent-lite: #4a90e2;
  --grad: linear-gradient(135deg, #00369f 0%, #0056d6 100%);
  --text: #3a3f45;
  --muted: #6a737d;
  --bg: #ffffff;
  --soft: #f6f8fa;
  --card: #ffffff;
  --border: #e1e4e8;
  --shadow: rgba(20, 40, 80, .10);
}

[data-theme="dark"] {
  --accent: #58a6ff;
  --accent-dark: #79b8ff;
  --accent-lite: #1f6feb;
  --grad: linear-gradient(135deg, #1f6feb 0%, #388bfd 100%);
  --text: #c9d1d9;
  --muted: #8b949e;
  --bg: #0d1117;
  --soft: #161b22;
  --card: #161b22;
  --border: #30363d;
  --shadow: rgba(0, 0, 0, .5);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  position: relative;
  color: var(--text);
  background: var(--bg);
  font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.7;
  transition: background-color .3s ease, color .3s ease;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(
      135deg,
      rgba(240, 248, 255, .28) 0%,
      rgba(230, 240, 255, .18) 25%,
      rgba(245, 250, 255, .22) 50%,
      rgba(235, 245, 255, .18) 75%,
      rgba(240, 248, 255, .28) 100%
    );
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
}

[data-theme="dark"] body::before {
  background-image:
    linear-gradient(
      135deg,
      rgba(13, 17, 23, .30) 0%,
      rgba(22, 27, 34, .20) 25%,
      rgba(13, 17, 23, .25) 50%,
      rgba(22, 27, 34, .20) 75%,
      rgba(13, 17, 23, .30) 100%
    );
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.wrap {
  max-width: 820px;
  margin: 0 auto;
  padding: 34px 20px 64px;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:not(.btn) {
  background-image: linear-gradient(90deg, var(--accent-dark), var(--accent));
  background-repeat: no-repeat;
  background-position: left bottom;
  background-size: 0 1.5px;
  padding-bottom: 1px;
  transition: background-size .3s cubic-bezier(.4, 0, .2, 1), color .3s ease;
}

a:not(.btn):hover {
  color: var(--accent-dark);
  background-size: 100% 1.5px;
}

h1 {
  margin: .1em 0 .35em;
  color: var(--text);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.25;
}

.subtitle {
  margin: 0 0 1em;
  color: var(--muted);
  font-size: 1.18rem;
  font-weight: 500;
  line-height: 1.5;
}

.venues {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.venue {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 999px;
  color: #fff;
  background: var(--grad);
  box-shadow: 0 2px 8px var(--shadow);
  font-size: .9rem;
  font-weight: 600;
  letter-spacing: .02em;
}

.venue.secondary {
  border: 1px solid var(--accent);
  color: var(--accent-dark);
  background: var(--soft);
  box-shadow: none;
}

.authors {
  margin: 1.15em 0 .4em;
  line-height: 1.95;
}

.au {
  margin-right: .15em;
  white-space: nowrap;
}

sup {
  font-size: .7em;
  line-height: 0;
}

.legend {
  margin: .2em 0 .4em;
  color: var(--muted);
  font-size: .92rem;
  line-height: 1.7;
}

.btns {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 1.2em 0 .2em;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: .45em;
  padding: .55em 1.05em;
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  background: var(--card);
  font-size: .95rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.btn:hover {
  color: #fff;
  background: var(--grad);
  box-shadow: 0 6px 16px var(--shadow);
  transform: translateY(-1px);
}

.btn.disabled {
  border-color: var(--border);
  color: var(--muted);
  background: var(--soft);
  cursor: default;
}

.btn.disabled:hover {
  color: var(--muted);
  background: var(--soft);
  box-shadow: none;
  transform: none;
}

.ic {
  width: 1.05em;
  height: 1.05em;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
}

figure {
  margin: 2.4em auto .4em;
}

figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 22px var(--shadow);
  transition: filter .3s ease;
}

[data-theme="dark"] figure img {
  filter: brightness(.82);
}

figcaption {
  max-width: 680px;
  margin: .8em auto 0;
  color: var(--muted);
  font-size: .9rem;
  text-align: center;
}

section {
  margin-top: 0;
}

h2 {
  position: relative;
  margin: 2.6em 0 .8em;
  padding-bottom: .3em;
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1.3;
}

h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-dark), var(--accent), var(--accent-lite));
  transition: width .8s cubic-bezier(.4, 0, .2, 1);
}

h2.animated::after {
  width: 100%;
}

h3 {
  margin: 1.3em 0 .25em;
  color: var(--text);
  font-size: 1.06rem;
}

p {
  margin: .7em 0;
}

.lead {
  font-size: 1.06rem;
}

.contrib {
  margin: .6em 0 0;
  padding-left: 1.2em;
}

.contrib li {
  margin: .45em 0;
}

.block {
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--soft);
}

.abstract p {
  margin: 0;
}

.finding {
  margin: 1.15em 0;
}

.finding h3 .num {
  margin-right: .35em;
  color: var(--accent);
  font-weight: 700;
}

strong.k {
  color: var(--accent-dark);
}

.modelset {
  margin: .6em 0;
  padding: .7em 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--soft);
  font-size: .95rem;
}

.modelset b {
  color: var(--accent-dark);
}

.table-scroll {
  overflow-x: auto;
  margin-top: 1em;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: .84rem;
}

th,
td {
  padding: 10px 9px;
  border-bottom: 1px solid var(--border);
  text-align: center;
  white-space: nowrap;
}

thead th {
  color: var(--muted);
  background: var(--soft);
  font-size: .76rem;
  font-weight: 600;
}

thead small {
  font-size: .7rem;
}

tbody th,
tbody td:nth-child(2) {
  text-align: left;
}

tbody th {
  font-weight: 600;
}

.accent-row {
  color: var(--accent-dark);
  background: rgba(0, 86, 214, .06);
}

[data-theme="dark"] .accent-row {
  background: rgba(88, 166, 255, .08);
}

.reslist {
  margin: .7em 0;
  padding-left: 1.2em;
}

.reslist li {
  margin: .32em 0;
}

pre {
  margin: .8em 0;
  overflow-x: auto;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  background: var(--soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .88rem;
  line-height: 1.65;
}

.bibhead {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: -1px;
  padding: .65em .8em;
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  color: var(--muted);
  background: var(--soft);
  font-size: .86rem;
}

.bibhead + pre {
  margin-top: 0;
  border-radius: 0 0 8px 8px;
}

.copy {
  padding: .45em .75em;
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  background: var(--card);
  font: 600 .82rem "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  cursor: pointer;
}

.copy:hover {
  color: #fff;
  background: var(--grad);
}

.theme-toggle {
  position: fixed;
  top: 18px;
  right: 20px;
  z-index: 30;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--muted);
  background: var(--card);
  box-shadow: 0 4px 14px var(--shadow);
  cursor: pointer;
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.animate-on-scroll {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .45s ease, transform .45s ease;
}

.animate-on-scroll.animated {
  opacity: 1;
  transform: none;
}

footer {
  margin-top: 3.4em;
  padding-top: 1.1em;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .88rem;
}

@media (max-width: 900px) {
  .theme-toggle {
    position: absolute;
  }
}

@media (max-width: 600px) {
  body {
    font-size: 16px;
  }

  .wrap {
    padding: 24px 16px 46px;
  }

  h1 {
    padding-right: 44px;
    font-size: 1.72rem;
  }

  .subtitle {
    font-size: 1.05rem;
  }

  .authors {
    line-height: 1.85;
  }

  .btns {
    gap: 8px;
  }

  .btn {
    font-size: .9rem;
  }

  figure {
    margin-top: 1.9em;
  }

  h2 {
    margin-top: 2.3em;
  }

  .bibhead {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  body::before {
    animation: none;
  }

  .animate-on-scroll {
    opacity: 1;
    transform: none;
    transition: none;
  }

  *,
  *::before,
  *::after {
    transition-duration: .01ms !important;
  }
}


/* Enriched paper/appendix content */
.fact-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 1.25em 0;
}
.fact {
  padding: 14px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--soft);
}
.fact strong {
  display: block;
  color: var(--accent-dark);
  font-size: 1.32rem;
  line-height: 1.2;
}
.fact span {
  display: block;
  margin-top: .25em;
  font-size: .82rem;
  font-weight: 700;
}
.fact small {
  display: block;
  margin-top: .2em;
  color: var(--muted);
  font-size: .7rem;
  line-height: 1.35;
}
.config-line,
.note,
.callout {
  margin: 1em 0;
  padding: .8em 1em;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: var(--soft);
  font-size: .93rem;
}
.note {
  color: var(--muted);
  border-left-color: var(--border);
}
.callout { margin-top: 1.4em; }
.callout strong,
.config-line b { color: var(--accent-dark); }

.theory-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 1.1em 0;
}
.theory-grid article {
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--soft);
}
.theory-grid code {
  display: inline-block;
  color: var(--accent-dark);
  font-size: .82rem;
}
.theory-grid h3 { margin: .6em 0 .3em; }
.theory-grid p {
  margin: 0;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.55;
}

.dataset-grid,
.threat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 1em 0;
}
.dataset-grid article,
.threat-grid article {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--soft);
}
.dataset-grid h3,
.threat-grid h3 { margin: 0 0 .55em; }
.dataset-grid dl { margin: 0; }
.dataset-grid dl div {
  display: flex;
  justify-content: space-between;
  padding: .2em 0;
  border-top: 1px dashed var(--border);
  font-size: .86rem;
}
.dataset-grid dl div:first-child { border-top: 0; }
.dataset-grid dt { color: var(--muted); }
.dataset-grid dd { margin: 0; font-weight: 700; }
.threat-grid p {
  margin: 0;
  color: var(--muted);
  font-size: .88rem;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 1em 0;
}
.metric-strip div {
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--soft);
}
.metric-strip span,
.metric-strip small {
  display: block;
  color: var(--muted);
  font-size: .7rem;
}
.metric-strip strong {
  display: block;
  margin: .15em 0;
  color: var(--accent-dark);
  font-size: 1.35rem;
}
.privacy-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 1em 0;
}
.privacy-cards article {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--soft);
}
.privacy-cards strong {
  display: block;
  color: var(--accent-dark);
  font-size: 1.25rem;
}
.privacy-cards span,
.privacy-cards small { display: block; }
.privacy-cards span {
  margin-top: .25em;
  font-size: .86rem;
  font-weight: 700;
}
.privacy-cards small { color: var(--muted); }

.table-scroll.compact table { min-width: 560px; }

.figure-grid {
  display: grid;
  gap: 12px;
  margin: 1.2em 0;
}
.figure-grid.two { grid-template-columns: 1fr 1fr; }
.figure-grid figure { margin: 0; }
.figure-grid figcaption { font-size: .78rem; }
.figure-grid img { box-shadow: 0 4px 14px var(--shadow); }

.ablation-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 1em 0;
}
.ablation-list div {
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--soft);
}
.ablation-list b {
  display: block;
  color: var(--accent-dark);
  font-size: .84rem;
}
.ablation-list span {
  display: block;
  margin-top: .2em;
  color: var(--muted);
  font-size: .77rem;
  line-height: 1.45;
}

.sensitivity-block {
  display: grid;
  grid-template-columns: .42fr .58fr;
  gap: 18px;
  align-items: center;
  margin: 1.35em 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--soft);
}
.sensitivity-block h3 { margin: 0 0 .35em; }
.sensitivity-block p {
  margin: 0;
  color: var(--muted);
  font-size: .86rem;
}
.sensitivity-block figure { margin: 0; }
.web-chart img {
  background: #fff;
  filter: none !important;
  box-shadow: none;
}
.web-chart figcaption {
  margin-top: .35em;
  font-size: .74rem;
}

@media (max-width: 760px) {
  .fact-grid,
  .metric-strip { grid-template-columns: 1fr 1fr; }
  .theory-grid { grid-template-columns: 1fr; }
  .dataset-grid,
  .threat-grid { grid-template-columns: 1fr; }
  .sensitivity-block { grid-template-columns: 1fr; }
  .ablation-list { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .figure-grid.two,
  .privacy-cards { grid-template-columns: 1fr; }
}
