:root {
  --bg: #000000;
  --surface: #0a0a0a;
  --surface-strong: #111111;
  --surface-muted: #151515;
  --text: #f5f5f5;
  --text-strong: #ffffff;
  --text-muted: #a1a1aa;
  --text-dim: #52525b;
  --line: #1f1f1f;
  --line-strong: #2a2a2a;
  --line-soft: rgba(255, 255, 255, 0.05);
  --glow: rgba(255, 255, 255, 0.07);
  --glow-strong: rgba(255, 255, 255, 0.14);
  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.12);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.12);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.12);
  --radius: 8px;
  --radius-lg: 10px;
  --font-sans: "Inter", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  color: var(--text);
  font-family: var(--font-sans);
  background:
    radial-gradient(ellipse 80% 40% at 50% 0%, rgba(255, 255, 255, 0.055), transparent),
    #000000;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

button,
input,
textarea,
select {
  font: inherit;
}

/* Slashed zeroes + tabular nums on all monospace elements */
.mono,
.score-value,
.history-stat,
.asset-endpoint,
.section-caption,
.inline-status,
.data-value,
.raw-payload {
  font-family: var(--font-mono);
  font-feature-settings: "zero" 1, "tnum" 1;
  font-variant-numeric: tabular-nums;
}

/* ─── Shell ─────────────────────────────────────────────── */

.app-shell {
  min-height: 100vh;
  padding: 20px;
}

.shell-frame {
  position: relative;
  max-width: 1440px;
  margin: 0 auto;
}

/* Gradient top border that fades at edges — Linear signature */
.shell-frame::before {
  content: "";
  position: absolute;
  top: 0;
  left: 6%;
  right: 6%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.18) 20%,
    rgba(255, 255, 255, 0.36) 50%,
    rgba(255, 255, 255, 0.18) 80%,
    transparent 100%
  );
  pointer-events: none;
}

/* ─── Topbar ─────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 16px;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(8, 8, 8, 0.88);
  backdrop-filter: blur(16px) saturate(160%);
  transition:
    top 180ms ease,
    width 180ms ease,
    margin 180ms ease,
    padding 180ms ease,
    border-radius 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease;
}

.topbar.is-solid {
  top: 0;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding-left: max(clamp(24px, 4vw, 56px), env(safe-area-inset-left));
  padding-right: max(clamp(24px, 4vw, 56px), env(safe-area-inset-right));
  border-color: var(--line-strong);
  border-right-width: 0;
  border-left-width: 0;
  border-radius: 0;
  background: #080808;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.32);
}

/* ─── Brand ─────────────────────────────────────────────── */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
}

.brand-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-copy {
  display: grid;
  gap: 1px;
}

.brand-name {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--text-strong);
}

.brand-meta {
  font-size: 11px;
  color: var(--text-dim);
}

/* ─── Nav ─────────────────────────────────────────────── */

.site-nav,
.action-row,
.history-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.site-nav {
  flex: 0 0 auto;
  margin-left: auto;
  justify-content: flex-end;
}

.site-nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 40px;
  margin-left: auto;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition:
    border-color 120ms ease,
    background-color 120ms ease,
    color 120ms ease;
}

.site-nav-toggle:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-strong);
}

.site-nav-toggle-bars {
  display: grid;
  gap: 4px;
}

.site-nav-toggle-bars span {
  display: block;
  width: 16px;
  height: 1.5px;
  border-radius: 999px;
  background: currentColor;
  transform-origin: center;
  transition:
    transform 140ms ease,
    opacity 140ms ease;
}

.site-nav-toggle[aria-expanded="true"] .site-nav-toggle-bars span:nth-child(1) {
  transform: translateY(5.5px) rotate(45deg);
}

.site-nav-toggle[aria-expanded="true"] .site-nav-toggle-bars span:nth-child(2) {
  opacity: 0;
}

