:root {
  --bg: #f6f4ef;
  --bg-panel: #ffffff;
  --ink: #1d1c1a;
  --ink-soft: #6b6862;
  --line: #e2ded4;
  --accent: #e8467c;
  --accent-ink: #ffffff;
  --done: #14a37f;
  --danger: #c8443a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(29, 28, 26, 0.06), 0 8px 24px rgba(29, 28, 26, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16151a;
    --bg-panel: #201f26;
    --ink: #f2f0ea;
    --ink-soft: #a3a0ac;
    --line: #33323c;
    --accent: #ff5f92;
    --accent-ink: #1b1a1f;
    --done: #35d6a8;
    --danger: #ff7a6e;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 28px rgba(0, 0, 0, 0.35);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

.shell {
  max-width: 560px;
  margin: 0 auto;
  padding: 32px 16px 96px;
}

.header {
  margin-bottom: 20px;
}

.title {
  margin: 0;
  font-size: clamp(28px, 7vw, 40px);
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 15px;
}

/* --- add form --- */
.add-form {
  display: flex;
  gap: 8px;
}

.add-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 13px 14px;
  font: inherit;
  color: var(--ink);
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.add-input:focus-visible,
.filter:focus-visible,
.add-button:focus-visible,
.toggle:focus-visible,
.delete:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.add-button {
  flex: 0 0 auto;
  padding: 13px 20px;
  font: inherit;
  font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}

.add-button:disabled {
  opacity: 0.55;
  cursor: progress;
}

.message {
  min-height: 20px;
  margin: 8px 2px 0;
  font-size: 14px;
  color: var(--ink-soft);
}

.message[data-kind="error"] {
  color: var(--danger);
}

/* --- filters --- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 14px;
}

.filter {
  padding: 7px 13px;
  font: inherit;
  font-size: 14px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}

.filter.is-active {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

/* --- list --- */
.todo-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.todo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 14px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.todo.is-busy {
  opacity: 0.55;
}

.toggle {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  padding: 0;
  display: grid;
  place-items: center;
  background: transparent;
  border: 2px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.toggle:active {
  transform: scale(0.88);
}

.todo.is-done .toggle {
  background: var(--done);
  border-color: var(--done);
}

.check {
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
}

.todo-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

.todo.is-done .todo-title {
  color: var(--ink-soft);
  text-decoration: line-through;
}

.delete {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  font-size: 22px;
  line-height: 1;
  color: var(--ink-soft);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.delete:hover {
  color: var(--danger);
}

.empty {
  margin: 24px 4px;
  color: var(--ink-soft);
  text-align: center;
}

/* --- celebration overlay --- */
.celebration-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
}

/* --- test page --- */
.test-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 16px 80px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
}

.test-summary {
  padding: 12px 14px;
  margin-bottom: 16px;
  border-radius: var(--radius);
  font-weight: 700;
}

.test-summary.pass {
  background: rgba(20, 163, 127, 0.15);
  color: var(--done);
}

.test-summary.fail {
  background: rgba(200, 68, 58, 0.15);
  color: var(--danger);
}

.test-suite {
  margin-bottom: 18px;
}

.test-suite h2 {
  font-size: 15px;
  margin: 0 0 6px;
}

.test-case {
  padding: 3px 0 3px 18px;
  text-indent: -18px;
}

.test-case.pass {
  color: var(--done);
}

.test-case.fail {
  color: var(--danger);
  white-space: pre-wrap;
}

@media (max-width: 420px) {
  .shell {
    padding-top: 20px;
  }
  .add-button {
    padding: 13px 16px;
  }
}
