:root {
  --bg: #0f1420;
  --surface: #171e2e;
  --surface-2: #1f293c;
  --border: #2a3549;
  --text: #eef1f7;
  --text-muted: #9aa5b8;
  --accent: #4f8cff;
  --accent-text: #ffffff;
  --ok: #33c27f;
  --err: #ef5757;
  --radius: 14px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #f0f2f8;
    --border: #dde2ee;
    --text: #171e2e;
    --text-muted: #5b6472;
    --accent: #3a6df0;
    --accent-text: #ffffff;
    --ok: #1f9d5f;
    --err: #d63b3b;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px 40px;
}

.app {
  width: 100%;
  max-width: 440px;
}

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

header.topbar h1 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

header.topbar .user {
  font-size: 13px;
  color: var(--text-muted);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.hidden { display: none !important; }

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin: 14px 0 6px;
}

label:first-of-type { margin-top: 0; }

input[type="text"],
input[type="password"],
input[type="url"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 15px;
}

input:focus {
  outline: none;
  border-color: var(--accent);
}

.pw-row {
  display: flex;
  gap: 8px;
}

.pw-row input { flex: 1; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 16px;
  border-radius: 10px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-toggle {
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 0 14px;
  border-radius: 10px;
}

.error-box {
  background: rgba(239, 87, 87, 0.12);
  border: 1px solid var(--err);
  color: var(--err);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  margin-top: 12px;
}

.capture-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
  padding: 24px 16px;
  cursor: pointer;
  color: var(--text-muted);
}

.capture-zone img {
  max-width: 100%;
  max-height: 260px;
  border-radius: 10px;
  display: block;
  margin: 0 auto;
}

.capture-zone .hint {
  font-size: 13px;
  margin-top: 8px;
}

.field-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.result-box {
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  word-break: break-word;
  margin-top: 14px;
}

.result-ok { background: rgba(51, 194, 127, 0.12); border: 1px solid var(--ok); color: var(--ok); }
.result-err { background: rgba(239, 87, 87, 0.12); border: 1px solid var(--err); color: var(--err); }

.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 24px;
}
