:root {
  --bg: #0a0d0b;
  --panel: #10140f;
  --panel-border: #223027;
  --text: #d9e8dd;
  --text-dim: #7d9488;
  --accent: #6dffb0;
  --accent-dim: #2f6b4e;
  --amber: #ffb445;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
}

body {
  position: relative;
  overflow-x: hidden;
}

/* faint scanline texture across the whole page, subject-appropriate */
.scope-lines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(109, 255, 176, 0.02) 0px,
    rgba(109, 255, 176, 0.02) 1px,
    transparent 1px,
    transparent 3px
  );
}

.topbar {
  border-bottom: 1px solid var(--panel-border);
  position: relative;
  z-index: 1;
}

.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-weight: 600;
  letter-spacing: 0.04em;
  font-size: 15px;
}

.brand-mark {
  color: var(--accent);
  font-size: 16px;
}

.brand-accent { color: var(--accent); }

.model-tag {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  border: 1px solid var(--panel-border);
  padding: 4px 10px;
  border-radius: 3px;
}

.stage {
  max-width: 1180px;
  margin: 0 auto;
  padding: 48px 24px 80px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 336px;
  grid-template-areas:
    "intro  samples"
    "panel  samples";
  gap: 0 26px;
  align-items: start;
  position: relative;
  z-index: 1;
}

.intro h1 {
  font-family: var(--mono);
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 500;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}

.intro p {
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1.6;
  max-width: 56ch;
  margin: 0 0 16px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 24px;
}

.dropzone {
  border: 1px dashed var(--panel-border);
  border-radius: 5px;
  padding: 56px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone:hover,
.dropzone:focus-visible,
.dropzone.dragover {
  border-color: var(--accent-dim);
  background: rgba(109, 255, 176, 0.03);
  outline: none;
}

.dropzone-icon {
  display: block;
  font-size: 28px;
  color: var(--accent);
  margin-bottom: 14px;
}

.dropzone-text {
  margin: 0 0 6px;
  font-size: 15px;
  color: var(--text);
}

.dropzone-sub {
  margin: 0;
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--mono);
}

.hidden { display: none !important; }

.work-area {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 20px;
}

@media (max-width: 640px) {
  .work-area { grid-template-columns: 1fr; }
}

.canvas-wrap {
  position: relative;
  background: #000;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

/* radar sweep — shown while inference is running */
.sweep {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
}

.sweep-ring {
  position: absolute;
  border: 1px solid rgba(109, 255, 176, 0.25);
  border-radius: 50%;
}
.sweep-ring.r1 { width: 40%; height: 40%; }
.sweep-ring.r2 { width: 65%; height: 65%; }
.sweep-ring.r3 { width: 90%; height: 90%; }

.sweep-arm {
  position: absolute;
  width: 45%;
  height: 45%;
  top: 5%;
  left: 50%;
  background: conic-gradient(from 0deg, rgba(109, 255, 176, 0.55), transparent 55deg);
  border-radius: 0 100% 0 0;
  transform-origin: 0% 100%;
  animation: sweep-rotate 1.4s linear infinite;
}

@keyframes sweep-rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.results {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.results-head {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.results-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  max-height: 420px;
}

.result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  font-size: 13px;
}

.result-swatch {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  flex-shrink: 0;
}

.result-name {
  flex: 1;
  font-family: var(--mono);
  font-size: 12.5px;
}

.result-score {
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 12px;
}

.results-empty {
  color: var(--text-dim);
  font-size: 13px;
  font-family: var(--mono);
  padding: 10px 2px;
}

.status-line {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  min-height: 18px;
  margin: 16px 2px 0;
}

.status-line.error { color: #ff7a6b; }
.status-line.ok { color: var(--accent); }

.reset-btn {
  margin-top: 16px;
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.03em;
  padding: 10px 16px;
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.reset-btn:hover {
  border-color: var(--accent-dim);
  color: var(--accent);
}

.intro   { grid-area: intro; }
.panel   { grid-area: panel; }
.samples { grid-area: samples; }

@media (max-width: 900px) {
  .stage {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "intro"
      "panel"
      "samples";
    gap: 22px 0;
  }
}

/* ===========================================================
   Sample library
   The page was one narrow column with a lot of dead space below
   the fold. It is now a two-column grid: work on the left,
   the sample shelf on the right, intro spanning both.
   =========================================================== */
.samples {
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  background: var(--panel);
  padding: 16px 16px 18px;
  position: relative;
  z-index: 1;
}

.samples-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 9px;
}
.samples-hint { color: var(--accent-dim); }

.samples-note {
  margin: 11px 0 16px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-dim);
}

.sample-groups { display: grid; gap: 15px; }

.sample-group-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 7px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--text);
}

.sample-swatch {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex: 0 0 auto;
}

.sample-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.sample {
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: 3px;
  background: #070a08;
  aspect-ratio: 1;
  overflow: hidden;
  cursor: grab;
  transition: border-color 0.15s ease, transform 0.1s ease;
}
.sample img {
  width: 100%;
  height: 100%;
  /* contain, not cover - these chips are one aircraft each and cropping
     would cut the wingtips off the thing you are meant to be looking at */
  object-fit: contain;
  display: block;
}
.sample:hover,
.sample:focus-visible {
  border-color: var(--accent);
  outline: none;
  transform: translateY(-1px);
}
.sample:active { cursor: grabbing; }
.sample.dragging { opacity: 0.4; }

@media (max-width: 900px) {
  .samples { margin-top: 4px; }
  .sample-row { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
