/* =========================================================
   Liflib — warm personal diary
   ========================================================= */
:root {
  --bg: #faf3ea;
  --bg-2: #f4e8d8;
  --card: #fffbf6;
  --ink: #3a2a20;
  --ink-2: #6b5646;
  --muted: #9a8574;
  --line: #ecdcc8;
  --accent: #8b5a3c;
  --accent-2: #a8714c;
  --accent-soft: #f3e2cf;
  --paper: #fffaf0;
  --rule: rgba(112, 142, 182, .26);
  --margin: rgba(214, 110, 96, .42);
  --hand: "Kalam", "Segoe Print", cursive;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(90, 60, 30, .06), 0 10px 30px -14px rgba(90, 60, 30, .22);
  --lh: 34px; /* ruled line height */
  --lines: 20; /* lines per diary sheet */
}
@media (max-height: 900px), (max-width: 640px) { :root { --lh: 29px; } }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
  line-height: 1.5;
}
body.no-scroll { overflow: hidden; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.hand { font-family: var(--hand); }

.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.sm { width: 16px; height: 16px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  border: 0; border-radius: 14px; padding: 11px 18px;
  font-weight: 600; transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-lg { padding: 14px 22px; font-size: 1.02rem; }
.btn-primary {
  background: linear-gradient(180deg, #9a6545, #7f4f33);
  color: #fff8ef;
  box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, 0 8px 18px -8px rgba(110, 60, 30, .6);
}
.btn-primary:hover { background: linear-gradient(180deg, #a56e4c, #87553a); }
.btn-soft { background: rgba(255, 251, 246, .92); color: var(--ink); box-shadow: 0 1px 2px rgba(90,60,30,.08), 0 6px 16px -10px rgba(90,60,30,.3); }
.btn-soft:hover { background: #fff; }
.link-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: none; border: 0; padding: 6px 4px; color: var(--ink-2); font-weight: 600;
}
.link-btn:hover { color: var(--accent); }
:focus-visible { outline: 2.5px solid #d39a62; outline-offset: 2px; border-radius: 10px; }

/* ---------- Brand ---------- */
/* wordmark: lowercase "liflib", clean sans — no icon next to it */
.brand {
  font-family: "Segoe UI", "Nunito Sans", system-ui, -apple-system, sans-serif;
  font-size: 2.3rem; font-weight: 500; letter-spacing: -.01em; line-height: 1; color: #1f1a17;
}
.brand-tag { margin: 6px 0 0; color: var(--ink-2); font-size: .9rem; }

.avatar {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #e9c9a5, #c99368); color: #fff; font-weight: 700; font-family: var(--serif);
}
.avatar-lg { width: 52px; height: 52px; font-size: 1.3rem; box-shadow: 0 0 0 4px #fff, var(--shadow); }

/* =========================================================
   LOGIN
   ========================================================= */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 48px 32px;
  background: radial-gradient(900px 600px at 70% 45%, #f6dcbf 0%, transparent 60%), var(--bg);
}
.login-inner {
  width: min(1040px, 100%); display: grid; grid-template-columns: minmax(320px, 400px) 1fr;
  gap: clamp(40px, 8vw, 110px); align-items: center;
}
.login-panel { display: flex; flex-direction: column; gap: 0; }
.login-form { margin-top: 44px; display: flex; flex-direction: column; gap: 16px; width: 100%; }
.login-form h1 { font-size: clamp(1.9rem, 2.6vw, 2.3rem); line-height: 1.15; text-wrap: balance; }
.login-form .muted { margin: -8px 0 8px; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .92rem; color: var(--ink-2); }
.field input {
  border: 1.5px solid var(--line); background: #fffdf9; border-radius: 12px; padding: 13px 14px; font-size: 1.05rem;
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus { outline: none; border-color: #d3a77f; box-shadow: 0 0 0 4px rgba(211, 167, 127, .2); }
.form-error { min-height: 1.2em; margin: -4px 0; color: #b4533a; font-size: .9rem; }
.login-form .btn { justify-content: center; margin-top: 4px; }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.login-art { display: grid; place-items: center; align-content: center; gap: 32px; perspective: 1600px; }
.login-quote { font-family: var(--hand); font-size: 1.35rem; color: var(--ink-2); margin: 0; }
.desk-book { position: relative; width: 300px; height: 400px; transform: rotate(-4deg); transform-style: preserve-3d; --w: 300px; }
.desk-pages {
  position: absolute; inset: 6px -8px -6px 6px; border-radius: 4px 12px 12px 4px;
  background: repeating-linear-gradient(90deg, #f6ecdc 0 2px, #e9dbc4 2px 3px);
  box-shadow: 0 30px 50px -20px rgba(80, 45, 20, .45);
}
.desk-cover { position: absolute; inset: 0; transform-origin: left center; backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: transform 1s cubic-bezier(.6, .05, .3, 1); }
.desk-book.open .desk-cover { transform: rotateY(-150deg); }
.desk-book .c-title { font-size: calc(var(--w) * .12); padding-right: 14%; }
.desk-book .c-sub { padding-right: 14%; }

/* Leather cover shared by login + animation */
.cover-face {
  background:
    radial-gradient(120% 90% at 30% 15%, rgba(255, 220, 180, .16), transparent 55%),
    radial-gradient(100% 100% at 50% 50%, var(--c1, #8e5a3c) 0%, var(--c2, #5a3320) 100%);
  border-radius: 4px 14px 14px 4px;
  box-shadow: inset 8px 0 12px -6px rgba(0, 0, 0, .5), inset -1px 0 0 rgba(255, 255, 255, .08), 0 20px 40px -18px rgba(60, 30, 10, .6);
  color: var(--cink, #f3dcb8); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; overflow: hidden;
}
.cover-face::before {
  content: ""; position: absolute; inset: 14px 14px 14px 24px;
  border: 1.5px dashed rgba(243, 220, 184, .4); border-radius: 4px 10px 10px 4px;
}
.cover-face .band { position: absolute; top: 0; bottom: 0; right: 16%; width: 9px; background: linear-gradient(90deg, #2e1b10, #4a2e1e 50%, #2e1b10); box-shadow: 0 0 6px rgba(0,0,0,.35); }
.cover-face .c-title { font-family: var(--serif); font-size: calc(var(--w, 300px) * .16); letter-spacing: .02em; text-shadow: 0 1px 0 rgba(0, 0, 0, .4), 0 -1px 0 rgba(255, 255, 255, .1); }
.cover-face .c-sub { font-family: var(--hand); font-size: calc(var(--w, 300px) * .07); opacity: .9; margin-top: 2px; }
.cover-face .c-year { position: absolute; bottom: 9%; font-family: var(--serif); font-size: calc(var(--w, 300px) * .05); letter-spacing: .3em; opacity: .65; }

/* =========================================================
   APP LAYOUT
   ========================================================= */
.app { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 32px 18px 0; display: flex; flex-direction: column;
  background: linear-gradient(180deg, #fbf5ee, #f6ebdd); border-right: 1px solid var(--line); overflow: hidden;
}
.sidebar .brand { padding-left: 16px; font-size: 2.1rem; }
.sidebar .brand-tag { margin-left: 16px; }
.nav { margin-top: 36px; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 14px; padding: 12px 16px; border: 0; border-radius: 14px; background: none;
  font-size: 1.02rem; font-weight: 600; color: var(--ink-2); text-align: left; transition: background .2s, color .2s;
}
.nav-item:hover { background: rgba(232, 208, 180, .35); color: var(--ink); }
.nav-item.active { background: linear-gradient(90deg, #f1dcc3, #f7ead9); color: var(--ink); }
.nav-item.active .ic { color: var(--accent); }
.nav-item.small { font-size: .92rem; padding: 10px 16px; }
.sidebar-foot { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.me { display: flex; align-items: center; gap: 10px; padding: 0 16px 8px; font-weight: 600; }
.shelf { margin-top: 14px; width: 100%; max-width: 220px; opacity: .85; display: block; }

/* "Coming soon" teaser at the bottom of the sidebar */
.soon-card {
  margin-top: auto; position: relative; padding: 16px 16px 14px; border-radius: 16px;
  background: linear-gradient(150deg, #fffaf3, #f6e6d3);
  border: 1px solid #ecdac4; box-shadow: 0 8px 20px -14px rgba(90, 60, 30, .35);
}
.soon-badge {
  position: absolute; top: -10px; right: 14px; padding: 3px 10px; border-radius: 99px;
  background: var(--accent); color: #fff8ef; font-size: .7rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  box-shadow: 0 4px 10px -4px rgba(110, 60, 30, .6);
}
.soon-head { display: flex; align-items: center; gap: 10px; }
.soon-title { margin: 0; font-family: var(--serif); font-size: 1.05rem; font-weight: 600; color: var(--ink); }
.soon-text { display: block; margin: 8px 0 0; font-size: .86rem; line-height: 1.45; color: var(--ink-2); }
/* a mic with soft sound rings */
.soon-mic {
  position: relative; flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: #f3dcc0; color: var(--accent);
}
.soon-mic .ic { width: 18px; height: 18px; position: relative; z-index: 1; }
.soon-mic i { position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid rgba(139, 90, 60, .35); animation: soonRing 2.4s ease-out infinite; }
.soon-mic i:nth-of-type(2) { animation-delay: .8s; }
.soon-mic i:nth-of-type(3) { animation-delay: 1.6s; }
@keyframes soonRing { from { transform: scale(1); opacity: .9; } to { transform: scale(1.9); opacity: 0; } }
@media (max-height: 700px) { .soon-text { display: none; } }

.main { padding: 34px 40px 60px; max-width: 1180px; width: 100%; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 26px; }
.topbar h1 { font-size: clamp(1.8rem, 3vw, 2.5rem); }
.topbar p { margin: 4px 0 0; font-size: 1.05rem; color: var(--ink-2); }

.top-right { position: relative; display: flex; align-items: center; gap: 14px; }
button.avatar { border: 0; padding: 0; }
.sync-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 99px;
  background: rgba(255, 251, 246, .9); border: 1px solid var(--line); font-size: .82rem; font-weight: 600; color: var(--ink-2); white-space: nowrap;
}
.sync-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: #c9b8a4; }
.sync-chip[data-state="ok"] .dot { background: #7fae6e; }
.sync-chip[data-state="syncing"] .dot { background: #d9a54f; animation: pulse 1s ease-in-out infinite; }
.sync-chip[data-state="offline"] .dot, .sync-chip[data-state="error"] .dot { background: #d27d5f; }
@keyframes pulse { 50% { opacity: .3; } }
.account-pop {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 30; min-width: 230px; padding: 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 18px 40px -16px rgba(90, 60, 30, .4);
}
.account-pop p { margin: 0; }
.ap-name { font-family: var(--serif); font-weight: 600; font-size: 1.1rem; }
.ap-email { font-size: .88rem; margin-bottom: 12px !important; word-break: break-all; }
.account-pop .btn { width: 100%; justify-content: center; }
.switch-mode { margin: 0; text-align: center; color: var(--ink-2); font-size: .95rem; }
.switch-mode .link-btn { color: var(--accent); }

/* ---------- Cover colours ---------- */
.cv-leather { --c1: #8e5a3c; --c2: #5a3320; --cink: #f3dcb8; --rib: #c35b49; }
.cv-cream   { --c1: #f5ead7; --c2: #e0cdac; --cink: #3a2a20; --rib: #a2483a; }
.cv-sage    { --c1: #bcc7a4; --c2: #94a07c; --cink: #2c3524; --rib: #4f6b45; }
.cv-rose    { --c1: #ebbcaf; --c2: #cf9585; --cink: #4a2a24; --rib: #9c4a3c; }
.cv-sky     { --c1: #c3d4e1; --c2: #95adc2; --cink: #22384a; --rib: #3d5c78; }
.cover-face .c-motif { width: 34%; margin-top: 8%; opacity: .75; }
.cover-face .c-motif svg { width: 100%; height: auto; display: block; }
[class*="cv-"]:not(.cv-leather) .band { display: none; }
.ba-cover .c-title { font-size: calc(var(--w) * .12); line-height: 1.15; padding: 0 12% 0 16%; overflow-wrap: break-word; }
.ba-cover .c-sub:empty { display: none; }

/* ---------- Hero ---------- */
.hero {
  position: relative; border-radius: 26px; overflow: hidden; min-height: 250px;
  box-shadow: var(--shadow); display: flex; align-items: center;
}
.hero-art {
  position: absolute; inset: 0 0 0 30%; width: 70%; height: 100%;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 32%);
          mask-image: linear-gradient(90deg, transparent 0%, #000 32%);
}
.hero-text { position: relative; z-index: 1; padding: 40px 44px; max-width: 600px; }
.hero-text::before {
  content: ""; position: absolute; inset: -40px -80px -40px -60px; z-index: -1; pointer-events: none;
  background: radial-gradient(120% 100% at 0% 50%, var(--tint-1) 38%, transparent 78%);
  transition: background 1.2s ease;
}
.hero-text h2 { font-size: clamp(1.8rem, 3vw, 2.4rem); }
.hero-text p { margin: 8px 0 24px; font-size: 1.08rem; color: var(--ink-2); max-width: 400px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- Grid ---------- */
.grid { display: grid; grid-template-columns: 1fr 340px; gap: 28px; margin-top: 32px; align-items: start; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.section-head h3, .card-head h3 { font-size: 1.4rem; }

.entry-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.entry {
  width: 100%; display: flex; align-items: center; gap: 18px; padding: 14px; text-align: left;
  background: var(--card); border: 1px solid #f1e4d3; border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease;
}
.entry:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(90,60,30,.06), 0 16px 34px -16px rgba(90,60,30,.3); }
.date-chip {
  flex: none; width: 62px; padding: 8px 0; border-radius: 12px; background: #f7ecdf;
  display: flex; flex-direction: column; align-items: center; line-height: 1.15; color: var(--ink-2); font-size: .82rem;
}
.date-chip b { font-family: var(--serif); font-size: 1.6rem; color: var(--ink); font-weight: 600; }
.entry-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.entry-title { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; }
.entry-snippet { color: var(--ink-2); font-size: .93rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.entry-thumb { flex: none; width: 110px; height: 78px; object-fit: cover; border-radius: 12px; }

.empty-state {
  padding: 34px 28px; text-align: center; border: 2px dashed #ead8c2; border-radius: var(--radius); background: rgba(255,251,246,.6);
}
.empty-state p { margin: 6px 0 18px; color: var(--ink-2); }
.empty-state .hand { font-size: 1.6rem; color: var(--accent); }

.side-cards { display: flex; flex-direction: column; gap: 18px; }
.card { background: var(--card); border: 1px solid #f1e4d3; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.card-head h3 { font-size: 1.2rem; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: #fbf3e9; border-radius: 14px; padding: 12px 6px; text-align: center; display: flex; flex-direction: column; }
.stat b { font-family: var(--serif); font-size: 1.6rem; font-weight: 600; }
.stat span { font-size: .8rem; color: var(--ink-2); }

.memory {
  background: linear-gradient(140deg, #f6e1c9, #efd0ae); border: 0; position: relative; overflow: hidden;
}
.memory h3 { font-size: 1.2rem; }
.memory .kicker { font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 700; color: var(--accent); }
.memory .quote { font-family: var(--hand); font-size: 1.15rem; line-height: 1.45; margin: 10px 0 14px; color: var(--ink); }
.memory .btn { font-size: .92rem; padding: 9px 14px; }

.bottom-nav { display: none; }

/* ---------- My Library shelf ---------- */
.library { margin-top: 34px; }
.library .section-head { align-items: center; margin-bottom: 8px; }
.library .section-head h3 { font-size: 1.7rem; }
.bookshelf { position: relative; padding: 8px 0 0; display: flex; flex-direction: column; gap: 46px; }
.shelf-books {
  position: relative; z-index: 1; display: flex; align-items: flex-end; gap: var(--shelf-gap, 28px);
  padding: 16px var(--shelf-pad, 24px) 0;
}
.shelf-plank {
  position: relative; height: 26px; margin-top: -2px; border-radius: 6px;
  background: linear-gradient(180deg, #e9c9a0 0%, #d8aa78 45%, #c48f5c 100%);
  box-shadow: 0 2px 0 #b07c4c, 0 22px 30px -16px rgba(90, 55, 25, .55);
}
.shelf-plank::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px; border-radius: 6px 6px 0 0; background: rgba(255, 240, 215, .55); }

.shelf-book {
  --w: 150px;
  position: relative; flex: none; width: var(--w); aspect-ratio: 3 / 4.1; border: 0; padding: 0; margin-bottom: 0;
  border-radius: 4px 12px 12px 4px; cursor: pointer;
  transform-origin: bottom center; transition: transform .35s cubic-bezier(.3, 1.4, .5, 1), filter .3s;
  filter: drop-shadow(0 14px 14px rgba(90, 55, 25, .28));
}
.shelf-book .cover-face { position: absolute; inset: 0; padding: 0 16px 0 24px; }
.shelf-book .c-title { font-size: 1.4rem; line-height: 1.12; text-shadow: none; padding: 0 4px; overflow-wrap: break-word; hyphens: auto; }
.shelf-book .c-title.long { font-size: 1.12rem; }
.shelf-book .c-sub { font-size: .95rem; margin-top: 6px; }
.shelf-book .cover-face::after { /* page edge at the bottom */
  content: ""; position: absolute; left: 10px; right: 4px; bottom: 0; height: 5px; background: repeating-linear-gradient(90deg, #f7eedf 0 2px, #e3d4bb 2px 3px); opacity: .8;
}
.shelf-book .ribbon {
  position: absolute; left: 22%; bottom: -30px; width: 13px; height: 34px; z-index: -1;
  background: var(--rib); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
}
.shelf-book .badge {
  position: absolute; top: 10px; right: 12px; z-index: 2; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(255, 252, 246, .85); color: #4a3528; box-shadow: 0 2px 6px rgba(0,0,0,.12);
}
.shelf-book .badge .ic { width: 17px; height: 17px; }
.shelf-book:hover, .shelf-book:focus-visible { transform: translateY(-10px) rotate(-1.5deg); filter: drop-shadow(0 24px 18px rgba(90, 55, 25, .3)); }
.shelf-book:nth-child(even):hover { transform: translateY(-10px) rotate(1.5deg); }

.book-add {
  flex: none; width: 150px; aspect-ratio: 3 / 4.1; border: 2px dashed #d9bf9d; border-radius: 12px; background: rgba(255, 251, 246, .5);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--ink-2); font-weight: 600;
  transition: background .2s, border-color .2s; margin-bottom: 4px;
}
.book-add .ic { width: 34px; height: 34px; stroke-width: 1.4; }
.book-add:hover { background: #fffaf3; border-color: #c99b6d; color: var(--ink); }
.shelf-hint { margin: 18px 4px 0; color: var(--ink-2); font-size: .95rem; }

/* ---------- Settings ---------- */
.settings { display: grid; gap: 18px; max-width: 620px; }
.settings-card h3 { font-size: 1.25rem; }
.settings-card p { margin: 4px 0 14px; }
.small-note { font-size: .9rem; }
.inline-field { display: flex; gap: 10px; }
.inline-field input, .sheet input[type="text"], .sheet input[type="email"], .sheet select {
  flex: 1; min-width: 0; border: 1.5px solid var(--line); background: #fffdf9; border-radius: 12px; padding: 11px 13px; font-size: 1rem;
}
.inline-field input:focus, .sheet input:focus, .sheet select:focus { outline: none; border-color: #d3a77f; box-shadow: 0 0 0 4px rgba(211, 167, 127, .2); }

/* ---------- Dialog sheet ---------- */
.sheet {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px); padding: 0; border: 0; border-radius: 24px;
  background: var(--card); color: var(--ink); box-shadow: 0 40px 80px -30px rgba(40, 20, 5, .6);
}
.sheet::backdrop { background: rgba(47, 32, 25, .45); backdrop-filter: blur(3px); }
.sheet[open] { animation: sheetIn .35s cubic-bezier(.3, 1.3, .5, 1); }
@keyframes sheetIn { from { opacity: 0; transform: translateY(20px) scale(.97); } }
.sheet-inner { padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.sheet-head h2 { font-size: 1.6rem; }
.sheet-head p { margin: 4px 0 0; color: var(--ink-2); }
.icon-btn { flex: none; width: 38px; height: 38px; border-radius: 50%; border: 0; background: #f5eadb; display: grid; place-items: center; }
.icon-btn:hover { background: #efdfca; }
.sheet .field { gap: 8px; }
.sheet-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.sheet .form-error { margin: 0; }

.new-book { display: grid; grid-template-columns: 150px 1fr; gap: 22px; align-items: start; }
.preview-book { position: relative; width: 130px; aspect-ratio: 3 / 4.1; --w: 130px; filter: drop-shadow(0 12px 12px rgba(90, 55, 25, .25)); }
.preview-book .cover-face { position: absolute; inset: 0; padding: 0 10px 0 18px; }
.preview-book .c-title { font-size: 1.15rem; line-height: 1.15; overflow-wrap: break-word; }
.choices { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch, .motif-opt {
  width: 40px; height: 40px; border-radius: 50%; border: 2px solid transparent; padding: 0; position: relative;
  box-shadow: 0 0 0 1px rgba(0,0,0,.08) inset; transition: transform .15s;
}
.swatch { background: linear-gradient(135deg, var(--c1), var(--c2)); }
.swatch[aria-checked="true"], .motif-opt[aria-checked="true"] { border-color: var(--ink); transform: scale(1.08); }
.motif-opt { background: #f7ecdf; color: #6b4a35; display: grid; place-items: center; }
.motif-opt svg { width: 24px; height: 24px; }
.choice-label { font-weight: 600; font-size: .92rem; color: var(--ink-2); margin-bottom: 8px; display: block; }

.member-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow-y: auto; }
.member { display: flex; align-items: center; gap: 12px; padding: 8px 4px; border-bottom: 1px solid #f2e6d6; }
.member:last-child { border-bottom: 0; }
.member .avatar { width: 38px; height: 38px; flex: none; }
.member .who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.member .who b { font-weight: 600; }
.member .who span { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-chip { font-size: .8rem; font-weight: 700; color: var(--accent); background: #f6e7d5; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.member .link-btn { font-size: .85rem; color: #b4533a; }
.invite-row { display: flex; gap: 8px; flex-wrap: wrap; }
.invite-row input { flex: 1 1 200px; }
.invite-row select { flex: 0 0 auto; }
.danger-link { align-self: flex-start; color: #b4533a !important; font-size: .9rem; }
.sheet-note { margin: 0; font-size: .9rem; color: var(--ink-2); background: #fbf2e6; border-radius: 12px; padding: 10px 14px; }

.page-author { font-family: var(--hand); color: #8a6a52; font-size: 1.05rem; margin: -6px 0 6px; }

/* =========================================================
   DIARY OVERLAY
   ========================================================= */
/* a warm wooden desk under a soft lamp */
.diary {
  position: fixed; inset: 0; z-index: 50;
  background-color: #c99c6c;
  background-image:
    radial-gradient(1100px 760px at 50% 18%, rgba(255, 238, 205, .55), transparent 70%),
    radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(90, 52, 24, .32) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='300'%3E%3Cfilter id='w'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.0035 .09' numOctaves='3' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .27 0 0 0 0 .12 0 0 0 -1.1 .62'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23w)'/%3E%3C/svg%3E"),
    repeating-linear-gradient(180deg, transparent 0 238px, rgba(95, 55, 25, .22) 238px 240px, transparent 240px 241px),
    linear-gradient(180deg, #d4aa7b, #c3935f);
  animation: fadeIn .35s ease;
}
.desk-decor { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.desk-mug { position: absolute; width: 150px; top: 120px; left: calc(50% - 560px); transform: rotate(-8deg); filter: drop-shadow(0 6px 8px rgba(70, 40, 15, .25)); }
.desk-pencil { position: absolute; width: 260px; bottom: 90px; right: calc(50% - 640px); transform: rotate(-24deg); filter: drop-shadow(0 4px 4px rgba(70, 40, 15, .25)); }
@media (max-width: 1180px) { .desk-decor { display: none; } }
@keyframes fadeIn { from { opacity: 0; } }

/* ---------- Book opening animation ---------- */
.book-anim {
  position: absolute; inset: 0; display: grid; place-items: center; perspective: 2000px; z-index: 3; pointer-events: none;
  --w: min(300px, 40vw); --h: calc(var(--w) * 1.36);
}
.ba-book { position: relative; width: var(--w); height: var(--h); transform-style: preserve-3d; }
.ba-back, .ba-cover, .ba-leaf { position: absolute; inset: 0; transform-style: preserve-3d; transform-origin: left center; }
.ba-back {
  background: var(--c2, #5a3320); border-radius: 4px 14px 14px 4px;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .6);
}
.ba-page {
  position: absolute; inset: 6px 8px 6px 0; border-radius: 0 8px 8px 0;
  background-color: var(--paper);
  box-shadow: 3px 0 0 #efe2cd, 5px 0 0 #e5d4ba, inset 10px 0 18px -10px rgba(120, 80, 40, .35);
}
.lined {
  background-color: var(--paper);
  background-image: repeating-linear-gradient(180deg, transparent 0 17px, var(--rule) 17px 18px);
  background-position: 0 30px;
}
.ba-page.lined { background-image: repeating-linear-gradient(180deg, transparent 0 17px, var(--rule) 17px 18px); }
.ba-date { position: absolute; top: 12px; left: 18px; right: 12px; font-size: calc(var(--w) * .06); color: #5a4030; }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.face.back { transform: rotateY(180deg); }
.ba-leaf .face { inset: 6px 8px 6px 0; border-radius: 0 8px 8px 0; box-shadow: inset 10px 0 18px -10px rgba(120, 80, 40, .3); }
.ba-leaf .face.back { border-radius: 8px 0 0 8px; box-shadow: inset -10px 0 18px -10px rgba(120, 80, 40, .3); }
.ba-cover .face.front { position: absolute; }
.inside-cover {
  background: #f3e6d1; border-radius: 14px 4px 4px 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  box-shadow: inset 0 0 0 10px var(--c2, #6a3e27), inset 0 0 0 11px rgba(0,0,0,.1);
  color: #6a4a35; text-align: center; padding: 20px;
}
.inside-cover .small { font-size: calc(var(--w) * .055); }
.inside-cover .big { font-size: calc(var(--w) * .1); color: var(--accent); }

.ba-cover { transform: rotateY(0deg) translateZ(2px); }
.ba-leaf { transform: rotateY(0deg) translateZ(1px); }

.book-anim.opening { animation: baFade 2.7s ease both; }
.book-anim.opening .ba-book { animation: baShift 2.7s cubic-bezier(.55, .05, .3, 1) both; }
.book-anim.opening .ba-cover { animation: baCover 2.7s cubic-bezier(.55, .05, .3, 1) both; }
.book-anim.opening .ba-leaf { animation: baLeaf 2.7s cubic-bezier(.55, .05, .3, 1) both; }

.book-anim.closing { animation: baFade 1.9s ease both reverse; }
.book-anim.closing .ba-book { animation: baShift 1.9s cubic-bezier(.55, .05, .3, 1) both reverse; }
.book-anim.closing .ba-cover { animation: baCover 1.9s cubic-bezier(.55, .05, .3, 1) both reverse; }
.book-anim.closing .ba-leaf { animation: baLeaf 1.9s cubic-bezier(.55, .05, .3, 1) both reverse; }

@keyframes baFade {
  0% { opacity: 0; transform: scale(.86) translateY(20px); }
  14% { opacity: 1; transform: none; }
  84% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: scale(1.12); }
}
@keyframes baShift {
  0%, 22% { transform: translateX(0); }
  56%, 100% { transform: translateX(50%); }
}
@keyframes baCover {
  0%, 20% { transform: rotateY(0deg) translateZ(2px); }
  58%, 100% { transform: rotateY(-180deg) translateZ(2px); }
}
@keyframes baLeaf {
  0%, 56% { transform: rotateY(0deg) translateZ(1px); }
  84%, 100% { transform: rotateY(-180deg) translateZ(1px); }
}

/* ---------- Stage (writing / reading) ---------- */
.stage {
  position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain;
  opacity: 0; transform: scale(.97); transition: opacity .5s ease, transform .5s ease; pointer-events: none;
}
.stage.show { opacity: 1; transform: none; pointer-events: auto; }

.dbar {
  position: sticky; top: 0; z-index: 5;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  padding: 14px 24px; color: #fbeedd;
  background: rgba(92, 58, 34, .72); backdrop-filter: blur(8px) saturate(1.1);
  box-shadow: 0 6px 18px -10px rgba(60, 30, 10, .5); margin-bottom: 18px;
}
.dbar > div { display: flex; align-items: center; gap: 10px; }
.dbar .center { justify-content: center; }
.dbar .right { justify-content: flex-end; }
.dbtn {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid rgba(246, 230, 210, .22);
  background: rgba(255, 245, 230, .08); color: #f6e6d2; border-radius: 12px; padding: 9px 14px; font-weight: 600; font-size: .95rem; white-space: nowrap;
  transition: background .2s;
}
.dbtn:hover { background: rgba(255, 245, 230, .18); }
.dbtn:disabled { opacity: .35; cursor: default; }
.dbtn.solid { background: #f3dcb8; color: #4a2e1e; border-color: transparent; }
.dbtn.solid:hover { background: #fbe8c8; }
.dbtn.ghost { border-color: transparent; background: none; }
.dbtn.home { background: rgba(255, 245, 230, .14); border-color: rgba(246, 230, 210, .35); }
.dbtn.home .lbl { display: inline !important; }
.save-status { font-size: .85rem; color: rgba(246, 230, 210, .7); display: inline-flex; align-items: center; gap: 6px; min-width: 70px; }
.page-label { font-family: var(--hand); font-size: 1.15rem; min-width: 120px; text-align: center; }

.paper-wrap { position: relative; max-width: 760px; margin: 6px auto 80px; padding: 0 20px; perspective: 2200px; }

.paper {
  position: relative;
  background-color: var(--paper);
  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='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .32 0 0 0 0 .2 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(90deg, rgba(120, 80, 40, .16), transparent 28px);
  border-radius: 6px 14px 14px 6px;
  padding: 44px 56px 56px 92px;
  box-shadow: 0 2px 0 #efe2cd, 0 4px 0 #e6d6bd, 0 6px 0 #ddcaae, 0 40px 70px -30px rgba(0, 0, 0, .7);
  color: #33261d;
}
/* margin line */
.paper::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 70px; width: 1.5px; background: var(--margin);
}
/* ribbon bookmark */
.paper::after {
  content: ""; position: absolute; top: -6px; right: 64px; width: 22px; height: 92px;
  background: linear-gradient(90deg, #a2483a, #c35b49 50%, #a2483a);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 84%, 0 100%);
  box-shadow: 0 2px 4px rgba(0,0,0,.2);
}

.page-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; padding-right: 70px; }
.page-date { margin: 0; font-family: var(--hand); font-size: 1.35rem; color: #6a4a35; }
.moods { display: flex; gap: 4px; align-items: center; }
.moods .mlabel { font-size: .8rem; color: var(--muted); margin-right: 4px; font-family: var(--sans); }
.mood {
  width: 38px; height: 38px; border-radius: 50%; border: 0; background: transparent; font-size: 1.35rem; line-height: 1;
  filter: grayscale(.8); opacity: .55; transition: transform .2s, filter .2s, opacity .2s, background .2s;
}
.mood:hover { opacity: 1; filter: none; transform: scale(1.12); }
.mood[aria-checked="true"] { opacity: 1; filter: none; background: #f6e3cb; transform: scale(1.12); }
.mood-badge { font-family: var(--hand); font-size: 1.05rem; color: #6a4a35; background: #f6e8d6; padding: 2px 12px; border-radius: 99px; }

.page-title {
  display: block; width: 100%; border: 0; background: transparent; padding: 0; margin: 0 0 6px;
  font-family: var(--hand); font-weight: 400; font-size: 2rem; line-height: 1.4; color: #3d2a1e;
}
.page-title:focus { outline: none; }
.page-title::placeholder { color: #c4b09c; }

.page-body {
  font-family: var(--hand); font-size: calc(var(--lh) * .62); font-weight: 300; line-height: var(--lh); color: #2f2f4a;
  min-height: calc(var(--lh) * var(--lines));
  background-image: repeating-linear-gradient(180deg, transparent 0 calc(var(--lh) - 1px), var(--rule) calc(var(--lh) - 1px) var(--lh));
  background-position: 0 2px;
  outline: none; caret-color: #8b5a3c; overflow-wrap: normal; position: relative; display: flow-root;
}
.page-body p { margin: 0; min-height: var(--lh); }
.page-body.empty::before {
  content: attr(data-placeholder); position: absolute; top: 0; left: 0; color: #b8a690; pointer-events: none;
}
.page-body.read { cursor: default; }
/* one sheet = exactly --lines ruled lines; longer pages continue on the next sheet */
.page-viewport { height: calc(var(--lh) * var(--lines)); overflow: hidden; position: relative; }
.page-foot { margin-top: 22px; text-align: center; font-family: var(--hand); color: #a58f7a; font-size: 1rem; }

/* ---------- Taped photos ---------- */
/* photos float on the left or right so writing flows beside them; several in a row sit side by side.
   --x / --y / --r give each one a slightly hand-placed look without moving the ruled lines. */
.photo {
  --r: -2deg; --x: 0px; --y: 0px;
  position: relative; float: left; width: var(--pw, 42%); margin: 26px 26px 0 4px;
  background: #fff; padding: 10px 10px 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 10px 22px -10px rgba(60, 40, 20, .45);
  transform: translate(var(--x), var(--y)) rotate(var(--r));
  user-select: none;
}
.photo.right { float: right; margin: 26px 4px 0 26px; }
.page-body[contenteditable] .photo img { cursor: grab; touch-action: none; }
.photo.dragging {
  z-index: 20; opacity: .9; cursor: grabbing; transition: none;
  box-shadow: 0 2px 4px rgba(0,0,0,.12), 0 30px 40px -18px rgba(60, 40, 20, .55);
}
.photo.dragging img { cursor: grabbing; }
.page-body.drop-hint { outline: 2px dashed rgba(139, 90, 60, .35); outline-offset: 6px; border-radius: 4px; }
.photo img { display: block; width: 100%; height: auto; max-height: calc(var(--lh) * var(--lines) - 66px); object-fit: cover; cursor: zoom-in; -webkit-user-drag: none; }
.photo::before, .photo::after {
  content: ""; position: absolute; width: 88px; height: 26px; z-index: 2;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .35), rgba(255, 255, 255, 0) 45%, rgba(255, 255, 255, .15)),
    repeating-linear-gradient(90deg, rgba(255,255,255,.08) 0 2px, transparent 2px 5px),
    rgba(240, 222, 170, .74);
  box-shadow: 0 1px 2px rgba(80, 60, 20, .12);
  clip-path: polygon(2% 0, 98% 0, 100% 14%, 97% 28%, 100% 42%, 97% 56%, 100% 70%, 97% 84%, 99% 100%, 2% 100%, 0 86%, 3% 72%, 0 58%, 3% 44%, 0 30%, 3% 16%);
  backdrop-filter: saturate(1.1);
}
.photo::before { top: -4px; left: -30px; transform: rotate(-32deg); }
.photo::after { bottom: -4px; right: -30px; transform: rotate(-32deg); }
.photo.alt::before { left: auto; right: -30px; transform: rotate(32deg); }
.photo.alt::after { right: auto; left: -30px; transform: rotate(32deg); }

/* resize + remove controls (writing only) — inside the frame so a page edge never hides them */
.photo-tools {
  position: absolute; top: 18px; right: 18px; z-index: 3; display: flex; gap: 2px; padding: 3px;
  background: rgba(58, 36, 22, .82); border-radius: 99px; backdrop-filter: blur(4px);
  opacity: 0; transform: translateY(-4px); transition: opacity .2s, transform .2s; box-shadow: 0 6px 14px rgba(0,0,0,.25);
}
.photo-tools .fit { display: none; border: 0; height: 32px; width: auto; padding: 0 12px 0 6px; gap: 4px; font-size: .8rem; font-weight: 700; border-radius: 99px; background: #f3dcb8; color: #4a2e1e; white-space: nowrap; }
.photo-tools .fit:hover { background: #fbe8c8; }
.photo.pushed.can-fit .photo-tools .fit { display: inline-flex; align-items: center; }
.photo.pushed .photo-tools { opacity: 1; transform: none; }
.photo-tools button:not(.fit) { width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: #fff; display: grid; place-items: center; }
.photo-tools button:hover { background: rgba(255, 255, 255, .18); }
.photo-tools .ic { width: 17px; height: 17px; }
.photo-handle {
  position: absolute; right: -9px; bottom: -9px; z-index: 3; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 2px solid #8b5a3c; box-shadow: 0 2px 6px rgba(0,0,0,.25); cursor: nwse-resize; touch-action: none;
  opacity: 0; transition: opacity .2s;
}
.photo.right .photo-handle { right: auto; left: -9px; cursor: nesw-resize; }
.photo:hover .photo-tools, .photo:focus-within .photo-tools, .photo.resizing .photo-tools { opacity: 1; transform: none; }
.photo:hover .photo-handle, .photo.resizing .photo-handle { opacity: 1; }
.photo.resizing { outline: 2px dashed rgba(139, 90, 60, .6); outline-offset: 4px; }
@media (hover: none) { .photo-tools, .photo-handle { opacity: 1; transform: none; } }

/* ---------- Photo viewer ---------- */
.viewer {
  width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: transparent; display: none; place-items: center;
}
.viewer[open] { display: grid; animation: fadeIn .25s ease; }
.viewer::backdrop { background: rgba(30, 18, 10, .78); backdrop-filter: blur(6px); }
.viewer-photo { margin: 0; background: #fff; padding: 14px 14px 18px; border-radius: 3px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.7); animation: viewerIn .35s cubic-bezier(.3, 1.3, .5, 1); }
.viewer-photo img { display: block; max-width: min(90vw, 1200px); max-height: calc(100vh - 120px); width: auto; height: auto; }
@keyframes viewerIn { from { transform: scale(.85) rotate(-3deg); opacity: 0; } }
.viewer-close {
  position: fixed; top: 18px; right: 18px; width: 46px; height: 46px; border-radius: 50%; border: 0;
  background: rgba(255, 250, 242, .92); color: #3a2a20; display: grid; place-items: center; box-shadow: 0 6px 16px rgba(0,0,0,.3);
}
.viewer-close:hover { background: #fff; }

.photo.drop { animation: photoDrop .7s cubic-bezier(.3, 1.4, .5, 1) both; }
.photo.drop::before { animation: tapeOn .45s .55s ease-out both; }
.photo.drop::after { animation: tapeOn2 .45s .75s ease-out both; }
@keyframes photoDrop {
  0% { opacity: 0; transform: translate(var(--x), calc(var(--y) - 50px)) rotate(calc(var(--r) + 9deg)) scale(1.12); box-shadow: 0 40px 50px -20px rgba(60,40,20,.5); }
  100% { opacity: 1; transform: translate(var(--x), var(--y)) rotate(var(--r)); }
}
@keyframes tapeOn { from { opacity: 0; transform: rotate(-32deg) translate(-14px, -14px) scale(1.3); } to { opacity: 1; } }
@keyframes tapeOn2 { from { opacity: 0; transform: rotate(-32deg) translate(14px, 14px) scale(1.3); } to { opacity: 1; } }
.photo.alt.drop::before { animation-name: tapeOnAlt; }
.photo.alt.drop::after { animation-name: tapeOnAlt2; }
@keyframes tapeOnAlt { from { opacity: 0; transform: rotate(32deg) translate(14px, -14px) scale(1.3); } to { opacity: 1; } }
@keyframes tapeOnAlt2 { from { opacity: 0; transform: rotate(32deg) translate(-14px, 14px) scale(1.3); } to { opacity: 1; } }

.paper.dragover { box-shadow: 0 0 0 4px rgba(243, 220, 184, .7), 0 40px 70px -30px rgba(0, 0, 0, .7); }

/* ---------- Page turn ---------- */
.ghost {
  position: absolute !important; top: 0; left: 20px; right: 20px; margin: 0 !important; overflow: hidden; pointer-events: none;
  backface-visibility: hidden; z-index: 4;
}
.ghost.turn-next { transform-origin: left center; animation: turnNext .75s cubic-bezier(.5, .05, .4, 1) forwards; }
.ghost.turn-prev { transform-origin: right center; animation: turnPrev .75s cubic-bezier(.5, .05, .4, 1) forwards; }
.ghost .shade { position: absolute; inset: 0; pointer-events: none; animation: shade .75s ease forwards; }
.ghost.turn-next .shade { background: linear-gradient(90deg, transparent, rgba(60, 30, 10, .35)); }
.ghost.turn-prev .shade { background: linear-gradient(270deg, transparent, rgba(60, 30, 10, .35)); }
@keyframes turnNext { to { transform: rotateY(-115deg); opacity: .2; } }
@keyframes turnPrev { to { transform: rotateY(115deg); opacity: .2; } }
@keyframes shade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 100; transform: translate(-50%, 20px);
  background: #3a2a20; color: #fbeedd; padding: 12px 20px; border-radius: 14px; font-weight: 600;
  box-shadow: 0 14px 30px -10px rgba(0,0,0,.4); opacity: 0; pointer-events: none; transition: opacity .3s, transform .3s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1100px) {
  .grid { grid-template-columns: 1fr; }
  .side-cards { display: grid; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 22px 16px 110px; }
  .bottom-nav {
    position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 20; display: flex; justify-content: space-around;
    background: rgba(255, 251, 246, .95); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 22px; padding: 8px;
    box-shadow: 0 14px 30px -14px rgba(90, 60, 30, .45);
  }
  .bottom-nav button {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: none;
    font-size: .8rem; font-weight: 600; color: var(--ink-2); padding: 6px; border-radius: 14px;
  }
  .bottom-nav button.active { color: var(--accent); }
  .bottom-nav .bn-write { background: var(--accent); color: #fff8ef; margin: 0 6px; }
  .login { padding: 32px 20px; place-items: start center; }
  .login-inner { grid-template-columns: 1fr; gap: 28px; max-width: 420px; }
  .login-art { order: -1; }
  .desk-book { width: 180px; height: 240px; --w: 180px; }
  .login-quote { display: none; }
  .login-panel { align-items: stretch; text-align: left; }
  .login-form { margin-top: 24px; }
}
@media (max-width: 860px) {
  .dbar .center .dbtn .lbl { display: none; }
  .save-status { min-width: 0; }
}
@media (max-width: 640px) {
  .topbar { align-items: flex-start; }
  .shelf-book, .book-add { --w: 128px; width: 128px; }
  .shelf-book .c-title { font-size: 1.2rem; }
  .bookshelf { --shelf-gap: 16px; --shelf-pad: 10px; }
  .new-book { grid-template-columns: 1fr; }
  .preview-book { margin: 0 auto; }
  .sheet-inner { padding: 22px 18px; }
  .sync-chip .txt { display: none; }
  .sync-chip { padding: 8px; }
  .hero { min-height: 0; flex-direction: column; align-items: stretch; }
  .hero-art { position: relative; inset: auto; width: 100%; height: 130px; order: -1; -webkit-mask-image: linear-gradient(180deg, #000 60%, transparent); mask-image: linear-gradient(180deg, #000 60%, transparent); }
  .hero-text { padding: 4px 20px 24px; }
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { justify-content: center; padding: 13px 14px; }
  .side-cards { grid-template-columns: 1fr; }
  .entry-thumb { width: 72px; height: 64px; }
  .entry { gap: 12px; padding: 12px; }
  .dbar { padding: 10px 12px; gap: 6px; }
  .dbtn .lbl { display: none; }
  .dbtn { padding: 9px 11px; }
  .page-label { min-width: 0; font-size: 1rem; }
  .paper-wrap { padding: 0 8px; }
  .paper { padding: 28px 18px 40px 46px; }
  .paper::before { left: 34px; }
  .paper::after { right: 22px; height: 64px; width: 18px; }
  .page-head { padding-right: 34px; }
  .page-title { font-size: 1.6rem; }
  .moods .mlabel { display: none; }

  .photo { --pw: 48%; }
  .photo::before, .photo::after { width: 76px; height: 24px; }
  .ghost { left: 8px; right: 8px; }
}

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

/* =========================================================
   ONE PAGE / TWO PAGES (open book)
   ========================================================= */
.paper { display: grid; grid-template-columns: minmax(0, 1fr); }
.leaf-head.l { grid-row: 1; grid-column: 1; }
.leaf-head.r { grid-row: 1; grid-column: 2; }
.vp-main { grid-row: 2; grid-column: 1; }
.vp-mirror { grid-row: 2; grid-column: 2; }
.page-foot.l { grid-row: 3; grid-column: 1; }
.page-foot.r { grid-row: 3; grid-column: 2; }
.spine { display: none; }
.paper:not(.spread) .leaf-head.r,
.paper:not(.spread) .vp-mirror,
.paper:not(.spread) .page-foot.r { display: none; }

.paper-wrap { transition: max-width .4s ease; }
.paper-wrap.wide { max-width: min(1380px, 95vw); }
.paper.spread { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 120px; border-radius: 6px; }
.paper.spread .spine { display: block; position: absolute; top: 0; bottom: 0; left: 50%; width: 0; pointer-events: none; }
.paper.spread .spine::before { /* the fold in the middle of the book */
  content: ""; position: absolute; top: 0; bottom: 0; left: -48px; width: 96px;
  background: linear-gradient(90deg, transparent, rgba(120, 80, 40, .1) 38%, rgba(90, 55, 25, .26) 50%, rgba(120, 80, 40, .1) 62%, transparent);
}
.paper.spread .spine::after { /* red margin line of the right page */
  content: ""; position: absolute; top: 0; bottom: 0; left: 56px; width: 1.5px; background: var(--margin);
}
.leaf-head.r { align-self: start; }
.leaf-head.r .page-date.small { font-size: 1.05rem; opacity: .65; margin: 6px 0 0; }
.vp-mirror { cursor: text; }
.vp-mirror .page-body.read, .page-body.read ~ .vp-mirror { cursor: default; }
.page-body.mirror .photo-tools, .page-body.mirror .photo-handle { display: none; }
.page-body.mirror .photo img { cursor: inherit; }
.page-foot.r { margin-top: 22px; text-align: center; }

/* turning a spread: the right page swings over the fold (or the left one back) */
.ghost.spread.turn-next { clip-path: inset(0 0 0 50%); transform-origin: 50% 50%; }
.ghost.spread.turn-prev { clip-path: inset(0 50% 0 0); transform-origin: 50% 50%; }

.view-toggle .ic { width: 19px; height: 19px; }

/* =========================================================
   COVER PHOTOS & EDITING BOOKS
   ========================================================= */
.cover-face .c-photo {
  position: relative; display: block; width: 66%; margin: 0 0 10px; padding: 5px 5px 7px; background: #fff;
  transform: rotate(-2.5deg); box-shadow: 0 4px 10px rgba(0, 0, 0, .28); z-index: 1;
}
.cover-face .c-photo img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.cover-face .c-photo::before {
  content: ""; position: absolute; top: -7px; left: 50%; width: 46%; height: 13px; transform: translateX(-50%) rotate(-3deg);
  background: rgba(240, 222, 170, .82); box-shadow: 0 1px 2px rgba(80, 60, 20, .15);
}
.cover-face .c-title.with-photo { font-size: calc(var(--w, 300px) * .1); line-height: 1.15; }
.shelf-book .c-title.with-photo { font-size: 1.02rem; }
.preview-book .c-title.with-photo { font-size: .92rem; }
.ba-cover .c-title.with-photo { font-size: calc(var(--w) * .085); }

.shelf-slot { position: relative; flex: none; }
.shelf-slot:nth-child(even) .shelf-book:hover { transform: translateY(-10px) rotate(1.5deg); }
.edit-book {
  position: absolute; top: 10px; left: 20px; z-index: 3; width: 32px; height: 32px; border-radius: 50%; border: 0;
  display: grid; place-items: center; background: rgba(255, 252, 246, .92); color: #4a3528; box-shadow: 0 2px 6px rgba(0,0,0,.15);
  opacity: 0; transform: translateY(4px); transition: opacity .2s, transform .2s;
}
.edit-book .ic { width: 16px; height: 16px; }
.shelf-slot:hover .edit-book, .edit-book:focus-visible { opacity: 1; transform: translateY(-10px); }
@media (hover: none) { .edit-book { opacity: 1; transform: none; } }

.pv-col { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.pv-photo-btn { font-size: .8rem; padding: 8px 10px; gap: 6px; white-space: nowrap; }
.pv-photo-btn .ic { width: 16px; height: 16px; }
.pv-remove { font-size: .85rem; color: #b4533a !important; padding: 0; }
.choice-hint { margin: 6px 0 0; font-size: .82rem; color: var(--muted); min-height: 1em; }
.sheet-links { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.sheet-links .link-btn { display: inline-flex; gap: 6px; align-items: center; }
.sheet-links .link-btn .ic { width: 16px; height: 16px; }

/* =========================================================
   BOOK COVERS v2 — one design everywhere (shelf, login, preview, opening book)
   Everything is sized from --w (the book's width), so text always fits inside the cover.
   ========================================================= */
.cover-face {
  container-type: inline-size;
  background-color: var(--c2, #5a3320);
  background-image:
    /* soft light from the top-left */
    radial-gradient(120% 80% at 25% 10%, rgba(255, 240, 215, .22), transparent 55%),
    /* fine grain, like book cloth / leather */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .16 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E"),
    linear-gradient(160deg, var(--c1, #8e5a3c) 0%, var(--c2, #5a3320) 100%);
  border-radius: calc(var(--w, 300px) * .02) calc(var(--w, 300px) * .055) calc(var(--w, 300px) * .055) calc(var(--w, 300px) * .02);
  box-shadow:
    inset -1px 0 0 rgba(255, 255, 255, .12),
    inset 0 1px 0 rgba(255, 255, 255, .14),
    inset 0 -2px 3px rgba(0, 0, 0, .12);
  display: block;
}
/* stitching around the edge, starting after the spine */
.cover-face::before {
  inset: calc(var(--w, 300px) * .055) calc(var(--w, 300px) * .055) calc(var(--w, 300px) * .055) calc(var(--w, 300px) * .16);
  border: 1.5px dashed rgba(255, 245, 225, .38);
  border-radius: calc(var(--w, 300px) * .03);
}
[class*="cv-"]:not(.cv-leather) .cover-face::before { border-color: rgba(60, 40, 25, .22); }

/* the spine: a darker band on the left with two raised ridges */
.cover-face .c-spine {
  position: absolute; top: 0; bottom: 0; left: 0; width: 11%; z-index: 1;
  background:
    linear-gradient(180deg, transparent 13%, rgba(0,0,0,.18) 13%, rgba(0,0,0,.18) 14.2%, rgba(255,255,255,.12) 14.2%, rgba(255,255,255,.12) 15%, transparent 15%,
                            transparent 85%, rgba(0,0,0,.18) 85%, rgba(0,0,0,.18) 86.2%, rgba(255,255,255,.12) 86.2%, rgba(255,255,255,.12) 87%, transparent 87%),
    linear-gradient(90deg, rgba(0,0,0,.34), rgba(0,0,0,.12) 55%, rgba(255,255,255,.14) 88%, rgba(0,0,0,.22));
  border-radius: inherit;
}
/* leather corner protectors on the right */
.cover-face .c-corner {
  position: absolute; right: 0; z-index: 1; width: 15%; aspect-ratio: 1;
  background: linear-gradient(135deg, rgba(0,0,0,.42), rgba(0,0,0,.26)), var(--c2, #5a3320);
  box-shadow: inset 1px 1px 0 rgba(255,255,255,.12);
}
.cover-face .c-corner.tr { top: 0; clip-path: polygon(0 0, 100% 0, 100% 100%); border-top-right-radius: calc(var(--w, 300px) * .055); }
.cover-face .c-corner.br { bottom: 0; clip-path: polygon(100% 0, 100% 100%, 0 100%); border-bottom-right-radius: calc(var(--w, 300px) * .055); }

/* the elastic band (brown leather diaries only) */
.cover-face .band { right: 15%; width: 3.2%; min-width: 5px; z-index: 2; }

/* everything printed on the cover sits in this box: right of the spine, left of the band */
.cover-face .c-content {
  position: absolute; z-index: 3;
  top: 13%; bottom: 15%; left: 17%; right: 10%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: calc(var(--w, 300px) * .04); text-align: center; min-width: 0;
}
.cover-face .c-content.banded { right: 24%; }

/* the name label: a cream paper label with a thin inner border */
.cover-face .c-label {
  display: flex; flex-direction: column; align-items: center; gap: calc(var(--w, 300px) * .012);
  max-width: 100%; padding: calc(var(--w, 300px) * .045) calc(var(--w, 300px) * .05);
  background: #fbf6ec; color: #3a2a20; border-radius: calc(var(--w, 300px) * .018);
  box-shadow: 0 1px 2px rgba(0,0,0,.18), inset 0 0 0 calc(var(--w, 300px) * .012) #fbf6ec, inset 0 0 0 calc(var(--w, 300px) * .017) rgba(90, 60, 35, .35);
}
.cover-face .c-label .c-title {
  font-family: var(--serif); font-weight: 600; line-height: 1.1; letter-spacing: 0; text-shadow: none; padding: 0;
  font-size: calc(var(--w, 300px) * .1); overflow-wrap: break-word; hyphens: auto; max-width: 100%;
}
.cover-face .c-label.long .c-title { font-size: calc(var(--w, 300px) * .082); }
.cover-face .c-label.with-photo .c-title { font-size: calc(var(--w, 300px) * .078); }
.cover-face .c-label .c-sub { font-family: var(--hand); font-size: calc(var(--w, 300px) * .056); color: #7a5a42; margin: 0; opacity: 1; line-height: 1.2; }

/* brown leather: gold-foil lettering pressed into the cover instead of a paper label */
.cover-face .c-label.foil { background: none; box-shadow: none; padding: 0; gap: calc(var(--w, 300px) * .02); }
.cover-face .c-label.foil .c-title {
  font-size: calc(var(--w, 300px) * .135); color: #ecd3a2;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .55), 0 -1px 0 rgba(255, 235, 200, .18);
}
.cover-face .c-label.foil.long .c-title { font-size: calc(var(--w, 300px) * .1); }
.cover-face .c-label.foil.with-photo .c-title { font-size: calc(var(--w, 300px) * .085); }
.cover-face .c-label.foil .c-sub { color: #e2c595; opacity: .9; }

.cover-face .c-motif { width: 30%; margin: 0; opacity: .6; color: var(--cink, #f3dcb8); }
.cover-face:not(:has(.foil)) .c-motif { color: rgba(50, 35, 25, .55); }
.cover-face .c-photo { width: 78%; margin: 0; }

.cover-face .c-year {
  position: absolute; z-index: 3; bottom: 6.5%; left: 17%; right: 10%; text-align: center;
  font-family: var(--serif); font-size: calc(var(--w, 300px) * .045); letter-spacing: .3em; opacity: .55;
  color: var(--cink, #f3dcb8);
}
.cover-face:has(.banded) .c-year { right: 24%; }
[class*="cv-"]:not(.cv-leather) .cover-face .c-year { color: rgba(50, 35, 25, .7); }

/* ---------- on the shelf: page edges, a bit of depth, a tilt when you point at it ---------- */
.shelf-books { perspective: 900px; }
.shelf-book { transform-style: preserve-3d; }
.shelf-book::before { /* page block peeking out on the right */
  content: ""; position: absolute; top: 3.5%; bottom: 2%; right: -4px; width: 7px; z-index: -1;
  background: repeating-linear-gradient(180deg, #f7efe1 0 2px, #e2d4bb 2px 3px);
  border-radius: 0 3px 3px 0; box-shadow: 1px 0 2px rgba(0,0,0,.15);
}
.shelf-book:hover, .shelf-book:focus-visible { transform: translateY(-10px) rotateY(-14deg) rotate(-1deg); }
.shelf-slot:nth-child(even) .shelf-book:hover { transform: translateY(-10px) rotateY(-14deg) rotate(1deg); }
.shelf-book .ribbon { left: 26%; }

/* sizes the covers are drawn at */
.shelf-book { --w: 150px; }
.preview-book { --w: 150px; width: 150px; }
@media (max-width: 640px) { .shelf-book { --w: 128px; } }
.desk-book .cover-face { --w: 300px; }
@media (max-width: 900px) { .desk-book .cover-face { --w: 180px; } }
.cover-face .c-label .c-sub, .cover-face .c-label .c-title { padding: 0; text-align: center; }
/* a touch larger lettering so names read well at shelf size */
.cover-face .c-label { padding: calc(var(--w, 300px) * .04) calc(var(--w, 300px) * .045); }
.cover-face .c-label .c-title { font-size: calc(var(--w, 300px) * .118); }
.cover-face .c-label.long .c-title { font-size: calc(var(--w, 300px) * .095); }
.cover-face .c-label.with-photo .c-title { font-size: calc(var(--w, 300px) * .088); }
.cover-face .c-label .c-sub { font-size: calc(var(--w, 300px) * .062); }
.cover-face .c-label.foil .c-title { font-size: calc(var(--w, 300px) * .145); }
.cover-face .c-label.foil.long .c-title { font-size: calc(var(--w, 300px) * .115); }



/* ---------- Done → reading: a soft settle so the switch feels deliberate ---------- */
.paper.settle { animation: settle .45s ease; }
@keyframes settle { from { opacity: .55; transform: translateY(6px); } }

/* ---------- Phones: page buttons in a bar at the bottom ---------- */
.dnav { display: none; }
@media (max-width: 640px) {
  .dnav:not([hidden]) {
    position: absolute; z-index: 6; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    display: block; padding: 6px; border-radius: 18px;
    background: rgba(92, 58, 34, .9); backdrop-filter: blur(8px); box-shadow: 0 14px 30px -14px rgba(0, 0, 0, .55);
  }
  .dnav .center { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
  .dnav .dbtn { min-width: 48px; min-height: 44px; justify-content: center; }
  .dnav .dbtn .lbl { display: none; }
  .dnav .page-label { flex: 1; text-align: center; color: #fbeedd; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dbar .center:empty { display: none; }
  .dbar { grid-template-columns: auto 1fr; }
  .paper-wrap { margin-bottom: 110px; } /* room above the bottom bar */
}

/* =========================================================
   HOME WITHOUT A SIDEBAR: header (brand, bell, profile)
   ========================================================= */
.app { display: block; min-height: 100vh; }
.sidebar, .bottom-nav { display: none !important; }
.site-head {
  max-width: 1240px; margin: 0 auto; padding: 22px 40px 0;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.site-head .brand { font-size: 2.1rem; }
.site-head .brand-tag { margin: 4px 0 0; }
.head-actions { display: flex; align-items: center; gap: 14px; }
.main { max-width: 1240px; margin: 0 auto; padding: 26px 40px 80px; }
.greet { margin-bottom: 22px; }
.greet h1 { font-size: clamp(1.8rem, 3vw, 2.5rem); }
.greet p { margin: 4px 0 0; font-size: 1.05rem; color: var(--ink-2); }

.pop-wrap { position: relative; }
.icon-round {
  position: relative; width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line);
  background: #fffaf3; color: var(--ink); display: grid; place-items: center; box-shadow: var(--shadow); transition: background .2s;
}
.icon-round:hover { background: #fff; }
.icon-round .ic { width: 22px; height: 22px; }
.bell-count {
  position: absolute; top: -3px; right: -3px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 99px;
  background: #c4553d; color: #fff; font-size: .72rem; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg);
}
button.avatar { cursor: pointer; }
.avatar.has-photo { background: #e9d9c6; overflow: hidden; padding: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }

.pop {
  position: absolute; right: 0; top: calc(100% + 12px); z-index: 40; background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: 0 22px 50px -20px rgba(70, 40, 15, .45); animation: sheetIn .2s ease;
}
.me-pop { width: 260px; padding: 10px; }
.me-head { display: flex; align-items: center; gap: 12px; padding: 8px 8px 12px; border-bottom: 1px solid #f1e4d3; margin-bottom: 6px; }
.me-head .avatar { width: 44px; height: 44px; flex: none; }
.me-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.me-who b { font-family: var(--serif); font-weight: 600; }
.me-who span { font-size: .85rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-item {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 12px; border: 0; border-radius: 12px; background: none;
  font-weight: 600; color: var(--ink); text-align: left;
}
.pop-item:hover { background: #f6ebdd; }
.pop-item.danger { color: #b4533a; }

.notif-pop { width: min(380px, calc(100vw - 32px)); padding: 6px 6px 8px; }
.pop-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px 8px; }
.pop-head b { font-family: var(--serif); font-size: 1.1rem; }
.pop-head .link-btn { font-size: .85rem; color: var(--accent); }
.notif-list { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow-y: auto; }
.notif {
  width: 100%; display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 0; border-radius: 12px;
  background: none; text-align: left; color: var(--ink);
}
.notif:hover { background: #f8efe3; }
.notif.unread { background: #fbf1e3; }
.notif.unread .notif-text { font-weight: 700; }
.notif-icon { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: #f1e1cd; color: var(--accent); overflow: hidden; font-size: 1.1rem; }
.notif-icon img { width: 100%; height: 100%; object-fit: cover; }
.notif-icon.announce { background: #e6efdd; color: #5b7a48; }
.notif-icon .ic { width: 18px; height: 18px; }
.notif-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif-text { font-size: .92rem; line-height: 1.35; }
.notif-time { font-size: .78rem; color: var(--muted); }
.notif-empty { padding: 18px 14px 14px; color: var(--ink-2); font-size: .92rem; text-align: center; }

/* coming soon banner: bottom right of the home page */
.soon-float {
  position: fixed; right: 24px; bottom: 24px; z-index: 30; width: 290px; margin: 0;
  box-shadow: 0 18px 40px -18px rgba(90, 60, 30, .5);
}
.soon-close {
  position: absolute; top: 8px; left: 10px; width: 24px; height: 24px; border: 0; border-radius: 50%; background: transparent;
  color: var(--muted); font-size: 1.1rem; line-height: 1; display: grid; place-items: center;
}
.soon-close:hover { background: #f1e2d0; color: var(--ink); }
.soon-float .soon-head { margin-top: 16px; }

/* ---------- profile drawer ---------- */
.drawer {
  position: fixed; inset: 0 0 0 auto; margin: 0; height: 100vh; max-height: 100vh; width: min(440px, 100vw); max-width: 100vw;
  border: 0; padding: 0; background: var(--bg); box-shadow: -30px 0 60px -30px rgba(40, 20, 5, .5);
  border-radius: 24px 0 0 24px; overflow: hidden;
}
.drawer[open] { animation: drawerIn .35s cubic-bezier(.2, .8, .3, 1); }
@keyframes drawerIn { from { transform: translateX(40px); opacity: 0; } }
.drawer::backdrop { background: rgba(47, 32, 25, .35); backdrop-filter: blur(2px); }
.drawer-inner { height: 100%; overflow-y: auto; padding: 24px 22px 40px; display: flex; flex-direction: column; gap: 14px; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; }
.drawer-head h2 { font-size: 1.6rem; }
.pf-card { background: var(--card); border: 1px solid #f1e4d3; border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.pf-card h3 { font-size: 1.15rem; }
.pf-card p { margin: -6px 0 0; font-size: .88rem; }
.pf-me { flex-direction: row; align-items: center; gap: 18px; }
.pf-avatar { position: relative; flex: none; border: 0; background: none; padding: 0; border-radius: 50%; }
.pf-avatar .avatar { width: 86px; height: 86px; font-size: 2rem; box-shadow: 0 0 0 4px #fff, var(--shadow); }
.pf-cam { position: absolute; right: -2px; bottom: -2px; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; border: 2px solid #fff; }
.pf-cam .ic { width: 15px; height: 15px; }
.pf-photo-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.pf-photo-actions .btn { font-size: .9rem; padding: 9px 14px; }
.pf-remove { font-size: .85rem; color: #b4533a !important; padding: 0; }
.pf-email { margin: 0 !important; }
.pf-card .field input { padding: 11px 13px; font-size: 1rem; }
.pf-card .form-error { margin: 0; }
.pf-card > .btn { align-self: flex-start; }
.pf-logout { align-self: stretch; justify-content: center; color: #b4533a; }

.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.theme-tile {
  border: 2px solid transparent; border-radius: 14px; background: #fbf5ec; padding: 6px; display: flex; flex-direction: column; gap: 6px;
  text-align: left; font-size: .82rem; font-weight: 600; color: var(--ink-2); transition: border-color .2s, transform .2s;
}
.theme-tile:hover { transform: translateY(-1px); }
.theme-tile[aria-checked="true"] { border-color: var(--accent); color: var(--ink); }
.theme-swatch { display: block; height: 54px; border-radius: 9px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.theme-name { padding: 0 4px 2px; }

.desk-oak .theme-swatch    { background: repeating-linear-gradient(180deg, transparent 0 13px, rgba(95,55,25,.18) 13px 14px), linear-gradient(180deg, #d4aa7b, #c3935f); }
.desk-walnut .theme-swatch { background: repeating-linear-gradient(180deg, transparent 0 13px, rgba(0,0,0,.22) 13px 14px), linear-gradient(180deg, #6e4630, #4b2e1f); }
.desk-birch .theme-swatch  { background: repeating-linear-gradient(180deg, transparent 0 13px, rgba(140,110,70,.14) 13px 14px), linear-gradient(180deg, #f0e2c8, #e2cfae); }
.desk-linen .theme-swatch  { background: repeating-linear-gradient(90deg, rgba(120,100,70,.08) 0 1px, transparent 1px 4px), repeating-linear-gradient(0deg, rgba(120,100,70,.08) 0 1px, transparent 1px 4px), #ddd1bf; }
.desk-slate .theme-swatch  { background: radial-gradient(120% 90% at 30% 20%, #6b7178, #3d4248); }
.paper-cream .theme-swatch   { background: repeating-linear-gradient(180deg, #fffaf0 0 11px, rgba(112,142,182,.4) 11px 12px); }
.paper-white .theme-swatch   { background: repeating-linear-gradient(180deg, #ffffff 0 11px, rgba(120,150,190,.45) 11px 12px); }
.paper-vintage .theme-swatch { background: repeating-linear-gradient(180deg, transparent 0 11px, rgba(140,110,70,.35) 11px 12px), radial-gradient(circle at 70% 30%, #e9d3a8, #f2e2c0 60%); }
.paper-dotted .theme-swatch  { background: radial-gradient(circle, rgba(90,110,140,.55) 1.2px, transparent 1.7px) 0 0 / 10px 10px, #fffdf8; }
.paper-blue .theme-swatch    { background: linear-gradient(90deg, transparent 18px, rgba(220,80,80,.7) 18px 19.5px, transparent 19.5px), repeating-linear-gradient(180deg, #fdfdfb 0 11px, rgba(70,120,200,.6) 11px 12px); }

/* =========================================================
   DESK THEMES (the table under the open diary)
   ========================================================= */
html[data-desk="walnut"] .diary,
html[data-desk="walnut"] .deskface {
  background-color: #4b2e1f;
  background-image:
    radial-gradient(1100px 760px at 50% 18%, rgba(255, 220, 170, .2), transparent 70%),
    radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(20, 10, 4, .45) 100%),
    repeating-linear-gradient(180deg, transparent 0 238px, rgba(0, 0, 0, .3) 238px 240px, transparent 240px 241px),
    repeating-linear-gradient(178deg, rgba(0,0,0,.06) 0 3px, transparent 3px 11px),
    linear-gradient(180deg, #6e4630, #4b2e1f);
}
html[data-desk="birch"] .diary,
html[data-desk="birch"] .deskface {
  background-color: #e6d4b4;
  background-image:
    radial-gradient(1100px 760px at 50% 18%, rgba(255, 250, 235, .6), transparent 70%),
    radial-gradient(ellipse at 50% 50%, transparent 60%, rgba(120, 90, 50, .2) 100%),
    repeating-linear-gradient(180deg, transparent 0 238px, rgba(140, 110, 70, .18) 238px 240px, transparent 240px 241px),
    repeating-linear-gradient(178deg, rgba(140,110,70,.06) 0 3px, transparent 3px 12px),
    linear-gradient(180deg, #f0e2c8, #e2cfae);
}
html[data-desk="linen"] .diary,
html[data-desk="linen"] .deskface {
  background-color: #d9cdbb;
  background-image:
    radial-gradient(1100px 760px at 50% 18%, rgba(255, 250, 240, .5), transparent 70%),
    radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(80, 60, 40, .22) 100%),
    repeating-linear-gradient(90deg, rgba(110, 90, 60, .07) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(0deg, rgba(110, 90, 60, .07) 0 1px, transparent 1px 4px),
    linear-gradient(180deg, #e2d7c6, #d3c5b0);
}
html[data-desk="slate"] .diary,
html[data-desk="slate"] .deskface {
  background-color: #3d4248;
  background-image:
    radial-gradient(1100px 760px at 50% 18%, rgba(255, 240, 220, .14), transparent 70%),
    radial-gradient(ellipse at 50% 50%, transparent 50%, rgba(0, 0, 0, .4) 100%),
    radial-gradient(120% 90% at 30% 20%, #5a6067, #33383e);
}

/* =========================================================
   DIARY PAPER THEMES
   ========================================================= */
html[data-paper="white"]   { --paper: #ffffff; --rule: rgba(120, 150, 190, .3); }
html[data-paper="vintage"] { --paper: #f3e3c3; --rule: rgba(140, 110, 70, .26); --margin: rgba(170, 90, 70, .35); }
html[data-paper="blue"]    { --paper: #fdfdfb; --rule: rgba(70, 120, 200, .42); --margin: rgba(220, 80, 80, .55); }
html[data-paper="dotted"]  { --paper: #fffdf8; }
html[data-paper="vintage"] .paper,
html[data-paper="vintage"] .paperface {
  background-image:
    radial-gradient(circle at 82% 18%, rgba(150, 100, 40, .12) 0 40px, transparent 41px),
    radial-gradient(ellipse at 50% 50%, transparent 60%, rgba(140, 100, 50, .18) 100%),
    linear-gradient(90deg, rgba(120, 80, 40, .2), transparent 28px);
}
html[data-paper="dotted"] .page-body,
html[data-paper="dotted"] .paperface {
  background-image: radial-gradient(circle, rgba(90, 110, 140, .5) 1.3px, transparent 1.8px);
  background-size: calc(var(--lh) * .75) var(--lh);
  background-position: 0 calc(var(--lh) / 2);
}

/* =========================================================
   HOME BANNER: one scene for the whole card, by time of day and weather
   ========================================================= */
.hero {
  /* morning is the starting point; the time of day swaps the whole set */
  --sk-1: #9ec4e8; --sk-2: #ffd8ae; --sk-3: #ffeedd;
  --far: #c7c2d2; --mid: #b39b86; --near: #8d7460; --front: #6b543f;
  --haze-c: rgba(255, 234, 208, .55);
  --orb-1: #fffdf2; --orb-2: rgba(255, 228, 170, .55); --orb-3: rgba(255, 214, 150, 0);
  --orb-core: #fff6dd; --orb-x: -118px; --orb-y: 44px; --orb-r: 1;
  --leaf: #7a6246; --water-1: #cfe0ee; --water-2: #b7c8d8;
  --cloud: #ffffff; --bird: #7d6148; --star: 0;
  --tint-1: #fdf1e3; --tint-2: #f8e4d2; --hero-ink: var(--ink); --hero-ink-2: var(--ink-2);
  background: linear-gradient(100deg, var(--tint-1) 0%, var(--tint-2) 100%);
  transition: background 1.2s ease;
}
.hero[data-time="noon"] {
  --sk-1: #6fa8de; --sk-2: #b3d6ee; --sk-3: #eaf3f8;
  --far: #b6c5c9; --mid: #a89477; --near: #857056; --front: #62503c;
  --haze-c: rgba(255, 255, 255, .4);
  --orb-1: #ffffff; --orb-2: rgba(255, 246, 214, .5); --orb-3: rgba(255, 240, 200, 0);
  --orb-core: #fffdf0; --orb-x: 10px; --orb-y: -34px; --orb-r: .9;
  --leaf: #6f6141; --water-1: #c3d9ea; --water-2: #a9c0d3;
  --tint-1: #fcf4e9; --tint-2: #f1efe6;
}
.hero[data-time="evening"] {
  --sk-1: #433c6b; --sk-2: #dd7352; --sk-3: #ffb877;
  --far: #7c5f72; --mid: #6a4a4e; --near: #4d373c; --front: #34262c;
  --haze-c: rgba(255, 164, 112, .35);
  --orb-1: #fff3d6; --orb-2: rgba(255, 150, 90, .5); --orb-3: rgba(255, 120, 70, 0);
  --orb-core: #ffd79a; --orb-x: -36px; --orb-y: 58px; --orb-r: 1.25;
  --leaf: #3b2a2e; --water-1: #d08a63; --water-2: #7a5057;
  --cloud: #f7c3a2; --bird: #4a3338;
  --tint-1: #f8e5d6; --tint-2: #eccbbb;
}
.hero[data-time="night"] {
  --sk-1: #0e1530; --sk-2: #1d2a4e; --sk-3: #3a4570;
  --far: #2b3458; --mid: #222b48; --near: #1a2138; --front: #121728;
  --haze-c: rgba(120, 140, 190, .18);
  --orb-1: #f6f8ff; --orb-2: rgba(190, 206, 245, .3); --orb-3: rgba(160, 180, 230, 0);
  --orb-core: #eef2ff; --orb-x: 74px; --orb-y: -22px; --orb-r: .62;
  --leaf: #161d33; --water-1: #2f3a60; --water-2: #1b2340;
  --cloud: #3d4668; --bird: #1a2138; --star: 1;
  --tint-1: #2a2540; --tint-2: #191a2d;
  --hero-ink: #f6ece0; --hero-ink-2: #cfc3d4;
}
.hero[data-time="night"] .hero-text h1,
.hero[data-time="night"] .hero-text h2 { color: var(--hero-ink); }
.hero[data-time="night"] .hero-text p { color: var(--hero-ink-2); }
.hero[data-time="night"] .hero-weather { color: #f0c79a !important; }
.hero-text h1, .hero-text h2, .hero-text p { transition: color 1.2s ease; }

/* the scene itself takes every colour from the set above */
.hero-art .sk1 { stop-color: var(--sk-1); }
.hero-art .sk2 { stop-color: var(--sk-2); }
.hero-art .sk3 { stop-color: var(--sk-3); }
.hero-art .og1 { stop-color: var(--orb-1); }
.hero-art .og2 { stop-color: var(--orb-2); }
.hero-art .og3 { stop-color: var(--orb-3); }
.hero-art .wg1 { stop-color: var(--water-1); }
.hero-art .wg2 { stop-color: var(--water-2); }
.hero-art .r-far { fill: var(--far); }
.hero-art .r-mid { fill: var(--mid); }
.hero-art .r-near { fill: var(--near); }
.hero-art .r-front { fill: var(--front); }
.hero-art .haze { fill: var(--haze-c); }
.hero-art .leaves circle { fill: var(--leaf); }
.hero-art .tree .trunk { stroke: var(--leaf); }
.hero-art .cloud ellipse { fill: var(--cloud); }
.hero-art .birds { stroke: var(--bird); }
.hero-art .stars { fill: #fff8e6; opacity: var(--star); }
.hero-art .orb { transform: translate(var(--orb-x), var(--orb-y)) scale(var(--orb-r)); transform-origin: 330px 120px; }
.hero-art .orb-core { fill: var(--orb-core); }
.hero-art .orb-bite { fill: var(--sk-1); opacity: 0; }        /* a crescent, only at night */
.hero[data-time="night"] .orb-bite { opacity: 1; }
.hero-art .ripples path { stroke: rgba(255, 255, 255, .35); stroke-width: 1.4; stroke-linecap: round; fill: none; }
.hero-art .sky, .hero-art .ridge, .hero-art .haze, .hero-art .water, .hero-art .leaves circle,
.hero-art .tree .trunk, .hero-art .cloud ellipse, .hero-art .birds, .hero-art .stars, .hero-art .orb,
.hero-art .orb-core, .hero-art .orb-bite { transition: fill 1.2s ease, stroke 1.2s ease, opacity 1.2s ease, transform 1.2s ease; }
.hero-art .clouds, .hero-art .rain, .hero-art .snow, .hero-art .snowcaps, .hero-art .fog, .hero-art .flash { opacity: 0; transition: opacity 1.2s ease; }
.hero-art .rain path { stroke: rgba(255, 255, 255, .85); }
.hero-art .snow circle { fill: #ffffff; }
.hero-art .snowcaps { stroke: #fbfdff; }
.hero-art .fog { fill: #f3efe8; }

/* weather on top of whatever time it is */
.hero[data-scene="sunny"] .clouds { opacity: .35; }
.hero[data-scene="cloudy"] .clouds { opacity: .95; }
.hero[data-scene="cloudy"] .orb { opacity: .5; }
.hero[data-scene="cloudy"] { --sk-1: #9fa9b4; --sk-2: #c6c6c2; --sk-3: #ded2c2; --tint-1: #f4efe6; --tint-2: #e8e2d8; }
.hero[data-scene="cloudy"][data-time="night"] { --sk-1: #171d31; --sk-2: #262c42; --sk-3: #3b4157; --tint-1: #262636; --tint-2: #1a1b28; }

.hero[data-scene="rain"] { --sk-1: #7f8a95; --sk-2: #a7abac; --sk-3: #c3bdb2; --cloud: #8d949c; --tint-1: #eceae4; --tint-2: #ded9d1; }
.hero[data-scene="rain"][data-time="night"] { --sk-1: #141a2b; --sk-2: #222838; --sk-3: #343a4a; --cloud: #39404f; --tint-1: #23242f; --tint-2: #181920; }
.hero[data-scene="rain"] .clouds, .hero[data-scene="storm"] .clouds { opacity: 1; }
.hero[data-scene="rain"] .rain, .hero[data-scene="storm"] .rain { opacity: .7; }
.hero[data-scene="rain"] .orb, .hero[data-scene="storm"] .orb,
.hero[data-scene="rain"] .birds, .hero[data-scene="storm"] .birds, .hero[data-scene="snow"] .birds,
.hero[data-scene="fog"] .birds { opacity: 0; }

.hero[data-scene="storm"] { --sk-1: #5f6874; --sk-2: #7d8086; --sk-3: #9a948b; --cloud: #666d78; --tint-1: #e3e0da; --tint-2: #d2cec6; }
.hero[data-scene="storm"][data-time="night"] { --sk-1: #0d1120; --sk-2: #1a1f30; --sk-3: #2a2f3e; --cloud: #2b3140; --tint-1: #1e1f29; --tint-2: #14151c; }
.hero[data-scene="storm"] .flash { animation: lightning 7s infinite; }

.hero[data-scene="fog"] { --sk-1: #cbc8c1; --sk-2: #dcd7cd; --sk-3: #e9e3d8; --haze-c: rgba(245, 241, 233, .7); --tint-1: #f3f0e9; --tint-2: #e6e2da; }
.hero[data-scene="fog"][data-time="night"] { --sk-1: #20242f; --sk-2: #2d313c; --sk-3: #3c404a; --tint-1: #262730; --tint-2: #1a1b22; }
.hero[data-scene="fog"] .fog { opacity: .65; }
.hero[data-scene="fog"] .orb { opacity: .35; }
.hero[data-scene="fog"] .r-far { opacity: .45; }

.hero[data-scene="snow"] { --sk-1: #bcd0e0; --sk-2: #dde6ec; --sk-3: #eeeae2; --far: #94a8b7; --mid: #9c8e7c; --near: #7d6b58; --tint-1: #f5f3ed; --tint-2: #e7e9ea; }
.hero[data-scene="snow"][data-time="night"] { --sk-1: #161d33; --sk-2: #27304a; --sk-3: #3c445c; --tint-1: #262a3a; --tint-2: #191c28; }
.hero[data-scene="snow"] .snow, .hero[data-scene="snow"] .snowcaps { opacity: .95; }
.hero[data-scene="snow"] .clouds { opacity: .8; }
.hero[data-scene="snow"] .orb { opacity: .4; }

.hero-art .drops { animation: rainFall .8s linear infinite; }
.hero-art .drops.d2 { animation-duration: 1s; animation-delay: -.4s; }
@keyframes rainFall { from { transform: translate(8px, -70px); } to { transform: translate(-14px, 90px); } }
.hero-art .flakes { animation: snowFall 7s linear infinite; }
.hero-art .flakes.f2 { animation-duration: 9s; animation-delay: -4s; }
@keyframes snowFall { from { transform: translate(0, -90px); } 50% { transform: translate(10px, 40px); } to { transform: translate(-6px, 170px); } }
.hero-art .fog1 { animation: fogDrift 14s ease-in-out infinite alternate; }
.hero-art .fog2 { animation: fogDrift 18s ease-in-out infinite alternate-reverse; }
@keyframes fogDrift { to { transform: translateX(-40px); } }
.hero-art .cloud { animation: cloudDrift 40s ease-in-out infinite alternate; }
.hero-art .cloud.c2 { animation-duration: 55s; }
@keyframes cloudDrift { to { transform: translateX(-36px); } }
@keyframes lightning { 0%, 91%, 100% { opacity: 0; } 92% { opacity: .75; } 93.5% { opacity: 0; } 94.5% { opacity: .5; } 96% { opacity: 0; } }
.hero-weather {
  margin: -14px 0 22px !important; font-size: .95rem !important; color: var(--accent) !important; font-weight: 600;
  display: inline-flex; align-items: center; gap: 8px;
}
.hero-weather::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .6; }

@media (max-width: 900px) {
  .site-head { padding: 16px 16px 0; }
  .main { padding: 18px 16px 40px; }
  .soon-float { position: relative; right: auto; bottom: auto; width: auto; margin: 0 16px 28px; }
}
@media (max-width: 640px) {
  .site-head .brand { font-size: 1.8rem; }
  .site-head .brand-tag { font-size: .8rem; }
  .icon-round { width: 42px; height: 42px; }
  .head-actions .avatar-lg { width: 44px; height: 44px; }
  .drawer { width: 100vw; border-radius: 0; }
  .pf-me { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) { .hero-art .drops, .hero-art .flakes, .hero-art .cloud, .hero-art .fog1, .hero-art .fog2 { animation: none; } }

/* optional age and location fields */
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; min-width: 0; }
.field-row .field-age { flex: 0 0 104px; }
.field em { font-style: normal; font-weight: 400; color: var(--muted); font-size: .82rem; margin-left: 4px; }
.pf-card .field-row .field input { width: 100%; }
@media (max-width: 380px) { .field-row { flex-direction: column; } .field-row .field-age { flex-basis: auto; } }
/* Siva Digital credit */
.site-foot { margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--line); text-align: center; color: var(--muted); font-size: .85rem; letter-spacing: .01em; }
.site-foot b { color: var(--ink-2); font-weight: 700; }
.login { grid-template-rows: 1fr auto; }
.login-foot { border-top: 0; margin-top: 28px; padding-top: 0; }
@media (max-width: 900px) { .site-foot { margin-top: 36px; } .main .site-foot { margin-bottom: 8px; } }
@media (min-width: 901px) { .main { padding-bottom: 170px; } }

/* =========================================================
   HOME v3: full width, greeting inside the banner, side panel, one screen
   ========================================================= */
.app { display: flex; flex-direction: column; min-height: 100vh; }
.site-head { max-width: 1680px; width: 100%; padding: 18px 36px 0; }
.main.home {
  flex: 1; width: 100%; max-width: 1680px; margin: 0 auto; padding: 18px 36px 28px;
  display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start;
}
.home-main { min-width: 0; }
.hero { min-height: 232px; }
.hero-text { padding: 34px 44px; max-width: 640px; }
.hero-text h1 { font-size: clamp(2rem, 3.2vw, 2.8rem); line-height: 1.1; }
.hero-text p { margin: 10px 0 22px; max-width: 440px; }
.hero-text .hero-weather { margin: -10px 0 20px !important; }
.library { margin-top: 24px; }

.side-panel { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 16px; }
.side-card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 16px 18px; box-shadow: var(--shadow); }

.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-head h3 { font-size: 1.15rem; }
.cal-nav { width: 32px; height: 32px; border-radius: 50%; border: 0; background: transparent; font-size: 1.5rem; line-height: 1; color: var(--ink-2); display: grid; place-items: center; padding-bottom: 3px; }
.cal-nav:hover:not(:disabled) { background: var(--accent-soft); }
.cal-nav:disabled { opacity: .3; cursor: default; }
.cal-week, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal-week span { font-size: .72rem; font-weight: 700; color: var(--muted); padding-bottom: 2px; }
.cal-day {
  aspect-ratio: 1; border: 0; border-radius: 50%; background: transparent; font-size: .85rem; font-weight: 600;
  color: var(--ink-2); display: grid; place-items: center; padding: 0; transition: background .15s, transform .15s;
}
.cal-day.blank { visibility: hidden; }
.cal-day:disabled { cursor: default; color: #c7b4a2; font-weight: 400; }
.cal-day.has { background: var(--accent); color: #fff; }
.cal-day.has:hover { transform: scale(1.1); }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--accent); color: var(--accent); font-weight: 800; }
.cal-day.today.has { color: #fff; box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--accent); }
.cal-day.today:not(.has):hover { background: var(--accent-soft); }
.cal-note { margin: 10px 0 0; font-size: .85rem; color: var(--ink-2); text-align: center; }

.stats-card { display: grid; grid-template-columns: repeat(3, 1fr); padding: 14px 8px; }
.stat-box { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 0 4px; }
.stat-box + .stat-box { border-left: 1px dashed var(--line); }
.stat-box b { font-family: var(--serif); font-size: 1.7rem; font-weight: 600; line-height: 1.1; color: var(--accent); }
.stat-box span { font-size: .76rem; color: var(--ink-2); font-weight: 600; line-height: 1.25; }

.side-soon { margin: 6px 0 0; width: auto; }
.side-soon .soon-head { margin-top: 16px; }
.site-foot.side-foot { margin: 0; padding: 0; border: 0; font-size: .8rem; }

@media (min-width: 901px) { .main.home { padding-bottom: 28px; } }
@media (max-width: 1100px) {
  .main.home { grid-template-columns: 1fr; }
  .side-panel { position: static; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); align-items: start; }
  .side-foot { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .site-head { padding: 14px 16px 0; }
  .main.home { padding: 14px 16px 28px; gap: 22px; }
  .hero-text { padding: 26px 24px; }
}
.side-panel { gap: 12px; }
.side-card { padding: 14px 16px; }
.cal-grid { gap: 2px 4px; }
@media (min-width: 901px) { .main.home { padding-bottom: 16px; } }
@media (min-width: 1101px) and (max-height: 760px) { .cal-day { aspect-ratio: auto; height: 30px; border-radius: 10px; } .hero { min-height: 210px; } }
@media (min-width: 1101px) and (min-height: 820px) { .hero { min-height: clamp(232px, 32vh, 380px); } .hero-text h1 { font-size: clamp(2.2rem, 3.4vw, 3.2rem); } }
/* books grow a little on tall screens so the shelf fills the space */
.bookshelf { --book-w: 150px; }
.shelf-book, .book-add { --w: var(--book-w); width: var(--book-w); }
@media (min-width: 1101px) and (min-height: 900px) { .bookshelf { --book-w: clamp(150px, 20vh, 220px); } .shelf-book .c-title { font-size: calc(var(--w) * .095); } }
@media (max-width: 640px) { .bookshelf { --book-w: 128px; } }
.hero-text { max-width: 720px; }

/* consent tick box and the six digit code */
.consent { display: flex; gap: 11px; align-items: flex-start; font-size: .88rem; line-height: 1.45; color: var(--ink-2); cursor: pointer; }
.consent input { flex: none; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); cursor: pointer; }
.pf-card .consent { font-size: .86rem; }
.pf-loc-now { margin: 2px 0 0 !important; font-size: .82rem !important; }
.dot-sep { color: var(--muted); margin: 0 4px; }

.consent b { font-weight: 700; color: var(--ink); }
.consent .tip { font-style: normal; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); background: var(--accent-soft); padding: 2px 7px; border-radius: 99px; margin-left: 6px; vertical-align: 1px; }

/* waiting for the link in the email */
.mail-wait { display: flex; justify-content: center; padding: 6px 0 2px; }
.mail-art { width: 132px; height: auto; animation: mailFloat 3.4s ease-in-out infinite; }
.mail-spark circle { fill: var(--accent); opacity: .25; animation: mailSpark 2.2s ease-in-out infinite; }
.mail-spark circle:nth-child(2) { animation-delay: .4s; }
.mail-spark circle:nth-child(3) { animation-delay: .8s; }
@keyframes mailFloat { 50% { transform: translateY(-6px); } }
@keyframes mailSpark { 50% { opacity: .85; transform: translateY(-3px); } }
.verify-tip { margin: 0; font-size: .85rem; color: var(--muted); line-height: 1.5; text-align: center; }
@media (prefers-reduced-motion: reduce) { .mail-art, .mail-spark circle { animation: none; } }

/* letting go of a diary, or of the whole account */
.btn-danger { background: #b4533a; color: #fff6ef; border: 1px solid #a1472f; }
.btn-danger:hover { background: #a1472f; }
.pf-danger { border-color: #e7c4b7; }
.pf-danger h3 { color: #b4533a; }
.pf-danger form { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.pf-danger-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.sheet-danger { display: flex; justify-content: flex-start; margin-top: 4px; }

/* a page break: the rest of the sheet left blank on purpose */
.pbreak { position: relative; width: 100%; clear: both; user-select: none; }
.pbreak-line {
  position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 8px;
  border-top: 1px dashed rgba(140, 110, 80, .45); padding-top: 4px; font-size: .72rem; color: var(--muted);
  font-family: var(--sans); letter-spacing: .04em; text-transform: uppercase;
}
.pbreak-word { background: var(--paper, #fffdf8); padding: 0 6px; margin-top: -14px; }
.pbreak-x {
  margin-top: -14px; margin-left: auto; border: 0; background: var(--paper, #fffdf8); color: var(--muted);
  font-size: 1rem; line-height: 1; padding: 0 6px; cursor: pointer; border-radius: 6px;
}
.pbreak-x:hover { color: #b4533a; }

/* days still to come: open, but quieter than the ones already lived */
.cal-day.ahead { color: #bca893; }
.cal-day:not(.has):hover { background: var(--accent-soft); }

/* =========================================================
   RED WEB SET: a suit's web spun across the desk
   ========================================================= */
html[data-desk="crimson"] .diary,
html[data-desk="crimson"] .deskface {
  background-color: #3a0f16;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1920' height='1080' viewBox='0 0 1920 1080'%3E%3Cpath d='M300 790L2192 790M300 790L2116 1323M300 790L1892 1813M300 790L1539 2220M300 790L1086 2511M300 790L569 2663M300 790L31 2663M300 790L-486 2511M300 790L-939 2220M300 790L-1292 1813M300 790L-1516 1323M300 790L-1592 790M300 790L-1516 257M300 790L-1292 -233M300 790L-939 -640M300 790L-486 -931M300 790L31 -1083M300 790L569 -1083M300 790L1086 -931M300 790L1539 -640M300 790L1892 -233M300 790L2116 257M316.0 790.0Q313.3 791.9 315.4 794.5M315.4 794.5Q312.2 795.6 313.5 798.7M313.5 798.7Q310.2 798.8 310.5 802.1M310.5 802.1Q307.3 801.3 306.6 804.6M306.6 804.6Q303.8 802.9 302.3 805.8M302.3 805.8Q300.0 803.4 297.7 805.8M297.7 805.8Q296.2 802.9 293.4 804.6M293.4 804.6Q292.7 801.3 289.5 802.1M289.5 802.1Q289.8 798.8 286.5 798.7M286.5 798.7Q287.8 795.6 284.6 794.5M284.6 794.5Q286.7 791.9 284.0 790.0M284.0 790.0Q286.7 788.1 284.6 785.5M284.6 785.5Q287.8 784.4 286.5 781.3M286.5 781.3Q289.8 781.2 289.5 777.9M289.5 777.9Q292.7 778.7 293.4 775.4M293.4 775.4Q296.2 777.1 297.7 774.2M297.7 774.2Q300.0 776.6 302.3 774.2M302.3 774.2Q303.8 777.1 306.6 775.4M306.6 775.4Q307.3 778.7 310.5 777.9M310.5 777.9Q310.2 781.2 313.5 781.3M313.5 781.3Q312.2 784.4 315.4 785.5M315.4 785.5Q313.3 788.1 316.0 790.0M320.5 790.0Q317.0 792.4 319.7 795.8M319.7 795.8Q315.6 797.1 317.2 801.1M317.2 801.1Q313.0 801.3 313.4 805.5M313.4 805.5Q309.3 804.5 308.5 808.6M308.5 808.6Q304.8 806.5 302.9 810.3M302.9 810.3Q300.0 807.2 297.1 810.3M297.1 810.3Q295.2 806.5 291.5 808.6M291.5 808.6Q290.7 804.5 286.6 805.5M286.6 805.5Q287.0 801.3 282.8 801.1M282.8 801.1Q284.4 797.1 280.3 795.8M280.3 795.8Q283.0 792.4 279.5 790.0M279.5 790.0Q283.0 787.6 280.3 784.2M280.3 784.2Q284.4 782.9 282.8 778.9M282.8 778.9Q287.0 778.7 286.6 774.5M286.6 774.5Q290.7 775.5 291.5 771.4M291.5 771.4Q295.2 773.5 297.1 769.7M297.1 769.7Q300.0 772.8 302.9 769.7M302.9 769.7Q304.8 773.5 308.5 771.4M308.5 771.4Q309.3 775.5 313.4 774.5M313.4 774.5Q313.0 778.7 317.2 778.9M317.2 778.9Q315.6 782.9 319.7 784.2M319.7 784.2Q317.0 787.6 320.5 790.0M326.2 790.0Q321.8 793.1 325.2 797.4M325.2 797.4Q320.0 799.1 322.1 804.2M322.1 804.2Q316.6 804.4 317.2 809.8M317.2 809.8Q311.9 808.5 310.9 813.8M310.9 813.8Q306.2 811.1 303.7 815.9M303.7 815.9Q300.0 812.0 296.3 815.9M296.3 815.9Q293.8 811.1 289.1 813.8M289.1 813.8Q288.1 808.5 282.8 809.8M282.8 809.8Q283.4 804.4 277.9 804.2M277.9 804.2Q280.0 799.1 274.8 797.4M274.8 797.4Q278.2 793.1 273.8 790.0M273.8 790.0Q278.2 786.9 274.8 782.6M274.8 782.6Q280.0 780.9 277.9 775.8M277.9 775.8Q283.4 775.6 282.8 770.2M282.8 770.2Q288.1 771.5 289.1 766.2M289.1 766.2Q293.8 768.9 296.3 764.1M296.3 764.1Q300.0 768.0 303.7 764.1M303.7 764.1Q306.2 768.9 310.9 766.2M310.9 766.2Q311.9 771.5 317.2 770.2M317.2 770.2Q316.6 775.6 322.1 775.8M322.1 775.8Q320.0 780.9 325.2 782.6M325.2 782.6Q321.8 786.9 326.2 790.0M333.6 790.0Q327.9 794.0 332.2 799.5M332.2 799.5Q325.6 801.7 328.2 808.1M328.2 808.1Q321.3 808.5 322.0 815.4M322.0 815.4Q315.2 813.7 313.9 820.5M313.9 820.5Q307.9 817.0 304.8 823.2M304.8 823.2Q300.0 818.2 295.2 823.2M295.2 823.2Q292.1 817.0 286.1 820.5M286.1 820.5Q284.8 813.7 278.0 815.4M278.0 815.4Q278.7 808.5 271.8 808.1M271.8 808.1Q274.4 801.7 267.8 799.5M267.8 799.5Q272.1 794.0 266.4 790.0M266.4 790.0Q272.1 786.0 267.8 780.5M267.8 780.5Q274.4 778.3 271.8 771.9M271.8 771.9Q278.7 771.5 278.0 764.6M278.0 764.6Q284.8 766.3 286.1 759.5M286.1 759.5Q292.1 763.0 295.2 756.8M295.2 756.8Q300.0 761.8 304.8 756.8M304.8 756.8Q307.9 763.0 313.9 759.5M313.9 759.5Q315.2 766.3 322.0 764.6M322.0 764.6Q321.3 771.5 328.2 771.9M328.2 771.9Q325.6 778.3 332.2 780.5M332.2 780.5Q327.9 786.0 333.6 790.0M342.9 790.0Q335.7 795.1 341.2 802.1M341.2 802.1Q332.8 805.0 336.1 813.2M336.1 813.2Q327.3 813.6 328.1 822.5M328.1 822.5Q319.5 820.4 317.8 829.1M317.8 829.1Q310.2 824.6 306.1 832.5M306.1 832.5Q300.0 826.1 293.9 832.5M293.9 832.5Q289.8 824.6 282.2 829.1M282.2 829.1Q280.5 820.4 271.9 822.5M271.9 822.5Q272.7 813.6 263.9 813.2M263.9 813.2Q267.2 805.0 258.8 802.1M258.8 802.1Q264.3 795.1 257.1 790.0M257.1 790.0Q264.3 784.9 258.8 777.9M258.8 777.9Q267.2 775.0 263.9 766.8M263.9 766.8Q272.7 766.4 271.9 757.5M271.9 757.5Q280.5 759.6 282.2 750.9M282.2 750.9Q289.8 755.4 293.9 747.5M293.9 747.5Q300.0 753.9 306.1 747.5M306.1 747.5Q310.2 755.4 317.8 750.9M317.8 750.9Q319.5 759.6 328.1 757.5M328.1 757.5Q327.3 766.4 336.1 766.8M336.1 766.8Q332.8 775.0 341.2 777.9M341.2 777.9Q335.7 784.9 342.9 790.0M355.0 790.0Q345.7 796.6 352.7 805.5M352.7 805.5Q342.0 809.2 346.2 819.7M346.2 819.7Q334.9 820.2 336.0 831.5M336.0 831.5Q325.0 828.8 322.8 840.0M322.8 840.0Q313.0 834.3 307.8 844.4M307.8 844.4Q300.0 836.2 292.2 844.4M292.2 844.4Q287.0 834.3 277.2 840.0M277.2 840.0Q275.0 828.8 264.0 831.5M264.0 831.5Q265.1 820.2 253.8 819.7M253.8 819.7Q258.0 809.2 247.3 805.5M247.3 805.5Q254.3 796.6 245.0 790.0M245.0 790.0Q254.3 783.4 247.3 774.5M247.3 774.5Q258.0 770.8 253.8 760.3M253.8 760.3Q265.1 759.8 264.0 748.5M264.0 748.5Q275.0 751.2 277.2 740.0M277.2 740.0Q287.0 745.7 292.2 735.6M292.2 735.6Q300.0 743.8 307.8 735.6M307.8 735.6Q313.0 745.7 322.8 740.0M322.8 740.0Q325.0 751.2 336.0 748.5M336.0 748.5Q334.9 759.8 346.2 760.3M346.2 760.3Q342.0 770.8 352.7 774.5M352.7 774.5Q345.7 783.4 355.0 790.0M370.4 790.0Q358.5 798.4 367.5 809.8M367.5 809.8Q353.8 814.6 359.2 828.0M359.2 828.0Q344.7 828.7 346.1 843.2M346.1 843.2Q332.0 839.7 329.2 854.0M329.2 854.0Q316.7 846.7 310.0 859.7M310.0 859.7Q300.0 849.1 290.0 859.7M290.0 859.7Q283.3 846.7 270.8 854.0M270.8 854.0Q268.0 839.7 253.9 843.2M253.9 843.2Q255.3 828.7 240.8 828.0M240.8 828.0Q246.2 814.6 232.5 809.8M232.5 809.8Q241.5 798.4 229.6 790.0M229.6 790.0Q241.5 781.6 232.5 770.2M232.5 770.2Q246.2 765.4 240.8 752.0M240.8 752.0Q255.3 751.3 253.9 736.8M253.9 736.8Q268.0 740.3 270.8 726.0M270.8 726.0Q283.3 733.3 290.0 720.3M290.0 720.3Q300.0 730.9 310.0 720.3M310.0 720.3Q316.7 733.3 329.2 726.0M329.2 726.0Q332.0 740.3 346.1 736.8M346.1 736.8Q344.7 751.3 359.2 752.0M359.2 752.0Q353.8 765.4 367.5 770.2M367.5 770.2Q358.5 781.6 370.4 790.0M390.1 790.0Q374.9 800.8 386.4 815.4M386.4 815.4Q368.8 821.4 375.8 838.7M375.8 838.7Q357.2 839.5 359.0 858.1M359.0 858.1Q340.9 853.6 337.4 871.9M337.4 871.9Q321.3 862.6 312.8 879.2M312.8 879.2Q300.0 865.7 287.2 879.2M287.2 879.2Q278.7 862.6 262.6 871.9M262.6 871.9Q259.1 853.6 241.0 858.1M241.0 858.1Q242.8 839.5 224.2 838.7M224.2 838.7Q231.2 821.4 213.6 815.4M213.6 815.4Q225.1 800.8 209.9 790.0M209.9 790.0Q225.1 779.2 213.6 764.6M213.6 764.6Q231.2 758.6 224.2 741.3M224.2 741.3Q242.8 740.5 241.0 721.9M241.0 721.9Q259.1 726.4 262.6 708.1M262.6 708.1Q278.7 717.4 287.2 700.8M287.2 700.8Q300.0 714.3 312.8 700.8M312.8 700.8Q321.3 717.4 337.4 708.1M337.4 708.1Q340.9 726.4 359.0 721.9M359.0 721.9Q357.2 740.5 375.8 741.3M375.8 741.3Q368.8 758.6 386.4 764.6M386.4 764.6Q374.9 779.2 390.1 790.0M415.3 790.0Q395.9 803.8 410.6 822.5M410.6 822.5Q388.1 830.2 397.0 852.3M397.0 852.3Q373.2 853.4 375.5 877.1M375.5 877.1Q352.4 871.5 347.9 894.9M347.9 894.9Q327.3 882.9 316.4 904.1M316.4 904.1Q300.0 886.8 283.6 904.1M283.6 904.1Q272.7 882.9 252.1 894.9M252.1 894.9Q247.6 871.5 224.5 877.1M224.5 877.1Q226.8 853.4 203.0 852.3M203.0 852.3Q211.9 830.2 189.4 822.5M189.4 822.5Q204.1 803.8 184.7 790.0M184.7 790.0Q204.1 776.2 189.4 757.5M189.4 757.5Q211.9 749.8 203.0 727.7M203.0 727.7Q226.8 726.6 224.5 702.9M224.5 702.9Q247.6 708.5 252.1 685.1M252.1 685.1Q272.7 697.1 283.6 675.9M283.6 675.9Q300.0 693.2 316.4 675.9M316.4 675.9Q327.3 697.1 347.9 685.1M347.9 685.1Q352.4 708.5 375.5 702.9M375.5 702.9Q373.2 726.6 397.0 727.7M397.0 727.7Q388.1 749.8 410.6 757.5M410.6 757.5Q395.9 776.2 415.3 790.0M447.6 790.0Q422.7 807.6 441.6 831.6M441.6 831.6Q412.8 841.5 424.1 869.8M424.1 869.8Q393.7 871.2 396.6 901.5M396.6 901.5Q367.0 894.3 361.3 924.2M361.3 924.2Q334.9 908.9 321.0 936.1M321.0 936.1Q300.0 914.0 279.0 936.1M279.0 936.1Q265.1 908.9 238.7 924.2M238.7 924.2Q233.0 894.3 203.4 901.5M203.4 901.5Q206.3 871.2 175.9 869.8M175.9 869.8Q187.2 841.5 158.4 831.6M158.4 831.6Q177.3 807.6 152.4 790.0M152.4 790.0Q177.3 772.4 158.4 748.4M158.4 748.4Q187.2 738.5 175.9 710.2M175.9 710.2Q206.3 708.8 203.4 678.5M203.4 678.5Q233.0 685.7 238.7 655.8M238.7 655.8Q265.1 671.1 279.0 643.9M279.0 643.9Q300.0 666.0 321.0 643.9M321.0 643.9Q334.9 671.1 361.3 655.8M361.3 655.8Q367.0 685.7 396.6 678.5M396.6 678.5Q393.7 708.8 424.1 710.2M424.1 710.2Q412.8 738.5 441.6 748.4M441.6 748.4Q422.7 772.4 447.6 790.0M488.9 790.0Q457.1 812.6 481.2 843.2M481.2 843.2Q444.3 855.9 458.9 892.1M458.9 892.1Q419.9 893.9 423.7 932.8M423.7 932.8Q385.8 923.5 378.5 961.8M378.5 961.8Q344.7 942.2 326.9 977.0M326.9 977.0Q300.0 948.7 273.1 977.0M273.1 977.0Q255.3 942.2 221.5 961.8M221.5 961.8Q214.2 923.5 176.3 932.8M176.3 932.8Q180.1 893.9 141.1 892.1M141.1 892.1Q155.7 855.9 118.8 843.2M118.8 843.2Q142.9 812.6 111.1 790.0M111.1 790.0Q142.9 767.4 118.8 736.8M118.8 736.8Q155.7 724.1 141.1 687.9M141.1 687.9Q180.1 686.1 176.3 647.2M176.3 647.2Q214.2 656.5 221.5 618.2M221.5 618.2Q255.3 637.8 273.1 603.0M273.1 603.0Q300.0 631.3 326.9 603.0M326.9 603.0Q344.7 637.8 378.5 618.2M378.5 618.2Q385.8 656.5 423.7 647.2M423.7 647.2Q419.9 686.1 458.9 687.9M458.9 687.9Q444.3 724.1 481.2 736.8M481.2 736.8Q457.1 767.4 488.9 790.0M541.8 790.0Q501.0 818.9 532.0 858.1M532.0 858.1Q484.7 874.4 503.4 920.7M503.4 920.7Q453.5 923.0 458.3 972.7M458.3 972.7Q409.8 960.9 400.4 1009.9M400.4 1009.9Q357.2 984.9 334.4 1029.3M334.4 1029.3Q300.0 993.1 265.6 1029.3M265.6 1029.3Q242.8 984.9 199.6 1009.9M199.6 1009.9Q190.2 960.9 141.7 972.7M141.7 972.7Q146.5 923.0 96.6 920.7M96.6 920.7Q115.3 874.4 68.0 858.1M68.0 858.1Q99.0 818.9 58.2 790.0M58.2 790.0Q99.0 761.1 68.0 721.9M68.0 721.9Q115.3 705.6 96.6 659.3M96.6 659.3Q146.5 657.0 141.7 607.3M141.7 607.3Q190.2 619.1 199.6 570.1M199.6 570.1Q242.8 595.1 265.6 550.7M265.6 550.7Q300.0 586.9 334.4 550.7M334.4 550.7Q357.2 595.1 400.4 570.1M400.4 570.1Q409.8 619.1 458.3 607.3M458.3 607.3Q453.5 657.0 503.4 659.3M503.4 659.3Q484.7 705.6 532.0 721.9M532.0 721.9Q501.0 761.1 541.8 790.0M609.5 790.0Q557.3 827.0 596.9 877.2M596.9 877.2Q536.5 898.0 560.4 957.3M560.4 957.3Q496.5 960.2 502.7 1023.9M502.7 1023.9Q440.5 1008.7 428.6 1071.5M428.6 1071.5Q373.2 1039.4 344.0 1096.3M344.0 1096.3Q300.0 1050.0 256.0 1096.3M256.0 1096.3Q226.8 1039.4 171.4 1071.5M171.4 1071.5Q159.5 1008.7 97.3 1023.9M97.3 1023.9Q103.5 960.2 39.6 957.3M39.6 957.3Q63.5 898.0 3.1 877.2M3.1 877.2Q42.7 827.0 -9.5 790.0M-9.5 790.0Q42.7 753.0 3.1 702.8M3.1 702.8Q63.5 682.0 39.6 622.7M39.6 622.7Q103.5 619.8 97.3 556.1M97.3 556.1Q159.5 571.3 171.4 508.5M171.4 508.5Q226.8 540.6 256.0 483.7M256.0 483.7Q300.0 530.0 344.0 483.7M344.0 483.7Q373.2 540.6 428.6 508.5M428.6 508.5Q440.5 571.3 502.7 556.1M502.7 556.1Q496.5 619.8 560.4 622.7M560.4 622.7Q536.5 682.0 596.9 702.8M596.9 702.8Q557.3 753.0 609.5 790.0M696.1 790.0Q629.4 837.4 680.1 901.6M680.1 901.6Q602.7 928.2 633.3 1004.2M633.3 1004.2Q551.5 1007.9 559.4 1089.4M559.4 1089.4Q479.9 1069.9 464.6 1150.3M464.6 1150.3Q393.7 1109.3 356.4 1182.1M356.4 1182.1Q300.0 1122.8 243.6 1182.1M243.6 1182.1Q206.3 1109.3 135.4 1150.3M135.4 1150.3Q120.1 1069.9 40.6 1089.4M40.6 1089.4Q48.5 1007.9 -33.3 1004.2M-33.3 1004.2Q-2.7 928.2 -80.1 901.6M-80.1 901.6Q-29.4 837.4 -96.1 790.0M-96.1 790.0Q-29.4 742.6 -80.1 678.4M-80.1 678.4Q-2.7 651.8 -33.3 575.8M-33.3 575.8Q48.5 572.1 40.6 490.6M40.6 490.6Q120.1 510.1 135.4 429.7M135.4 429.7Q206.3 470.7 243.6 397.9M243.6 397.9Q300.0 457.2 356.4 397.9M356.4 397.9Q393.7 470.7 464.6 429.7M464.6 429.7Q479.9 510.1 559.4 490.6M559.4 490.6Q551.5 572.1 633.3 575.8M633.3 575.8Q602.7 651.8 680.1 678.4M680.1 678.4Q629.4 742.6 696.1 790.0M807.1 790.0Q721.6 850.6 786.5 932.9M786.5 932.9Q687.4 966.9 726.6 1064.1M726.6 1064.1Q621.9 1068.9 632.1 1173.2M632.1 1173.2Q530.3 1148.3 510.6 1251.2M510.6 1251.2Q420.0 1198.7 372.2 1291.9M372.2 1291.9Q300.0 1215.9 227.8 1291.9M227.8 1291.9Q180.0 1198.7 89.4 1251.2M89.4 1251.2Q69.7 1148.3 -32.1 1173.2M-32.1 1173.2Q-21.9 1068.9 -126.6 1064.1M-126.6 1064.1Q-87.4 966.9 -186.5 932.9M-186.5 932.9Q-121.6 850.6 -207.1 790.0M-207.1 790.0Q-121.6 729.4 -186.5 647.1M-186.5 647.1Q-87.4 613.1 -126.6 515.9M-126.6 515.9Q-21.9 511.1 -32.1 406.8M-32.1 406.8Q69.7 431.7 89.4 328.8M89.4 328.8Q180.0 381.3 227.8 288.1M227.8 288.1Q300.0 364.1 372.2 288.1M372.2 288.1Q420.0 381.3 510.6 328.8M510.6 328.8Q530.3 431.7 632.1 406.8M632.1 406.8Q621.9 511.1 726.6 515.9M726.6 515.9Q687.4 613.1 786.5 647.1M786.5 647.1Q721.6 729.4 807.1 790.0M949.0 790.0Q839.6 867.6 922.7 972.9M922.7 972.9Q795.9 1016.5 846.0 1140.9M846.0 1140.9Q712.0 1147.0 725.0 1280.5M725.0 1280.5Q594.8 1248.6 569.6 1380.4M569.6 1380.4Q453.6 1313.1 392.4 1432.4M392.4 1432.4Q300.0 1335.2 207.6 1432.4M207.6 1432.4Q146.4 1313.1 30.4 1380.4M30.4 1380.4Q5.2 1248.6 -125.0 1280.5M-125.0 1280.5Q-112.0 1147.0 -246.0 1140.9M-246.0 1140.9Q-195.9 1016.5 -322.7 972.9M-322.7 972.9Q-239.6 867.6 -349.0 790.0M-349.0 790.0Q-239.6 712.4 -322.7 607.1M-322.7 607.1Q-195.9 563.5 -246.0 439.1M-246.0 439.1Q-112.0 433.0 -125.0 299.5M-125.0 299.5Q5.2 331.4 30.4 199.6M30.4 199.6Q146.4 266.9 207.6 147.6M207.6 147.6Q300.0 244.8 392.4 147.6M392.4 147.6Q453.6 266.9 569.6 199.6M569.6 199.6Q594.8 331.4 725.0 299.5M725.0 299.5Q712.0 433.0 846.0 439.1M846.0 439.1Q795.9 563.5 922.7 607.1M922.7 607.1Q839.6 712.4 949.0 790.0M1130.8 790.0Q990.7 889.3 1097.1 1024.1M1097.1 1024.1Q934.8 1079.9 998.9 1239.1M998.9 1239.1Q827.4 1247.0 844.0 1417.9M844.0 1417.9Q677.3 1377.1 645.1 1545.7M645.1 1545.7Q496.6 1459.6 418.2 1612.3M418.2 1612.3Q300.0 1487.8 181.8 1612.3M181.8 1612.3Q103.4 1459.6 -45.1 1545.7M-45.1 1545.7Q-77.3 1377.1 -244.0 1417.9M-244.0 1417.9Q-227.4 1247.0 -398.9 1239.1M-398.9 1239.1Q-334.8 1079.9 -497.1 1024.1M-497.1 1024.1Q-390.7 889.3 -530.8 790.0M-530.8 790.0Q-390.7 690.7 -497.1 555.9M-497.1 555.9Q-334.8 500.1 -398.9 340.9M-398.9 340.9Q-227.4 333.0 -244.0 162.1M-244.0 162.1Q-77.3 202.9 -45.1 34.3M-45.1 34.3Q103.4 120.4 181.8 -32.3M181.8 -32.3Q300.0 92.2 418.2 -32.3M418.2 -32.3Q496.6 120.4 645.1 34.3M645.1 34.3Q677.3 202.9 844.0 162.1M844.0 162.1Q827.4 333.0 998.9 340.9M998.9 340.9Q934.8 500.1 1097.1 555.9M1097.1 555.9Q990.7 690.7 1130.8 790.0M1363.4 790.0Q1184.1 917.1 1320.3 1089.6M1320.3 1089.6Q1112.5 1161.1 1194.6 1364.9M1194.6 1364.9Q975.1 1374.9 996.4 1593.7M996.4 1593.7Q782.9 1541.4 741.7 1757.3M741.7 1757.3Q551.7 1647.1 451.3 1842.6M451.3 1842.6Q300.0 1683.2 148.7 1842.6M148.7 1842.6Q48.3 1647.1 -141.7 1757.3M-141.7 1757.3Q-182.9 1541.4 -396.4 1593.7M-396.4 1593.7Q-375.1 1374.9 -594.6 1364.9M-594.6 1364.9Q-512.5 1161.1 -720.3 1089.6M-720.3 1089.6Q-584.1 917.1 -763.4 790.0M-763.4 790.0Q-584.1 662.9 -720.3 490.4M-720.3 490.4Q-512.5 418.9 -594.6 215.1M-594.6 215.1Q-375.1 205.1 -396.4 -13.7M-396.4 -13.7Q-182.9 38.6 -141.7 -177.3M-141.7 -177.3Q48.3 -67.1 148.7 -262.6M148.7 -262.6Q300.0 -103.2 451.3 -262.6M451.3 -262.6Q551.7 -67.1 741.7 -177.3M741.7 -177.3Q782.9 38.6 996.4 -13.7M996.4 -13.7Q975.1 205.1 1194.6 215.1M1194.6 215.1Q1112.5 418.9 1320.3 490.4M1320.3 490.4Q1184.1 662.9 1363.4 790.0M1661.1 790.0Q1431.7 952.7 1606.0 1173.5M1606.0 1173.5Q1340.0 1265.0 1445.1 1525.9M1445.1 1525.9Q1164.1 1538.7 1191.4 1818.7M1191.4 1818.7Q918.1 1751.8 865.4 2028.1M865.4 2028.1Q622.1 1887.0 493.7 2137.3M493.7 2137.3Q300.0 1933.3 106.3 2137.3M106.3 2137.3Q-22.1 1887.0 -265.4 2028.1M-265.4 2028.1Q-318.1 1751.8 -591.4 1818.7M-591.4 1818.7Q-564.1 1538.7 -845.1 1525.9M-845.1 1525.9Q-740.0 1265.0 -1006.0 1173.5M-1006.0 1173.5Q-831.7 952.7 -1061.1 790.0M-1061.1 790.0Q-831.7 627.3 -1006.0 406.5M-1006.0 406.5Q-740.0 315.0 -845.1 54.1M-845.1 54.1Q-564.1 41.3 -591.4 -238.7M-591.4 -238.7Q-318.1 -171.8 -265.4 -448.1M-265.4 -448.1Q-22.1 -307.0 106.3 -557.3M106.3 -557.3Q300.0 -353.3 493.7 -557.3M493.7 -557.3Q622.1 -307.0 865.4 -448.1M865.4 -448.1Q918.1 -171.8 1191.4 -238.7M1191.4 -238.7Q1164.1 41.3 1445.1 54.1M1445.1 54.1Q1340.0 315.0 1606.0 406.5M1606.0 406.5Q1431.7 627.3 1661.1 790.0M2042.2 790.0Q1748.6 998.3 1971.7 1280.8M1971.7 1280.8Q1631.2 1398.0 1765.7 1731.9M1765.7 1731.9Q1406.0 1748.4 1440.9 2106.7M1440.9 2106.7Q1091.2 2021.2 1023.8 2374.8M1023.8 2374.8Q712.3 2194.2 547.9 2514.5M547.9 2514.5Q300.0 2253.5 52.1 2514.5M52.1 2514.5Q-112.3 2194.2 -423.8 2374.8M-423.8 2374.8Q-491.2 2021.2 -840.9 2106.7M-840.9 2106.7Q-806.0 1748.4 -1165.7 1731.9M-1165.7 1731.9Q-1031.2 1398.0 -1371.7 1280.8M-1371.7 1280.8Q-1148.6 998.3 -1442.2 790.0M-1442.2 790.0Q-1148.6 581.7 -1371.7 299.2M-1371.7 299.2Q-1031.2 182.0 -1165.7 -151.9M-1165.7 -151.9Q-806.0 -168.4 -840.9 -526.7M-840.9 -526.7Q-491.2 -441.2 -423.8 -794.8M-423.8 -794.8Q-112.3 -614.2 52.1 -934.5M52.1 -934.5Q300.0 -673.5 547.9 -934.5M547.9 -934.5Q712.3 -614.2 1023.8 -794.8M1023.8 -794.8Q1091.2 -441.2 1440.9 -526.7M1440.9 -526.7Q1406.0 -168.4 1765.7 -151.9M1765.7 -151.9Q1631.2 182.0 1971.7 299.2M1971.7 299.2Q1748.6 581.7 2042.2 790.0' fill='none' stroke='%231d050a' stroke-width='2.0' stroke-linecap='round' opacity='0.55'/%3E%3C/svg%3E"),
    radial-gradient(900px 620px at 50% 12%, rgba(255, 180, 160, .16), transparent 70%),
    radial-gradient(ellipse at 50% 50%, transparent 46%, rgba(10, 2, 8, .6) 100%),
    radial-gradient(760px 520px at 90% 98%, rgba(24, 44, 116, .42), transparent 72%),
    repeating-linear-gradient(178deg, rgba(0, 0, 0, .06) 0 3px, transparent 3px 13px),
    linear-gradient(170deg, #71181f, #3a0f16 62%, #2c0a11);
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, repeat, no-repeat;
  background-position: center, center, center, center, center, center;
  background-size: cover, auto, auto, auto, auto, auto;
}
.desk-crimson .theme-swatch {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cpath d='M88 62L201 62M88 62L190 111M88 62L158 150M88 62L113 172M88 62L63 172M88 62L18 150M88 62L-14 111M88 62L-25 62M88 62L-14 13M88 62L18 -26M88 62L63 -48M88 62L113 -48M88 62L158 -26M88 62L190 13M93.0 62.0Q92.1 62.9 92.5 64.2M92.5 64.2Q91.3 64.6 91.1 65.9M91.1 65.9Q89.8 65.8 89.1 66.9M89.1 66.9Q88.0 66.2 86.9 66.9M86.9 66.9Q86.2 65.8 84.9 65.9M84.9 65.9Q84.7 64.6 83.5 64.2M83.5 64.2Q83.9 62.9 83.0 62.0M83.0 62.0Q83.9 61.1 83.5 59.8M83.5 59.8Q84.7 59.4 84.9 58.1M84.9 58.1Q86.2 58.2 86.9 57.1M86.9 57.1Q88.0 57.8 89.1 57.1M89.1 57.1Q89.8 58.2 91.1 58.1M91.1 58.1Q91.3 59.4 92.5 59.8M92.5 59.8Q92.1 61.1 93.0 62.0M95.1 62.0Q93.8 63.3 94.4 65.1M94.4 65.1Q92.7 65.7 92.4 67.6M92.4 67.6Q90.6 67.4 89.6 68.9M89.6 68.9Q88.0 68.0 86.4 68.9M86.4 68.9Q85.4 67.4 83.6 67.6M83.6 67.6Q83.3 65.7 81.6 65.1M81.6 65.1Q82.2 63.3 80.9 62.0M80.9 62.0Q82.2 60.7 81.6 58.9M81.6 58.9Q83.3 58.3 83.6 56.4M83.6 56.4Q85.4 56.6 86.4 55.1M86.4 55.1Q88.0 56.0 89.6 55.1M89.6 55.1Q90.6 56.6 92.4 56.4M92.4 56.4Q92.7 58.3 94.4 58.9M94.4 58.9Q93.8 60.7 95.1 62.0M98.1 62.0Q96.3 63.9 97.1 66.4M97.1 66.4Q94.6 67.3 94.3 69.9M94.3 69.9Q91.7 69.6 90.2 71.8M90.2 71.8Q88.0 70.5 85.8 71.8M85.8 71.8Q84.3 69.6 81.7 69.9M81.7 69.9Q81.4 67.3 78.9 66.4M78.9 66.4Q79.7 63.9 77.9 62.0M77.9 62.0Q79.7 60.1 78.9 57.6M78.9 57.6Q81.4 56.7 81.7 54.1M81.7 54.1Q84.3 54.4 85.8 52.2M85.8 52.2Q88.0 53.5 90.2 52.2M90.2 52.2Q91.7 54.4 94.3 54.1M94.3 54.1Q94.6 56.7 97.1 57.6M97.1 57.6Q96.3 60.1 98.1 62.0M102.3 62.0Q99.7 64.7 100.9 68.2M100.9 68.2Q97.4 69.5 96.9 73.2M96.9 73.2Q93.2 72.8 91.2 76.0M91.2 76.0Q88.0 74.0 84.8 76.0M84.8 76.0Q82.8 72.8 79.1 73.2M79.1 73.2Q78.6 69.5 75.1 68.2M75.1 68.2Q76.3 64.7 73.7 62.0M73.7 62.0Q76.3 59.3 75.1 55.8M75.1 55.8Q78.6 54.5 79.1 50.8M79.1 50.8Q82.8 51.2 84.8 48.0M84.8 48.0Q88.0 50.0 91.2 48.0M91.2 48.0Q93.2 51.2 96.9 50.8M96.9 50.8Q97.4 54.5 100.9 55.8M100.9 55.8Q99.7 59.3 102.3 62.0M108.3 62.0Q104.6 65.8 106.3 70.8M106.3 70.8Q101.4 72.6 100.7 77.9M100.7 77.9Q95.4 77.4 92.5 81.8M92.5 81.8Q88.0 79.1 83.5 81.8M83.5 81.8Q80.6 77.4 75.3 77.9M75.3 77.9Q74.6 72.6 69.7 70.8M69.7 70.8Q71.4 65.8 67.7 62.0M67.7 62.0Q71.4 58.2 69.7 53.2M69.7 53.2Q74.6 51.4 75.3 46.1M75.3 46.1Q80.6 46.6 83.5 42.2M83.5 42.2Q88.0 44.9 92.5 42.2M92.5 42.2Q95.4 46.6 100.7 46.1M100.7 46.1Q101.4 51.4 106.3 53.2M106.3 53.2Q104.6 58.2 108.3 62.0M116.9 62.0Q111.6 67.4 114.0 74.5M114.0 74.5Q107.0 77.1 106.0 84.6M106.0 84.6Q98.5 83.8 94.4 90.1M94.4 90.1Q88.0 86.2 81.6 90.1M81.6 90.1Q77.5 83.8 70.0 84.6M70.0 84.6Q69.0 77.1 62.0 74.5M62.0 74.5Q64.4 67.4 59.1 62.0M59.1 62.0Q64.4 56.6 62.0 49.5M62.0 49.5Q69.0 46.9 70.0 39.4M70.0 39.4Q77.5 40.2 81.6 33.9M81.6 33.9Q88.0 37.8 94.4 33.9M94.4 33.9Q98.5 40.2 106.0 39.4M106.0 39.4Q107.0 46.9 114.0 49.5M114.0 49.5Q111.6 56.6 116.9 62.0M129.0 62.0Q121.6 69.7 124.9 79.8M124.9 79.8Q114.9 83.5 113.6 94.0M113.6 94.0Q102.9 93.0 97.1 102.0M97.1 102.0Q88.0 96.4 78.9 102.0M78.9 102.0Q73.1 93.0 62.4 94.0M62.4 94.0Q61.1 83.5 51.1 79.8M51.1 79.8Q54.4 69.7 47.0 62.0M47.0 62.0Q54.4 54.3 51.1 44.2M51.1 44.2Q61.1 40.5 62.4 30.0M62.4 30.0Q73.1 31.0 78.9 22.0M78.9 22.0Q88.0 27.6 97.1 22.0M97.1 22.0Q102.9 31.0 113.6 30.0M113.6 30.0Q114.9 40.5 124.9 44.2M124.9 44.2Q121.6 54.3 129.0 62.0M146.2 62.0Q135.7 72.9 140.4 87.3M140.4 87.3Q126.2 92.5 124.3 107.5M124.3 107.5Q109.2 106.1 101.0 118.7M101.0 118.7Q88.0 110.9 75.0 118.7M75.0 118.7Q66.8 106.1 51.7 107.5M51.7 107.5Q49.8 92.5 35.6 87.3M35.6 87.3Q40.3 72.9 29.8 62.0M29.8 62.0Q40.3 51.1 35.6 36.7M35.6 36.7Q49.8 31.5 51.7 16.5M51.7 16.5Q66.8 17.9 75.0 5.3M75.0 5.3Q88.0 13.1 101.0 5.3M101.0 5.3Q109.2 17.9 124.3 16.5M124.3 16.5Q126.2 31.5 140.4 36.7M140.4 36.7Q135.7 51.1 146.2 62.0M170.7 62.0Q155.7 77.4 162.5 97.9M162.5 97.9Q142.3 105.3 139.5 126.6M139.5 126.6Q118.1 124.6 106.4 142.6M106.4 142.6Q88.0 131.4 69.6 142.6M69.6 142.6Q57.9 124.6 36.5 126.6M36.5 126.6Q33.7 105.3 13.5 97.9M13.5 97.9Q20.3 77.4 5.3 62.0M5.3 62.0Q20.3 46.6 13.5 26.1M13.5 26.1Q33.7 18.7 36.5 -2.6M36.5 -2.6Q57.9 -0.6 69.6 -18.6M69.6 -18.6Q88.0 -7.4 106.4 -18.6M106.4 -18.6Q118.1 -0.6 139.5 -2.6M139.5 -2.6Q142.3 18.7 162.5 26.1M162.5 26.1Q155.7 46.6 170.7 62.0' fill='none' stroke='%23200609' stroke-width='1.1' stroke-linecap='round' opacity='0.65'/%3E%3C/svg%3E"), linear-gradient(170deg, #7d1a24, #3a0f16);
  background-repeat: no-repeat, no-repeat;
  background-position: center, center;
  background-size: cover, auto;
}

/* the page keeps the colours of the set, and nothing in the way of the writing */
html[data-paper="web"] { --paper: #fff4f2; --rule: rgba(176, 36, 48, .28); --margin: rgba(32, 56, 128, .5); }
html[data-paper="web"] .paper,
html[data-paper="web"] .paperface {
  background-image: linear-gradient(90deg, rgba(32, 56, 128, .16), transparent 30px);
  background-repeat: no-repeat;
}
.paper-web .theme-swatch {
  background:
    linear-gradient(90deg, transparent 17px, rgba(32, 56, 128, .55) 17px 18.5px, transparent 18.5px),
    repeating-linear-gradient(180deg, #fff4f2 0 11px, rgba(176, 36, 48, .4) 11px 12px);
}

/* pick any colour at all for a cover */
.swatch-any {
  background:
    conic-gradient(#ff2d2d, #ffd12d, #37d67a, #2dc6ff, #6b4bff, #ff2dbf, #ff2d2d);
  position: relative;
}
.swatch-any::after {
  content: ""; position: absolute; inset: 30%; border-radius: 50%; background: var(--card);
  box-shadow: inset 0 1px 2px rgba(60, 40, 25, .25);
}
.cpick { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; max-width: 260px; }
.cp-sv {
  position: relative; height: 120px; border-radius: 12px; cursor: crosshair; touch-action: none;
  background:
    linear-gradient(180deg, transparent, #000),
    linear-gradient(90deg, #fff, var(--hue, #ff0000));
  box-shadow: inset 0 0 0 1px rgba(60, 40, 25, .18);
}
.cp-hue {
  position: relative; height: 16px; border-radius: 10px; cursor: pointer; touch-action: none;
  background: linear-gradient(90deg, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000);
  box-shadow: inset 0 0 0 1px rgba(60, 40, 25, .18);
}
.cp-dot, .cp-bar { position: absolute; pointer-events: none; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .35); }
.cp-dot { width: 14px; height: 14px; transform: translate(-50%, -50%); }
.cp-bar { width: 14px; height: 20px; top: -2px; border-radius: 7px; transform: translateX(-50%); }
.cp-row { display: flex; align-items: center; gap: 10px; }
.cp-prev { width: 34px; height: 34px; border-radius: 10px; flex: none; box-shadow: inset 0 0 0 1px rgba(60, 40, 25, .2); }
.cp-row input {
  flex: 1; min-width: 0; font-family: var(--sans); font-size: .95rem; padding: 9px 12px;
  border: 1px solid #e7d7c2; border-radius: 10px; background: #fffdf9; color: var(--ink);
}

/* an eye in the corner of every password box */
.pass-box { position: relative; display: block; }
.pass-box input { width: 100%; padding-right: 46px !important; }
.eye-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; display: grid; place-items: center; padding: 0;
  border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 9px;
}
.eye-btn svg { width: 20px; height: 20px; }
.eye-btn:hover { color: var(--accent); background: rgba(139, 90, 60, .08); }
.eye-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.narrow-sheet { width: min(420px, calc(100vw - 24px)); }
.narrow-sheet .sheet-inner { gap: 14px; }


/* =========================================================
   HOME v4: the banner, the shelf, and nothing else
   ========================================================= */
.main.home { display: block; max-width: 1240px; padding: 18px 30px 40px; }
.library { margin-top: 30px; }
.home-foot { margin: 36px 0 0; text-align: center; border: 0; }

.streak-pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px; border-radius: 99px;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
  font-size: .9rem; font-weight: 700; color: var(--ink); white-space: nowrap;
}
.streak-pill b { font-weight: 800; }
.streak-pill .crown { width: 17px; height: 17px; fill: #f2bd3f; stroke: #c9901c; stroke-width: 1.4; }
@media (max-width: 560px) { .streak-pill { display: none; } }

.cal-pop { width: 318px; padding: 14px 16px 12px; }
.cal-pop .cal-grid { gap: 3px; }
.cal-stats {
  display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; padding-top: 10px;
  border-top: 1px dashed var(--line); font-size: .78rem; color: var(--ink-2); font-weight: 600;
}
.cal-stats b { font-family: var(--serif); font-size: 1.05rem; color: var(--accent); margin-right: 5px; }

/* the coming soon card floats in the corner now that the side panel has gone */
.soon-card { position: fixed; right: 20px; bottom: 20px; width: 288px; z-index: 30; margin: 0; }
.soon-card .soon-head { margin-top: 14px; }
@media (max-width: 820px) { .soon-card { position: static; width: auto; margin: 0 16px 24px; } }
@media (max-width: 900px) { .main.home { padding: 14px 16px 30px; } }

/* =========================================================
   EDIT A DIARY: the cover on the left, everything else on the right
   ========================================================= */
.sheet.wide { width: min(840px, calc(100vw - 24px)); }
.book-cols { display: grid; grid-template-columns: 248px minmax(0, 1fr); gap: 26px; align-items: start; }
.pv-col { display: flex; flex-direction: column; align-items: center; padding-top: 6px; }
.book-cols .preview-book {
  width: 200px; --w: 200px;
  filter: drop-shadow(0 26px 26px rgba(90, 55, 25, .3));
  animation: bookFloat 6s ease-in-out infinite;
}
@keyframes bookFloat {
  0%, 100% { transform: rotate(-6deg) translateY(0); }
  50% { transform: rotate(-6deg) translateY(-12px); }
}
.pv-note { margin: 26px 0 0; font-size: .76rem; line-height: 1.5; color: var(--muted); text-align: center; max-width: 210px; }
.bk-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.field.bare { gap: 0; }
.field.bare input { width: 100%; }
.bk-photo { display: flex; gap: 10px; }
.bk-photo .btn { flex: 1; justify-content: space-between; padding: 11px 14px; font-size: .9rem; }
.bk-photo .btn:disabled { opacity: .45; cursor: default; }
.bk-group { border-top: 1px solid var(--line); padding-top: 13px; }
.bk-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.bk-label { font-size: .84rem; font-weight: 700; color: var(--ink-2); }
.bk-head .link-btn { font-size: .82rem; font-weight: 700; }
.bk-group .choices { gap: 9px; }
.bk-group .swatch, .bk-group .motif-opt { width: 34px; height: 34px; }
.bk-group .motif-opt svg { width: 20px; height: 20px; }
.mini-themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mini-themes .theme-tile { background: #fffdf9; border-color: var(--line); }
.mini-themes .theme-swatch { height: 42px; }
.mini-themes .theme-name { font-size: .72rem; text-align: center; padding: 0 0 2px; }
.sheet-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 16px; }
.foot-right { display: flex; gap: 10px; margin-left: auto; }
@media (max-width: 720px) {
  .book-cols { grid-template-columns: 1fr; }
  .pv-note { max-width: none; }
}

/* =========================================================
   THE THEME PAGE: your diary floating on what you picked
   ========================================================= */
.theme-sheet { width: min(960px, calc(100vw - 24px)); }
.ts-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; }
.ts-stage {
  position: relative; min-height: 350px; border-radius: 20px; overflow: hidden;
  display: grid; place-items: center; box-shadow: inset 0 0 60px rgba(0, 0, 0, .3);
}
.ts-float { animation: tsFloat 5.5s ease-in-out infinite; }
@keyframes tsFloat { 0%, 100% { transform: translateY(6px); } 50% { transform: translateY(-12px); } }
.ts-float .preview-book { width: 168px; --w: 168px; transform: rotate(-5deg); filter: drop-shadow(0 30px 24px rgba(0, 0, 0, .45)); }
.ts-paper {
  --lh: 24px; width: 236px; height: 306px; border-radius: 4px 8px 8px 4px;
  background-color: var(--paper);
  background-image: repeating-linear-gradient(180deg, transparent 0 calc(var(--lh) - 1px), var(--rule) calc(var(--lh) - 1px) var(--lh));
  box-shadow: 0 30px 50px -22px rgba(0, 0, 0, .65), inset 14px 0 18px -16px rgba(90, 60, 30, .45);
}
.ts-side .theme-grid { grid-template-columns: repeat(2, 1fr); max-height: 350px; overflow: auto; padding-right: 2px; }
.ts-side .theme-tile { background: #fffdf9; border-color: var(--line); }
@media (max-width: 760px) {
  .ts-body { grid-template-columns: 1fr; }
  .ts-stage { min-height: 260px; }
  .ts-side .theme-grid { max-height: none; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .book-cols .preview-book { animation: none; transform: rotate(-6deg); }
  .ts-float { animation: none; }
}

/* the desk a preview sits on: the oak one, straight from the open diary */
.deskface {
  background-color: #c99c6c;
  background-image:
    radial-gradient(1100px 760px at 50% 18%, rgba(255, 238, 205, .55), transparent 70%),
    radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(90, 52, 24, .32) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='300'%3E%3Cfilter id='w'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.0035 .09' numOctaves='3' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .27 0 0 0 0 .12 0 0 0 -1.1 .62'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23w)'/%3E%3C/svg%3E"),
    repeating-linear-gradient(180deg, transparent 0 238px, rgba(95, 55, 25, .22) 238px 240px, transparent 240px 241px),
    linear-gradient(180deg, #d4aa7b, #c3935f);
}

/* the one you picked, marked plainly, in both theme rows and on the theme page */
.mini-themes .theme-tile[aria-checked="true"],
.ts-side .theme-tile[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139, 90, 60, .14); }
.ts-paper { position: relative; overflow: hidden; }
.ts-paper .paperface { --lh: 24px; position: absolute; inset: 0; }
html[data-paper="dotted"] .ts-paper { background-image: none; }

/* =========================================================
   ONE BUTTON FOR THE LOOK OF A DIARY
   ========================================================= */
.theme-btn {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: #fffdf9;
  color: var(--ink); transition: border-color .18s, background .18s;
}
.theme-btn:hover { border-color: var(--accent); background: #fff8ee; }
.tb-swatches { position: relative; width: 52px; height: 38px; flex: none; }
.tb-desk, .tb-paper { position: absolute; border-radius: 8px; box-shadow: 0 2px 6px -2px rgba(70, 40, 15, .5), inset 0 0 0 1px rgba(0,0,0,.1); }
.tb-desk { inset: 0; }
.tb-paper { right: -2px; bottom: -3px; width: 26px; height: 30px; border-radius: 4px; }
.tb-desk.desk-oak, .tb-desk.desk-walnut, .tb-desk.desk-birch, .tb-desk.desk-linen, .tb-desk.desk-slate, .tb-desk.desk-crimson,
.tb-paper[class*="paper-"] { background-size: cover; background-position: center; }
.tb-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.tb-text b { font-size: .95rem; }
.tb-text small { font-size: .78rem; color: var(--ink-2); }
.tb-go { width: 18px; height: 18px; color: var(--muted); flex: none; }

/* the desk and paper squares inside that button borrow the theme swatch art */
.tb-desk.desk-oak    { background: repeating-linear-gradient(180deg, transparent 0 13px, rgba(95,55,25,.18) 13px 14px), linear-gradient(180deg, #d4aa7b, #c3935f); }
.tb-desk.desk-walnut { background: repeating-linear-gradient(180deg, transparent 0 13px, rgba(0,0,0,.22) 13px 14px), linear-gradient(180deg, #6e4630, #4b2e1f); }
.tb-desk.desk-birch  { background: repeating-linear-gradient(180deg, transparent 0 13px, rgba(140,110,70,.14) 13px 14px), linear-gradient(180deg, #f0e2c8, #e2cfae); }
.tb-desk.desk-linen  { background: repeating-linear-gradient(90deg, rgba(120,100,70,.08) 0 1px, transparent 1px 4px), repeating-linear-gradient(0deg, rgba(120,100,70,.08) 0 1px, transparent 1px 4px), #ddd1bf; }
.tb-desk.desk-slate  { background: radial-gradient(120% 90% at 30% 20%, #6b7178, #3d4248); }
.tb-desk.desk-crimson { background: linear-gradient(170deg, #7d1a24, #3a0f16); }
.tb-paper.paper-cream   { background: repeating-linear-gradient(180deg, #fffaf0 0 5px, rgba(112,142,182,.4) 5px 6px); }
.tb-paper.paper-white   { background: repeating-linear-gradient(180deg, #ffffff 0 5px, rgba(120,150,190,.45) 5px 6px); }
.tb-paper.paper-vintage { background: repeating-linear-gradient(180deg, transparent 0 5px, rgba(140,110,70,.35) 5px 6px), #ecd9b4; }
.tb-paper.paper-dotted  { background: radial-gradient(circle, rgba(90,110,140,.55) 1px, transparent 1.4px) 0 0 / 6px 6px, #fffdf8; }
.tb-paper.paper-blue    { background: repeating-linear-gradient(180deg, #fdfdfb 0 5px, rgba(70,120,200,.6) 5px 6px); }
.tb-paper.paper-web     { background: repeating-linear-gradient(180deg, #fff4f2 0 5px, rgba(176,36,48,.4) 5px 6px); }

/* the theme page holds both rows now, and the diary sits on the paper */
.ts-side { display: flex; flex-direction: column; gap: 16px; max-height: 420px; overflow: auto; padding-right: 4px; }
.ts-group { display: flex; flex-direction: column; gap: 8px; }
.ts-side .theme-grid { max-height: none; overflow: visible; }
.ts-float { position: relative; width: 296px; height: 318px; }
.ts-float .ts-paper { position: absolute; right: 0; top: 0; width: 198px; height: 262px; }
.ts-float .preview-book { position: absolute; left: 0; bottom: 4px; width: 134px; --w: 134px; transform: rotate(-7deg); }
@media (max-width: 760px) {
  .ts-side { max-height: none; }
  .ts-float { width: 240px; height: 270px; transform: scale(.88); }
}

/* the edit sheet is short enough to sit on screen whole */
.sheet.wide .cp-sv { height: 96px; }
.sheet.wide .cpick { gap: 8px; margin-top: 10px; }
/* the colour panel, folded into two columns so the sheet stays on one screen */
.sheet.wide .sheet-inner { padding: 24px 26px; gap: 14px; }
.sheet.wide .bk-group { padding-top: 11px; }
.sheet.wide .bk-head { margin-bottom: 8px; }
.sheet.wide .cpick {
  display: grid; grid-template-columns: 148px minmax(0, 1fr); grid-template-rows: auto auto;
  gap: 8px 12px; max-width: 370px; margin-top: 10px;
}
.sheet.wide .cp-sv { grid-row: 1 / 3; height: 84px; }
.sheet.wide .cp-hue { align-self: end; }

/* the banner runs the full width of the page, in line with the header */
.main.home { max-width: 1680px; padding: 18px 36px 40px; }
.main.home .hero { min-height: 244px; }
@media (max-width: 900px) { .main.home { padding: 14px 16px 30px; } .main.home .hero { min-height: 300px; } }

/* the colour chooser on the theme page sits in the narrow column */
.ts-cpick { max-width: none; margin-top: 2px; }
.ts-cpick .cp-sv { height: 78px; }
.ts-group .choices { gap: 9px; }
.ts-group .swatch { width: 34px; height: 34px; }

/* =========================================================
   A COVER YOU CAN SET THE COLOURS OF
   ========================================================= */
/* the stitching takes its colour from the cover, or from whatever was chosen */
.cover-face::before { border-color: var(--stitch, rgba(255, 245, 225, .38)); }
[class*="cv-"]:not(.cv-leather) .cover-face::before { border-color: var(--stitch, rgba(60, 40, 25, .22)); }

/* the little drawing stays on the cover even when there is a photo */
.cover-face .c-motif.with-photo { width: 17%; margin-top: 0; opacity: .85; }
.cover-face .c-content.pm { gap: calc(var(--w, 300px) * .025); }
.cover-face .c-content.pm .c-photo { width: 58%; margin-bottom: 2px; }
.shelf-book .c-motif.with-photo, .preview-book .c-motif.with-photo { width: 15%; }

/* "automatic" in a row of colours */
.swatch-auto {
  background:
    linear-gradient(135deg, #fffaf1 0 48%, #b4533a 48% 52%, #3a2a20 52%) !important;
}
.ts-group .swatch-any, .ts-group .swatch-auto { width: 34px; height: 34px; }

/* the stitching is thin at preview sizes: give it a width that grows with the book */
.cover-face::before { border-width: max(1.4px, calc(var(--w, 300px) * .0085)); }

/* every colour in a row is the same circle, pale ones included */
.ts-group .choices { gap: 10px; }
.ts-group .swatch, .ts-group .swatch-any, .ts-group .swatch-auto {
  flex: 0 0 32px; width: 32px; height: 32px; border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(60, 40, 25, .28);
}
.swatch-auto { background: linear-gradient(135deg, #fffdf8 0 45%, #a7553c 45% 55%, #fffdf8 55%) !important; }

/* a smaller stage, with the diary the bigger of the two */
.ts-stage { min-height: 300px; }
.ts-float { width: 286px; height: 292px; }
.ts-float .ts-paper { right: 0; top: 0; width: 150px; height: 198px; }
.ts-float .preview-book { left: 0; bottom: 0; width: 180px; --w: 180px; transform: rotate(-6deg); }
@media (max-width: 760px) { .ts-float { width: 250px; height: 258px; transform: scale(.92); } }
.ts-side { max-height: 372px; }

/* the little drawing follows the chosen icon colour, whatever the cover is made of */
.cover-face .c-motif { color: var(--motif, var(--cink, #f3dcb8)); }
.cover-face:not(:has(.foil)) .c-motif { color: var(--motif, rgba(50, 35, 25, .55)); }

/* more room for the controls, less empty desk around the preview */
.ts-body { grid-template-columns: minmax(0, 376px) minmax(0, 1fr); gap: 22px; }
.ts-side .theme-grid { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 860px) {
  .ts-body { grid-template-columns: 1fr; }
  .ts-side .theme-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
}

/* desk and paper sit beside each other, so the panel scrolls far less */
.ts-side { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; align-content: start; }
.ts-group { grid-column: 1 / -1; }
.ts-group:has(#tsDesks), .ts-group:has(#tsPapers) { grid-column: auto; }
.ts-side .theme-grid { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 860px) {
  .ts-side { display: flex; }
  .ts-side .theme-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
}

/* the foot of the edit sheet: either the button, or a quiet line saying it already is */
.sheet-foot .foot-left { display: flex; align-items: center; min-height: 1px; }
.is-default { display: inline-flex; align-items: center; gap: 7px; font-size: .92rem; color: var(--ink-2); }
.is-default .ic { width: 16px; height: 16px; color: var(--accent); }
.ts-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.ts-actions .link-btn { font-size: .9rem; }

/* =========================================================
   STICKY NOTES ON THE BANNER
   ========================================================= */
.sticky-btn {
  position: absolute; z-index: 3; top: 14px; right: 16px;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: 12px; cursor: pointer;
  font: inherit; font-size: .86rem; font-weight: 600; letter-spacing: .01em;
  color: #4a3626; background: rgba(255, 252, 244, .72);
  border: 1.5px dashed rgba(95, 70, 50, .55);
  backdrop-filter: blur(3px); transition: background .2s ease, transform .2s ease, border-color .2s ease;
}
.sticky-btn .ic { width: 16px; height: 16px; }
.sticky-btn:hover { background: rgba(255, 252, 244, .95); transform: translateY(-1px); border-color: rgba(95, 70, 50, .8); }
.hero[data-time="night"] .sticky-btn { color: #f6e4c9; background: rgba(32, 26, 36, .5); border-color: rgba(246, 228, 201, .5); }
.hero[data-time="night"] .sticky-btn:hover { background: rgba(32, 26, 36, .75); }

.hero-notes {
  position: absolute; z-index: 2; right: 22px; bottom: 16px;
  display: flex; align-items: flex-end; gap: 14px; pointer-events: none;
}
.sticky {
  position: relative; pointer-events: auto;
  width: 132px; min-height: 108px; padding: 13px 12px 12px;
  border-radius: 3px; transform: rotate(var(--tilt, -3deg));
  background: var(--sn-1); color: #3a2c1e;
  box-shadow: 0 10px 18px rgba(40, 26, 14, .26), 0 2px 4px rgba(40, 26, 14, .18);
  transition: transform .18s ease, box-shadow .18s ease;
}
.sticky:nth-child(2) { margin-bottom: 16px; }
.sticky:nth-child(3) { margin-bottom: 4px; }
.sticky::after {               /* the bit of tape that holds it up */
  content: ""; position: absolute; top: -9px; left: 50%; width: 46px; height: 17px;
  transform: translateX(-50%) rotate(calc(var(--tilt, 0deg) * -.6));
  background: rgba(255, 253, 245, .55); box-shadow: 0 1px 2px rgba(40, 26, 14, .18);
}
.sticky:hover { transform: rotate(var(--tilt, -3deg)) translateY(-3px) scale(1.02); box-shadow: 0 16px 26px rgba(40, 26, 14, .3); }
.sticky h4 { margin: 0 0 5px; font-family: var(--hand); font-size: 1.02rem; font-weight: 700; line-height: 1.15; }
.sticky .sn-text { margin: 0; font-family: var(--hand); font-size: .95rem; line-height: 1.28; white-space: pre-wrap; overflow-wrap: anywhere; }
.sn-open { position: absolute; inset: 0; z-index: 0; border: 0; background: none; cursor: pointer; border-radius: inherit; }
.sticky h4, .sticky .sn-text, .sticky .sn-list { position: relative; z-index: 1; pointer-events: none; }
.sn-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.sn-list li { display: flex; align-items: flex-start; gap: 6px; font-family: var(--hand); font-size: .92rem; line-height: 1.2; }
.sn-list span { overflow-wrap: anywhere; }
.sn-list .done { text-decoration: line-through; opacity: .55; }
.sn-tick {
  flex: 0 0 15px; width: 15px; height: 15px; margin-top: 1px; padding: 0; cursor: pointer;
  pointer-events: auto; border-radius: 4px; background: rgba(255, 255, 255, .6);
  border: 1.4px solid rgba(70, 50, 32, .5); display: grid; place-items: center; color: transparent;
}
.sn-tick .ic { width: 11px; height: 11px; stroke-width: 3.4; }
.sn-tick.on { background: rgba(70, 50, 32, .82); border-color: rgba(70, 50, 32, .82); color: #fffaf0; }

/* the colours a note comes in */
.sn-butter { --sn-1: #fdeb9a; }
.sn-rose { --sn-1: #f9c9d4; }
.sn-mint { --sn-1: #c3e8cd; }
.sn-sky { --sn-1: #c6dff6; }
.sn-peach { --sn-1: #fbd3ad; }
.sticky, .sk-card { background: var(--sn-1, #fdeb9a); }

@media (max-width: 1100px) { .hero-notes .sticky:nth-child(3) { display: none; } }
@media (max-width: 900px) {
  .hero-notes { right: 12px; bottom: 10px; gap: 10px; }
  .sticky { width: 108px; min-height: 86px; padding: 10px 9px; }
  .sticky h4 { font-size: .92rem; }
  .sticky .sn-text, .sn-list li { font-size: .84rem; }
}
@media (max-width: 620px) { .hero-notes .sticky:nth-child(2) { display: none; } }

/* ---------- the sheet you write them in ---------- */
.sticky-sheet { width: min(640px, calc(100vw - 24px)); }
.sk-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 16px; }
.sk-none { grid-column: 1 / -1; margin: 6px 0 2px; color: var(--ink-2); font-size: .95rem; }
.sk-card {
  position: relative; padding: 14px 13px 10px; border-radius: 4px; transform: rotate(-.6deg);
  box-shadow: 0 8px 16px rgba(40, 26, 14, .2); display: flex; flex-direction: column; gap: 8px; color: #3a2c1e;
}
.sk-card:nth-child(even) { transform: rotate(.8deg); }
.sk-card input, .sk-card textarea {
  width: 100%; font: inherit; font-family: var(--hand); color: #3a2c1e;
  background: rgba(255, 255, 255, .42); border: 1px solid rgba(70, 50, 32, .2);
  border-radius: 5px; padding: 6px 8px; resize: none;
}
.sk-card input:focus, .sk-card textarea:focus { outline: 2px solid rgba(70, 50, 32, .35); outline-offset: 1px; }
.sk-card .sk-title { font-weight: 700; font-size: 1rem; }
.sk-items { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.sk-items li { display: flex; align-items: center; gap: 6px; }
.sk-items input { flex: 1; min-width: 0; }
.icon-btn.tiny { width: 24px; height: 24px; flex: 0 0 24px; }
.icon-btn.tiny .ic { width: 13px; height: 13px; }
.sk-card .link-btn { font-size: .85rem; align-self: flex-start; }
.sk-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 4px; }
.sn-dots { display: flex; gap: 5px; }
.sn-dot {
  width: 17px; height: 17px; border-radius: 50%; cursor: pointer; padding: 0;
  background: var(--sn-1); border: 1px solid rgba(70, 50, 32, .3);
}
.sn-dot.on { box-shadow: 0 0 0 2px rgba(70, 50, 32, .55); }
.sk-add { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.sk-add .btn .ic { width: 16px; height: 16px; }
.sk-count { color: var(--ink-2); font-size: .88rem; margin-left: auto; }

/* on a phone the banner is a column: one note, up in the sky, clear of the button */
@media (max-width: 620px) {
  .hero-notes { top: 14px; left: 16px; right: auto; bottom: auto; }
  .hero-notes .sticky:nth-child(2), .hero-notes .sticky:nth-child(3) { display: none; }
  .sticky { width: 112px; min-height: 80px; }
}

/* =========================================================
   THE PROFILE, NOW A PAGE OF ITS OWN
   ========================================================= */
.profile-page { max-width: 1680px; margin: 0 auto; padding: 18px 36px 48px; }
.pf-wrap { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.pf-top { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.pf-top h2 { font-size: 2rem; margin-top: 10px; }
.pf-top p { margin: 0; color: var(--ink-2); }
.pf-back { align-self: flex-start; gap: 7px; }
.pf-back .ic { width: 16px; height: 16px; }
.profile-page .site-foot { margin-top: 26px; }
@media (max-width: 900px) { .profile-page { padding: 14px 16px 36px; } .pf-top h2 { font-size: 1.6rem; } }

/* ---------- how Liflib is going ---------- */
.pf-feedback { background: linear-gradient(180deg, #fffaf0, var(--card) 58%); border-color: #efdcc0; }
.fb-stars { display: flex; gap: 6px; margin-top: 4px; }
.fb-star {
  width: 42px; height: 42px; padding: 0; cursor: pointer; border: 0; background: none;
  display: grid; place-items: center; border-radius: 12px; color: #d9cab4;
  transition: transform .15s ease, color .15s ease;
}
.fb-star .ic { width: 30px; height: 30px; fill: currentColor; stroke: none; }
.fb-star:hover { transform: translateY(-2px); }
.fb-star.on { color: #e9ae3c; }
.fb-star-word { margin: 0 !important; font-family: var(--hand); font-size: 1.1rem; color: var(--accent); min-height: 1.3em; }
.fb-qs { display: flex; flex-direction: column; gap: 14px; margin-top: 6px; }
.fb-q { display: flex; flex-direction: column; gap: 7px; }
.fb-ask { font-size: .95rem; font-weight: 600; color: var(--ink); }
.fb-ask .muted { font-weight: 400; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit; font-size: .9rem; cursor: pointer; padding: 7px 14px; border-radius: 999px;
  background: #fffdf9; color: var(--ink); border: 1px solid var(--line);
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff8ec; }
.pf-feedback textarea {
  width: 100%; font: inherit; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: #fffdf9; color: var(--ink); resize: vertical;
}
.fb-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 2px; }
.fb-foot .muted { font-size: .86rem; }

/* =========================================================
   STICKY NOTES YOU CAN MOVE ABOUT
   ========================================================= */
/* the board is the right half of the banner only, clear of the words on the left */
.hero-notes {
  position: absolute; z-index: 2;
  left: 50%; right: 18px; top: 58px; bottom: 14px;
  display: block; gap: 0; pointer-events: none;
}
.hero-notes .sticky {
  position: absolute; left: 0; top: 0; margin: 0 !important;
  pointer-events: auto; cursor: grab; touch-action: none;
  user-select: none; -webkit-user-select: none;
}
.hero-notes .sticky:hover { z-index: 5; }
.hero-notes .sticky.lifted {
  cursor: grabbing; z-index: 9;
  transform: rotate(var(--tilt, -3deg)) scale(1.05);
  box-shadow: 0 22px 34px rgba(40, 26, 14, .34);
  transition: none;
}
.hero-notes .sticky .sn-open { cursor: inherit; }

@media (max-width: 1100px) { .hero-notes .sticky:nth-child(3) { display: block; } }
@media (max-width: 900px) { .hero-notes { left: 46%; top: 54px; right: 12px; } }

/* a phone has no spare half, so they stack up in the sky again and stay put */
@media (max-width: 620px) {
  .hero-notes { left: 16px; right: auto; top: 14px; bottom: auto; display: flex; gap: 10px; }
  .hero-notes .sticky { position: relative; cursor: default; }
  .hero-notes .sticky:nth-child(n + 2) { display: none; }
}

/* ---------- the sheet: room enough to read what you are typing ---------- */
.sticky-sheet { width: min(780px, calc(100vw - 24px)); }
.sk-list { grid-template-columns: repeat(auto-fill, minmax(224px, 1fr)); gap: 18px; }
.sk-card { padding: 15px 14px 11px; }
.sk-card input, .sk-card textarea { font-size: .98rem; line-height: 1.35; }
.sk-card .sk-title { font-size: 1.02rem; }
.sk-items li { gap: 5px; }
.sk-items input { padding: 6px 7px; }
.sk-card textarea { min-height: 104px; }
@media (max-width: 560px) { .sk-list { grid-template-columns: 1fr; } }
.sk-items textarea { flex: 1; min-width: 0; resize: none; overflow: hidden; }
.sk-card textarea[data-item] { min-height: 0; padding: 6px 8px; }
.sk-card textarea.sk-title { min-height: 0; overflow: hidden; resize: none; }
.hero-notes { top: 50px; bottom: 10px; }
@media (max-width: 620px) { .hero-notes { top: 14px; bottom: auto; } }

/* =========================================================
   A DIARY SOMEBODY WANTS TO SHARE WITH YOU
   The card sits above everything and stays until it is answered.
   ========================================================= */
.invites { max-width: 1680px; margin: 0 auto; padding: 14px 36px 0; display: flex; flex-direction: column; gap: 10px; }
.inv-card {
  display: flex; align-items: center; gap: 16px; padding: 12px 16px 12px 12px;
  background: linear-gradient(100deg, #fff6e6, var(--card) 62%);
  border: 1px solid #ecd6b4; border-left: 5px solid var(--accent);
  border-radius: 16px; box-shadow: 0 10px 22px -16px rgba(70, 45, 25, .5);
  animation: inviteIn .45s cubic-bezier(.2, .8, .3, 1);
}
@keyframes inviteIn { from { opacity: 0; transform: translateY(-8px); } }
.inv-card.gone { animation: inviteOut .3s ease forwards; }
@keyframes inviteOut { to { opacity: 0; transform: translateY(-8px); } }
.inv-book { flex: 0 0 48px; width: 48px; --w: 48px; display: block; position: relative; border-radius: 3px 5px 5px 3px; overflow: hidden; }
.inv-book .cover-face { border-radius: inherit; }
.inv-words { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.inv-words b { font-size: 1rem; }
.inv-words small { color: var(--ink-2); font-size: .88rem; }
.inv-acts { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.btn-sm { padding: 8px 14px; font-size: .9rem; }
.btn-sm .ic { width: 15px; height: 15px; }
@media (max-width: 760px) {
  .invites { padding: 12px 16px 0; }
  .inv-card { flex-wrap: wrap; gap: 10px; }
  .inv-acts { width: 100%; }
  .inv-acts .btn { flex: 1; justify-content: center; }
}

/* waiting for an answer, and asking to write */
.role-chip.waiting { background: #fdf0d8; color: #8a6025; }
.member .ask-row {
  flex-basis: 100%; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 8px; padding: 9px 12px; border-radius: 12px; background: var(--accent-soft, #f6e9dc);
}
.member .ask-row b { font-size: .9rem; font-weight: 600; }
.member .ask-row .btn { margin-left: auto; }
.sheet-links .btn-soft .ic { width: 16px; height: 16px; }

/* =========================================================
   EACH HAND ITS OWN INK, AND A NAME UNDER THE PAGE
   ========================================================= */
.paper.inked .page-body,
.paper.inked .page-title,
.paper.inked .page-body.mirror { color: var(--hand-ink); }
.paper.inked .page-title::placeholder { color: var(--hand-ink); opacity: .45; }
.page-sign {
  position: absolute; z-index: 3; right: 8%; bottom: 3.2%;
  margin: 0; font-family: var(--hand); font-size: 1.12rem; white-space: nowrap;
  color: var(--hand-ink, #8a6a52); opacity: .9; transform: rotate(-1.4deg);
}
.paper.spread .page-sign { right: 5%; }
@media (max-width: 760px) { .page-sign { font-size: 1rem; right: 7%; bottom: 2.6%; } }

/* =========================================================
   TURNING A PAGE: THE SHEET BENDS INSTEAD OF FLIPPING FLAT
   A real page bows away from the spine, catches the light along the bend,
   stiffens as it stands up, then falls over.
   ========================================================= */
.paper-wrap { perspective: 1500px; perspective-origin: 50% 42%; }
.ghost { transform-style: preserve-3d; will-change: transform; border-radius: 2px 7px 7px 2px; }
.ghost.turn-next {
  transform-origin: left center;
  animation: turnNext .82s cubic-bezier(.36, .04, .32, 1) forwards;
}
.ghost.turn-prev {
  transform-origin: right center;
  animation: turnPrev .82s cubic-bezier(.36, .04, .32, 1) forwards;
}
/* the bow: the free edge lifts first and the sheet squeezes as it curves */
@keyframes turnNext {
  0%   { transform: rotateY(0) skewY(0) scaleX(1); }
  18%  { transform: rotateY(-16deg) skewY(1.6deg) scaleX(.985); }
  42%  { transform: rotateY(-52deg) skewY(2.2deg) scaleX(.955); }
  68%  { transform: rotateY(-92deg) skewY(.8deg) scaleX(.94); }
  100% { transform: rotateY(-132deg) skewY(-1deg) scaleX(.97); opacity: .16; }
}
@keyframes turnPrev {
  0%   { transform: rotateY(0) skewY(0) scaleX(1); }
  18%  { transform: rotateY(16deg) skewY(-1.6deg) scaleX(.985); }
  42%  { transform: rotateY(52deg) skewY(-2.2deg) scaleX(.955); }
  68%  { transform: rotateY(92deg) skewY(-.8deg) scaleX(.94); }
  100% { transform: rotateY(132deg) skewY(1deg) scaleX(.97); opacity: .16; }
}
/* the light running along the curve, and the dark in the fold by the spine */
.ghost .curl { position: absolute; inset: 0; pointer-events: none; mix-blend-mode: multiply; }
.ghost.turn-next .curl {
  background:
    linear-gradient(100deg, rgba(60, 35, 12, .22) 0%, rgba(255, 252, 244, 0) 14%, rgba(255, 255, 255, .5) 42%, rgba(70, 42, 18, .1) 72%, rgba(50, 28, 8, .28) 100%);
  animation: curlNext .82s cubic-bezier(.36, .04, .32, 1) forwards;
}
.ghost.turn-prev .curl {
  background:
    linear-gradient(260deg, rgba(60, 35, 12, .22) 0%, rgba(255, 252, 244, 0) 14%, rgba(255, 255, 255, .5) 42%, rgba(70, 42, 18, .1) 72%, rgba(50, 28, 8, .28) 100%);
  animation: curlNext .82s cubic-bezier(.36, .04, .32, 1) forwards;
}
@keyframes curlNext {
  0% { opacity: 0; background-size: 300% 100%; background-position: 100% 0; }
  30% { opacity: 1; }
  100% { opacity: .95; background-size: 115% 100%; background-position: 0 0; }
}
/* the shadow the sheet drags across the page underneath */
.cast {
  position: absolute; top: 0; left: 20px; right: 20px; z-index: 3; pointer-events: none;
  border-radius: 6px; opacity: 0;
}
.cast.to-next { background: linear-gradient(90deg, rgba(50, 28, 10, .34), rgba(50, 28, 10, .06) 46%, transparent 70%); animation: castNext .82s ease-out forwards; }
.cast.to-prev { background: linear-gradient(270deg, rgba(50, 28, 10, .34), rgba(50, 28, 10, .06) 46%, transparent 70%); animation: castNext .82s ease-out forwards; }
@keyframes castNext {
  0% { opacity: .85; transform: scaleX(1); }
  60% { opacity: .5; transform: scaleX(.6); }
  100% { opacity: 0; transform: scaleX(.2); }
}
.cast.to-next { transform-origin: left center; }
.cast.to-prev { transform-origin: right center; }

/* a phone holds the book closer, so the bend is stronger and a touch quicker */
@media (max-width: 760px) {
  .paper-wrap { perspective: 1000px; }
  .cast { left: 8px; right: 8px; }
  .ghost.turn-next, .ghost.turn-prev, .ghost .curl, .cast { animation-duration: .68s; }
}
/* an open spread turns only the half you are leaving */
.ghost.spread { border-radius: 2px; }
/* the bar spans the page and stays at the top while you scroll, until it is answered */
.invites {
  width: 100%; position: sticky; top: 0; z-index: 30;
  padding-bottom: 12px; background: linear-gradient(var(--bg) 62%, transparent);
}
.inv-card { width: 100%; }
.inv-book { height: 62px; }
/* the "may I write?" row drops onto its own line under the person */
.member { flex-wrap: wrap; }
.member .who { min-width: 0; }

/* =========================================================
   THE TURN, MADE SMOOTH
   Only transform and opacity change while it runs, and only on layers the
   compositor already holds — no blend modes, no scaling of the text, so the
   sheet never has to be redrawn mid-flight.
   ========================================================= */
.ghost, .ghost.turn-next, .ghost.turn-prev {
  animation: none !important;                 /* nothing moves until the frame we say so */
  transform: rotateY(0deg);
  will-change: transform;
  backface-visibility: hidden;
  contain: paint;
}
.ghost .curl, .ghost .shade, .cast { animation: none !important; will-change: transform, opacity; }
.ghost .curl, .ghost .shade { mix-blend-mode: normal; }

.ghost.go.turn-next { animation: turnNext .66s cubic-bezier(.33, 0, .25, 1) forwards !important; }
.ghost.go.turn-prev { animation: turnPrev .66s cubic-bezier(.33, 0, .25, 1) forwards !important; }
@keyframes turnNext {
  0%   { transform: rotateY(0deg); opacity: 1; }
  80%  { opacity: 1; }
  100% { transform: rotateY(-142deg); opacity: .1; }
}
@keyframes turnPrev {
  0%   { transform: rotateY(0deg); opacity: 1; }
  80%  { opacity: 1; }
  100% { transform: rotateY(142deg); opacity: .1; }
}

/* the bend lives in the light, not in the geometry: one wide gradient slid across */
.ghost .curl {
  position: absolute; top: 0; bottom: 0; left: -100%; width: 300%;
  background: linear-gradient(90deg,
    rgba(40, 22, 6, 0) 28%, rgba(40, 22, 6, .2) 38%,
    rgba(255, 253, 246, .62) 46%, rgba(255, 253, 246, .2) 52%,
    rgba(40, 22, 6, .26) 62%, rgba(40, 22, 6, 0) 74%);
  opacity: 0; pointer-events: none;
}
.ghost.go.turn-next .curl { animation: curlSweep .66s cubic-bezier(.33, 0, .25, 1) forwards !important; }
.ghost.go.turn-prev .curl { animation: curlSweepBack .66s cubic-bezier(.33, 0, .25, 1) forwards !important; }
@keyframes curlSweep {
  0% { transform: translate3d(28%, 0, 0); opacity: 0; }
  30% { opacity: .95; }
  100% { transform: translate3d(-24%, 0, 0); opacity: .7; }
}
@keyframes curlSweepBack {
  0% { transform: translate3d(-28%, 0, 0); opacity: 0; }
  30% { opacity: .95; }
  100% { transform: translate3d(24%, 0, 0); opacity: .7; }
}

/* the fold going dark as the sheet stands up */
.ghost .shade { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.ghost.turn-next .shade { background: linear-gradient(90deg, rgba(48, 26, 8, .5), rgba(48, 26, 8, .04) 55%, transparent); }
.ghost.turn-prev .shade { background: linear-gradient(270deg, rgba(48, 26, 8, .5), rgba(48, 26, 8, .04) 55%, transparent); }
.ghost.go .shade { animation: foldDark .66s ease-in forwards !important; }
@keyframes foldDark { 0% { opacity: 0; } 100% { opacity: 1; } }

/* the shadow dragged across the page underneath */
.cast.go { animation: castSweep .66s ease-out forwards !important; }
@keyframes castSweep {
  0% { opacity: .8; transform: scaleX(1); }
  100% { opacity: 0; transform: scaleX(.18); }
}

@media (max-width: 760px) {
  .ghost.go.turn-next, .ghost.go.turn-prev,
  .ghost.go .curl, .ghost.go .shade, .cast.go {
    animation-duration: .54s !important;
  }
}

/* =========================================================
   A SHEET THAT REALLY BENDS
   The turning page is a chain of strips hinged end to end. Each one turns a
   little later than the one before it, so the paper bows, stands up in a curve
   and settles flat as it falls — real geometry, not a painted-on highlight.
   ========================================================= */
.paper-wrap { perspective: 1700px; perspective-origin: 50% 40%; }
.flip {
  position: absolute; top: 0; z-index: 4; pointer-events: none;
  transform-style: preserve-3d;
}
.flip.to-next { left: 20px; }
.flip.to-prev { right: 20px; }

.fseg {
  position: absolute; top: 0;
  transform-style: preserve-3d;
  will-change: transform;
  transform: rotateY(0deg);
}
/* turning forward: the spine is on the left, so every strip hinges on its left edge */
.flip.to-next .fseg { transform-origin: left center; left: 100%; }
.flip.to-next > .fseg { left: 0; }
/* turning back: the spine is on the right */
.flip.to-prev .fseg { transform-origin: right center; right: 100%; }
.flip.to-prev > .fseg { right: 0; }

.fface { position: absolute; inset: 0; overflow: hidden; backface-visibility: hidden; }
.fface > .fsheet { position: absolute; top: 0; margin: 0 !important; border-radius: 0; }

/* each strip is a touch wider than its slot, so the joins leave no hairline */
.flip.to-next .fface { width: calc(100% + .8px); }
.flip.to-prev .fface { width: calc(100% + .8px); left: -.8px; }

/* the shading ramps across the whole sheet rather than stepping strip by strip,
   so the curve reads as one bent surface */
.fsheen { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.flip.to-next .fsheen {
  background: linear-gradient(90deg,
    rgba(46, 26, 8, calc(.04 + var(--i) * .042)),
    rgba(46, 26, 8, calc(.04 + (var(--i) + 1) * .042)));
}
.flip.to-prev .fsheen {
  background: linear-gradient(270deg,
    rgba(46, 26, 8, calc(.04 + var(--i) * .042)),
    rgba(46, 26, 8, calc(.04 + (var(--i) + 1) * .042)));
}

/* the hinge angles: they add up along the chain, so the tip sweeps right over */
.flip.go .fseg {
  animation: hingeNext var(--fdur, .72s) cubic-bezier(.42, 0, .3, 1) forwards;
  animation-delay: calc(var(--i) * 34ms);
}
.flip.to-prev.go .fseg { animation-name: hingePrev; }
.flip.go .fsheen { animation: sheenIn var(--fdur, .72s) ease-in forwards; animation-delay: calc(var(--i) * 34ms); }
@keyframes hingeNext { to { transform: rotateY(-25.5deg); } }
@keyframes hingePrev { to { transform: rotateY(25.5deg); } }
@keyframes sheenIn { 0% { opacity: 0; } 55% { opacity: 1; } 100% { opacity: .85; } }

/* the whole sheet fades at the very end, as it lands out of sight */
.flip.go { animation: flipFade var(--fdur, .72s) linear forwards; }
@keyframes flipFade { 0%, 72% { opacity: 1; } 100% { opacity: 0; } }

@media (max-width: 760px) {
  .paper-wrap { perspective: 1100px; }
  .flip.to-next { left: 8px; }
  .flip.to-prev { right: 8px; }
  .flip { --fdur: .6s; }
  .flip.go .fseg .fseg, .flip.go .fsheen { animation-delay: calc(var(--i) * 28ms); }
}

/* =========================================================
   TURNING A PAGE: A PLAIN FLIP
   One sheet lifts and goes over. No bend, no sound — just the page turning.
   ========================================================= */
.paper-wrap { perspective: 2000px; perspective-origin: 50% 45%; }
.flip {
  position: absolute !important; top: 0; margin: 0 !important; z-index: 4;
  overflow: hidden; pointer-events: none; backface-visibility: hidden;
  will-change: transform, opacity;
}
.flip.to-next { left: 20px; right: 20px; transform-origin: left center; }
.flip.to-prev { left: 20px; right: 20px; transform-origin: right center; }
.flip.to-next.go { animation: pageNext .52s cubic-bezier(.4, 0, .3, 1) forwards; }
.flip.to-prev.go { animation: pagePrev .52s cubic-bezier(.4, 0, .3, 1) forwards; }
@keyframes pageNext {
  0% { transform: rotateY(0deg); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: rotateY(-108deg); opacity: 0; }
}
@keyframes pagePrev {
  0% { transform: rotateY(0deg); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: rotateY(108deg); opacity: 0; }
}
@media (max-width: 760px) {
  .flip.to-next, .flip.to-prev { left: 8px; right: 8px; }
  .flip.to-next.go, .flip.to-prev.go { animation-duration: .44s; }
}

/* =========================================================
   ONE PAGE, SEVERAL HANDS
   In a book people share, a day is a single page. Everyone's writing sits on
   it in their own ink, and each person signs under their own last line.
   ========================================================= */
.hand { display: block; color: var(--hand-ink); }
.hand p { color: inherit; }
.hand-title { font-family: var(--serif); font-weight: 600; font-size: 1.12em; margin-bottom: .1em; }
.hand-note { opacity: .6; font-size: .9em; font-style: italic; }
.hand-sign {
  margin-left: 50%;                 /* half way across the page, as you would sign it */
  font-family: var(--hand); font-size: 1.05em;
  color: var(--hand-ink, #8a6a52); opacity: .95;
  transform: rotate(-.8deg); transform-origin: left center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hand-sign.mine { color: var(--hand-ink); }
.hand + p, .hand + .photo { margin-top: .35em; }
.paper.many-hands .page-body { color: var(--hand-ink); }   /* your own ink as you type */
.paper.many-hands .page-body .hand { margin-bottom: .2em; }
/* a hand you cannot edit should not look like a text box */
.page-body .hand { cursor: default; user-select: text; }
@media (max-width: 760px) { .hand-sign { margin-left: 42%; font-size: 1em; } }
/* the page's own paragraph rules are more specific, so say it plainly */
.page-body p.hand-sign, .page-body .hand p.hand-sign {
  margin: .15em 0 .55em 50%;
}
.page-body .hand + p, .page-body .hand + .hand { margin-top: .45em; }
@media (max-width: 760px) { .page-body p.hand-sign, .page-body .hand p.hand-sign { margin-left: 42%; } }

/* an open spread turns one leaf: the right page going forward, the left coming back,
   both hinged on the spine down the middle */
.flip.spread.to-next { clip-path: inset(0 0 0 50%); transform-origin: 50% 50%; }
.flip.spread.to-prev { clip-path: inset(0 50% 0 0); transform-origin: 50% 50%; }
.flip.spread.to-next.go { animation-name: leafNext; }
.flip.spread.to-prev.go { animation-name: leafPrev; }
@keyframes leafNext {
  0% { transform: rotateY(0deg); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: rotateY(-96deg); opacity: 0; }
}
@keyframes leafPrev {
  0% { transform: rotateY(0deg); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: rotateY(96deg); opacity: 0; }
}

/* the page buttons sit at the foot of the page on every screen, not only phones */
.dnav:not([hidden]) {
  position: absolute; z-index: 6; left: 50%; transform: translateX(-50%);
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  display: block; width: auto; padding: 6px; border-radius: 18px;
  background: rgba(92, 58, 34, .9); backdrop-filter: blur(8px);
  box-shadow: 0 14px 30px -14px rgba(0, 0, 0, .55);
}
.dnav .center { display: flex; align-items: center; justify-content: center; gap: 8px; }
.dnav .dbtn { min-height: 40px; justify-content: center; }
.dnav .dbtn .lbl { display: inline; }
.dnav .page-label { color: #fbeedd; font-size: .95rem; white-space: nowrap; padding: 0 4px; }
@media (max-width: 640px) {
  .dnav:not([hidden]) { left: 12px; right: 12px; width: auto; transform: none; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
  .dnav .center { justify-content: space-between; }
  .dnav .dbtn { min-width: 64px; min-height: 44px; }
}
/* a hand on the page: dragging sideways turns it */
.stage { cursor: default; }
.stage.dragging { cursor: grabbing; user-select: none; }
/* the join between two sheets of one day: a quiet rule, not a label shouting NEW PAGE */
.pbreak-line { text-transform: none; letter-spacing: .02em; font-style: italic; font-family: var(--serif); font-size: .78rem; opacity: .75; }
.pbreak-line .pbreak-x { font-style: normal; opacity: 0; transition: opacity .15s ease; }
.pbreak:hover .pbreak-x, .pbreak-x:focus-visible { opacity: 1; }

/* =========================================================
   ONE ROW OF TOOLS, ALL PICTURES
   Everything the open book can do sits in a single floating bar at the foot
   of the page. Nothing is labelled until you rest on it.
   ========================================================= */
.dbar { display: none !important; }            /* the old top bar is gone */
.stage { padding-top: 18px; }

.dnav:not([hidden]) {
  position: absolute; z-index: 30; left: 50%; transform: translateX(-50%);
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  width: auto; padding: 7px; border-radius: 999px;
  background: rgba(252, 246, 236, .92); backdrop-filter: blur(10px);
  border: 1px solid rgba(120, 85, 55, .16);
  box-shadow: 0 18px 40px -16px rgba(60, 38, 20, .45), 0 2px 6px rgba(60, 38, 20, .12);
}
.dnav .center { display: flex; align-items: center; gap: 4px; }
.dnav .dbtn {
  position: relative; width: 42px; height: 42px; min-width: 0; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: #6b4a2f;
  display: grid; place-items: center; cursor: pointer;
  transition: background .15s ease, color .15s ease, transform .15s ease;
}
.dnav .dbtn .ic { width: 20px; height: 20px; }
.dnav .dbtn .lbl { display: none !important; }
.dnav .dbtn:hover:not(:disabled) { background: rgba(139, 90, 60, .12); transform: translateY(-1px); }
.dnav .dbtn:active:not(:disabled) { transform: translateY(0); }
.dnav .dbtn:disabled { opacity: .3; cursor: default; }
.dnav .dbtn.solid { background: var(--accent); color: #fff6ea; }
.dnav .dbtn.solid:hover { background: #7a4c2e; }
.dnav .page-label { color: #8a6a52; font-size: .82rem; padding: 0 8px; white-space: nowrap; }
.dnav .save-status { color: #8a6a52; font-size: .78rem; padding-right: 8px; min-width: 0; }

/* what a tool does, shown when you rest on it */
.dnav .dbtn[data-tip]::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%) translateY(4px);
  padding: 6px 11px; border-radius: 9px; white-space: nowrap;
  background: #3a2a20; color: #fbeedd; font-size: .8rem; font-weight: 500; letter-spacing: .01em;
  opacity: 0; pointer-events: none; transition: opacity .16s ease, transform .16s ease;
  box-shadow: 0 8px 18px -8px rgba(0, 0, 0, .5);
}
.dnav .dbtn[data-tip]::before {
  content: ""; position: absolute; bottom: calc(100% + 4px); left: 50%;
  border: 5px solid transparent; border-top-color: #3a2a20; transform: translateX(-50%) translateY(4px);
  opacity: 0; pointer-events: none; transition: opacity .16s ease, transform .16s ease;
}
.dnav .dbtn[data-tip]:hover::after, .dnav .dbtn[data-tip]:focus-visible::after,
.dnav .dbtn[data-tip]:hover::before, .dnav .dbtn[data-tip]:focus-visible::before {
  opacity: 1; transform: translateX(-50%) translateY(0);
}
.dnav .dbtn:disabled::after, .dnav .dbtn:disabled::before { transition: none; }

@media (max-width: 640px) {
  .dnav:not([hidden]) { left: 50%; right: auto; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom, 0px)); padding: 5px; }
  .dnav .dbtn { width: 40px; height: 40px; }
  .dnav .page-label, .dnav .save-status { display: none; }
}
@media (prefers-reduced-motion: reduce) { .dnav .dbtn[data-tip]::after, .dnav .dbtn[data-tip]::before { transition: none; } }

/* =========================================================
   A LEAF WITH TWO SIDES
   The sheet you turn shows its front as it lifts and its blank back as it goes
   over, hinged on the spine, all the way round — the way a page really turns.
   ========================================================= */
.flip {
  position: absolute; top: 0; z-index: 4; pointer-events: none;
  transform-style: preserve-3d; will-change: transform;
}
.flip.to-next, .flip.to-prev { left: 20px; right: 20px; }
.flip.to-next { transform-origin: left center; }
.flip.to-prev { transform-origin: right center; }
.flip.spread.to-next { clip-path: inset(0 0 0 50%); transform-origin: 50% 50%; }
.flip.spread.to-prev { clip-path: inset(0 50% 0 0); transform-origin: 50% 50%; }

.flip .leaf-front, .flip .leaf-back {
  position: absolute !important; inset: 0; margin: 0 !important;
  backface-visibility: hidden; overflow: hidden;
}
.flip .leaf-back {
  transform: rotateY(180deg);
  background-color: var(--paper, #fffdf8);
  background-image: var(--paper-lines, none);
  box-shadow: inset 0 0 40px rgba(90, 60, 30, .08);
}
.flip.to-next .leaf-back { box-shadow: inset 12px 0 26px -12px rgba(70, 45, 20, .3); }
.flip.to-prev .leaf-back { box-shadow: inset -12px 0 26px -12px rgba(70, 45, 20, .3); }

.flip.to-next.go { animation: leafOverNext .62s cubic-bezier(.42, 0, .32, 1) forwards; }
.flip.to-prev.go { animation: leafOverPrev .62s cubic-bezier(.42, 0, .32, 1) forwards; }
@keyframes leafOverNext {
  0% { transform: rotateY(0deg); }
  88% { opacity: 1; }
  100% { transform: rotateY(-180deg); opacity: 0; }
}
@keyframes leafOverPrev {
  0% { transform: rotateY(0deg); }
  88% { opacity: 1; }
  100% { transform: rotateY(180deg); opacity: 0; }
}
@media (max-width: 760px) {
  .flip.to-next, .flip.to-prev { left: 8px; right: 8px; }
  .flip.to-next.go, .flip.to-prev.go { animation-duration: .54s; }
}
/* the spread turns the same way: one leaf, all the way over, showing its back */
.flip.spread.to-next.go { animation-name: leafOverNext; }
.flip.spread.to-prev.go { animation-name: leafOverPrev; }

/* =========================================================
   THE TURNING LEAF, BUILT TO KEEP ITS DEPTH
   The wrapper does the clipping and holds the perspective; the leaf inside does
   nothing but rotate. Clipping or hiding the back face on the leaf itself would
   make the browser flatten it, and a flat leaf has no back to show — which is
   what made the old one vanish halfway over.
   ========================================================= */
.leafwrap {
  position: absolute; top: 0; left: 20px; right: 20px; z-index: 4;
  pointer-events: none;
  perspective: 1900px; perspective-origin: 50% 42%;
}
.leafwrap.spread.to-next { clip-path: inset(0 0 0 50%); }
.leafwrap.spread.to-prev { clip-path: inset(0 50% 0 0); }

.leaf {
  position: absolute; inset: 0;
  transform-style: preserve-3d;
  will-change: transform;
  transform: rotateY(0deg);
}
.leaf.to-next { transform-origin: left center; }
.leaf.to-prev { transform-origin: right center; }
.leafwrap.spread .leaf { transform-origin: 50% 50%; }

.leaf > .leaf-front, .leaf > .leaf-back {
  position: absolute !important; inset: 0; margin: 0 !important;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.leaf > .leaf-front { overflow: hidden; }
.leaf > .leaf-back {
  transform: rotateY(180deg);
  background-color: var(--paper, #fffdf8);
  border-radius: 10px;
}
.leaf.to-next > .leaf-back { box-shadow: inset 14px 0 30px -14px rgba(70, 45, 20, .35); }
.leaf.to-prev > .leaf-back { box-shadow: inset -14px 0 30px -14px rgba(70, 45, 20, .35); }

.leaf.to-next.go { animation: leafRight .62s cubic-bezier(.42, 0, .32, 1) forwards; }
.leaf.to-prev.go { animation: leafLeft .62s cubic-bezier(.42, 0, .32, 1) forwards; }
@keyframes leafRight { to { transform: rotateY(-180deg); } }
@keyframes leafLeft { to { transform: rotateY(180deg); } }

@media (max-width: 760px) {
  .leafwrap { left: 8px; right: 8px; perspective: 1300px; }
  .leaf.to-next.go, .leaf.to-prev.go { animation-duration: .54s; }
}

/* =========================================================
   THE TURNING LEAF — FINAL
   Half the book in a spread, the whole page on its own. Hinged on the spine,
   never clipped, two sides, a clean 180° onto the opposite side.
   ========================================================= */
.paper-wrap { overflow: visible; }
.leaf {
  position: absolute; top: 0; z-index: 6; pointer-events: none;
  transform-style: preserve-3d; will-change: transform;
  transform: rotateY(0deg);
}
.leaf.to-next { transform-origin: left center; }
.leaf.to-prev { transform-origin: right center; }

.leaf > .leaf-front, .leaf > .leaf-back {
  position: absolute; inset: 0; overflow: hidden;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.leaf > .leaf-back {
  transform: rotateY(180deg);
  background: var(--paper, #fffdf8);
}
.leaf.to-next > .leaf-back { box-shadow: inset 16px 0 32px -16px rgba(70, 45, 20, .35); }
.leaf.to-prev > .leaf-back { box-shadow: inset -16px 0 32px -16px rgba(70, 45, 20, .35); }
.leaf .leaf-page { box-shadow: none; border-radius: 0; }

.leaf.to-next.go { animation: leafOver .6s cubic-bezier(.45, .05, .3, 1) forwards; }
.leaf.to-prev.go { animation: leafBack .6s cubic-bezier(.45, .05, .3, 1) forwards; }
@keyframes leafOver { from { transform: rotateY(0deg); } to { transform: rotateY(-180deg); } }
@keyframes leafBack { from { transform: rotateY(0deg); } to { transform: rotateY(180deg); } }
@media (max-width: 760px) { .leaf.to-next.go, .leaf.to-prev.go { animation-duration: .52s; } }

/* =========================================================
   THE RULED LINES BELONG TO THE SHEET, NOT TO THE WRITING
   They used to be painted on the body of the text, so they only covered as much
   of the page as was written on and were redrawn whenever the page was measured —
   which is why they arrived a moment late after a turn. A sheet is always exactly
   twenty lines tall, so the lines live there and are simply always present.
   ========================================================= */
.page-viewport {
  background-image: repeating-linear-gradient(180deg, transparent 0 calc(var(--lh) - 1px), var(--rule) calc(var(--lh) - 1px) var(--lh));
  background-position: 0 2px;
  background-repeat: repeat;
}
.page-body, .page-body.mirror { background-image: none; }

/* the back of the leaf carries a real page too, so it keeps the paper's own edge */
.leaf > .leaf-back .leaf-page { box-shadow: none; }

/* =========================================================
   SPEAKING INSTEAD OF TYPING
   A quiet strip above the tools while it listens, showing the words as they
   are caught. The microphone itself glows so it is obvious it is on.
   ========================================================= */
.hearing {
  position: absolute; z-index: 31; left: 50%; transform: translateX(-50%);
  bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: center; gap: 12px;
  max-width: min(520px, calc(100vw - 32px));
  padding: 10px 12px 10px 16px; border-radius: 999px;
  background: rgba(58, 42, 32, .95); color: #fbeedd;
  box-shadow: 0 16px 34px -14px rgba(0, 0, 0, .55);
  animation: hearIn .25s ease;
}
@keyframes hearIn { from { opacity: 0; transform: translateX(-50%) translateY(6px); } }
.hear-text {
  font-size: .92rem; line-height: 1.25; flex: 1; min-width: 0;
  max-height: 2.5em; overflow: hidden; text-overflow: ellipsis;
}
.hear-dot { display: flex; align-items: flex-end; gap: 3px; height: 16px; flex: 0 0 auto; }
.hear-dot i { width: 3px; border-radius: 2px; background: #e8b4642e; background: #e8b464; animation: hearWave 1s ease-in-out infinite; }
.hear-dot i:nth-child(1) { height: 7px; animation-delay: 0s; }
.hear-dot i:nth-child(2) { height: 14px; animation-delay: .15s; }
.hear-dot i:nth-child(3) { height: 9px; animation-delay: .3s; }
@keyframes hearWave { 0%, 100% { transform: scaleY(.5); } 50% { transform: scaleY(1); } }
.hearing .btn { flex: 0 0 auto; background: rgba(255, 245, 230, .16); color: #fbeedd; border-color: transparent; }
.hearing .btn:hover { background: rgba(255, 245, 230, .26); }

.dnav .dbtn[data-d="mic"].on { background: #b4533a; color: #fff6ea; }
.dnav .dbtn[data-d="mic"].on::after { content: "Stop listening"; }
@media (prefers-reduced-motion: reduce) { .hear-dot i { animation: none; } }
