:root {
  --bg: #f8f9fd;
  --bg-soft: #ffffff;
  --panel: rgba(255, 255, 255, 0.96);
  --panel-border: rgba(203, 213, 225, 0.55);
  --text: #1e293b;
  --muted: #64748b;
  --accent: #4f46e5;
  --accent-2: #06b6d4;
  --gold: #d97706;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  --videos-task-gap: 2.7rem;
  --videos-title-to-tasks-gap: 1rem;
  --task-panel-title-size: 1.3rem;
  --task-panel-title-size-mobile: 1.2rem;
  --task-head-bottom-gap: 0.9rem;
  --task-badge-size: 0.78rem;
  --task-badge-size-mobile: 0.75rem;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}

body {
  position: relative;
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% -5%, rgba(79, 70, 229, 0.05), transparent 55%);
  z-index: -1;
}

.container {
  width: min(1320px, 92vw);
  margin: 0 auto;
}

.narrow {
  width: min(980px, 92vw);
}

/* ── Navigation ─────────────────────────────────────────── */

.top-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid #e2e8f0;
}

.nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 66px;
}

.brand {
  color: var(--text);
  text-decoration: none;
  font-family: "DM Sans", sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.3px;
}

.top-nav nav {
  display: flex;
  gap: 1rem;
}

.top-nav nav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
  transition: color 0.2s;
}

.top-nav nav a:hover {
  color: var(--accent);
}

/* ── Hero ────────────────────────────────────────────────── */

.hero {
  padding: 6.2rem 0 4.2rem;
  background: linear-gradient(180deg, rgba(79, 70, 229, 0.035) 0%, transparent 65%);
}

.hero-inner {
  text-align: center;
}

.hero-tag {
  display: inline-block;
  margin: 0 0 1rem;
  padding: 0.36rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(79, 70, 229, 0.25);
  color: var(--accent);
  font-size: 0.82rem;
  background: rgba(79, 70, 229, 0.05);
}

.hero h1 {
  margin: 0;
  font-family: "DM Sans", sans-serif;
  font-weight: 800;
  letter-spacing: 0.25px;
  font-size: clamp(2.15rem, 6.2vw, 4.35rem);
  line-height: 1.08;
  background: linear-gradient(135deg, #1e293b 15%, #4f46e5 50%, #06b6d4 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-title {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.weaving-mark {
  width: clamp(38px, 4.6vw, 62px);
  height: clamp(38px, 4.6vw, 62px);
  flex: 0 0 auto;
  filter: drop-shadow(0 4px 10px rgba(79, 70, 229, 0.18));
}

.hero-subtitle {
  margin: 1.1rem auto 0;
  width: min(1040px, 96%);
  color: #334155;
  font-size: clamp(1.18rem, 2.5vw, 1.82rem);
  font-weight: 560;
  line-height: 1.45;
}

.hero-authors {
  margin: 1.55rem auto 0;
  width: min(1120px, 97%);
  color: #475569;
  font-size: clamp(1rem, 1.35vw, 1.22rem);
  line-height: 1.82;
  font-weight: 500;
}

.hero-authors a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dashed rgba(79, 70, 229, 0.35);
  transition: color 0.2s, border-color 0.2s;
}

.hero-authors a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.hero-authors sup,
.hero-affiliation sup,
.hero-notes sup {
  font-size: 0.78em;
  color: var(--accent);
}

.hero-affiliation {
  margin: 0.78rem auto 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.15vw, 1.12rem);
}

.hero-notes {
  margin: 0.5rem auto 0;
  color: #64748b;
  font-size: clamp(0.94rem, 1.02vw, 1.02rem);
}

/* ── Link Buttons ────────────────────────────────────────── */

.link-buttons {
  margin-top: 1.8rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.85rem;
}

.link-btn {
  text-decoration: none;
  color: #fff;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  border: 1px solid rgba(79, 70, 229, 0.4);
  padding: 0.64rem 1.02rem;
  border-radius: 999px;
  font-weight: 650;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 10px rgba(79, 70, 229, 0.18);
}

.link-btn .ai {
  font-size: 1.1rem;
}

.hf-icon {
  display: inline-block;
  font-size: 1.04rem;
  line-height: 1;
  transform: translateY(1px);
}

.link-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.28);
}

