:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #eef2f6;
  color: #111827;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button,
select,
input {
  font: inherit;
}

button,
.fileButton,
select {
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #ffffff;
  color: #111827;
  min-height: 36px;
  padding: 7px 10px;
}

button {
  cursor: pointer;
}

.app {
  min-height: 100vh;
}

.topbar {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid #d9e0e8;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 14px 16px;
}

h1 {
  font-size: 20px;
  line-height: 1.15;
  margin: 0 0 4px;
}

h2 {
  font-size: 13px;
  letter-spacing: 0;
  margin: 0 0 10px;
  text-transform: uppercase;
}

p {
  color: #667085;
  margin: 0;
}

.actions,
.buttonRow {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.fileButton {
  cursor: pointer;
  display: inline-flex;
  position: relative;
}

.fileButton input {
  height: 1px;
  opacity: 0;
  overflow: hidden;
  position: absolute;
  width: 1px;
}

.authBox {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.authInput {
  min-height: 36px;
  min-width: 150px;
}

.authUser {
  color: #344054;
  font-size: 12px;
  font-weight: 700;
}

.workspace {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr) 340px;
  padding: 14px;
}

.viewer {
  align-items: center;
  background: #111827;
  border: 1px solid #263244;
  border-radius: 8px;
  display: flex;
  height: min(calc(100vh - 104px), 760px);
  min-height: 520px;
  overflow: hidden;
  position: relative;
}

video,
canvas {
  display: block;
  height: 100%;
  left: 0;
  object-fit: contain;
  position: absolute;
  top: 0;
  width: 100%;
}

canvas {
  pointer-events: none;
}

.viewer.manualEditing canvas {
  cursor: crosshair;
  pointer-events: auto;
}

.playbackBadge {
  background: rgba(17, 24, 39, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  left: 12px;
  padding: 5px 9px;
  pointer-events: none;
  position: absolute;
  top: 12px;
}

.playbackBadge.playing {
  background: rgba(15, 118, 110, 0.88);
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section {
  background: #ffffff;
  border: 1px solid #d9e0e8;
  border-radius: 8px;
  overflow: hidden;
}

.section summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  list-style: none;
  padding: 12px;
  user-select: none;
}

.section summary::-webkit-details-marker {
  display: none;
}

.section summary::after {
  color: #667085;
  content: "+";
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.section[open] summary {
  border-bottom: 1px solid #eef2f6;
}

.section[open] summary::after {
  content: "-";
}

.section summary h2 {
  margin: 0;
}

.sectionBody {
  padding: 0 12px 12px;
}

label {
  color: #374151;
  display: grid;
  font-size: 13px;
  gap: 5px;
  margin: 9px 0;
}

label:has(input[type="checkbox"]) {
  align-items: center;
  display: flex;
}

input[type="range"] {
  width: 100%;
}

output {
  color: #0f766e;
  float: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.readout,
pre {
  color: #344054;
  font-size: 12px;
  line-height: 1.4;
}

.clipMetaGrid {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.clipMetaRow {
  align-items: baseline;
  border-bottom: 1px solid #eef2f6;
  display: grid;
  gap: 8px;
  grid-template-columns: 92px minmax(0, 1fr);
  padding-bottom: 7px;
}

.clipMetaRow span {
  color: #667085;
  font-size: 11px;
  text-transform: uppercase;
}

.clipMetaRow strong {
  color: #111827;
  font-size: 12px;
  font-weight: 700;
  min-width: 0;
  overflow-wrap: anywhere;
}

.clipFlagList {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 2px;
}

.clipFlag {
  background: #eef6ff;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 7px;
}

.suggestionList {
  border-top: 1px solid #eef2f6;
  display: grid;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
}

.suggestionRow {
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  color: #344054;
  cursor: default;
  display: grid;
  font-size: 12px;
  gap: 2px;
  grid-template-columns: 1fr auto;
  padding: 7px 8px;
}

.suggestionRow:hover,
.suggestionRowActive {
  background: #ecfeff;
  border-color: #38bdf8;
}

.suggestionTitle {
  color: #111827;
  font-weight: 700;
}

.suggestionMeta {
  color: #667085;
  font-variant-numeric: tabular-nums;
}

.legend {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr;
}

.legend div {
  align-items: center;
  color: #374151;
  display: flex;
  font-size: 13px;
  gap: 8px;
}

.swatch {
  border-radius: 999px;
  display: inline-block;
  height: 12px;
  width: 12px;
}

.swatch.pupil {
  background: #22c55e;
}

.swatch.iris {
  background: #38bdf8;
}

.swatch.mpEye {
  background: #84cc16;
}

.swatch.mpIris {
  background: #a855f7;
}

.swatch.benchmark {
  background: #fef08a;
}

.swatch.appOverlay {
  background: #f43f5e;
}

.swatch.manualIris {
  background: #f59e0b;
}

.swatch.manualEyeRoi {
  background: #f59e0b;
}

.swatch.manualPupil {
  background: #ef4444;
}

.swatch.eyeRoi {
  background: #facc15;
}

.swatch.candidate {
  background: #fb923c;
}

.swatch.rejected {
  background: #f87171;
}

.swatch.sclera {
  background: #22d3ee;
}

pre {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  margin: 0;
  max-height: 260px;
  overflow: auto;
  padding: 9px;
  white-space: pre-wrap;
}

.toggleButtonActive {
  background: #111827;
  border-color: #111827;
  color: #ffffff;
}

@media (max-width: 960px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

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

  .viewer {
    aspect-ratio: 4 / 3;
    height: auto;
    min-height: 0;
  }
}
