/*
  Responsive breakpoints (same names as Tailwind):
    base  < 640px   phones
    sm   >= 640px
    md   >= 768px   tablets
    lg   >= 1024px  laptops
    xl   >= 1280px  desktops
    2xl  >= 1536px  large monitors
  Every size below is in rem, so changing the root font size at each breakpoint
  scales text, spacing and controls together.
*/

:root {
  --ink: #111111;
  --ink-2: #3c3c43;
  --muted: #86868b;
  --line: #ececec;
  --bg: #ffffff;
  --panel: #f5f5f4;

  /* palette from Fig. 1 (green is the main color) */
  --green: #648A42;
  --green-ink: #4E6C34;
  --green-tint: #f1f5ec;
  --pink: #F06C78;
  --pink-2: #F8929C;
  --pink-3: #F9C3CB;
  --cream: #F5E7B8;
  --green-2: #839A5A;
  --pink-ink: #C24A58;    /* darker strawberry for small text (contrast) */
  --pink-tint: #FDF0F2;

  --font-body: "Inter Tight", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-title: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --maxw: 100%;          /* content width cap, raised at each breakpoint */
  --gutter: 1.25rem;     /* side margin */
  --gap: 1.25rem;
  --h1: 2rem;
  --h2: 1.6rem;
  --top: 5rem;           /* space above the title */
}

html { font-size: 17px; scroll-behavior: smooth; }
@media (min-width: 640px)  { html { font-size: 18px; } :root { --gutter: 2rem;   --h1: 2.3rem; --top: 6rem; } }
@media (min-width: 768px)  { html { font-size: 18px; } :root { --maxw: 720px;  --gap: 1.5rem; --h1: 2.6rem; --h2: 1.75rem; --top: 7rem; } }
@media (min-width: 1024px) { html { font-size: 19px; } :root { --maxw: 940px;  --h1: 2.9rem; --h2: 1.85rem; --top: 8rem; } }
@media (min-width: 1280px) { html { font-size: 20px; } :root { --maxw: 1140px; --gap: 1.75rem; --h1: 3.1rem; --h2: 1.95rem; --top: 9rem; } }
@media (min-width: 1536px) { html { font-size: 22px; } :root { --maxw: 1320px; --h1: 3.3rem; --h2: 2.05rem; --top: 10rem; } }

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--green-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

.text, .media, .wide { width: min(var(--maxw), 100% - 2 * var(--gutter)); margin: 0 auto; }

/* ---------- header ---------- */
header {
  padding: var(--top) 0 2.5rem;
  text-align: center;
  background:
    radial-gradient(55% 70% at 12% 0%, rgba(249, 195, 203, .55), transparent 70%),
    radial-gradient(45% 65% at 92% 8%, rgba(245, 231, 184, .55), transparent 70%),
    radial-gradient(45% 55% at 55% 100%, rgba(131, 154, 90, .20), transparent 70%);
}
::selection { background: var(--pink-3); }

h1 {
  font-family: var(--font-title);
  font-size: var(--h1);
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 auto 1.8rem;
  max-width: 22em;
}

.authors { font-size: 1.1rem; font-weight: 500; }
.authors span { display: inline-block; margin: 0 0.55em; }
.authors sup { font-weight: 400; color: var(--muted); margin-left: 1px; }
.affil { margin-top: 0.65rem; color: var(--ink-2); }
.eq { margin-top: 0.15rem; font-size: 0.72rem; color: var(--muted); }