/* ── Sections ────────────────────────────────────────────── */

.section {
  padding: 1.2rem 0 3.4rem;
}

.update-note-section {
  padding: 0.2rem 0 0.7rem;
}

.update-note-card {
  background: #fffbeb;
  border: 1px solid rgba(217, 119, 6, 0.25);
  border-radius: 14px;
  padding: 0.75rem 0.95rem;
  box-shadow: 0 2px 12px rgba(217, 119, 6, 0.05);
}

.update-note-title {
  margin: 0 0 0.42rem;
  font-size: 0.82rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #92400e;
}

.update-note-list {
  margin: 0;
  padding-left: 1.1rem;
  color: #78350f;
}

.update-note-list li {
  margin: 0.22rem 0;
  line-height: 1.5;
  font-size: 0.9rem;
}

.notice-date {
  color: #b45309;
  font-weight: 700;
}

/* ── Section Titles ──────────────────────────────────────── */

.section-title {
  margin: 0 0 var(--videos-title-to-tasks-gap);
  font-size: clamp(1.55rem, 3.2vw, 2.2rem);
  font-family: "DM Sans", sans-serif;
  letter-spacing: 0.2px;
  color: var(--text);
}

.section-title-compact {
  font-size: clamp(1.42rem, 2.5vw, 1.92rem);
}

.sub-title {
  margin: 2.1rem 0 0.9rem;
  color: #334155;
  font-size: 1.2rem;
}

.task-intro {
  margin: 0 0 0.78rem;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.89rem;
}

/* ── Task Tabs ───────────────────────────────────────────── */

.task-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: var(--videos-title-to-tasks-gap);
  margin-bottom: 1.2rem;
}

.task-tab {
  appearance: none;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: var(--muted);
  padding: 0.52rem 1.1rem;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.task-tab:hover {
  color: var(--accent);
  border-color: rgba(79, 70, 229, 0.35);
  background: rgba(79, 70, 229, 0.04);
}

.task-tab.active {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 2px 12px rgba(79, 70, 229, 0.22);
}

.task-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Task Panels ─────────────────────────────────────────── */

.task-panel[data-task] {
  display: none;
}

.task-panel[data-task].active-task {
  display: block;
}

.task-panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.compact-panel {
  padding: 0.72rem;
}

.task-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.compact-head {
  margin-bottom: var(--task-head-bottom-gap);
}

.task-panel-head h4 {
  margin: 0;
  font-size: var(--task-panel-title-size);
  color: var(--text);
}

.task-badge {
  border: 1px solid rgba(79, 70, 229, 0.28);
  background: rgba(79, 70, 229, 0.06);
  color: var(--accent);
  border-radius: 999px;
  font-size: var(--task-badge-size);
  padding: 0.16rem 0.5rem;
  font-weight: 600;
}

/* ── Case Grids ──────────────────────────────────────────── */

.compact-case-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.52rem;
}

.flf2v-case-grid {
  grid-template-columns: 1fr;
}

.flf2v-row {
  --flf2v-row-input-height: auto;
  --flf2v-row-image-height: auto;
  --flf2v-row-video-height: auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.52rem;
}

.flf2v-case {
  height: 100%;
  grid-template-rows: auto 1fr;
}

.flf2v-case .compact-input {
  min-height: var(--flf2v-row-input-height);
  background: transparent;
  border: 0;
  padding: 0;
}

.flf2v-case .compact-output {
  width: 100%;
}

.flf2v-row .flf2v-case .compact-output {
  margin-top: auto;
}

.flf2v-frame-pair {
  margin: 0.2rem 0 0.28rem;
}

.flf2v-thumb {
  width: 100%;
  height: auto;
  display: block;
  margin: 0;
  border-radius: 0;
  border: 0;
  aspect-ratio: auto;
  object-fit: contain;
  background: transparent;
}

.flf2v-video {
  width: 100%;
  height: auto !important;
  display: block;
  aspect-ratio: auto !important;
  object-fit: contain !important;
  background: transparent !important;
}

.flf2v-row .flf2v-thumb {
  height: var(--flf2v-row-image-height);
}

.flf2v-row .flf2v-video {
  height: var(--flf2v-row-video-height) !important;
}

.t2v-case-grid,
.i2v-case-grid,
.tiv2v-case-grid {
  grid-template-columns: 1fr;
}

