:root {
  color-scheme: light;
  --ink: #17211d;
  --muted: #59645f;
  --line: #cbd6d2;
  --bg: #f4f7f6;
  --panel: #ffffff;
  --accent: #0b6f6a;
  --accent-dark: #084f4c;
  --danger: #9b2c2c;
}

* { box-sizing: border-box; }

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.panel {
  width: min(960px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 14px 36px rgba(23, 33, 29, 0.08);
}

.status-bar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1, h2 { margin: 0; }
h1 { font-size: 28px; }
h2 { font-size: 20px; }

.status {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--muted);
  min-width: 108px;
  text-align: center;
}

.form {
  display: grid;
  gap: 18px;
}

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

label, fieldset {
  display: grid;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--ink);
  font: inherit;
}

fieldset {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

legend {
  color: var(--ink);
  padding: 0 6px;
}

fieldset label,
.ack {
  display: flex;
  align-items: center;
  gap: 8px;
}

fieldset input,
.ack input {
  width: 18px;
  min-height: 18px;
}

button {
  justify-self: start;
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  padding: 0 18px;
  background: var(--accent);
  color: white;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button:hover { background: var(--accent-dark); }
button:disabled { opacity: 0.65; cursor: wait; }

.progress,
.result {
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

.progress {
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
  color: var(--muted);
}

.loader {
  width: 48px;
  height: 48px;
  border: 5px solid #d7e2df;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

pre {
  overflow: auto;
  background: #101815;
  color: #dce8e4;
  border-radius: 8px;
  padding: 16px;
  max-height: 360px;
}

#captureVideo,
#captureCanvas {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  left: -10000px;
  top: -10000px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 760px) {
  .shell { padding: 16px; }
  .panel { padding: 18px; }
  .status-bar,
  .grid {
    grid-template-columns: 1fr;
    display: grid;
  }
  fieldset { grid-template-columns: 1fr; }
}
