:root {
  --font-display: "Fraunces", Georgia, serif;
  --font-text: "Hanken Grotesk", "Helvetica Neue", Arial, sans-serif;
  --bg: oklch(0.17 0.012 30);
  --bg-2: oklch(0.21 0.016 30);
  --ink: oklch(0.95 0.012 60);
  --ink-2: oklch(0.78 0.018 50);
  --ink-3: oklch(0.6 0.02 40);
  --line: oklch(0.95 0.02 50 / 0.1);
  --accent: oklch(0.76 0.11 35);
  --accent-soft: oklch(0.76 0.11 35 / 0.16);
  --period: oklch(0.66 0.16 22);
  --fertile: oklch(0.8 0.08 160);
  --ovu: oklch(0.86 0.1 90);
  --shadow-lg: 0 4px 8px -4px oklch(0.05 0.02 30 / 0.5), 0 12px 24px -6px oklch(0.05 0.02 30 / 0.45), 0 24px 48px -12px oklch(0.05 0.02 30 / 0.5);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --r: 22px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
}
:root[data-accent="sea"] { --accent: oklch(0.78 0.09 200); --accent-soft: oklch(0.78 0.09 200 / 0.16); }
:root[data-accent="sage"] { --accent: oklch(0.8 0.08 145); --accent-soft: oklch(0.8 0.08 145 / 0.16); }
:root[data-accent="gold"] { --accent: oklch(0.84 0.1 85); --accent-soft: oklch(0.84 0.1 85 / 0.16); }
:root[data-accent="lilac"] { --accent: oklch(0.8 0.08 320); --accent-soft: oklch(0.8 0.08 320 / 0.16); }

* { box-sizing: border-box; margin: 0; }
html { background: var(--bg); color: var(--ink); -webkit-text-size-adjust: 100%; }
body {
  font: 400 16px/1.5 var(--font-text); min-height: 100dvh; text-wrap: pretty;
  background: radial-gradient(120% 70% at 80% -10%, oklch(0.28 0.04 35 / 0.7), transparent 60%), var(--bg);
  padding: env(safe-area-inset-top) 0 calc(88px + env(safe-area-inset-bottom));
}
.grain::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 50; opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
main { max-width: 480px; margin: 0 auto; padding: var(--s5) var(--s4) 0; }
h1, h2, .display { font-family: var(--font-display); font-weight: 400; letter-spacing: -0.02em; line-height: 1.05; text-wrap: balance; }
h1 { font-size: clamp(2.2rem, 1.4rem + 4vw, 3rem); }
h2 { font-size: 1.5rem; margin-bottom: var(--s3); }
.eyebrow { font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); }
.muted { color: var(--ink-2); }
.small { font-size: 0.875rem; }
.stack > * + * { margin-top: var(--s4); }
section { margin-top: var(--s6); }
.card { background: linear-gradient(180deg, var(--bg-2), oklch(0.19 0.014 30)); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s5); box-shadow: var(--shadow-lg), inset 0 1px 0 oklch(1 0 0 / 0.05); }

/* Today header */
.top { display: flex; justify-content: space-between; align-items: end; gap: var(--s4); }
.top .moon { text-align: right; font-size: 0.8rem; color: var(--ink-3); }

/* The ring: signature moment */
.ring { position: relative; margin: var(--s5) -8px 0; aspect-ratio: 1; }
.ring svg { width: 100%; height: 100%; overflow: visible; }
.ring .arc { fill: none; stroke-linecap: round; stroke-width: 10; }
.ring .tick { stroke: var(--line); stroke-width: 1.5; }
.ring .bead { fill: var(--ink); filter: drop-shadow(0 0 10px var(--accent)) drop-shadow(0 0 22px var(--accent)); }
.ring .sweep { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; opacity: 0.9; }
.ring .center { position: absolute; inset: 22%; display: grid; place-content: center; text-align: center; }
.ring .center .num { font-family: var(--font-display); font-size: clamp(4rem, 2rem + 14vw, 6rem); line-height: 0.9; letter-spacing: -0.04em; font-variation-settings: "opsz" 144; }
.ring .center .lbl { font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2); }
.ring .center .ph { margin-top: var(--s2); font-family: var(--font-display); font-style: italic; font-size: 1.25rem; color: var(--accent); }
@keyframes draw { from { stroke-dashoffset: var(--len); } to { stroke-dashoffset: 0; } }
.ring .sweep { stroke-dasharray: var(--len); animation: draw 1200ms var(--ease-out-expo) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.rise > * { animation: rise 600ms var(--ease-out-quart) both; }
.rise > *:nth-child(2) { animation-delay: 60ms; } .rise > *:nth-child(3) { animation-delay: 120ms; }
.rise > *:nth-child(4) { animation-delay: 180ms; } .rise > *:nth-child(5) { animation-delay: 240ms; }

.facts { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); margin-top: var(--s4); }
.facts div { border-top: 1px solid var(--line); padding-top: var(--s2); }
.facts b { display: block; font-family: var(--font-display); font-weight: 400; font-size: 1.35rem; }