.site-nav-toggle[aria-expanded="true"] .site-nav-toggle-bars span:nth-child(3) {
  transform: translateY(-5.5px) rotate(-45deg);
}

.site-nav a,
.button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  transition:
    border-color 120ms ease,
    background-color 120ms ease,
    color 120ms ease;
}

.site-nav a:hover,
.button:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
}

.site-nav a.is-active {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-strong);
}

.site-nav svg,
.button svg,
.inline-status svg {
  width: 14px;
  height: 14px;
  stroke-width: 1.6;
  flex-shrink: 0;
}

.site-nav a svg {
  color: currentColor;
  transition:
    color 120ms ease,
    filter 120ms ease;
}

.site-nav a.is-active svg {
  color: var(--success);
  filter:
    drop-shadow(0 0 6px rgba(34, 197, 94, 0.5))
    drop-shadow(0 0 10px rgba(34, 197, 94, 0.18));
}

/* ─── Page Layout ─────────────────────────────────────── */

.page-content {
  padding-top: 16px;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding: 18px 20px;
}

.site-footer-copy {
  display: grid;
  gap: 4px;
}

.site-footer-name {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-strong);
}

.site-footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.site-footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text-muted);
  transition:
    border-color 120ms ease,
    background-color 120ms ease,
    color 120ms ease;
}

.site-footer-links a:hover,
.site-footer-links a:focus-visible {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-strong);
}

.page-hero,
.history-stack,
.asset-grid {
  display: grid;
  gap: 12px;
}

.result-layout {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
}

.result-layout > .console-card {
  width: 100%;
  min-width: 0;
}

.result-layout > .media-panel,
.result-layout > .hero-card {
  grid-column: span 6;
}

.result-layout > .matrix-card,
.result-layout > .console-card:last-child {
  grid-column: span 6;
}

.asset-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

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

.console-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  /* Subtle inner gradient */
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* Inner top gradient line — fades at edges */
.console-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 14%;
  right: 14%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.18) 40%,
    rgba(255, 255, 255, 0.28) 50%,
    rgba(255, 255, 255, 0.18) 60%,
    transparent
  );
  pointer-events: none;
  z-index: 1;
}

/* Beam hero cards — radial glow above card center */
.beam-card {
  background:
    radial-gradient(ellipse 70% 50% at 50% -5%, rgba(255, 255, 255, 0.09), transparent),
    var(--surface);
}

.hero-card,
.matrix-card,
.debug-card,
.media-panel,
.empty-state,
.history-card,
.asset-card {
  padding: 18px;
}

.media-panel,
.matrix-card {
  display: grid;
  gap: 14px;
}

/* ─── Flex rows ───────────────────────────────────────── */

.eyebrow-row,
.panel-head,
.section-bar,
.asset-head,
.history-head,
.history-footer,
.result-header,
.score-band,
.score-side-row,
.hazard-row,
.asset-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-head,
.section-bar {
  padding-bottom: 12px;
  margin-bottom: 0;
  border-bottom: 1px solid;
  border-image: linear-gradient(
    90deg,
    transparent,
    var(--line) 16%,
    var(--line) 84%,
    transparent
  ) 1;
}

/* ─── Typography ──────────────────────────────────────── */

.eyebrow {
  margin: 0;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.inline-status,
.section-caption,
.asset-endpoint {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-dim);
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.04em;
  color: var(--text-strong);
}

h1 {
  margin-top: 10px;
  font-size: clamp(20px, 2.8vw, 32px);
  line-height: 0.97;
}

h2 {
  margin-top: 3px;
  font-size: clamp(18px, 2.5vw, 22px);
  line-height: 1.06;
}

h3 {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.15;
}

.hero-copy,
.asset-description,
.history-summary,
.helper-card p,
.summary-card p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.65;
  font-size: 13.5px;
}

/* ─── Actions ─────────────────────────────────────────── */

.action-row {
  margin-top: 18px;
}

.button {
  cursor: pointer;
}