.links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; margin-top: 1.6rem; }
.btn {
  display: inline-flex; align-items: center; gap: 0.45rem;
  height: 2.3rem; padding: 0 1.05rem;
  border-radius: 999px;
  background: var(--ink); color: #fff;
  font-size: 0.88rem; font-weight: 500;
  transition: background .15s ease;
}
.btn:hover { background: var(--green); text-decoration: none; }
.btn svg { width: 0.95rem; height: 0.95rem; fill: currentColor; }
.btn.soon { background: #fff; color: var(--muted); border: 1px solid var(--line); cursor: default; }
.btn.soon:hover { background: #fff; }
.btn.soon em { font-style: normal; font-size: 0.72rem; color: var(--pink-ink); background: var(--pink-tint); padding: 0.05rem 0.45rem; border-radius: 999px; }

/* ---------- sections ---------- */
section { padding: 2.5rem 0; }

h2 {
  font-size: var(--h2);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin: 0 0 0.6rem;
}
.kicker {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--pink-ink);
  margin-bottom: 0.4rem;
}

p { margin: 0 0 1em; color: var(--ink-2); }
p.after-fig { margin-top: calc(var(--gap) * 1.6); }

figure { margin: var(--gap) 0 0; }
figure img { width: 100%; height: auto; display: block; }
figcaption { font-size: 0.85rem; color: var(--muted); line-height: 1.6; margin-top: 0.8rem; }
figcaption b { color: var(--ink-2); font-weight: 600; }
.hint { color: #a1a1a6; }
img.zoomable { cursor: zoom-in; }

/* ---------- video slots ---------- */
.video-slot {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 0.75rem;
  overflow: hidden;
  background: var(--pink-tint);
}
.video-slot.has-video { background: #000; }
.video-slot.plain { aspect-ratio: 1920 / 860; border-radius: 0; }
.video-slot.plain.has-video { background: #fff; }
.video-slot video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.video-slot .ph {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.25rem;
  color: var(--muted); font-size: 0.75rem;
}
.video-slot .ph svg { width: 1.6rem; height: 1.6rem; fill: var(--pink-2); }
.video-slot .ph code { font-family: var(--font-mono); font-size: 0.65rem; color: #a1a1a6; }
.video-slot.has-video .ph { display: none; }

.grid-2 { display: grid; grid-template-columns: 1fr; gap: var(--gap); margin-top: var(--gap); }
@media (min-width: 640px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- real-world: video + task list ----------
   base (< 640px):   list under the video, one column
   sm-md (640-1023): 2 x 2 cards under the video
   lg+ (>= 1024px):  list beside the video                                  */
.rw { display: grid; grid-template-columns: 1fr; gap: 0.9rem; margin-top: var(--gap); }
.rw-list { display: grid; grid-template-columns: 1fr; gap: 0.5rem; }
.rw-list button {
  all: unset; box-sizing: border-box; cursor: pointer;
  display: flex; flex-direction: column; gap: 0.15rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: #fff;
  transition: border-color .2s ease, background .2s ease;
}
.rw-list button .k { font-size: 0.62rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.rw-list button .t { font-size: 0.85rem; line-height: 1.4; color: var(--ink-2); }
.rw-list button .s { font-size: 0.72rem; color: var(--muted); }
.rw-list button .s b { font-weight: 600; color: var(--ink-2); }
.rw-list button:hover { border-color: #cfcfd4; }
.rw-list button[aria-selected="true"] { border-color: var(--pink); background: var(--pink-tint); }
.rw-list button[aria-selected="true"] .t { color: var(--ink); }
.rw-list button[aria-selected="true"] .s b { color: var(--ink-2); }
.rw-list button[aria-selected="true"] .k { color: var(--pink-ink); }
.rw-list button:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }

@media (min-width: 640px) {
  .rw-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
}
@media (min-width: 1024px) {
  .rw { grid-template-columns: minmax(0, 1fr) minmax(15rem, 31%); gap: var(--gap); align-items: start; }
  .rw-list { grid-template-columns: 1fr; gap: 0.5rem; }
}
.table-note { font-size: 0.8rem; color: var(--muted); margin-top: 0.8rem; }
/* stacked variant: task cards in a row under a wide video (real-robot section) */
.rw.stack { grid-template-columns: 1fr; }
.rw.stack .rw-list { grid-template-columns: 1fr; }
@media (min-width: 640px) { .rw.stack .rw-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .rw.stack { grid-template-columns: 1fr; } .rw.stack .rw-list { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.rw-side { display: flex; flex-direction: column; gap: 0.6rem; min-width: 0; }

/* ---------- side-by-side comparison player ---------- */
.video-slot.cmp { aspect-ratio: 976 / 480; }
.video-slot.cmp.cmp-real { aspect-ratio: 976 / 360; }
.video-slot.cmp video { object-fit: contain; background: #fff;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 976 480' preserveAspectRatio='none'%3E%3Crect x='0' y='0' width='480' height='480' rx='16' fill='black'/%3E%3Crect x='496' y='0' width='480' height='480' rx='16' fill='black'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 976 480' preserveAspectRatio='none'%3E%3Crect x='0' y='0' width='480' height='480' rx='16' fill='black'/%3E%3Crect x='496' y='0' width='480' height='480' rx='16' fill='black'/%3E%3C/svg%3E");
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%; }
.video-slot.cmp.cmp-real video { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 976 360' preserveAspectRatio='none'%3E%3Crect x='0' y='0' width='480' height='360' rx='16' fill='black'/%3E%3Crect x='496' y='0' width='480' height='360' rx='16' fill='black'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 976 360' preserveAspectRatio='none'%3E%3Crect x='0' y='0' width='480' height='360' rx='16' fill='black'/%3E%3Crect x='496' y='0' width='480' height='360' rx='16' fill='black'/%3E%3C/svg%3E"); }
.video-slot.cmp.has-video { background: transparent; }
.cmp-labels { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.cmp-labels .lab {
  position: absolute; top: 0.6rem;
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.2rem 0.6rem 0.2rem 0.45rem; border-radius: 999px;
  background: rgba(255,255,255,.92); color: var(--ink);
  font-size: 0.72rem; font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.cmp-labels .lab.left { left: 0.6rem; }
.cmp-labels .lab.right { left: calc(50.82% + 0.6rem); }
.cmp-labels .ic { width: 1.05rem; height: 1.05rem; flex: none; }
.cmp-labels .ic path { fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.cmp-labels .ic.ok circle { fill: var(--green); }
.cmp-labels .ic.x circle { fill: var(--pink); }
.video-slot:not(.has-video) .cmp-labels, .video-slot:not(.has-video) .speed { display: none; }
.speed {
  position: absolute; right: 0.6rem; bottom: 0.6rem; z-index: 2;
  font-size: 0.68rem; font-weight: 600; color: #fff; background: rgba(17,17,17,.55);
  padding: 0.1rem 0.45rem; border-radius: 999px;
}
.seg.small { margin: 0; align-self: flex-start; width: auto; }
.seg.small button { height: 1.8rem; font-size: 0.75rem; padding: 0 0.7rem; }

/* ---------- segmented toggle + bars ---------- */
.seg { display: inline-flex; flex-wrap: wrap; gap: 0.25rem; padding: 0.25rem; margin: 0.5rem 0 1.2rem; border-radius: 999px; background: var(--pink-tint); max-width: 100%; }
.seg button {
  font: inherit; font-size: 0.8rem; cursor: pointer;
  border: none; background: transparent; color: var(--ink-2);
  height: 2rem; padding: 0 0.8rem; border-radius: 999px;
  transition: background .15s ease, color .15s ease;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-selected="true"] { background: #fff; color: var(--pink-ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); font-weight: 600; }

.bars { display: grid; gap: 0.7rem; }
.bar-row { display: grid; grid-template-columns: 6rem minmax(0, 1fr) 2.6rem; align-items: center; gap: 0.75rem; font-size: 0.9rem; }
@media (min-width: 768px) { .bar-row { grid-template-columns: 8rem minmax(0, 1fr) 3rem; } }
.bar-name { color: var(--ink-2); white-space: nowrap; }
.bar-track { height: 0.65rem; border-radius: 999px; background: var(--panel); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--pink-3); transition: width .7s cubic-bezier(.2,.7,.2,1); }
.bar-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.bar-row.ours .bar-fill { background: var(--green); }
.bar-row.ours .bar-name, .bar-row.ours .bar-val { color: var(--ink); font-weight: 600; }

/* column charts: pinks and cream for the baselines, matcha green for Ours */
.cols-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4rem 1rem; font-size: 0.75rem; color: var(--ink-2); margin-bottom: 1.6rem; }
.cols-legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.cols-legend i { width: 0.75rem; height: 0.75rem; border-radius: 0.25rem; display: inline-block; }
.colgroups { display: grid; grid-template-columns: 1fr; gap: 1.8rem var(--gap); }
.colgroups.n1 { width: min(26rem, 100%); margin: 0 auto; }
@media (min-width: 640px) { .colgroups.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.cols {
  height: 11rem; display: flex; align-items: flex-end; justify-content: center; gap: 0.55rem;
  border-bottom: 1.5px solid var(--line); padding: 1.4rem 0.4rem 0;
}
.col {
  position: relative; width: clamp(1.6rem, 4vw, 2.6rem); height: 0;
  border-radius: 0.8rem 0.8rem 0.3rem 0.3rem;
  transition: height .9s cubic-bezier(.2, .8, .2, 1);
}
.col .v { position: absolute; bottom: calc(100% + 0.3rem); left: 50%; transform: translateX(-50%); font-size: 0.7rem; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.col.ours .v { font-weight: 700; color: var(--ink); }
.col:hover { filter: brightness(0.96); }
.m0 { background: var(--pink-3); }
.m1 { background: var(--pink-2); }
.m2 { background: var(--cream); }
.m3 { background: var(--green); }
.ctitle { text-align: center; font-size: 0.72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-top: 0.6rem; }

details.full { margin-top: 0.8rem; }
details.full summary { cursor: pointer; font-size: 0.8rem; color: var(--green-ink); list-style: none; }
details.full summary::-webkit-details-marker { display: none; }
details.full summary::before { content: "+ "; }
details.full[open] summary::before { content: "\2212  "; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin-top: 0.9rem; }
table { border-collapse: collapse; width: 100%; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
th, td { padding: 0.5rem 0.65rem; text-align: center; white-space: nowrap; }
thead th { font-weight: 600; color: var(--muted); font-size: 0.8rem; border-bottom: 1px solid var(--line); }
thead tr:first-child th { border-bottom: none; padding-bottom: 0; color: var(--ink-2); }
tbody td { border-bottom: 1px solid var(--line); color: var(--ink-2); }
td:first-child, th:first-child { text-align: left; }
tr.ours td { background: var(--green-tint); color: var(--ink); font-weight: 600; border-bottom: none; }

/* ---------- UMAP: figure left, toggle + caption right (stacked on narrow windows) ---------- */
.umap-row { display: grid; grid-template-columns: 1fr; gap: var(--gap); align-items: start; margin: var(--gap) 0 0; }
.umap-row .swap { position: relative; aspect-ratio: 753 / 653; width: min(22rem, 100%); margin: 0 auto; }
.umap-row .swap img { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity .35s ease; }
.umap-row .swap img.on { opacity: 1; }
.umap-side { margin: 0; }
.umap-side .seg { margin: 0 0 0.9rem; }
.umap-cap { font-size: 0.9rem; line-height: 1.65; color: var(--ink-2); margin: 0; }
@media (min-width: 768px) {
  .umap-row { grid-template-columns: minmax(0, 22rem) minmax(0, 1fr); gap: calc(var(--gap) * 1.5); }
  .umap-row .swap { width: 100%; margin: 0; }
}

/* ---------- bibtex ---------- */
.bib-wrap { position: relative; }
pre.bibtex {
  background: var(--pink-tint);
  border-radius: 0.7rem;
  padding: 1.1rem 1.25rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.7;
  letter-spacing: -0.01em;
  color: var(--ink-2);
  margin: 0;
}
.copy {
  position: absolute; top: 0.55rem; right: 0.55rem;
  font: inherit; font-size: 0.7rem; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  height: 1.6rem; padding: 0 0.6rem; border-radius: 999px;
}
.copy:hover { color: var(--ink); border-color: #cfcfd4; }

/* ---------- lightbox + reveal ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(255,255,255,.96);
  display: flex; align-items: center; justify-content: center;
  padding: 2rem; opacity: 0; pointer-events: none; transition: opacity .2s ease; cursor: zoom-out;
}
.lightbox.open { opacity: 1; pointer-events: auto; }
.lightbox img { max-width: 100%; max-height: 100%; }

.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.in { opacity: 1; transform: none; }

footer { margin-top: 2rem; padding: 1.4rem 0 2.6rem; border-top: 1px solid var(--line); font-size: 0.72rem; color: var(--muted); }
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.4rem 1.5rem; }
.foot-title { color: var(--ink-2); font-weight: 500; }
.foot a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
