/* =========================================================
   BASE  (colours & fonts are set by app.js from the theme)
   ========================================================= */
:root {
  --bg-a: #fff0f5; --bg-b: #ffe4ee; --bg-c: #fdf2ff;
  --surface: #fffafc; --ink: #5a3d4c; --muted: #a07f90;
  --accent: #ff7aa8; --accent-2: #ffc2d6;
  --font-head: "Playfair Display", serif; --font-body: "Quicksand", sans-serif;
  --head-scale: 1; --body-scale: 1; --base: 17px;
  --line: color-mix(in srgb, var(--accent) 22%, transparent);
  --soft: color-mix(in srgb, var(--accent-2) 35%, var(--surface));
  --shadow: 0 14px 40px color-mix(in srgb, var(--accent) 16%, transparent);
  --shadow-lg: 0 24px 60px color-mix(in srgb, var(--accent) 26%, transparent);
  --radius: 24px;
}
:root.dark {
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.5);
  --soft: color-mix(in srgb, var(--accent-2) 14%, var(--surface));
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg-a); scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  font-size: calc(var(--base) * var(--body-scale));
  line-height: 1.65;
  color: var(--ink);
  min-height: 100vh;
  background: linear-gradient(160deg, var(--bg-a), var(--bg-b) 55%, var(--bg-c)) fixed;
  transition: background 0.7s ease, color 0.4s ease;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
img { max-width: 100%; display: block; }
::selection { background: var(--accent-2); color: var(--ink); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 8px; }

h1, h2, h3, .site-title, .card-title { font-family: var(--font-head); font-weight: 700; line-height: 1.15; letter-spacing: 0.01em; }

/* =========================================================
   SKY & FLOATING DECOR
   ========================================================= */
.sky, .floaters { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.clouds, .stars { position: absolute; inset: 0; opacity: 0; transition: opacity 0.8s; }
.sky-clouds .clouds { opacity: 1; }
.sky-stars .stars { opacity: 1; }
.clouds span { position: absolute; font-size: 100px; opacity: 0.5; animation: drift linear infinite; }
.clouds span:nth-child(1) { top: 9%;  animation-duration: 80s; }
.clouds span:nth-child(2) { top: 36%; animation-duration: 110s; animation-delay: -50s; font-size: 64px; }
.clouds span:nth-child(3) { top: 68%; animation-duration: 140s; animation-delay: -95s; font-size: 120px; }
@keyframes drift { from { transform: translateX(-220px); } to { transform: translateX(110vw); } }

.stars i { position: absolute; border-radius: 50%; background: #fff; box-shadow: 0 0 6px #fff; animation: twinkle 3.5s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: 0.15; transform: scale(0.5); } }

.floaters span { position: absolute; opacity: 0.6; animation-timing-function: linear; animation-iteration-count: infinite; will-change: transform; }
.floaters .rise { bottom: -50px; animation-name: rise; }
.floaters .fall { top: -50px; animation-name: fall; }
.floaters .rain { top: -30px; animation-name: rain; opacity: 0.35; }
@keyframes rise { 0% { transform: translate(0, 0) rotate(0); } 50% { transform: translate(30px, -55vh) rotate(25deg); } 100% { transform: translate(-20px, -115vh) rotate(-15deg); } }
@keyframes fall { 0% { transform: translate(0, 0) rotate(0); } 50% { transform: translate(-40px, 55vh) rotate(160deg); } 100% { transform: translate(30px, 115vh) rotate(320deg); } }
@keyframes rain { to { transform: translate(-30px, 115vh); } }
.no-motion .clouds span, .no-motion .stars i { animation: none; }

/* =========================================================
   TOP BAR
   ========================================================= */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 4px; z-index: 30; opacity: 0; transition: opacity 0.3s; }
.progress.show { opacity: 1; }
.progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 0 4px 4px 0; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px clamp(16px, 4vw, 40px);
  transition: background 0.3s, box-shadow 0.3s;
}
.scrolled .topbar {
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 4px 24px color-mix(in srgb, var(--accent) 10%, transparent);
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-head); font-size: calc(22px * var(--head-scale)); font-weight: 700; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 22px;
  background: linear-gradient(135deg, var(--accent-2), var(--surface)); box-shadow: var(--shadow);
}
.top-actions { display: flex; gap: 10px; }

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 0.9em;
  background: var(--surface); box-shadow: var(--shadow);
  transition: transform 0.25s, box-shadow 0.25s, background 0.3s;
}
.pill:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.pill.accent { background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--accent-2))); color: #fff; }
:root.dark .pill.accent { color: #1b1830; }

main { position: relative; z-index: 1; padding: 0 clamp(16px, 4vw, 40px); outline: none; }

/* =========================================================
   HOME
   ========================================================= */
.hero { text-align: center; padding: clamp(40px, 8vh, 90px) 0 36px; animation: rise-in 0.8s both; }
.hero.small { padding-top: 120px; }
.hero.small p { margin-top: 20px; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.18em; font-size: 0.72em; font-weight: 700; color: var(--muted); }
.site-title {
  font-size: calc(clamp(52px, 10vw, 104px) * var(--head-scale));
  margin: 10px 0 12px;
  background: linear-gradient(100deg, var(--accent), var(--ink) 40%, var(--accent) 60%, var(--accent-2));
  background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 9s ease-in-out infinite;
  padding: 0 0.1em;
}
@keyframes shimmer { 50% { background-position: 100% 0; } }
.tagline { font-size: 1.15em; color: var(--muted); }
.quote { margin-top: 18px; font-style: italic; min-height: 1.6em; transition: opacity 0.45s; }
.quote.fade { opacity: 0; }

.about {
  max-width: 760px; margin: 0 auto 40px;
  display: flex; gap: 24px; align-items: center;
  padding: 26px 30px; border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow); animation: rise-in 0.8s 0.1s both;
}
.avatar {
  flex: none; width: 92px; height: 92px; border-radius: 50%; font-size: 50px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent-2), var(--soft));
  box-shadow: inset 0 0 0 4px var(--surface), 0 0 0 3px var(--accent-2);
  animation: bob 3.5s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translateY(-6px) rotate(-3deg); } }
.about h2 { font-size: calc(1.7em * var(--head-scale)); margin-bottom: 4px; }
.about p { color: var(--muted); }
.stats { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 12px; font-size: 0.85em; color: var(--muted); }
.stats b { color: var(--ink); }

.toolbar { max-width: 1100px; margin: 0 auto 36px; display: grid; gap: 14px; justify-items: center; animation: rise-in 0.8s 0.2s both; }
.search {
  display: flex; align-items: center; gap: 10px; width: min(520px, 100%);
  padding: 12px 20px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow);
  border: 2px solid transparent; transition: border-color 0.25s;
}
.search:focus-within { border-color: var(--accent-2); }
.search input { flex: 1; border: none; outline: none; background: none; font: inherit; color: var(--ink); }
.search input::placeholder { color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.chip {
  padding: 8px 16px; border-radius: 999px; font-weight: 600; font-size: 0.88em;
  background: var(--surface); box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 10%, transparent);
  border: 2px solid transparent; transition: all 0.25s;
}
.chip.small { padding: 5px 12px; font-size: 0.8em; color: var(--muted); }
.chip:hover { transform: translateY(-2px); }
.chip.on { border-color: var(--accent); background: var(--soft); color: var(--ink); }

.empty { text-align: center; color: var(--muted); padding: 30px 0 60px; position: relative; z-index: 1; }

@keyframes rise-in { from { opacity: 0; transform: translateY(24px); } }

/* =========================================================
   POST CARDS (shared)
   ========================================================= */
.posts { max-width: 1140px; margin: 0 auto; padding-bottom: 60px; }
.card {
  display: block; position: relative;
  background: var(--surface); color: var(--ink);
  animation: rise-in 0.6s both; animation-delay: var(--delay, 0s);
  transition: transform 0.4s cubic-bezier(.2,.8,.3,1.25), box-shadow 0.4s;
}
.card-cover { overflow: hidden; }
.card-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.8s ease; }
.card:hover .card-cover img { transform: scale(1.06); }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.78em; font-weight: 600; color: var(--muted); }
.mood-emoji { font-size: 1.5em; line-height: 1; margin-right: 2px; }
.dot { opacity: 0.6; }
.card-title { font-size: calc(1.45em * var(--head-scale)); margin: 8px 0; }
.card-excerpt { color: var(--muted); font-size: 0.93em; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.card-tags span { font-size: 0.72em; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--soft); color: var(--muted); }
.read-more { display: inline-block; margin-top: 14px; font-weight: 700; font-size: 0.85em; color: var(--accent); transition: transform 0.25s; }
.card:hover .read-more { transform: translateX(5px); }

/* ---------- Polaroid ---------- */
.layout-polaroid { display: grid; gap: 44px 34px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); align-items: start; padding-top: 10px; }
.layout-polaroid .card { padding: 14px 14px 22px; border-radius: 6px; transform: rotate(var(--tilt)); box-shadow: var(--shadow); }
.layout-polaroid .card::before {
  content: ""; position: absolute; top: -12px; left: 50%; width: 100px; height: 26px; z-index: 2;
  transform: translateX(-50%) rotate(-4deg);
  background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--mood-accent) 45%, transparent) 0 8px, color-mix(in srgb, var(--surface) 70%, transparent) 8px 16px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.layout-polaroid .card-cover { aspect-ratio: 4 / 3; border-radius: 3px; margin-bottom: 4px; }