.button-primary {
  border-color: #333333;
  color: var(--text-strong);
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.1), transparent 75%),
    rgba(255, 255, 255, 0.03);
}

.button-primary:hover {
  border-color: #484848;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.16), transparent 75%),
    rgba(255, 255, 255, 0.05);
}

.button-secondary {
  background: transparent;
}

.button:active {
  transform: translateY(1px);
}

.cta-button {
  appearance: none;
}

.cta-button:disabled {
  cursor: wait;
  opacity: 0.75;
}

.cta-button.is-loading::before {
  content: "";
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  border-top-color: rgba(255, 255, 255, 0.9);
  animation: spin 0.75s linear infinite;
  flex-shrink: 0;
}

/* ─── Section Bar ─────────────────────────────────────── */

.section-bar {
  margin: 24px 0 12px;
}

.section-bar[id] {
  scroll-margin-top: 96px;
}

.section-bar h2 {
  margin-top: 3px;
}

.mvp-banner[hidden] {
  display: none;
}

.mvp-banner {
  display: grid;
  gap: 18px;
  margin: 10px 0 15px;
  padding: 20px 24px;
  background:
    radial-gradient(circle at top right, rgba(251, 191, 36, 0.18), transparent 34%),
    radial-gradient(circle at 18% 18%, rgba(245, 158, 11, 0.12), transparent 30%),
    linear-gradient(180deg, rgba(61, 36, 7, 0.95) 0%, rgba(24, 14, 4, 0.96) 100%);
  border-color: rgba(245, 158, 11, 0.38);
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 214, 0.08),
    0 0 0 1px rgba(251, 191, 36, 0.06);
}

.mvp-banner-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.mvp-banner-copy {
  display: grid;
  gap: 8px;
}

.mvp-banner-copy p {
  margin: 0;
  line-height: 1.65;
  font-size: 13.5px;
}

.mvp-banner-copy h2 {
  margin-top: 0;
}

.mvp-banner-copy a {
  color: #fde68a;
  text-decoration: underline;
  text-decoration-color: rgba(251, 191, 36, 0.45);
  text-underline-offset: 0.18em;
  transition:
    color 120ms ease,
    text-decoration-color 120ms ease;
}

.mvp-banner-copy a:hover,
.mvp-banner-copy a:focus-visible {
  color: #fff3d4;
  text-decoration-color: rgba(255, 243, 212, 0.7);
}

.mvp-banner-dismiss {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: 999px;
  background: rgba(255, 248, 220, 0.04);
  color: #d6b26e;
  cursor: pointer;
  flex: 0 0 auto;
  transition:
    border-color 120ms ease,
    background-color 120ms ease,
    color 120ms ease;
}

.mvp-banner-dismiss:hover {
  border-color: rgba(251, 191, 36, 0.5);
  background: rgba(255, 248, 220, 0.08);
  color: #fff3d4;
}

.mvp-banner-dismiss svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.8;
}

.input-chooser {
  display: grid;
  gap: 18px;
}

.input-chooser-copy {
  display: grid;
  gap: 8px;
}

.input-choice-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}

.input-choice {
  display: grid;
  gap: 18px;
  padding: 24px;
  min-width: 0;
}

.input-choice-upload {
  background:
    radial-gradient(circle at top, rgba(34, 197, 94, 0.09), transparent 54%),
    linear-gradient(180deg, rgba(11, 18, 13, 0.98) 0%, rgba(8, 10, 9, 1) 100%);
  border-color: rgba(34, 197, 94, 0.26);
}

.input-choice-gallery {
  background:
    radial-gradient(circle at top, rgba(245, 158, 11, 0.1), transparent 58%),
    linear-gradient(180deg, rgba(22, 16, 8, 0.98) 0%, rgba(10, 9, 7, 1) 100%);
  border-color: rgba(245, 158, 11, 0.24);
}

.input-choice-head,
.input-choice-form {
  display: grid;
  gap: 10px;
}

