/*
  Lamp's look: midnight navy and lamplight gold, serif headings, soft cards.
  Dark is the default. Colors live in the variables right below; use them
  instead of new colors. (Names: "sage" = done/mint, "rust" = missed/orange.)
*/

:root {
  /* Light mode: ivory paper with navy ink. */
  --bg: #faf7f0;
  --bg-2: #efe9dc;
  --card: #ffffff;
  --card-2: #f7f3ea;
  --ink: #14213a;
  --ink-2: #4a5670;
  --ink-3: #656d7e;
  --line: rgba(20, 33, 58, .09);
  --line-2: rgba(20, 33, 58, .17);
  --gold: #89621b;
  --gold-2: #dba64a;
  --amber: #e69a33;
  --cream: #f6dca4;
  --sky: #4a86d8;
  --sage: #21754e;
  --sage-2: #4fbf89;
  --rust: #a35223;
  --on-gold: #fffaf0;
  --cell-empty: #ebe5d8;
  --hero-a: color-mix(in srgb, var(--gold-2) 20%, var(--card));
  --hero-b: var(--card);
  --spine-text: #fff6dc;
  --knob: #ffffff;
  --shadow-1: 0 1px 2px rgba(20, 33, 58, .05), 0 6px 18px rgba(20, 33, 58, .06);
  --shadow-2: 0 2px 6px rgba(20, 33, 58, .07), 0 22px 48px rgba(20, 33, 58, .13);

  /* Soft tints are mixed from the colors above, so they follow the theme. */
  --gold-soft: color-mix(in srgb, var(--gold) 12%, var(--card));
  --sage-soft: color-mix(in srgb, var(--sage) 14%, var(--card));
  --rust-soft: color-mix(in srgb, var(--rust) 13%, var(--card));
  /* Reading partners are shown in sky blue, so they never get confused with your own gold. */
  --mate: var(--sky);
  --mate-soft: color-mix(in srgb, var(--sky) 14%, var(--card));

  /* Book spines on the shelf. */
  --spine-1: #2b4778; --spine-2: #6e3b2f; --spine-3: #2d5a47; --spine-4: #7a5a2a; --spine-5: #45386e;

  --serif: ui-serif, "New York", "Iowan Old Style", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  --r-lg: 24px;
  --r-md: 18px;
  --r-sm: 12px;
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --sheet-ease: cubic-bezier(.32, .72, 0, 1);
  --top-h: 64px;
  --tab-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1a2e; --bg-2: #14223b; --card: #17243d; --card-2: #1d2c4a;
    --ink: #f5efe2; --ink-2: #b9bfcc; --ink-3: #8b95a9;
    --line: rgba(245, 239, 226, .08); --line-2: rgba(245, 239, 226, .16);
    --gold: #e8b65a; --gold-2: #f4cf82; --amber: #f2a94a; --cream: #fbe6b8; --sky: #8fb8ff;
    --sage: #6fcf9f; --sage-2: #93e0b9; --rust: #f0a067;
    --gold-soft: color-mix(in srgb, var(--gold) 22%, var(--card));
    --on-gold: #1a1406; --cell-empty: #213152;
    --hero-a: #213a6b; --hero-b: #121e37;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(3, 8, 20, .35);
    --shadow-2: 0 2px 8px rgba(0, 0, 0, .4), 0 24px 60px rgba(3, 8, 20, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1a2e; --bg-2: #14223b; --card: #17243d; --card-2: #1d2c4a;
  --ink: #f5efe2; --ink-2: #b9bfcc; --ink-3: #8b95a9;
  --line: rgba(245, 239, 226, .08); --line-2: rgba(245, 239, 226, .16);
  --gold: #e8b65a; --gold-2: #f4cf82; --amber: #f2a94a; --cream: #fbe6b8; --sky: #8fb8ff;
  --sage: #6fcf9f; --sage-2: #93e0b9; --rust: #f0a067;
    --gold-soft: color-mix(in srgb, var(--gold) 22%, var(--card));
  --on-gold: #1a1406; --cell-empty: #213152;
  --hero-a: #213a6b; --hero-b: #121e37;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(3, 8, 20, .35);
  --shadow-2: 0 2px 8px rgba(0, 0, 0, .4), 0 24px 60px rgba(3, 8, 20, .55);
  color-scheme: dark;
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background:
    radial-gradient(1000px 560px at 50% -220px, color-mix(in srgb, var(--gold-2) 22%, transparent) 0%, color-mix(in srgb, var(--gold-2) 18.7%, transparent) 19.0%, color-mix(in srgb, var(--gold-2) 15.0%, transparent) 34.0%, color-mix(in srgb, var(--gold-2) 11.0%, transparent) 47.0%, color-mix(in srgb, var(--gold-2) 7.5%, transparent) 58.0%, color-mix(in srgb, var(--gold-2) 4.4%, transparent) 69.0%, color-mix(in srgb, var(--gold-2) 2.2%, transparent) 80.0%, color-mix(in srgb, var(--gold-2) 0.8%, transparent) 90.0%, transparent 100%),
    radial-gradient(800px 700px at 100% 100%, color-mix(in srgb, var(--sky) 8%, transparent) 0%, color-mix(in srgb, var(--sky) 6.8%, transparent) 19.0%, color-mix(in srgb, var(--sky) 5.4%, transparent) 34.0%, color-mix(in srgb, var(--sky) 4.0%, transparent) 47.0%, color-mix(in srgb, var(--sky) 2.7%, transparent) 58.0%, color-mix(in srgb, var(--sky) 1.6%, transparent) 69.0%, color-mix(in srgb, var(--sky) 0.8%, transparent) 80.0%, color-mix(in srgb, var(--sky) 0.3%, transparent) 90.0%, transparent 100%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 24px);
}
/* A whisper of paper grain. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .3 0 0 0 0 .2 0 0 0 0 .1 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
#view { position: relative; z-index: 1; outline: none; }

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--gold); }
svg { display: block; }
:focus-visible { outline: 2.5px solid var(--gold); outline-offset: 2px; border-radius: 8px; }
h1, h2, h3 { margin: 0; font-weight: 600; }
p { margin: 0; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 12px; top: -60px; z-index: 50;
  background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 10px; text-decoration: none;
}
.skip:focus { top: 12px; }

.display {
  font-family: var(--serif);
  font-size: clamp(34px, 7vw, 46px);
  line-height: 1.05;
  letter-spacing: -.02em;
  font-weight: 600;
}
.display .of { font-size: .5em; color: var(--ink-3); font-weight: 500; letter-spacing: 0; margin-left: 4px; }
.eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 8px;
}
.section-title {
  font-family: var(--serif);
  font-size: 21px;
  letter-spacing: -.01em;
  margin: 0 0 14px;
}
.hint { font-size: 14px; color: var(--ink-3); margin-top: 10px; }

/* ---------- Top bar and tabs ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: calc(var(--top-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  gap: 16px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(18px);
  backdrop-filter: saturate(1.4) blur(18px);
  border-bottom: 1px solid transparent;
}
.brand {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none; color: var(--ink);
  font-family: var(--serif); font-size: 22px; font-weight: 600; letter-spacing: -.01em;
}
.brand-mark { width: 28px; height: 28px; }
.brand-mark .flame { fill: var(--gold-2); transform-origin: 50% 90%; animation: flicker 3.2s ease-in-out infinite; }
.brand-mark .base { fill: var(--ink-2); }

.tabs { display: none; margin: 0 auto; gap: 4px; padding: 4px; border-radius: 999px; background: var(--bg-2); }
.tabs a {
  padding: 8px 18px; border-radius: 999px; text-decoration: none;
  font-size: 15px; font-weight: 500; color: var(--ink-2);
  transition: background .25s var(--ease), color .25s var(--ease);
}
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow-1); }

.sync-pill {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card);
  font-size: 13px; font-weight: 500; color: var(--ink-2);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sage); flex: none; }
.syncing .dot, .dot.syncing { background: var(--gold-2); animation: breathe 1s ease-in-out infinite; }
.error .dot, .dot.error { background: var(--rust); }
.dot.idle { background: var(--ink-3); }

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding: 6px 8px env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--card) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(18px);
  backdrop-filter: saturate(1.4) blur(18px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; color: var(--ink-3); font-size: 11px; font-weight: 600;
  border-radius: 14px;
  transition: color .25s var(--ease), transform .2s var(--ease);
}
.tabbar a:active { transform: scale(.92); }
.tabbar svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transition: transform .4s var(--spring); }
.tabbar a[aria-current="page"] { color: var(--gold); }
/* A small gold bar that glides to the selected tab. */
.tab-ind {
  position: absolute; top: 0; left: 8px;
  width: calc((100% - 16px) / 5); height: 3px;
  display: flex; justify-content: center;
  transform: translateX(calc(var(--ti, 0) * 100%));
  transition: transform .5s var(--spring);
  pointer-events: none;
}
.tab-ind::before {
  content: ""; width: 34px; height: 3px; border-radius: 0 0 3px 3px;
  background: var(--gold);
  box-shadow: 0 2px 10px color-mix(in srgb, var(--gold) 70%, transparent);
}
.tabbar a[aria-current="page"] svg { transform: translateY(-1px) scale(1.08); }

body.welcoming .tabbar, body.welcoming .tabs, body.welcoming .sync-pill { display: none; }

@media (min-width: 860px) {
  .tabs { display: flex; }
  .tabbar { display: none; }
  body { padding-bottom: 48px; }
  .sync-pill { margin-left: 0; }
  .topbar { display: grid; grid-template-columns: 1fr auto 1fr; }
  .topbar .sync-pill { justify-self: end; }
}

/* ---------- Page layout ---------- */

.page, .today-grid, .welcome {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px max(16px, env(safe-area-inset-left)) 24px;
}
.page-head { margin: 10px 0 22px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--card);
  font-size: 16px; font-weight: 600; color: var(--ink);
  transition: transform .2s var(--ease), background .2s, box-shadow .2s;
}
.btn:hover { background: var(--card-2); }
a.btn { text-decoration: none; white-space: nowrap; }
.btn svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn:active { transform: scale(.97); }
.btn.primary {
  border-color: transparent;
  color: var(--on-gold);
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 8px 22px color-mix(in srgb, var(--gold) 35%, transparent);
}
.btn.primary:hover { filter: brightness(1.05); }
.btn.quiet { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.quiet:hover { background: var(--bg-2); }
.btn.danger { color: var(--rust); border-color: color-mix(in srgb, var(--rust) 35%, transparent); background: transparent; margin-top: 14px; }
.btn.danger:hover { background: var(--rust-soft); }
.btn-row .btn.danger { margin-top: 0; }
.choice-stack { display: grid; gap: 10px; margin: 16px 0 4px; }
.choice-stack .btn.danger { margin-top: 0; }
.btn.big { min-height: 56px; padding: 0 30px; font-size: 18px; }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 15px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

.icon-btn {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%; border: 1px solid var(--line); background: var(--card);
  color: var(--ink-2);
  transition: transform .2s var(--ease), background .2s, opacity .2s;
}
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { background: var(--card-2); color: var(--ink); }
.icon-btn:active { transform: scale(.92); }
.icon-btn:disabled { opacity: .35; cursor: default; }

.chip {
  min-height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--gold) 30%, transparent);
  background: var(--gold-soft); color: var(--gold);
  font-size: 14px; font-weight: 600;
  animation: rise .4s var(--ease) both;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 18px;
  box-shadow: var(--shadow-1);
}
.card p + p { margin-top: 8px; }

