/*
  Tidepool: mood journal app (Screenery template)
  The page is a grainy, dreamy gradient field whose four colours (--c0..--c3) are set by today's mood.
  Text sits on frosted sheets solid enough for AA, or on the open field behind a soft adaptive veil.
  The phone holds the working app: mood plane, tags, entry, calendar of gradient orbs, patterns.

  Contents
   1. Tokens (palette, mood anchors, type, space, radius, motion)
   2. Base and browser surfaces
   3. The field and the grain
   4. Components: buttons, segmented control, checkbox, alerts, icons, veil
   5. Header
   6. Hero and the device frame
   7. App: status bar, panels, mood plane, tags, entry, saved
   8. App: month calendar, day detail, streak, export
   9. App: patterns
  10. Page sheets: why, privacy, poster
  11. Pricing, download, questions, footer, dialog, toast
  12. Motion and reduced motion
  13. Narrow screens
*/

/* ---------- 1. Tokens ---------- */
/* Registered so the field can ease from one mood to the next */
@property --c0 { syntax: '<color>'; inherits: true; initial-value: #e3ece6; }
@property --c1 { syntax: '<color>'; inherits: true; initial-value: #9fd3c1; }
@property --c2 { syntax: '<color>'; inherits: true; initial-value: #b4a9e2; }
@property --c3 { syntax: '<color>'; inherits: true; initial-value: #f4cdb8; }

:root {
  /* Today's mood field. JS writes these; the defaults are a calm evening. */
  --c0: #e3ece6;
  --c1: #9fd3c1;
  --c2: #b4a9e2;
  --c3: #f4cdb8;

  /* Ink and paper */
  --ink: #1b1f3b;          /* body text, primary buttons */
  --ink-2: #454a6b;        /* secondary text on paper and frost */
  --ink-3: #5e6384;        /* tertiary, still 4.5:1 on frost */
  --paper: #fbf7f2;
  --frost: rgb(251 247 242 / .87);
  --frost-strong: rgb(251 247 242 / .94);
  --line: rgb(27 31 59 / .14);
  --line-strong: rgb(27 31 59 / .28);
  --wash: rgb(27 31 59 / .06);
  --danger: #a3263f;
  --danger-wash: #fbe9ec;
  --ok: #24614f;

  /* Ink on the open field: JS flips these when the field turns dusky */
  --on-field: var(--ink);
  --on-field-2: #2c3152;
  --on-field-inv: var(--paper);
  --veil: rgb(251 247 242 / .62);

  /* The four corners of the mood plane (also the anchors the JS blends between) */
  --q-tense: #d2457a;
  --q-energised: #ffa77c;
  --q-low: #4659a0;
  --q-calm: #8fd8c6;

  /* Type */
  --serif: 'DM Serif Display', 'Iowan Old Style', Georgia, serif;
  --sans: 'Wix Madefor Text', system-ui, sans-serif;
  --t-xs: .8125rem;
  --t-s: .9375rem;
  --t-m: 1.0625rem;
  --t-l: 1.25rem;
  --t-h3: 1.5rem;
  --t-h2: clamp(2.1rem, 1.4rem + 2.6vw, 3.6rem);
  --t-h1: clamp(2.9rem, 1.6rem + 4.6vw, 5.6rem);

  /* Space and radius */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 72px; --s-9: 112px;
  --gutter: clamp(16px, 4vw, 40px);
  --r-s: 10px; --r-m: 16px; --r-l: 24px; --r-xl: 36px; --r-pill: 999px;

  /* Depth: soft, offset, tinted toward dusk */
  --shadow-1: 0 2px 6px -2px rgb(27 31 59 / .18), 0 10px 24px -14px rgb(27 31 59 / .3);
  --shadow-2: 0 18px 50px -28px rgb(27 31 59 / .45), 0 4px 14px -8px rgb(27 31 59 / .2);
  --shadow-phone: 0 50px 90px -40px rgb(18 20 44 / .65), 0 18px 40px -20px rgb(18 20 44 / .4);

  /* Motion */
  --ease: cubic-bezier(.16, 1, .3, 1);
  --field-ease: 1.1s;
}

/* ---------- 2. Base and browser surfaces ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  background: var(--c0);
  color: var(--ink);
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
  accent-color: var(--ink);
  scrollbar-color: rgb(27 31 59 / .45) transparent;
  -webkit-text-size-adjust: 100%;
  transition: --c0 var(--field-ease) var(--ease), --c1 var(--field-ease) var(--ease), --c2 var(--field-ease) var(--ease), --c3 var(--field-ease) var(--ease);
}
body {
  margin: 0;
  font-family: var(--sans);
  font-size: var(--t-m);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--ink); color: var(--paper); }
input, textarea, button, select { font: inherit; color: inherit; }
textarea { caret-color: var(--ink); }
img, svg, canvas { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0; font-weight: 400; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .22em; }
a:hover { text-decoration-thickness: 2px; }
strong { font-weight: 600; }
:focus-visible { outline: 2.5px solid var(--ink); outline-offset: 3px; border-radius: 6px; }
main { overflow-x: clip; } /* the veils reach past their text; never past the page */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.skip { position: absolute; left: var(--s-4); top: -60px; z-index: 50; background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: var(--r-pill); }
.skip:focus { top: var(--s-4); }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.placeholder { font-style: italic; font-weight: 400; }

/* ---------- 3. The field and the grain ---------- */
.field {
  position: fixed; inset: 0; z-index: -2; overflow: hidden;
  background:
    radial-gradient(120% 90% at 100% 0%, var(--c3) 0%, transparent 60%),
    radial-gradient(90% 80% at 0% 100%, var(--c2) 0%, transparent 65%),
    var(--c0);
}
.blob {
  position: absolute; width: 78vmax; height: 78vmax; border-radius: 50%;
  background: radial-gradient(closest-side, var(--c1), transparent);
  opacity: .9;
}
.blob--a { left: -18vmax; top: -22vmax; }
.blob--b { right: -26vmax; top: 18vh; background: radial-gradient(closest-side, var(--c2), transparent); opacity: .85; }
.blob--c { left: 18vw; bottom: -40vmax; background: radial-gradient(closest-side, var(--c3), transparent); opacity: .8; }
.grain {
  position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none;
  opacity: .3; mix-blend-mode: overlay;
}

/* ---------- 4. Components ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 48px; padding: 0 22px; border-radius: var(--r-pill); border: 1.5px solid transparent;
  font-weight: 600; font-size: var(--t-s); letter-spacing: .005em; text-decoration: none; cursor: pointer;
  transition: transform .4s var(--ease), background-color .3s, box-shadow .4s var(--ease);
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn--small { min-height: 44px; padding: 0 18px; }
.btn--field { background: var(--on-field); color: var(--on-field-inv); box-shadow: var(--shadow-1); }
.btn--ghost { color: var(--on-field); border-color: currentColor; background: transparent; }
.btn--app, .btn--sheet { background: var(--ink); color: var(--paper); box-shadow: var(--shadow-1); }
.btn--app:hover, .btn--sheet:hover { background: #2a2f55; }
.btn--quiet { background: var(--wash); color: var(--ink); }
.btn--quiet:hover { background: rgb(27 31 59 / .11); }
.btn--danger { background: var(--danger); color: var(--paper); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; }
.btn.is-loading { cursor: progress; }
.btn.is-loading::before {
  content: ''; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
}

/* Segmented control made of radios (wrapped in a fieldset whose legend sits above) */
.segfield { border: 0; padding: 0; margin: 0; min-width: 0; }
.segfield legend { padding: 0 0 6px; font-size: var(--t-xs); font-weight: 600; color: var(--ink-2); }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border: 0; margin: 0; border-radius: var(--r-pill); background: var(--wash); }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border-radius: var(--r-pill); font-size: var(--t-s); font-weight: 600; color: var(--ink-2); transition: background-color .3s, color .3s; }
.seg input:checked + span { background: var(--ink); color: var(--paper); box-shadow: var(--shadow-1); }
.seg input:focus-visible + span { outline: 2.5px solid var(--ink); outline-offset: 2px; }

.check { display: inline-flex; align-items: center; gap: var(--s-2); min-height: 44px; font-size: var(--t-s); font-weight: 500; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 0; }

.alert { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-3) var(--s-4); border-radius: var(--r-m); font-size: var(--t-s); line-height: 1.45; }
.alert--error { background: var(--danger-wash); color: #7a1a2f; border: 1px solid rgb(163 38 63 / .3); }
.alert .icon { margin-top: 1px; }
.fielderr { display: flex; gap: var(--s-2); align-items: flex-start; color: var(--danger); font-size: var(--t-xs); font-weight: 600; line-height: 1.4; margin-top: var(--s-2); }
.fielderr .icon { width: 16px; height: 16px; margin-top: 1px; }
[hidden] { display: none !important; }

/* Soft veil behind text that sits on the open field: it pushes the local background away from the ink */
.veil { position: relative; isolation: isolate; }
.veil::before {
  content: ''; position: absolute; inset: -14% -10%; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side, var(--veil), transparent);
  transition: background .6s;
}

/* ---------- 5. Header ---------- */
.top {
  position: sticky; top: var(--s-3); z-index: 20;
  width: min(1240px, 100% - 2 * var(--gutter)); margin: var(--s-3) auto 0;
  display: flex; align-items: center; gap: var(--s-5);
  padding: 8px 8px 8px 20px; border-radius: var(--r-pill);
  background: var(--frost-strong); box-shadow: var(--shadow-1);
  -webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3);
}
.top .btn--field { background: var(--ink); color: var(--paper); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; min-height: 44px; }
.brand__orb {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 34% 30%, #fff 0, var(--c3) 22%, var(--c1) 58%, var(--q-low) 115%);
  box-shadow: inset 0 -2px 5px rgb(27 31 59 / .25);
}
.brand__name { font-family: var(--serif); font-size: 1.55rem; line-height: 1; letter-spacing: -.01em; }
.nav { display: flex; gap: var(--s-1); margin-left: auto; }
.nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: var(--r-pill); font-size: var(--t-s); font-weight: 500; text-decoration: none; color: var(--ink-2); }
.nav a:hover { background: var(--wash); color: var(--ink); }