.layout-polaroid .card-body { padding: 12px 8px 0; }
.layout-polaroid .card:hover { transform: rotate(0) translateY(-10px) scale(1.02); box-shadow: var(--shadow-lg); z-index: 2; }

/* ---------- Magazine ---------- */
.layout-magazine { display: grid; gap: 30px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.layout-magazine .card { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.layout-magazine .card-cover { aspect-ratio: 16 / 10; }
.layout-magazine .card-body { padding: 22px 24px 26px; border-top: 4px solid var(--mood-accent); flex: 1; }
.layout-magazine .card:hover { transform: translateY(-8px); box-shadow: var(--shadow-lg); }
@media (min-width: 760px) {
  .layout-magazine .card:first-child { grid-column: 1 / -1; flex-direction: row; min-height: 360px; }
  .layout-magazine .card:first-child .card-cover { flex: 1.3; aspect-ratio: auto; }
  .layout-magazine .card:first-child .card-body { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 40px; border-top: none; border-left: 5px solid var(--mood-accent); }
  .layout-magazine .card:first-child .card-title { font-size: calc(2.3em * var(--head-scale)); }
  .layout-magazine .card:first-child .card-excerpt { -webkit-line-clamp: 5; font-size: 1em; }
}

/* ---------- Journal ---------- */
.layout-journal { max-width: 780px; display: grid; gap: 30px; }
.layout-journal .card {
  border-radius: 6px 18px 18px 6px; padding: 34px 34px 30px 70px; box-shadow: var(--shadow);
  background:
    linear-gradient(90deg, transparent 50px, color-mix(in srgb, var(--accent) 45%, transparent) 50px 52px, transparent 52px),
    repeating-linear-gradient(var(--surface) 0 31px, var(--line) 31px 32px);
  background-color: var(--surface);
  display: grid; grid-template-columns: 1fr auto; gap: 0 24px;
}
.layout-journal .card::before {
  content: ""; position: absolute; left: 18px; top: 28px; bottom: 28px; width: 14px;
  background: radial-gradient(circle, var(--bg-b) 5px, transparent 6px) 0 0 / 14px 40px repeat-y;
}
.layout-journal .card-cover { grid-column: 2; grid-row: 1; width: 150px; height: 150px; border-radius: 14px; transform: rotate(3deg); box-shadow: var(--shadow); border: 6px solid var(--surface); }
.layout-journal .card-body { grid-column: 1; grid-row: 1; }
.layout-journal .card-title { font-size: calc(1.8em * var(--head-scale)); }
.layout-journal .card:hover { transform: translateX(8px); }
@media (max-width: 600px) {
  .layout-journal .card { grid-template-columns: 1fr; padding-left: 58px; }
  .layout-journal .card-cover { grid-column: 1; grid-row: 1; width: 100%; height: 170px; margin-bottom: 16px; transform: none; }
  .layout-journal .card-body { grid-row: 2; }
}

/* ---------- Sticky notes ---------- */
.layout-sticky { display: grid; gap: 38px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); padding-top: 14px; }
.layout-sticky .card {
  min-height: 260px; padding: 34px 24px 24px; border-radius: 4px 4px 4px 28px;
  background: linear-gradient(170deg, color-mix(in srgb, var(--note) 85%, #fff), var(--note));
  color: #3c3240; transform: rotate(var(--tilt));
  box-shadow: 0 16px 30px -12px rgba(60, 40, 60, 0.35);
}
.layout-sticky .card::before { content: "📌"; position: absolute; top: -14px; left: 50%; transform: translateX(-50%) rotate(15deg); font-size: 28px; }
.layout-sticky .card-cover { display: none; }
.layout-sticky .card-meta, .layout-sticky .card-excerpt { color: #6a5d6e; }
.layout-sticky .card-tags span { background: rgba(255,255,255,0.55); color: #6a5d6e; }
.layout-sticky .read-more { color: #3c3240; }
.layout-sticky .card-title { font-size: calc(1.55em * var(--head-scale)); }
.layout-sticky .card:hover { transform: rotate(0) scale(1.05); z-index: 2; }

/* ---------- Minimal ---------- */
.layout-minimal { max-width: 800px; }
.layout-minimal .card {
  background: none; display: grid; grid-template-columns: 110px 1fr; gap: 24px;
  padding: 28px 8px; border-bottom: 1px solid var(--line);
}
.layout-minimal .card:first-child { border-top: 1px solid var(--line); }
.layout-minimal .card-cover { grid-column: 1; width: 110px; height: 110px; border-radius: 50%; }
.layout-minimal .card-body { grid-column: 2; grid-row: 1; }
.layout-minimal .card:not(:has(.card-cover)) .card-body { grid-column: 1 / -1; padding-left: 134px; }
.layout-minimal .card-title { font-size: calc(1.6em * var(--head-scale)); transition: color 0.25s; }
.layout-minimal .card:hover .card-title { color: var(--accent); }
.layout-minimal .card:hover { transform: translateX(6px); }
@media (max-width: 600px) {
  .layout-minimal .card { grid-template-columns: 1fr; }
  .layout-minimal .card-cover { display: none; }
  .layout-minimal .card-body, .layout-minimal .card:not(:has(.card-cover)) .card-body { grid-column: 1; padding-left: 0; }
}

/* =========================================================
   SINGLE ENTRY
   ========================================================= */
.post { max-width: 780px; margin: 0 auto; padding: 20px 0 60px; animation: rise-in 0.7s both; }
.back { display: inline-block; font-weight: 700; font-size: 0.9em; color: var(--muted); margin-bottom: 26px; transition: color 0.2s, transform 0.2s; }
.back:hover { color: var(--accent); transform: translateX(-4px); }
.post-head { text-align: center; margin-bottom: 34px; }
.post-mood { display: inline-block; padding: 6px 16px; border-radius: 999px; background: var(--soft); font-weight: 700; font-size: 0.85em; }
.post-head h1 { font-size: calc(clamp(38px, 6vw, 64px) * var(--head-scale)); margin: 18px 0 14px; }
.post-meta { color: var(--muted); font-size: 0.9em; display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.post-cover { margin: 0 0 40px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-lg); }
.post-cover img { width: 100%; max-height: 460px; object-fit: cover; }
.divider { text-align: center; color: var(--accent); letter-spacing: 0.6em; margin: 0 0 34px; }

.post-content {
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: clamp(26px, 5vw, 54px);
  font-size: 1.07em; line-height: 1.9;
}
.post-content > * + * { margin-top: 1.15em; }
.post-content > p:first-child::first-letter {
  font-family: var(--font-head); float: left; font-size: 3.6em; line-height: 0.9;
  padding: 6px 12px 0 0; color: var(--accent);
}
.post-content h2, .post-content h3, .post-content h4 { margin-top: 1.6em; }
.post-content h2 { font-size: calc(1.7em * var(--head-scale)); }
.post-content h3 { font-size: calc(1.35em * var(--head-scale)); }
.post-content h4 { font-size: calc(1.15em * var(--head-scale)); }
.post-content a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.post-content ul, .post-content ol { padding-left: 1.4em; }
.post-content li { margin: 0.35em 0; padding-left: 0.3em; }
.post-content li::marker { color: var(--accent); font-weight: 700; }
.post-content ul { list-style: "✿  "; }
.post-content blockquote {
  position: relative; padding: 22px 28px 22px 60px; border-radius: 18px;
  background: var(--soft); font-family: var(--font-head); font-size: calc(1.2em * var(--head-scale)); line-height: 1.5;
}
.post-content blockquote::before { content: "“"; position: absolute; left: 18px; top: 2px; font-size: 3.4em; color: var(--accent); font-family: Georgia, serif; }
.post-content mark { background: linear-gradient(transparent 45%, var(--accent-2) 45%); color: inherit; padding: 0 3px; border-radius: 3px; }
.post-content code { font-family: ui-monospace, monospace; font-size: 0.88em; background: var(--soft); padding: 2px 7px; border-radius: 6px; }
.post-content hr { border: none; text-align: center; color: var(--accent); margin: 2em 0; }
.post-content hr::after { content: "✿   ✿   ✿"; letter-spacing: 0.3em; }
.post-content figure img, .post-content .inline-img { border-radius: 16px; box-shadow: var(--shadow); margin: 0 auto; }
.post-content figcaption { text-align: center; color: var(--muted); font-size: 0.85em; font-style: italic; margin-top: 10px; }

.post-tags { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 30px 0 10px; }
.post-tags a { padding: 6px 14px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); font-weight: 700; font-size: 0.82em; color: var(--muted); transition: transform 0.2s, color 0.2s; }
.post-tags a:hover { color: var(--accent); transform: translateY(-2px); }
.post-actions { display: flex; justify-content: center; align-items: center; gap: 16px; flex-wrap: wrap; margin: 22px 0 40px; }
.theme-note { font-size: 0.82em; color: var(--muted); }
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.nav-card { padding: 20px 24px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); transition: transform 0.25s, box-shadow 0.25s; }
.nav-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.nav-card small { display: block; color: var(--muted); font-weight: 700; font-size: 0.75em; text-transform: uppercase; letter-spacing: 0.12em; }
.nav-card span { font-family: var(--font-head); font-size: calc(1.15em * var(--head-scale)); font-weight: 700; }
.nav-card.right { text-align: right; }

/* =========================================================
   FOOTER & EXTRAS
   ========================================================= */
.footer { position: relative; z-index: 1; text-align: center; padding: 30px 20px 50px; color: var(--muted); font-size: 0.88em; }
.footer .small { font-size: 0.85em; margin-top: 4px; opacity: 0.8; }

.to-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 15; width: 48px; height: 48px; border-radius: 50%;
  background: var(--surface); box-shadow: var(--shadow); font-size: 20px; font-weight: 700;
  opacity: 0; transform: translateY(20px); pointer-events: none; transition: all 0.3s;
}
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }

.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 60; transform: translate(-50%, 30px);
  padding: 12px 22px; border-radius: 999px; background: var(--ink); color: var(--surface);
  font-weight: 600; font-size: 0.9em; opacity: 0; pointer-events: none; transition: all 0.35s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* =========================================================
   CUSTOMIZE DRAWER
   ========================================================= */
.overlay { position: fixed; inset: 0; z-index: 40; background: rgba(40, 25, 50, 0.3); backdrop-filter: blur(3px); animation: fade 0.3s; }
.overlay[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 50; width: min(440px, 100%);
  background: var(--surface); box-shadow: -20px 0 60px rgba(0,0,0,0.15);
  transform: translateX(105%); transition: transform 0.45s cubic-bezier(.2,.8,.2,1);
  display: flex; flex-direction: column; visibility: hidden;
}
.drawer.open { transform: none; visibility: visible; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 22px 26px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: calc(1.6em * var(--head-scale)); }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; background: var(--soft); font-size: 15px; }
.drawer-body { overflow-y: auto; padding: 8px 26px 40px; }
.drawer-body section { padding: 20px 0; border-bottom: 1px dashed var(--line); }
.drawer-body h3 { font-family: var(--font-body); font-size: 0.78em; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); margin-bottom: 14px; }
.drawer-body h3 small { text-transform: none; letter-spacing: 0; font-weight: 500; margin-left: 6px; }

