:root {
  --bg: #f5f5f3;
  --card: #ffffff;
  --text: #111111;
  --muted: #5c5c5c;
  --line: #d6d6d2;
  --accent: #111111;
  --accent-text: #ffffff;
  --warn: #b3261e;
  --stroke: 2px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0e0e;
    --card: #181818;
    --text: #f4f4f2;
    --muted: #a8a8a4;
    --line: #333333;
    --accent: #f4f4f2;
    --accent-text: #0e0e0e;
    --warn: #ff8a80;
  }
  /* Das Kaninchen ist schwarz gezeichnet; im Dunkeln als Negativ zeigen. */
  .rabbit, .empty::before { filter: invert(1); }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

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

header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  max-width: 720px;
  margin: 0 auto 20px;
  border-bottom: var(--stroke) solid var(--text);
}

header img { flex: none; }
header h1 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
  flex: 1;
}
header h1 span { font-weight: 400; }

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

button, textarea, input { font: inherit; color: inherit; }

button {
  border: var(--stroke) solid var(--accent);
  border-radius: 999px;
  padding: 9px 18px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
  cursor: pointer;
}

button:disabled { opacity: 0.5; cursor: default; }
button.ghost { background: transparent; color: var(--text); border-color: var(--text); }

@media (hover: hover) {
  button:not(:disabled):hover { background: transparent; color: var(--text); }
  button.ghost:not(:disabled):hover { background: var(--accent); color: var(--accent-text); }
}

#capture { display: grid; gap: 8px; }
#capture label { font-weight: 700; }
#capture .actions { display: flex; gap: 8px; }
#capture .actions button[type="submit"] { flex: 1; }
#mic[hidden] { display: none; }
#mic[aria-pressed="true"] {
  background: var(--warn);
  border-color: var(--warn);
  color: var(--bg);
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.6; } }
@media (prefers-reduced-motion: reduce) { #mic[aria-pressed="true"] { animation: none; } }

textarea, input {
  width: 100%;
  border: var(--stroke) solid var(--text);
  border-radius: 14px;
  padding: 10px 12px;
  background: var(--card);
  resize: vertical;
}
textarea::placeholder, input::placeholder { color: var(--muted); }

#notice {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 6px solid var(--text);
}
#notice.error { border-color: var(--warn); color: var(--warn); }

#tabs {
  display: flex;
  margin: 24px 0 12px;
  border: var(--stroke) solid var(--text);
  border-radius: 999px;
  padding: 3px;
  gap: 3px;
}
#tabs button {
  flex: 1;
  background: transparent;
  color: var(--text);
  border-color: transparent;
  padding: 6px 10px;
  font-weight: 600;
}
#tabs button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }

#areas { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
#areas[hidden] { display: none; }
#areas button {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 4px 12px;
}
#areas button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

h2.group {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text);
  margin: 24px 0 8px;
}
h2.group::after { content: ""; flex: 1; height: 1px; background: var(--line); }
h2.group.overdue { color: var(--warn); }

.item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 8px;
}

.item input[type="checkbox"] {
  appearance: none;
  width: 24px;
  height: 24px;
  margin: 1px 0 0;
  padding: 0;
  flex: none;
  border: var(--stroke) solid var(--text);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}
.item input[type="checkbox"]:checked {
  background: var(--text);
  box-shadow: inset 0 0 0 4px var(--card);
}
.item:has(input:checked) .title { text-decoration: line-through; color: var(--muted); }
.item .body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.item .title { font-weight: 700; }
.item .meta, .item .step { color: var(--muted); font-size: 0.875rem; }
.item .meta { margin-top: 4px; }
.item .remove {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
  padding: 0 8px;
  font-size: 1.2rem;
}

.tag {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--text);
  border: 1px solid var(--text);
  border-radius: 999px;
  padding: 0 8px;
  margin-right: 6px;
}

button.tag.prio { background: transparent; color: var(--muted); border-color: var(--line); font-weight: 500; line-height: inherit; cursor: pointer; }
button.tag.prio.hoch { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 700; }
button.tag.prio.niedrig { border-style: dashed; }

#calendar { margin: 28px 0 0; font-size: 0.875rem; color: var(--muted); display: grid; gap: 4px; }
#calendar[hidden] { display: none; }
#calendar a { color: var(--text); font-weight: 700; }

.empty { color: var(--muted); padding: 32px 0; text-align: center; }
.empty::before {
  content: "";
  display: block;
  width: 112px;
  height: 112px;
  margin: 0 auto 8px;
  background: url(/rabbit.svg) center / contain no-repeat;
}

dialog {
  border: var(--stroke) solid var(--text);
  border-radius: 20px;
  background: var(--card);
  color: var(--text);
  padding: 24px;
  width: min(360px, calc(100vw - 32px));
}
dialog form { display: grid; gap: 10px; }
dialog img { justify-self: center; }
dialog h2 { margin: 0; font-size: 1.2rem; font-weight: 800; text-align: center; }
dialog p { margin: 0; color: var(--muted); font-size: 0.9rem; }
dialog p[hidden] { display: none; }
dialog label { font-weight: 700; }
dialog::backdrop { background: var(--bg); }
#login-error { color: var(--warn); }

#logout { margin-top: 20px; font-size: 0.875rem; padding: 6px 14px; }
#logout[hidden] { display: none; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); border: 0; padding: 0; }