.t2v-row {
  --t2v-row-input-height: auto;
  --t2v-row-video-height: auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.52rem;
}

.tiv2v-row {
  --tiv2v-row-input-height: auto;
  --tiv2v-row-image-height: auto;
  --tiv2v-row-video-height: auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.52rem;
}

.i2v-row {
  --i2v-row-input-height: auto;
  --i2v-row-image-height: auto;
  --i2v-row-video-height: auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.52rem;
}

.t2v-auto-video {
  width: 100%;
  height: auto !important;
  display: block;
  aspect-ratio: auto !important;
  object-fit: contain !important;
  background: transparent !important;
}

.t2v-auto-case .compact-input {
  min-height: var(--t2v-row-input-height);
}

.t2v-row .t2v-auto-case .compact-output {
  margin-top: auto;
}

.t2v-row .t2v-auto-video {
  height: var(--t2v-row-video-height) !important;
}

.i2v-auto-case .compact-input {
  min-height: var(--i2v-row-input-height);
  background: transparent;
  border: 0;
  padding: 0;
}

.i2v-auto-thumb {
  width: 100%;
  height: auto;
  display: block;
  margin: 0.2rem 0 0.28rem;
  border-radius: 0;
  border: 0;
  aspect-ratio: auto;
  object-fit: contain;
  background: transparent;
}

.i2v-auto-video {
  width: 100%;
  height: auto !important;
  display: block;
  aspect-ratio: auto !important;
  object-fit: contain !important;
  background: transparent !important;
}

.i2v-row .i2v-auto-thumb {
  height: var(--i2v-row-image-height);
}

.i2v-row .i2v-auto-video {
  height: var(--i2v-row-video-height) !important;
}

.i2v-row .i2v-auto-case .compact-output {
  margin-top: auto;
}

.tiv2v-unified-panel {
  padding: 0.72rem;
}

.tiv2v-case {
  height: 100%;
  grid-template-rows: auto 1fr;
}

.tiv2v-case .compact-input {
  min-height: var(--tiv2v-row-input-height);
  background: transparent;
  border: 0;
  padding: 0;
}

.tiv2v-before-video,
.tiv2v-after-video {
  width: 100%;
  height: auto !important;
  display: block;
  aspect-ratio: auto !important;
  object-fit: contain !important;
  background: transparent !important;
}

.tiv2v-row .tiv2v-before-video,
.tiv2v-row .tiv2v-after-video {
  height: var(--tiv2v-row-video-height) !important;
}

.tiv2v-row .tiv2v-case .compact-output {
  margin-top: auto;
}

.tiv2v-before-video {
  margin: 0.2rem 0 0.28rem;
}

.tiv2v-meta-row {
  display: grid;
  grid-template-columns: minmax(92px, 38%) 1fr;
  gap: 0.38rem;
  align-items: start;
  margin-top: 0.1rem;
}

.tiv2v-ref-image {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 7px;
  border: 1px solid #e2e8f0;
  aspect-ratio: auto;
  object-fit: contain;
  background: transparent;
}

.tiv2v-row .tiv2v-ref-image {
  height: var(--tiv2v-row-image-height);
}

.tiv2v-meta-row p {
  margin: 0;
  color: #475569;
  font-size: 0.74rem;
  line-height: 1.35;
}

/* ── Reasoning ───────────────────────────────────────────── */

.reasoning-unified-panel {
  padding: 0.72rem;
}

.reasoning-case-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.52rem;
}

.compact-case.reasoning-case {
  grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.3fr) minmax(0, 1.05fr);
  gap: 0.45rem;
  align-items: stretch;
  height: 100%;
}

.reasoning-col {
  border: 1px dashed rgba(79, 70, 229, 0.2);
  border-radius: 8px;
  padding: 0.38rem;
  background: rgba(79, 70, 229, 0.02);
  display: grid;
  align-content: start;
  gap: 0.26rem;
}

.reasoning-col strong {
  display: block;
  margin: 0;
  font-size: 0.77rem;
  color: var(--text);
}

.reasoning-image-row {
  width: 100%;
  display: grid;
  gap: 0.28rem;
  margin: 0.08rem 0 0.14rem;
}

.reasoning-image-row.count-1 {
  grid-template-columns: 1fr;
}

