:root {
  --bg: #f5f3ed;
  --bg-soft: #fbfaf6;
  --ink: #1e2522;
  --muted: #66716b;
  --line: rgba(30, 37, 34, 0.14);
  --panel: #ffffff;
  --accent: #c65f4a;
  --accent-2: #2f8178;
  --accent-3: #d8a83f;
  --shadow: 0 18px 48px rgba(42, 48, 44, 0.12);
  --room-viewer-height: 560px;
  --room-viewer-height-tablet: 470px;
  --room-viewer-height-mobile: 390px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
}

.is-hidden {
  display: none !important;
}

.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: rgba(245, 243, 237, 0.9);
  backdrop-filter: blur(16px);
}

.nav-inner {
  width: min(1180px, calc(100% - 32px));
  min-height: 60px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.nav-brand {
  font-weight: 800;
  text-decoration: none;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 18px;
  color: var(--muted);
  font-size: 14px;
}

.nav-links a {
  text-decoration: none;
}

.nav-links a:hover {
  color: var(--ink);
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 76px 0 48px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("../../data/image/scene_041.png");
  background-size: cover;
  background-position: center;
  opacity: 0.22;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(245, 243, 237, 0.84);
}

.hero .section-shell {
  position: relative;
  z-index: 1;
}

.section {
  padding: 64px 0;
}

.section-alt {
  background: var(--bg-soft);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.section-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.narrow {
  max-width: 900px;
  margin: 0 auto;
}

.hero-title {
  margin: 0;
  font-size: 48px;
  line-height: 1.08;
  font-weight: 850;
  text-align: center;
}

.author-block {
  max-width: 1080px;
  margin: 18px auto 0;
  text-align: center;
  color: #26302b;
}

.author-list {
  margin: 0;
  font-size: 21px;
  line-height: 1.28;
  font-weight: 720;
  letter-spacing: 0;
}

.author-list span,
.affiliation-list span {
  display: inline-block;
}

.author-block sup {
  font-size: 0.58em;
  line-height: 0;
  vertical-align: super;
}

.affiliation-list {
  max-width: 900px;
  margin: 14px auto 0;
  color: #46524d;
  font-size: 15px;
  line-height: 1.45;
  letter-spacing: 0;
}

.affiliation-list span {
  margin: 0 8px;
}

.equal-contribution {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.hero-kicker,
.section-kicker {
  margin: 0 0 12px;
  color: var(--accent-2);
  font-weight: 800;
  text-align: center;
}

.hero-subtitle {
  max-width: 860px;
  margin: 22px auto 0;
  color: #3e4944;
  font-size: 18px;
  text-align: center;
}

.publication-note {
  margin-top: 18px;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 26px;
}

.pill-button {
  max-width: 100%;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 16px;
  background: var(--panel);
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
  box-shadow: 0 5px 18px rgba(42, 48, 44, 0.08);
  text-align: center;
}

.pill-button span:last-child {
  min-width: 0;
}

.pill-button.primary {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.pill-button:disabled,
.pill-button[aria-disabled="true"] {
  cursor: not-allowed;
  color: #8a928e;
  background: #ece9df;
}

.section-title {
  margin: 0;
  font-size: 32px;
  line-height: 1.16;
  text-align: center;
}

.section-copy {
  max-width: 840px;
  margin: 14px auto 0;
  color: var(--muted);
  text-align: center;
  font-size: 16px;
}

.prose {
  max-width: 900px;
  margin: 26px auto 0;
  color: #36413b;
  font-size: 16px;
}

.paper-figure {
  max-width: 1120px;
  margin: 0 auto;
}

.teaser-figure {
  max-width: 900px;
}

.paper-figure + .paper-figure {
  margin-top: 28px;
}

.paper-figure img {
  width: 100%;
  height: auto;
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.paper-figure .figure-caption {
  min-height: 0;
}

.teaser-carousel {
  margin-top: 30px;
  overflow: hidden;
}

.teaser-carousel-track {
  height: 420px;
  display: grid;
  grid-template-columns: 0.7fr minmax(0, 1.55fr) 0.7fr;
  align-items: center;
  gap: 18px;
}

.teaser-slide {
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 360ms ease, opacity 360ms ease;
}

.teaser-slide-preview {
  opacity: 0.48;
  cursor: pointer;
}

.teaser-slide-current {
  opacity: 1;
}

.teaser-slide-inner {
  width: 100%;
}

.teaser-image-shell {
  width: 100%;
  aspect-ratio: 14 / 9;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #e8e5dc;
  box-shadow: var(--shadow);
}

.teaser-slide-preview .teaser-image-shell {
  box-shadow: none;
}

.teaser-slide-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.teaser-slide-meta {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}

.teaser-slide-meta span {
  border-radius: 999px;
  padding: 5px 12px;
  background: rgba(47, 129, 120, 0.12);
  color: #1f625b;
  font-size: 13px;
  font-weight: 800;
}

.is-sliding-next .teaser-slide-current,
.is-sliding-prev .teaser-slide-current {
  transform: scale(0.985);
}

.figure-caption {
  max-width: 900px;
  min-height: 48px;
  margin: 14px auto 0;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

.viewer-toolbar {
  max-width: 920px;
  margin: 28px auto 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.select-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 10px;
}

.control-input,
.control-select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--panel);
  color: var(--ink);
}

.icon-button {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}

.icon-button:hover,
.icon-button.is-active {
  border-color: rgba(198, 95, 74, 0.42);
  background: rgba(198, 95, 74, 0.12);
}

.prompt-display {
  max-width: 920px;
  min-height: 54px;
  margin: 0 auto 18px;
  border-left: 4px solid var(--accent-2);
  border-radius: 8px;
  padding: 14px 16px;
  background: rgba(47, 129, 120, 0.09);
  color: #31423d;
  font-size: 14px;
}

.room-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
  gap: 20px;
  align-items: start;
}

.viewer-box {
  position: relative;
  min-height: var(--room-viewer-height);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f0eee7;
  box-shadow: var(--shadow);
}

.viewer-box canvas {
  display: block;
}

.progress-wrapper {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 12;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.92);
}

.progress-text {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
}

.progress-wrapper progress {
  width: 100%;
}

.viewer-controls {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 14;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.viewer-controls .icon-button {
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.92);
}

.show-all-button {
  width: auto;
  gap: 6px;
  padding: 0 10px;
}

.help-tooltip {
  position: absolute;
  top: 60px;
  right: 14px;
  z-index: 16;
  display: none;
  width: min(260px, calc(100% - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  color: #3b4641;
  font-size: 13px;
}

.help-tooltip.is-visible {
  display: block;
}

.help-tooltip ul {
  margin: 0;
  padding-left: 18px;
}

.side-stack {
  display: grid;
  gap: 18px;
  position: sticky;
  top: 84px;
  align-self: start;
  min-width: 0;
  max-height: min(var(--room-viewer-height), calc(100vh - 108px));
}

.tool-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 30px rgba(42, 48, 44, 0.08);
  overflow: hidden;
}

.side-stack .tool-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: auto;
  max-height: min(var(--room-viewer-height), calc(100vh - 108px));
}

.side-stack .tool-panel:has(.object-inspector:not(.is-hidden)) {
  height: min(var(--room-viewer-height), calc(100vh - 108px));
}

.tool-panel-header {
  flex: 0 0 auto;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfaf7;
}

.tool-panel-title {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
}

.tool-panel-body {
  padding: 16px;
}

.side-stack .tool-panel-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 14px;
}

.no-selection,
.code-empty {
  min-height: 100px;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
}

.object-inspector {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.code-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  background: rgba(47, 129, 120, 0.10);
  color: #236860;
  font-size: 12px;
  font-weight: 800;
}

.meta-mass {
  margin-top: 12px;
  border: 1px solid rgba(30, 37, 34, 0.10);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fbfaf7;
  color: #56635d;
  font-size: 14px;
  font-weight: 750;
}

.isolated-viewer-wrapper {
  position: relative;
  margin-top: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f3ef;
}

.isolated-viewer {
  width: 100%;
  height: 180px;
}

.merged-code-header {
  margin-top: 14px;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
}

.code-panel-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.code-toolbar {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  border: 1px solid rgba(30, 37, 34, 0.10);
  border-radius: 8px;
  padding: 8px;
  background: #fbfaf7;
}

.code-file-select {
  min-width: 0;
  flex: 1 1 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 9px;
  background: #fff;
}

.code-block {
  flex: 1 1 0;
  min-height: 120px;
  height: auto;
  margin: 0;
  overflow: auto;
  border: 1px solid rgba(30, 37, 34, 0.12);
  border-radius: 8px;
  padding: 14px;
  background: #1f2522;
  color: #f4f1e7;
  font-size: 12px;
  line-height: 1.55;
  tab-size: 2;
  white-space: pre;
}

.viewer-shell {
  height: 640px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #d5d8d7;
  box-shadow: var(--shadow);
}

.viewer-shell iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
}

