:root {
  color-scheme: light;
  --bg: #f4f2ed;
  --ink: #20211f;
  --muted: #686d64;
  --line: #d8d4ca;
  --panel: #ffffff;
  --accent: #2e6f57;
  --accent-2: #b6462f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background-color: var(--bg);
  overflow-x: hidden;
}

.creature-scatter {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.creature-scatter img {
  position: absolute;
  height: auto;
  filter: drop-shadow(0 10px 18px rgba(56, 47, 34, .13));
  user-select: none;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.stream-panel,
.controls,
.clips {
  background: rgba(255, 255, 255, .94);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: 0 12px 30px rgba(56, 47, 34, .08);
}

.masthead,
.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.eyebrow,
.section-title p,
.controls p,
.muted,
time {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

h1, h2, h3 { margin: 0; line-height: 1.15; }
h1 { font-size: clamp(2rem, 5vw, 4rem); }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }

.status {
  min-width: 108px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--accent);
  font-weight: 700;
}

.mast-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-button {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  padding: 9px 12px;
  background: #fbfaf7;
}

video#liveVideo {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #111;
  border-radius: 6px;
}

.controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.controls > div { margin-right: auto; min-width: 220px; }

label {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  white-space: nowrap;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  font: inherit;
  font-weight: 700;
  padding: 10px 14px;
  cursor: pointer;
}

button + button { background: var(--accent-2); }

.clip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.clip-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fbfaf7;
}

.clip-card video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #111;
}

.clip-card div { padding: 12px; }
.empty { color: var(--muted); }

.calibration-stage {
  position: relative;
  width: 100%;
  background: #111;
  border-radius: 6px;
  overflow: hidden;
}

.calibration-stage img {
  display: block;
  width: 100%;
  height: auto;
}

.calibration-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

.calibration-controls button:nth-of-type(2) {
  background: var(--accent);
}

@media (max-width: 700px) {
  .masthead,
  .section-title {
    display: block;
  }
  .status { margin-top: 12px; }
  .mast-actions { align-items: stretch; margin-top: 12px; }
  .controls { align-items: stretch; }
  .controls > * { width: 100%; }
  .creature-scatter img { max-width: 104px; }
}