.reasoning-image-row.count-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.reasoning-input-image {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 7px;
  border: 1px solid #e2e8f0;
  aspect-ratio: auto;
  object-fit: contain;
  background: transparent;
}

.reasoning-user-prompt {
  margin: 0;
  color: #475569;
  font-size: 0.74rem;
  line-height: 1.35;
}

.reasoning-user-prompt .prompt-inline-label {
  display: inline;
  margin: 0;
  font-size: inherit;
  font-weight: 700;
  color: var(--text);
}

.reasoning-trace-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: #475569;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.71rem;
  line-height: 1.4;
}

.reasoning-output-col {
  align-content: start;
}

.reasoning-output-video {
  width: 100%;
  height: auto !important;
  display: block;
  aspect-ratio: auto !important;
  object-fit: contain !important;
  background: transparent !important;
}

/* ── Editing ─────────────────────────────────────────────── */

.editing-case-stack {
  display: grid;
  gap: 0.52rem;
}

.editing-case-row {
  --editing-row-input-height: auto;
  --editing-row-video-height: auto;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.editing-case {
  height: 100%;
  grid-template-rows: auto 1fr;
}

.editing-case .compact-input {
  min-height: var(--editing-row-input-height);
  background: transparent;
  border: 0;
  padding: 0;
}

.editing-before-video,
.editing-after-video {
  width: 100%;
  height: auto !important;
  display: block;
  aspect-ratio: auto !important;
  object-fit: contain !important;
  background: transparent !important;
}

.editing-case-row .editing-before-video,
.editing-case-row .editing-after-video {
  height: var(--editing-row-video-height) !important;
}

.editing-case-row .editing-case .compact-output {
  margin-top: auto;
}

.editing-before-video {
  margin: 0.2rem 0 0.28rem;
}

.editing-before-video.narrow-fit-55,
.editing-after-video.narrow-fit-55 {
  width: 52%;
  margin-left: auto;
  margin-right: auto;
}

/* ── Compact Case ────────────────────────────────────────── */

.compact-case {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.34rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.45rem;
  background: #fff;
}

.t2v-case {
  gap: 0.34rem;
}

.t2v-prompt {
  margin: 0;
  padding: 0.35rem 0.45rem;
  border-radius: 8px;
  border: 1px dashed rgba(79, 70, 229, 0.2);
  background: rgba(79, 70, 229, 0.02);
  color: #475569;
  font-size: 0.74rem;
  line-height: 1.35;
}

.t2v-prompt strong {
  color: var(--text);
}

.compact-input {
  border: 1px dashed rgba(79, 70, 229, 0.2);
  border-radius: 8px;
  padding: 0.4rem;
  background: rgba(79, 70, 229, 0.02);
}

.compact-input strong {
  display: block;
  margin-bottom: 0.18rem;
  font-size: 0.77rem;
  color: var(--text);
}

.compact-input p {
  margin: 0;
  color: #475569;
  font-size: 0.74rem;
  line-height: 1.35;
}

.compact-input p .prompt-inline-label {
  display: inline;
  margin: 0;
  font-size: inherit;
  font-weight: 700;
  color: var(--text);
}

.input-thumb {
  width: 100%;
  display: block;
  border-radius: 7px;
  border: 1px solid #e2e8f0;
  margin: 0.24rem 0;
}

.i2v-case {
  gap: 0.36rem;
}

.i2v-input-row {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 0.4rem;
  align-items: center;
  padding: 0.34rem;
  border: 1px dashed rgba(79, 70, 229, 0.2);
  border-radius: 8px;
  background: rgba(79, 70, 229, 0.02);
}

.i2v-input-row p {
  margin: 0;
  color: #475569;
  font-size: 0.7rem;
  line-height: 1.3;
}

.i2v-thumb {
  width: 52px;
  height: 32px;
  margin: 0;
  object-fit: cover;
}

.frame-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.32rem;
  margin: 0.24rem 0;
}

.compact-output {
  display: grid;
  align-content: start;
  gap: 0.28rem;
}

