:root {
  color-scheme: dark;
  --background: #11120f;
  --surface: #191a16;
  --muted: #a2a49a;
  --text: #f5f5ed;
  --accent: #c8fa69;
  --line: rgba(245, 245, 237, 0.12);
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body { min-height: 100vh; min-height: 100dvh; }

button, a { font: inherit; }

.screen {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 640px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 22px max(18px, env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 42px;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(200, 250, 105, 0.26);
  border-radius: 11px;
  background: rgba(200, 250, 105, 0.08);
}

.brand-mark svg { width: 23px; fill: none; stroke: var(--accent); stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }

.close-button {
  display: grid;
  width: 34px;
  height: 34px;
  margin-left: auto;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}

.content {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 0 18px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.2em;
}

h1 {
  margin: 0;
  font-size: clamp(25px, 7vw, 34px);
  font-weight: 650;
  letter-spacing: -0.045em;
}

.status {
  min-height: 42px;
  max-width: 350px;
  margin: 12px 0 22px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.camera-shell {
  position: relative;
  width: min(82vw, 360px);
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid rgba(245, 245, 237, 0.1);
  border-radius: 27px;
  background: #080907;
  box-shadow: 0 22px 64px rgba(0, 0, 0, 0.36);
}

.reader,
.reader > div,
#reader__scan_region,
#reader__scan_region > video {
  width: 100% !important;
  height: 100% !important;
}

.reader { position: relative; z-index: 1; }
.reader video { object-fit: cover; }
.reader canvas, #reader__dashboard, #reader__header_message { display: none !important; }
.reader .qr-shaded-region { border: 2px solid var(--accent) !important; border-radius: 16px; box-shadow: 0 0 20px rgba(200, 250, 105, 0.2); }

.camera-glow {
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(8, 9, 7, 0.13), transparent 23%, transparent 77%, rgba(8, 9, 7, 0.23));
}

.start-button {
  min-width: 180px;
  min-height: 48px;
  margin-top: 19px;
  padding: 0 22px;
  border: 0;
  border-radius: 15px;
  background: var(--accent);
  color: #171a11;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
}

.start-button[hidden], .retry-link[hidden] { display: none; }
.hint { max-width: 300px; margin: 19px 0 0; color: #82847b; font-size: 12px; line-height: 1.5; }
.retry-link { margin-top: 12px; color: var(--accent); font-size: 13px; }

.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 35px;
  border-top: 1px solid var(--line);
  color: #8d9087;
  font-size: 11px;
}

.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px rgba(200, 250, 105, 0.55); }
.screen[data-state="error"] .pulse { background: #ff806f; box-shadow: 0 0 10px rgba(255, 128, 111, 0.5); }
.screen[data-state="busy"] .pulse { background: #ffcc67; box-shadow: 0 0 10px rgba(255, 204, 103, 0.5); }

@media (max-height: 700px) {
  .content { padding: 10px 0; }
  .status { margin: 7px 0 13px; }
  .camera-shell { width: min(72vw, 300px); }
  .hint { margin-top: 12px; }
}