/* ---------- Welcome ---------- */

.welcome { max-width: 760px; padding-top: 24px; }
.welcome > div + div { margin-top: 36px; }
.welcome-hero { text-align: center; padding: 18px 0 6px; position: relative; isolation: isolate; }
.lamp-big { width: 96px; height: 96px; margin: 0 auto 14px; position: relative; }
.lamp-big::before {
  content: ""; position: absolute; inset: -40px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--amber) 45%, transparent) 0%, color-mix(in srgb, var(--amber) 38.2%, transparent) 13.3%, color-mix(in srgb, var(--amber) 30.6%, transparent) 23.8%, color-mix(in srgb, var(--amber) 22.5%, transparent) 32.9%, color-mix(in srgb, var(--amber) 15.3%, transparent) 40.6%, color-mix(in srgb, var(--amber) 9.0%, transparent) 48.3%, color-mix(in srgb, var(--amber) 4.5%, transparent) 56.0%, color-mix(in srgb, var(--amber) 1.6%, transparent) 63.0%, transparent 70%);
  animation: glow 4s ease-in-out infinite;
}
.lamp-big svg { position: relative; width: 100%; height: 100%; }
.lamp-big .flame { fill: var(--gold-2); transform-origin: 50% 85%; animation: flicker 2.6s ease-in-out infinite; }
.lamp-big .flame-core { fill: var(--cream); transform-origin: 50% 90%; animation: flicker 1.9s ease-in-out infinite reverse; }
.lamp-big .base { fill: var(--ink-2); }
.welcome-title { font-family: var(--serif); font-size: clamp(48px, 12vw, 72px); letter-spacing: -.03em; line-height: 1; }
.welcome-sub { margin-top: 12px; font-family: var(--serif); font-size: 21px; color: var(--ink-2); font-style: italic; }
.welcome-go { text-align: center; }
.welcome-go .btn { width: 100%; max-width: 380px; }
.fine { margin: 16px auto 0; max-width: 460px; font-size: 14px; color: var(--ink-3); }

.rise { animation: rise .8s var(--ease) both; animation-delay: calc(var(--d, 0) * 120ms); }

/* Plan cards */
.plan-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.plan-card {
  position: relative;
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 18px; text-align: left;
  border-radius: var(--r-md); border: 1.5px solid var(--line); background: var(--card);
  box-shadow: var(--shadow-1);
  transition: border-color .25s, transform .25s var(--ease), box-shadow .25s;
}
.plan-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.plan-card[aria-pressed="true"] { border-color: var(--gold-2); background: linear-gradient(180deg, color-mix(in srgb, var(--gold-soft) 70%, var(--card)), var(--card)); }
.pc-art { width: 64px; height: 40px; margin-bottom: 4px; }
.pc-art .a1 { fill: var(--gold-2); }
.pc-art .a2 { fill: var(--sage-2); }
.pc-art .a3 { fill: var(--sky); }
.pc-art .line { fill: none; stroke: var(--ink-3); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.pc-name { font-family: var(--serif); font-size: 19px; font-weight: 600; }
.pc-blurb { font-size: 14px; color: var(--ink-2); line-height: 1.45; }
.pc-tick {
  position: absolute; top: 14px; right: 14px;
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--gold); color: var(--on-gold);
  transform: scale(0); transition: transform .4s var(--spring);
}
.pc-tick svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.plan-card[aria-pressed="true"] .pc-tick { transform: scale(1); }
@media (max-width: 599px) {
  .plan-card { display: grid; grid-template-columns: 56px 1fr; column-gap: 14px; row-gap: 2px; padding: 16px 44px 16px 14px; }
  .pc-art { grid-row: 1 / span 2; width: 56px; height: 36px; align-self: center; margin: 0; }
}

