:root {
  --bg: #14171c;
  --panel: #1f242c;
  --line: #333a45;
  --text: #f1f3f6;
  --muted: #a3acb9;
  --accent: #35c48d;
  --warn: #f2b04a;
  --bad: #f0706a;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

[hidden] { display: none !important; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
}

.top h1 { margin: 0; font-size: 18px; font-weight: 600; }

.pill {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}
.pill.ok { color: var(--accent); }
.pill.off { color: var(--warn); }

.stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
}

.hint { margin: 0; color: var(--muted); text-align: center; }

.preview {
  flex: 1;
  min-height: 0;
  max-width: 100%;
  object-fit: contain;
  border-radius: 10px;
}

.caption {
  margin: 0;
  min-height: 1.4em;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  overflow-wrap: anywhere;
}

.strip {
  display: flex;
  gap: 8px;
  padding: 8px 16px;
  overflow-x: auto;
  min-height: 72px;
}

.tile {
  position: relative;
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile::after {
  content: "";
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1.5px solid var(--bg);
  background: var(--warn);
}
.tile.saved::after { background: var(--accent); }
.tile.failed::after { background: var(--bad); }

.bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 4px 16px 20px;
}

.queue { margin: 0; min-height: 1.4em; color: var(--muted); font-size: 14px; }

.shutter {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 4px solid var(--text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.shutter-inner {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: var(--text);
  transition: transform .1s;
}
.shutter:active .shutter-inner { transform: scale(.9); }
.shutter:focus-within { outline: 3px solid var(--accent); outline-offset: 3px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}

.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, .7);
}

.card {
  width: min(340px, 100%);
  padding: 20px;
  border-radius: 14px;
  background: var(--panel);
}
.card h2 { margin: 0 0 6px; font-size: 18px; }
.card p { margin: 0 0 12px; color: var(--muted); }
.card input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 24px;
  letter-spacing: .25em;
  text-align: center;
}
.card .error { min-height: 1.4em; margin: 8px 0; color: var(--bad); font-size: 14px; }
.card button {
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #06281b;
  font-size: 16px;
  font-weight: 600;
}

.card .text-input {
  font-size: 16px;
  letter-spacing: 0;
  text-align: left;
}
.card .code {
  margin: 8px 0 0;
  color: var(--warn);
  font-size: 34px;
  font-weight: 600;
  letter-spacing: .15em;
  text-align: center;
}