.compact-output::before {
  content: "Output Video";
  display: block;
  margin-bottom: 0.18rem;
  font-size: 0.77rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.compact-video {
  aspect-ratio: 16 / 10;
  max-height: 125px;
}

.compact-input-video {
  aspect-ratio: 16 / 10;
  max-height: 90px;
  margin: 0.24rem 0;
}

.compact-output code {
  width: fit-content;
  font-size: 0.72rem;
}

.title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.chip {
  border-radius: 999px;
  border: 1px solid rgba(217, 119, 6, 0.4);
  background: rgba(217, 119, 6, 0.06);
  color: #b45309;
  padding: 0.3rem 0.72rem;
  font-size: 0.82rem;
  font-weight: 650;
}

/* ── Cards ───────────────────────────────────────────────── */

.glass-card,
.hero-video-card,
.video-card,
.compare-card,
.table-wrap,
.bibtex-box {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.glass-card {
  padding: 1.2rem 1.15rem;
}

.glass-card p {
  margin: 0.4rem 0;
  color: #334155;
  line-height: 1.78;
}

.hero-video-card {
  padding: 1rem;
}

/* ── Architecture Section ────────────────────────────────── */

.architecture-section {
  padding-top: 2.5rem;
  padding-bottom: 3.8rem;
}

.architecture-card {
  padding: 1.1rem;
}

.architecture-image {
  width: 100%;
  display: block;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #fff;
  object-fit: contain;
}

.architecture-figure-wrap {
  margin: 0.6rem 0 2rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 1.2rem;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.04);
}

.figure-caption {
  margin: 0.8rem 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.figure-caption strong {
  color: var(--text);
}

.architecture-overview {
  margin: 0.2rem 0 1.4rem;
  padding: 1rem 1.2rem;
  border-radius: 14px;
  background: rgba(79, 70, 229, 0.03);
  border: 1px solid rgba(79, 70, 229, 0.1);
}

.architecture-overview p {
  margin: 0;
  color: #334155;
  line-height: 1.78;
  font-size: 0.98rem;
}

.architecture-overview p + p {
  margin-top: 0.8rem;
}

.arch-feature-list {
  list-style: none;
  padding-left: 0;
  margin: 0.9rem 0 0;
}

.arch-feature-list li {
  margin: 0.6rem 0;
  padding: 0.65rem 0.9rem;
  border-left: 3px solid rgba(79, 70, 229, 0.5);
  background: rgba(79, 70, 229, 0.025);
  border-radius: 0 8px 8px 0;
  color: #334155;
  line-height: 1.78;
  font-size: 0.98rem;
}

.arch-feature-list li strong {
  color: var(--text);
}


.architecture-brief {
  margin: 0.2rem 0 0.9rem;
  padding: 0.88rem 0.98rem;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
}

.architecture-brief p {
  margin: 0;
  color: #334155;
  line-height: 1.78;
}

.architecture-brief ul {
  margin: 0.62rem 0 0;
  padding-left: 1.15rem;
  color: #475569;
}

.architecture-brief li {
  margin: 0.34rem 0;
  line-height: 1.78;
}

.architecture-brief .highlight-list {
  list-style: none;
  padding-left: 0;
  margin: 0.7rem 0 0;
}

.architecture-brief .highlight-list li {
  margin: 0.5rem 0;
  padding: 0.6rem 0.85rem;
  border-left: 3px solid rgba(79, 70, 229, 0.5);
  background: rgba(79, 70, 229, 0.03);
  border-radius: 0 8px 8px 0;
}

/* ── Demo Video ──────────────────────────────────────────── */

.demo-video {
  width: 100%;
  display: block;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

video.demo-video:not([src]) {
  background: linear-gradient(90deg, #f1f5f9, #e2e8f0, #f1f5f9);
  background-size: 200% 100%;
  animation: videoShimmer 1.8s ease-in-out infinite;
}

@keyframes videoShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

[id$="CaseGrid"]:empty {
  min-height: 100px;
  display: grid;
  place-items: center;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
}

[id$="CaseGrid"]:empty::after {
  content: "Loading demos…";
  color: var(--muted);
  font-size: 0.85rem;
  opacity: 0.5;
}

/* ── Misc Labels ─────────────────────────────────────────── */

.slot-label {
  margin-top: 0.72rem;
  color: var(--muted);
  font-size: 0.87rem;
}

.slot-label code,
.video-card code,
.compact-input code,
.compact-output code,
.replace-tip code {
  color: var(--accent);
  background: rgba(79, 70, 229, 0.06);
  border: 1px solid rgba(79, 70, 229, 0.18);
  padding: 0.14rem 0.44rem;
  border-radius: 8px;
}

/* ── Video Grid ──────────────────────────────────────────── */

.video-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.video-card {
  padding: 0.72rem;
}

.video-card p {
  margin: 0.68rem 0 0.42rem;
  font-weight: 600;
  font-size: 0.93rem;
  color: var(--text);
}

.video-card code {
  font-size: 0.8rem;
}

/* ── Interleaved ─────────────────────────────────────────── */

.interleaved-unified-panel {
  padding: 0.72rem;
}

.comp-grid-tail {
  display: none;
}

.interleaved-case-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.52rem;
}

.interleaved-case-grid-unified {
  grid-template-columns: 1fr;
}

.interleaved-row {
  --interleaved-row-input-height: auto;
  --interleaved-row-image-height: auto;
  --interleaved-row-video-height: auto;
  --interleaved-image-gap: 0.22rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.52rem;
}

.interleaved-case {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 0.32rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  padding: 0.42rem;
  height: 100%;
}

.interleaved-case .compact-input {
  width: 100%;
  min-height: var(--interleaved-row-input-height);
  padding: 0.34rem;
  border: 0;
  background: transparent;
}

.interleaved-row .interleaved-case .compact-output {
  margin-top: auto;
}

.interleaved-image-row {
  width: 100%;
  display: grid;
  gap: var(--interleaved-image-gap);
  align-items: start;
  margin: 0.22rem 0 0.26rem;
}

.interleaved-image-row.count-1 {
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
}

.interleaved-image-row.count-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.interleaved-image-row.count-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.interleaved-image-row.count-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.interleaved-thumb {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: auto;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  margin: 0;
  background: transparent;
}

.interleaved-image-row.count-1 .interleaved-thumb {
  width: calc((100% - var(--interleaved-image-gap)) / 2);
  max-width: 100%;
  margin-inline: auto;
}

.interleaved-video {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: auto;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: transparent;
}

.interleaved-row .interleaved-thumb {
  height: var(--interleaved-row-image-height);
}

.interleaved-row .interleaved-video {
  height: var(--interleaved-row-video-height) !important;
}

/* ── Comparison ──────────────────────────────────────────── */

.comp-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
}

.comp-grid-tail {
  margin-top: 0.78rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.comp-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 0.62rem;
  display: grid;
  gap: 0.34rem;
}

.comp-title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--text);
  line-height: 1.35;
}

