:root {
  color-scheme: light dark;
  --bg: #f6f6f4;
  --card: #ffffff;
  --text: #1d1d1b;
  --muted: #6b6b66;
  --border: #d9d9d4;
  --accent: #2f6fdb;
  --accent-text: #ffffff;
  --ok: #1f7a3a;
  --error: #b42318;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161615;
    --card: #20201f;
    --text: #ececea;
    --muted: #9a9a94;
    --border: #3a3a37;
    --accent: #5b8ff0;
    --accent-text: #0d0d0c;
    --ok: #4cc27a;
    --error: #f0786b;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

main {
  max-width: 34rem;
  margin: 0 auto;
  padding: 2.5rem 1rem;
}

header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

h1 { font-size: 1.35rem; margin: 0; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  display: grid;
  gap: 1rem;
}

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

fieldset + fieldset {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

legend, label[for] { font-weight: 600; padding: 0; }

.hint, .meta { color: var(--muted); font-size: 0.85rem; margin: 0; }

code { font-size: 0.9em; }

input[type="password"], input[type="text"] {
  width: 100%;
  padding: 0.5rem 0.65rem;
  font: inherit;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.85rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}

#password { font-family: inherit; font-size: 1rem; }

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

.check { display: flex; gap: 0.5rem; align-items: center; cursor: pointer; }
.check input { width: 1.05rem; height: 1.05rem; margin: 0; accent-color: var(--accent); }

.buttons, .actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

button {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.4rem 0.85rem;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}

button:hover:not(:disabled) { border-color: var(--muted); }
button:disabled { opacity: 0.5; cursor: default; }

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

button.link {
  border: 0;
  background: none;
  padding: 0;
  color: var(--muted);
  text-decoration: underline;
}

.message { font-size: 0.9rem; margin: 0; min-height: 1.35em; }
.message.ok { color: var(--ok); }
.message.error, .error { color: var(--error); }
