:root {
  color-scheme: dark;
  --bg: #0e1216;
  --panel: #161c22;
  --panel-2: #1c232c;
  --text: #e9eef3;
  --muted: #9fadb9;
  --accent: #4cc38a;
  --accent-ink: #06281a;
  --danger: #ff7a7a;
  --warn-bg: #2a2113;
  --warn-border: #8a6d2b;
  --error-bg: #2c1518;
  --error-border: #8c3535;
  --line: #2b333d;
  --focus: #8ecbff;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--focus);
  color: #000;
  padding: 0.5rem 1rem;
  z-index: 10;
}

.skip:focus { left: 0.5rem; top: 0.5rem; }

.site-header, main, .site-footer {
  width: min(42rem, 100% - 2rem);
  margin-inline: auto;
}

.site-header { padding: 1.5rem 0 0.5rem; }

.brand {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.tagline { margin: 0.15rem 0 0; color: var(--muted); }

main { padding-bottom: 1rem; }

h1 { font-size: 1.6rem; line-height: 1.25; margin: 1rem 0 0.5rem; }
h2 { font-size: 1.2rem; margin: 1.5rem 0 0.5rem; }
.lede { color: var(--muted); margin-top: 0; }

section[aria-labelledby] {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-top: 1rem;
}

#read-view ul, #create-view ul { padding-left: 1.25rem; }
#read-view li, #create-view li { margin: 0.35rem 0; }

.field { margin: 1rem 0; border: 0; padding: 0; }
fieldset.field { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.75rem 1rem; }
legend { padding: 0 0.4rem; }

label { display: block; font-weight: 600; margin-bottom: 0.4rem; }
label.choice { display: block; font-weight: 400; margin: 0.4rem 0; cursor: pointer; }
input[type="radio"] { accent-color: var(--accent); margin-right: 0.5rem; }

textarea, input[type="text"] {
  width: 100%;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.65rem 0.75rem;
  font: inherit;
}

textarea { min-height: 8rem; resize: vertical; }
textarea[aria-invalid="true"] { border-color: var(--danger); }

.count { color: var(--muted); font-size: 0.9rem; margin: 0.35rem 0 0; }
.count.over { color: var(--danger); }

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

button:disabled { opacity: 0.55; cursor: wait; }
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
button.danger { background: transparent; color: var(--danger); border: 1px solid var(--error-border); }

.row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.8rem; }
.row button { flex: 1 1 10rem; }

.banner, .error, .warn, .status, .note { border-radius: var(--radius); }

.status { color: var(--muted); min-height: 1.5em; margin: 0.75rem 0 0; }
.status:empty { display: none; }

.banner, .error {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  padding: 0.7rem 0.9rem;
}

.warn {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  padding: 0.7rem 0.9rem;
}

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

.message {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message:empty { display: none; }

code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.9em; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.site-footer { color: var(--muted); font-size: 0.9rem; padding: 0 0 2rem; }

@media (max-width: 34rem) {
  section[aria-labelledby] { padding: 1rem; }
  h1 { font-size: 1.35rem; }
  .row button { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
