/* Palette follows the IROS poster: white page, ManiLadder blue (#0253DE),
   orange (#DA5203) accents, Tiro Telugu for display type. Inter is used for
   UI text and numbers. */
:root {
  --bg: #ffffff;
  --bg-tint: #f7f9fd;
  --panel: #ffffff;
  --ink: #0f1424;
  --muted: #5d6475;
  --line: #e6e8ee;
  --blue: #0253de;
  --blue-deep: #013a9e;
  --blue-soft: #e8efff;
  --orange: #da5203;
  --orange-soft: #fff6f0;
  --orange-line: #f2cdb6;
  --level-1: #4fae80;
  --level-2: #e9ad2b;
  --level-3: #f0832c;
  --level-4: #d64c43;
  --display: "Tiro Telugu", Georgia, "Times New Roman", serif;
  --ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --shadow: 0 18px 50px rgba(2, 40, 120, 0.10);
  --shadow-sm: 0 6px 18px rgba(2, 40, 120, 0.08);
  --radius: 20px;
  --nav-h: 60px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 16px); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: 0; }
svg { display: block; }

/* ---- Top nav ----------------------------------------------------------- */

.topnav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid transparent;
  transform: translateY(-100%);
  transition: transform 260ms ease, border-color 260ms ease;
}

.topnav.is-visible {
  transform: none;
  border-bottom-color: var(--line);
}

.topnav-brand img { height: 30px; width: auto; display: block; }

.topnav-links { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.topnav-links::-webkit-scrollbar { display: none; }

.topnav-links a {
  padding: 7px 13px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 999px;
  white-space: nowrap;
  transition: color 140ms ease, background 140ms ease;
}

.topnav-links a:hover { color: var(--blue); }
.topnav-links a.is-active { color: #fff; background: var(--blue); }

/* ---- Hero -------------------------------------------------------------- */

.hero {
  position: relative;
  min-height: min(100svh, 980px);
  display: grid;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
}

.hero-wall {
  position: absolute;
  inset: -4%;
  z-index: -2;
  transform: rotate(-4deg) scale(1.08);
}

.hero-wall video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.9);
}

.hero-veil {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 60% 55% at 50% 48%, rgba(255, 255, 255, 0.97) 30%, rgba(255, 255, 255, 0.82) 62%, rgba(255, 255, 255, 0.55) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0) 70%, #fff 100%);
}

.hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: linear-gradient(90deg, transparent 0%, var(--orange) 32%, var(--orange) 74%, transparent 100%);
}

.hero-inner {
  width: 100%;
  max-width: 1120px;
  padding: 96px 24px 88px;
  text-align: center;
}

.hero h1 {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  animation: rise 900ms cubic-bezier(.2, .7, .2, 1) both;
}

.wordmark { display: block; width: min(600px, 84vw); height: auto; }

.hero-tagline {
  display: block;
  max-width: 980px;
  font-family: var(--display);
  font-size: clamp(1.45rem, 2.9vw, 2.5rem);
  font-weight: 700;
  line-height: 1.22;
  text-wrap: balance;
}

.accent-blue { color: var(--blue); }
.accent-orange { color: var(--orange); }
.accent-blue, .accent-orange { white-space: nowrap; }

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 44px;
  margin: 44px 0 0;
  padding: 0;
  list-style: none;
  animation: rise 900ms 150ms cubic-bezier(.2, .7, .2, 1) both;
}

.hero-stats li { display: grid; gap: 2px; min-width: 96px; }

.hero-stats strong {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  line-height: 1;
  color: var(--blue);
  font-variant-numeric: tabular-nums;
}

.hero-stats li:nth-child(even) strong { color: var(--orange); }

.hero-stats span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 40px;
  animation: rise 900ms 300ms cubic-bezier(.2, .7, .2, 1) both;
}

.pill-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  color: #fff;
  background: var(--ink);
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.pill-link svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.pill-link em {
  padding: 1px 7px;
  font-size: 0.68rem;
  font-style: normal;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
}