.comp-input-strip {
  border: 1px dashed rgba(79, 70, 229, 0.18);
  border-radius: 8px;
  background: rgba(79, 70, 229, 0.02);
  padding: 0.34rem;
  display: grid;
  gap: 0.24rem;
}

.mini-label {
  display: inline-block;
  font-size: 0.65rem;
  letter-spacing: 0.07em;
  color: #475569;
  text-transform: uppercase;
  font-weight: 700;
}

.comp-image-row {
  display: grid;
  gap: 0.22rem;
  justify-content: start;
  align-items: center;
}

.comp-image-row.count-1 { grid-template-columns: 54px; }
.comp-image-row.count-2 { grid-template-columns: repeat(2, 50px); }
.comp-image-row.count-3 { grid-template-columns: repeat(3, 42px); }
.comp-image-row.count-4 { grid-template-columns: repeat(4, 36px); }

.comp-thumb {
  width: 100%;
  height: 30px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.comp-prompt {
  margin: 0;
  color: #475569;
  font-size: 0.69rem;
  line-height: 1.3;
}

.comp-mini-video {
  max-height: 54px;
  aspect-ratio: 16 / 10;
  border-radius: 8px;
}

.comp-card code,
.interleaved-case code {
  width: fit-content;
  font-size: 0.72rem;
}

.compare-list {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.compare-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
}

.pane {
  padding: 0.72rem;
  background: #fafbfe;
}

.pane span {
  display: inline-block;
  margin-bottom: 0.5rem;
  color: #475569;
  font-size: 0.85rem;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 0.18rem 0.56rem;
}

.replace-tip {
  margin: 1.25rem 0 0;
  color: #64748b;
  line-height: 1.7;
}

/* ── Results Table ───────────────────────────────────────── */

.table-wrap {
  margin-top: 1rem;
  overflow-x: auto;
  padding: 0.9rem;
}

.table-wrap h3 {
  margin: 0.3rem 0 0.9rem;
  color: var(--text);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1240px;
}

thead th {
  background: rgba(79, 70, 229, 0.06);
  color: var(--text);
  padding: 0.74rem 0.6rem;
  text-align: center;
  vertical-align: middle;
  border-bottom: 2px solid rgba(79, 70, 229, 0.15);
  font-size: 0.88rem;
}

tbody td {
  padding: 0.66rem 0.6rem;
  color: #334155;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.9rem;
  text-align: center;
  vertical-align: middle;
}

thead th:nth-child(1),
thead th:nth-child(2),
tbody td:nth-child(1),
tbody td:nth-child(2) {
  text-align: left;
}

.type-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.type-badge.task-specific {
  background: rgba(234, 88, 12, 0.1);
  color: #c2410c;
}

.type-badge.unified {
  background: rgba(79, 70, 229, 0.1);
  color: #4338ca;
}

.highlight-row {
  background: rgba(79, 70, 229, 0.06);
}

.highlight-row-soft {
  background: rgba(6, 182, 212, 0.06);
}

.metric-note {
  margin: 0.8rem 0 0.2rem;
  color: var(--muted);
  font-size: 0.84rem;
}

/* ── BibTeX ──────────────────────────────────────────────── */

.bibtex-box {
  overflow: auto;
  background: #f8fafc;
}

.bibtex-box pre {
  margin: 0;
  padding: 1rem;
  font-size: 0.88rem;
  line-height: 1.6;
  color: #334155;
}

/* ── Footer ──────────────────────────────────────────────── */

footer {
  margin: 2rem 0 2.2rem;
  color: var(--muted);
  text-align: center;
  font-size: 0.9rem;
}

footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

footer a:hover {
  color: #4338ca;
  text-decoration: underline;
}

/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 1080px) {
  .video-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .comp-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .interleaved-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .compact-case-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .flf2v-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .t2v-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .i2v-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tiv2v-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .task-tabs {
    gap: 0.38rem;
  }

  .task-tab {
    padding: 0.42rem 0.78rem;
    font-size: 0.8rem;
  }

  .top-nav nav {
    gap: 0.6rem;
  }

  .top-nav nav a {
    font-size: 0.85rem;
  }

  .hero h1 {
    font-size: clamp(1.95rem, 9vw, 2.8rem);
  }

  .hero-title {
    gap: 0.52rem;
  }

  .weaving-mark {
    width: 34px;
    height: 34px;
  }

  .hero-subtitle {
    font-size: 1.02rem;
  }

  .hero-authors {
    font-size: 0.94rem;
    line-height: 1.72;
  }

  .hero-affiliation {
    font-size: 0.9rem;
  }

  .hero-notes {
    font-size: 0.83rem;
  }

  .compact-panel {
    padding: 0.62rem;
  }

  .task-panel-head h4 {
    font-size: var(--task-panel-title-size-mobile);
  }

  .task-badge {
    font-size: var(--task-badge-size-mobile);
  }

  .comp-grid {
    grid-template-columns: 1fr;
  }

  .interleaved-row {
    grid-template-columns: 1fr;
  }

  .comp-title {
    font-size: 0.8rem;
  }

  .comp-image-row.count-4 {
    grid-template-columns: repeat(4, 1fr);
  }

  .compact-case-grid {
    grid-template-columns: 1fr;
  }

  .flf2v-row {
    grid-template-columns: 1fr;
  }

  .t2v-row {
    grid-template-columns: 1fr;
  }

  .i2v-row {
    grid-template-columns: 1fr;
  }

  .tiv2v-row {
    grid-template-columns: 1fr;
  }

  .compact-case {
    grid-template-columns: 1fr;
  }

  .frame-pair {
    grid-template-columns: 1fr 1fr;
  }

  .compact-video {
    max-height: 170px;
  }

  .i2v-input-row {
    grid-template-columns: 46px 1fr;
    gap: 0.32rem;
  }

  .i2v-thumb {
    width: 46px;
    height: 28px;
  }

  .tiv2v-meta-row {
    grid-template-columns: 1fr;
  }

  .video-grid {
    grid-template-columns: 1fr;
  }

  .compare-card {
    grid-template-columns: 1fr;
  }
}