.input-choice-divider {
  display: flex;
  align-items: center;
  justify-content: center;
}

.input-choice-divider span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.08), transparent 72%),
    rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 0 0 1px rgba(255, 255, 255, 0.02);
}

.upload-help {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-dim);
}

.upload-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.upload-submit {
  min-height: 40px;
  padding: 0 14px;
  border-color: rgba(34, 197, 94, 0.42);
  color: #f0fdf4;
  background:
    radial-gradient(circle at top, rgba(34, 197, 94, 0.24), transparent 72%),
    linear-gradient(180deg, rgba(24, 58, 38, 0.98) 0%, rgba(10, 28, 18, 0.98) 100%);
  box-shadow:
    inset 0 1px 0 rgba(240, 253, 244, 0.1),
    0 0 0 1px rgba(34, 197, 94, 0.06);
}

.upload-submit:hover {
  border-color: rgba(74, 222, 128, 0.68);
  color: #ffffff;
  background:
    radial-gradient(circle at top, rgba(74, 222, 128, 0.32), transparent 72%),
    linear-gradient(180deg, rgba(29, 76, 49, 0.98) 0%, rgba(12, 33, 22, 0.98) 100%);
}

.upload-submit svg {
  color: #86efac;
}

.sample-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.sample-strip-thumb {
  overflow: hidden;
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 8px;
  background: var(--surface-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.sample-strip-thumb img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.input-choice-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.input-choice-jump {
  min-height: 40px;
  padding: 0 14px;
  border-color: rgba(245, 158, 11, 0.34);
  color: #fff7ed;
  background:
    radial-gradient(circle at top, rgba(245, 158, 11, 0.18), transparent 72%),
    linear-gradient(180deg, rgba(56, 35, 10, 0.98) 0%, rgba(24, 16, 7, 0.98) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 247, 237, 0.08),
    0 0 0 1px rgba(245, 158, 11, 0.06);
}

.input-choice-jump:hover {
  border-color: rgba(251, 191, 36, 0.5);
  color: #ffffff;
  background:
    radial-gradient(circle at top, rgba(251, 191, 36, 0.24), transparent 72%),
    linear-gradient(180deg, rgba(72, 45, 12, 0.98) 0%, rgba(29, 20, 8, 0.98) 100%);
}

.input-choice-jump svg {
  color: #fcd34d;
}

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

.asset-card {
  display: grid;
  gap: 12px;
  padding: 10px;
}

.asset-preview {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.asset-preview img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.asset-body {
  display: grid;
  gap: 12px;
  padding: 6px 4px;
}

.asset-head,
.history-head,
.result-header {
  align-items: flex-start;
}

.history-kicker,
.helper-label,
.score-caption,
.summary-label,
dt {
  margin: 0;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.asset-meta-row {
  display: grid;
  gap: 8px;
}

/* ─── Pills / Tags / Badges ───────────────────────────── */

.label-badge,
.history-stat {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 10.5px;
}

.history-stat {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
}

.label-badge {
  min-width: 76px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.label-clear {
  color: #bbf7d0;
  border-color: rgba(34, 197, 94, 0.28);
  background: var(--success-soft);
}

.label-review {
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.28);
  background: var(--warning-soft);
}

.label-stop {
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.28);
  background: var(--danger-soft);
}

.asset-footer {
  margin-top: 2px;
  justify-content: flex-end;
}

.asset-action {
  width: 100%;
  justify-content: center;
  border-color: rgba(34, 197, 94, 0.34);
  color: #dcfce7;
  background:
    radial-gradient(circle at top, rgba(34, 197, 94, 0.2), transparent 72%),
    linear-gradient(180deg, rgba(21, 44, 31, 0.98) 0%, rgba(10, 23, 15, 0.98) 100%);
  box-shadow:
    inset 0 1px 0 rgba(220, 252, 231, 0.08),
    0 0 0 1px rgba(34, 197, 94, 0.05);
}

.asset-action:hover {
  border-color: rgba(74, 222, 128, 0.6);
  color: #f0fdf4;
  background:
    radial-gradient(circle at top, rgba(74, 222, 128, 0.28), transparent 72%),
    linear-gradient(180deg, rgba(25, 60, 39, 0.98) 0%, rgba(11, 28, 18, 0.98) 100%);
}

.asset-action svg {
  color: #86efac;
}

/* ─── Forms ───────────────────────────────────────────── */

.upload-form,
.hazard-list {
  display: grid;
  gap: 10px;
}

.data-key {
  font-size: 12.5px;
  color: var(--text-muted);
}

.data-value {
  font-size: 11.5px;
  color: var(--text-strong);
}

input[type="file"] {
  width: 100%;
  min-height: 140px;
  padding: 14px;
  border: 1px dashed #2a2a2a;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent 100%),
    var(--surface-strong);
  color: var(--text-muted);
  transition: border-color 120ms ease;
}

input[type="file"]:hover {
  border-color: #383838;
}

input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-strong);
  cursor: pointer;
  font-size: 12px;
  transition: background 120ms ease;
}

input[type="file"]::file-selector-button:hover {
  background: rgba(255, 255, 255, 0.07);
}

.facts-grid,
.image-meta-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.helper-card,
.fact-card,
.summary-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.012);
  padding: 12px;
}