/* Reading */
.reading .headline { font-family: var(--font-display); font-size: 1.9rem; line-height: 1.08; letter-spacing: -0.02em; margin: var(--s2) 0 var(--s3); }
.dd { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); margin-top: var(--s5); font-size: 0.95rem; }
.dd ul { list-style: none; padding: 0; } .dd li { padding: 6px 0; border-top: 1px solid var(--line); }

/* Caleb card */
.pull { padding: 0; overflow: hidden; }
.pull img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.pull .words { padding: var(--s5); }
.pull .words p { font-family: var(--font-display); font-size: 1.45rem; line-height: 1.2; font-style: italic; }
.pull .from { margin-top: var(--s3); font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; }
.cal .dow { font-size: 0.7rem; color: var(--ink-3); padding-bottom: 4px; }
.cal button { aspect-ratio: 1; border-radius: 50%; border: 1px solid transparent; background: none; color: var(--ink); font: 500 0.95rem var(--font-text); cursor: pointer; position: relative; }
.cal .period { background: var(--period); color: oklch(0.15 0.02 20); }
.cal .predicted { border: 1.5px dashed var(--period); }
.cal .fertile { background: oklch(0.8 0.08 160 / 0.18); }
.cal .ovulation { background: var(--ovu); color: oklch(0.2 0.02 90); }
.cal .today { outline: 2px solid var(--accent); outline-offset: 2px; }
.cal .logged::after { content: ""; position: absolute; bottom: 4px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--accent); }
.cal .out { visibility: hidden; }
.monthbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--s4); }
.legend { display: flex; flex-wrap: wrap; gap: var(--s4); margin-top: var(--s4); font-size: 0.8rem; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }

/* Chart */
.big3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3); }
.big3 div { text-align: center; padding: var(--s4) var(--s2); border: 1px solid var(--line); border-radius: 18px; }
.big3 .g { font-size: 1.6rem; color: var(--accent); }
.big3 b { display: block; font-family: var(--font-display); font-weight: 400; font-size: 1.25rem; margin-top: 4px; }
.plist { list-style: none; padding: 0; }
.plist li { display: grid; grid-template-columns: 2rem 1fr auto; align-items: baseline; padding: 10px 0; border-top: 1px solid var(--line); }
.plist .g { color: var(--accent); }

/* Controls */
button, .btn { font: 600 0.95rem var(--font-text); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: 999px; border: 0; cursor: pointer; background: var(--accent); color: oklch(0.18 0.02 30); transition: transform 180ms var(--ease-out-quart), box-shadow 180ms var(--ease-out-quart); box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.35), 0 8px 20px -8px var(--accent); }
.btn:active { transform: scale(0.97); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); box-shadow: none; }
.btn.block { width: 100%; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: none; color: var(--ink); cursor: pointer; display: grid; place-items: center; }
label { display: block; font-size: 0.85rem; color: var(--ink-2); margin-bottom: 6px; }
input, select, textarea { width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: oklch(0.13 0.01 30); color: var(--ink); font: 400 16px var(--font-text); }
textarea { min-height: 96px; resize: vertical; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: none; color: var(--ink); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }
.swatches { display: flex; gap: 12px; }
.swatches button { width: 40px; height: 40px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.swatches button[aria-pressed="true"] { border-color: var(--ink); }
.switch { display: flex; justify-content: space-between; align-items: center; gap: var(--s4); padding: 14px 0; border-top: 1px solid var(--line); }
.switch input { width: 52px; min-height: 30px; accent-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 10px; }
.err { color: var(--period); font-size: 0.9rem; min-height: 1.4em; }
.list-item { display: flex; gap: var(--s3); align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); }
.list-item p { flex: 1; }
.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.thumbs figure { position: relative; } .thumbs img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; display: block; }
.thumbs button { position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: oklch(0.1 0.01 30 / 0.7); color: var(--ink); cursor: pointer; }

/* Tabs */
#tabs { position: fixed; left: 50%; bottom: calc(12px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: 4px; padding: 6px; border-radius: 999px; z-index: 40;
  background: oklch(0.22 0.016 30 / 0.72); backdrop-filter: blur(16px) saturate(160%); -webkit-backdrop-filter: blur(16px) saturate(160%); border: 1px solid oklch(1 0 0 / 0.08); box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.08), var(--shadow-lg); }
#tabs button { display: grid; place-items: center; gap: 2px; min-width: 70px; padding: 0 12px; white-space: nowrap; height: 54px; border: 0; border-radius: 999px; background: none; color: var(--ink-3); font: 500 0.68rem var(--font-text); cursor: pointer; transition: color 180ms var(--ease-out-quart), background 180ms var(--ease-out-quart); }
#tabs button[aria-current="page"] { color: var(--ink); background: var(--accent-soft); }
#tabs svg { width: 22px; height: 22px; }

