:root {
  --hud-bg: #0000008c;
  --hud-bg-strong: rgba(0, 0, 0, 0.72);
  --hud-border: rgba(255, 255, 255, 0.35);
  --hud-border-soft: rgba(255, 255, 255, 0.2);
  --hud-text: rgba(255, 255, 255, 0.96);
  --hud-muted: rgba(255, 255, 255, 0.68);
  --hud-faint: rgba(255, 255, 255, 0.42);
  --hud-accent: rgba(255, 255, 255, 0.96);
  --hud-button: rgba(255, 255, 255, 0.08);
  --hud-button-hover: rgba(255, 255, 255, 0.14);
  --positive: rgba(255, 158, 74, 0.95);
  --gradient: rgba(84, 206, 255, 0.92);
  --update: rgba(255, 70, 74, 0.92);
  color-scheme: dark;
  font-family:
    "Segoe UI", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    sans-serif;
  background: #000;
  color: #fff;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: #000;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--hud-text);
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  background:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(circle at 50% 20%, black 0 22%, transparent 72%);
}

body::after {
  background:
    radial-gradient(circle at 72% 12%, rgba(255, 158, 74, 0.2), transparent 18rem),
    radial-gradient(circle at 16% 78%, rgba(84, 206, 255, 0.18), transparent 22rem),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 18rem);
}

#attribution {
  position: fixed;
  left: 50%;
  bottom: 10px;
  z-index: 2;
  width: min(620px, calc(100vw - 24px));
  margin: 0;
  color: rgba(255, 255, 255, 0.52);
  font-size: 10px;
  line-height: 1.35;
  letter-spacing: 0;
  text-align: center;
  text-shadow: 0 0 6px #000;
  transform: translateX(-50%);
  pointer-events: none;
}

button,
input {
  font: inherit;
}

.shell {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  width: min(1180px, calc(100% - 24px));
  margin: 0 auto;
  padding: 12px 0 28px;
}

.hero,
.control-panel,
.progress-card,
.dashboard > article,
.results-card,
.status-strip article {
  border: 1px solid var(--hud-border);
  background: var(--hud-bg);
  color: var(--hud-text);
  text-shadow: 0 0 6px #000;
  backdrop-filter: blur(8px);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 96px;
  padding: 8px 12px;
}

.hero.hero--light {
  border-color: rgba(0, 0, 0, 0.16);
  background: #f6f6f2;
  color: #111;
  text-shadow: none;
}

.hero.hero--light .eyebrow {
  color: rgba(0, 0, 0, 0.55);
}

.hero.hero--light h1,
.hero.hero--light h2 {
  color: #111;
}

.hero.hero--light .lede {
  color: rgba(0, 0, 0, 0.7);
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--hud-muted);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1,
h2 {
  color: var(--hud-text);
  font-weight: 600;
  letter-spacing: 0.02em;
}

h1 {
  margin-bottom: 6px;
  font-size: clamp(22px, 4.2vw, 44px);
  line-height: 0.95;
  text-transform: uppercase;
}


h2 {
  margin-bottom: 8px;
  font-size: clamp(18px, 3vw, 30px);
  line-height: 1;
}

.lede,
.control-panel p,
.latest-card p:not(.eyebrow) {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--hud-muted);
  font-size: 12px;
  line-height: 1.55;
}

.hero .lede {
  margin-top: 4px;
}

.lede-highlight {
  display: inline-block;
  padding: 2px 6px;
  background: #111;
  color: #fff;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.hero-logo {
  display: block;
  width: min(128px, 18vw);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.22));
  animation: hud-in 420ms ease both;
}

.control-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.mode-tabs {
  display: flex;
  gap: 8px;
  align-items: center;
}

.mode-tab {
  grid-column: auto;
  width: auto;
  padding: 7px 9px;
  color: var(--hud-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 10px;
}

.mode-tab.is-active {
  border-color: rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.14);
  color: var(--hud-text);
}

.mode-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 520px);
  gap: 18px;
}

.mode-panel[hidden] {
  display: none;
}

.run-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
}

.custom-form {
  display: grid;
  gap: 8px;
  align-content: stretch;
  min-height: 150px;
  border: 1px dashed var(--hud-border);
  padding: 14px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--hud-muted);
}

.custom-file-drop {
  min-height: 88px;
  align-content: center;
  border: 1px solid var(--hud-border-soft);
  padding: 14px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 52%),
    rgba(0, 0, 0, 0.18);
  cursor: pointer;
}

.custom-file-drop span {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.custom-file-drop strong {
  color: var(--hud-text);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.custom-file-drop input {
  margin-top: 10px;
  padding: 7px;
  cursor: pointer;
}

.custom-form p {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
}

.custom-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.custom-actions button {
  grid-column: auto;
}

label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--hud-muted);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--hud-border);
  border-radius: 0;
  padding: 8px 9px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--hud-text);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  outline: none;
}

input:focus {
  border-color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.08);
}