.pill-link.is-soon { opacity: 0.55; cursor: default; }
.pill-link.is-primary { background: var(--blue); box-shadow: 0 10px 26px rgba(2, 83, 222, 0.32); }
.pill-link.is-primary:hover { transform: translateY(-2px); }

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

/* ---- Sections ---------------------------------------------------------- */

main {
  max-width: 1480px;
  margin: 0 auto;
  padding: 24px 32px 80px;
}

.section { margin-top: 96px; }

.section-heading { margin-bottom: 26px; }

.section-heading h2 {
  display: inline-block;
  min-width: min(420px, 100%);
  padding-bottom: 8px;
  color: var(--blue);
  font-family: var(--display);
  font-size: clamp(1.8rem, 2.8vw, 2.6rem);
  font-weight: 700;
  line-height: 1.1;
  border-bottom: 3px solid transparent;
  border-image: linear-gradient(90deg, var(--blue), rgba(2, 83, 222, 0)) 1;
}

.section-lede {
  max-width: 760px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 700ms ease, transform 700ms cubic-bezier(.2, .7, .2, 1);
}

.reveal.is-in { opacity: 1; transform: none; }

.intro-video-shell {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0b0f1a;
  border: 2px solid var(--orange);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.intro-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* ---- Segmented controls ------------------------------------------------ */

.segmented { display: flex; flex-wrap: wrap; gap: 6px; }

.segmented button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 15px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}

.segmented button:hover { border-color: var(--blue); color: var(--blue); }
.segmented.compact button { min-height: 34px; padding: 0 12px; font-size: 0.84rem; }

.segmented button[aria-pressed="true"] {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.swatch { width: 9px; height: 9px; border-radius: 50%; flex: none; }

/* ---- Ladder leaderboard ------------------------------------------------ */

.ladder-panel {
  padding: 26px;
  background:
    radial-gradient(ellipse 70% 60% at 30% 0%, rgba(2, 83, 222, 0.06), transparent 70%),
    var(--bg-tint);
  border: 1px solid var(--line);
  border-radius: 28px;
}

.ladder-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.ladder-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 1fr);
  gap: 26px;
  align-items: stretch;
}

.ladder-stage {
  position: relative;
  min-height: 520px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
}

.ladder-svg { width: 100%; height: 100%; max-height: 720px; margin: 0 auto; }