.swatches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.swatch { display: grid; gap: 6px; justify-items: center; font-size: 0.72em; font-weight: 600; text-align: center; }
.swatch-color {
  width: 100%; aspect-ratio: 1.4; border-radius: 16px; display: grid; place-items: center; font-size: 24px;
  border: 3px solid transparent; box-shadow: 0 4px 12px rgba(0,0,0,0.08); transition: transform 0.2s, border-color 0.2s;
}
.swatch:hover .swatch-color { transform: translateY(-3px); }
.swatch.on .swatch-color { border-color: var(--ink); }
.hint { margin-top: 16px; font-size: 0.8em; color: var(--muted); line-height: 2.2; }
.mood-pick { padding: 3px 10px; margin: 0 2px; border-radius: 999px; background: var(--soft); font-size: 0.95em; font-weight: 600; }
.mood-pick:hover { background: var(--accent-2); }

.font-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.font-opt {
  display: grid; gap: 2px; padding: 12px 10px; border-radius: 14px; text-align: center;
  background: var(--bg-a); border: 2px solid transparent; transition: border-color 0.2s, transform 0.2s;
}
.font-opt:hover { transform: translateY(-2px); }
.font-opt.on { border-color: var(--accent); background: var(--soft); }
.font-opt .sample { line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.font-opt small { font-size: 0.68em; color: var(--muted); font-weight: 600; }

.layout-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.layout-opt {
  display: grid; gap: 4px; justify-items: center; padding: 14px 6px; border-radius: 14px;
  background: var(--bg-a); border: 2px solid transparent; font-size: 0.78em; font-weight: 700; transition: all 0.2s;
}
.layout-opt span { font-size: 24px; }
.layout-opt.on { border-color: var(--accent); background: var(--soft); }

.seg { display: flex; background: var(--bg-a); border-radius: 999px; padding: 4px; }
.seg button { flex: 1; padding: 8px; border-radius: 999px; font-weight: 600; font-size: 0.85em; transition: all 0.2s; }
.seg button.on { background: var(--surface); box-shadow: var(--shadow); color: var(--accent); }

.toggles { display: grid; gap: 14px; }
.toggle { display: flex; align-items: center; gap: 12px; font-size: 0.9em; font-weight: 600; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.track { flex: none; width: 46px; height: 26px; border-radius: 999px; background: var(--line); position: relative; transition: background 0.25s; }
.track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.2); transition: transform 0.25s; }
.toggle input:checked + .track { background: var(--accent); }
.toggle input:checked + .track::after { transform: translateX(20px); }
.toggle input:focus-visible + .track { outline: 3px solid var(--accent); outline-offset: 2px; }
.reset { margin-top: 24px; width: 100%; justify-content: center; }


/* =========================================================
   SMALL SCREENS & ACCESSIBILITY
   ========================================================= */
@media (max-width: 640px) {
  .pill span { display: none; }
  .pill { padding: 10px 14px; }
  .about { flex-direction: column; text-align: center; padding: 26px 22px; }
  .stats { justify-content: center; }
  .post-nav { grid-template-columns: 1fr; }
  .swatches { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* =========================================================
   WRITING PAGE
   ========================================================= */
.writer { max-width: 1240px; margin: 0 auto; padding-bottom: 80px; display: grid; gap: 26px; }
.panel {
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(20px, 3vw, 32px);
}
.clock-card {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
  padding: 22px 30px; border-radius: var(--radius);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent-2) 70%, var(--surface)), var(--surface));
  box-shadow: var(--shadow); animation: rise-in 0.6s both;
}
.clock { font-family: var(--font-head); font-size: calc(2.6em * var(--head-scale)); font-weight: 700; line-height: 1.1; }
.clock-sub { color: var(--muted); font-weight: 600; }
.when summary { cursor: pointer; font-weight: 700; font-size: 0.88em; color: var(--muted); list-style: none; padding: 8px 14px; border-radius: 999px; background: var(--surface); }
.when summary::-webkit-details-marker { display: none; }
.when[open] { display: grid; gap: 8px; justify-items: end; }
.when input { font: inherit; color: var(--ink); background: var(--surface); border: 2px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.link-btn { font-size: 0.82em; font-weight: 700; color: var(--accent); }

.writer-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 26px; align-items: start; }
.preview { position: sticky; top: 90px; max-height: calc(100vh - 110px); overflow-y: auto; }
.preview .post { padding: 10px 0 0; animation: none; }
.preview .post-head { margin-bottom: 22px; }
.preview .post-head h1 { font-size: calc(clamp(30px, 3.4vw, 44px) * var(--head-scale)); margin: 14px 0 10px; }
.preview .post-cover { margin-bottom: 24px; }
.preview .post-content { box-shadow: none; background: var(--bg-a); padding: 26px; font-size: 1em; }
.placeholder { color: var(--muted); font-style: italic; }
.placeholder::first-letter { all: unset; }

.field { display: grid; gap: 8px; margin-bottom: 22px; }
.field > span { font-size: 0.78em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }
.field > span small { text-transform: none; letter-spacing: 0; font-weight: 500; }
.field input[type="text"], .field input[type="password"], .field textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--bg-a);
  border: 2px solid transparent; border-radius: 16px; padding: 12px 16px; outline: none; transition: border-color 0.2s, background 0.2s;
}
.field input:focus, .field textarea:focus { border-color: var(--accent-2); background: var(--surface); }
#title { font-family: var(--font-head); font-size: calc(1.5em * var(--head-scale)); font-weight: 700; }
.field textarea { resize: vertical; min-height: 260px; line-height: 1.8; }
.counter { font-size: 0.78em; color: var(--muted); text-align: right; }

.mood-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.mood-btn {
  display: grid; justify-items: center; gap: 2px; padding: 10px 4px; border-radius: 16px;
  background: var(--bg-a); font-size: 0.74em; font-weight: 700; border: 2px solid transparent; transition: all 0.2s;
}
.mood-btn span { font-size: 26px; line-height: 1.1; transition: transform 0.25s; }
.mood-btn:hover span { transform: scale(1.2) rotate(-6deg); }
.mood-btn.on { border-color: var(--accent); background: var(--soft); }

.theme-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.theme-dot {
  width: 42px; height: 42px; border-radius: 50%; font-size: 18px; display: grid; place-items: center;
  border: 3px solid transparent; box-shadow: 0 3px 10px rgba(0,0,0,0.08); transition: transform 0.2s, border-color 0.2s;
}
.theme-dot.auto { background: var(--bg-a); }
.theme-dot:hover { transform: translateY(-3px); }
.theme-dot.on { border-color: var(--ink); }

