:root {
  color-scheme: light;
  --bg: #eef5f3;
  --panel: #ffffff;
  --ink: #17211f;
  --muted: #61706d;
  --line: #cad8d5;
  --accent: #0f766e;
  --accent-2: #243b53;
  --danger: #a33a2b;
  --ok: #207345;
  --warn: #9a6b12;
}

* { box-sizing: border-box; }

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

.shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 16px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.topbar, .row, .status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.status { justify-content: flex-end; flex-wrap: wrap; }

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 12px;
}

h1, h2 {
  margin: 0 0 12px;
  letter-spacing: 0;
}

h1 { font-size: clamp(24px, 4vw, 38px); }
h2 { font-size: 18px; margin-top: 18px; }

.state {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--muted);
  white-space: nowrap;
}

video {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #111;
  border-radius: 8px;
  object-fit: cover;
  display: block;
}

.controls {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--accent-2);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  background: #aeb9b7;
  cursor: not-allowed;
}

#submitBtn { background: var(--accent); }

.challenge {
  margin-top: 12px;
  padding: 12px;
  border-left: 4px solid var(--accent);
  background: #f6fbfa;
  color: var(--muted);
}

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

.tab {
  background: #eef4f2;
  color: var(--ink);
  border: 1px solid var(--line);
}

.tab.active {
  background: var(--accent-2);
  color: white;
}

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

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

.shot img,
.shot video {
  width: 100%;
  display: block;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 0;
}

.shot span {
  display: block;
  padding: 6px 8px;
  color: var(--muted);
  font-size: 12px;
}

.diagnostic-list {
  display: grid;
  gap: 8px;
}

.diagnostic-item {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 8px;
  padding: 9px 10px;
  background: #fbfdfc;
}

.diagnostic-item strong {
  font-size: 13px;
}

.diagnostic-item span {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.diagnostic-item.ok { border-left-color: var(--ok); }
.diagnostic-item.warn,
.diagnostic-item.manual { border-left-color: var(--warn); }
.diagnostic-item.fail { border-left-color: var(--danger); }
.diagnostic-item.pending { border-left-color: var(--muted); }

.support-box {
  margin-top: 8px;
  color: var(--muted);
}

.support-box summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

label {
  display: block;
  margin: 10px 0 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input, textarea, pre {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font: 13px ui-monospace, SFMono-Regular, Consolas, monospace;
  background: #fbfdfc;
}

input {
  min-height: 42px;
}

textarea {
  min-height: 78px;
  resize: vertical;
}

pre {
  min-height: 84px;
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
}

.history-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.history-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfdfc;
}

.history-card div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.history-card span,
.history-card small,
.empty {
  color: var(--muted);
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 8px;
  color: white;
  background: var(--danger);
  font-size: 12px;
}

.badge.ok { background: var(--ok); }
.badge.warn { background: var(--danger); }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; padding: 10px; }
  .topbar { align-items: flex-start; }
  .controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid { grid-template-columns: 1fr; }
  .diagnostic-item { grid-template-columns: 1fr; }
  .row { align-items: stretch; flex-direction: column; }
}
