:root {
  color-scheme: light;

  --bg: #f7f8fa;
  --surface: #ffffff;

  --ink: #1c2939;
  --muted: #687486;

  --border: #e3e8ef;

  --accent: #236c64;
  --accent-light: #edf5f2;

  --radius: 14px;
  --focus: #458bcd;

  --shadow: 0 4px 20px #1c293907;
}


/* =========================================================
   GLOBAL
   ========================================================= */

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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;

  font-size: 14px;
  line-height: 1.5;
}

button,
select,
input {
  font: inherit;
}

button,
select {
  max-width: 100%;
}

button {
  cursor: pointer;
}

button:disabled,
select:disabled {
  cursor: not-allowed;
  color: #8993a1;
}

button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 3px solid #458bcd88;
  outline-offset: 3px;
}


/* =========================================================
   HEADER
   ========================================================= */

.site-header {
  height: 85px;

  padding: 0 42px;

  background: var(--surface);

  border-bottom:
    1px solid var(--border);

  display: flex;

  align-items: center;
  justify-content: space-between;

  gap: 20px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand strong {
  font-size: 16px;
  letter-spacing: -0.3px;
}

.brand-subtitle {
  display: block;

  font-size: 11px;

  color: var(--muted);

  margin-top: 2px;
}

.brand-mark {
  width: 34px;
  height: 34px;

  display: grid;

  grid-template-columns:
    repeat(2, 12px);

  grid-template-rows:
    repeat(2, 12px);

  gap: 4px;

  align-content: center;
  justify-content: center;
}

.brand-mark i {
  border:
    1.5px solid var(--accent);

  border-radius: 3px;
}

.brand-mark i:first-child {
  background: var(--accent);
}

.brand-mark i:last-child {
  border-style: dashed;
}

.status-badge {
  font-size: 11px;
  font-weight: 600;

  display: flex;

  gap: 7px;

  align-items: center;

  padding: 6px 10px;

  border:
    1px solid var(--border);

  border-radius: 50px;

  color: var(--muted);

  white-space: nowrap;
}

.status-badge span {
  height: 6px;
  width: 6px;

  background: #aeb8c4;

  border-radius: 50%;
}

.status-badge.connected span {
  background: var(--accent);
}


/* =========================================================
   PAGE
   ========================================================= */

.workspace {
  max-width: 1440px;

  margin: auto;

  padding:
    34px 42px 22px;
}


/* =========================================================
   INTRODUCTION
   ========================================================= */

.introduction {
  display: flex;

  gap: 24px;

  align-items: center;
  justify-content: space-between;

  margin-bottom: 24px;
}

.eyebrow,
.section-label,
.caption {
  font-size: 10px;

  letter-spacing: 1.3px;

  font-weight: 700;
}

.eyebrow {
  color: var(--accent);

  margin:
    0 0 8px;
}

h1 {
  font-size:
    clamp(
      23px,
      2.5vw,
      32px
    );

  line-height: 1.2;

  letter-spacing: -1.1px;

  margin:
    0 0 9px;

  font-weight: 650;
}

.lead {
  margin: 0;

  font-size: 13px;

  color: var(--muted);
}


/* =========================================================
   BUTTONS
   ========================================================= */

.button {
  display: inline-flex;

  gap: 9px;

  align-items: center;
  justify-content: center;

  border-radius: 9px;

  min-height: 41px;

  padding: 9px 15px;

  font-size: 12px;
  font-weight: 600;

  white-space: nowrap;

  transition:
    background 0.15s,
    border-color 0.15s;
}

.secondary {
  background: var(--surface);

  border:
    1px solid #d7dfe8;

  color: var(--ink);
}

.secondary:hover:not(:disabled) {
  background: #f3f6f8;

  border-color: #b9c6d4;
}

.compare-button[aria-pressed="true"] {
  background: var(--accent-light);

  color: var(--accent);

  border-color: #bed9d0;
}

.button:disabled {
  background: #f7f8fa;

  border-color: var(--border);
}


/* =========================================================
   SETUP NOTICE
   ========================================================= */

.setup-notice {
  display: flex;

  align-items: flex-start;

  gap: 10px;

  background: #f1f4f8;

  border:
    1px solid #e4e9f0;

  border-radius: 10px;

  padding: 12px 15px;

  font-size: 12px;

  color: var(--muted);

  margin-bottom: 20px;
}

.setup-notice strong {
  color: #44536a;

  font-weight: 600;
}

.notice-dot {
  flex: 0 0 6px;

  height: 6px;

  margin-top: 6px;

  background: #8d9bb1;

  border-radius: 50%;
}


/* =========================================================
   EXAMPLE SELECTION BAR
   ========================================================= */

.selection-bar {
  background: var(--surface);

  border:
    1px solid var(--border);

  border-radius: var(--radius);

  padding: 18px 20px;

  display: flex;

  align-items: flex-end;

  gap: 16px;

  box-shadow: var(--shadow);

  margin-bottom: 26px;
}

.field {
  display: flex;

  flex-direction: column;

  gap: 6px;

  min-width: 0;
}

.field > span {
  font-size: 11px;

  font-weight: 600;

  color: #526176;
}

.selection-bar > .field {
  flex:
    0 1 210px;
}

.field select {
  border:
    1px solid #dce3eb;

  border-radius: 8px;

  background-color: #ffffff;

  color: var(--ink);

  height: 41px;

  padding:
    0 32px 0 12px;

  font-size: 12px;

  width: 100%;
}

.field select:disabled {
  background: #fafbfd;

  color: #8b95a3;
}


/* =========================================================
   CURRENT EXAMPLE
   ========================================================= */

.example-summary {
  padding-left: 20px;

  border-left:
    1px solid var(--border);

  margin-left: auto;

  min-width: 230px;

  align-self: center;

  display: flex;

  flex-direction: column;
}

.caption {
  color: #9aa4b2;

  font-size: 9px;

  letter-spacing: 1px;
}

.example-summary strong {
  font-size: 12px;

  font-weight: 600;

  margin:
    3px 0 2px;

  text-transform: capitalize;
}

.example-summary > span:last-child {
  font-size: 10px;

  color: var(--muted);

  max-width: 260px;

  overflow: hidden;

  text-overflow: ellipsis;

  white-space: nowrap;
}


/* =========================================================
   PERMANENT GROUND TRUTH SECTION
   ========================================================= */

.ground-truth-section {
  background: var(--surface);

  border:
    1px solid var(--border);

  border-radius: var(--radius);

  box-shadow: var(--shadow);

  padding:
    18px 20px 20px;

  margin-bottom: 28px;
}

.ground-truth-heading {
  display: flex;

  align-items: flex-end;

  justify-content: space-between;

  gap: 24px;

  margin-bottom: 13px;
}

.ground-truth-heading h2 {
  margin:
    3px 0 0;

  font-size: 18px;

  font-weight: 620;

  letter-spacing: -0.35px;
}

.ground-truth-meta {
  display: flex;

  flex-direction: column;

  text-align: right;
}

.ground-truth-meta strong {
  font-size: 12px;

  margin:
    3px 0 1px;

  text-transform: capitalize;
}

.ground-truth-meta > span:last-child {
  font-size: 10px;

  color: var(--muted);
}


/* =========================================================
   LARGE GROUND TRUTH IMAGE
   ========================================================= */

.ground-truth-stage {
  width: 100%;

  height: 330px;

  position: relative;

  display: flex;

  align-items: center;

  justify-content: center;

  overflow: hidden;

  background: #f6f8fa;

  border:
    1px solid #e6ebf1;

  border-radius: 9px;
}

.gt-preview-image {
  width: 100%;

  height: 100%;

  object-fit: contain;

  display: block;
}

.gt-preview-empty {
  color: #8491a2;

  font-size: 12px;

  text-align: center;

  padding: 30px;
}


/* =========================================================
   VIEWER HEADING
   ========================================================= */

.viewer-heading {
  display: flex;

  align-items: center;

  justify-content: space-between;

  gap: 12px;

  margin:
    0 1px 10px;

  min-height: 23px;
}

.viewer-heading > div {
  display: flex;

  align-items: center;

  gap: 12px;
}

.section-label {
  color: #8190a1;
}

.sample-tag {
  font-size: 10px;

  background: #eef1f6;

  padding: 3px 8px;

  border-radius: 5px;

  color: #607087;
}

/* =========================================================
   MODEL VIEWER GRID
   ========================================================= */

.viewer-grid {
  display: grid;

  grid-template-columns:
    minmax(0, 1fr);

  gap: 18px;
}

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

.viewer-card {
  background: var(--surface);

  border:
    1px solid var(--border);

  border-radius: var(--radius);

  overflow: hidden;

  min-width: 0;

  box-shadow: var(--shadow);
}


/* =========================================================
   CARD CONTROLS
   ========================================================= */

.card-controls {
  display: flex;

  align-items: flex-end;

  gap: 18px;

  padding:
    18px 20px 8px;
}

.model-field {
  flex:
    1 1 260px;
}

.view-field {
  flex:
    0 1 240px;
}

.model-description {
  margin: 0;

  padding:
    0 20px 14px;

  font-size: 10px;

  min-height: 29px;

  color: var(--muted);
}


/* =========================================================
   MODEL IMAGE STAGE
   ========================================================= */

.image-stage {
  margin:
    0 20px;

  position: relative;

  background: #f6f8fa;

  border:
    1px solid #e6ebf1;

  border-radius: 9px;

  height: 385px;

  display: flex;

  align-items: center;

  justify-content: center;

  overflow: hidden;
}


/* Same height we use for the permanent GT reference */
.comparing .image-stage {
  height: 330px;
}

.stage-image {
  width: 100%;

  height: 100%;

  object-fit: contain;

  display: block;
}


/* =========================================================
   EMPTY STATE
   ========================================================= */

.empty-state {
  text-align: center;

  max-width: 350px;

  padding: 35px;
}

.empty-icon {
  width: 70px;

  height: 70px;

  background: #ffffff;

  border:
    1px solid #e6ebf1;

  display: grid;

  place-items: center;

  margin:
    0 auto 18px;

  border-radius: 16px;

  color: #8fa3b4;

  box-shadow:
    0 3px 10px #253b4d04;
}

.empty-title {
  font-size: 16px;

  font-weight: 550;

  margin:
    0 0 6px;

  letter-spacing: -0.25px;
}

.empty-description {
  font-size: 12px;

  color: var(--muted);

  margin: 0;

  line-height: 1.7;
}


/* =========================================================
   CAPTIONS
   ========================================================= */

.image-caption {
  display: flex;

  gap: 10px;

  align-items: center;

  justify-content: space-between;

  font-size: 10px;

  color: var(--muted);

  padding:
    10px 20px 14px;

  min-height: 45px;
}

.coordinate-space {
  white-space: nowrap;

  background: #f1f4f7;

  border-radius: 4px;

  padding: 2px 5px;
}


/* =========================================================
   METRICS
   ========================================================= */

.metric-strip {
  display: flex;

  align-items: center;

  padding:
    15px 22px;

  border-top:
    1px solid var(--border);

  gap: 36px;

  background: #fefefe;
}

.metric {
  min-width: 67px;
}

.metric > span {
  font-size: 10px;

  color: var(--muted);
}

.direction {
  color: #97a3b1;

  margin-left: 3px;
}

.metric strong {
  font-size: 23px;

  font-weight: 550;

  letter-spacing: -0.6px;

  display: block;

  margin-top: 2px;

  line-height: 1.2;

  font-variant-numeric:
    tabular-nums;
}

.metric-context {
  margin-left: auto;

  font-size: 10px;

  color: #586679;

  text-align: right;
}

.metric-context-detail {
  color: #8c98a7;
}

.comparing .metric-strip {
  gap: 20px;
}

.comparing .metric-context {
  max-width: 120px;
}


/* =========================================================
   COMPARISON
   ========================================================= */

.comparison-summary {
  border:
    1px solid #dae7e2;

  background: #f0f6f3;

  padding:
    12px 16px;

  margin-top: 12px;

  border-radius: 9px;

  font-size: 12px;

  color: #386058;
}


/* =========================================================
   GATE WEIGHTS
   ========================================================= */

.gate-panel {
  width:
    min(
      400px,
      100%
    );

  padding: 30px;
}

.gate-panel h2 {
  font-size: 21px;

  font-weight: 550;

  letter-spacing: -0.5px;

  margin:
    0 0 20px;
}

.gate-panel > p {
  font-size: 10px;

  color: var(--muted);

  line-height: 1.6;

  margin:
    20px 0 0;
}

.gate-row {
  display: grid;

  grid-template-columns:
    90px 1fr 40px;

  gap: 10px;

  align-items: center;

  margin-bottom: 15px;

  font-size: 12px;
}

.gate-track {
  height: 8px;

  border-radius: 4px;

  background: #e0e9e6;

  overflow: hidden;
}

.gate-fill {
  height: 100%;

  background: var(--accent);

  border-radius: 4px;
}

.gate-value {
  text-align: right;

  font-variant-numeric:
    tabular-nums;
}


/* =========================================================
   INFO NOTE
   ========================================================= */

.quiet-note {
  display: flex;

  gap: 9px;

  align-items: flex-start;

  margin:
    17px 2px 30px;

  color: #7a8797;

  font-size: 11px;
}

.quiet-note p {
  margin: 0;

  line-height: 1.7;
}

.small-info {
  display: inline-flex;

  flex:
    0 0 15px;

  justify-content: center;

  align-items: center;

  height: 15px;

  border:
    1px solid #a7b3c1;

  border-radius: 50%;

  font-size: 10px;

  margin-top: 2px;
}


/* =========================================================
   FOOTER
   ========================================================= */

.workspace-footer {
  display: flex;

  justify-content: space-between;

  gap: 15px;

  font-size: 10px;

  color: #9aa4b0;

  border-top:
    1px solid var(--border);

  padding-top: 15px;
}


/* =========================================================
   LARGE SCREENS
   ========================================================= */

@media (min-width: 1500px) {

  .image-stage {
    height: 430px;
  }

  .comparing .image-stage {
    height: 390px;
  }

  .ground-truth-stage {
    height: 390px;
  }

}


/* =========================================================
   MEDIUM SCREENS
   ========================================================= */

@media (max-width: 1100px) {

  .selection-bar {
    flex-wrap: wrap;

    gap: 12px;
  }

  .selection-bar > .field {
    flex-basis: 170px;
  }

  .example-summary {
    min-width: 200px;
  }

  .comparing .card-controls {
    flex-direction: column;

    align-items: stretch;

    gap: 9px;
  }

  .comparing .model-field,
  .comparing .view-field {
    flex: auto;
  }

  .comparing .metric-strip {
    flex-wrap: wrap;

    gap: 16px;
  }

  .comparing .metric-context {
    margin-left: auto;
  }

  .image-stage {
    height: 365px;
  }

  .ground-truth-stage {
    height: 330px;
  }

}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 760px) {

  .site-header {
    padding:
      0 20px;

    height: 75px;
  }

  .workspace {
    padding:
      24px 18px 18px;
  }

  .brand-subtitle {
    font-size: 9px;

    max-width: 205px;
  }

  .status-badge {
    font-size: 9px;
  }

  .introduction {
    align-items: flex-start;

    flex-direction: column;

    gap: 16px;
  }

  .introduction .button {
    align-self: flex-end;
  }

  .selection-bar {
    flex-wrap: wrap;

    padding: 15px;
  }

  .selection-bar > .field {
    flex:
      1 1 calc(50% - 10px);
  }

  .random-button {
    flex:
      0 1 auto;
  }

  .example-summary {
    flex:
      1 1 100%;

    border-left: 0;

    border-top:
      1px solid var(--border);

    padding:
      12px 0 0;

    margin-left: 0;

    min-width: 0;

    text-align: left;
  }

  .example-summary > span:last-child {
    display: none;
  }


  /* Ground truth */

  .ground-truth-section {
    padding:
      15px;

    margin-bottom: 22px;
  }

  .ground-truth-heading {
    align-items: flex-start;

    flex-direction: column;

    gap: 8px;
  }

  .ground-truth-meta {
    text-align: left;
  }

  .ground-truth-stage {
    height: 300px;
  }


  /* Viewer */

  .viewer-grid.comparing {
    grid-template-columns:
      minmax(0, 1fr);
  }

  .card-controls {
    padding:
      15px 15px 8px;

    gap: 10px;
  }

  .model-field {
    flex:
      1 1 180px;
  }

  .view-field {
    flex:
      0 1 160px;
  }

  .image-stage {
    margin:
      0 15px;

    height: 330px;
  }

  .model-description {
    padding-left: 15px;
    padding-right: 15px;
  }

  .image-caption {
    padding-left: 15px;
    padding-right: 15px;
  }

  .metric-strip {
    padding:
      14px 15px;

    gap: 20px;
  }

  .metric {
    min-width: 50px;
  }

  .metric strong {
    font-size: 21px;
  }

  .metric-context {
    font-size: 9px;
  }

  .empty-title {
    font-size: 15px;
  }

  .empty-state {
    padding: 20px;
  }

  .workspace-footer {
    font-size: 9px;
  }

  .gate-panel {
    padding: 20px;
  }

}


