:root {
  color-scheme: dark;
  --bg: #040b07;
  --panel: #09150e;
  --panel-2: #0d1d13;
  --line: #24442d;
  --line-strong: #3b7a48;
  --text: #eff8f0;
  --muted: #94aa9a;
  --green: #6df05e;
  --red: #ff6b72;
  --shadow: 0 20px 54px rgba(0, 0, 0, 0.34);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--bg); }

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

button,
input { font: inherit; }

[hidden] { display: none !important; }

.scanner-shell {
  width: min(720px, calc(100% - 24px));
  margin: 0 auto;
  padding: 14px 0 max(26px, env(safe-area-inset-bottom));
}

.scanner-header {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
}

.brand img { border: 1px solid var(--line-strong); border-radius: 8px; }
.brand span { min-width: 0; display: grid; gap: 2px; }
.brand strong { font-size: 1.02rem; }
.brand small { color: var(--muted); font-size: 0.76rem; font-weight: 750; }

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.privacy-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 12px 0;
}

.privacy-strip span {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #07110b;
  color: var(--muted);
  padding: 6px 10px;
  font-size: 0.72rem;
  font-weight: 800;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px rgba(109, 240, 94, 0.7);
}

.scanner-card,
.password-card {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 18px;
}

.password-card { margin-top: 14px; background: var(--panel-2); }

.card-heading { margin-bottom: 15px; }
.card-heading.compact { margin-bottom: 12px; }
.card-heading p { margin: 0 0 5px; color: var(--green); font-size: 0.7rem; font-weight: 900; text-transform: uppercase; }
.card-heading h1,
.card-heading h2 { margin: 0; font-size: clamp(1.65rem, 7vw, 2.25rem); line-height: 1.08; }
.card-heading span { display: block; margin-top: 8px; color: var(--muted); font-size: 0.86rem; line-height: 1.5; }

.camera-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #020704;
}

.camera-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 9px;
  color: var(--text);
  text-align: center;
  padding: 20px;
}

.camera-placeholder small { color: var(--muted); }

.scan-corners {
  width: 96px;
  height: 96px;
  border: 3px solid var(--green);
  border-radius: 10px;
  box-shadow: 0 0 28px rgba(109, 240, 94, 0.16);
}

.scan-guide {
  position: absolute;
  left: 18%;
  top: 16%;
  width: 64%;
  aspect-ratio: 1;
  border: 3px solid rgba(109, 240, 94, 0.88);
  border-radius: 12px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.28), 0 0 26px rgba(109, 240, 94, 0.24);
  pointer-events: none;
}

.camera-actions,
.password-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.primary-button,
.secondary-button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 900;
  padding: 0 13px;
  text-align: center;
}

.primary-button { border: 1px solid #8cff79; background: var(--green); color: #041007; }
.secondary-button { border: 1px solid var(--line-strong); background: #07170d; color: var(--text); text-decoration: none; }
.primary-button:focus-visible,
.secondary-button:focus-visible { outline: 3px solid rgba(109, 240, 94, 0.24); outline-offset: 2px; }
.primary-button:disabled,
.secondary-button:disabled { cursor: not-allowed; opacity: 0.42; }

.photo-button { margin: 0; }

.scanner-status {
  min-height: 44px;
  margin: 12px 0 0;
  border: 1px dashed var(--line);
  border-radius: 7px;
  color: var(--muted);
  padding: 10px 12px;
  font-size: 0.8rem;
  line-height: 1.45;
}

.scanner-status[data-kind="success"] { border-color: var(--line-strong); color: #bcfab6; }
.scanner-status[data-kind="warning"] { border-color: rgba(255, 107, 114, 0.52); color: #ffb2b6; }

.password-card > label { display: block; margin-bottom: 7px; font-size: 0.84rem; font-weight: 850; }

#scannedPassword {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
  background: #030b06;
  color: var(--text);
  padding: 12px 13px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

#scannedPassword:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(109, 240, 94, 0.1); }

.password-summary { margin: 8px 0 0; color: var(--muted); font-size: 0.78rem; }

.scanner-footer {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
}

@media (max-width: 520px) {
  .scanner-shell { width: min(100% - 16px, 720px); padding-top: 8px; }
  .scanner-header { align-items: flex-start; }
  .header-actions { align-items: stretch; flex-direction: column; }
  .generator-link { min-height: 42px; padding: 0 11px; font-size: 0.76rem; }
  .scanner-card,
  .password-card { padding: 14px; }
  .camera-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .camera-actions .photo-button { grid-column: 1 / -1; }
  .scanner-footer { align-items: flex-start; flex-direction: column; justify-content: center; padding: 12px 0; }
}
