body {
  font-family: 'Noto Sans', sans-serif;
}

.section {
  padding: 2rem 1.5rem;
}

.publication-title,
.publication-authors {
  font-family: 'Google Sans', sans-serif;
}

.publication-authors a {
  color: hsl(204, 86%, 53%) !important;
}

.publication-authors a:hover {
  text-decoration: underline;
}

.author-block {
  display: inline-block;
}

/* Link buttons, in the style of the publication list on zelinshen.github.io (al-folio):
   thin outlined pills, dashed and muted while a link is still to come. */
.publication-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem 0.5rem;
  margin: 1rem 0 0.25rem;
}

.pub-btn {
  display: inline-block;
  padding: 0.25rem 1rem;
  border: 1px solid #000;
  border-radius: 0.25rem;
  font-family: 'Google Sans', sans-serif;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #000;
  background: transparent;
  text-decoration: none;
  white-space: nowrap;
}

a.pub-btn:hover {
  color: #0d57a1;
  border-color: #0d57a1;
}

.pub-btn.coming-soon {
  color: #828282;
  border-color: #828282;
  border-style: dashed;
  cursor: default;
}

.org-logos {
  margin-top: 1.5rem;
  gap: 2.5rem;
}

.org-logos .column {
  display: flex;
  align-items: center;
  justify-content: center;
}

.org-logo {
  height: 55px;
  width: auto;
  object-fit: contain;
}

.org-logo.arcad-logo {
  height: 85px;
}

/* Interactive demo */

.demo-prompt {
  padding: 0.75rem 1rem;
  border-left: 4px solid #ffcb05;
  border-radius: 4px;
  background: #fff9e3;
}

.demo-prompt kbd {
  display: inline-block;
  min-width: 1.4em;
  padding: 0 0.3em;
  border: 1px solid #c8c8c8;
  border-bottom-width: 2px;
  border-radius: 4px;
  background: #fff;
  font-family: 'Google Sans', sans-serif;
  font-size: 0.85em;
  text-align: center;
}

.demo-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background: #e9eef4;
  outline: none;
}

.demo-viewport:focus-visible {
  box-shadow: 0 0 0 3px rgba(0, 39, 76, 0.35);
}

/* Absolutely positioned so the drawing buffer size never feeds back into the layout. */
.demo-viewport canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100% !important;
  height: 100% !important;
  touch-action: none;
}

.demo-status {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  text-align: center;
  color: #4a4a4a;
  background: rgba(233, 238, 244, 0.9);
  white-space: pre-line;
}

.demo-hint {
  position: absolute;
  right: 10px;
  bottom: 8px;
  z-index: 2;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 0.75rem;
  color: #4a4a4a;
  background: rgba(255, 255, 255, 0.8);
  pointer-events: none;
}

.demo-readout {
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  background: #f5f6f8;
  font-size: 0.9rem;
}

.demo-readout > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.demo-readout .label-text {
  color: #7a7a7a;
}

.demo-readout .value {
  font-family: 'Google Sans', sans-serif;
  font-variant-numeric: tabular-nums;
  color: #00274c;
  font-weight: 600;
}

/* Direction pad: a 3 x 2 grid of key buttons */
.demo-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.demo-pad .button {
  margin: 0;
  font-family: 'Google Sans', sans-serif;
  font-weight: 600;
  border: 2px solid #00274c;
  color: #00274c;
  user-select: none;
}

.demo-pad .button:hover,
.demo-pad .button:active {
  background: #00274c;
  color: #fff;
}

.demo-actions {
  margin-bottom: 0.25rem !important;
}

.demo-actions .button {
  flex: 1 1 auto;
  font-weight: 600;
  user-select: none;
}

.demo-actions .button.is-active-mode {
  background: #00274c;
  border-color: #00274c;
  color: #fff;
}

.demo-buttons {
  margin-top: 0.25rem;
}

.demo-keys {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: #7a7a7a;
  line-height: 1.4;
}

.footer {
  padding: 2rem 1.5rem;
}