.helper-card p,
.summary-card p {
  margin-top: 5px;
}

/* ─── Media ───────────────────────────────────────────── */

.media-frame {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
}

.media-frame img {
  width: 100%;
  min-height: 400px;
  object-fit: cover;
}

.image-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  color: var(--text-dim);
  font-size: 13px;
}

.image-fallback.small {
  min-height: 140px;
}

.image-meta-grid {
  margin-top: 10px;
}

/* ─── Result / Score ──────────────────────────────────── */

.result-header {
  align-items: start;
  margin-top: 10px;
}

.score-band {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(220px, 1fr);
  align-items: stretch;
  margin: 16px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(ellipse 60% 80% at 0% 50%, rgba(255, 255, 255, 0.06), transparent),
    rgba(255, 255, 255, 0.018);
}

.score-main {
  display: grid;
  gap: 6px;
}

.score-value {
  font-size: clamp(44px, 8vw, 80px);
  line-height: 0.9;
  letter-spacing: -0.09em;
  color: var(--text-strong);
}

/* Color-coded score by risk label */
.score-value.is-clear {
  color: var(--success);
}

.score-value.is-review {
  color: var(--warning);
}

.score-value.is-stop {
  color: var(--danger);
}

.score-side {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  min-width: 0;
}

.score-side-row {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.012);
}

.facts-grid {
  margin: 0;
  align-items: stretch;
}

.fact-card {
  display: grid;
  gap: 6px;
  height: 100%;
}

dd {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-strong);
}

.summary-card {
  margin-top: 10px;
}

/* ─── Hazard Matrix ───────────────────────────────────── */

.hazard-list {
  margin-top: 14px;
  gap: 6px;
}

.hazard-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.012);
  transition: background 120ms ease;
}

.hazard-row:hover {
  background: rgba(255, 255, 255, 0.022);
}

.hazard-main {
  flex: 1;
  min-width: 0;
}

.hazard-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
}

.hazard-name {
  text-transform: capitalize;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.hazard-presence {
  font-size: 11px;
  font-family: var(--font-mono);
  font-feature-settings: "zero" 1;
  letter-spacing: 0.04em;
}

.hazard-presence.present {
  color: #fca5a5;
}

.hazard-presence.absent {
  color: #86efac;
}

.meter-track {
  display: block;
  width: 100%;
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
}

.meter-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.meter-fill.is-present {
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.45), rgba(239, 68, 68, 0.95));
}

.meter-fill.is-absent {
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.35), rgba(34, 197, 94, 0.85));
}

