:root {
  color-scheme: light;
  --sidebar-width: 274px;
  --page-bg: #f7f7f3;
  --surface: #ffffff;
  --surface-soft: #f0f2ed;
  --text: #202421;
  --muted: #626b65;
  --line: #d9ddd7;
  --line-strong: #aeb8b1;
  --accent: #5b5b59;
  --accent-soft: #e9e9e6;
  --warm: #b75e35;
  --link: #245fa8;
  --sidebar-bg: #fafbf8;
  --sidebar-hover: #ebefea;
  --shadow: 0 12px 32px rgba(28, 35, 31, 0.11);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 40px;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--page-bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
  transition: background-color 180ms ease, color 180ms ease;
}

body.dark-mode {
  color-scheme: dark;
  --page-bg: #151615;
  --surface: #1e201f;
  --surface-soft: #242725;
  --text: #eceeea;
  --muted: #a5aaa6;
  --line: #353936;
  --line-strong: #565d58;
  --accent: #c5c5c2;
  --accent-soft: #2d2d2b;
  --warm: #c9a474;
  --link: #78aee8;
  --sidebar-bg: #1a1c1b;
  --sidebar-hover: #272a28;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.32);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

.icon-button {
  position: fixed;
  top: 22px;
  z-index: 40;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: var(--shadow);
  color: var(--text);
  cursor: pointer;
  font-size: 20px;
  transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease,
    transform 160ms ease;
}

.icon-button:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.icon-button:focus-visible,
.sidebar-close:focus-visible,
.sidebar-link:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 42%, transparent);
  outline-offset: 3px;
}

.sidebar-toggle {
  left: 22px;
  z-index: 60;
}