.bibtex-box {
  max-width: 900px;
  margin: 24px auto 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.bibtex-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfaf7;
}

.bibtex-code {
  min-height: 110px;
  margin: 0;
  padding: 18px;
  color: var(--muted);
  background: #ffffff;
}

.footer {
  padding: 28px 0;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

.drag-hint {
  position: absolute;
  left: 50%;
  bottom: 18px;
  z-index: 12;
  transform: translateX(-50%);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.92);
  color: #3d4842;
  font-size: 13px;
  pointer-events: none;
  box-shadow: 0 6px 18px rgba(42, 48, 44, 0.12);
}

@media (max-width: 980px) {
  .room-layout {
    grid-template-columns: 1fr;
  }

  .side-stack,
  .side-stack .tool-panel {
    position: static;
    height: auto;
    max-height: none;
  }

  .side-stack .tool-panel:has(.object-inspector:not(.is-hidden)) {
    height: auto;
  }

  .viewer-toolbar {
    grid-template-columns: 1fr;
  }

  .teaser-carousel-track {
    height: auto;
    grid-template-columns: 1fr;
  }

  .teaser-slide-preview {
    display: none;
  }

  .viewer-box {
    min-height: var(--room-viewer-height-tablet);
  }

  .isolated-viewer {
    height: 200px;
  }

  .code-block {
    flex: 0 0 260px;
    min-height: 200px;
    height: 260px;
  }
}

@media (max-width: 680px) {
  .nav-inner {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 0;
    gap: 8px;
  }

  .nav-links {
    width: 100%;
    justify-content: flex-start;
    gap: 8px;
    font-size: 13px;
  }

  .hero {
    padding-top: 48px;
  }

  .hero-title {
    font-size: 34px;
  }

  .author-block {
    margin-top: 18px;
  }

  .author-list {
    font-size: 18px;
  }

  .affiliation-list,
  .equal-contribution {
    font-size: 13px;
  }

  .affiliation-list {
    margin-top: 12px;
  }

  .section {
    padding: 44px 0;
  }

  .viewer-box {
    min-height: var(--room-viewer-height-mobile);
  }

  .side-stack .tool-panel-body {
    padding: 12px;
  }

  .isolated-viewer {
    height: 180px;
  }

  .code-block {
    flex-basis: 220px;
    height: 220px;
    min-height: 180px;
    font-size: 11px;
  }

  .viewer-controls {
    left: 10px;
    right: 10px;
  }

  .viewer-shell {
    height: 560px;
  }
}
