:root {
  color-scheme: light;
  font-family: Arial, Helvetica, sans-serif;
  background: #edf3ef;
  color: #17211c;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: #edf3ef; }
.app { width: min(560px, 100%); margin: 0 auto; padding: 16px; padding-bottom: 40px; }
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.logo { width: 44px; height: 44px; display: grid; place-items: center; background: #154734; color: #fff; border-radius: 8px; font-weight: 900; }
.brand { font-size: 18px; font-weight: 800; }
.sub { font-size: 13px; color: #5e6b62; }
.panel, .video-card, .trip-meta, .gps-bar {
  background: #fff;
  border: 1px solid #d8e3dc;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(23, 33, 28, .08);
}
.panel { padding: 28px; }
.center { text-align: center; }
.hidden { display: none !important; }
h1 { margin: 8px 0; font-size: 22px; }
h2 { margin: 0 0 6px; font-size: 18px; }
p { color: #536158; line-height: 1.45; }
.hint { margin: 0 0 10px; font-size: 14px; }
.spinner {
  width: 38px;
  height: 38px;
  margin: 0 auto 12px;
  border: 4px solid #d7e7dd;
  border-top-color: #166534;
  border-radius: 999px;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.trip-meta { padding: 14px; margin-bottom: 12px; display: grid; gap: 8px; }
.meta-row { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid #edf1ee; padding-bottom: 8px; }
.meta-row:last-child { border-bottom: 0; padding-bottom: 0; }
.label { color: #66736b; font-size: 12px; text-transform: uppercase; font-weight: 700; }
.value { font-weight: 700; text-align: right; }
.stepper { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.step-pill {
  text-align: center;
  padding: 10px 8px;
  border-radius: 999px;
  background: #e7efe9;
  color: #5e6b62;
  font-size: 13px;
  font-weight: 700;
}
.step-pill.active { background: #166534; color: #fff; }
.step-pill.done { background: #bbf7d0; color: #14532d; }
.gps-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 700;
}
.gps-bar .ok { color: #166534; }
.video-card { padding: 14px; }
.video-box {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: 62vh;
  background: #101814;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
video, canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
#preview.recording-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
#overlayCanvas {
  position: absolute;
  inset: 0;
  display: none;
}
#overlayCanvas.visible {
  display: block;
}
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
button {
  border: 1px solid #b8c9bf;
  border-radius: 6px;
  background: #fff;
  color: #17211c;
  padding: 12px 14px;
  font-weight: 700;
  cursor: pointer;
}
button.ghost { padding: 8px 10px; font-size: 12px; }
button:disabled { opacity: .55; cursor: not-allowed; }
.primary { width: 100%; margin-top: 14px; background: #166534; border-color: #166534; color: #fff; }
.danger { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.status { margin-top: 8px; color: #536158; font-size: 13px; min-height: 18px; }
.msg { min-height: 22px; color: #b91c1c; font-weight: 700; }
.ok {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #166534;
  color: #fff;
  font-weight: 900;
}
.blocker {
  position: fixed;
  inset: 0;
  background: rgba(10, 18, 14, 0.72);
  display: grid;
  place-items: center;
  z-index: 50;
  padding: 20px;
}
.blocker-card {
  width: min(360px, 100%);
  background: #fff;
  border-radius: 12px;
  padding: 24px 18px;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0,0,0,.28);
}
.blocker-card h2 { margin: 8px 0; }
.blocker-card p { margin: 0; }