/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (
  prefers-reduced-motion: reduce
) {

  * {
    transition: none !important;

    scroll-behavior: auto !important;
  }
}

@media (min-width: 900px) {

  .site-header {
    height: 56px;
  }

  .workspace {
    padding: 12px 26px 12px;
  }

  .introduction {
    margin-bottom: 8px;
  }

  h1 {
    font-size: 23px;
    margin-bottom: 3px;
  }

  .lead {
    font-size: 11px;
  }

  .selection-bar {
    padding: 8px 12px;
    margin-bottom: 10px;
  }

  .field select {
    height: 34px;
  }

  .button {
    min-height: 34px;
    padding: 6px 11px;
  }

  .ground-truth-section {
    padding: 8px 11px 9px;
    margin-bottom: 10px;
  }

  .ground-truth-heading {
    margin-bottom: 6px;
  }

  .ground-truth-heading h2 {
    font-size: 15px;
  }

  .ground-truth-stage {
    height: 150px;
  }

  .viewer-heading {
    margin-bottom: 5px;
  }

  .card-controls {
    padding: 8px 11px 4px;
    gap: 10px;
  }

  .model-description {
    padding: 0 11px 5px;
    min-height: 16px;
    font-size: 9px;
  }

  .image-stage {
    height: 150px;
    margin: 0 11px;
  }

  .comparing .image-stage {
    height: 150px;
  }

  .image-caption {
    min-height: 24px;
    padding: 4px 11px 5px;
  }

  .metric-strip {
    padding: 6px 12px;
    gap: 22px;
  }

  .metric strong {
    font-size: 17px;
  }

  .metric > span {
    font-size: 9px;
  }

  .metric-context {
    font-size: 8px;
  }

  .comparison-summary {
    padding: 5px 10px;
    margin-top: 5px;
    font-size: 11px;
  }

  .quiet-note {
    margin: 7px 2px 10px;
  }
}