/* Start date choices */
.choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.choice {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 14px; border-radius: var(--r-sm);
  border: 1.5px solid var(--line); background: var(--card); text-align: left;
  transition: border-color .25s, background .25s, transform .2s var(--ease);
}
.choice:active { transform: scale(.97); }
.choice[aria-pressed="true"] { border-color: var(--gold-2); background: color-mix(in srgb, var(--gold-soft) 60%, var(--card)); }
.choice-label { font-weight: 600; font-size: 16px; }
.choice-sub { font-size: 13px; color: var(--ink-3); }
.choice[aria-pressed="true"] .choice-sub { color: var(--ink-2); }
.ob-date { margin-top: 12px; display: flex; align-items: center; gap: 12px; animation: rise .4s var(--ease) both; }
.ob-date label { font-weight: 600; }

input[type="date"], input[type="time"], .link-box input {
  font-size: 16px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  background: var(--card-2);
  color: var(--ink);
}

/* ---------- Today ---------- */

.today-grid { display: grid; gap: 22px; }
@media (min-width: 860px) {
  .today-grid { grid-template-columns: minmax(330px, 400px) 1fr; gap: 32px; align-items: start; padding-top: 32px; }
  .hero { position: sticky; top: calc(var(--top-h) + 20px); }
}

.hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding: 24px 22px 22px;
  border-radius: var(--r-lg);
  background: linear-gradient(165deg, var(--hero-a) 0%, color-mix(in srgb, var(--hero-a) 50%, var(--hero-b)) 40%, color-mix(in srgb, var(--hero-a) 18%, var(--hero-b)) 68%, var(--hero-b) 95%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
  animation: rise .7s var(--ease) both;
}
.hero-content { position: relative; }

/* Warm lamplight glow inside the Today card. */
.glow-layer { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.hero-glow.two {
  right: auto; top: auto; left: -140px; bottom: -180px;
  width: 280px; height: 280px;
  background: radial-gradient(circle, color-mix(in srgb, var(--gold-2) 18%, transparent) 0%, color-mix(in srgb, var(--gold-2) 15.3%, transparent) 13.3%, color-mix(in srgb, var(--gold-2) 12.2%, transparent) 23.8%, color-mix(in srgb, var(--gold-2) 9.0%, transparent) 32.9%, color-mix(in srgb, var(--gold-2) 6.1%, transparent) 40.6%, color-mix(in srgb, var(--gold-2) 3.6%, transparent) 48.3%, color-mix(in srgb, var(--gold-2) 1.8%, transparent) 56.0%, color-mix(in srgb, var(--gold-2) 0.6%, transparent) 63.0%, transparent 70%);
  animation-duration: 18s; animation-direction: alternate-reverse;
}

/* The glowing point at the end of the progress ring. */
.ring-tip { transform-box: view-box; transform-origin: 60px 60px; transition: transform 1.6s var(--ease), opacity .5s; opacity: 0; }
.ring-tip.on { opacity: 1; }
.tip-dot { fill: var(--cream); }
.tip-glow { fill: var(--gold-2); opacity: .5; transform-box: fill-box; transform-origin: center; animation: tip-pulse 2.2s ease-in-out infinite; }
.hero-glow {
  position: absolute; z-index: -1;
  width: 320px; height: 320px; right: -110px; top: -140px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--gold-2) 26%, transparent) 0%, color-mix(in srgb, var(--gold-2) 22.1%, transparent) 13.3%, color-mix(in srgb, var(--gold-2) 17.7%, transparent) 23.8%, color-mix(in srgb, var(--gold-2) 13.0%, transparent) 32.9%, color-mix(in srgb, var(--gold-2) 8.8%, transparent) 40.6%, color-mix(in srgb, var(--gold-2) 5.2%, transparent) 48.3%, color-mix(in srgb, var(--gold-2) 2.6%, transparent) 56.0%, color-mix(in srgb, var(--gold-2) 0.9%, transparent) 63.0%, transparent 70%);
  filter: blur(18px);
  animation: drift 14s ease-in-out infinite alternate;
}
.hero-body { display: flex; align-items: center; gap: 22px; margin-top: 18px; }
@media (min-width: 860px) {
  .hero-body { flex-direction: column; align-items: stretch; }
  .hero .ring { align-self: center; width: 190px; height: 190px; }
  .hero .ring-num { font-size: 46px; }
}

