:root {
  color-scheme: light dark;
  --background: #f6f7fb;
  --card: #ffffff;
  --text: #1c2030;
  --muted: #5f6578;
  --line: #d6d9e4;
  --accent: #3b6df0;
  --accent-text: #ffffff;
  --danger: #b3261e;
  --ok: #1a7f45;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #14161f;
    --card: #1d2030;
    --text: #e8eaf3;
    --muted: #9aa0b6;
    --line: #333850;
    --accent: #7c9bff;
    --accent-text: #10131d;
    --danger: #ff8a80;
    --ok: #6fd89a;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

header {
  max-width: 28rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.brand {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

header nav a {
  color: var(--muted);
  font-size: 0.9rem;
  margin-left: 1rem;
}

main {
  max-width: 28rem;
  margin: 1rem auto 2rem;
  padding: 0 1rem;
}

section {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

h1 {
  font-size: 1.4rem;
  margin: 0 0 0.25rem;
}

h2 {
  font-size: 1.1rem;
  margin: 0 0 0.5rem;
}

p {
  margin: 0.5rem 0;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

label {
  display: block;
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: var(--muted);
}

input,
textarea {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--background);
  color: var(--text);
  font: inherit;
}

textarea {
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
  min-height: 7rem;
  resize: vertical;
}

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

button {
  margin-top: 1rem;
  padding: 0.65rem 1.1rem;
  border: 0;
  border-radius: 0.5rem;
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

button.plain {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--line);
}

button:disabled {
  opacity: 0.6;
  cursor: wait;
}

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

.row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.row button {
  flex: 1 1 auto;
}

.links {
  margin-top: 1rem;
  font-size: 0.9rem;
}

.links a {
  margin-right: 1rem;
}

.message {
  margin-top: 0.75rem;
  min-height: 1.25rem;
  font-size: 0.9rem;
}

.message.error {
  color: var(--danger);
}

.message.ok {
  color: var(--ok);
}

.codes {
  font-family: ui-monospace, monospace;
  background: var(--background);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  padding: 0.75rem;
  margin: 0.75rem 0;
  list-style: none;
  columns: 1;
}

.codes li {
  padding: 0.1rem 0;
  word-break: break-all;
}

[hidden] {
  display: none !important;
}

@media (min-width: 40rem) {
  header,
  main {
    max-width: 34rem;
  }
}