/* =========================================================
   MODERN RESEARCH DASHBOARD THEME
   Paste at the bottom of web/styles.css
   ========================================================= */

:root {
  --page-bg: #07111f;
  --surface: rgba(15, 27, 46, 0.82);
  --surface-light: rgba(27, 43, 68, 0.72);
  --border: rgba(148, 163, 184, 0.18);
  --border-hover: rgba(96, 165, 250, 0.55);

  --text: #f1f5f9;
  --muted: #94a3b8;
  --primary: #60a5fa;
  --secondary: #a78bfa;
  --success: #34d399;

  --radius-lg: 22px;
  --radius-md: 14px;
  --shadow: 0 20px 55px rgba(0, 0, 0, 0.3);
}

/* Page background */

body {
  min-height: 100vh;
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;

  background:
    radial-gradient(
      circle at 10% 5%,
      rgba(37, 99, 235, 0.22),
      transparent 32%
    ),
    radial-gradient(
      circle at 90% 20%,
      rgba(139, 92, 246, 0.18),
      transparent 30%
    ),
    linear-gradient(145deg, #07111f 0%, #0b1628 55%, #091321 100%);

  background-attachment: fixed;
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;

  padding: 16px clamp(20px, 5vw, 70px);
  color: var(--text);

  background: rgba(7, 17, 31, 0.76);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.brand strong {
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.brand-subtitle {
  color: var(--muted);
}

.brand-mark {
  border-radius: 12px;
  box-shadow: 0 0 25px rgba(96, 165, 250, 0.35);
}

/* Main content */

.workspace {
  width: min(1440px, calc(100% - 36px));
  margin: 0 auto;
  padding: 24px 0 28px;
}

/* Introduction */

.introduction {
  position: relative;
  overflow: hidden;
  padding: clamp(28px, 5vw, 56px);
  margin-bottom: 24px;

  background:
    linear-gradient(
      120deg,
      rgba(37, 99, 235, 0.19),
      rgba(139, 92, 246, 0.12)
    ),
    var(--surface);

  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.introduction::after {
  content: "";
  position: absolute;
  top: -90px;
  right: -70px;
  width: 260px;
  height: 260px;

  background: rgba(96, 165, 250, 0.16);
  border-radius: 50%;
  filter: blur(15px);
  pointer-events: none;
}

.eyebrow,
.section-label,
.caption {
  color: var(--primary);
  font-weight: 700;
  letter-spacing: 0.13em;
}

.introduction h1 {
  max-width: 850px;
  margin: 12px 0;
  color: var(--text);
  font-size: clamp(2rem, 4vw, 3.8rem);
  line-height: 1.05;
  letter-spacing: -0.045em;
}

.lead {
  max-width: 700px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.7;
}

/* Shared panels */

.selection-bar,
.ground-truth-section,
.viewer-card,
.comparison-summary,
.quiet-note {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.selection-bar {
  padding: 22px;
  border-radius: var(--radius-lg);
}

.ground-truth-section {
  overflow: hidden;
  margin-top: 0;
  margin-bottom: 18px;
  padding: 0;
  border-radius: var(--radius-lg);
}

.viewer-card {
  overflow: hidden;
  border-radius: var(--radius-lg);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.viewer-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-hover);
  box-shadow: 0 25px 65px rgba(0, 0, 0, 0.38);
}

/* Form controls */

.field > span {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

select {
  min-height: 46px;
  color: var(--text);

  background-color: rgba(8, 19, 34, 0.88);
  border: 1px solid var(--border);
  border-radius: 12px;

  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease;
}

select:hover:not(:disabled) {
  border-color: var(--border-hover);
  background-color: rgba(15, 31, 53, 0.95);
}

select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.14);
}

/* Buttons */

.button {
  min-height: 46px;
  padding: 0 20px;
  color: white;
  font-weight: 700;

  background:
    linear-gradient(135deg, #2563eb, #7c3aed);

  border: 0;
  border-radius: 12px;
  box-shadow: 0 9px 24px rgba(37, 99, 235, 0.25);

  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    filter 160ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.1);
  box-shadow: 0 13px 30px rgba(37, 99, 235, 0.35);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button:disabled {
  opacity: 0.45;
  box-shadow: none;
}

/* Status */

.status-badge {
  color: var(--text);
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.28);
  border-radius: 999px;
}

.status-badge > span {
  background: var(--success);
  box-shadow: 0 0 12px var(--success);
}

/* Current example */

.example-summary {
  padding: 11px 16px;
  background: rgba(8, 19, 34, 0.58);
  border: 1px solid var(--border);
  border-radius: 13px;
}

.example-summary strong {
  color: var(--text);
}

/* Image areas */

.ground-truth-stage,
.image-stage {
  min-height: 360px;
  background:
    linear-gradient(
      45deg,
      rgba(148, 163, 184, 0.035) 25%,
      transparent 25%,
      transparent 75%,
      rgba(148, 163, 184, 0.035) 75%
    ),
    #050d18;

  background-size: 28px 28px;
}

.stage-image,
.gt-preview-image {
  transition:
    transform 250ms ease,
    filter 250ms ease;
}

.stage-image:hover,
.gt-preview-image:hover {
  transform: scale(1.015);
  filter: brightness(1.05);
}

.image-caption {
  color: var(--muted);
  background: rgba(5, 13, 24, 0.76);
  border-top: 1px solid var(--border);
}

.coordinate-space,
.sample-tag {
  color: #bfdbfe;
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(96, 165, 250, 0.24);
  border-radius: 999px;
}

/* Metrics */

.metric-strip {
  background:
    linear-gradient(
      120deg,
      rgba(37, 99, 235, 0.08),
      rgba(139, 92, 246, 0.06)
    );
  border-top: 1px solid var(--border);
}

.metric {
  border-right-color: var(--border);
}

.metric span {
  color: var(--muted);
}

.metric strong {
  color: var(--text);
  font-size: 1.35rem;
}

.metric-context {
  color: var(--muted);
}

/* Headings and descriptions */

.ground-truth-heading,
.viewer-heading,
.card-controls {
  border-color: var(--border);
}

.ground-truth-heading h2 {
  color: var(--text);
}

.model-description,
#gt-condition-label {
  color: var(--muted);
}

/* Comparison */

.viewer-grid {
  gap: 24px;
}

.comparison-summary {
  margin-top: 20px;
  padding: 16px 20px;
  color: #cbd5e1;
  border-radius: var(--radius-md);
}

/* Gate visualization */

.gate-panel {
  color: var(--text);
}

.gate-track {
  overflow: hidden;
  background: rgba(148, 163, 184, 0.15);
  border-radius: 999px;
}

.gate-fill {
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 999px;
  box-shadow: 0 0 15px rgba(96, 165, 250, 0.35);
}

/* Information note and footer */

.quiet-note {
  margin-top: 24px;
  color: var(--muted);
  border-radius: var(--radius-md);
}

.small-info {
  color: var(--primary);
  background: rgba(96, 165, 250, 0.14);
}

.workspace-footer {
  color: #64748b;
  border-top-color: var(--border);
}

/* Loading notice */

.setup-notice {
  color: #fecaca;
  background: rgba(127, 29, 29, 0.3);
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: var(--radius-md);
}

/* Small entrance animation */

.introduction,
.selection-bar,
.ground-truth-section,
.viewer-card {
  animation: panel-in 450ms ease both;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile */

@media (max-width: 760px) {
  .workspace {
    width: min(100% - 20px, 1440px);
    padding-top: 20px;
  }

  .site-header {
    padding: 13px 15px;
  }

  .brand-subtitle {
    display: none;
  }

  .introduction {
    padding: 28px 22px;
  }

  .introduction h1 {
    font-size: 2.1rem;
  }

  .selection-bar {
    padding: 16px;
  }

  .ground-truth-stage,
  .image-stage {
    min-height: 270px;
  }

  .metric-strip {
    overflow-x: auto;
  }
}


/* =========================================================
   PREMIUM AI LAB POLISH
   ========================================================= */

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.28;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(96, 165, 250, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(96, 165, 250, 0.045) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(to bottom, black, transparent 82%);
  -webkit-mask-image: linear-gradient(to bottom, black, transparent 82%);
}

.site-header {
  height: 76px;
}

.site-header::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(96, 165, 250, 0.75), rgba(167, 139, 250, 0.65), transparent);
}

.brand-mark {
  width: 42px;
  height: 42px;
  padding: 7px;
  background: linear-gradient(145deg, rgba(96, 165, 250, 0.2), rgba(139, 92, 246, 0.12));
  border: 1px solid rgba(125, 211, 252, 0.28);
}

.brand-mark i {
  border-color: #7dd3fc;
}

.brand-mark i:first-child {
  background: linear-gradient(135deg, #38bdf8, #8b5cf6);
  border-color: transparent;
}

.brand strong {
  display: block;
  background: linear-gradient(90deg, #f8fafc, #bfdbfe);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.status-badge {
  padding: 8px 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.status-badge.connected > span {
  animation: status-pulse 2s ease-out infinite;
}

@keyframes status-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.45);
  }

  50% {
    box-shadow: 0 0 0 6px rgba(52, 211, 153, 0);
  }
}

.introduction {
  min-height: 300px;
  isolation: isolate;
  align-items: flex-end;
}

.introduction::before {
  content: "CV  /  SPATIAL INTELLIGENCE  /  OPEN VOCABULARY";
  position: absolute;
  top: 28px;
  right: 34px;
  z-index: -1;
  color: rgba(191, 219, 254, 0.34);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.17em;
}

.introduction h1 {
  max-width: 900px;
  background: linear-gradient(110deg, #ffffff 10%, #bfdbfe 55%, #c4b5fd 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.compare-button {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  min-width: 168px;
}

.selection-bar {
  position: relative;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px 16px;
  background:
    linear-gradient(110deg, rgba(96, 165, 250, 0.06), transparent 38%),
    var(--surface);
}

.selection-bar::before {
  content: "EXPERIMENT CONTROLS";
  display: none;
  position: absolute;
  top: 10px;
  left: 22px;
  color: rgba(148, 163, 184, 0.65);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.field select {
  padding-inline: 14px 38px;
  color-scheme: dark;
}

.random-button::before {
  content: "\21BB";
  margin-right: 8px;
  font-size: 17px;
}

.example-summary {
  min-width: 180px;
  padding: 0 0 0 16px;
  background: transparent;
  border: 0;
  border-left: 1px solid rgba(96, 165, 250, 0.35);
  border-radius: 0;
}

.ground-truth-heading,
.card-controls {
  background: linear-gradient(110deg, rgba(96, 165, 250, 0.07), transparent 55%);
}

.ground-truth-heading {
  margin-bottom: 0;
  padding: 14px 18px;
}

.viewer-heading {
  margin-top: 36px;
  padding: 0 4px 12px;
}

.viewer-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.viewer-actions .compare-button {
  min-height: 40px;
  min-width: 158px;
  padding-inline: 17px;
}

.viewer-card {
  position: relative;
}

.viewer-card::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 2;
  height: 3px;
  background: linear-gradient(90deg, #38bdf8, #6366f1, #a855f7);
  opacity: 0.8;
}

.card-controls {
  padding-top: 24px;
}

.model-description {
  padding-bottom: 18px;
  color: #aebbd0;
  font-size: 11px;
  line-height: 1.6;
}

.image-stage,
.ground-truth-stage {
  position: relative;
  border: 1px solid rgba(96, 165, 250, 0.17);
  box-shadow:
    inset 0 0 45px rgba(0, 0, 0, 0.32),
    0 0 0 1px rgba(255, 255, 255, 0.015);
}

.ground-truth-stage {
  height: 280px;
  min-height: 280px;
  border-radius: 0;
}

.image-stage::before,
.ground-truth-stage::before {
  content: "";
  position: absolute;
  inset: 12px;
  z-index: 2;
  border: 1px solid rgba(125, 211, 252, 0.12);
  pointer-events: none;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(82px, 1fr));
  gap: 10px;
  padding: 14px 18px 18px;
}

.metric {
  min-width: 0;
  padding: 12px 14px;
  background: rgba(5, 13, 24, 0.45);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 12px;
}

.metric:nth-child(1) strong {
  color: #7dd3fc;
}

.metric:nth-child(2) strong {
  color: #a5b4fc;
}

.metric:nth-child(3) strong {
  color: #f0abfc;
}

.metric-context {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-left: 0;
  padding: 10px 12px;
  background: rgba(5, 13, 24, 0.24);
  border-radius: 12px;
}

.comparison-summary {
  text-align: center;
  background:
    linear-gradient(90deg, rgba(37, 99, 235, 0.12), rgba(124, 58, 237, 0.12)),
    var(--surface);
}

.workspace-footer {
  margin-top: 32px;
  padding-block: 22px;
}

@media (max-width: 900px) {
  .introduction {
    min-height: 270px;
    align-items: flex-start;
  }

  .introduction::before {
    display: none;
  }

  .metric-strip {
    grid-template-columns: repeat(3, minmax(80px, 1fr));
  }

  .metric-context {
    grid-column: 1 / -1;
    text-align: left;
  }
}


/* =========================================================
   USER IMAGE INFERENCE
   ========================================================= */

.demo-mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(640px, 100%);
  margin: 0 0 18px;
  padding: 5px;
  background: rgba(5, 14, 27, 0.58);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 15px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
}

.demo-mode-tab {
  display: flex;
  min-height: 54px;
  padding: 9px 15px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  color: #94a3b8;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 11px;
}

.demo-mode-tab span {
  font-size: 12px;
  font-weight: 750;
}

.demo-mode-tab small {
  font-size: 9px;
  color: #64748b;
}

.demo-mode-tab:hover:not(.is-active) {
  color: #e2e8f0;
  background: rgba(30, 52, 82, 0.44);
}

.demo-mode-tab.is-active {
  color: #ffffff;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.34), rgba(109, 40, 217, 0.3));
  border-color: rgba(147, 197, 253, 0.38);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 6px 18px rgba(37, 99, 235, 0.12);
}

.demo-mode-tab.is-active small {
  color: #dbeafe;
}

.upload-lab {
  margin-bottom: 28px;
  padding: clamp(20px, 3vw, 30px);
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(15, 27, 46, 0.94), rgba(12, 24, 42, 0.86));
  border: 1px solid rgba(96, 165, 250, 0.22);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.upload-lab-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.upload-lab-heading h2 {
  margin: 0 0 7px;
  color: var(--text);
  font-size: clamp(20px, 2vw, 27px);
  font-weight: 650;
  letter-spacing: -0.6px;
}

.upload-lab-heading p:last-child,
.upload-mode-help {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.availability-badge {
  flex: 0 0 auto;
  padding: 7px 11px;
  color: #a7f3d0;
  font-size: 10px;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.24);
  border-radius: 999px;
}

.availability-badge::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 7px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.75);
}

