:root {
  --bg: #ffffff;
  --ink: #111111;
  --muted: #6b6b6b;
  --line: #e7e5e1;
  --soft: #f6f4f0;
  --today: #fff4cc;
  --done: #111111;
  --radius: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5;
}
button { font: inherit; color: inherit; touch-action: manipulation; }
a { color: inherit; }

main, .top, .foot { max-width: 46rem; margin: 0 auto; padding: 0 1.25rem; }

/* ---------- Header ---------- */
.top { padding-top: 1.5rem; }
.logo { display: block; height: 34px; width: auto; }

.intro { padding: 2.5rem 0 1.75rem; }
h1 {
  margin: 0;
  font-size: clamp(2.1rem, 7vw, 3rem);
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.05;
}
.lede { margin: .9rem 0 0; max-width: 34rem; color: var(--muted); font-size: 1.05rem; }
.cycle {
  display: inline-block;
  margin: 1.1rem 0 0;
  padding: .3rem .75rem;
  border-radius: 999px;
  background: var(--soft);
  font-size: .85rem;
  font-weight: 600;
}
.cycle:empty { display: none; }
.cycle-note { margin: .5rem 0 0; font-size: .9rem; color: var(--muted); }
.cycle-note:empty { display: none; }

h2 { margin: 0; font-size: 1.05rem; font-weight: 600; letter-spacing: -.01em; }

/* ---------- Day card ---------- */
.day-card {
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  padding: 1.1rem 1.1rem 1.25rem;
}
.day-head { display: flex; align-items: center; gap: .5rem; }
.day-title-wrap { flex: 1; text-align: center; min-width: 0; }
.day-kicker {
  margin: 0;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.day-title { font-size: 1.2rem; margin-top: .1rem; }

.icon-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--soft);
  cursor: pointer;
}
.icon-btn:hover { background: var(--line); }
.icon-btn:disabled { opacity: .3; cursor: default; background: var(--soft); }
.icon-btn svg, .done-btn svg, .check svg {
  width: 20px; height: 20px;
  fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
}