/* Plain model preview below the original publication title and links. */
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.publication-title .title-break { display: none; }
@media (min-width: 1024px) { .publication-title { font-size: 2.25rem !important; } .publication-title .title-break { display: inline; } }
@media (min-width: 1216px) { .publication-title { font-size: 2.7rem !important; } }
.hero-composition { position: relative; height: clamp(500px, 70svh, 760px); overflow: hidden; background: transparent; }
.robot-view { position: absolute; inset: 0; }
.robot-view canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; pointer-events: none; }
.robot-poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
@media (max-width: 768px) { .hero-composition { height: clamp(380px, 128vw, 500px); } }
/* Review-only controls, visible exclusively with ?cameraSetup=1. */
.camera-setup { position: absolute; z-index: 5; top: 1rem; right: 1rem; width: min(290px, calc(100% - 2rem)); padding: 1rem; border: 1px solid #b4c3cf; border-radius: 6px; background: rgba(255,255,255,.96); color: #00274c; font: .78rem/1.5 'Google Sans', sans-serif; box-shadow: 0 4px 24px #00274c12; }
.camera-setup p { margin: .5rem 0; }
.camera-setup button { margin-right: .4rem; padding: .4rem .6rem; border: 1px solid #8ca1b1; border-radius: 3px; background: white; color: #00274c; cursor: pointer; }
.camera-setup textarea { width: 100%; height: 130px; margin: .5rem 0; font: 10px monospace; }
@media(max-width: 768px) { .camera-setup { top: .5rem; right: .5rem; width: 250px; padding: .65rem; font-size: .7rem; } }

/* Keep the publication header centered as one unit; only its lower logo area overlaps. */
/* The header holds still on screen while the robot and then the demo section scroll over it.
   Sticky positioning runs in the browser's scroller, so it never lags behind the scroll the way a
   script-set offset does. A sticky element can't leave its parent's content box (padding doesn't
   count), so an empty block runs the hero on for --hero-hold beneath the demo section (matched by
   a negative margin on #demo): the header stays pinned until the demo section has covered it. */
.publication-hero { --hero-hold: 100vh; position: relative; isolation: isolate; }
.publication-hero::after { content: ''; display: block; flex: none; height: var(--hero-hold); }
.publication-hero > .hero-body { position: sticky; top: 0; z-index: 2; padding-bottom: 0; }
#demo { margin-top: calc(-1 * var(--hero-hold, 100vh)); }
.publication-hero > .hero-composition { z-index: 3; margin-top: -48px; pointer-events: none; }
.publication-meta .org-logos { display: flex; flex-direction: row; flex-wrap: nowrap; align-items: center; justify-content: center; gap: 1.5rem; margin-bottom: 0; }
.publication-meta .org-logos .column { flex: 0 1 auto; min-width: 0; padding: .5rem; }
.publication-meta .org-logo { display: block; max-width: 100%; height: 55px; width: auto; }
.publication-meta .org-logo.arcad-logo { height: 65px; }
@media (max-width: 768px) {
  .publication-hero > .hero-body { padding-bottom: .25rem; }
  .publication-hero > .hero-composition { margin-top: 0; }
  .publication-meta .org-logos { gap: .5rem; margin-top: 1rem; }
  .publication-meta .org-logo { height: auto; max-height: 32px; width: 100%; max-width: 155px; }
  .publication-meta .org-logo.arcad-logo { height: auto; max-height: 40px; max-width: 150px; }
}

@media (max-width: 480px) {
  .publication-title { font-size: clamp(1.8rem, 8vw, 2.25rem) !important; line-height: 1.16; }
}
/* Scale the poster the way fitCamera() frames the live model, never stretching it:
   desktop fits the height and centers (sides crop), phones fit the width from the top. */
.robot-poster img { position: absolute; top: 0; left: 50%; display: block; width: auto; height: 100%; max-width: none; transform: translateX(-50%); }
@media (max-width: 768px) { .robot-poster img { left: 0; width: 100%; height: auto; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .publication-hero > .hero-body, .publication-hero > .hero-composition { translate: none !important; }
}

/* The next section is an opaque foreground sheet over the slower scrolling hero layers. */
.publication-hero { z-index: 0; }
#demo { position: relative; z-index: 3; background: #fff; }
.footer { position: relative; z-index: 3; }

/* The incoming simulation section owns the fade; the robot scrolls behind this edge. */
#demo::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: clamp(56px, 8vw, 100px);
  background: linear-gradient(to bottom, rgba(255,255,255,0), #fff);
  pointer-events: none;
}
.demo-status { flex-direction: column; gap: 1rem; }
.demo-status[hidden] { display: none; }
.demo-profile { margin-top: .75rem; font-size: .75rem; color: #526473; }
.demo-profile summary { cursor: pointer; }
.demo-profile pre { margin-top: .5rem; padding: .75rem; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .7rem; }
#demo-start[hidden] { display: none; }

/* Click the view to take control (pointer lock); the outline shows when it has the controls. */
.demo-viewport canvas { cursor: pointer; }
.demo-viewport.is-controlling { box-shadow: 0 0 0 3px rgba(0, 39, 76, 0.55); }

/* Under the view, gamepad style: walk stick left, action buttons in the middle, turn stick right. */
.demo-controls {
  display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: 'move actions look';
  align-items: center; gap: 1rem; margin-top: 0.75rem; padding-bottom: 1.4rem;
}
#demo-stick-move { grid-area: move; }
#demo-stick-look { grid-area: look; }
.demo-controls .demo-actions {
  grid-area: actions; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4rem; margin: 0 !important;
}
.demo-controls .demo-actions .button { flex: 0 1 auto; margin: 0; }
.demo-stick {
  position: relative; width: 104px; height: 104px; flex: none; border-radius: 50%;
  background: #f5f6f8; border: 2px solid #c9d3dd; touch-action: none; user-select: none; -webkit-user-select: none;
  cursor: grab;
}
.demo-stick.is-active { border-color: #00274c; cursor: grabbing; }
.demo-stick-knob {
  position: absolute; left: 50%; top: 50%; width: 42px; height: 42px; margin: -21px 0 0 -21px; border-radius: 50%;
  background: #00274c; box-shadow: 0 2px 6px rgba(0, 39, 76, 0.3); pointer-events: none;
}
.demo-stick:not(.is-active) .demo-stick-knob { transition: transform 0.12s ease-out; }
.demo-stick-label {
  position: absolute; left: 0; right: 0; bottom: -1.35rem; text-align: center; font-size: 0.75rem; color: #7a7a7a;
  pointer-events: none;
}
/* Narrow phones: both sticks on one row, the buttons on a row of their own beneath. */
@media (max-width: 480px) {
  .demo-controls { grid-template-columns: auto 1fr auto; grid-template-areas: 'move . look' 'actions actions actions'; row-gap: 2rem; padding-bottom: 0; }
}

/* A short key -> action list instead of prose. Touch screens get the joystick version. */
.demo-howto { margin-bottom: 0.75rem; padding: 0.6rem 0.75rem; border-radius: 8px; border: 1px solid #e3e8ee; font-size: 0.85rem; }
.demo-howto-title { margin: 0 0 0.4rem !important; font-weight: 600; color: #00274c; }
.demo-howto-list { display: grid; grid-template-columns: auto 1fr; gap: 0.3rem 0.75rem; align-items: center; margin: 0 !important; }
.demo-howto-list dt { white-space: nowrap; color: #4a4a4a; font-weight: 400; }
.demo-howto-list dd { margin: 0 !important; color: #7a7a7a; }
.demo-howto kbd {
  display: inline-block; min-width: 1.5em; margin-right: 2px; padding: 0 0.3em; border: 1px solid #c8c8c8;
  border-bottom-width: 2px; border-radius: 4px; background: #fff; font: 600 0.72rem/1.5 'Google Sans', sans-serif;
  text-align: center; color: #363636;
}
.demo-howto-note { margin: 0.5rem 0 0 !important; font-size: 0.75rem; color: #9a9a9a; line-height: 1.35; }
.demo-howto .for-touch { display: none; }
@media (hover: none) and (pointer: coarse) {
  .demo-howto .for-touch { display: grid; }
  .demo-howto .for-pointer { display: none; }
}

/* Full-width playground. The view spans the page (with a gutter) and the readout, the controls
   card and Play/Reset float over its corners; on phones they stack beneath, joysticks first. */
.demo-wide { margin-top: 1.25rem; }  /* the section padding (1.5rem) is the only side gutter */
.demo-stage { position: relative; }
.demo-wide .demo-viewport { max-height: calc(100vh - 140px); min-height: 300px; }
.demo-wide .demo-profile { margin-top: 0.5rem; }
.demo-howto > summary { cursor: pointer; list-style: none; }
.demo-howto > summary::-webkit-details-marker { display: none; }
.demo-howto > summary::after { content: ' \25BE'; color: #7a7a7a; }
.demo-howto:not([open]) > summary::after { content: ' \25B8'; }
.demo-howto:not([open]) > summary { margin-bottom: 0 !important; }
@media (min-width: 769px) {
  .demo-hud { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
  .demo-hud > * {
    position: absolute; margin: 0 !important; pointer-events: auto;
    background: rgba(255, 255, 255, 0.82); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    box-shadow: 0 2px 10px rgba(0, 39, 76, 0.08);
  }
  .demo-hud-readout { top: 12px; left: 12px; width: 230px; font-size: 0.82rem; }
  .demo-hud .demo-howto { top: 12px; right: 12px; width: 290px; max-height: calc(100% - 64px); overflow: auto; border: 0; }
  .demo-hud-buttons { left: 12px; bottom: 10px; padding: 4px; border-radius: 999px; }
  .demo-hud-buttons .button { margin-bottom: 0 !important; }
}
@media (max-width: 768px) {
  .demo-wide { display: flex; flex-direction: column; }
  .demo-stage { display: contents; }
  .demo-wide .demo-viewport { order: 1; min-height: 0; }
  .demo-wide .demo-controls { order: 2; }
  .demo-hud { order: 3; margin-top: 0.5rem; }
  .demo-wide .demo-profile { order: 4; }
}

/* Loading screen modelled on the PS5 welcome screen, on a light backdrop. The backdrop, spotlight and
   bokeh are a three.js scene on the canvas underneath (static/js/demo/intro.js); this overlay is
   transparent and carries only what must stay crisp: one thin line of text, a ringed emblem that
   pulses, and a thin progress bar with a light sweep. */
.demo-status.is-loading { background: transparent; color: #00274c; transition: opacity 0.45s ease; }
.demo-status.is-loading > #demo-status-text, .demo-status.is-loading > #demo-start { display: none; }
.demo-status.is-fading { opacity: 0; }
.demo-loader {
  width: min(360px, 70%); margin-top: -2%;
  display: flex; flex-direction: column; align-items: center; gap: 1.5rem;
}
.demo-loader[hidden] { display: none; }
.demo-loader-label {
  margin: 0 !important; font: 300 0.95rem/1.2 'Google Sans', 'Noto Sans', sans-serif; letter-spacing: 0.03em;
  color: #2c3e52; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}
/* A frosted disc with a navy monogram; two thin rings pulse outwards like the PS button. */
.demo-loader-emblem {
  position: relative; width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 28%, #ffffff 0%, #f3f6f9 55%, #e4eaf1 100%);
  color: #00274c; font: 500 1.45rem/1 'Google Sans', sans-serif;
  box-shadow: inset 0 0 0 1px rgba(0, 39, 76, 0.14), 0 0 0 6px rgba(255, 255, 255, 0.55),
              0 0 0 7px rgba(0, 39, 76, 0.10), 0 10px 30px rgba(0, 39, 76, 0.16);
}
.demo-loader-emblem::before, .demo-loader-emblem::after {
  content: ''; position: absolute; inset: -7px; border-radius: 50%; border: 1.5px solid rgba(0, 39, 76, 0.28);
  animation: demo-loader-ring 2.6s cubic-bezier(.2, .6, .3, 1) infinite;
}
.demo-loader-emblem::after { animation-delay: 1.3s; }
@keyframes demo-loader-ring { from { transform: scale(1); opacity: 0.85; } to { transform: scale(1.8); opacity: 0; } }
.demo-loader-bar { width: 100%; display: flex; align-items: center; gap: 0.75rem; margin-top: 1rem; }
.demo-loader-track {
  position: relative; flex: 1; height: 2px; border-radius: 999px; overflow: hidden; background: rgba(0, 39, 76, 0.12);
}
.demo-loader-fill {
  position: absolute; inset: 0; transform-origin: left center; transform: scaleX(0); border-radius: inherit;
  background: linear-gradient(90deg, #00274c 0%, #1f6fe0 70%, #7ab6ff 100%);
  box-shadow: 0 0 6px rgba(31, 111, 224, 0.55), 0 0 14px rgba(31, 111, 224, 0.25);
}
.demo-loader-fill::after {
  content: ''; position: absolute; inset: 0; width: 30%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.9), transparent);
  animation: demo-loader-sweep 1.8s ease-in-out infinite;
}
@keyframes demo-loader-sweep { from { transform: translateX(-120%); } to { transform: translateX(400%); } }
.demo-loader-pct {
  min-width: 2.6em; text-align: right; font: 400 0.75rem/1 'Google Sans', sans-serif; color: #526473;
  font-variant-numeric: tabular-nums;
}
@media (prefers-reduced-motion: reduce) {
  .demo-loader-fill::after, .demo-loader-emblem::before, .demo-loader-emblem::after { animation: none; display: none; }
  .demo-status.is-loading { transition: none; }
}
/* While loading, only the How-to card stays over the view (something to read while waiting). */
.demo-stage:has(.demo-status.is-loading) .demo-hud-readout,
.demo-stage:has(.demo-status.is-loading) .demo-hud-buttons { visibility: hidden; }
/* Before Play the particle scene is already running underneath: no panel, just the prompt and button. */
.demo-status.is-idle { background: transparent; }
.demo-status.is-idle > #demo-status-text {
  font: 300 0.95rem/1.3 'Google Sans', 'Noto Sans', sans-serif; letter-spacing: 0.03em; color: #2c3e52;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}
.demo-status.is-idle > #demo-start { box-shadow: 0 8px 24px rgba(0, 39, 76, 0.18); }