.ring { position: relative; width: 132px; height: 132px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: color-mix(in srgb, var(--ink) 9%, transparent); stroke-width: 10; }
.ring-bar {
  fill: none; stroke: url(#ringGrad); stroke-width: 10; stroke-linecap: round;
  transition: stroke-dashoffset 1.6s var(--ease);
  filter: drop-shadow(0 2px 6px color-mix(in srgb, var(--gold) 40%, transparent));
}
.rg1 { stop-color: var(--amber); }
.rg2 { stop-color: var(--gold); }
.ring-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-num { font-family: var(--serif); font-size: 34px; font-weight: 600; letter-spacing: -.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.ring-num small { font-size: .5em; margin-left: 1px; color: var(--ink-2); }
.ring-sub { font-size: 12px; color: var(--ink-3); margin-top: 4px; }

.stats { margin: 0; display: grid; gap: 12px; flex: 1; }
@media (min-width: 860px) { .stats { grid-template-columns: repeat(3, 1fr); text-align: center; } }
.stat dt { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }
.stat dd { margin: 2px 0 0; display: flex; align-items: baseline; gap: 4px; font-family: var(--serif); font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
@media (min-width: 860px) { .stat dd { justify-content: center; } }
.stat dd small { font-family: var(--sans); font-size: 13px; font-weight: 500; color: var(--ink-3); }
.stat-flame { display: none; width: 20px; height: 20px; align-self: center; }
.stat.lit .stat-flame { display: block; }
.stat-flame svg { width: 20px; height: 20px; fill: var(--amber); transform-origin: 50% 90%; animation: flicker 2.2s ease-in-out infinite; }

/* Behind banner */
.behind {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 16px; margin-bottom: 18px;
  border-radius: var(--r-md);
  background: var(--rust-soft);
  border: 1px solid color-mix(in srgb, var(--rust) 20%, transparent);
  animation: rise .6s var(--ease) both .15s;
}
.behind-icon svg { width: 26px; height: 26px; fill: none; stroke: var(--rust); stroke-width: 1.8; stroke-linecap: round; }
.behind-title { font-weight: 700; color: var(--rust); }
.behind-sub { font-size: 14px; color: var(--ink-2); margin-top: 2px; }
.behind-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* The day's readings */
.day { touch-action: pan-y; }
.day-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.day-title { flex: 1; text-align: center; }
.day-title h2 { font-family: var(--serif); font-size: 25px; letter-spacing: -.01em; }
.day-title p { font-size: 14px; color: var(--ink-3); }
.back-row { display: flex; justify-content: center; margin: -4px 0 14px; }

.readings { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.slot {
  position: relative;
  border-radius: var(--r-md);
  animation: rise .6s var(--ease) both;
  animation-delay: calc(var(--i) * 80ms + 150ms);
}
.day.swapped .slot { animation: none; }

/* The strip behind a card, revealed as you swipe it right. */
.swipe-bg {
  position: absolute; inset: 0;
  display: flex; align-items: center; gap: 8px;
  padding-left: 20px;
  border-radius: var(--r-md);
  background: var(--sage);
  color: var(--on-gold);
  font-weight: 700; font-size: 15px;
  opacity: var(--pull, 0);
}
.swipe-bg svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; transform: scale(calc(.6 + var(--pull, 0) * .4)); transition: transform .3s var(--spring); }
.armed .swipe-bg svg { transform: scale(1.25) rotate(-8deg); }
.sb-unread { display: none; }
.slot:has(.reading.done) .swipe-bg { background: var(--ink-3); }
.slot:has(.reading.done) .sb-read { display: none; }
.slot:has(.reading.done) .sb-unread { display: inline; }

.reading {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 12px 12px 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
  touch-action: pan-y;
  -webkit-user-select: none; user-select: none;
  transition: background .4s var(--ease), border-color .4s var(--ease), transform .55s var(--spring);
}
.reading.dragging { transition: background .4s var(--ease), border-color .4s var(--ease); cursor: grabbing; }
.reading.done { background: color-mix(in srgb, var(--sage) 12%, var(--card)); border-color: color-mix(in srgb, var(--sage) 28%, transparent); }

.check { position: relative; width: 48px; height: 48px; flex: none; border: 0; background: none; padding: 8px; border-radius: 50%; }
/* A ring of light that spreads out when a reading is checked. */
.check::after {
  content: ""; position: absolute; inset: 8px; border-radius: 50%;
  border: 2px solid var(--sage);
  opacity: 0; pointer-events: none;
}
.reading.pop .check::after { animation: ripple .7s var(--ease); }
.check svg { width: 32px; height: 32px; overflow: visible; }
.c-ring { fill: none; stroke: var(--line-2); stroke-width: 2; transition: stroke .3s; }
.check:hover .c-ring { stroke: var(--sage-2); }
.c-fill { fill: var(--sage); transform-box: fill-box; transform-origin: center; transform: scale(0); transition: transform .5s var(--spring); }
.c-mark { fill: none; stroke: var(--card); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 18; stroke-dashoffset: 18; transition: stroke-dashoffset .35s var(--ease); }
.done .c-fill { transform: scale(1); }
.done .c-mark { stroke-dashoffset: 0; transition-delay: .14s; }
.done .c-ring { stroke: transparent; }

.r-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.r-track { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--gold); transition: color .3s; }
.done .r-track { color: var(--sage); }
.r-title {
  align-self: flex-start;
  font-family: var(--serif); font-size: 21px; font-weight: 600; letter-spacing: -.01em; line-height: 1.25;
  background: linear-gradient(currentColor, currentColor) 0 58% / 0 1.5px no-repeat;
  transition: background-size .55s var(--ease), color .4s;
}
.done .r-title { color: var(--ink-2); background-size: 100% 1.5px; }
.r-meta { font-size: 13px; color: var(--ink-3); }
.reading.done .r-meta { color: var(--ink-2); } /* stays readable on the green "done" card */

.r-open {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 40px; padding: 0 12px 0 14px; border-radius: 999px;
  background: var(--gold-soft); color: var(--gold);
  font-size: 15px; font-weight: 600; text-decoration: none;
  transition: transform .2s var(--ease), filter .2s;
}
.r-open svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .3s var(--spring); }
.r-open:hover svg { transform: translate(2px, -2px); }
.r-open:active { transform: scale(.95); }

.complete-card {
  display: flex; gap: 14px; align-items: flex-start;
  margin-top: 14px; padding: 18px;
  border-radius: var(--r-md);
  background: linear-gradient(140deg, color-mix(in srgb, var(--sage-soft) 90%, var(--card)), var(--card));
  border: 1px solid color-mix(in srgb, var(--sage) 25%, transparent);
}
.complete-card.enter { animation: card-in .7s var(--spring) both; }
.complete-card.enter .seal { animation: seal-in .7s var(--spring) both .1s; }
.seal { width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--sage); color: var(--card); }
.seal svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.cc-title { font-weight: 700; color: var(--sage); }
.complete-card blockquote { margin: 6px 0 4px; font-family: var(--serif); font-style: italic; font-size: 18px; line-height: 1.45; color: var(--ink); }
.complete-card cite { font-style: normal; font-size: 13px; color: var(--ink-3); }

/* This week: seven small day buttons above the readings */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 0 0 16px; }
.wk {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-height: 64px; padding: 8px 2px 8px;
  border-radius: 14px; border: 1px solid var(--line); background: var(--card);
  color: var(--ink-2);
  transition: background .3s, border-color .3s, transform .2s var(--ease), color .3s;
}
.wk:active { transform: scale(.94); }
.wk.off { opacity: .35; border-style: dashed; background: transparent; }
.wk-d { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }
.wk-n { font-family: var(--serif); font-size: 19px; font-weight: 600; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.wk-dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 3px; background: var(--cell-empty); transition: background .3s, transform .4s var(--spring); }
.wk.done .wk-dot { background: var(--gold-2); }
.wk.partial .wk-dot { background: linear-gradient(90deg, var(--gold-2) 50%, var(--cell-empty) 50%); }
.wk.missed .wk-dot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--rust); }
.wk.today .wk-d { color: var(--gold); }
.wk.rest .wk-dot { background: transparent; width: 10px; height: 2px; border-radius: 1px; box-shadow: none; background: var(--sky); margin-top: 6px; }
.wk.rest .wk-sum { font-style: italic; }
.wk.sel { border-color: var(--gold-2); background: var(--gold-soft); box-shadow: 0 6px 18px color-mix(in srgb, var(--gold) 18%, transparent); }
.wk.sel .wk-dot { transform: scale(1.25); }
.wk.sel .wk-d, .wk.sel .wk-sum { color: var(--ink-2); }
.wk-sum { display: none; }
@media (min-width: 1100px) {
  .wk { min-height: 92px; padding: 10px 6px; }
  .wk-sum { display: block; margin-top: 4px; font-size: 11.5px; line-height: 1.25; color: var(--ink-3); text-align: center; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
}

/* Your thoughts under a day's readings */
.note {
  position: relative;
  margin-top: 14px;
  padding: 14px 16px 12px;
  border-radius: var(--r-md);
  background: var(--card);
  border: 1px dashed var(--line-2);
  transition: border-color .3s, background .3s;
}
.note:focus-within, .note.has-text { border-style: solid; border-color: color-mix(in srgb, var(--gold) 40%, transparent); }
.note-label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--gold);
}
.note-label svg, .nc-foot svg, .empty-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.note-text {
  display: block; width: 100%; min-height: 56px; margin-top: 6px; padding: 0;
  border: 0; outline: none; resize: none; background: transparent;
  font-family: var(--serif); font-size: 18px; line-height: 1.55; color: var(--ink);
  field-sizing: content;
}
.note-text::placeholder { color: var(--ink-3); font-style: italic; }
.note:focus-within { box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 18%, transparent); }
.note-status { position: absolute; top: 14px; right: 16px; font-size: 12px; font-weight: 600; color: var(--sage); opacity: 0; }
.note-status.saved { animation: saved 1.8s var(--ease); }