button {
  grid-column: 1 / -1;
  min-width: 0;
  border: 1px solid var(--hud-border);
  border-radius: 0;
  padding: 9px;
  background: var(--hud-button);
  color: var(--hud-text);
  font-size: 12px;
  line-height: 1.2;
  letter-spacing: 0;
  cursor: pointer;
  transition:
    background-color 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease;
}

button:hover {
  border-color: rgba(255, 255, 255, 0.48);
  background: var(--hud-button-hover);
}

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

button:disabled {
  cursor: default;
  opacity: 0.55;
}

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

.status-strip article {
  display: grid;
  gap: 4px;
  min-height: 86px;
  padding: 12px;
  font-variant-numeric: tabular-nums;
}

.status-strip span {
  color: var(--hud-muted);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.status-strip strong {
  overflow: hidden;
  color: var(--hud-accent);
  font-size: clamp(24px, 4vw, 48px);
  font-weight: 600;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-card {
  padding: 12px;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--hud-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 12px;
  overflow: hidden;
  border: 1px solid var(--hud-border-soft);
  background: rgba(255, 255, 255, 0.03);
}

#progress-bar {
  width: 0%;
  height: 100%;
  background:
    linear-gradient(90deg, var(--positive), rgba(255, 255, 255, 0.96), var(--gradient)),
    repeating-linear-gradient(90deg, transparent 0 18px, rgba(0, 0, 0, 0.35) 18px 20px);
  transition: width 160ms linear;
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 10px;
}

.dashboard > article,
.results-card {
  min-height: 260px;
  padding: 14px;
}

.latest-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.selected-image-shell {
  position: relative;
  display: grid;
  min-height: 220px;
  flex: 1;
  align-items: center;
  border: 1px solid var(--hud-border-soft);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.06), transparent 42%),
    rgba(255, 255, 255, 0.02);
  overflow: hidden;
}

.selected-image-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 18px 18px;
  opacity: 0.42;
  pointer-events: none;
}

.selected-image-shell img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  max-height: 330px;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.5);
}

.selected-image-shell img[hidden] {
  display: none;
}

.selected-image-empty {
  position: relative;
  z-index: 1;
  padding: 26px;
  color: var(--hud-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.selected-image-overlay {
  position: absolute;
  z-index: 2;
  right: 10px;
  bottom: 10px;
  left: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.66);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
}

#latest-image {
  overflow: hidden;
  margin: 0 0 7px;
  color: var(--hud-text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

#latest-text {
  max-height: 86px;
  margin: 0;
  color: var(--hud-accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(16px, 2vw, 19px);
  line-height: 1.25;
  overflow: auto;
}

.thumb-card {
  max-height: 410px;
  overflow: hidden;
}

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 6px;
  max-height: 318px;
  margin: 12px 0 0;
  padding: 0;
  overflow: auto;
}

.thumb-frame {
  position: relative;
  min-width: 0;
  aspect-ratio: 16 / 10;
  margin: 0;
  border: 1px solid var(--hud-border-soft);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  overflow: hidden;
}

.thumb-frame:focus-visible,
.thumb-frame.is-selected {
  border-color: rgba(255, 255, 255, 0.86);
  outline: none;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.9),
    0 0 0 3px rgba(255, 255, 255, 0.32),
    inset 0 0 22px rgba(255, 255, 255, 0.14);
}

.thumb-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.92) contrast(1.06) brightness(0.9);
}

.thumb-frame figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 3px 5px;
  background: rgba(0, 0, 0, 0.7);
  color: var(--hud-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thumb-status {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 1;
  border: 1px solid rgba(255, 255, 255, 0.28);
  padding: 2px 4px;
  background: rgba(0, 0, 0, 0.72);
  color: var(--hud-text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 8px;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.results-card {
  display: grid;
  grid-template-columns: minmax(0, 0.6fr) minmax(0, 1.4fr);
  gap: 14px;
  min-height: auto;
}

.artifact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: flex-start;
  justify-content: flex-end;
  color: var(--hud-muted);
  font-size: 12px;
}

.artifact-links a {
  border: 1px solid var(--hud-border);
  padding: 7px 9px;
  background: var(--hud-button);
  color: var(--hud-text);
  font-size: 11px;
  text-decoration: none;
  transition:
    background-color 0.18s ease,
    border-color 0.18s ease;
}

.artifact-links a:hover {
  border-color: rgba(255, 255, 255, 0.48);
  background: var(--hud-button-hover);
}

@keyframes hud-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 820px) {
  .hero,
  .mode-panel,
  .dashboard,
  .results-card {
    grid-template-columns: 1fr;
  }

  .hero-logo {
    width: 148px;
  }

  .status-strip,
  .run-form {
    grid-template-columns: 1fr 1fr;
  }

  .artifact-links {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 16px, 1180px);
    padding-top: 8px;
  }

  .status-strip,
  .run-form {
    grid-template-columns: 1fr;
  }
}
