:root {
  color-scheme: light dark;
  --bg: light-dark(#f7f7fb, #16161d);
  --surface: light-dark(#ffffff, #20202a);
  --text: light-dark(#1b1b23, #ececf3);
  --muted: light-dark(#5d5d6c, #a2a2b3);
  --border: light-dark(#dcdce6, #34343f);
  --brand: light-dark(#5b3fe0, #a08cff);
  --brand-text: light-dark(#ffffff, #16161d);
  --danger: light-dark(#c62828, #ff7b7b);
  --ok: light-dark(#1b7f3b, #6fdc8c);
  --add: light-dark(#e6f6ea, #17331f);
  --del: light-dark(#fbe7e7, #3a1c1c);
  accent-color: var(--brand);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom);
}

header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 0 8px;
}

h1 { font-size: 1.25rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 24px 0 8px; }

main { max-width: 720px; margin: 0 auto 48px; }

.muted { color: var(--muted); font-size: 0.9rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

button {
  font: inherit;
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  background: var(--brand);
  color: var(--brand-text);
  cursor: pointer;
  min-height: 44px;
}
button.secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }
button:disabled { opacity: 0.5; cursor: default; }
button:focus-visible, textarea:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

.record {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 96px;
  font-size: 1.25rem;
  border-radius: 20px;
  margin-top: 8px;
}
.record .dot { width: 20px; height: 20px; border-radius: 50%; background: currentColor; }
.record[aria-pressed="true"] { background: var(--danger); }
.record[aria-pressed="true"] .dot { border-radius: 4px; }
@media (prefers-reduced-motion: no-preference) {
  .record[aria-pressed="true"] .dot { animation: pulse 1s ease-in-out infinite alternate; }
}
@keyframes pulse { to { opacity: 0.4; } }

label { display: block; margin: 16px 0 4px; font-weight: 600; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 400; margin-top: 8px; }

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

.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.spread { justify-content: space-between; margin-top: 0; }

.list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  overflow-wrap: anywhere;
  min-width: 0;
}
.card .body { margin-top: 6px; font-size: 0.95rem; }
.card .body ul { margin: 4px 0 0; padding-left: 20px; }
.card a { color: var(--brand); }

.pill {
  font-size: 0.8rem;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}
.pill.done { color: var(--ok); }
.pill.failed { color: var(--danger); }

.badge:not(:empty) {
  font-size: 0.8rem;
  background: var(--brand);
  color: var(--brand-text);
  border-radius: 999px;
  padding: 0 8px;
  margin-left: 4px;
}

pre.diff {
  font: 0.8rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--bg);
  border-radius: 8px;
  padding: 8px;
  overflow-x: auto;
  max-height: 320px;
  margin: 8px 0 0;
}
pre.diff .add { background: var(--add); display: block; }
pre.diff .del { background: var(--del); display: block; }

details { margin-top: 32px; }
summary { cursor: pointer; color: var(--muted); }