/* "Lamp has a new address" card (only on the old address) */
.moved {
  margin-bottom: 18px;
  border-color: color-mix(in srgb, var(--gold) 45%, transparent);
  background: linear-gradient(160deg, var(--gold-soft), var(--card) 75%);
  animation: rise .6s var(--ease) both;
}
.moved-title { font-family: var(--serif); font-size: 21px; margin-bottom: 4px; }

/* ---------- Reading partners ---------- */

.together {
  margin-bottom: 18px; padding: 14px 16px;
  border-radius: var(--r-md);
  background: linear-gradient(160deg, var(--mate-soft), var(--card) 70%);
  border: 1px solid color-mix(in srgb, var(--mate) 22%, transparent);
  box-shadow: var(--shadow-1);
  animation: rise .6s var(--ease) both .2s;
}
.together-title, .notes-split {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--sans); font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-2);
}
.together-title svg, .notes-split svg, .btn svg.people, .sheet-icon svg {
  width: 18px; height: 18px; fill: none; stroke: var(--mate); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.mates, .partner-list { list-style: none; padding: 0; margin: 0; }
.mates { display: grid; gap: 4px; margin-top: 8px; }
.mate, .partner-row {
  display: flex; align-items: center; gap: 12px; padding: 6px 0;
  animation: rise .55s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 70ms + 250ms);
}
.mate-ring { position: relative; flex: none; width: 44px; height: 44px; }
.mate-ring svg { width: 44px; height: 44px; transform: rotate(-90deg); }
.mr-track { fill: var(--card); stroke: var(--cell-empty); stroke-width: 3.5; }
.mr-bar { fill: none; stroke: var(--mate); stroke-width: 3.5; stroke-linecap: round; transition: stroke-dashoffset 1.2s var(--ease); }
.mate-initial {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--serif); font-size: 18px; font-weight: 600; color: var(--ink);
}
.mate-text { flex: 1; min-width: 0; }
.mate-name { font-weight: 700; }
.mate-sub { font-size: 14px; color: var(--ink-2); overflow-wrap: anywhere; }
.mate-status {
  flex: none; display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 700; white-space: nowrap;
  background: var(--bg-2); color: var(--ink-2);
}
.mate-status svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.mate-status.done { background: var(--sage-soft); color: var(--sage); animation: seal-in .6s var(--spring) both .5s; }
.mate-status.reading { background: var(--gold-soft); color: var(--gold); }
@media (max-width: 420px) {
  .mate-status { padding: 5px 8px; font-size: 12.5px; }
}

/* The "Share with…" switch under a note */
.note-share {
  display: inline-flex; align-items: center; gap: 10px;
  margin-top: 10px; padding: 4px 2px; border: 0; background: none;
  font-size: 14px; font-weight: 600; color: var(--ink-2); text-align: left;
}
.ns-track {
  position: relative; flex: none; width: 38px; height: 22px; border-radius: 999px;
  background: var(--cell-empty); transition: background .3s var(--ease);
}
.ns-knob {
  position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--knob); box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
  transition: transform .45s var(--spring);
}
.note-share[aria-pressed="true"] { color: var(--ink); }
.note-share[aria-pressed="true"] .ns-track { background: var(--mate); }
.note-share[aria-pressed="true"] .ns-knob { transform: translateX(16px); }

/* A partner's note, shown under yours */
.mate-note {
  margin: 10px 0 0; padding: 12px 16px;
  border-radius: var(--r-md);
  background: var(--mate-soft);
  border-left: 3px solid var(--mate);
  animation: rise .55s var(--ease) backwards .1s;
}
.mate-note figcaption, .nc-who { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.mn-av {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--mate); color: var(--card); font-size: 12px; font-weight: 700;
}
.mn-ref { font-weight: 500; color: var(--ink-3); }
.mn-text { margin-top: 6px; font-family: var(--serif); font-size: 18px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.mate-card { border-left: 3px solid var(--mate); }
.notes-split { margin: 14px 0 0; }
.shared-tag {
  display: inline-block; margin-left: 6px; padding: 2px 7px; border-radius: 999px; vertical-align: 1px;
  font-size: 10.5px; letter-spacing: .04em; background: var(--mate-soft); color: var(--ink-2);
}

/* A partner finished this day (Year) or chapter (Books): a small blue dot. */
.cell.mate::before {
  content: ""; position: absolute; right: 2px; bottom: 2px; width: 5px; height: 5px; border-radius: 50%;
  background: var(--mate); box-shadow: 0 0 0 1.5px var(--card);
}
.legend .cell.mate { position: relative; }
.chap { position: relative; }
.chap.mate::after {
  content: ""; position: absolute; top: 5px; right: 5px; width: 6px; height: 6px; border-radius: 50%;
  background: var(--mate);
}

/* Settings */
.partners-card .btn svg { stroke: currentColor; }
.name-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.name-row label { font-weight: 600; }
.name-row.stack { flex-direction: column; align-items: stretch; gap: 6px; }
.name-row input {
  flex: 1; max-width: 240px; min-height: 44px; padding: 0 12px;
  font-size: 16px; color: var(--ink);
  border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--card-2);
}
.name-row.stack input { max-width: none; }
.partner-list { margin-top: 12px; border-top: 1px solid var(--line); }
.partner-row { border-bottom: 1px solid var(--line); padding: 10px 0; }
.invite-waiting {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 14px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--mate-soft);
}
.sheet-icon { display: inline-grid; place-items: center; width: 52px; height: 52px; margin-bottom: 10px; border-radius: 50%; background: var(--mate-soft); }
.sheet-icon svg { width: 26px; height: 26px; }

/* ---------- Notes ---------- */

.notes-page { max-width: 760px; }
.notes-search { margin-bottom: 16px; }
.notes-search input {
  width: 100%; min-height: 46px; padding: 0 16px;
  font-size: 16px; color: var(--ink);
  border-radius: 999px; border: 1px solid var(--line-2); background: var(--card);
}
.notes-list { display: grid; gap: 12px; }
.note-card {
  padding: 18px 18px 10px;
  border-radius: var(--r-md);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-1);
  animation: rise .55s var(--ease) backwards; animation-delay: calc(var(--i) * 50ms);
}
.nc-title { font-family: var(--sans); font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--gold); }
.nc-text { margin-top: 8px; font-family: var(--serif); font-size: 19px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.nc-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; font-size: 13px; color: var(--ink-3); }
.empty { text-align: center; padding: 34px 22px; animation: rise .6s var(--ease) backwards; }
.empty-icon { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--gold-soft); color: var(--gold); margin-bottom: 12px; }
.empty-icon svg { width: 26px; height: 26px; }
.empty h2 { font-family: var(--serif); font-size: 22px; }
.empty p { color: var(--ink-2); margin: 8px auto 18px; max-width: 420px; }

