:root {
  color-scheme: dark;
  --bg: #090b10;
  --surface: rgba(15, 20, 29, 0.78);
  --surface-strong: rgba(20, 28, 40, 0.94);
  --border: rgba(150, 177, 214, 0.2);
  --border-strong: rgba(137, 213, 255, 0.42);
  --text: #eef5ff;
  --muted: #99a8ba;
  --dim: #6e7a8d;
  --cyan: #72ddff;
  --green: #7dffb2;
  --amber: #ffd166;
  --red: #ff7b72;
  --violet: #b9a7ff;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  --mono: "SFMono-Regular", "Roboto Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 16% 8%, rgba(114, 221, 255, 0.14), transparent 28rem),
    radial-gradient(circle at 84% 18%, rgba(125, 255, 178, 0.1), transparent 28rem),
    linear-gradient(135deg, #080a0f 0%, #0e1320 46%, #090b10 100%);
  color: var(--text);
  font-family: var(--sans);
  overflow-x: hidden;
}

a {
  color: inherit;
}

#code-rain,
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

#code-rain {
  z-index: 0;
  opacity: 0.42;
}

.grain {
  z-index: 1;
  opacity: 0.22;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.026) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, #000 0%, #000 64%, transparent 100%);
}

main {
  position: relative;
  z-index: 2;
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(420px, 1.05fr);
  align-items: center;
  min-height: 94vh;
  gap: 44px;
  padding: 56px 0 38px;
}

.kicker,
.section-label {
  margin: 0 0 18px;
  color: var(--green);
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 10ch;
  margin-bottom: 16px;
  font-size: clamp(4rem, 10vw, 8.3rem);
  font-weight: 760;
  letter-spacing: 0;
  line-height: 0.88;
}

.subtitle {
  margin-bottom: 20px;
  color: var(--cyan);
  font-family: var(--mono);
  font-size: clamp(1.02rem, 1.8vw, 1.26rem);
  line-height: 1.45;
}

.dek,
.body-copy {
  color: #c8d4e1;
  font-size: clamp(1rem, 1.55vw, 1.18rem);
  line-height: 1.75;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.9rem;
  text-decoration: none;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.button:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  background: rgba(114, 221, 255, 0.1);
}

.button.primary {
  border-color: rgba(125, 255, 178, 0.46);
  background: linear-gradient(135deg, rgba(125, 255, 178, 0.24), rgba(114, 221, 255, 0.13));
}

.terminal-card {
  min-height: 520px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0)),
    rgba(3, 7, 13, 0.8);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(16px);
}

.terminal-top {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 16px;
  border-bottom: 1px solid rgba(137, 213, 255, 0.2);
  background: rgba(255, 255, 255, 0.055);
}

.terminal-top span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.terminal-top span:nth-child(1) { background: var(--red); }
.terminal-top span:nth-child(2) { background: var(--amber); }
.terminal-top span:nth-child(3) { background: var(--green); }

.terminal-top p {
  margin: 0 0 0 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
}

#terminal-output {
  min-height: 478px;
  margin: 0;
  padding: 22px;
  color: #d7e8f8;
  font-family: var(--mono);
  font-size: clamp(0.78rem, 1.12vw, 0.96rem);
  line-height: 1.68;
  white-space: pre-wrap;
}

.terminal-command { color: var(--cyan); }
.terminal-ok { color: var(--green); }
.terminal-warn { color: var(--amber); }
.terminal-error { color: var(--red); }
.terminal-dim { color: var(--dim); }
.terminal-caret {
  display: inline-block;
  width: 0.62em;
  height: 1.08em;
  transform: translateY(0.16em);
  background: var(--green);
  animation: blink 1s steps(2, jump-none) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.authors,
.stats,
.section-grid,
.layers,
.applications,
.open-problems,
.citation {
  margin-bottom: 96px;
}

.authors {
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.authors p {
  margin-bottom: 12px;
  color: #dbe7f2;
  font-size: 1.03rem;
  line-height: 1.9;
}

.authors sup,
.affiliations sup {
  color: var(--green);
}

.authors .affiliations {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.stats div,
.layer-card,
.problem-grid article,
.code-box {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 16px 54px rgba(0, 0, 0, 0.18);
}

.stats div {
  padding: 24px 20px;
}

.stats strong {
  display: block;
  margin-bottom: 8px;
  color: var(--cyan);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 690;
  line-height: 1;
}

.stats span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.85rem;
}

.section-grid,
.applications,
.citation {
  display: grid;
  grid-template-columns: 0.82fr 1.18fr;
  gap: 48px;
  align-items: start;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1;
  letter-spacing: 0;
}

.layer-track {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 32px;
}

.layer-card {
  position: relative;
  min-height: 460px;
  padding: 28px;
  overflow: hidden;
}

.layer-card::before {
  content: "";
  position: absolute;
  inset: auto -30% -40% -30%;
  height: 220px;
  background: radial-gradient(circle, rgba(114, 221, 255, 0.16), transparent 68%);
}

.layer-card span {
  display: inline-flex;
  margin-bottom: 54px;
  color: var(--green);
  font-family: var(--mono);
  font-size: 0.86rem;
}

.layer-card h3,
.problem-grid h3 {
  color: var(--text);
  font-size: clamp(1.24rem, 2vw, 1.58rem);
  line-height: 1.18;
}

.layer-card p,
.problem-grid p {
  position: relative;
  color: #b8c5d4;
  line-height: 1.68;
}

.layer-card ul {
  position: relative;
  display: grid;
  gap: 10px;
  margin: 24px 0 0;
  padding: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.84rem;
  list-style: none;
}

.layer-card li::before {
  content: "↳ ";
  color: var(--cyan);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.chips span {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  padding: 0 14px;
  border: 1px solid rgba(137, 213, 255, 0.24);
  border-radius: 8px;
  background: rgba(114, 221, 255, 0.08);
  color: #d9ebfb;
  font-family: var(--mono);
  font-size: 0.86rem;
}

.problem-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 30px;
}

.problem-grid article {
  padding: 22px;
}

.problem-grid h3 {
  margin-bottom: 12px;
  font-size: 1.08rem;
}

.problem-grid p {
  margin-bottom: 0;
  font-size: 0.96rem;
}

.code-box {
  position: relative;
  overflow: hidden;
}

.code-box button {
  position: absolute;
  top: 12px;
  right: 12px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-family: var(--mono);
  cursor: pointer;
}

.code-box pre {
  margin: 0;
  padding: 24px;
  overflow-x: auto;
  color: #dce8f4;
  font-family: var(--mono);
  font-size: 0.86rem;
  line-height: 1.65;
}

@media (max-width: 940px) {
  main {
    width: min(100% - 28px, 720px);
  }

  .hero,
  .section-grid,
  .applications,
  .citation {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    padding-top: 48px;
  }

  h1 {
    max-width: 8ch;
  }

  .terminal-card {
    min-height: 420px;
  }

  #terminal-output {
    min-height: 378px;
  }

  .stats,
  .layer-track,
  .problem-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 620px) {
  main {
    width: min(100% - 24px, 520px);
  }

  h1 {
    font-size: clamp(3.25rem, 19vw, 5.1rem);
  }

  .stats,
  .layer-track,
  .problem-grid {
    grid-template-columns: 1fr;
  }

  .layer-card {
    min-height: auto;
  }

  .authors,
  .stats,
  .section-grid,
  .layers,
  .applications,
  .open-problems,
  .citation {
    margin-bottom: 68px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