/* Sheet */
#sheet { position: fixed; inset: 0; z-index: 60; display: grid; align-items: end; background: oklch(0.05 0.01 30 / 0.55); }
#sheet .panel { background: var(--bg-2); border-radius: 28px 28px 0 0; padding: var(--s5) var(--s4) calc(var(--s5) + env(safe-area-inset-bottom)); max-width: 520px; width: 100%; margin: 0 auto; max-height: 85dvh; overflow: auto; animation: up 420ms var(--ease-out-expo) both; border-top: 1px solid var(--line); }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Login */
.gate { min-height: 80dvh; display: grid; align-content: center; }
.gate h1 { font-size: 3.4rem; font-style: italic; }
.who { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }

@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

[hidden] { display: none !important; }

.pop { padding: var(--s4) var(--s2) 0; text-align: center; }
.pop-text { font-family: var(--font-display); font-style: italic; font-size: clamp(1.7rem, 1.2rem + 3vw, 2.2rem); line-height: 1.15; letter-spacing: -0.01em; margin: var(--s4) 0 var(--s5); text-wrap: balance; }

.setup { min-height: 82dvh; display: grid; grid-template-rows: auto 1fr auto; gap: var(--s5); padding-top: var(--s4); }
.dots { display: flex; gap: 6px; } .dots i { flex: 1; height: 3px; border-radius: 3px; background: var(--line); transition: background 400ms var(--ease-out-quart); } .dots i.on { background: var(--accent); }
.setup-nav { display: grid; gap: var(--s3); }
.steps { padding-left: 1.2em; } .steps li { padding: 4px 0; }
.linkish { background: none; border: 0; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; min-height: 44px; cursor: pointer; }

.ring .grab { fill: none; stroke: transparent; stroke-width: 56; pointer-events: stroke; touch-action: none; cursor: grab; }
.ring.scrubbing .grab { cursor: grabbing; }
.ring .bead { transition: cx 160ms var(--ease-out-quart), cy 160ms var(--ease-out-quart); }
.ring.scrubbing .bead { transition: none; }
.ring .center { pointer-events: none; }
.ring .center .when { margin-top: 4px; font-size: 0.8rem; color: var(--ink-2); min-height: 1.2em; }
.ring:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; border-radius: 50%; }

/* Cute pass: softer letterforms, rosier light, rounder shapes */
:root { --accent: oklch(0.8 0.1 12); --accent-soft: oklch(0.8 0.1 12 / 0.16); --r: 28px; }
h1, h2, .display, .ring .center .num, .reading .headline, .pop-text, .letter-text, .pull .words p { font-variation-settings: "SOFT" 100, "WONK" 1; }
body { background: radial-gradient(120% 70% at 80% -10%, oklch(0.3 0.05 10 / 0.75), transparent 60%), radial-gradient(90% 50% at 0% 100%, oklch(0.26 0.04 330 / 0.5), transparent 60%), var(--bg); }
.ring .bead { r: 8; }
.ring::before { content: ""; position: absolute; inset: -6%; pointer-events: none; opacity: 0.8;
  background-image: radial-gradient(1.5px 1.5px at 12% 18%, oklch(0.97 0.02 60) 50%, transparent 51%), radial-gradient(1px 1px at 86% 12%, oklch(0.97 0.02 60) 50%, transparent 51%), radial-gradient(1.5px 1.5px at 92% 70%, oklch(0.97 0.02 60) 50%, transparent 51%), radial-gradient(1px 1px at 6% 82%, oklch(0.97 0.02 60) 50%, transparent 51%), radial-gradient(1px 1px at 50% 2%, oklch(0.97 0.02 60) 50%, transparent 51%);
  animation: twinkle 3.6s var(--ease-in-out-cubic) infinite alternate; }
@keyframes twinkle { from { opacity: 0.35; } to { opacity: 0.9; } }
.topright { display: grid; justify-items: end; gap: var(--s2); }
.mailbox { position: relative; width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; cursor: pointer; color: var(--ink);
  background: oklch(0.24 0.02 20 / 0.8); border: 1px solid var(--line); box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.07), var(--shadow-lg); transition: transform 180ms var(--ease-out-quart); }
.mailbox:active { transform: scale(0.94); }
.mailbox svg { width: 24px; height: 24px; }
.mailbox .badge { position: absolute; top: 9px; right: 9px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px oklch(0.24 0.02 20), 0 0 12px var(--accent); animation: bob 1.8s var(--ease-in-out-cubic) infinite alternate; }
@keyframes bob { from { transform: translateY(0); } to { transform: translateY(-2px); } }
.letter { padding: var(--s4) 0; border-top: 1px solid var(--line); }
.letter-text { font-family: var(--font-display); font-style: italic; font-size: 1.3rem; line-height: 1.25; margin-top: 4px; }
.letter.newest .letter-text { font-size: 1.6rem; color: var(--ink); }