.availability-badge.is-checking {
  color: #bfdbfe;
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(96, 165, 250, 0.24);
}

.availability-badge.is-checking::before {
  background: #60a5fa;
}

.availability-badge.is-offline {
  color: #cbd5e1;
  background: rgba(100, 116, 139, 0.12);
  border-color: rgba(148, 163, 184, 0.2);
}

.availability-badge.is-offline::before {
  background: #94a3b8;
  box-shadow: none;
}

.upload-mode-row {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 15px;
}

.upload-mode-field {
  width: min(360px, 100%);
}

.upload-mode-help {
  max-width: 560px;
  padding-bottom: 10px;
  line-height: 1.5;
}

.upload-input-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.upload-drop-zone {
  position: relative;
  display: grid;
  min-height: 126px;
  padding: 22px 20px 18px 68px;
  align-content: center;
  gap: 3px;
  cursor: pointer;
  background: rgba(8, 19, 34, 0.64);
  border: 1px dashed rgba(125, 211, 252, 0.32);
  border-radius: 15px;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.upload-drop-zone:hover,
.upload-drop-zone.is-dragging,
.upload-drop-zone.has-file {
  background: rgba(18, 43, 72, 0.66);
  border-color: rgba(96, 165, 250, 0.72);
  transform: translateY(-1px);
}

.upload-drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.upload-drop-zone strong {
  color: #f8fafc;
  font-size: 13px;
}

.upload-drop-zone > span:not(.upload-step) {
  color: var(--muted);
  font-size: 10px;
}

.upload-drop-zone em {
  margin-top: 5px;
  overflow: hidden;
  color: #93c5fd;
  font-size: 10px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-step {
  position: absolute;
  top: 50%;
  left: 20px;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: #dbeafe;
  font-size: 12px;
  font-weight: 800;
  background: rgba(37, 99, 235, 0.28);
  border: 1px solid rgba(96, 165, 250, 0.4);
  border-radius: 10px;
  transform: translateY(-50%);
}

.automatic-parent-panel {
  position: relative;
  display: grid;
  min-height: 126px;
  padding: 18px 18px 18px 68px;
  grid-template-columns: minmax(160px, 1fr) auto;
  align-items: center;
  gap: 12px;
  background: rgba(8, 19, 34, 0.64);
  border: 1px dashed rgba(125, 211, 252, 0.32);
  border-radius: 15px;
}

.automatic-parent-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.automatic-parent-copy strong {
  color: #f8fafc;
  font-size: 13px;
}

.automatic-parent-copy span {
  color: var(--muted);
  font-size: 10px;
}

.detected-object-field {
  grid-column: 1 / -1;
}

.automatic-parent-panel.is-detecting {
  border-color: rgba(167, 139, 250, 0.72);
  background: rgba(46, 30, 82, 0.28);
}

.upload-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr)) auto;
  gap: 14px;
  margin-top: 16px;
  align-items: end;
}

