:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --text: #202938;
  --muted: #667085;
  --faint: #98a2b3;
  --line: #e4e7ec;
  --link: #1d5f8a;
  --link-bg: #eef6fa;
  --header-height: 56px;
  --page-width: 980px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111418;
  --surface: #151a20;
  --text: #f2f4f7;
  --muted: #c1c7d0;
  --faint: #858d9a;
  --line: #2d3540;
  --link: #8ecae6;
  --link-bg: #172b36;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 24px);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.62;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover,
a:focus-visible {
  color: var(--text);
}

img {
  display: block;
  max-width: 100%;
}

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

h1 {
  margin-bottom: 6px;
  font-size: clamp(2.1rem, 4.4vw, 3.1rem);
  font-weight: 750;
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 750;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 4px;
  font-size: 1.02rem;
  font-weight: 750;
  line-height: 1.35;
  letter-spacing: 0;
}

p {
  color: var(--muted);
}

strong {
  font-weight: 760;
}

.page {
  width: min(calc(100% - 42px), var(--page-width));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 100;
  transform: translateY(-140%);
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 0.9rem;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header-height);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(10px);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  gap: 24px;
}

.brand {
  color: var(--text);
  font-weight: 750;
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
}

.nav-links a,
.theme-toggle {
  color: var(--muted);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 650;
  text-decoration: none;
}

.theme-toggle {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.nav-links a:hover,
.nav-links a:focus-visible,
.nav-links a[aria-current="page"],
.theme-toggle:hover,
.theme-toggle:focus-visible {
  color: var(--text);
}

.nav-toggle {
  display: none;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 4px auto;
  background: var(--text);
}

.intro {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 38px;
  padding: 58px 0 50px;
}

.portrait {
  width: 180px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border: 1px solid var(--line);
}

.kicker,
.venue {
  margin-bottom: 6px;
  color: var(--faint);
  font-size: 0.88rem;
  font-weight: 750;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.affiliation {
  margin-bottom: 18px;
  color: var(--text);
  font-size: 1.08rem;
}

.bio {
  max-width: 680px;
  margin-bottom: 10px;
}

.advisor {
  max-width: 680px;
  margin-bottom: 18px;
}

.page-hero {
  max-width: 720px;
  padding: 58px 0 50px;
}

.page-hero p:last-child {
  margin-bottom: 0;
}

.link-row,
.paper-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.link-row a,
.paper-links a,
.paper-links span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--link);
  font-size: 0.88rem;
  font-weight: 650;
  text-decoration: none;
}

.link-row a:hover,
.link-row a:focus-visible,
.paper-links a:hover,
.paper-links a:focus-visible {
  background: var(--link-bg);
  color: var(--text);
}

.paper-links span {
  color: var(--faint);
}

.section {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 34px;
  padding: 34px 0;
  border-top: 1px solid var(--line);
}

.section-body {
  min-width: 0;
}

.paper,
.entry {
  padding-bottom: 26px;
}

.paper + .paper,
.entry + .entry {
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.paper:last-child,
.entry:last-child {
  padding-bottom: 0;
}

.paper {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.paper-main {
  min-width: 0;
}

.authors,
.summary {
  max-width: 760px;
  margin-bottom: 8px;
}

.authors {
  color: var(--text);
}

.paper-figure {
  margin: 6px 0 0;
  max-width: 520px;
}

.paper-figure img {
  width: 100%;
  border: 1px solid var(--line);
  background: #ffffff;
}

.paper-figure figcaption {
  margin-top: 8px;
  color: var(--faint);
  font-size: 0.88rem;
}

.entry {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 24px;
}

.entry time {
  color: var(--faint);
  font-size: 0.92rem;
  font-weight: 650;
}

.entry p {
  margin-bottom: 0;
}

.note-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.note {
  min-height: 168px;
  padding: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.note h3 {
  margin-bottom: 10px;
}

.note p:last-child,
.contact-intro {
  margin-bottom: 0;
}

.contact-intro {
  color: var(--muted);
}

.contact-form {
  display: grid;
  gap: 12px;
  max-width: 560px;
  margin-top: 16px;
}

.contact-form label {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 650;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  padding: 9px 10px;
}

.contact-form textarea {
  resize: vertical;
}

.contact-form button {
  justify-self: start;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--link);
  cursor: pointer;
  font: inherit;
  font-weight: 650;
}

.contact-form button:hover,
.contact-form button:focus-visible {
  background: var(--link-bg);
  color: var(--text);
}

.contact-form button:disabled {
  cursor: progress;
  opacity: 0.65;
}

.contact-status {
  min-height: 1.2em;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.contact-note {
  margin: 12px 0 0;
  color: var(--faint);
  font-size: 0.9rem;
}

.game-panel {
  max-width: 760px;
}

.game-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  color: var(--muted);
}

.game-status button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--link);
  cursor: pointer;
  font: inherit;
  font-weight: 650;
}

.runner-stage {
  position: relative;
}

.runner-canvas {
  display: block;
  width: 100%;
  aspect-ratio: 19 / 9;
  border: 1px solid var(--line);
  background: var(--surface);
  touch-action: none;
}

.runner-controls {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.runner-controls button {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--link);
  cursor: pointer;
  font: inherit;
  font-weight: 650;
}

.game-message {
  margin: 12px 0 0;
  color: var(--muted);
}

.score-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  margin-top: 16px;
}

.score-form-overlay {
  position: absolute;
  left: 50%;
  bottom: 22px;
  z-index: 2;
  width: min(420px, calc(100% - 28px));
  padding: 14px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: 0 18px 48px rgba(32, 41, 56, 0.16);
  transform: translateX(-50%);
}

.score-form[hidden] {
  display: none;
}

.score-form label {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 650;
}

.score-form input {
  min-height: 32px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  padding: 0 9px;
}

.score-form button {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--link);
  cursor: pointer;
  font: inherit;
  font-weight: 650;
}

.high-score-board {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.high-score-board h3 {
  margin-bottom: 10px;
}

.high-score-board ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
  color: var(--muted);
}

.high-score-board li::marker {
  color: var(--faint);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 0 42px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 0.9rem;
}

.site-footer p {
  margin: 0;
  color: inherit;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

html.js .reveal {
  opacity: 1;
  transform: none;
}

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

@media (max-width: 820px) {
  .page {
    width: min(calc(100% - 28px), var(--page-width));
  }

  .nav-toggle {
    display: block;
  }

  .nav-links {
    position: absolute;
    top: calc(100% + 8px);
    right: 14px;
    left: 14px;
    display: grid;
    gap: 2px;
    padding: 10px;
    border: 1px solid var(--line);
    background: var(--surface);
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity 140ms ease, transform 140ms ease;
  }

  .nav-links.is-open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .nav-links a,
  .theme-toggle {
    display: flex;
    min-height: 36px;
    align-items: center;
  }

  .intro,
  .section,
  .entry {
    grid-template-columns: 1fr;
  }

  .intro {
    gap: 24px;
    padding-top: 42px;
  }

  .portrait {
    width: 156px;
  }

  .section {
    gap: 18px;
    padding: 30px 0;
  }

  .note-grid {
    grid-template-columns: 1fr;
  }

  .paper-figure {
    max-width: 100%;
  }
}

@media (max-width: 520px) {
  h1 {
    font-size: 2.15rem;
  }

  .link-row,
  .paper-links {
    gap: 6px;
  }

}