/* Confidence value to the right of each hazard row */
.hazard-confidence {
  font-family: var(--font-mono);
  font-feature-settings: "zero" 1, "tnum" 1;
  font-size: 12px;
  color: var(--text-dim);
  min-width: 36px;
  text-align: right;
}

/* ─── Raw Payload ─────────────────────────────────────── */

.raw-payload {
  margin: 14px 0 0;
  max-height: 480px;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #040404;
  color: #a1a1aa;
  font-size: 11.5px;
  line-height: 1.75;
}

/* ─── History ─────────────────────────────────────────── */

.history-stack {
  margin-top: 0;
  gap: 8px;
}

.history-card {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.history-thumb {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.history-thumb img,
.history-thumb .image-fallback {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.history-main {
  display: grid;
  gap: 10px;
}

.history-head {
  align-items: start;
}

.history-footer {
  margin-top: auto;
}

.history-stats {
  gap: 6px;
}

.history-stat {
  min-height: 22px;
  font-size: 10.5px;
}

/* ─── Empty State ─────────────────────────────────────── */

.empty-state {
  display: grid;
  justify-items: start;
  gap: 12px;
  min-height: 240px;
}

.empty-state svg {
  width: 16px;
  height: 16px;
  color: var(--text-dim);
  stroke-width: 1.5;
}

/* ─── Animation ───────────────────────────────────────── */

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

@media (max-width: 1100px) {
  .topbar {
    align-items: center;
  }

  .site-nav {
    justify-content: flex-end;
  }

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

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

@media (max-width: 760px) {
  .app-shell {
    padding: 12px;
  }

  .topbar {
    top: 12px;
    align-items: center;
    padding: 10px 12px;
  }

  .topbar.is-solid {
    padding-left: max(clamp(18px, 5vw, 28px), env(safe-area-inset-left));
    padding-right: max(clamp(18px, 5vw, 28px), env(safe-area-inset-right));
  }

  .page-content {
    padding-top: 12px;
  }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    padding: 14px;
  }

  .site-footer-links {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .result-layout {
    grid-template-columns: 1fr;
  }

  .hero-card,
  .matrix-card,
  .media-panel,
  .empty-state,
  .history-card,
  .asset-card,
  .input-choice {
    padding: 14px;
  }

  .facts-grid,
  .image-meta-grid {
    grid-template-columns: 1fr;
  }

  .score-band,
  .section-bar,
  .history-head,
  .history-footer,
  .asset-footer,
  .input-choice-actions,
  .upload-actions,
  .panel-head,
  .result-header,
  .hazard-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .score-band {
    grid-template-columns: 1fr;
  }

  .score-side {
    width: 100%;
    min-width: 0;
    grid-template-columns: 1fr;
  }

  .score-side-row {
    width: 100%;
  }

  .site-nav-toggle {
    display: inline-flex;
    flex: 0 0 auto;
  }

  .site-nav {
    display: none;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 8px;
    width: 100%;
    margin-left: 0;
    padding-top: 4px;
  }

  .site-nav.is-open {
    display: flex;
  }

  .site-nav a,
  .button,
  .site-footer-links a {
    width: 100%;
    justify-content: center;
  }

  .site-nav a {
    min-height: 40px;
  }

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

  .input-choice-grid {
    grid-template-columns: 1fr;
  }

  .input-choice-divider {
    min-height: 24px;
  }

  .input-choice-divider span {
    width: 100%;
    height: 32px;
    border-radius: 999px;
    letter-spacing: 0.18em;
  }

  .sample-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .asset-action,
  .input-choice-jump,
  .upload-submit {
    width: 100%;
  }

  .mvp-banner {
    padding: 14px;
  }

  .mvp-banner-head {
    align-items: stretch;
    flex-direction: column;
  }

  .mvp-banner-dismiss {
    align-self: flex-end;
  }

  .upload-actions .section-caption {
    width: 100%;
    justify-content: center;
  }

  h1 {
    font-size: clamp(18px, 6vw, 26px);
  }
}
