/* 2FA Lab — self-contained styles (no third-party CSS or fonts) */

:root {
  color-scheme: light;
  --ink: #0f172a;
  --body: #475569;
  --muted: #64748b;
  --line: #e2e8f0;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --accent: #f05535;
  --accent-dark: #b5301a;
  --accent-soft: #fff1ed;
  --ok: #0f766e;
  --ok-soft: #ecfdf5;
  --bad: #b42318;
  --bad-soft: #fef3f2;
  --radius: 18px;
  --font-display: "Sora", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --shadow: 0 18px 40px -30px rgba(15, 23, 42, 0.45);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f5f3ff;
  --body: #b6b2c8;
  --muted: #928da8;
  --line: #2b2742;
  --surface: #100e1b;
  --surface-alt: #181526;
  --accent-soft: color-mix(in srgb, var(--accent) 18%, transparent);
  --accent-dark: #ff8a6f;
  --ok: #5eead4;
  --ok-soft: rgba(20, 184, 166, 0.12);
  --bad: #fda29b;
  --bad-soft: rgba(240, 68, 56, 0.14);
  --shadow: 0 24px 50px -34px rgba(0, 0, 0, 0.9);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 86px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--body);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

a { color: var(--accent-dark); }
a:hover { color: var(--accent); }

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.1em 0.35em;
}

.wrap {
  width: min(1180px, calc(100% - 40px));
  margin-inline: auto;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  background: var(--ink);
  color: var(--surface);
  text-decoration: none;
}
.skip-link:focus { top: 1rem; }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-display);
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-size: 15px; font-weight: 700; }
.brand-sub { font-size: 11.5px; color: var(--muted); font-family: var(--font-body); }

.header-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 14px;
}

.header-nav a {
  color: var(--body);
  text-decoration: none;
  font-weight: 500;
}
.header-nav a:hover { color: var(--accent-dark); }

.header-nav .lang-link {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 9px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.theme-toggle {
  flex: none;
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.theme-toggle svg { width: 18px; height: 18px; }
html[data-theme="light"] .theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: none; }

@media (max-width: 700px) {
  .header-nav a:not(.lang-link):not([href*="authhub"]) { display: none; }
}

/* ---------- Hero ---------- */

.hero { padding: 56px 0 8px; }

.eyebrow {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-dark);
}

.hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--ink);
  max-width: 20ch;
}

.hero-sub {
  margin: 18px 0 0;
  max-width: 62ch;
  font-size: 17px;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}

.badges li {
  font-size: 12.5px;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-alt);
  color: var(--muted);
}

.warn {
  margin: 22px 0 0;
  padding: 12px 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  border-left-width: 4px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--body);
  font-size: 14px;
  max-width: 78ch;
}

.updated {
  margin: 12px 0 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
}

/* ---------- Layout ---------- */

.tool-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 20px;
  margin-top: 20px;
}

@media (max-width: 900px) {
  .tool-grid { grid-template-columns: 1fr; }
}

.tool-grid-single { grid-template-columns: 1fr; }

.uri-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 24px;
  align-items: start;
}

.uri-main { min-width: 0; }
.qr-side { min-width: 0; }

@media (max-width: 760px) {
  .uri-layout { grid-template-columns: 1fr; }
}

.card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  min-width: 0;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.card-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.card-head .btn { margin-left: auto; }

.step {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
}

.uri-mode {
  display: inline-block;
  margin-left: 4px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  vertical-align: 1px;
}

.hotp-counter-field { max-width: 220px; }

.pill {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 10px;
  white-space: nowrap;
}

.lead { margin: -6px 0 16px; font-size: 14px; color: var(--muted); }

/* ---------- Fields ---------- */

.field { margin-bottom: 14px; }

.field label {
  display: block;
  margin-bottom: 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}

input,
select,
textarea {
  width: 100%;
  padding: 9px 11px;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--ink);
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 9px;
}

select { font-family: var(--font-body); cursor: pointer; }

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input[readonly],
textarea[readonly] { color: var(--body); }

textarea { resize: vertical; line-height: 1.55; }

#secret { font-size: 15px; letter-spacing: 0.06em; }

.hint { margin: 6px 0 0; font-size: 12px; color: var(--muted); }

.error {
  margin: 10px 0 0;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--bad-soft);
  color: var(--bad);
  font-size: 13px;
  font-weight: 600;
}

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

.param-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.param-grid .field { margin-bottom: 0; }

@media (max-width: 560px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 15px;
  border-radius: 9px;
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn-primary {
  background: var(--ink);
  color: var(--surface);
  border-color: var(--ink);
}
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

.btn-ghost {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}
.btn-ghost:hover { border-color: var(--muted); color: var(--accent-dark); }

.btn-sm { padding: 6px 11px; font-size: 12.5px; }

/* ---------- Code output ---------- */

.card-code { display: flex; flex-direction: column; }

.code-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 14px;
}

