:root {
  color-scheme: dark;
  --bg: #111312;
  --panel: #191d1b;
  --text: #f4f0e8;
  --muted: #a5aaa4;
  --line: #313832;
  --accent: #47d18c;
  --warn: #f0b84e;
  --danger: #e85d6a;
  --blue: #62a8ff;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 0;
}

.stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100vh;
  background: #080908;
  overflow: hidden;
}

#video,
#overlay {
  width: min(100vw, calc(100vh * 1));
  height: min(100vw, calc(100vh * 1));
  max-width: 100%;
  max-height: 100vh;
  aspect-ratio: 1 / 1;
}

#video {
  object-fit: cover;
  background: #050605;
}

#overlay {
  position: absolute;
  pointer-events: none;
}

.status-strip {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-strip span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(244, 240, 232, 0.16);
  background: rgba(8, 9, 8, 0.72);
  color: var(--text);
  padding: 4px 10px;
  border-radius: 6px;
  backdrop-filter: blur(8px);
}

.side {
  min-height: 100vh;
  border-left: 1px solid var(--line);
  background: var(--panel);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.1;
  font-weight: 760;
}

h2 {
  font-size: 14px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0;
}

#detail {
  margin-top: 6px;
  color: var(--muted);
}

.controls {
  display: grid;
  gap: 12px;
}

.controls button {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  color: var(--text);
  background: #242b25;
  border-radius: 6px;
  cursor: pointer;
}

.controls button:first-child {
  border-color: rgba(71, 209, 140, 0.45);
  background: #1d3a2b;
}

.controls button:disabled {
  color: #6f746f;
  cursor: not-allowed;
  background: #181b19;
}

.controls label {
  display: grid;
  grid-template-columns: 44px 1fr 52px;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

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

.metrics div {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  min-height: 72px;
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.metrics strong {
  font-size: 20px;
  font-weight: 720;
}

.detections {
  min-height: 0;
}

.detections ul {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: grid;
  gap: 8px;
}

.detections li {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.detections b {
  overflow-wrap: anywhere;
}

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

@media (max-width: 840px) {
  .app {
    grid-template-columns: 1fr;
  }

  .stage {
    min-height: auto;
  }

  #video,
  #overlay {
    width: 100vw;
    height: 100vw;
    max-height: none;
  }

  .side {
    min-height: auto;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}