/* A rest day on Today */
.rest-card {
  padding: 26px 20px 20px; text-align: center;
  border-radius: var(--r-md);
  background: linear-gradient(160deg, color-mix(in srgb, var(--sky) 10%, var(--card)), var(--card) 70%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
  animation: rise .6s var(--ease) both .1s;
}
.rest-icon {
  display: inline-grid; place-items: center;
  width: 56px; height: 56px; border-radius: 50%;
  background: color-mix(in srgb, var(--sky) 16%, var(--card)); color: var(--sky);
  margin-bottom: 10px;
  animation: sway 5s ease-in-out infinite;
}
.rest-icon svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.rest-title { font-family: var(--serif); font-size: 23px; font-weight: 600; }
.rest-sub { margin: 6px auto 0; max-width: 380px; color: var(--ink-2); }
.rest-next { margin-top: 12px; font-size: 14px; color: var(--ink-3); }
.rest-card .btn-row { justify-content: center; }
.rest-card .btn svg { width: 16px; height: 16px; }

/* Rest-day picker: seven round day buttons */
.rest-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; max-width: 460px; }
.rest-pill {
  min-height: 46px; padding: 0 2px;
  border-radius: 14px; border: 1.5px solid var(--line); background: var(--card);
  font-size: 14px; font-weight: 600; color: var(--ink-2);
  transition: background .25s, border-color .25s, color .25s, transform .2s var(--ease);
}
.rest-pill:active { transform: scale(.93); }
.rest-pill[aria-pressed="true"] { background: color-mix(in srgb, var(--sky) 18%, var(--card)); border-color: var(--sky); color: var(--ink); }
.optional { font-family: var(--sans); font-size: 13px; font-weight: 600; color: var(--ink-3); margin-left: 6px; letter-spacing: .02em; }

/* ---------- Year ---------- */

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 18px; }
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile {
  padding: 14px 16px; border-radius: var(--r-md);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-1);
  animation: rise .6s var(--ease) both;
}
.tile:nth-child(2) { animation-delay: 60ms; }
.tile:nth-child(3) { animation-delay: 120ms; }
.tile:nth-child(4) { animation-delay: 180ms; }
.tile-label { display: block; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }
.tile-num { display: flex; align-items: baseline; gap: 5px; font-family: var(--serif); font-size: 30px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tile-num small { font-family: var(--sans); font-size: 13px; font-weight: 500; color: var(--ink-3); }

.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 16px; font-size: 13px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .cell { width: 12px; height: 12px; display: inline-block; animation: none; }

.months { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 12px; }
@media (min-width: 860px) { .months { grid-template-columns: repeat(4, 1fr); gap: 16px; } }
.month {
  padding: 14px; border-radius: var(--r-md);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-1);
  animation: rise .6s var(--ease) both; animation-delay: calc(var(--m) * 40ms);
}
.month h2 { font-family: var(--serif); font-size: 17px; margin-bottom: 8px; }
.month h2 span { color: var(--ink-3); font-weight: 500; }
.dow, .cells { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.dow span { font-size: 11px; text-align: center; color: var(--ink-3); font-weight: 600; }
.cells { margin-top: 4px; }
.cell {
  aspect-ratio: 1; border-radius: 6px; border: 0; padding: 0;
  background: var(--cell-empty);
  position: relative;
  animation: cell-in .5s var(--spring) both;
  animation-delay: calc(var(--i, 0) * 2.2ms + 150ms);
  transition: transform .2s var(--ease), background .4s;
}
button.cell:hover { transform: scale(1.18); z-index: 1; }
.cell.blank, .cell.out { background: transparent; animation: none; }
.cell.out { background: color-mix(in srgb, var(--cell-empty) 35%, transparent); }
.cell.future { background: var(--cell-empty); }
.cell.done { background: linear-gradient(140deg, var(--gold-2), var(--gold)); }
.cell.partial { background: linear-gradient(140deg, var(--gold-2) 0 50%, var(--cell-empty) 50%); }
.cell.rest { background: color-mix(in srgb, var(--sky) 22%, transparent); }
.cell.missed { background: var(--cell-empty); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--rust) 45%, transparent); }
.cell.today::after {
  content: ""; position: absolute; inset: -3px; border-radius: 8px;
  border: 2px solid var(--ink);
  animation: today-pulse 2.4s ease-in-out infinite;
}

/* ---------- Books ---------- */

.seg {
  position: relative;
  display: grid; grid-template-columns: repeat(var(--n), 1fr);
  padding: 4px; border-radius: 999px;
  background: var(--bg-2);
  max-width: 460px;
  margin-bottom: 22px;
}
.seg-thumb {
  position: absolute; top: 4px; bottom: 4px; left: 4px;
  width: calc((100% - 8px) / var(--n));
  border-radius: 999px; background: var(--card); box-shadow: var(--shadow-1);
  transform: translateX(calc(var(--i) * 100%));
  transition: transform .45s var(--spring);
}
.seg button {
  position: relative; z-index: 1;
  min-height: 40px; border: 0; background: none; border-radius: 999px;
  padding: 0 6px; white-space: nowrap;
  font-size: clamp(13px, 3.7vw, 15px); font-weight: 600; color: var(--ink-2);
  transition: color .3s;
}
.seg button[aria-pressed="true"] { color: var(--ink); }

.shelf + .shelf { margin-top: 26px; }
.shelf-title { display: flex; align-items: baseline; justify-content: space-between; font-family: var(--serif); font-size: 21px; margin-bottom: 10px; }
.shelf-title span { font-family: var(--sans); font-size: 14px; color: var(--ink-3); font-weight: 600; }
.shelf-list { display: grid; gap: 8px; }
@media (min-width: 860px) { .shelf-list { grid-template-columns: 1fr 1fr; align-items: start; } }

/* Desktop library: the whole Bible on two long shelves. */
.library { display: none; }
@media (min-width: 860px) {
  .library { display: grid; gap: 22px; margin-bottom: 30px; }
  .shelf .bookcase { display: none; }
  .lib-title { font-family: var(--serif); font-size: 21px; margin-bottom: 4px; }
  .library .spines { gap: 3px; padding: 22px 10px 12px; overflow: visible; }
  .library .spine-wrap { flex: 1 1 0; min-width: 0; }
  .library .spine { width: 100%; }
  .library .spine-name { font-size: 10.5px; }
}