.toolbar-md { display: flex; flex-wrap: wrap; gap: 6px; }
.toolbar-md button { min-width: 38px; height: 36px; padding: 0 10px; border-radius: 10px; background: var(--bg-a); font-weight: 700; transition: background 0.2s; }
.toolbar-md button:hover { background: var(--accent-2); }
.emoji-pop { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; padding: 10px; border-radius: 16px; background: var(--bg-a); }
.emoji-pop[hidden] { display: none; }
.emoji-pop button { font-size: 22px; padding: 4px; border-radius: 8px; }
.emoji-pop button:hover { background: var(--surface); transform: scale(1.15); }

.photo-drop {
  position: relative; display: grid; place-items: center; min-height: 90px; padding: 16px; border-radius: 16px;
  border: 2px dashed var(--accent-2); background: var(--bg-a); color: var(--muted); font-weight: 600; text-align: center; transition: all 0.2s;
}
.photo-drop:hover, .photo-drop.has { border-color: var(--accent); color: var(--ink); }
.photo-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.actions.center { justify-content: center; }
.pill.big { padding: 14px 26px; font-size: 1em; }
.pill.ghost { background: transparent; box-shadow: none; color: var(--muted); }
.saved { margin-top: 12px; font-size: 0.78em; color: var(--muted); }

.connect summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.connect summary::-webkit-details-marker { display: none; }
.connect[open] summary { margin-bottom: 16px; }
.status { font-size: 0.72em; padding: 3px 10px; border-radius: 999px; background: var(--bg-a); color: var(--muted); }
.status.ok { background: #d6f5e3; color: #2f6b47; }
.help { color: var(--muted); font-size: 0.9em; margin-bottom: 18px; }
.conn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.connect .toggle { margin: 0 0 18px; }

.dialog {
  position: fixed; left: 50%; top: 50%; z-index: 55; transform: translate(-50%, -50%);
  width: min(440px, calc(100% - 32px)); padding: 34px 30px 28px; text-align: center;
  background: var(--surface); border-radius: 28px; box-shadow: var(--shadow-lg); animation: pop 0.35s both;
}
.dialog[hidden] { display: none; }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -46%) scale(0.95); } }
.dialog-emoji { font-size: 52px; animation: bob 2.5s ease-in-out infinite; }
.dialog h2 { font-size: calc(1.8em * var(--head-scale)); margin: 8px 0; }
.dialog p { color: var(--muted); margin-bottom: 22px; }

@media (max-width: 900px) {
  .writer-grid { grid-template-columns: 1fr; }
  .preview { position: static; max-height: none; }
}
@media (max-width: 520px) {
  .mood-grid { grid-template-columns: repeat(3, 1fr); }
  .conn-grid { grid-template-columns: 1fr; }
  .emoji-pop { grid-template-columns: repeat(8, 1fr); }
  .clock { font-size: calc(2em * var(--head-scale)); }
}
.write-page .topbar { position: relative; }
.post-content > :not(:first-child) { clear: both; }

/* =========================================================
   NAVIGATION & SOUNDS
   ========================================================= */
.main-nav { display: flex; gap: 4px; padding: 5px; border-radius: 999px; background: color-mix(in srgb, var(--surface) 75%, transparent); box-shadow: var(--shadow); }
.main-nav a { padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: 0.85em; color: var(--muted); transition: all 0.25s; white-space: nowrap; }
.main-nav a:hover { color: var(--ink); }
.main-nav a.on { background: var(--soft); color: var(--ink); }
.pill.icon { padding: 10px 13px; }
#soundBtn.playing { background: var(--soft); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 25%, transparent); } }

