/* ============================================
   Simple QR — Scan Secure Code & Unlock Page
   Clean Light / Dark Adaptive Theme
   Zero External Requests (CSP Compliant)
   ============================================ */

:root {
  --bg-color: #f6f9fc;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --border-color: #e2e8f0;
  --border-hover: #cbd5e1;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --accent: #009ab3;
  --accent-hover: #007d92;
  --accent-muted: rgba(0, 154, 179, 0.1);
  --danger: #ef4444;
  --danger-muted: rgba(239, 68, 68, 0.1);
  --warning: #f59e0b;
  --warning-muted: rgba(245, 158, 11, 0.1);
  --success: #16a34a;
  --success-muted: rgba(22, 163, 74, 0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.07), 0 4px 10px -2px rgba(15, 23, 42, 0.03);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #0d1521;
    --bg-card: #1a2332;
    --bg-input: #121b29;
    --border-color: rgba(255, 255, 255, 0.09);
    --border-hover: rgba(255, 255, 255, 0.18);
    --text-primary: #f0f4f8;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #00b8d4;
    --accent-hover: #009ab3;
    --accent-muted: rgba(0, 184, 212, 0.12);
    --success: #22c55e;
    --success-muted: rgba(34, 197, 94, 0.12);
    --shadow-lg: 0 14px 36px -6px rgba(0, 0, 0, 0.45);
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; scroll-behavior: smooth; }
body {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-color);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* --- Header --- */
.header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
}
.header-inner {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
  text-decoration: none;
}
.header-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-muted);
  padding: 4px 10px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* --- Main --- */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 36px 16px 48px;
  gap: 48px;
}

/* --- Card --- */
.card {
  width: 100%;
  max-width: 460px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.card-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-muted);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.card-icon-success { background: var(--success-muted); color: var(--success); }
.card-icon-error { background: var(--danger-muted); color: var(--danger); }
.card h1, .card h2 { font-size: 21px; font-weight: 800; margin-bottom: 8px; letter-spacing: -0.02em; }
.card .explainer { color: var(--text-secondary); margin-bottom: 24px; line-height: 1.6; }
.card .subtle { font-size: 13px; color: var(--text-muted); margin-top: 16px; }

/* --- Inputs & Buttons --- */
.input-group { position: relative; margin-bottom: 16px; }
.input-group input {
  width: 100%;
  height: 44px;
  padding: 0 44px 0 16px;
  font-size: 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
}
.input-group input:focus { border-color: var(--accent); }
.btn-icon {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}
.btn-icon:hover { color: var(--text-secondary); }

.btn-primary {
  width: 100%;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

/* --- Scanner Tabs & Panels --- */
.scanner-tabs {
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 20px;
}
.tab-btn {
  flex: 1;
  padding: 8px;
  background: transparent;
  border: none;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 5px;
  font-size: 13px;
}
.tab-btn.active { background: var(--bg-card); color: var(--text-primary); box-shadow: var(--shadow-sm); }
.scanner-container {
  width: 100%;
  aspect-ratio: 4/3;
  background: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  margin-bottom: 16px;
}
.scanner-video { width: 100%; height: 100%; object-fit: cover; }
.scanner-status {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #e2e8f0;
  background: rgba(0, 0, 0, 0.72);
  font-size: 13px;
  padding: 16px;
}
.camera-controls { display: flex; gap: 8px; }
.upload-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-sm);
  padding: 40px 20px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: border-color 0.2s, color 0.2s;
}
.upload-zone:hover { border-color: var(--accent); color: var(--accent); }
.upload-icon { margin-bottom: 10px; }

/* --- Badges --- */
.security-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}
.badge {
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

/* --- Status & Alerts --- */
.error-msg {
  background: var(--danger-muted);
  color: var(--danger);
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-top: 12px;
  margin-bottom: 12px;
  display: flex;
  gap: 8px;
  text-align: left;
  align-items: center;
}
.cooldown-msg {
  background: var(--warning-muted);
  color: var(--warning);
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 12px;
  display: flex;
  gap: 8px;
  text-align: left;
  align-items: center;
}
.card-success .explainer { margin-bottom: 12px; }
.content-preview {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  padding: 16px;
  border-radius: var(--radius-sm);
  position: relative;
  text-align: left;
  margin-bottom: 16px;
}
.content-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  word-break: break-all;
  max-height: 120px;
  overflow-y: auto;
  color: var(--text-primary);
  padding-right: 64px;
}
.content-text a { color: var(--accent); text-decoration: underline; }
.btn-copy {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 11px;
  padding: 4px 8px;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-copy:hover { color: var(--accent); border-color: var(--accent); }

.redirect-bar { background: var(--bg-input); border: 1px solid var(--border-color); padding: 12px; border-radius: var(--radius-sm); }
.redirect-info { font-size: 13px; font-weight: 500; margin-bottom: 8px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.progress-track { height: 4px; background: var(--border-color); border-radius: 2px; margin-bottom: 10px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); width: 0%; transition: width 1s linear; }
.redirect-actions { display: flex; gap: 8px; justify-content: center; }
.btn-sm { padding: 6px 14px; font-size: 12px; font-weight: 600; border-radius: 6px; cursor: pointer; border: none; background: var(--accent); color: #fff; }
.btn-sm-ghost { background: transparent; border: 1px solid var(--border-color); color: var(--text-secondary); }

/* --- SEO Guide & FAQ Section --- */
.seo-section {
  width: 100%;
  max-width: 760px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.seo-block {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 28px;
}

.seo-eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 6px;
}

.seo-block h2 {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.seo-lead {
  color: var(--text-secondary);
  margin-bottom: 18px;
  font-size: 14px;
}

.seo-lead-tight {
  margin-bottom: 0;
}

.seo-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  list-style: none;
}

.seo-step {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.seo-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--accent-muted);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 10px;
}

.seo-step h3 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.seo-step p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
}

.seo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.seo-feature {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.seo-feature h3 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.seo-feature p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
}

.seo-faq {
  border-top: 1px solid var(--border-color);
}

.seo-faq details {
  border-bottom: 1px solid var(--border-color);
}

.seo-faq summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 0;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.seo-faq summary::-webkit-details-marker { display: none; }

.seo-faq summary::after {
  content: '+';
  color: var(--accent);
  font-size: 18px;
  font-weight: 600;
  flex-shrink: 0;
}

.seo-faq details[open] summary::after {
  content: '−';
}

.seo-faq details p {
  padding-bottom: 14px;
  color: var(--text-secondary);
  font-size: 13.5px;
  line-height: 1.65;
}

.seo-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.seo-cta-copy {
  flex: 1 1 320px;
}

.seo-cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn-outline {
  height: 40px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s;
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-cta-sm {
  height: 40px;
  width: auto;
  padding: 0 18px;
  font-size: 13px;
}

@media (max-width: 680px) {
  .seo-steps,
  .seo-grid {
    grid-template-columns: 1fr;
  }
  .card,
  .seo-block {
    padding: 22px;
  }
}

/* --- Footer --- */
.footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border-color);
  text-align: center;
  background: var(--bg-card);
}
.footer-inner {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
}
.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}
.footer a { color: var(--text-secondary); text-decoration: none; font-weight: 500; }
.footer a:hover { color: var(--accent); }