/* The bookcase: spines standing on a wooden shelf. */
.bookcase { position: relative; margin: 0 0 16px; }
.bookcase::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 12px;
  border-radius: 3px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--gold) 70%, var(--bg)), color-mix(in srgb, var(--gold) 35%, var(--bg)));
  box-shadow: 0 6px 14px rgba(0, 0, 0, .25);
  pointer-events: none;
}
.spines {
  display: flex; align-items: flex-end; gap: 4px;
  padding: 18px 12px 12px;
  overflow-x: auto;
  scrollbar-width: none;
  perspective: 800px;
}
.spines::-webkit-scrollbar { display: none; }
.spine-wrap { flex: none; display: flex; }
.spine {
  --c: var(--spine-1);
  position: relative;
  width: var(--w); height: var(--h);
  padding: 0; border: 0;
  border-radius: 3px 3px 2px 2px;
  overflow: hidden;
  background: linear-gradient(90deg, color-mix(in srgb, var(--c) 75%, #000) 0%, var(--c) 18%, color-mix(in srgb, var(--c) 85%, #fff) 45%, var(--c) 70%, color-mix(in srgb, var(--c) 70%, #000) 100%);
  box-shadow: 1px 0 0 rgba(0, 0, 0, .25);
  transform-origin: 50% 100%;
  transition: transform .5s var(--spring), box-shadow .3s;
  animation: book-drop .8s var(--spring) backwards;
  animation-delay: calc(var(--j) * 45ms + 120ms);
}
.s1 { --c: var(--spine-1); } .s2 { --c: var(--spine-2); } .s3 { --c: var(--spine-3); } .s4 { --c: var(--spine-4); } .s5 { --c: var(--spine-5); }
/* Gold bands near the top and bottom of each spine. */
.spine::before, .spine::after {
  content: ""; position: absolute; left: 0; right: 0; height: 4px; z-index: 1;
  border-top: 1px solid color-mix(in srgb, var(--gold-2) 70%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--gold-2) 70%, transparent);
}
.spine::before { top: 9px; }
.spine::after { bottom: 9px; }
.spine-fill {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: calc(var(--p) * 100%);
  background: linear-gradient(0deg, color-mix(in srgb, var(--gold-2) 75%, transparent), color-mix(in srgb, var(--gold-2) 35%, transparent));
  transition: height 1s var(--ease);
}
.spine-name {
  position: absolute; inset: 18px 0; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  writing-mode: vertical-rl; transform: rotate(180deg);
  font-family: var(--serif); font-size: 11px; font-weight: 600; letter-spacing: .04em;
  color: var(--spine-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .5);
}
.spine:hover, .spine:focus-visible { transform: translateY(-12px) rotateY(-20deg); box-shadow: 8px 10px 18px rgba(0, 0, 0, .35); }
.spine.finished { box-shadow: 0 0 16px color-mix(in srgb, var(--gold-2) 55%, transparent); }
.spine.finished .spine-name { color: var(--on-gold); text-shadow: none; }
.spine.lift { animation: lift .7s var(--spring); }
.book.flash { animation: flash 1.2s var(--ease); }

.book {
  border-radius: var(--r-md);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-1);
  overflow: hidden;
  position: relative;
  animation: rise .5s var(--ease) both; animation-delay: calc(min(var(--i), 20) * 25ms);
}
.book-head {
  width: 100%;
  display: grid; grid-template-columns: 1fr auto 24px; grid-template-rows: auto auto;
  column-gap: 10px; row-gap: 8px; align-items: center;
  padding: 14px 14px 14px 16px; border: 0; background: none; text-align: left;
}
.book-name { font-family: var(--serif); font-size: 18px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.badge {
  display: none;
  font-family: var(--sans); font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; background: var(--gold-soft); color: var(--gold);
}
.finished .badge { display: inline-block; animation: seal-in .6s var(--spring) both; }
.book-count { font-size: 14px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.bc-n { color: var(--ink); font-weight: 600; }
.chev { grid-row: 1 / span 2; grid-column: 3; color: var(--ink-3); transition: transform .4s var(--spring); }
.chev svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.open .chev { transform: rotate(180deg); }
.bar { grid-column: 1 / span 2; height: 6px; border-radius: 3px; background: var(--cell-empty); overflow: hidden; }
.bar > span {
  display: block; height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--amber), var(--gold));
  transform-origin: left; transform: scaleX(var(--p));
  transition: transform .8s var(--ease);
  animation: bar-in 1.1s var(--ease) both; animation-delay: calc(min(var(--i), 20) * 25ms + 200ms);
}
.finished .bar > span { background: linear-gradient(90deg, var(--sage-2), var(--sage)); }

.book-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .5s var(--ease); }
.open .book-body { grid-template-rows: 1fr; }
.book-body-inner { overflow: hidden; }
.chapters { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; padding: 2px 14px 12px; }
.chap {
  height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--card-2);
  font-size: 15px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums;
  transition: background .3s, color .3s, border-color .3s, transform .2s var(--ease);
}
.chap:hover { border-color: var(--line-2); }
.chap:active { transform: scale(.9); }
.chap.on { background: var(--sage); border-color: transparent; color: var(--card); }
.book-link {
  display: inline-flex; align-items: center; gap: 4px;
  margin: 0 14px 14px; font-size: 15px; font-weight: 600; text-decoration: none;
}
.book-link svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.book.shine::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 30%, color-mix(in srgb, var(--cream) 70%, transparent) 50%, transparent 70%);
  animation: shine 1.1s var(--ease) both;
}

/* ---------- Settings ---------- */

.settings { max-width: 760px; }
.group + .group { margin-top: 32px; }
.group { animation: rise .6s var(--ease) both; }
.group:nth-of-type(2) { animation-delay: 60ms; }
.group:nth-of-type(3) { animation-delay: 120ms; }
.group:nth-of-type(4) { animation-delay: 180ms; }
.group:nth-of-type(5) { animation-delay: 240ms; }
.row-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row-card label { font-weight: 600; }
.sync-card p { color: var(--ink-2); }
.sync-line { display: flex; align-items: center; gap: 10px; }
.settings .seg { margin-bottom: 0; }

/* Daily reminder */
.remind-card { display: grid; gap: 14px; }
.remind-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.remind-text { display: flex; flex-direction: column; }
.remind-text .hint { margin-top: 2px; }
.remind-title { font-weight: 600; }
.remind-time { padding-top: 14px; border-top: 1px solid var(--line); }
.remind-time label { font-weight: 600; }
.remind-card .btn-row { margin-top: 0; }

/* An on/off switch like the ones in iPhone Settings. */
.switch {
  position: relative; flex: none;
  width: 54px; height: 32px; padding: 0;
  border-radius: 999px; border: 0;
  background: var(--cell-empty);
  transition: background .3s var(--ease);
}
.switch .knob {
  position: absolute; top: 3px; left: 3px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--knob);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
  transition: transform .45s var(--spring), width .2s var(--ease);
}
.switch:active .knob { width: 32px; }
.switch[aria-checked="true"] { background: var(--sage); }
.switch[aria-checked="true"] .knob { transform: translateX(22px); }
.switch[aria-checked="true"]:active .knob { transform: translateX(16px); }
.switch.busy .knob { animation: breathe 1s ease-in-out infinite; }

/* ---------- Add to Home Screen ---------- */