.upload-controls > .field {
  position: relative;
}

.upload-controls .field input[type="text"] {
  width: 100%;
  height: 46px;
  min-height: 46px;
  padding: 0 13px;
  color: #e2e8f0;
  background: #0b1729;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 11px;
}

.upload-controls .field input[type="text"]:hover {
  background: #10213a;
  border-color: rgba(96, 165, 250, 0.58);
}

.upload-controls .field input[type="text"]:focus {
  color: #ffffff;
  background: #10213a;
  border-color: #60a5fa;
  outline: none;
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.15);
}

.experimental-query-note {
  margin-top: 12px;
  padding: 9px 12px;
  color: #c4b5fd;
  font-size: 10px;
  background: rgba(124, 58, 237, 0.1);
  border: 1px solid rgba(167, 139, 250, 0.23);
  border-radius: 9px;
}

.experimental-query-note strong {
  margin-right: 5px;
  color: #ddd6fe;
}

.autocomplete-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  z-index: 45;
  max-height: 246px;
  padding: 5px;
  overflow-y: auto;
  background: #0b1729;
  border: 1px solid rgba(96, 165, 250, 0.42);
  border-radius: 11px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.48);
}

.autocomplete-option {
  display: flex;
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  align-items: center;
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 550;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 7px;
}