.ladder-svg .rail { fill: url(#railGrad); }
.ladder-svg .rung { stroke-linecap: round; }
.ladder-svg .rung-label { font-family: var(--display); font-weight: 700; font-size: 22px; fill: var(--blue); }
.ladder-svg .rung-badge text { font-family: var(--ui); font-weight: 700; font-size: 11px; fill: #fff; letter-spacing: 0.04em; }
.ladder-svg .axis-tick { font-family: var(--ui); font-size: 10px; fill: #9aa1b2; }
.ladder-svg .ground { fill: #eef1f6; }

.ladder-svg .token { cursor: pointer; }
.ladder-svg .token-g { transition: transform 1100ms cubic-bezier(.34, 1.4, .5, 1); }
.ladder-svg .token circle.halo { opacity: 0.18; transition: r 200ms ease; }
.ladder-svg .token:hover circle.halo,
.ladder-svg .token.is-selected circle.halo { r: 30; opacity: 0.25; }
.ladder-svg .token text { font-family: var(--ui); font-weight: 800; fill: #fff; pointer-events: none; }
.ladder-svg .token .token-name { font-weight: 700; }
.ladder-svg .token .token-score { font-weight: 600; font-size: 11px; fill: var(--muted); }
.ladder-svg .token .token-name { font-size: 15px; }
.ladder-svg .token-leader { stroke-width: 1.5; stroke-dasharray: 3 3; opacity: 0.7; }

.ladder-svg .cloud { fill: #fff; opacity: 0.9; animation: drift 14s ease-in-out infinite alternate; }
.ladder-svg .cloud.c2 { animation-duration: 19s; animation-delay: -6s; }
@keyframes drift { from { transform: translateX(-14px); } to { transform: translateX(14px); } }

.ladder-tooltip {
  position: absolute;
  z-index: 3;
  width: 230px;
  padding: 12px 14px;
  background: rgba(15, 20, 36, 0.94);
  color: #fff;
  border-radius: 14px;
  box-shadow: var(--shadow);
  font-size: 0.82rem;
  pointer-events: none;
}

.ladder-tooltip h4 { margin: 0 0 8px; font-size: 0.95rem; }
.ladder-tooltip .tt-row { display: grid; grid-template-columns: 26px 1fr 38px; align-items: center; gap: 8px; margin-top: 4px; }
.ladder-tooltip .tt-bar { height: 6px; background: rgba(255, 255, 255, 0.15); border-radius: 99px; overflow: hidden; }
.ladder-tooltip .tt-bar i { display: block; height: 100%; border-radius: 99px; }
.ladder-tooltip .tt-val { text-align: right; font-variant-numeric: tabular-nums; }

.ladder-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.ladder-side-head { display: flex; align-items: center; justify-content: space-between; }
.ladder-side-head h3 { font-family: var(--display); font-size: 1.5rem; color: var(--blue); }

.tag-illustrative {
  padding: 3px 10px;
  color: var(--orange);
  background: var(--orange-soft);
  border: 1px dashed var(--orange);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.rank-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }

.rank-item {
  display: grid;
  grid-template-columns: 30px 40px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  cursor: pointer;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.rank-item:hover { transform: translateX(3px); }
.rank-item.is-selected { border-color: var(--blue); box-shadow: var(--shadow-sm); }

.rank-pos { color: var(--muted); font-weight: 800; font-size: 1.1rem; text-align: center; }

.rank-dot {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: #fff;
  border-radius: 50%;
  font-weight: 800;
  font-size: 0.9rem;
}

.rank-name { display: grid; line-height: 1.25; min-width: 0; }
.rank-name strong { font-size: 1rem; }
.rank-name span { color: var(--muted); font-size: 0.8rem; }
.rank-score { font-weight: 800; font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.rank-score small { color: var(--muted); font-weight: 600; font-size: 0.75rem; }

.model-detail {
  padding: 16px 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.model-detail h4 { margin: 0 0 12px; font-size: 0.95rem; }

.level-bar { display: grid; grid-template-columns: 62px 1fr 44px; align-items: center; gap: 10px; margin-top: 9px; font-size: 0.86rem; }
.level-bar .lb-name { font-weight: 700; }
.level-bar .lb-track { height: 10px; background: #eef1f6; border-radius: 99px; overflow: hidden; }
.level-bar .lb-track i { display: block; height: 100%; width: 0; border-radius: 99px; transition: width 700ms cubic-bezier(.2, .7, .2, 1); }
.level-bar .lb-val { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

.ladder-note { margin: auto 0 0; color: var(--muted); font-size: 0.8rem; }

/* ---- Stairs (what makes a rung harder) --------------------------------- */

#chain-filter { margin-bottom: 22px; }

.stairs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  align-items: end;
}

.stair {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.stair:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.stair:nth-child(1) { margin-top: 165px; }
.stair:nth-child(2) { margin-top: 110px; }
.stair:nth-child(3) { margin-top: 55px; }

.stair video { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #0b0f1a; }

.stair-body { padding: 14px 16px 16px; border-top: 4px solid var(--lc); }
.stair-level { color: var(--lc); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.stair-name { margin: 2px 0 6px; font-size: 1.05rem; font-weight: 700; overflow-wrap: anywhere; }
.stair-desc { margin: 0; color: var(--muted); font-size: 0.88rem; }

/* ---- Task matrix ------------------------------------------------------- */

.controls-section {
  position: sticky;
  top: calc(var(--nav-h) + 10px);
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin-bottom: 26px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 18px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
}

.search-box {
  position: relative;
  flex: 1 1 260px;
  display: block;
}

.search-box svg {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 17px;
  height: 17px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
}

.search-box input {
  width: 100%;
  min-height: 40px;
  padding: 0 14px 0 40px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  outline: none;
}

.search-box input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(2, 83, 222, 0.16); }

.result-count { margin-left: auto; color: var(--muted); font-size: 0.85rem; font-weight: 600; }

.matrix-head,
.matrix-row {
  display: grid;
  grid-template-columns: 112px repeat(8, minmax(0, 1fr));
  gap: 10px;
}

.matrix-head { position: relative; margin-bottom: 8px; }

.matrix-domain {
  grid-row: 1;
  padding: 6px 0 8px;
  color: #fff;
  border-radius: 12px 12px 0 0;
  font-weight: 700;
  font-size: 0.86rem;
  letter-spacing: 0.05em;
  text-align: center;
  text-transform: uppercase;
}

.matrix-domain.rigid_body { grid-column: 2 / span 4; background: var(--blue); }
.matrix-domain.deformable { grid-column: 6 / span 4; background: var(--orange); }

.matrix-emb {
  grid-row: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-top: 0;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
}

.matrix-emb svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.matrix-emb.rigid_body { color: var(--blue); }
.matrix-emb.deformable { color: var(--orange); }

.matrix-row {
  position: relative;
  padding: 12px 0;
  border-top: 1px dashed var(--line);
}

.matrix-level {
  position: sticky;
  top: 160px;
  align-self: start;
  display: grid;
  gap: 6px;
  justify-items: start;
}

.matrix-level h3 { font-family: var(--display); color: var(--blue); font-size: 1.5rem; line-height: 1; }

.level-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  color: #fff;
  border-radius: 7px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.level-badge-1 { background: var(--level-1); }
.level-badge-2 { background: var(--level-2); color: #3e2c00; }
.level-badge-3 { background: var(--level-3); }
.level-badge-4 { background: var(--level-4); }

.level-count { color: var(--muted); font-size: 0.8rem; font-weight: 600; }

.matrix-cell { display: grid; gap: 8px; align-content: start; min-width: 0; }

.tile {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  aspect-ratio: 4 / 3;
  background: #0b0f1a;
  border: 0;
  border-radius: 11px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 0 0 1px var(--line);
  transition: transform 160ms ease, box-shadow 160ms ease;
  animation: tile-in 420ms ease both;
}

@keyframes tile-in { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }

.tile:hover, .tile:focus-visible {
  z-index: 2;
  transform: scale(1.06);
  box-shadow: 0 0 0 2px var(--orange), 0 14px 30px rgba(15, 20, 36, 0.22);
  outline: none;
}

.tile img, .tile video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tile video { opacity: 0; transition: opacity 200ms ease; }
.tile.is-playing video { opacity: 1; }

.tile-name {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 18px 8px 6px;
  color: #fff;
  background: linear-gradient(180deg, transparent, rgba(5, 8, 18, 0.85));
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: left;
  overflow-wrap: anywhere;
}

.tile.is-missing { display: grid; place-items: center; background: var(--orange-soft); box-shadow: 0 0 0 1px var(--orange-line); }
.tile.is-missing .tile-name { color: var(--orange); background: none; }
.tile.is-missing::before { content: "video pending"; color: var(--orange); font-size: 0.7rem; opacity: 0.7; }

.matrix-empty { padding: 60px 0; color: var(--muted); text-align: center; }

/* ---- Results ----------------------------------------------------------- */

.results-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 22px; }

.chart-card {
  margin: 0;
  padding: 20px 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-sm);
}

.chart-card figcaption { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; font-weight: 700; }
.chart-card svg { width: 100%; height: auto; }
.chart-card .grid-line { stroke: var(--line); }
.chart-card .tick { font-size: 11px; fill: var(--muted); font-family: var(--ui); }
.chart-card .series { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

.chart-legend { display: flex; gap: 18px; margin-top: 8px; font-size: 0.85rem; font-weight: 600; }
.chart-legend span { display: inline-flex; align-items: center; gap: 7px; }

.embodiment-bars { display: grid; gap: 16px; }
.eb-group h4 { margin: 0 0 6px; font-size: 0.88rem; }
.eb-row { display: grid; grid-template-columns: 78px 1fr 40px; align-items: center; gap: 10px; margin-top: 5px; font-size: 0.8rem; }
.eb-row .lb-track { height: 9px; background: #eef1f6; border-radius: 99px; overflow: hidden; }
.eb-row .lb-track i { display: block; height: 100%; border-radius: 99px; }
.eb-row .lb-val { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---- Cite & footer ----------------------------------------------------- */

.cite-card {
  position: relative;
  padding: 22px 24px;
  background: #0f1424;
  color: #e7ebf5;
  border-radius: 20px;
  overflow-x: auto;
}

.cite-card pre { margin: 0; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.88rem; line-height: 1.6; }

.copy-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 6px 14px;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
}

.copy-btn:hover { background: rgba(255, 255, 255, 0.22); }

.site-footer {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 50px 24px 60px;
  color: var(--muted);
  background: var(--bg-tint);
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 0.9rem;
}

.site-footer img { width: 180px; height: auto; }
.site-footer p { margin: 0; }

/* ---- Modal ------------------------------------------------------------- */

.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(8, 12, 24, 0.66); backdrop-filter: blur(6px); animation: fade 200ms ease; }

.modal-card {
  position: relative;
  width: min(980px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
  animation: pop 260ms cubic-bezier(.2, .8, .3, 1.2);
}

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(0.94) translateY(10px); } }

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 38px;
  height: 38px;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
}

.modal-media { background: #0b0f1a; }
.modal-media video { display: block; width: 100%; max-height: 66vh; object-fit: contain; background: #0b0f1a; }
.modal-media .missing { display: grid; place-items: center; aspect-ratio: 16 / 9; color: var(--orange); background: var(--orange-soft); font-weight: 700; }

.modal-body { padding: 18px 24px 22px; }
.modal-tags { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  color: #fff;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
}

.chip.rigid_body { background: var(--blue); }
.chip.deformable { background: var(--orange); }
.chip.plain { color: var(--ink); background: #eef1f6; }

.modal-body h3 { margin: 10px 0 4px; font-family: var(--display); font-size: 1.8rem; color: var(--blue); overflow-wrap: anywhere; }
.modal-path { margin: 0; color: var(--muted); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.82rem; overflow-wrap: anywhere; }

.modal-nav { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

.modal-nav button {
  min-height: 36px;
  padding: 0 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
}

.modal-nav button:hover { border-color: var(--blue); color: var(--blue); }

/* ---- Responsive -------------------------------------------------------- */

@media (max-width: 1180px) {
  .ladder-layout { grid-template-columns: 1fr; }
  .ladder-stage { min-height: 0; }
  .ladder-svg { max-height: 600px; }
  .results-grid { grid-template-columns: 1fr; }
  .matrix-head, .matrix-row { grid-template-columns: 88px repeat(8, minmax(0, 1fr)); gap: 6px; }
  .tile-name { font-size: 0.62rem; padding: 14px 5px 4px; }
}

@media (max-width: 900px) {
  .topnav { padding: 0 14px; }
  .topnav-brand { display: none; }
  main { padding-left: 16px; padding-right: 16px; }
  .section { margin-top: 72px; }
  .ladder-panel { padding: 14px; border-radius: 20px; }
  .stairs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stair:nth-child(n) { margin-top: 0; }
  .matrix-head { display: none; }
  .matrix-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .matrix-level { position: static; grid-column: 1 / -1; grid-auto-flow: column; justify-content: start; align-items: center; gap: 10px; }
  .matrix-cell::before {
    content: attr(data-label);
    color: var(--cell-color);
    font-size: 0.75rem;
    font-weight: 700;
  }
  .matrix-cell { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .matrix-cell::before { grid-column: 1 / -1; }
  .controls-section { position: static; }
  .result-count { margin-left: 0; }
}

@media (max-width: 520px) {
  .hero-inner { padding: 72px 16px 64px; }
  .hero-stats { gap: 14px 22px; }
  .hero-stats li { min-width: 80px; }
  .stairs { grid-template-columns: 1fr; }
  .matrix-row { grid-template-columns: 1fr; }
  .rank-item { grid-template-columns: 24px 36px 1fr auto; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