.install-hero { text-align: center; padding-top: 4px; }
.install-icon {
  display: block; margin: 0 auto 14px;
  width: 72px; height: 72px; border-radius: 18px;
  box-shadow: 0 10px 30px color-mix(in srgb, var(--gold) 35%, transparent);
  animation: icon-drop .8s var(--spring) backwards .15s;
}
.install-hero .sheet-title { padding-right: 0; margin-bottom: 6px; }
.install-hero p { color: var(--ink-2); max-width: 400px; margin: 0 auto; }
.install-btn { width: 100%; margin-top: 18px; animation: rise .5s var(--ease) backwards .3s; }
.guide-card {
  margin-top: 18px; padding: 16px 16px 6px;
  border-radius: var(--r-md); background: var(--card); border: 1px solid var(--line);
}
.guide-card h3 { font-size: 13px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--gold); margin-bottom: 8px; }
.guide-steps { list-style: none; margin: 0; padding: 0; }
.guide-steps li {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 10px 0; border-top: 1px solid var(--line);
  color: var(--ink-2); line-height: 1.5;
  animation: rise .5s var(--ease) backwards; animation-delay: calc(var(--i) * 110ms + 350ms);
}
.guide-steps li:first-child { border-top: 0; }
.guide-steps b { color: var(--ink); }
.step-n {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--gold-soft); color: var(--gold);
  font-size: 13px; font-weight: 700;
}
.guide-sym {
  display: inline-grid; place-items: center; vertical-align: -5px;
  width: 24px; height: 24px; border-radius: 7px;
  background: var(--card-2); border: 1px solid var(--line-2); color: var(--sky);
}
.guide-sym svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
/* The Share button gets a gentle nudge so it's easy to spot. */
.guide-steps li:first-child .guide-sym { animation: nudge 2.4s ease-in-out infinite 1.2s; }
.install-foot { justify-content: center; }
.install .hint { text-align: center; }
.install-row { display: flex; align-items: center; gap: 14px; }
.install-row img { border-radius: 11px; flex: none; }
.install-row p { flex: 1; color: var(--ink-2); }

/* ---------- Bottom sheet ---------- */

#sheet-root { position: fixed; inset: 0; z-index: 40; }
.sheet-backdrop {
  position: absolute; inset: 0;
  background: rgba(20, 14, 6, .38);
  opacity: 0; transition: opacity .3s;
}
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: 88vh; overflow: auto;
  padding: 26px max(20px, env(safe-area-inset-left)) calc(24px + env(safe-area-inset-bottom));
  background: var(--bg);
  border-radius: 28px 28px 0 0;
  box-shadow: var(--shadow-2);
  transform: translateY(100%);
  transition: transform .5s var(--sheet-ease);
}
.open .sheet-backdrop { opacity: 1; }
.open .sheet { transform: none; }
.sheet-grip { position: absolute; top: 8px; left: 50%; width: 40px; height: 5px; margin-left: -20px; border-radius: 3px; background: var(--line-2); }
.sheet-close { position: absolute; top: 14px; right: 14px; }
.sheet-title { font-family: var(--serif); font-size: 28px; letter-spacing: -.01em; margin-bottom: 14px; padding-right: 48px; }
.sheet-body > p:not(.eyebrow):not(.hint) { color: var(--ink-2); }
.sheet .slot { animation-delay: calc(var(--i) * 70ms + 200ms); }
.link-box { margin-top: 14px; }
.link-box input { width: 100%; font-family: ui-monospace, Menlo, monospace; font-size: 16px; }
@media (min-width: 700px) {
  #sheet-root { display: grid; place-items: center; }
  .sheet {
    position: relative; left: auto; right: auto; bottom: auto;
    width: min(560px, calc(100vw - 48px));
    border-radius: 28px;
    transform: translateY(24px) scale(.96); opacity: 0;
    transition: transform .45s var(--spring), opacity .25s;
  }
  .open .sheet { opacity: 1; }
  .sheet-grip { display: none; }
}

/* ---------- Toast, floating "+2", confetti ---------- */

.toast {
  position: fixed; left: 50%; z-index: 60;
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 16px);
  display: flex; align-items: center; gap: 14px;
  max-width: calc(100vw - 32px);
  padding: 12px 18px; border-radius: 16px;
  background: var(--ink); color: var(--bg);
  font-size: 15px; font-weight: 500;
  box-shadow: var(--shadow-2);
  transform: translate(-50%, 20px) scale(.96); opacity: 0; pointer-events: none;
  transition: transform .45s var(--spring), opacity .25s;
}
.toast.show { transform: translate(-50%, 0) scale(1); opacity: 1; pointer-events: auto; }
.toast button { border: 0; background: none; color: var(--gold-2); font-weight: 700; padding: 6px 4px; min-height: 36px; }
@media (min-width: 860px) { .toast { bottom: 28px; } }

.float-tag {
  position: fixed; z-index: 55; pointer-events: none;
  padding: 4px 10px; border-radius: 999px;
  background: var(--sage); color: var(--card);
  font-size: 13px; font-weight: 700; white-space: nowrap;
}
#confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 70; }

/* ---------- Motion ---------- */

.pop { animation: pop .5s var(--spring); }

@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(1); } 35% { transform: scale(.95); } 70% { transform: scale(1.025); } 100% { transform: scale(1); } }
@keyframes cell-in { from { opacity: 0; transform: scale(.3); } to { opacity: 1; transform: none; } }
@keyframes bar-in { from { transform: scaleX(0); } }
@keyframes card-in { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes seal-in { from { transform: scale(0) rotate(-30deg); } to { transform: none; } }
@keyframes shine { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@keyframes flicker {
  0%, 100% { transform: scale(1) rotate(0); }
  25% { transform: scale(1.04, .97) rotate(-1.5deg); }
  50% { transform: scale(.97, 1.04) rotate(1deg); }
  75% { transform: scale(1.02, .99) rotate(-.5deg); }
}
@keyframes glow { 0%, 100% { opacity: .75; transform: scale(1); } 50% { opacity: 1; transform: scale(1.08); } }
@keyframes drift { from { transform: translate(0, 0) scale(1); } to { transform: translate(-60px, 40px) scale(1.15); } }
@keyframes tip-pulse { 0%, 100% { transform: scale(.8); opacity: .35; } 50% { transform: scale(1.35); opacity: .7; } }
@keyframes ripple { from { opacity: .9; transform: scale(1); } to { opacity: 0; transform: scale(2.4); } }
@keyframes book-drop { from { opacity: 0; transform: translateY(-46px) rotate(-7deg); } 50% { opacity: 1; } to { opacity: 1; transform: none; } }
@keyframes lift { 0% { transform: none; } 40% { transform: translateY(-22px) rotateY(-30deg); } 100% { transform: none; } }
@keyframes flash { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--gold-2) 70%, transparent); } 30% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold-2) 50%, transparent); } 100% { box-shadow: var(--shadow-1); } }
@keyframes saved { 0% { opacity: 0; transform: translateY(4px); } 15%, 70% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes icon-drop { from { opacity: 0; transform: translateY(-18px) scale(.8); } to { opacity: 1; transform: none; } }
@keyframes nudge { 0%, 70%, 100% { transform: none; } 78% { transform: translateY(-4px); } 86% { transform: none; } 92% { transform: translateY(-2px); } }
@keyframes sway { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes today-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(1.08); } }

/* Page changes cross-fade with a small lift. */
::view-transition-old(root) { animation: vt-out .18s ease-in both; }
::view-transition-new(root) { animation: vt-in .42s var(--ease) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    transition-delay: 0s !important;
  }
}

/* ---------- Privacy page ---------- */

.privacy-body { padding-bottom: 48px; }
.privacy { max-width: 720px; padding-top: 40px; }
.privacy h2 { font-family: var(--serif); font-size: 22px; margin: 30px 0 10px; }
.privacy p, .privacy li { color: var(--ink-2); line-height: 1.65; }
.privacy p + p, .privacy ul + p { margin-top: 12px; }
.privacy ul { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.privacy strong { color: var(--ink); }
.privacy-lede { margin-top: 14px; font-family: var(--serif); font-size: 20px; color: var(--ink) !important; }
.privacy-back { margin-top: 32px; }