.autocomplete-option:hover,
.autocomplete-option:focus,
.autocomplete-option.is-active {
  color: #ffffff;
  background: rgba(37, 99, 235, 0.48);
  outline: none;
}

.autocomplete-empty {
  padding: 10px;
  color: #94a3b8;
  font-size: 10px;
}

.upload-run-button {
  min-height: 46px;
  padding-inline: 20px;
  color: #ffffff;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  border: 1px solid rgba(147, 197, 253, 0.32);
}

.upload-run-button:hover:not(:disabled) {
  background: linear-gradient(135deg, #1d4ed8, #6d28d9);
  border-color: rgba(191, 219, 254, 0.62);
}

.upload-run-button:disabled {
  color: rgba(226, 232, 240, 0.5);
  background: #172033;
  border-color: rgba(148, 163, 184, 0.14);
}

.upload-status {
  min-height: 20px;
  margin: 12px 2px 4px;
  color: var(--muted);
  font-size: 11px;
}

.upload-status.is-error {
  color: #fca5a5;
}

.upload-status.is-success {
  color: #86efac;
}

.upload-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.upload-preview-card {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  background: rgba(5, 14, 27, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 14px;
}

.upload-preview-card figcaption {
  display: flex;
  min-height: 52px;
  padding: 10px 13px;
  align-items: center;
  color: #cbd5e1;
  font-size: 10px;
  font-weight: 700;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.mask-editor-heading {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mask-editor-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

.mask-tool {
  min-height: 28px;
  padding: 4px 8px;
  color: #cbd5e1;
  font-size: 9px;
  font-weight: 700;
  background: #101d30;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 7px;
}

.mask-tool:hover:not(:disabled),
.mask-tool.is-active {
  color: #ffffff;
  background: rgba(37, 99, 235, 0.55);
  border-color: rgba(96, 165, 250, 0.62);
}

.mask-tool:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.brush-size-field {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 8px;
}

.brush-size-field input {
  width: 58px;
  accent-color: #60a5fa;
}

.upload-preview-stage {
  display: grid;
  height: 230px;
  place-items: center;
  overflow: hidden;
  color: #64748b;
  font-size: 11px;
  background: #050d18;
}

.upload-preview-grid.has-image .upload-preview-stage {
  height: auto;
  min-height: 0;
  aspect-ratio: var(--upload-image-ratio);
}

.upload-preview-stage img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.mask-preview-stage img {
  image-rendering: pixelated;
}

.mask-editor-stage {
  position: relative;
  display: flex;
}

.mask-editor-stage img,
.mask-editor-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.mask-editor-stage canvas {
  z-index: 2;
  cursor: crosshair;
  touch-action: none;
}

.mask-editor-help {
  min-height: 38px;
  margin: 0;
  padding: 9px 12px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
  border-top: 1px solid rgba(148, 163, 184, 0.1);
}

.result-card {
  border-color: rgba(167, 139, 250, 0.28);
}

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

  .upload-run-button {
    width: 100%;
  }

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

  .upload-preview-card.result-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .upload-lab-heading,
  .upload-mode-row {
    flex-direction: column;
    align-items: stretch;
  }

  .availability-badge {
    align-self: flex-start;
  }

  .upload-input-grid,
  .upload-controls,
  .upload-preview-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .upload-preview-card.result-card {
    grid-column: auto;
  }

  .upload-preview-stage {
    height: 260px;
  }

  .demo-mode-switch {
    grid-template-columns: minmax(0, 1fr);
  }

  .automatic-parent-panel {
    grid-template-columns: minmax(0, 1fr);
  }

  .automatic-parent-panel .button {
    width: 100%;
  }

  .mask-editor-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .mask-editor-tools {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .site-header {
    height: 66px;
  }

  .status-badge strong {
    display: none;
  }

  .introduction {
    min-height: 0;
  }

  .compare-button {
    width: 100%;
  }

  .viewer-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .viewer-actions {
    width: 100%;
  }

  .viewer-actions .compare-button {
    flex: 1 1 auto;
  }

  .metric-strip {
    grid-template-columns: 1fr 1fr;
  }

  .metric:nth-child(3) {
    grid-column: 1 / -1;
  }
}


/* =========================================================
   CONTROL CONTRAST FIXES
   Keep these final so the original light theme cannot win.
   ========================================================= */

.button.secondary {
  color: #f8fafc;
  background-color: #2563eb;
  background-image: linear-gradient(135deg, #2563eb, #6d28d9);
  border: 1px solid rgba(147, 197, 253, 0.24);
}

.button.secondary:hover:not(:disabled) {
  color: #ffffff;
  background-color: #1d4ed8;
  background-image: linear-gradient(135deg, #1d4ed8, #7c3aed);
  border-color: rgba(191, 219, 254, 0.55);
  filter: none;
}

.button.secondary:active:not(:disabled) {
  color: #ffffff;
  background-image: linear-gradient(135deg, #1e40af, #5b21b6);
}

.compare-button[aria-pressed="true"] {
  color: #ecfeff;
  background-color: #0f766e;
  background-image: linear-gradient(135deg, #0f766e, #2563eb);
  border-color: rgba(94, 234, 212, 0.46);
}

.compare-button[aria-pressed="true"]:hover:not(:disabled) {
  color: #ffffff;
  background-image: linear-gradient(135deg, #0d9488, #2563eb);
  border-color: rgba(153, 246, 228, 0.62);
}

.button.secondary:disabled {
  color: rgba(226, 232, 240, 0.56);
  background-color: #172033;
  background-image: none;
  border-color: rgba(148, 163, 184, 0.14);
}

.field select,
select.model-select,
select.view-select {
  width: 100%;
  height: 46px;
  min-height: 46px;
  padding: 0 36px 0 13px;
  color: #e2e8f0;
  color-scheme: dark;
  background-color: #0b1729;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 11px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.field select:hover:not(:disabled),
select.model-select:hover:not(:disabled),
select.view-select:hover:not(:disabled) {
  color: #ffffff;
  background-color: #10213a;
  border-color: rgba(96, 165, 250, 0.58);
}

.field select:focus,
.field select:focus-visible,
select.model-select:focus,
select.view-select:focus {
  color: #ffffff;
  background-color: #10213a;
  border-color: #60a5fa;
  outline: none;
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.15);
}

.field select:disabled,
select.model-select:disabled,
select.view-select:disabled {
  color: rgba(148, 163, 184, 0.62);
  background-color: #0b1422;
  border-color: rgba(148, 163, 184, 0.12);
  opacity: 0.72;
}

select option,
select optgroup {
  color: #e2e8f0;
  background-color: #0b1729;
}

select option:disabled {
  color: #64748b;
}

@media (prefers-reduced-motion: reduce) {
  .introduction,
  .selection-bar,
  .ground-truth-section,
  .viewer-card,
  .status-badge.connected > span {
    animation: none;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}


/* =========================================================
   JAVASCRIPT-ENHANCED COMPONENTS
   ========================================================= */

.demo-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 24px;
}

.demo-stats span {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 8px 12px;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  background: rgba(3, 10, 22, 0.35);
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 999px;
}

.demo-stats strong {
  color: #e0f2fe;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.stage-image:not([hidden]),
.gt-preview-image:not([hidden]) {
  cursor: zoom-in;
}

.zoom-button {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 5;
  display: inline-flex;
  min-height: 36px;
  padding: 7px 11px;
  gap: 7px;
  align-items: center;
  color: #f8fafc;
  font-size: 11px;
  font-weight: 700;
  background: rgba(7, 17, 31, 0.82);
  border: 1px solid rgba(191, 219, 254, 0.28);
  border-radius: 9px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(10px);
  opacity: 0.72;
  transition:
    opacity 150ms ease,
    background-color 150ms ease,
    border-color 150ms ease,
    transform 150ms ease;
}

.zoom-button:hover {
  color: #ffffff;
  background: rgba(37, 99, 235, 0.9);
  border-color: rgba(191, 219, 254, 0.65);
  opacity: 1;
  transform: translateY(-1px);
}

.image-stage:hover .zoom-button,
.ground-truth-stage:hover .zoom-button,
.zoom-button:focus-visible {
  opacity: 1;
}

.metric[title] {
  cursor: help;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease;
}

.metric[title]:hover {
  transform: translateY(-2px);
  background: rgba(15, 31, 53, 0.72);
  border-color: rgba(96, 165, 250, 0.3);
}

.demo-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 17px;
  color: #e0f2fe;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: rgba(15, 27, 46, 0.94);
  border: 1px solid rgba(96, 165, 250, 0.32);
  border-radius: 12px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(14px);
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.demo-toast::before {
  content: "✓";
  display: inline-grid;
  width: 20px;
  height: 20px;
  margin-right: 9px;
  place-items: center;
  color: #07111f;
  background: #34d399;
  border-radius: 50%;
}

.demo-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.lightbox-open {
  overflow: hidden;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  padding: clamp(20px, 4vw, 60px);
  place-items: center;
  background: rgba(2, 7, 15, 0.91);
  backdrop-filter: blur(18px);
  animation: lightbox-in 180ms ease both;
}

.image-lightbox[hidden] {
  display: none;
}

.lightbox-content {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
  width: min(1400px, 94vw);
  height: min(860px, 86vh);
  justify-items: center;
}

.lightbox-gallery {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.lightbox-gallery.is-comparing {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.lightbox-gallery figure {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  background: rgba(5, 13, 24, 0.78);
  border: 1px solid rgba(125, 211, 252, 0.18);
  border-radius: 16px;
}

.lightbox-content img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  background: #050d18;
  border: 1px solid rgba(125, 211, 252, 0.22);
  border-radius: 16px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.62);
}

.lightbox-gallery figure img {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.lightbox-gallery figcaption {
  display: flex;
  min-height: 52px;
  padding: 10px 14px;
  gap: 3px;
  flex-direction: column;
  justify-content: center;
  background: rgba(15, 27, 46, 0.92);
  border-top: 1px solid rgba(148, 163, 184, 0.14);
}

.lightbox-gallery figcaption strong {
  color: #e0f2fe;
  font-size: 12px;
}

.lightbox-gallery figcaption span {
  overflow: hidden;
  color: #94a3b8;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lightbox-content p {
  margin: 0;
  color: #cbd5e1;
  font-size: 12px;
  text-align: center;
}

/* Preserve the original two-panel model comparison on desktop. */

.viewer-grid.comparing {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 20px;
}

.lightbox-close {
  position: fixed;
  top: 20px;
  right: 22px;
  z-index: 2;
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  color: #f8fafc;
  font-size: 28px;
  line-height: 1;
  background: rgba(15, 27, 46, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 50%;
}

.lightbox-close:hover {
  background: rgba(37, 99, 235, 0.65);
  border-color: rgba(125, 211, 252, 0.55);
}

body.is-loading .status-badge {
  animation: loading-glow 1.5s ease-in-out infinite;
}

@keyframes lightbox-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes loading-glow {
  0%, 100% {
    opacity: 0.65;
  }

  50% {
    opacity: 1;
  }
}

@media (max-width: 560px) {
  .demo-stats {
    margin-top: 18px;
  }

  .demo-stats span {
    padding: 6px 9px;
  }

  .ground-truth-stage {
    height: 220px;
    min-height: 220px;
  }

  .demo-toast {
    right: 16px;
    bottom: 16px;
    left: 16px;
    max-width: none;
  }

  .image-lightbox {
    padding: 54px 12px 20px;
  }

  .lightbox-content {
    width: 100%;
    height: calc(100dvh - 92px);
  }
}

@media (max-width: 900px) {
  .viewer-grid.comparing {
    grid-template-columns: minmax(0, 1fr);
  }

  .lightbox-gallery.is-comparing {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: repeat(2, minmax(0, 1fr));
  }

  .lightbox-gallery figcaption {
    min-height: 42px;
  }
}


/* =========================================================
   SAVED RESULTS OVERVIEW
   ========================================================= */

.catalogue-overview-grid {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 22px;
}

.catalogue-overview-grid .selection-bar {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 14px;
  margin: 0;
  padding: 18px;
}

.catalogue-overview-grid .selection-bar > .field {
  flex: none;
  width: 100%;
}

.catalogue-overview-grid .random-button {
  width: 100%;
  margin-top: 2px;
}

.catalogue-overview-grid .example-summary {
  min-width: 0;
  margin: auto 0 0;
  padding: 14px 0 0;
  border: 0;
  border-top: 1px solid rgba(96, 165, 250, 0.24);
}

.catalogue-overview-grid .ground-truth-section {
  display: flex;
  min-width: 0;
  margin: 0;
  flex-direction: column;
}

.catalogue-overview-grid .ground-truth-heading {
  flex: 0 0 auto;
}

.catalogue-overview-grid .ground-truth-stage {
  flex: 0 0 340px;
  height: 340px;
  min-height: 340px;
}

.split-performance {
  display: flex;
  min-height: 34px;
  margin: 0 14px 12px;
  padding: 7px 10px;
  align-items: center;
  gap: 10px;
  color: #94a3b8;
  font-size: 10px;
  background: rgba(5, 13, 24, 0.42);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 9px;
}

.split-performance strong {
  color: #dbeafe;
  font-size: 11px;
}

.split-performance em {
  margin-left: auto;
  color: #94a3b8;
  font-style: normal;
  font-weight: 700;
}

.split-performance em.is-positive {
  color: #86efac;
}

.split-performance em.is-negative {
  color: #fca5a5;
}

@media (max-width: 900px) {
  .catalogue-overview-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .catalogue-overview-grid .ground-truth-stage {
    height: 280px;
    min-height: 280px;
  }
}

@media (max-width: 560px) {
  .catalogue-overview-grid {
    gap: 14px;
    margin-bottom: 16px;
  }

  .catalogue-overview-grid .selection-bar {
    padding: 15px;
  }

  .catalogue-overview-grid .ground-truth-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .catalogue-overview-grid .ground-truth-meta {
    text-align: left;
  }

  .catalogue-overview-grid .ground-truth-stage {
    height: 220px;
    min-height: 220px;
  }

  .split-performance {
    flex-wrap: wrap;
  }

  .split-performance em {
    width: 100%;
    margin-left: 0;
  }
}
