:root {
  --bg: #f4f1ea;
  --card: #fffdf8;
  --ink: #1d1d1f;
  --muted: #6e6a62;
  --line: #e4ded2;
  --accent: #c2562a;
  --accent-soft: #f6e3d8;
  --done: #a39d92;
  --check: #3f7d4e;
  --shadow: 0 1px 2px rgb(0 0 0 / .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16171a;
    --card: #1f2024;
    --ink: #ecebe7;
    --muted: #9b978f;
    --line: #2e3035;
    --accent: #ef8a5a;
    --accent-soft: #3a261d;
    --done: #6c6a66;
    --check: #6dbb7f;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}
button { font: inherit; color: inherit; }

.top {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; letter-spacing: .14em; font-size: 13px; color: var(--accent); }
.seg {
  margin-left: auto; display: flex; padding: 3px; gap: 2px;
  background: var(--line); border-radius: 10px;
}
.seg button {
  border: 0; background: transparent; padding: 7px 14px; border-radius: 8px;
  font-size: 15px; font-weight: 500; color: var(--muted); cursor: pointer;
}
.seg button[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

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

.summary { padding: 20px 2px 8px; }
.summary h1 { margin: 0; font-size: 30px; letter-spacing: -.01em; }
.meta { margin: 4px 0 10px; color: var(--muted); display: flex; gap: 12px; font-variant-numeric: tabular-nums; }
.meta span:empty { display: none; }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
#fill { height: 100%; width: 0; background: var(--check); transition: width .25s ease; }

.section { margin-top: 18px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 4px 6px; }
.section-head h2 { margin: 0; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.window { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.section.complete .section-head h2::after { content: " ✓"; color: var(--check); }

.items { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }
.items li + li { border-top: 1px solid var(--line); }
.item {
  display: flex; align-items: center; gap: 14px; width: 100%;
  min-height: 54px; padding: 12px 16px; border: 0; background: transparent;
  text-align: left; cursor: pointer;
}
.box {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--line); display: grid; place-items: center;
  font-size: 15px; font-weight: 700; color: transparent; transition: background .15s, border-color .15s;
}
.item[aria-checked="true"] .box { background: var(--check); border-color: var(--check); color: #fff; }
.item[aria-checked="true"] .text { color: var(--done); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--done) 60%, transparent); }
.item.is-next { background: var(--accent-soft); box-shadow: inset 4px 0 0 var(--accent); }
.item.is-next .box { border-color: var(--accent); }
.item:active { background: color-mix(in srgb, var(--line) 50%, transparent); }

.notes { margin-top: 22px; padding: 14px 16px; border-radius: 14px; border: 1px dashed var(--line); color: var(--muted); font-size: 15px; }
.notes h2 { margin: 0 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.notes p { margin: 4px 0; }

.clear {
  display: block; margin: 28px auto 12px; padding: 10px 22px;
  border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer;
}

.next {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 3;
  display: flex; gap: 10px; align-items: center;
  max-width: 720px; margin: 0 auto;
  padding: 10px max(16px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.next-text {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start;
  padding: 10px 16px; border: 1px solid var(--line); border-radius: 16px;
  background: var(--card); box-shadow: 0 6px 20px rgb(0 0 0 / .12); cursor: pointer; text-align: left;
}
.next-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
#next-item { width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 600; }
.next-tick {
  flex: none; width: 60px; height: 60px; border-radius: 50%; border: 0;
  background: var(--accent); color: #fff; font-size: 26px; font-weight: 700; cursor: pointer;
  box-shadow: 0 6px 20px rgb(0 0 0 / .18);
}
.next.all-done .next-tick { display: none; }
.next.all-done .next-label { color: var(--check); }

dialog { border: 1px solid var(--line); border-radius: 16px; background: var(--card); color: var(--ink); padding: 20px; max-width: 320px; }
dialog::backdrop { background: rgb(0 0 0 / .35); }
dialog p { margin: 0 0 16px; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; }
.confirm-actions button { padding: 8px 16px; border-radius: 10px; border: 1px solid var(--line); background: transparent; cursor: pointer; }
.confirm-actions .danger { background: var(--accent); border-color: var(--accent); color: #fff; }

.error { margin-top: 24px; color: var(--accent); }

/* Bigger targets on large touch screens (the reTerminal, an iPad). */
@media (min-width: 900px) and (pointer: coarse) {
  body { font-size: 20px; }
  .item { min-height: 64px; }
  .box { width: 32px; height: 32px; }
}