.theme-toggle {
  right: 22px;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  width: min(var(--sidebar-width), 86vw);
  padding: 78px 18px 24px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: var(--sidebar-bg);
  box-shadow: var(--shadow);
  transform: translateX(-104%);
  transition: transform 220ms ease, background-color 180ms ease;
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar-header {
  display: flex;
  min-height: 68px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 4px 18px;
  border-bottom: 1px solid var(--line);
}

.sidebar-kicker,
.sidebar-title {
  margin: 0;
  letter-spacing: 0;
}

.sidebar-kicker {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
}

.sidebar-title {
  margin-top: 4px;
  font-size: 1.2rem;
  font-weight: 700;
}

.sidebar-close {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 25px;
  line-height: 1;
}

.sidebar-close:hover {
  background: var(--sidebar-hover);
  color: var(--text);
}

.sidebar-nav {
  display: grid;
  gap: 6px;
  padding-top: 18px;
}

.sidebar-link {
  position: relative;
  display: block;
  min-height: 44px;
  padding: 11px 14px 11px 18px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.35;
  text-decoration: none;
  transition: background-color 150ms ease, color 150ms ease;
}

.sidebar-link::before {
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 0;
  width: 3px;
  border-radius: 2px;
  background: transparent;
  content: "";
}

.sidebar-link:hover {
  background: var(--sidebar-hover);
  color: var(--text);
}

.sidebar-link.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.sidebar-link.active::before {
  background: var(--accent);
}

.page-shell {
  min-height: 100vh;
}

.hero {
  display: grid;
  min-height: 0;
  place-items: center;
  padding: 56px 30px 12px;
}

.hero-inner {
  display: grid;
  width: min(100%, 1100px);
  gap: 14px;
  text-align: center;
}

.paper-title {
  max-width: 1000px;
  margin: 0 auto;
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1.28rem;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.35;
}

.paper-title strong {
  font-weight: 700;
}

.paper-meta {
  display: grid;
  gap: 4px;
  width: min(100%, 1020px);
  margin: 0 auto;
}

.paper-authors,
.paper-affiliations {
  margin: 0;
}

.paper-authors {
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.45;
}

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

.paper-authors a:hover,
.paper-authors a:focus-visible {
  text-decoration-thickness: 2px;
}

.paper-authors sup,
.paper-affiliations sup {
  margin-left: 1px;
  font-size: 0.68em;
  line-height: 0;
}

.paper-affiliations {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px 14px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

.paper-actions {
  display: flex;
  min-height: 42px;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.paper-action {
  display: inline-flex;
  min-width: 112px;
  height: 42px;
  padding: 0 20px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  user-select: none;
}

.paper-action-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  object-fit: contain;
}

body.dark-mode .github-icon {
  filter: invert(1);
}

a.paper-action {
  transition: border-color 160ms ease, background-color 160ms ease;
}

a.paper-action:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}

.content-section {
  width: min(calc(100% - 60px), 1100px);
  min-height: 460px;
  margin: 0 auto;
  padding: 26px 0 90px;
}

.section-heading {
  display: flex;
  align-items: baseline;
  gap: 18px;
  margin-bottom: 28px;
}

.section-heading h2,
.section-index {
  margin: 0;
  letter-spacing: 0;
}

.section-heading h2 {
  font-size: 1.55rem;
  line-height: 1.25;
}

.section-index {
  color: var(--warm);
  font-size: 0.78rem;
  font-weight: 700;
}

.method-section {
  min-height: 0;
  padding-top: 14px;
  padding-bottom: 28px;
}

.method-section .section-heading {
  margin-bottom: 16px;
}

.method-figures {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(100%, 860px);
  margin: 0 auto;
  align-items: start;
  gap: 14px;
}

.method-figures-single {
  grid-template-columns: 1fr;
}

.method-figures-single .method-figure {
  width: min(100%, 780px);
  margin: 0 auto;
}

.method-figure {
  display: grid;
  grid-template-rows: 300px auto;
  gap: 8px;
  margin: 0;
}

.method-figure-image {
  display: block;
  width: 100%;
  height: 300px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  object-fit: contain;
}

.method-figure figcaption {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
  text-align: center;
}

.audio-section {
  padding-top: 10px;
}

.samples-stage {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.sample-card {
  display: grid;
  grid-template-rows: minmax(3.1em, auto) auto auto;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 5px 18px rgba(28, 35, 31, 0.06);
}

.sample-caption {
  margin: 0;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.5;
}

.sample-spectrum {
  display: block;
  width: 100%;
  aspect-ratio: 4.2 / 1;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #181716;
  object-fit: cover;
}

.sample-card audio {
  display: block;
  width: 100%;
  height: 38px;
  color-scheme: light;
}

body.dark-mode .sample-card {
  box-shadow: none;
}

body.dark-mode .sample-card audio {
  color-scheme: dark;
}

@media (min-width: 760px) {
  .paper-title {
    font-size: 1.65rem;
  }
}

@media (min-width: 1180px) {
  .paper-title {
    font-size: 1.75rem;
  }
}

@media (max-width: 759px) {
  .icon-button {
    top: 16px;
    width: 40px;
    height: 40px;
  }

  .sidebar-toggle {
    left: 16px;
  }

  .theme-toggle {
    right: 16px;
  }

  .hero {
    min-height: 0;
    padding: 76px 20px 16px;
  }

  .paper-title {
    font-size: 1.22rem;
    line-height: 1.4;
  }

  .paper-actions {
    gap: 8px;
  }

  .paper-authors {
    font-size: 0.78rem;
  }

  .paper-affiliations {
    gap: 2px 10px;
    font-size: 0.68rem;
  }

  .paper-action {
    min-width: 96px;
    height: 40px;
    padding: 0 14px;
    font-size: 0.8rem;
  }

  .content-section {
    width: min(calc(100% - 40px), 1100px);
  }

  .content-section {
    min-height: 400px;
    padding: 26px 0 70px;
  }

  .section-heading {
    gap: 12px;
  }

  .section-heading h2 {
    font-size: 1.3rem;
  }

  .samples-stage {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .sample-card {
    grid-template-rows: auto auto auto;
    padding: 14px;
  }

  .sample-caption {
    min-height: 0;
  }

  .method-figures {
    grid-template-columns: 1fr;
  }

  .method-figure {
    grid-template-rows: 240px auto;
  }

  .method-figure-image {
    height: 240px;
  }
}

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