.readings { margin: 1.25rem 0 1.25rem; display: grid; gap: .6rem; }
.reading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .9rem 1rem;
  border-radius: 10px;
  background: var(--soft);
  text-decoration: none;
}
.reading:hover { background: var(--line); }
.reading .ref { font-size: 1.2rem; font-weight: 600; letter-spacing: -.01em; }
.reading .kind { display: block; font-size: .78rem; color: var(--muted); font-weight: 500; }
.reading .go { flex: none; font-size: .85rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.reading .go::after { content: " ↗"; }

.catchup {
  padding: 1rem;
  border-radius: 10px;
  background: var(--soft);
}
.catchup strong { display: block; font-size: 1.2rem; letter-spacing: -.01em; }
.catchup p { margin: .3rem 0 0; color: var(--muted); }
.catchup button {
  margin-top: .75rem;
  padding: .55rem .9rem;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
}

.day-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.done-btn, .esv-btn {
  flex: 1 1 12rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 50px;
  padding: .75rem 1rem;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.done-btn { border: 1.5px solid var(--ink); background: var(--ink); color: #fff; }
.done-btn svg { display: none; }
.done-btn[aria-pressed="true"] { background: #fff; color: var(--ink); }
.done-btn[aria-pressed="true"] svg { display: block; }
.esv-btn { border: 1.5px solid var(--line); background: #fff; }
.esv-btn:hover { border-color: var(--ink); }
.esv-btn[hidden] { display: none; }

.today-link {
  display: block;
  margin: .9rem auto 0;
  padding: .3rem .5rem;
  border: 0;
  background: none;
  font-weight: 600;
  font-size: .9rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.today-link[hidden] { display: none; }

/* ---------- Progress ---------- */
.progress { padding: 2.25rem 0 0; }
.progress-row { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.progress-count { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.bar {
  position: relative;
  height: 10px;
  margin-top: .75rem;
  border-radius: 999px;
  background: var(--soft);
  overflow: visible;
}
.bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: 999px;
  background: var(--ink);
  transition: width .4s ease;
}
.bar-today {
  position: absolute;
  top: -4px; bottom: -4px;
  width: 2px;
  margin-left: -1px;
  background: #d4a514;
  border-radius: 2px;
}
.bar-today[hidden] { display: none; }
.pace { margin: .6rem 0 0; color: var(--muted); font-size: .92rem; }

.bulk { margin-top: 1rem; border: 1px solid var(--line); border-radius: 10px; }
.bulk summary {
  padding: .75rem 1rem;
  font-size: .92rem;
  font-weight: 600;
  cursor: pointer;
  list-style-position: inside;
}
.bulk-body { padding: 0 1rem 1rem; }
.bulk label { display: block; font-size: .92rem; color: var(--muted); }
.bulk-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.bulk input[type="date"] {
  flex: 1 1 10rem;
  min-height: 44px;
  padding: .5rem .75rem;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  color: var(--ink);
}
.bulk input[type="date"]:focus { outline: 3px solid #d4a514; outline-offset: 1px; border-color: var(--ink); }
.bulk-btn {
  flex: 0 0 auto;
  min-height: 44px;
  padding: .5rem 1.1rem;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.bulk-msg { margin: .6rem 0 0; font-size: .92rem; }
.bulk-msg:empty { display: none; }
.bulk-msg button {
  margin-left: .35rem;
  padding: 0;
  border: 0;
  background: none;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* ---------- Whole plan ---------- */
.plan { padding: 2.75rem 0 0; }
.plan-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

.year-tabs { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--soft); }
.year-tabs button {
  padding: .35rem .85rem;
  border: 0;
  border-radius: 999px;
  background: none;
  font-weight: 600;
  font-size: .88rem;
  cursor: pointer;
}
.year-tabs button[aria-selected="true"] { background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .12); }

.months {
  display: flex;
  gap: .4rem;
  margin: 1rem -1.25rem 0;
  padding: 0 1.25rem .25rem;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.months::-webkit-scrollbar { display: none; }
.months button {
  flex: none;
  min-width: 3.4rem;
  padding: .45rem .7rem;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  scroll-snap-align: start;
}
.months button[aria-selected="true"] { border-color: var(--ink); background: var(--ink); color: #fff; }
.months button.all-done:not([aria-selected="true"])::after { content: " ✓"; }

.day-list { list-style: none; margin: 1rem 0 0; padding: 0; border-top: 1px solid var(--line); }
.day-row {
  display: grid;
  grid-template-columns: auto 4.2rem 1fr;
  align-items: center;
  gap: .25rem .75rem;
  padding: .55rem .25rem;
  border-bottom: 1px solid var(--line);
}
.day-row.is-today { background: var(--today); border-radius: 8px; border-bottom-color: transparent; }
.day-row.is-selected .date { text-decoration: underline; text-underline-offset: 3px; }

.check {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  margin: -6px 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.check-spacer { width: 44px; }
.check span {
  display: grid;
  place-items: center;
  width: 24px; height: 24px;
  border: 1.5px solid #b9b6b0;
  border-radius: 6px;
  background: #fff;
  color: #fff;
}
.check svg { width: 16px; height: 16px; stroke-width: 3; }
.check[aria-checked="true"] span { background: var(--done); border-color: var(--done); }
.check[aria-checked="false"] svg { visibility: hidden; }

.date {
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  font-weight: 600;
  font-size: .92rem;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.date small { display: block; font-weight: 500; color: var(--muted); font-size: .75rem; }
.refs { min-width: 0; font-size: .95rem; }
.refs a { text-decoration: none; }
.refs a:hover { text-decoration: underline; text-underline-offset: 3px; }
.refs .main { display: block; font-weight: 500; }
.refs .second { display: block; color: var(--muted); font-size: .88rem; }
.refs .cu { color: var(--muted); font-style: italic; }
.day-row.is-read .refs { color: var(--muted); }

/* ---------- Footer ---------- */
.foot { padding-top: 3rem; padding-bottom: calc(3rem + env(safe-area-inset-bottom)); color: var(--muted); font-size: .85rem; }
.foot p { margin: 0; }
.reset {
  margin-top: .75rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* ---------- Focus ---------- */
:is(button, a):focus-visible { outline: 3px solid #d4a514; outline-offset: 2px; }

@media (max-width: 480px) {
  .intro { padding: 2rem 0 1.5rem; }
  .lede { font-size: 1rem; }
  .day-card { padding: 1rem .9rem 1.1rem; }
  .reading { padding: .85rem .9rem; }
  .reading .ref { font-size: 1.1rem; }
  .day-row { grid-template-columns: auto 3.6rem 1fr; gap: .2rem .55rem; }
}

@media (prefers-reduced-motion: reduce) {
  .bar-fill { transition: none; }
}