/* ---------- 6. Hero and the device frame ---------- */
.hero {
  width: min(1240px, 100% - 2 * var(--gutter)); margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: clamp(32px, 6vw, 96px); align-items: center;
  padding: var(--s-8) 0 var(--s-9);
  color: var(--on-field);
}
.hero__copy { max-width: 36rem; }
.hero__title { font-family: var(--serif); font-size: var(--t-h1); line-height: .98; letter-spacing: -.02em; }
.hero__title span { display: block; color: var(--on-field-2); }
.hero__lede { margin-top: var(--s-5); font-size: var(--t-l); line-height: 1.55; color: var(--on-field-2); max-width: 32rem; }
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-6); }
.hero__note { margin-top: var(--s-5); font-size: var(--t-s); font-weight: 600; color: var(--on-field-2); display: flex; gap: 10px; align-items: center; }
.hero__note::before { content: ''; width: 28px; height: 1.5px; background: currentColor; flex: none; }
.hero .btn--field:focus-visible, .hero .btn--ghost:focus-visible { outline-color: var(--on-field); }

.device { position: relative; }
.device__frame {
  position: relative; width: 392px; padding: 12px; border-radius: 60px;
  background: linear-gradient(145deg, #2a2d48, #111326 60%, #22253f);
  box-shadow: var(--shadow-phone), inset 0 0 0 1.5px rgb(255 255 255 / .12);
}
.device__island { position: absolute; z-index: 6; top: 24px; left: 50%; width: 104px; height: 30px; margin-left: -52px; border-radius: 20px; background: #07080f; }
.device__btn { position: absolute; width: 4px; border-radius: 2px; background: #1b1d33; }
.device__btn--a { left: -3px; top: 150px; height: 34px; }
.device__btn--b { left: -3px; top: 200px; height: 58px; }
.device__btn--c { right: -3px; top: 190px; height: 86px; }

.screen {
  position: relative; height: 800px; border-radius: 48px; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; color: var(--ink);
}
.screen__field {
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(80% 50% at 15% 8%, var(--c1), transparent 70%),
    radial-gradient(90% 60% at 100% 55%, var(--c2), transparent 70%),
    radial-gradient(90% 50% at 10% 100%, var(--c3), transparent 70%),
    var(--c0);
}
.status { position: relative; z-index: 5; flex: none; height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 6px 34px 0 40px; color: var(--on-field); font-weight: 600; font-size: var(--t-s); }
.status__icons { display: flex; gap: 6px; align-items: center; }
.status svg { fill: currentColor; }
.screen__scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 8px 16px 20px; scrollbar-width: thin; }

/* ---------- 7. App: Today ---------- */
.js .panel:not(.is-active) { display: none; }
.apphead { padding: 0 6px var(--s-4); color: var(--on-field); }
.apphead__date { font-size: var(--t-xs); font-weight: 600; color: var(--on-field-2); letter-spacing: .01em; }
.apphead__title { font-family: var(--serif); font-size: 2.15rem; line-height: 1.05; letter-spacing: -.01em; }

.checkin, .saved, .sheet-in {
  background: var(--frost); border-radius: var(--r-l); padding: var(--s-4);
  -webkit-backdrop-filter: blur(16px) saturate(1.25); backdrop-filter: blur(16px) saturate(1.25);
  box-shadow: var(--shadow-1);
}
.sheet-in + .sheet-in { margin-top: var(--s-3); }

.plane-wrap { position: relative; padding: 24px 22px; }
.plane-axis { position: absolute; font-size: .75rem; font-weight: 600; color: var(--ink-2); line-height: 1; white-space: nowrap; }
.plane-axis--top { top: 4px; left: 50%; transform: translateX(-50%); }
.plane-axis--bottom { bottom: 4px; left: 50%; transform: translateX(-50%); }
.plane-axis--left { left: 2px; top: 50%; writing-mode: vertical-rl; transform: translateY(-50%) rotate(180deg); }
.plane-axis--right { right: 2px; top: 50%; writing-mode: vertical-rl; transform: translateY(-50%); }
.plane {
  position: relative; aspect-ratio: 1; border-radius: 26px; touch-action: none; cursor: crosshair;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .35), 0 10px 30px -18px rgb(27 31 59 / .5);
}
.plane__lower, .plane__upper { position: absolute; inset: 0; border-radius: inherit; }
.plane__lower { background: linear-gradient(90deg, var(--q-low), var(--q-calm)); }
.plane__upper {
  background: linear-gradient(90deg, var(--q-tense), var(--q-energised));
  -webkit-mask-image: linear-gradient(#000 0%, #000 8%, transparent 92%); mask-image: linear-gradient(#000 0%, #000 8%, transparent 92%);
}
.plane::after { content: ''; position: absolute; inset: 0; border-radius: inherit; background: radial-gradient(closest-side, rgb(255 255 255 / .3), transparent); pointer-events: none; }
.plane__cross { position: absolute; inset: 10px; pointer-events: none;
  background:
    linear-gradient(rgb(255 255 255 / .7), rgb(255 255 255 / .7)) center / 1px 100% no-repeat,
    linear-gradient(90deg, rgb(255 255 255 / .7), rgb(255 255 255 / .7)) center / 100% 1px no-repeat;
  -webkit-mask-image: repeating-linear-gradient(90deg, #000 0 3px, transparent 3px 7px), repeating-linear-gradient(#000 0 3px, transparent 3px 7px);
  mask-image: repeating-linear-gradient(90deg, #000 0 3px, transparent 3px 7px), repeating-linear-gradient(#000 0 3px, transparent 3px 7px);
  -webkit-mask-composite: source-over; mask-composite: add;
  opacity: .9;
}
.plane__hint {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, calc(-50% + 40px));
  padding: 6px 12px; border-radius: var(--r-pill); background: var(--frost-strong); color: var(--ink);
  font-size: var(--t-xs); font-weight: 600; white-space: nowrap; pointer-events: none; box-shadow: var(--shadow-1);
}
.plane__point {
  --px: 50%; --py: 50%;
  position: absolute; left: var(--px); top: var(--py); width: 44px; height: 44px; margin: -22px 0 0 -22px;
  border-radius: 50%; cursor: grab; touch-action: none; z-index: 2;
}
.plane__point::before {
  content: ''; position: absolute; inset: 7px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, var(--paper) 45%, color-mix(in oklab, var(--c1) 40%, var(--paper)));
  box-shadow: 0 0 0 3px rgb(255 255 255 / .55), 0 6px 16px -4px rgb(20 22 50 / .55);
  transition: transform .4s var(--ease);
}
.plane.is-dragging .plane__point { cursor: grabbing; }
.plane.is-dragging .plane__point::before { transform: scale(1.18); }
.plane__point:focus-visible { outline: none; }
.plane__point:focus-visible::before { box-shadow: 0 0 0 3px var(--ink), 0 0 0 6px var(--paper), 0 6px 16px -4px rgb(20 22 50 / .55); }
.plane:not(.is-placed) .plane__point::before { background: transparent; border: 2px dashed rgb(255 255 255 / .95); box-shadow: 0 0 0 1px rgb(27 31 59 / .2); }

.moodword { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin-top: var(--s-2); padding: 0 6px; }
.moodword strong { font-family: var(--serif); font-weight: 400; font-size: 1.6rem; line-height: 1.1; }
.moodword__dot { width: 12px; height: 12px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, var(--c3), var(--c1)); align-self: center; box-shadow: inset 0 0 0 1px rgb(27 31 59 / .2); }
.moodword span[data-mood-nums] { font-size: var(--t-xs); color: var(--ink-2); font-variant-numeric: tabular-nums; }

.tags { border: 0; padding: 0; margin: var(--s-5) 0 0; min-width: 0; }
.tags legend { display: flex; justify-content: space-between; align-items: baseline; width: 100%; padding: 0 6px; font-weight: 600; font-size: var(--t-s); }
.tags__count { font-size: var(--t-xs); font-weight: 500; color: var(--ink-2); }
.tags__list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--s-3); }
.tag {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: var(--r-pill);
  border: 1px solid var(--line-strong); background: rgb(255 255 255 / .55); font-size: var(--t-xs); font-weight: 600; cursor: pointer;
  transition: background-color .25s, color .25s, border-color .25s;
  position: relative;
}
.tag::after { content: ''; position: absolute; inset: -4px 0; } /* 44px tall touch target */
.tag:hover { border-color: var(--ink); }
.tag[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.tag[aria-pressed="true"] .icon { display: block; }
.tag .icon { width: 14px; height: 14px; display: none; }
.tag[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }

.entry { margin-top: var(--s-5); }
.entry__label { display: block; padding: 0 6px; font-weight: 600; font-size: var(--t-s); }
.entry textarea {
  display: block; width: 100%; margin-top: var(--s-2); padding: 12px 14px; resize: vertical; min-height: 92px;
  border-radius: var(--r-m); border: 1px solid var(--line-strong); background: rgb(255 255 255 / .7); line-height: 1.5; font-size: var(--t-s);
}
.entry textarea::placeholder { color: var(--ink-3); }
.entry textarea:focus-visible { outline: 2.5px solid var(--ink); outline-offset: 1px; }
.entry textarea[aria-invalid="true"] { border-color: var(--danger); }
.entry__meta { display: flex; justify-content: space-between; gap: var(--s-3); margin-top: 6px; padding: 0 6px; font-size: .75rem; color: var(--ink-2); }
.autosave { display: inline-flex; align-items: center; gap: 4px; }
.autosave .icon { width: 14px; height: 14px; }
.autosave.is-saving .icon { opacity: .35; }
.counter { font-variant-numeric: tabular-nums; font-weight: 600; }
.counter.is-near { color: #7a4a12; }
.counter.is-over { color: var(--danger); }

.checkin .alert { margin-top: var(--s-4); }
.checkin > .btn { width: 100%; margin-top: var(--s-4); min-height: 52px; font-size: var(--t-m); }

.saved { text-align: center; padding: var(--s-6) var(--s-5); }
.saved:focus { outline: none; }
.saved__orb {
  display: block; width: 120px; height: 120px; margin: 0 auto var(--s-5); border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #fff 0, var(--c3) 20%, var(--c1) 55%, var(--c2) 100%);
  box-shadow: 0 20px 40px -20px rgb(27 31 59 / .55), inset 0 -6px 14px rgb(27 31 59 / .18);
}
.saved__title { font-family: var(--serif); font-size: 1.65rem; line-height: 1.15; }
.saved__line { margin-top: var(--s-2); font-size: var(--t-s); color: var(--ink-2); }
.saved__care { margin-top: var(--s-4); padding-top: var(--s-3); border-top: 1px solid var(--line); font-size: var(--t-xs); line-height: 1.5; text-align: left; }
.saved__actions { display: grid; gap: var(--s-2); margin-top: var(--s-5); }

/* Tab bar */
.tabbar {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 8px 14px 22px;
  background: var(--frost-strong); border-top: 1px solid var(--line);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
}
.tabbar__tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 52px; padding: 6px 0;
  border: 0; border-radius: var(--r-m); background: transparent; color: var(--ink-2); font-size: .75rem; font-weight: 600; cursor: pointer;
}
.tabbar__tab .icon { width: 22px; height: 22px; }
.tabbar__tab[aria-selected="true"] { color: var(--ink); background: var(--wash); }
.tabbar__tab[aria-selected="true"] .icon { stroke-width: 2; }

/* ---------- 8. App: month ---------- */
.cal__dow, .cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal__dow span { text-align: center; font-size: .75rem; font-weight: 600; color: var(--ink-2); padding-bottom: 4px; }
.cal__noscript { grid-column: 1 / -1; font-size: var(--t-s); color: var(--ink-2); }
.day {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0 2px; min-height: 52px;
  border: 0; background: transparent; border-radius: 12px; cursor: pointer; font-variant-numeric: tabular-nums;
}
.day__orb {
  width: 30px; height: 30px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, rgb(255 255 255 / .9) 0, var(--d3) 22%, var(--d1) 60%, var(--d2) 105%);
  box-shadow: 0 4px 10px -5px rgb(27 31 59 / .6);
  transition: transform .35s var(--ease);
}
.day__num { font-size: .75rem; font-weight: 600; color: var(--ink-2); line-height: 1.2; }
.day:hover .day__orb { transform: scale(1.1); }
.day.is-empty .day__orb { background: transparent; box-shadow: none; border: 1.5px dashed var(--line-strong); }
.day.is-future { cursor: default; }
.day.is-future .day__orb { border-style: dotted; border-color: var(--line); }
.day.is-today .day__num { color: var(--ink); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.day[aria-pressed="true"] { background: var(--wash); }
.day[aria-pressed="true"] .day__num { color: var(--ink); }
.day:focus-visible { outline-offset: 0; }

.daydetail { margin-top: var(--s-3); padding-top: var(--s-3); border-top: 1px solid var(--line); min-height: 96px; font-size: var(--t-s); }
.daydetail__empty { color: var(--ink-2); }
.daydetail__head { display: flex; align-items: center; gap: var(--s-3); }
.daydetail__orb { width: 40px; height: 40px; border-radius: 50%; flex: none; background: radial-gradient(circle at 34% 30%, #fff 0, var(--d3) 22%, var(--d1) 60%, var(--d2) 105%); }
.daydetail__title { font-weight: 600; }
.daydetail__nums { font-size: .75rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.daydetail__tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: var(--s-2); }
.daydetail__tags span { padding: 2px 10px; border-radius: var(--r-pill); background: var(--wash); font-size: .75rem; font-weight: 600; }
.daydetail__note { margin-top: var(--s-2); font-family: var(--serif); font-size: 1.15rem; line-height: 1.35; }

.streak { font-size: var(--t-s); line-height: 1.5; }
.streak span { color: var(--ink-2); }
.exportbox { display: grid; gap: var(--s-3); font-size: var(--t-s); }
.exportbox p:first-child { color: var(--ink-2); }
.exportbox__done, .privacy__done, .poster__done, .download__done { font-size: var(--t-xs); font-weight: 600; color: var(--ok); min-height: 1.2em; }

/* ---------- 9. App: patterns ---------- */
.minihead { font-family: var(--serif); font-size: 1.35rem; line-height: 1.15; }
.minisub { margin-top: 4px; font-size: var(--t-xs); color: var(--ink-2); line-height: 1.5; }
.weeks { display: grid; gap: 10px; margin-top: var(--s-4); }
.week { display: grid; grid-template-columns: 74px 1fr 46px; align-items: center; gap: 8px; font-size: .75rem; font-variant-numeric: tabular-nums; }
.week__label { font-weight: 600; line-height: 1.25; }
.week__label small { display: block; font-weight: 500; color: var(--ink-2); font-size: .6875rem; }
.week__track { position: relative; height: 18px; border-radius: var(--r-pill); background: var(--wash); }
.week__track::before { content: ''; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1.5px; background: var(--line-strong); }
.week__bar { position: absolute; top: 3px; bottom: 3px; border-radius: var(--r-pill); background: linear-gradient(90deg, var(--w2), var(--w1)); box-shadow: inset 0 0 0 1px rgb(27 31 59 / .15); }
.week__val { text-align: right; font-weight: 700; }
.week--none .week__val { color: var(--ink-2); font-weight: 500; }
.weeks__axis { display: grid; grid-template-columns: 74px 1fr 46px; gap: 8px; font-size: .6875rem; color: var(--ink-2); }
.weeks__axis span:nth-child(2) { display: flex; justify-content: space-between; }

.corr { list-style: none; margin: var(--s-4) 0 0; padding: 0; display: grid; gap: var(--s-4); }
.corr li { font-size: var(--t-xs); line-height: 1.45; }
.corr__tag { font-weight: 700; font-size: var(--t-s); }
.corr__bars { display: grid; grid-template-columns: 52px 1fr 40px; gap: 4px 8px; align-items: center; margin-top: 6px; font-variant-numeric: tabular-nums; }
.corr__bars span:nth-child(3n+1) { color: var(--ink-2); font-weight: 600; }
.corr__bars span:nth-child(3n) { text-align: right; font-weight: 600; }
.corr__meter { height: 8px; border-radius: var(--r-pill); background: var(--wash); overflow: hidden; }
.corr__meter i { display: block; height: 100%; border-radius: inherit; background: var(--ink); }
.corr__meter--hard i { background: var(--q-low); }
.corr__line { margin-top: 6px; color: var(--ink-2); }
.corr__line strong { color: var(--ink); }
.corr__note { margin-top: var(--s-4); padding-top: var(--s-3); border-top: 1px solid var(--line); font-size: .75rem; color: var(--ink-2); }
.care p { font-size: var(--t-xs); line-height: 1.5; }
.empty { text-align: center; padding: var(--s-6) var(--s-5); }
.empty__orbs { display: flex; justify-content: center; gap: 10px; margin-bottom: var(--s-4); }
.empty__orbs i { width: 28px; height: 28px; border-radius: 50%; border: 1.5px dashed var(--line-strong); }

/* ---------- 10. Page sheets ---------- */
.sheet {
  width: min(1240px, 100% - 2 * var(--gutter)); margin: 0 auto var(--s-6);
  padding: clamp(28px, 5vw, 72px);
  border-radius: var(--r-xl); background: var(--frost);
  border: 1px solid rgb(255 255 255 / .55);
  box-shadow: var(--shadow-2);
  -webkit-backdrop-filter: blur(28px) saturate(1.3); backdrop-filter: blur(28px) saturate(1.3);
}
.h2 { font-family: var(--serif); font-size: var(--t-h2); line-height: 1.02; letter-spacing: -.015em; }
.lead { margin-top: var(--s-4); font-size: var(--t-l); line-height: 1.55; color: var(--ink-2); max-width: 40rem; }

/* Why it works */
.why__head { max-width: 46rem; }
.why__body { display: grid; grid-template-columns: minmax(220px, 320px) minmax(0, 1fr); gap: clamp(28px, 5vw, 80px); margin-top: var(--s-7); align-items: start; }
.why__fig { margin: 0; }
.why__fig svg { width: 100%; height: auto; filter: drop-shadow(0 18px 30px rgb(27 31 59 / .28)); }
.why__fig-labels rect { fill: var(--paper); fill-opacity: .94; }
.why__fig-labels text { font: 600 12px var(--sans); fill: var(--ink); text-anchor: middle; }
.why__fig figcaption { margin-top: var(--s-3); font-size: var(--t-s); color: var(--ink-2); }
.why__text { display: grid; gap: var(--s-5); max-width: 40rem; }
.why__text strong { display: block; font-family: var(--serif); font-weight: 400; font-size: var(--t-h3); line-height: 1.15; margin-bottom: 4px; }
.why__limit { display: flex; gap: var(--s-3); align-items: flex-start; margin-top: var(--s-2); padding-top: var(--s-5); border-top: 1px solid var(--line-strong); font-size: var(--t-s); line-height: 1.55; }
.why__limit strong { display: inline; font-family: var(--sans); font-weight: 700; font-size: inherit; margin: 0; }
.why__limit .icon { margin-top: 2px; color: var(--danger); }

/* Privacy */
.privacy { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: clamp(28px, 5vw, 72px); align-items: center; }
.facts { margin: var(--s-6) 0 0; display: grid; gap: var(--s-4); }
.facts div { padding-top: var(--s-4); border-top: 1px solid var(--line); }
.facts dt { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.facts dd { margin: 4px 0 0 30px; color: var(--ink-2); font-size: var(--t-s); max-width: 34rem; }
.privacy__actions { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-6); }
.privacy__done { margin-top: var(--s-3); }
.paper {
  margin: 0; padding: var(--s-5) var(--s-5) var(--s-6); border-radius: 6px; background: #fffdf9; color: var(--ink);
  box-shadow: 0 30px 60px -30px rgb(27 31 59 / .55), 0 2px 6px rgb(27 31 59 / .1);
  transform: rotate(1.4deg);
  background-image: repeating-linear-gradient(transparent 0 27px, rgb(75 90 147 / .14) 27px 28px);
  background-position: 0 58px;
}
.paper figcaption { font-size: var(--t-xs); font-weight: 600; color: var(--ink-2); padding-bottom: var(--s-3); border-bottom: 1px solid var(--line); margin-bottom: var(--s-3); }
.paper__text { margin: 0; font-family: var(--sans); font-size: .875rem; line-height: 28px; white-space: pre-wrap; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; max-height: 392px; overflow: hidden; }

/* Poster */
.poster { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 440px); gap: clamp(28px, 5vw, 80px); align-items: center; }
.poster__opts { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s-4); margin-top: var(--s-6); }
.poster__opts .seg { flex-wrap: nowrap; }
.poster__opts .check { min-height: 48px; }
.poster__done { flex-basis: 100%; }
.poster__frame { position: relative; aspect-ratio: 4 / 5; border-radius: var(--r-l); overflow: hidden; box-shadow: 0 40px 80px -40px rgb(27 31 59 / .7), 0 4px 12px rgb(27 31 59 / .15); }
.poster__fallback {
  position: absolute; inset: 0; display: flex; align-items: flex-end; padding: 8%;
  background:
    radial-gradient(60% 40% at 20% 20%, #a9d8cf, transparent 70%),
    radial-gradient(60% 40% at 80% 35%, #ffb08a, transparent 70%),
    radial-gradient(60% 40% at 30% 70%, #4b5a93, transparent 70%),
    radial-gradient(60% 40% at 80% 85%, #c8c3ee, transparent 70%),
    #e8dfe8;
  font-family: var(--serif); font-size: clamp(2.5rem, 6vw, 4rem); color: var(--ink);
}
.poster__canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

/* ---------- 11. Pricing, download, questions, footer ---------- */
.pricing { width: min(1240px, 100% - 2 * var(--gutter)); margin: 0 auto var(--s-6); padding: var(--s-8) 0 var(--s-4); color: var(--on-field); }
.pricing__head { max-width: 46rem; margin: 0 auto; text-align: center; }
.pricing__head .lead { color: var(--on-field-2); margin-inline: auto; }
.pricing .seg--bill { margin-top: var(--s-5); background: var(--frost-strong); box-shadow: var(--shadow-1); }
.pricing .seg--bill span { color: var(--ink-2); }
.pricing .seg--bill input:checked + span { color: var(--paper); }
.plans { display: grid; grid-template-columns: repeat(2, minmax(0, 420px)); justify-content: center; gap: var(--s-5); margin-top: var(--s-7); color: var(--ink); }
.plan {
  display: flex; flex-direction: column; padding: var(--s-6); border-radius: var(--r-xl); background: var(--frost); box-shadow: var(--shadow-2);
  border: 1px solid rgb(255 255 255 / .55);
  -webkit-backdrop-filter: blur(24px) saturate(1.3); backdrop-filter: blur(24px) saturate(1.3);
}
.plan--deep { background: rgb(27 31 59 / .9); color: var(--paper); border-color: rgb(255 255 255 / .12); }
.plan__name { font-family: var(--serif); font-size: 1.85rem; line-height: 1.1; }
.plan__price { display: flex; align-items: baseline; gap: 8px; margin-top: var(--s-4); }
.plan__num { font-family: var(--serif); font-size: 3.4rem; line-height: 1; font-variant-numeric: tabular-nums; }
.plan__per { font-weight: 600; font-size: var(--t-s); }
.plan__sub { margin-top: 6px; font-size: var(--t-s); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.plan--deep .plan__sub { color: #d6d3e4; }
.plan__list { list-style: none; padding: 0; margin: var(--s-5) 0 var(--s-6); display: grid; gap: var(--s-3); font-size: var(--t-s); }
.plan__list li { display: flex; gap: 10px; align-items: flex-start; }
.plan__list .icon { width: 18px; height: 18px; margin-top: 2px; }
.plan .btn { margin-top: auto; }
.plan--deep .btn--sheet { background: var(--paper); color: var(--ink); }
.plan--deep .btn--sheet:focus-visible { outline-color: var(--paper); }
.pricing__fine { margin: var(--s-5) auto 0; max-width: 40rem; text-align: center; font-size: var(--t-s); font-weight: 600; color: var(--on-field-2); }

.download { width: min(900px, 100% - 2 * var(--gutter)); margin: 0 auto; padding: var(--s-9) 0; text-align: center; color: var(--on-field); }
.download__title { font-size: clamp(2.4rem, 1.4rem + 3.6vw, 4.4rem); }
.download__lede { margin-top: var(--s-4); font-size: 1.2rem; font-weight: 600; color: var(--on-field-2); }
.download__btns { display: flex; justify-content: center; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-6); }
.store {
  display: inline-flex; align-items: center; gap: 12px; min-height: 60px; padding: 0 24px 0 18px; border-radius: 18px; border: 0; cursor: pointer;
  background: var(--on-field); color: var(--on-field-inv); text-align: left; font-weight: 700; font-size: 1.15rem; line-height: 1.1; box-shadow: var(--shadow-2);
  transition: transform .4s var(--ease);
}
.store:hover { transform: translateY(-2px); }
.store small { display: block; font-size: .75rem; font-weight: 500; opacity: .9; }
.store .icon { width: 26px; height: 26px; }
.store:focus-visible { outline-color: var(--on-field); }
.download__done { margin-top: var(--s-3); color: var(--on-field); }

.faq { max-width: 960px; }
.faq__list { margin-top: var(--s-6); border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  display: flex; justify-content: space-between; align-items: center; gap: var(--s-4); min-height: 64px; padding: var(--s-3) 0;
  font-weight: 600; font-size: var(--t-l); cursor: pointer; list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary .icon { transition: transform .4s var(--ease); }
.faq details[open] summary .icon { transform: rotate(180deg); }
.faq details p { padding: 0 0 var(--s-5); max-width: 62ch; color: var(--ink-2); }

.foot {
  width: min(1240px, 100% - 2 * var(--gutter)); margin: 0 auto var(--s-5);
  display: grid; grid-template-columns: 1.2fr 1fr auto; gap: var(--s-5); align-items: center;
  padding: var(--s-5) var(--s-6); border-radius: var(--r-xl); background: var(--frost-strong); font-size: var(--t-s); box-shadow: var(--shadow-1);
}
.foot__brand { display: flex; gap: var(--s-3); align-items: flex-start; color: var(--ink-2); }
.foot__brand strong { color: var(--ink); }
.foot__help { display: flex; gap: 10px; align-items: flex-start; color: var(--ink-2); }
.foot__help .icon { color: var(--danger); margin-top: 2px; }
.foot__help strong { color: var(--ink); white-space: nowrap; }
.foot__nav { display: flex; flex-wrap: wrap; gap: 0 var(--s-2); }
.foot__nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 6px; font-weight: 600; }

.dlg {
  border: 0; padding: var(--s-6); border-radius: var(--r-xl); max-width: min(440px, 100% - 32px); background: var(--paper); color: var(--ink);
  box-shadow: 0 40px 80px -30px rgb(18 20 44 / .7);
}
.dlg::backdrop { background: rgb(27 31 59 / .45); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.dlg__title { font-family: var(--serif); font-size: 1.8rem; line-height: 1.1; }
.dlg p { margin-top: var(--s-3); color: var(--ink-2); font-size: var(--t-s); }
.dlg__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s-2); margin-top: var(--s-5); }

.toast {
  position: fixed; z-index: 60; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: min(460px, 100% - 32px);
  padding: 12px 18px; border-radius: var(--r-m); background: var(--ink); color: var(--paper); font-size: var(--t-s); font-weight: 500; box-shadow: var(--shadow-2);
}

/* ---------- 12. Motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .blob--a { animation: drift-a 38s ease-in-out infinite alternate; }
  .blob--b { animation: drift-b 46s ease-in-out infinite alternate; }
  .blob--c { animation: drift-c 52s ease-in-out infinite alternate; }
  .btn.is-loading::before { animation: spin .8s linear infinite; }
  .saved:not([hidden]) .saved__orb { animation: rise .9s var(--ease) both; }
  .toast:not([hidden]) { animation: toast-in .5s var(--ease) both; }
  /* Sheets lift into place as they arrive, from an already-visible default */
  @supports (animation-timeline: view()) {
    .sheet, .plan { animation: settle linear both; animation-timeline: view(); animation-range: entry 0% entry 20%; }
  }
}
@keyframes drift-a { to { transform: translate(14vmax, 10vmax) scale(1.12); } }
@keyframes drift-b { to { transform: translate(-12vmax, -8vmax) scale(.92); } }
@keyframes drift-c { to { transform: translate(-10vmax, -6vmax) scale(1.1); } }
@keyframes spin { to { transform: rotate(1turn); } }
@keyframes rise { from { transform: scale(.6); filter: blur(10px); opacity: .4; } }
@keyframes toast-in { from { transform: translate(-50%, 12px); opacity: 0; } }
@keyframes settle { from { transform: translateY(16px); } }

@media (prefers-reduced-motion: reduce) {
  html { transition: none; scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0s !important; animation: none !important; }
}

/* ---------- 13. Narrow screens ---------- */
@media (max-width: 1100px) {
  .nav a:nth-child(n+5) { display: none; }
}
@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; justify-items: center; padding-top: var(--s-7); }
  .hero__copy { max-width: 40rem; text-align: center; }
  .hero__lede { margin-inline: auto; }
  .hero__actions { justify-content: center; }
  .hero__note { justify-content: center; }
  .why__body, .privacy, .poster { grid-template-columns: 1fr; }
  .why__fig { max-width: 300px; }
  .poster__frame { max-width: 440px; width: 100%; justify-self: center; }
  .foot { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .nav { display: none; }
  .top { justify-content: space-between; }
  .hero { padding: var(--s-6) 0 var(--s-7); gap: var(--s-6); }
  .hero__copy, .hero__note { text-align: left; justify-content: flex-start; }
  .hero__actions { justify-content: flex-start; }
  .hero__note { display: none; }
  /* The app goes full width: no bezel, the page is the phone */
  .device { width: 100%; }
  .device__frame { width: 100%; padding: 0; background: none; box-shadow: none; border-radius: 0; }
  .device__island, .device__btn, .status { display: none; }
  .screen { height: auto; border-radius: var(--r-xl); overflow: clip; box-shadow: var(--shadow-2); }
  .screen__scroll { overflow: visible; padding: var(--s-5) 12px var(--s-4); }
  .tabbar { position: sticky; bottom: 0; z-index: 4; padding-bottom: 10px; border-radius: 0 0 var(--r-xl) var(--r-xl); }
  .plans { grid-template-columns: 1fr; }
  .sheet { border-radius: var(--r-l); }
  .why__fig { max-width: 240px; }
  .paper { transform: none; }
  .poster__opts { align-items: stretch; flex-direction: column; }
  .poster__opts .btn { width: 100%; }
  .download { padding: var(--s-8) 0; }
  .faq summary { font-size: var(--t-m); }
  .foot { padding: var(--s-5); }
}