.code {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: clamp(34px, 6vw, 52px);
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--ink);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.code-sm { font-size: clamp(26px, 4vw, 34px); }

.code-wrap-sm { margin: 6px 0 4px; }

.copy-inline { flex: none; }

.progress {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: var(--accent);
  transform-origin: left center;
  transition: transform 0.25s linear;
}

.meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 16px 0 0;
}

.meta div { min-width: 0; }
.meta dt { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.meta dd {
  margin: 2px 0 0;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink);
  overflow-wrap: anywhere;
}

/* ---------- QR ---------- */

.qr-frame {
  display: grid;
  place-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.qr-frame canvas {
  width: min(260px, 100%);
  height: auto;
}

.import {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.import summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.import[open] summary { margin-bottom: 12px; }

/* ---------- Google Authenticator export ---------- */

.ga-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.ga-layout:has(.ga-side:not([hidden])) {
  grid-template-columns: minmax(0, 1fr) 300px;
}

.ga-main { min-width: 0; }
.ga-side { min-width: 0; }
.ga-side .qr-frame { padding: 14px; }

@media (max-width: 760px) {
  .ga-layout { grid-template-columns: 1fr; }
}

#ga-input { font-size: 12px; }

.ga-table { font-size: 12.5px; }
.ga-table th { white-space: nowrap; }
.ga-table td { vertical-align: middle; }
.ga-table .ga-index { color: var(--muted); font-family: var(--font-mono); }
.ga-table .ga-type {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--body);
  white-space: nowrap;
}
.ga-table .ga-secret {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  max-width: 230px;
  overflow-wrap: anywhere;
}
.ga-table .ga-code {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}
.ga-table .btn { padding: 4px 9px; font-size: 12px; }

.ga-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--bad);
}

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; margin-top: 14px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th, td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

thead th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  font-weight: 600;
}

tbody th { font-weight: 600; color: var(--ink); }

.drift-table td, .drift-table th { font-family: var(--font-mono); }
.drift-table td.empty { font-family: var(--font-body); color: var(--muted); text-align: center; padding: 14px; }

.compare td:first-child { color: var(--body); }

/* ---------- Verify ---------- */

.result {
  margin: 12px 0 0;
  min-height: 1.4em;
  font-size: 13.5px;
  font-weight: 600;
}
.result.ok { color: var(--ok); }
.result.bad { color: var(--bad); }

/* ---------- Saved ---------- */

.saved-block {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.saved-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.saved-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.saved-head .btn { margin-left: auto; }

.saved-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.saved-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-alt);
  font-size: 13px;
}

.saved-list .saved-name {
  font-weight: 600;
  color: var(--ink);
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}
.saved-list .saved-meta { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }
.saved-list .btn { flex: none; }

/* ---------- Prose / SEO content ---------- */

.prose {
  margin-top: 56px;
}

.prose h2 {
  margin: 40px 0 12px;
  font-family: var(--font-display);
  font-size: clamp(21px, 3vw, 27px);
  letter-spacing: -0.02em;
  color: var(--ink);
}

.prose h2:first-child { margin-top: 0; }

.prose p { margin: 0 0 14px; }
.prose ul, .prose ol { margin: 0 0 14px; padding-left: 1.3em; }
.prose li { margin-bottom: 8px; }

.steps { counter-reset: step; list-style: none; padding-left: 0 !important; }

.steps li {
  position: relative;
  padding-left: 44px;
  margin-bottom: 16px !important;
}

.steps li::before {
  counter-increment: step;
  content: counter(step, upper-alpha);
  position: absolute;
  left: 0;
  top: 2px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 5px;
}

.feature-list { list-style: none; padding-left: 0 !important; }
.feature-list li {
  padding-left: 22px;
  position: relative;
}
.feature-list li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0.72em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
  margin: 40px 0 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-alt);
}

.cta > div:first-child { flex: 1 1 320px; }
.cta h2 { margin: 0 0 6px; font-size: 20px; }
.cta p { margin: 0; font-size: 14px; }
.cta-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.faq {
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
}

.faq summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ink);
  font-size: 15.5px;
}

.faq p { margin: 10px 0 0; font-size: 14.5px; }

/* ---------- Footer ---------- */

.site-footer {
  margin-top: 72px;
  border-top: 1px solid var(--line);
  background: var(--surface-alt);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 0;
  font-size: 13px;
  color: var(--muted);
}

.footer-links { display: flex; flex-wrap: wrap; gap: 16px; }
.footer-links a { color: var(--body); text-decoration: none; }
.footer-links a:hover { color: var(--accent-dark); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .progress span { transition: none; }
}