.sound-pop {
  position: fixed; top: 72px; right: clamp(16px, 4vw, 40px); z-index: 25; width: 260px; padding: 18px;
  border-radius: 22px; background: var(--surface); box-shadow: var(--shadow-lg); animation: rise-in 0.25s both;
}
.sound-pop[hidden] { display: none; }
.sound-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 14px; }
.sound-grid button { display: grid; justify-items: center; gap: 2px; padding: 12px 6px; border-radius: 16px; background: var(--bg-a); font-size: 24px; border: 2px solid transparent; transition: all 0.2s; }
.sound-grid button span { font-size: 12px; font-weight: 700; }
.sound-grid button.on { border-color: var(--accent); background: var(--soft); }
.vol { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.vol input { flex: 1; accent-color: var(--accent); }

/* =========================================================
   HOME EXTRAS
   ========================================================= */
.memory {
  max-width: 760px; margin: -14px auto 36px; display: flex; align-items: center; gap: 16px;
  padding: 18px 22px; border-radius: 22px; position: relative; z-index: 1;
  background: linear-gradient(120deg, var(--soft), var(--surface)); box-shadow: var(--shadow);
  border: 2px dashed color-mix(in srgb, var(--accent) 35%, transparent); transition: transform 0.3s;
  animation: rise-in 0.8s 0.15s both;
}
.memory:hover { transform: translateY(-4px) rotate(-0.4deg); }
.memory-icon { font-size: 34px; flex: none; }
.memory-text { display: grid; gap: 2px; flex: 1; min-width: 0; }
.memory-text small { text-transform: uppercase; letter-spacing: 0.14em; font-weight: 700; font-size: 0.68em; color: var(--accent); }
.memory-text b { font-family: var(--font-head); font-size: calc(1.2em * var(--head-scale)); }
.memory-text span { color: var(--muted); font-size: 0.88em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.memory-go { font-size: 1.4em; color: var(--accent); }

.card.locked .card-excerpt { font-style: italic; }
.lock-badge { position: absolute; top: 14px; right: 14px; z-index: 3; padding: 4px 10px; border-radius: 999px; background: var(--ink); color: var(--surface); font-size: 0.7em; font-weight: 700; }
.layout-sticky .lock-badge { top: 18px; }

.post-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.post-chips span { padding: 5px 13px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); font-size: 0.82em; font-weight: 600; }

.unlock { max-width: 460px; margin: 10px auto 40px; padding: 36px 30px; text-align: center; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-lg); }
.unlock-lock { font-size: 54px; animation: bob 3s ease-in-out infinite; }
.unlock p { color: var(--muted); margin-top: 8px; }
.unlock-hint { font-style: italic; }
.unlock-row { display: flex; gap: 10px; margin-top: 20px; }
.unlock-row input, .dlg-input { flex: 1; min-width: 0; font: inherit; color: var(--ink); background: var(--bg-a); border: 2px solid transparent; border-radius: 999px; padding: 11px 18px; outline: none; }
.unlock-row input:focus, .dlg-input:focus { border-color: var(--accent-2); }
.unlock-msg { min-height: 1.4em; font-weight: 600; color: var(--accent) !important; }
.shake { animation: shake 0.4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.dlg-input { width: 100%; margin-bottom: 18px; }

/* =========================================================
   CALENDAR · JOURNEY · GALLERY
   ========================================================= */
.page-head { text-align: center; padding: clamp(30px, 6vh, 60px) 0 30px; animation: rise-in 0.7s both; }
.page-title { font-size: calc(clamp(44px, 8vw, 80px) * var(--head-scale)); margin: 8px 0; color: var(--accent); }
.panel-card { max-width: 900px; margin: 0 auto 26px; padding: clamp(20px, 3vw, 32px); border-radius: var(--radius); background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: var(--shadow); position: relative; z-index: 1; animation: rise-in 0.7s 0.1s both; }
.panel-card h3 { font-size: calc(1.4em * var(--head-scale)); margin-bottom: 16px; }
.panel-card h3.mt { margin-top: 26px; }
.muted { color: var(--muted); }

.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.cal-head h2 { font-size: calc(1.6em * var(--head-scale)); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-dow { text-align: center; font-size: 0.72em; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; padding-bottom: 4px; }
.cal-cell { position: relative; aspect-ratio: 1; border-radius: 14px; background: var(--bg-a); display: grid; place-items: center; transition: transform 0.2s; }
.cal-cell.empty { background: none; }
.cal-cell.today { outline: 2px dashed var(--accent); }
.cal-num { position: absolute; top: 5px; left: 8px; font-size: 0.72em; font-weight: 700; color: var(--muted); }
.cal-cell.has { box-shadow: var(--shadow); }
.cal-cell.has .cal-num { color: #4a3a46; }
.cal-cell.has:hover { transform: scale(1.08) rotate(-2deg); z-index: 2; }
.cal-mood { font-size: clamp(18px, 3.5vw, 30px); margin-top: 8px; }
.cal-more { position: absolute; bottom: 4px; right: 6px; font-size: 0.65em; font-weight: 700; color: #4a3a46; }
.month-chips { margin-top: 20px; }

.month-list { max-width: 900px; margin: 0 auto 60px; position: relative; z-index: 1; }
.month-list h3 { font-size: calc(1.3em * var(--head-scale)); margin: 10px 4px 14px; }
.row-entry { display: flex; align-items: center; gap: 16px; padding: 14px 18px; margin-bottom: 10px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); transition: transform 0.25s; }
.row-entry:hover { transform: translateX(6px); }
.row-day { display: grid; justify-items: center; min-width: 46px; }
.row-day b { font-family: var(--font-head); font-size: 1.6em; line-height: 1; }
.row-day small { font-size: 0.7em; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.row-mood { font-size: 26px; }
.row-title { display: grid; font-weight: 700; }
.row-title small { font-weight: 500; color: var(--muted); font-size: 0.8em; }

.stat-grid { max-width: 900px; margin: 0 auto 26px; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; position: relative; z-index: 1; }
.stat { padding: 20px; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); text-align: center; animation: rise-in 0.6s both; }
.stat b { display: block; font-family: var(--font-head); font-size: calc(2em * var(--head-scale)); color: var(--accent); line-height: 1.1; }
.stat span { font-size: 0.8em; font-weight: 700; color: var(--muted); }

.mood-chart { width: 100%; height: auto; overflow: visible; }
.mood-chart .grid-line { stroke: var(--line); stroke-dasharray: 4 6; }
.mood-chart .axis { font-size: 14px; }
.mood-area { fill: color-mix(in srgb, var(--accent-2) 45%, transparent); }
.mood-line { fill: none; stroke: var(--accent); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.mood-dot { fill: var(--surface); stroke: var(--accent); stroke-width: 3; cursor: pointer; transition: r 0.2s; }
.mood-dot:hover { r: 9; }
.chart-note { text-align: center; font-size: 0.8em; color: var(--muted); margin-top: 6px; }

.two-col { max-width: 900px; margin: 0 auto 60px; display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.two-col .panel-card { margin: 0; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 28px; align-items: center; gap: 10px; margin: 10px 0; font-size: 0.88em; font-weight: 600; }
.bar { height: 14px; border-radius: 999px; background: var(--bg-a); overflow: hidden; }
.bar-fill { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--accent); transition: width 1s cubic-bezier(.2,.8,.2,1); }
.bar-num { text-align: right; color: var(--muted); }
.chips.left { justify-content: flex-start; }

.gallery { max-width: 1140px; margin: 0 auto 60px; columns: 3 280px; column-gap: 26px; position: relative; z-index: 1; }
.shot { display: block; break-inside: avoid; margin-bottom: 26px; padding: 12px 12px 16px; border-radius: 6px; background: var(--surface); box-shadow: var(--shadow); transform: rotate(var(--tilt)); transition: transform 0.35s, box-shadow 0.35s; }
.shot:hover { transform: rotate(0) scale(1.03); box-shadow: var(--shadow-lg); z-index: 2; position: relative; }
.shot img { width: 100%; border-radius: 3px; }
.shot-cap { display: grid; padding: 12px 4px 0; font-family: var(--font-head); font-weight: 700; }
.shot-cap small { font-family: var(--font-body); font-weight: 600; color: var(--muted); font-size: 0.75em; }

/* =========================================================
   WRITER EXTRAS
   ========================================================= */
.field-row { display: flex !important; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.field-tools { display: flex; gap: 6px; text-transform: none; letter-spacing: 0; }
.mini { font: inherit; font-size: 0.95em; font-weight: 700; color: var(--ink); padding: 6px 12px; border-radius: 999px; background: var(--bg-a); border: none; cursor: pointer; }
.mini:hover { background: var(--accent-2); }
.prompt-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-radius: 16px; background: var(--soft); font-weight: 600; animation: rise-in 0.3s both; }
.prompt-card[hidden] { display: none; }
.prompt-actions { display: flex; gap: 14px; }
.counter { display: flex; justify-content: space-between; }
#micBtn.live { background: var(--accent); color: #fff; animation: pulse 1.5s infinite; }

.lock-box { padding: 18px 20px; border-radius: 18px; background: var(--bg-a); margin-bottom: 22px; transition: background 0.3s; }
.lock-box.on { background: var(--soft); }
.lock-fields { margin-top: 16px; }
.lock-fields .help { margin-bottom: 14px; }
.lock-fields .field { margin-bottom: 12px; }

.edit-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; padding: 12px 18px; border-radius: 999px; background: var(--ink); color: var(--surface); font-weight: 600; }
.edit-banner[hidden] { display: none; }
.edit-banner .link-btn { color: var(--accent-2); }

.entry-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px dashed var(--line); }
.er-mood { font-size: 24px; }
.er-text { flex: 1; min-width: 0; display: grid; }
.er-text b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.er-text small { color: var(--muted); font-size: 0.78em; }
#entriesDrawer .drawer-body section { border-bottom: none; }
#entriesDrawer .icon-btn { flex: none; }

/* focus mode: just you and your words */
body.focus .topbar, body.focus .clock-card, body.focus .preview, body.focus .connect, body.focus .edit-banner,
body.focus .editor > *:not(.field):not(label.field), body.focus .editor > .field:not(:has(#content)):not(:has(#title)),
body.focus .floaters, body.focus .sky { display: none !important; }
body.focus .writer-grid { grid-template-columns: 1fr; max-width: 820px; margin: 0 auto; }
body.focus .editor { background: transparent; box-shadow: none; backdrop-filter: none; padding-top: 40px; }
body.focus #content { min-height: 70vh; font-size: 1.15em; line-height: 2; background: transparent; border-color: transparent; }
body.focus #title { background: transparent; text-align: center; font-size: calc(2.2em * var(--head-scale)); }
body.focus #focusBtn { position: fixed; top: 18px; right: 18px; z-index: 30; width: 44px; height: 44px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow); }

@media (max-width: 900px) {
  .main-nav a span { display: none; }
  .main-nav a { padding: 8px 11px; }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; }
  .brand > span:last-child { display: none; }
  .main-nav { order: 3; width: 100%; justify-content: space-around; }
  .memory { margin-top: 0; }
  .cal-grid { gap: 4px; }
  .cal-cell { border-radius: 10px; }
  .cal-num { top: 2px; left: 4px; }
  .bar-row { grid-template-columns: 96px 1fr 24px; }
}

/* =========================================================
   PRINT / SAVE AS PDF
   ========================================================= */
@media print {
  .sky, .floaters, .topbar, .footer, .to-top, .toast, .progress, .post-actions, .post-nav, .back, .drawer, .overlay, .sound-pop { display: none !important; }
  body { background: #fff !important; color: #222; }
  .post-content { box-shadow: none !important; background: none !important; padding: 0 !important; backdrop-filter: none !important; }
  .post-cover { box-shadow: none !important; }
  .post-cover img { max-height: 320px; }
  .post { animation: none; }
}

/* =========================================================
   DAILY STREAK
   ========================================================= */
.streak-wrap { max-width: 760px; margin: -14px auto 36px; position: relative; z-index: 1; animation: rise-in 0.8s 0.12s both; }
.streak {
  display: flex; gap: 24px; align-items: center; padding: 22px 26px; border-radius: var(--radius);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent-2) 55%, var(--surface)), var(--surface));
  box-shadow: var(--shadow);
}
.streak-main { display: flex; flex-direction: column; align-items: center; flex: none; min-width: 96px; }
.streak-flame { font-size: 54px; line-height: 1; filter: grayscale(0.6); opacity: 0.7; transition: all 0.4s; }
.streak.lit .streak-flame { filter: none; opacity: 1; animation: flicker 1.6s ease-in-out infinite; }
@keyframes flicker { 0%, 100% { transform: scale(1) rotate(-2deg); } 50% { transform: scale(1.1) rotate(3deg); } }
.streak-num { display: grid; justify-items: center; line-height: 1; margin-top: 4px; }
.streak-num b { font-family: var(--font-head); font-size: calc(2.4em * var(--head-scale)); color: var(--accent); }
.streak-num small { font-size: 0.72em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-top: 4px; }
.streak-side { flex: 1; min-width: 0; display: grid; gap: 12px; }
.streak-msg { font-weight: 700; }
.streak-week { display: flex; gap: 8px; }
.sw-day { display: grid; justify-items: center; gap: 4px; font-size: 0.72em; font-weight: 700; color: var(--muted); }
.sw-day i {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-style: normal;
  background: var(--surface); border: 2px dashed var(--line); color: #fff; font-size: 15px; transition: all 0.3s;
}
.sw-day.done i { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: 2px solid transparent; box-shadow: 0 4px 10px color-mix(in srgb, var(--accent) 35%, transparent); }
.sw-day.today { color: var(--ink); }
.sw-day.today i { border-color: var(--accent); }
.streak-next { display: grid; gap: 6px; font-size: 0.82em; font-weight: 600; color: var(--muted); }
.sn-bar { height: 10px; border-radius: 999px; background: var(--surface); overflow: hidden; }
.sn-fill { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 1.2s cubic-bezier(.2,.8,.2,1); }
.streak-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.sb { display: grid; justify-items: center; width: 44px; padding: 5px 0 3px; border-radius: 12px; background: var(--surface); font-size: 20px; line-height: 1.1; filter: grayscale(1); opacity: 0.4; }
.sb small { font-size: 10px; font-weight: 700; color: var(--muted); }
.sb.got { filter: none; opacity: 1; box-shadow: 0 3px 10px color-mix(in srgb, var(--accent) 25%, transparent); }
.streak-best { font-size: 0.82em; color: var(--muted); }

/* small version on the write page and in the publish popup */
.streak.compact { padding: 12px 18px; gap: 16px; box-shadow: none; background: color-mix(in srgb, var(--surface) 75%, transparent); }
.streak.compact .streak-main { min-width: 64px; }
.streak.compact .streak-flame { font-size: 32px; }
.streak.compact .streak-num b { font-size: calc(1.6em * var(--head-scale)); }
.streak.compact .streak-num small { font-size: 0.6em; }
.streak.compact .streak-msg { font-size: 0.82em; }
.streak.compact .sw-day i { width: 24px; height: 24px; font-size: 12px; }
.streak.compact .streak-week { gap: 5px; }
.streak-slot { flex: 1; min-width: 280px; max-width: 460px; }
.dialog .streak { text-align: left; margin-bottom: 20px; }

.new-badge { display: grid; justify-items: center; margin: -6px 0 16px; animation: pop 0.5s both; }
.new-badge span { font-size: 46px; }
.new-badge small { color: var(--muted); }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
.confetti span { position: absolute; top: -40px; animation: confetti-fall linear forwards; }
@keyframes confetti-fall { to { transform: translateY(110vh) rotate(540deg); opacity: 0.2; } }

@media (max-width: 640px) {
  .streak-wrap { margin-top: 0; }
  .streak { flex-direction: column; text-align: center; padding: 22px 18px; }
  .streak-week, .streak-badges { justify-content: center; }
  .streak.compact { flex-direction: row; text-align: left; }
  .streak.compact .streak-week { justify-content: flex-start; }
  .sw-day i { width: 28px; height: 28px; }
}

/* ---------- streak: freeze, rewards ---------- */
.streak.waiting .streak-flame { filter: grayscale(0.35); opacity: 0.85; }
.streak.frozen { background: linear-gradient(135deg, #dff3ff, #f4fbff 60%, var(--surface)); }
.streak.frozen .streak-flame { filter: none; opacity: 1; animation: shiver 2.4s ease-in-out infinite; }
.streak.frozen .streak-num b { color: #4aa3d8; }
.streak.frozen .streak-msg { color: #2f6f96; }
:root.dark .streak.frozen { background: linear-gradient(135deg, #1d3550, var(--surface)); }
:root.dark .streak.frozen .streak-msg { color: #a9dcff; }
@keyframes shiver { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }
.streak.broken .streak-flame, .streak.none .streak-flame { filter: none; opacity: 1; }
.sw-day.frozen i { background: linear-gradient(135deg, #bfe6ff, #e9f7ff); border: 2px solid #9fd6f7; font-size: 13px; }

.streak-rewards { display: flex; flex-wrap: wrap; gap: 8px; }
.rw { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--surface); font-size: 0.76em; font-weight: 700; color: var(--muted); }
.rw small { font-weight: 600; opacity: 0.7; }
.rw.got { color: #3c2c36; box-shadow: 0 3px 10px color-mix(in srgb, var(--accent) 25%, transparent); }

.swatch.locked .swatch-color { filter: grayscale(0.85); opacity: 0.55; }
.swatch.locked { cursor: not-allowed; }
.swatch-name small { display: block; font-weight: 600; color: var(--muted); font-size: 0.9em; }
.swatch.reward:not(.locked) .swatch-color { box-shadow: 0 0 0 2px #f2c14e, 0 4px 14px rgba(242, 193, 78, 0.45); }
.theme-dot.locked { filter: grayscale(0.9); opacity: 0.5; cursor: not-allowed; background: var(--bg-a) !important; }

.reward-card { text-align: center; padding: 22px 18px; margin-bottom: 18px; border-radius: 22px; background: linear-gradient(135deg, color-mix(in srgb, var(--accent-2) 60%, var(--surface)), var(--surface)); }
.reward-badge { font-size: 64px; line-height: 1.1; animation: pop 0.6s both, bob 3s 0.6s ease-in-out infinite; }
.reward-kicker { text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.72em; font-weight: 800; color: var(--accent) !important; margin: 6px 0 8px !important; }
.reward-compliment { font-family: var(--font-head); font-size: calc(1.25em * var(--head-scale)); line-height: 1.4; color: var(--ink) !important; margin-bottom: 14px !important; }
.reward-gift { display: inline-block; padding: 8px 16px; border-radius: 999px; background: var(--surface); font-size: 0.88em; box-shadow: var(--shadow); }

.reward-modal { position: fixed; inset: 0; z-index: 65; display: grid; place-items: center; padding: 20px; background: rgba(40, 25, 50, 0.4); backdrop-filter: blur(5px); animation: fade 0.3s; }
.reward-sheet { width: min(460px, 100%); max-height: 90vh; overflow-y: auto; padding: 30px 26px 24px; border-radius: 30px; background: var(--surface); box-shadow: var(--shadow-lg); text-align: center; animation: pop 0.4s both; }
.reward-sheet h2 { font-size: calc(2em * var(--head-scale)); margin-bottom: 16px; color: var(--accent); }
.dialog { max-height: 92vh; overflow-y: auto; }

/* ---------- sound panel (v2) ---------- */
.sound-pop { width: 360px; max-height: calc(100vh - 100px); overflow-y: auto; padding: 18px 18px 14px; z-index: 45; }
.sp-head { display: flex; align-items: center; justify-content: space-between; font-size: 1.05em; }
.sp-label { margin: 14px 0 8px; font-size: 0.68em; font-weight: 800; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); }
.sp-mixes { display: flex; flex-wrap: wrap; gap: 6px; }
.sp-mixes button { padding: 6px 12px; border-radius: 999px; background: var(--bg-a); font-size: 0.8em; font-weight: 700; border: 2px solid transparent; transition: all 0.2s; }
.sp-mixes button:hover { background: var(--soft); }
.sp-mixes button.on { border-color: var(--accent); background: var(--soft); }
.sound-pop .sound-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 0; }
.sound-pop .sound-grid button { font-size: 22px; padding: 10px 2px 8px; }
.sound-pop .sound-grid button span { font-size: 10.5px; line-height: 1.2; text-align: center; }
.sound-pop .sound-grid button.on { animation: breathe 3s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.05); } }
.sound-pop .vol { margin-top: 16px; }
.sp-sleep { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; font-size: 0.85em; font-weight: 700; }
.mini-seg { display: inline-flex; padding: 3px; }
.mini-seg button { padding: 5px 10px; font-size: 0.85em; }
.sp-note { margin-top: 12px; font-size: 0.78em; color: var(--muted); text-align: center; }
@media (max-width: 640px) {
  .sound-pop { top: auto; bottom: 0; left: 0; right: 0; width: 100%; max-height: 75vh; border-radius: 26px 26px 0 0; }
}

/* =========================================================
   VIEWS · LIKES · COMMENTS
   ========================================================= */
.social { margin: 0 0 40px; display: grid; gap: 18px; }
.views-line { justify-self: center; display: inline-flex; align-items: center; gap: 6px; padding: 8px 18px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); font-size: 0.9em; color: var(--muted); }
.views-line[hidden] { display: none; }
.views-line b { color: var(--accent); font-size: 1.1em; }
.comments-card { padding: clamp(20px, 4vw, 34px); border-radius: var(--radius); background: color-mix(in srgb, var(--surface) 92%, transparent); box-shadow: var(--shadow); }
.comments-card h3 { font-size: calc(1.5em * var(--head-scale)); margin-bottom: 6px; }
.comments-card > p { font-size: 0.88em; margin-bottom: 18px; }
.giscus, .giscus-frame { width: 100%; }
.giscus-frame { border: none; color-scheme: normal; min-height: 160px; }
@media print { .social { display: none !important; } }

/* =========================================================
   PHOTOS: collage · viewer · writer tray
   ========================================================= */
.photo-grid { display: grid; gap: 10px; margin: 1.4em 0; }
.photo-grid figure { margin: 0; position: relative; overflow: hidden; border-radius: 16px; box-shadow: var(--shadow); }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; border-radius: 0 !important; box-shadow: none !important; transition: transform 0.6s; }
.photo-grid figure:hover img { transform: scale(1.05); }
.photo-grid figcaption { position: absolute; left: 0; right: 0; bottom: 0; margin: 0 !important; padding: 18px 12px 8px; color: #fff !important; font-size: 0.78em !important; text-align: left !important; background: linear-gradient(transparent, rgba(0,0,0,0.55)); }
.photo-grid.n2 { grid-template-columns: 1fr 1fr; }
.photo-grid.n2 figure { aspect-ratio: 4 / 5; }
.photo-grid.n3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; aspect-ratio: 3 / 2; }
.photo-grid.n3 figure:first-child { grid-row: 1 / 3; }
.photo-grid.n4 { grid-template-columns: 1fr 1fr; }
.photo-grid.n4 figure { aspect-ratio: 1; }
.photo-grid.many { grid-template-columns: repeat(3, 1fr); }
.photo-grid.many figure { aspect-ratio: 1; }
.zoomable { cursor: zoom-in; }

.lightbox { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: rgba(15, 10, 20, 0.92); animation: fade 0.25s; }
.lightbox figure { margin: 0; max-width: 92vw; max-height: 86vh; display: grid; justify-items: center; gap: 12px; }
.lightbox img { max-width: 92vw; max-height: 78vh; object-fit: contain; border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,0.5); animation: pop 0.3s both; }
.lightbox figcaption { color: #fff; font-family: var(--font-head); font-size: 1.15em; text-align: center; }
.lightbox button { position: absolute; width: 48px; height: 48px; border-radius: 50%; background: rgba(255,255,255,0.15); color: #fff; font-size: 26px; backdrop-filter: blur(6px); }
.lightbox button:hover { background: rgba(255,255,255,0.3); }
.lb-close { top: 18px; right: 18px; font-size: 18px !important; }
.lb-prev { left: 18px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 18px; top: 50%; transform: translateY(-50%); }
.lb-count { position: absolute; bottom: 18px; color: rgba(255,255,255,0.75); font-weight: 700; font-size: 0.85em; }

.toolbar-md .photo-btn { background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--accent-2))); color: #fff; padding: 0 14px; }
:root.dark .toolbar-md .photo-btn { color: #1b1830; }
#content.dropping { border-color: var(--accent); background: var(--soft); }
.photo-tray { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px; border-radius: 16px; background: var(--bg-a); }
.photo-tray[hidden] { display: none; }
.tray-item { position: relative; width: 84px; height: 84px; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); animation: pop 0.3s both; }
.tray-item img { width: 100%; height: 100%; object-fit: cover; }
.tray-item button { position: absolute; width: 26px; height: 26px; border-radius: 50%; background: rgba(0,0,0,0.55); color: #fff; font-size: 12px; display: grid; place-items: center; }
.tray-x { top: 4px; right: 4px; }
.tray-cap { bottom: 4px; right: 4px; }
.tray-note { width: 100%; font-size: 0.75em; color: var(--muted); }
@media (max-width: 520px) { .photo-grid.many { grid-template-columns: 1fr 1fr; } }

/* ---------- logo ---------- */
.brand-mark.logo { background: none; padding: 0; object-fit: contain; filter: drop-shadow(0 4px 10px color-mix(in srgb, var(--accent) 30%, transparent)); transition: transform 0.4s; }
.brand:hover .brand-mark.logo { transform: rotate(-10deg) scale(1.08); }

/* =========================================================
   LOGIN PAGE
   ========================================================= */
.login-page { display: grid; place-items: center; min-height: 100vh; }
.login-wrap { position: relative; z-index: 1; width: min(980px, 100% - 32px); padding: 40px 0; }
.login-card { display: grid; grid-template-columns: 1fr 1.15fr; border-radius: 34px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow-lg); animation: rise-in 0.7s both; }
.login-art {
  position: relative; display: grid; align-content: center; justify-items: center; text-align: center; gap: 10px; padding: 48px 34px;
  background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.55), transparent 50%), linear-gradient(160deg, var(--accent-2), var(--accent));
  color: #fff; overflow: hidden;
}
.login-art::after { content: "✦  ✧  ✦"; position: absolute; bottom: 22px; letter-spacing: 0.6em; opacity: 0.6; }
.login-logo { width: 120px; height: 120px; filter: drop-shadow(0 10px 24px rgba(60, 30, 90, 0.35)); animation: bob 4s ease-in-out infinite; }
.login-name { font-family: "Great Vibes", var(--font-head); font-weight: 400; font-size: clamp(52px, 7vw, 72px); line-height: 1; text-shadow: 0 4px 18px rgba(60, 30, 90, 0.3); margin-top: 6px; }
.login-tag { font-weight: 600; opacity: 0.92; max-width: 300px; }
.login-clock { display: grid; margin-top: 16px; padding: 12px 22px; border-radius: 20px; background: rgba(255,255,255,0.22); backdrop-filter: blur(6px); }
.login-clock b { font-family: var(--font-head); font-size: 1.9em; line-height: 1.1; }
.login-clock span { font-size: 0.85em; font-weight: 600; opacity: 0.9; }
.login-quote { font-style: italic; opacity: 0.9; max-width: 280px; margin-top: 8px; }
.login-forms { padding: clamp(28px, 5vw, 52px); display: grid; align-content: center; }
.lform h2 { font-size: calc(2.1em * var(--head-scale)); margin: 6px 0 8px; }
.lform > .muted { margin-bottom: 22px; }
.lform .field { margin-bottom: 16px; }
.pw-row { display: flex; gap: 6px; align-items: center; }
.pw-row input { flex: 1; }
.pw-eye { width: 44px; height: 44px; border-radius: 12px; background: var(--bg-a); font-size: 18px; flex: none; }
.lform input[type="password"], .lform input[type="text"] { width: 100%; font: inherit; color: var(--ink); background: var(--bg-a); border: 2px solid transparent; border-radius: 14px; padding: 11px 14px; outline: none; }
.lform input:focus { border-color: var(--accent-2); background: var(--surface); }
.lmsg { min-height: 1.4em; font-size: 0.88em; font-weight: 700; color: var(--accent); margin: 2px 0 12px; }
.pill.wide { width: 100%; justify-content: center; }
.pill:disabled { opacity: 0.6; cursor: wait; transform: none; }
.lrow { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; font-size: 0.9em; }
.lform.success { animation: pop 0.5s both; }
.steps-mini { display: flex; gap: 8px; margin-bottom: 18px; }
.steps-mini span { padding: 4px 12px; border-radius: 999px; background: var(--bg-a); font-size: 0.75em; font-weight: 700; color: var(--muted); }
.steps-mini span.on { background: var(--soft); color: var(--ink); }
.pw-meter { height: 8px; border-radius: 999px; background: var(--bg-a); overflow: hidden; margin: -4px 0 6px; }
.pw-meter span { display: block; height: 100%; width: 0; border-radius: 999px; transition: width 0.4s, background 0.4s; background: #f28b8b; }
.pw-meter span[data-s="2"] { background: #f2c14e; }
.pw-meter span[data-s="3"] { background: #8fd18a; }
.pw-meter span[data-s="4"] { background: #4cbf8a; }
.pw-hint { font-size: 0.8em; color: var(--muted); margin-bottom: 8px; }
.login-foot { text-align: center; margin-top: 18px; font-size: 0.82em; color: var(--muted); }
.who { display: inline-flex; align-items: center; gap: 4px; padding: 8px 14px; border-radius: 999px; background: var(--soft); font-size: 0.85em; }
.writer-link { text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 760px) {
  .login-card { grid-template-columns: 1fr; }
  .login-art { padding: 34px 24px 30px; }
  .login-logo { width: 84px; height: 84px; }
  .login-clock, .login-quote { display: none; }
  .login-art::after { display: none; }
  .who { display: none; }
}

/* ---------- share & install ---------- */
.share-sheet h2 { margin-bottom: 18px; }
.share-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 20px; }
.share-opt { display: grid; justify-items: center; gap: 6px; padding: 14px 4px; border-radius: 18px; background: var(--bg-a); font-size: 28px; transition: transform 0.2s, background 0.2s; }
.share-opt:hover { transform: translateY(-3px); background: var(--soft); }
.share-opt span { font-size: 11px; font-weight: 700; }
.install-box .hint { line-height: 1.6; margin: 0 0 12px; }
@media (max-width: 420px) { .share-grid { grid-template-columns: repeat(2, 1fr); } }

/* =========================================================
   MEMBERS: account menu · loading · likes · comments
   ========================================================= */
.loading { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: linear-gradient(160deg, var(--bg-a), var(--bg-b) 55%, var(--bg-c)); transition: opacity 0.6s, visibility 0.6s; }
.loading.gone { opacity: 0; visibility: hidden; }
.load-inner { display: grid; justify-items: center; gap: 14px; color: var(--muted); font-weight: 600; text-align: center; padding: 20px; }
.load-logo { width: 96px; height: 96px; animation: load-pulse 1.4s ease-in-out infinite; filter: drop-shadow(0 10px 24px color-mix(in srgb, var(--accent) 35%, transparent)); }
.load-moon { font-size: 54px; }
@keyframes load-pulse { 50% { transform: scale(1.1) rotate(-6deg); } }

.account { position: relative; }
.acc-btn { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); font-weight: 700; font-size: 0.88em; transition: transform 0.2s; }
.acc-btn:hover { transform: translateY(-2px); }
.acc-name { max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.caret { font-size: 0.75em; color: var(--muted); }
.av { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 18px; background: linear-gradient(135deg, var(--accent-2), var(--soft)); box-shadow: inset 0 0 0 2px var(--surface); }
.av.big { width: 48px; height: 48px; font-size: 26px; }
.acc-menu { position: absolute; right: 0; top: calc(100% + 10px); z-index: 30; width: 260px; padding: 10px; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow-lg); animation: pop 0.25s both; transform-origin: top right; }
.acc-menu[hidden] { display: none; }
.acc-head { display: flex; align-items: center; gap: 12px; padding: 8px 8px 12px; border-bottom: 1px dashed var(--line); margin-bottom: 6px; }
.acc-head small { display: block; color: var(--muted); font-size: 0.78em; }
.acc-menu a, .acc-menu button { display: block; width: 100%; text-align: left; padding: 10px 12px; border-radius: 14px; font-weight: 600; font-size: 0.9em; transition: background 0.2s; }
.acc-menu a:hover, .acc-menu button:hover { background: var(--soft); }
.profile-sheet .avatars-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 16px; }
.profile-sheet .avatars-row button { width: 44px; height: 44px; border-radius: 50%; font-size: 22px; background: var(--bg-a); border: 2px solid transparent; transition: transform 0.25s; }
.profile-sheet .avatars-row button.on { border-color: var(--accent); transform: scale(1.15); }
.profile-sheet .field { text-align: left; }
.profile-sheet .field input { width: 100%; font: inherit; color: var(--ink); background: var(--bg-a); border: 2px solid transparent; border-radius: 14px; padding: 11px 14px; outline: none; }
.profile-sheet > p { margin: 0 0 16px; font-size: 0.85em; }

.react-row { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; }
.like-btn { position: relative; display: inline-flex; align-items: center; gap: 10px; padding: 12px 22px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); font-weight: 800; transition: transform 0.25s cubic-bezier(.3,1.6,.5,1), background 0.3s; }
.like-btn .heart { font-size: 1.3em; filter: grayscale(1); opacity: 0.6; transition: filter 0.3s, opacity 0.3s, transform 0.4s cubic-bezier(.3,1.8,.5,1); }
.like-btn:hover { transform: translateY(-2px); }
.like-btn.on { background: linear-gradient(135deg, #ffe0ea, var(--surface)); color: #d9406a; }
.like-btn.on .heart { filter: none; opacity: 1; animation: heart-pop 0.5s cubic-bezier(.3,1.8,.5,1); }
@keyframes heart-pop { 40% { transform: scale(1.6) rotate(-12deg); } }
.like-word { font-size: 0.85em; color: var(--muted); }
.like-btn.on .like-word { color: inherit; }
.burst { position: absolute; left: 30px; top: 10px; pointer-events: none; font-size: 16px; animation: fly 1s ease-out forwards; }
@keyframes fly { to { transform: translate(var(--dx), var(--dy)) scale(0.6) rotate(25deg); opacity: 0; } }

.c-form { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 22px; }
.c-box { flex: 1; display: grid; gap: 8px; }
.c-box textarea { width: 100%; resize: none; font: inherit; color: var(--ink); background: var(--bg-a); border: 2px solid transparent; border-radius: 18px; padding: 12px 16px; outline: none; min-height: 52px; transition: border-color 0.2s, background 0.2s; }
.c-box textarea:focus { border-color: var(--accent-2); background: var(--surface); }
.c-bar { display: flex; justify-content: space-between; align-items: center; font-size: 0.78em; color: var(--muted); }
.c-bar .pill { padding: 8px 18px; }
.c-list { display: grid; gap: 14px; }
.c-item { display: flex; gap: 12px; align-items: flex-start; animation: rise-in 0.4s both; transition: opacity 0.25s, transform 0.25s; }
.c-item.removing { opacity: 0; transform: translateX(30px); }
.c-item.fresh .c-bubble { animation: fresh 1.6s ease; }
@keyframes fresh { 0% { box-shadow: 0 0 0 4px var(--accent-2); } 100% { box-shadow: 0 0 0 0 transparent; } }
.c-bubble { flex: 1; min-width: 0; padding: 12px 16px; border-radius: 6px 20px 20px 20px; background: var(--bg-a); }
.c-item.by-owner .c-bubble { background: var(--soft); }
.c-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin-bottom: 4px; }
.c-head small { color: var(--muted); font-size: 0.75em; }
.c-bubble p { word-wrap: break-word; line-height: 1.6; }
.owner-tag { font-size: 0.68em; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: var(--accent); color: #fff; }
.c-del { flex: none; padding: 6px 8px; border-radius: 10px; font-size: 0.85em; opacity: 0.55; transition: opacity 0.2s, background 0.2s; }
.c-del:hover, .c-del.armed { opacity: 1; background: #ffe3e8; color: #c43c5a; font-weight: 700; }
.c-empty, .c-loading { text-align: center; padding: 10px 0; }
.comments-card h3 small { font-family: var(--font-body); font-size: 0.55em; color: var(--muted); }
@media (max-width: 640px) { .acc-name, .caret { display: none; } .acc-btn { padding: 4px; } .c-form .av { display: none; } }
body.gated .writer { opacity: 0.35; pointer-events: none; filter: blur(2px); transition: all 0.4s; }

/* ---------- private entries (seen by others) ---------- */
.private-card, .private-sheet { position: relative; overflow: hidden; }
.private-card .card-body { min-height: 210px; }
.blur-wrap { filter: blur(7px); opacity: .55; user-select: none; pointer-events: none; padding: 6px 0; }
.fake-title, .fake-line { border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-2, var(--accent)) 70%, transparent); }
.fake-title { height: 20px; width: 70%; margin: 10px 0 16px; }
.fake-line { height: 10px; width: 100%; margin: 10px 0; opacity: .7; }
.fake-line.short { width: 55%; }
.private-lock { position: absolute; inset: 52px 0 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 0 18px; font-weight: 600; }
.private-lock small { font-weight: 400; opacity: .75; font-size: .85rem; }
.private-lock.big { inset: 0; gap: 10px; }
.private-lock.big strong { font-family: var(--head-font); font-size: 1.5rem; }
.private-lock .pill { margin-top: 8px; }
.lock-bubble { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; font-size: 1.6rem;
  background: var(--card, #fff); box-shadow: 0 8px 24px rgba(0,0,0,.15), 0 0 0 6px color-mix(in srgb, var(--accent) 25%, transparent);
  animation: lockFloat 3.2s ease-in-out infinite; }
@keyframes lockFloat { 50% { transform: translateY(-5px) rotate(-6deg); } }
.private-sheet { min-height: 380px; margin-top: 18px; padding: 26px; border-radius: 24px; background: var(--card, rgba(255,255,255,.6)); }
.only-me { display: inline-block; font-size: .78rem; font-weight: 600; padding: 3px 10px; border-radius: 99px; margin-bottom: 6px;
  background: color-mix(in srgb, var(--accent) 18%, transparent); }
@media (prefers-reduced-motion: reduce) { .lock-bubble { animation: none; } }

/* visibility picker + 2-step login */
.vis-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.vis-pick button { padding: 12px 8px; border-radius: 16px; border: 2px solid transparent; background: color-mix(in srgb, var(--accent) 10%, transparent); cursor: pointer; font: inherit; color: inherit; text-align: center; }
.vis-pick button b { display: block; font-size: 1.3rem; }
.vis-pick button small { display: block; opacity: .7; font-size: .72rem; margin-top: 2px; }
.vis-pick button.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 22%, transparent); }
.mfa-box { text-align: center; }
.mfa-box img, .mfa-box .qr { width: 190px; height: 190px; margin: 10px auto; display: block; background: #fff; border-radius: 14px; padding: 8px; }
.mfa-secret { font-family: ui-monospace, monospace; letter-spacing: .12em; word-break: break-all; font-size: .85rem; padding: 8px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 12%, transparent); }
.mfa-code { font-size: 1.6rem; letter-spacing: .5em; text-align: center; width: 12ch; padding: 8px; border-radius: 12px; }

/* join requests */
.req-bell { position: relative; }
.req-bell.ring { animation: bellRing 3s ease-in-out infinite; }
@keyframes bellRing { 0%, 85%, 100% { transform: rotate(0); } 88% { transform: rotate(-14deg); } 92% { transform: rotate(12deg); } 96% { transform: rotate(-6deg); } }
.req-badge { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 99px; display: grid; place-items: center;
  background: #ff5c8a; color: #fff; font-size: .7rem; font-weight: 700; box-shadow: 0 0 0 2px var(--bg, #fff); }
.req-sheet { max-width: 620px; width: min(620px, 94vw); text-align: left; }
.req-sheet h2, .req-sheet > .muted { text-align: center; }
.req-tabs { display: flex; gap: 6px; justify-content: center; margin: 14px 0; flex-wrap: wrap; }
.req-tabs button { border: 0; padding: 8px 14px; border-radius: 99px; font: inherit; font-weight: 600; cursor: pointer; color: inherit;
  background: color-mix(in srgb, var(--accent) 10%, transparent); }
.req-tabs button.on { background: var(--accent); color: #fff; }
.req-tabs b { opacity: .8; margin-left: 2px; }
.req-list { display: grid; gap: 10px; max-height: 50vh; overflow: auto; padding: 2px; }
.req-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px; background: color-mix(in srgb, var(--accent) 8%, transparent); transition: opacity .2s; }
.req-row.busy { opacity: .5; pointer-events: none; }
.req-row .avatar { font-size: 1.6rem; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; background: var(--card, #fff); flex: none; }
.req-who { flex: 1; min-width: 0; }
.req-who b { display: block; }
.req-who small { display: block; opacity: .7; font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.req-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.req-acts .pill { padding: 7px 12px; font-size: .82rem; }
.pill.danger { color: #c0264f; }
.req-empty { text-align: center; opacity: .7; padding: 24px 0; }
@media (max-width: 560px) { .req-row { flex-wrap: wrap; } .req-acts { width: 100%; justify-content: flex-start; } }
@media (prefers-reduced-motion: reduce) { .req-bell.ring { animation: none; } }
.req-badge[hidden] { display: none; }
