:root {
  color-scheme: dark;
  --bg: #07090d;
  --panel: rgba(17, 21, 29, 0.86);
  --panel-2: #10151e;
  --line: rgba(255,255,255,.09);
  --text: #f6f7fb;
  --muted: #8e98a9;
  --accent: #7c5cff;
  --accent-2: #4da1ff;
  --good: #42d392;
  --bad: #ff6b7d;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 15% -10%, rgba(124, 92, 255, .18), transparent 36rem),
    radial-gradient(circle at 100% 15%, rgba(77, 161, 255, .12), transparent 32rem),
    var(--bg);
  color: var(--text);
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.eyebrow {
  color: #a99cff;
  text-transform: uppercase;
  letter-spacing: .16em;
  font-size: 11px;
  font-weight: 800;
}

h1, h2, p { margin: 0; }
h1 { margin-top: 6px; font-size: clamp(28px, 5vw, 44px); letter-spacing: -.04em; }
h2 { font-size: 19px; letter-spacing: -.015em; }
p { color: var(--muted); margin-top: 6px; line-height: 1.5; font-size: 14px; }

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}
.pill.good { color: #8df0bd; border-color: rgba(66, 211, 146, .28); background: rgba(66, 211, 146, .08); }
.pill.bad { color: #ff9baa; border-color: rgba(255, 107, 125, .28); background: rgba(255, 107, 125, .08); }

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr);
  gap: 18px;
  align-items: stretch;
}

.card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(19, 24, 33, .94), rgba(13, 17, 24, .94));
  box-shadow: 0 22px 60px rgba(0,0,0,.25);
  overflow: hidden;
}

.card-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 20px;
}
.card-heading.compact { padding-bottom: 16px; }

.button {
  border: 0;
  border-radius: 12px;
  min-height: 40px;
  padding: 0 15px;
  cursor: pointer;
  color: var(--text);
  font-weight: 750;
  font-size: 13px;
  transition: transform .15s ease, opacity .15s ease, background .15s ease;
}
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button:disabled { opacity: .5; cursor: not-allowed; }
.button.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.button.ghost { background: rgba(255,255,255,.06); border: 1px solid var(--line); }

.camera-wrap {
  position: relative;
  margin: 0 20px;
  aspect-ratio: 16 / 10;
  min-height: 330px;
  background: #030406;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 18px;
  overflow: hidden;
}

video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #030406;
}

.scan-frame {
  position: absolute;
  width: min(53%, 280px);
  aspect-ratio: 1;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  border-radius: 22px;
  box-shadow: 0 0 0 999px rgba(0,0,0,.28);
}
.scan-frame i { position: absolute; width: 34px; height: 34px; border-color: white; border-style: solid; opacity: .9; }
.scan-frame i:nth-child(1) { left: 0; top: 0; border-width: 3px 0 0 3px; border-radius: 12px 0 0 0; }
.scan-frame i:nth-child(2) { right: 0; top: 0; border-width: 3px 3px 0 0; border-radius: 0 12px 0 0; }
.scan-frame i:nth-child(3) { left: 0; bottom: 0; border-width: 0 0 3px 3px; border-radius: 0 0 0 12px; }
.scan-frame i:nth-child(4) { right: 0; bottom: 0; border-width: 0 3px 3px 0; border-radius: 0 0 12px 0; }

.camera-message {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  text-align: center;
  color: var(--muted);
  background: radial-gradient(circle, rgba(124,92,255,.08), transparent 50%);
}
.camera-message.hidden { display: none; }

.scanner-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 20px 20px;
  color: var(--muted);
  font-size: 12px;
}

.shared-card { min-height: 100%; }
.empty-state {
  min-height: 390px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 34px;
  color: var(--muted);
  text-align: center;
}
.empty-state strong { color: var(--text); }
.empty-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin-bottom: 8px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.035);
  font-size: 36px;
  color: #b6adff;
}

.qr-result { padding: 0 20px 22px; }
.qr-image-box {
  width: min(100%, 390px);
  aspect-ratio: 1;
  margin: 6px auto 18px;
  padding: 14px;
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.qr-image-box img,
.qr-image-box canvas,
.qr-image-box > div { width: 100%; height: 100%; object-fit: contain; }
#generatedQr { display: grid; place-items: center; }
#generatedQr img, #generatedQr canvas { max-width: 100%; max-height: 100%; }

.qr-meta { border-top: 1px solid var(--line); padding-top: 16px; }
.label { color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-size: 10px; font-weight: 800; }
.qr-text {
  margin-top: 7px;
  padding: 11px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,.045);
  color: #dce1ea;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-all;
  max-height: 110px;
  overflow: auto;
}
.updated { display: block; color: var(--muted); font-size: 11px; margin-top: 9px; }

footer {
  color: #667083;
  font-size: 11px;
  line-height: 1.5;
  padding: 18px 4px 0;
  text-align: center;
}

@media (max-width: 860px) {
  .grid { grid-template-columns: 1fr; }
  .camera-wrap { min-height: 0; aspect-ratio: 4 / 3; }
}

@media (max-width: 560px) {
  .shell { width: min(100% - 20px, 1180px); padding-top: 20px; }
  .topbar { align-items: flex-start; }
  .card-heading { align-items: flex-start; flex-direction: column; }
  .card-heading .button { width: 100%; }
  .camera-wrap { margin: 0 12px; }
  .scanner-footer { padding-left: 12px; padding-right: 12px; }
  .qr-result { padding-left: 12px; padding-right: 12px; }
}
