:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #15171a;
  --muted: #5b6270;
  --border: #d5d9e0;
  --accent: #2457d6;
  --accent-text: #ffffff;
  --error: #b42318;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --card: #181b21;
    --text: #eceef2;
    --muted: #9aa2b1;
    --border: #2c313b;
    --accent: #5b8cff;
    --accent-text: #0f1115;
    --error: #ff7a6b;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main {
  max-width: 28rem;
  margin: 2rem auto;
  padding: 1.5rem 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
}
@media (max-width: 30rem) {
  main { margin: 0; border: 0; border-radius: 0; min-height: 100vh; }
}
h1 { font-size: 1.25rem; margin: 0 0 0.75rem; }
.brand { margin: 0 0 0.25rem; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
label { display: block; font-weight: 600; margin-bottom: 0.25rem; }
.field { display: flex; gap: 0.5rem; }
input[type="password"], input[type="text"]#password, input[type="url"], textarea {
  flex: 1;
  min-width: 0;
  font-size: 1.1rem;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}
button {
  font: inherit;
  padding: 0.7rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}
#submit {
  width: 100%;
  margin-top: 1rem;
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}
button:disabled { opacity: 0.6; cursor: default; }
.hint { color: var(--muted); }
.small { font-size: 0.875rem; margin: 0.4rem 0 0; }
.code {
  font: 700 3rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.3em;
  text-align: center;
  margin: 1rem 0;
}
.error { color: var(--error); font-weight: 600; }
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
textarea { width: 100%; resize: vertical; font-family: inherit; line-height: 1.4; }
input[type="url"] { width: 100%; }
input[type="file"] { width: 100%; font: inherit; color: var(--text); }
.types {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  margin: 1rem 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.types button {
  padding: 0.5rem 0.25rem;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}
.types button[aria-selected="true"] { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / 0.12); }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.primary, #submit {
  width: 100%;
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}
button.link {
  display: block;
  width: 100%;
  margin-top: 0.5rem;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 0.95rem;
  text-decoration: underline;
}
#error-qr { text-align: left; padding-left: 0; }
video {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 10px;
  background: #000;
  margin-bottom: 0.75rem;
}
#scanner button, #offline button:not(.link) { width: 100%; }
.qr {
  display: block;
  width: 100%;
  max-width: 22rem;
  height: auto;
  margin: 0.5rem auto;
  border-radius: 8px;
  image-rendering: pixelated;
}
.footer { margin: 1.5rem 0 0; font-size: 0.8rem; text-align: center; }
.footer a { color: var(--muted); }
.doc h2 { font-size: 1.05rem; margin: 1.5rem 0 0.25rem; }
.doc p:not(.brand):not(.hint), .doc li { color: var(--text); }
.doc ul { padding-left: 1.25rem; }
.doc a { color: var(--accent); }
.doc code { font-size: 0.9em; }
