:root {
  --bg: #0b0d10;
  --panel: #14181d;
  --line: #232a31;
  --ink: #e8edf2;
  --muted: #8b97a3;
  --accent: #3ddc84;
  --accent-ink: #04150b;
  --warn: #ffb020;
  --bad: #ff5c5c;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  overscroll-behavior: none;
}
#app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

.screen {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
}
.screen.active {
  display: flex;
}

/* INTRO */
.intro-wrap {
  margin: auto;
  max-width: 30rem;
  padding: 2rem 1.5rem calc(2rem + env(safe-area-inset-bottom));
}
.badge {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  margin-bottom: 1.4rem;
}
h1 {
  font-size: 2rem;
  line-height: 1.1;
  margin: 0 0 0.8rem;
  letter-spacing: -0.02em;
}
.lede {
  color: var(--muted);
  line-height: 1.55;
  margin: 0 0 1.6rem;
}
.lede.small {
  font-size: 0.9rem;
}
.steps {
  list-style: none;
  padding: 0;
  margin: 0 0 2rem;
  display: grid;
  gap: 0.6rem;
}
.steps li {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  padding: 0.8rem 1rem;
  font-size: 0.95rem;
}
.steps b {
  display: inline-grid;
  place-items: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.8rem;
  margin-right: 0.6rem;
}
.cta-row {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  flex-wrap: wrap;
}
.fineprint {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 1.2rem;
  min-height: 1rem;
}

/* BUTTONS */
button,
.ghost {
  font-family: inherit;
  font-size: 1rem;
  border-radius: 0.7rem;
  border: 1px solid var(--line);
  padding: 0.85rem 1.3rem;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease;
}
button:active {
  transform: scale(0.97);
}
.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  font-weight: 650;
}
.ghost {
  background: transparent;
  color: var(--ink);
}
label.ghost {
  display: inline-block;
}
.small {
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  background: var(--panel);
  color: var(--ink);
}
button:disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* STAGE (camera + still) */
.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #000;
  display: grid;
  place-items: center;
  overflow: hidden;
}
#video,
#still {
  max-width: 100%;
  max-height: 100%;
  display: block;
}
#overlay,
#still-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}
.chip {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 0.8rem);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(11, 13, 16, 0.82);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font-size: 0.88rem;
  font-weight: 550;
  white-space: nowrap;
}
.chip.ok {
  border-color: var(--accent);
  color: var(--accent);
}
.chip.warn {
  border-color: var(--warn);
  color: var(--warn);
}

/* CONTROLS BAR */
.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.2rem calc(1rem + env(safe-area-inset-bottom));
  background: var(--bg);
  border-top: 1px solid var(--line);
}
.controls.wrap {
  flex-wrap: wrap;
  justify-content: center;
}
.shutter {
  width: 68px;
  height: 68px;
  border-radius: 999px;
  background: #fff;
  border: 4px solid var(--bg);
  box-shadow: 0 0 0 3px #fff;
  padding: 0;
}
.frame-count {
  color: var(--muted);
  font-size: 0.85rem;
  min-width: 4rem;
  text-align: right;
}

/* READOUT */
.readout {
  padding: 1.1rem 1.2rem;
  background: var(--panel);
  border-top: 1px solid var(--line);
  text-align: center;
}
.readout-main {
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.readout-main .unit {
  color: var(--muted);
  font-size: 1rem;
  font-weight: 500;
  margin-left: 0.3rem;
}
.readout-sub {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.35rem;
  min-height: 1rem;
}
.readout-sub.ok {
  color: var(--accent);
}
.readout-sub.warn {
  color: var(--warn);
}

/* SET */
.set-wrap {
  margin: auto;
  max-width: 30rem;
  width: 100%;
  padding: 2rem 1.5rem calc(2rem + env(safe-area-inset-bottom));
}
h2 {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
}
.thumbs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin: 1.2rem 0 1.6rem;
  min-height: 4rem;
}
.thumbs img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: 0.5rem;
  border: 1px solid var(--line);
}
.set-wrap .primary,
.set-wrap .ghost {
  width: 100%;
  margin-top: 0.7rem;
}

/* LOADER */
.loader {
  position: fixed;
  inset: 0;
  background: rgba(11, 13, 16, 0.92);
  display: grid;
  place-items: center;
  gap: 1rem;
  z-index: 50;
  grid-auto-flow: row;
}
.loader.hidden {
  display: none;
}
.loader p {
  color: var(--muted);
}
.spinner {
  width: 42px;
  height: 42px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
