/* DiaryFast — one stylesheet for the site and the journal app. Light + dark, mobile first. */
:root {
  --bg: #faf8ff; --surface: #ffffff; --surface-2: #f3f0fb; --ink: #1d1830; --muted: #625b78; --line: #e3def0;
  --brand: #7c4dff; --brand-ink: #ffffff; --brand-soft: #efe9ff; --brand-dark: #5b2fe0;
  --ok: #157a4a; --err: #b42318; --warn: #a15c00;
  --m1: #e5484d; --m2: #f08c3c; --m3: #e8c33b; --m4: #6cc070; --m5: #2fa37b; --m0: #d8d3e4;
  --radius: 12px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16131f; --surface: #1f1b2b; --surface-2: #282337; --ink: #ece8f7; --muted: #a59fbb; --line: #352f47;
    --brand: #9b7bff; --brand-ink: #14101f; --brand-soft: #2b2342; --brand-dark: #b9a2ff; --ok: #4ccb8b; --err: #ff7a70; --warn: #f0b35b;
    --m0: #3a3450; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #16131f; --surface: #1f1b2b; --surface-2: #282337; --ink: #ece8f7; --muted: #a59fbb; --line: #352f47;
  --brand: #9b7bff; --brand-ink: #14101f; --brand-soft: #2b2342; --brand-dark: #b9a2ff; --ok: #4ccb8b; --err: #ff7a70; --warn: #f0b35b;
  --m0: #3a3450; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--font); overflow-x: hidden; }
img { max-width: 100%; }
a { color: var(--brand-dark); }
:root[data-theme="dark"] a, :root:not([data-theme="light"]) a { text-underline-offset: 2px; }
h1, h2, h3 { line-height: 1.25; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.wrap { width: 100%; max-width: 1600px; margin: 0 auto; padding-inline: clamp(16px, 3.34vw, 48px); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip-link:focus { left: 8px; }
.hp { position: absolute; left: -5000px; }
[hidden] { display: none !important; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5em; background: var(--brand); color: var(--brand-ink); border: 1px solid var(--brand); border-radius: 6px; padding: .6em 1.2em; font-weight: 600; text-decoration: none; cursor: pointer; line-height: 1.2; min-height: 42px; text-align: center; }
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-outline { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-outline:hover { border-color: var(--brand); }
.btn-ghost { background: transparent; color: var(--ink); border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: .4em .9em; min-height: 36px; font-size: .9rem; }
.btn-lg { padding: .8em 1.5em; font-size: 1rem; min-height: 52px; }
.danger { color: var(--err) !important; }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand-dark); text-decoration: underline; cursor: pointer; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; border: 1px solid transparent; background: transparent; cursor: pointer; font-size: 1.2rem; text-decoration: none; color: var(--ink); }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.on { background: var(--err); color: #fff; animation: pulse 1.2s infinite; }
.icon-btn:disabled { opacity: .4; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(229,72,77,.25); } }
.chip { display: inline-flex; align-items: center; gap: .3em; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: .3em .8em; font-size: .875rem; cursor: pointer; color: var(--ink); text-decoration: none; min-height: 34px; }
.chip:hover { border-color: var(--brand); }
.pill { display: inline-block; background: var(--brand-soft); color: var(--brand-dark); border-radius: 999px; padding: 0 .6em; font-size: .8rem; font-weight: 600; }
.row-inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row-between { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.check { display: inline-flex; align-items: center; gap: .45em; cursor: pointer; }
.field { margin: 12px 0; }
.field label, .label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=search], select, textarea { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: .55em .75em; width: 100%; min-height: 42px; }
.row-inline input, .row-inline select { width: auto; flex: 1 1 180px; }
textarea { resize: vertical; }
.form-msg { min-height: 1.2em; margin: 6px 0; font-size: .9rem; }
.form-msg.ok { color: var(--ok); }
.form-msg.err { color: var(--err); }
.hint { font-size: .85rem; color: var(--muted); }
code { background: var(--surface-2); padding: .1em .35em; border-radius: 5px; font-size: .9em; }

/* top bar */
body { --header-row: 76px; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; padding-top: env(safe-area-inset-top); }
.topbar-row { display: flex; align-items: center; gap: 24px; min-height: var(--header-row); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 1.25rem; font-weight: 700; letter-spacing: -.03em; }
.brand-mark { display: inline-flex; width: 36px; height: 36px; border-radius: 8px; background: var(--brand); color: var(--brand-ink); align-items: center; justify-content: center; }
.brand-text b { color: var(--brand-dark); }
#primary-nav { margin-left: auto; display: flex; align-items: center; gap: 8px; }
#primary-nav a:not(.btn) { color: var(--ink); text-decoration: none; padding: .45em .7em; border-radius: 6px; font-size: .95rem; }
#primary-nav a:not(.btn):hover, #primary-nav a[aria-current] { background: var(--surface-2); }
#primary-nav a.btn-ghost { margin-left: 24px; }
.nav-toggle { display: none; margin-left: auto; width: 40px; padding: 0; }
.pro-btn.is-pro { background: var(--brand-soft); color: var(--brand-dark); border-color: var(--brand-soft); }
@media (max-width: 820px) {
  body { --header-row: 64px; }
  body:not(.page-app) .nav-toggle { display: inline-flex; }
  body:not(.page-app) #primary-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--surface); border-bottom: 1px solid var(--line); flex-direction: column; align-items: stretch; padding: 8px 16px 16px; }
  body:not(.page-app) #primary-nav.open { display: flex; }
  #primary-nav a.btn-ghost { margin-left: 0; }
}

/* marketing */
.hero { padding: 80px 0 64px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 64px; align-items: center; }
.hero-image { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border: 1px solid var(--line); border-radius: var(--radius); }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; color: var(--brand-dark); font-size: .75rem; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.eyebrow::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.hero h1 { font-size: clamp(2.375rem, 4.3vw, 4rem); line-height: 1.1; margin: 20px 0 22px; letter-spacing: -.045em; }
.hero h1 em { color: var(--brand-dark); font-style: normal; }
.lead { font-size: 1.125rem; line-height: 1.8; color: var(--muted); max-width: 40em; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 30px 0 24px; }
.hero-points { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px 20px; color: var(--muted); font-size: .8125rem; }
.hero-points li { display: inline-flex; align-items: center; gap: 6px; }
.hero-points .icon { color: var(--ok); flex: none; }
.crumbs { font-size: .9rem; color: var(--muted); margin-bottom: 12px; }
.crumbs a { color: var(--muted); }
.demo-feed { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.demo-head, .demo-caption { background: var(--surface-2); padding: 20px 24px; }
.demo-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; border-bottom: 1px solid var(--line); }
.demo-head h2, .demo-head p { margin: 0; }
.demo-head h2 { font-size: 1rem; }
.demo-head p { font-size: .8125rem; color: var(--muted); }
.demo-head .pill { color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, var(--surface)); padding: 4px 10px; }
.demo-items { padding: 18px 24px; }
.demo-item { display: flex; align-items: center; gap: 16px; min-height: 88px; padding: 12px 14px; border: 1px solid var(--line); border-inline-start: 4px solid var(--brand); border-radius: 6px; }
.demo-item:first-child { border-inline-start-color: var(--ok); }
.demo-icon { display: grid; place-items: center; flex: 0 0 52px; height: 52px; border-radius: 8px; color: var(--brand-dark); background: var(--surface-2); }
.demo-item strong { margin-inline-end: 8px; }
.demo-item p { margin: 3px 0 0; color: var(--muted); font-size: .875rem; }
.demo-caption { padding-block: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: .75rem; }
.content { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 40px; padding-top: 24px; padding-bottom: 48px; }
@media (max-width: 960px) {
  .hero { padding: 48px 0; }
  .hero-grid, .content { grid-template-columns: 1fr; }
  .hero-grid { gap: 32px; }
}
.prose { max-width: 760px; }
.prose h2 { margin-top: 1.8em; }
.prose li { margin: .3em 0; }
.page { padding-top: 48px; padding-bottom: 56px; }
.page h1 { font-size: clamp(2rem, 3.5vw, 3rem); letter-spacing: -.035em; }
.narrow { max-width: 820px; }
.home-section { padding: 72px 0; scroll-margin-top: calc(var(--header-row) + 2px + env(safe-area-inset-top)); }
.home-section.alt { background: var(--surface); border-block: 1px solid var(--line); }
.home-section.alt + .alt { border-top: 0; }
.section-head { max-width: 780px; margin-bottom: 36px; }
.section-head.center { margin-inline: auto; }
.section-head h2, .page-home .faq h2 { font-size: clamp(1.75rem, 3.4vw, 2.5rem); letter-spacing: -.03em; margin: 0; }
.section-head .eyebrow { margin-bottom: 12px; }
.section-head p { margin: 12px 0 0; color: var(--muted); font-size: 1.0625rem; }
.tour-grid, .home-steps, #guides .cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.tour-item, .home-steps li, .start-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.tour-item .icon { color: var(--brand-dark); }
.tour-item h3, .home-steps h3, .start-grid h3 { margin: 8px 0 6px; font-size: 1.125rem; }
.tour-item p, .home-steps p { margin: 0; color: var(--muted); font-size: .95rem; }
.home-steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.home-steps li::before { counter-increment: step; content: counter(step); display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; margin-bottom: 16px; background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; }
.start-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; align-items: center; }
.start-card .hero-cta { margin-bottom: 0; }
.start-note, .cta-band { background: var(--brand-soft); border: 1px solid var(--line); border-radius: var(--radius); }
.start-note { margin-top: 16px; padding: 20px 24px; }
.start-note ul { padding-inline-start: 1.2em; margin-bottom: 0; color: var(--muted); }
.start-note li + li { margin-top: 8px; }
.home-details { margin-top: 24px; }
.home-details details { border-bottom: 1px solid var(--line); padding: 12px 0; }
.home-details summary { font-weight: 600; cursor: pointer; }
.home-plans { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 900px; gap: 22px; margin-inline: auto; }
.home-plans .price-card { padding: 26px; gap: 12px; }
.home-plans .price { font-size: 2.5rem; }
.home-plans ul { padding-inline-start: 1.2em; margin: 0 0 8px; color: var(--muted); }
.cta-band { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: stretch; overflow: hidden; }
.cta-copy { align-self: center; padding: 44px; }
.cta-band h2 { margin: 0; font-size: clamp(1.5rem, 3vw, 2.125rem); letter-spacing: -.025em; }
.cta-band p { margin: 6px 0 20px; color: var(--muted); }
.cta-image { display: block; width: 100%; height: 100%; max-height: 320px; object-fit: cover; }
@media (max-width: 860px) {
  .tour-grid, #guides .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-steps, .start-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .home-section { padding: 48px 0; }
  .hero .lead { font-size: 1rem; }
  .demo-items { padding: 12px; }
  .demo-head, .demo-caption { padding-inline: 16px; }
  .demo-item { gap: 10px; padding: 10px; }
  .demo-icon { flex-basis: 36px; height: 40px; }
  .tour-grid, #guides .cards, .home-plans { grid-template-columns: 1fr; }
  .hero-image { aspect-ratio: 3 / 2; }
  .cta-band { grid-template-columns: 1fr; }
  .cta-copy { padding: 24px; }
  .cta-image { height: auto; aspect-ratio: 2 / 1; }
}
.more h2 { font-size: 1.1rem; }
.cards { display: grid; gap: 10px; }
.card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; text-decoration: none; color: var(--ink); }
.card:hover { border-color: var(--brand); }
.card strong { display: block; }
.card .muted { font-size: .875rem; }
.faq { max-width: 820px; margin-inline: auto; }
.page-home .faq h2 { text-align: center; margin-bottom: 32px; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 20px; margin-bottom: 10px; }
.faq summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; cursor: pointer; font-weight: 600; list-style: none; padding: 16px 0; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--muted); font-size: 1.375rem; font-weight: 400; line-height: 1; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 0 0 18px; color: var(--muted); }
.table-wrap { overflow-x: auto; }
.plan-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: 12px; overflow: hidden; font-size: .95rem; }
.plan-table th, .plan-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.plan-table thead th { background: var(--surface-2); }
.plan-table tbody th { font-weight: 500; }
.price-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 16px 0; }
@media (max-width: 760px) { .price-cards { grid-template-columns: 1fr; } }
.price-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.price-card.featured { border: 2px solid var(--brand); }
.price-card .btn { margin-top: auto; }
.price-name { margin: 0; font-weight: 700; }
.price { margin: 0; font-size: 1.8rem; font-weight: 800; }
.price span { font-size: .9rem; font-weight: 500; color: var(--muted); }
.badge { position: absolute; top: -11px; right: 14px; margin: 0; background: var(--brand); color: var(--brand-ink); font-size: .75rem; font-weight: 700; border-radius: 999px; padding: 2px 10px; }
.narrow-field { max-width: 360px; }
.key-box { font: 700 1.3rem/1.4 Consolas, Menlo, monospace; background: var(--brand-soft); border-radius: 10px; padding: 12px 16px; letter-spacing: 1px; word-break: break-all; }
.footer { border-top: 1px solid var(--line); background: var(--surface); padding: 48px 0 calc(32px + env(safe-area-inset-bottom)); }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 32px; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .footer-grid { grid-template-columns: 1fr; gap: 20px; } }
.footer-brand { color: var(--ink); font-size: 1.2rem; font-weight: 700; text-decoration: none; }
.footer-brand b { color: var(--brand-dark); }
.footer-col { display: flex; flex-direction: column; gap: 4px; }
.footer-col a { color: var(--muted); text-decoration: none; font-size: .95rem; }
.footer-col a:hover { color: var(--ink); }
.footer-h { color: var(--muted); font-size: .8125rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; margin: 0 0 4px; }
.footer-bottom { margin: 28px 0 0; border-top: 1px solid var(--line); padding-top: 20px; }
.footer-app { padding: 16px 0 calc(16px + env(safe-area-inset-bottom)); }
.contact-form { max-width: 560px; }

/* dialogs */
dialog { border: 0; border-radius: 18px; padding: 24px; max-width: min(760px, calc(100vw - 24px)); width: 100%; background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(20,14,40,.45); }
.dialog-close { position: absolute; top: 10px; right: 12px; }
.dialog-close button { background: none; border: 0; font-size: 1.6rem; cursor: pointer; color: var(--muted); }
.pro-dialog h2 { margin-top: 0; }
.pro-state { background: var(--brand-soft); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.key-entry { margin-top: 12px; }
.key-entry summary { cursor: pointer; font-weight: 600; }
.img-dialog { padding: 0; background: #000; max-width: 96vw; }
.img-dialog img { display: block; max-height: 90vh; margin: auto; }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; opacity: 0; pointer-events: none; transition: .25s; z-index: 100; max-width: calc(100vw - 32px); font-size: .95rem; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--err); color: #fff; }

/* ---------------------------------------------------------------- app */
.page-app { background: var(--bg); }
.app { width: 100%; max-width: 1280px; margin: 0 auto; padding: 32px clamp(16px, 3.34vw, 48px) 0; }
.app-heading h1 { margin: 0; font-size: clamp(1.875rem, 3.5vw, 2.5rem); letter-spacing: -.035em; }
.app-heading p { margin: 6px 0 0; color: var(--muted); }
.app-nav { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin: 22px 0 24px; }
.app-tab { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-bottom: 3px solid transparent; background: transparent; border-radius: 6px 6px 0 0; padding: 8px 18px; cursor: pointer; color: var(--muted); font-size: .9375rem; font-weight: 600; min-height: 46px; }
.app-tab .icon { flex: none; }
.app-tab:hover { background: var(--surface-2); }
.app-tab.on { background: var(--brand-soft); color: var(--brand-dark); border-bottom-color: var(--brand); }
@media (max-width: 640px) {
  .app { padding-top: 24px; }
  .app-nav { gap: 2px; }
  .app-tab { flex: 1; flex-direction: column; gap: 3px; padding: 7px 2px; font-size: .75rem; }
  .page-app #primary-nav [data-view-link="settings"] { display: none; }
}
.app-main { padding-bottom: 32px; min-height: 60vh; }
.loading { color: var(--muted); padding: 40px 0; text-align: center; }
.view-h { font-size: 1.5rem; margin: 8px 0; letter-spacing: -.02em; }
.empty { text-align: center; padding: 32px 16px; color: var(--muted); }
.app-main > .empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); margin-top: 16px; }
.empty h2 { color: var(--ink); }
.big { font-size: 2.6rem; margin: 0; }
.upsell { background: var(--brand-soft); border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; }
.upsell p { margin-top: 0; }

/* composer */
.composer, .editor, .talk, .actions-box, .set-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.journal-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 320px); gap: 24px; align-items: start; margin-bottom: 16px; }
.journal-grid .composer { margin: 0; }
.composer h2, .prompt-panel h2 { margin: 0 0 10px; font-size: 1.125rem; }
.composer textarea { font-size: 1rem; min-height: 104px; }
.chat-input textarea { border: 0; background: transparent; padding: 6px 2px; font-size: 1.05rem; min-height: 72px; }
.prompt-panel { display: grid; gap: 8px; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; background: var(--brand-soft); }
.prompt-panel h2, .prompt-panel p { margin: 0; }
.prompt-panel p { color: var(--muted); font-size: .875rem; }
.prompt-panel .prompt-chip { max-width: none; width: 100%; padding: 9px 10px; background: var(--surface); }
@media (max-width: 860px) { .journal-grid { grid-template-columns: 1fr; gap: 14px; } }
@media (max-width: 480px) { .composer, .editor, .talk, .actions-box, .set-card, .prompt-panel { padding: 14px; } }
.prompts { display: flex; flex-wrap: nowrap; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 6px; align-items: center; scrollbar-width: thin; }
.prompts > span { flex: 0 0 auto; }
.prompt-chip { flex: 0 0 auto; max-width: min(320px, 90%); white-space: normal; text-align: left; border: 1px solid var(--line); background: var(--surface-2); border-radius: 6px; padding: 6px 10px; font-size: .875rem; cursor: pointer; color: var(--ink); line-height: 1.35; }
.prompt-chip:hover { border-color: var(--brand); }
.prompts .prompt-chip.g-joy { background: color-mix(in srgb, var(--m4) 14%, var(--surface)); }
.prompts .prompt-chip.g-grow { background: color-mix(in srgb, var(--brand) 12%, var(--surface)); }
.composer-prompt, .post-prompt { margin: 4px 0; font-size: .9rem; color: var(--brand-dark); font-weight: 600; }
.post-prompt::before, .composer-prompt::before { content: "✦ "; }
.composer-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-top: 6px; }
.composer-tools { display: flex; gap: 2px; }
.composer-attach { display: flex; flex-wrap: wrap; gap: 8px; }
.thumb { position: relative; }
.thumb img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; display: block; }
.thumb button, .wx-pill button { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--ink); color: var(--bg); cursor: pointer; line-height: 1; }
.wx-pill { position: relative; display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2); border-radius: 999px; padding: 4px 26px 4px 10px; font-size: .875rem; align-self: center; }
.wx-pill button { position: static; margin-left: 4px; }
.mood-pick { display: flex; gap: 2px; }
.mood-btn { width: 40px; height: 40px; border-radius: 50%; border: 2px solid transparent; background: transparent; font-size: 1.35rem; cursor: pointer; filter: grayscale(.85); opacity: .7; transition: .15s; }
.mood-btn:hover { filter: none; opacity: 1; }
.mood-btn.on { filter: none; opacity: 1; transform: scale(1.12); }
.mood-btn.on.m1 { border-color: var(--m1); } .mood-btn.on.m2 { border-color: var(--m2); } .mood-btn.on.m3 { border-color: var(--m3); } .mood-btn.on.m4 { border-color: var(--m4); } .mood-btn.on.m5 { border-color: var(--m5); }
.reply-with { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.persona-pick { display: flex; flex-wrap: wrap; gap: 4px; }
.persona-btn { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 10px 3px 6px; cursor: pointer; font-size: .85rem; min-height: 34px; color: var(--ink); }
.persona-btn.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.quota { margin: 6px 0 0; }
.feed-tools { display: flex; gap: 10px; align-items: center; margin: 8px 0; }
.feed-tools input { flex: 1; }
.day-h { font-size: .95rem; color: var(--muted); margin: 22px 4px 8px; font-weight: 600; }

/* posts */
.post { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 12px; margin-bottom: 12px; }
.post-head { display: flex; align-items: center; gap: 10px; }
.post-head > div { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.post-head strong { overflow: hidden; text-overflow: ellipsis; }
.mood { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem; background: var(--surface-2); }
.mood.m1 { background: color-mix(in srgb, var(--m1) 22%, var(--surface)); } .mood.m2 { background: color-mix(in srgb, var(--m2) 22%, var(--surface)); } .mood.m3 { background: color-mix(in srgb, var(--m3) 26%, var(--surface)); } .mood.m4 { background: color-mix(in srgb, var(--m4) 22%, var(--surface)); } .mood.m5 { background: color-mix(in srgb, var(--m5) 22%, var(--surface)); }
.mood.m0 { color: var(--muted); }
.post-body { margin: 6px 0 4px; overflow-wrap: anywhere; }
.post-body p, .reply-text p, .bubble p { margin: .35em 0; }
.post-body h3, .post-body h4, .post-body h5 { margin: .6em 0 .2em; }
.post-body blockquote, .prose blockquote { border-left: 3px solid var(--brand); margin: .5em 0; padding: 0 0 0 12px; color: var(--muted); }
.post-body pre { background: var(--surface-2); padding: 10px; border-radius: 8px; overflow-x: auto; }
.post.long .post-body { font-size: 1.02rem; }
.post-imgs { display: grid; gap: 4px; border-radius: 12px; overflow: hidden; margin: 8px 0; }
.post-imgs.n2, .post-imgs.n4 { grid-template-columns: 1fr 1fr; } .post-imgs.n3 { grid-template-columns: 2fr 1fr; }
.post-imgs img { width: 100%; height: 100%; max-height: 360px; object-fit: cover; display: block; cursor: zoom-in; }
.post-imgs.n1 img { max-height: 460px; }
.essence { margin: 6px 0 2px; font-style: italic; color: var(--muted); }
.tags { margin: 4px 0; }
.tag { display: inline-block; color: var(--brand-dark); background: var(--brand-soft); border-radius: 6px; padding: 0 6px; font-size: .85em; margin: 1px 0; }
.post-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0 4px; }
.liked { margin-left: auto; }
.replies { display: flex; flex-direction: column; gap: 8px; }
.replies:not(:empty) { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 6px; }
.reply { display: flex; gap: 10px; }
.reply strong { font-size: .875rem; }
.reply .reply-text { font-size: .97rem; }
.avatar { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); display: inline-flex; align-items: center; justify-content: center; font-size: 1.05rem; }
.typing { display: inline-flex; gap: 4px; margin: 6px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.pop-menu { position: absolute; z-index: 60; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.18); padding: 6px; min-width: 220px; max-width: calc(100vw - 16px); display: flex; flex-direction: column; }
.pop-menu button { text-align: left; background: none; border: 0; padding: 9px 12px; border-radius: 8px; cursor: pointer; color: var(--ink); }
.pop-menu button:hover, .pop-menu button:focus { background: var(--surface-2); }
.pop-menu .muted { display: block; }

/* editor */
.editor-top { display: flex; justify-content: space-between; align-items: center; margin: 8px 0; gap: 8px; }
.title-input { font-size: 1.35rem !important; font-weight: 700; border: 0 !important; padding-left: 2px !important; background: transparent !important; }
.title-input:focus { outline: none; }
.md-bar { display: flex; flex-wrap: wrap; gap: 4px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px 0; margin: 6px 0; }
.md-bar button { min-width: 36px; height: 34px; border: 1px solid transparent; background: transparent; border-radius: 8px; cursor: pointer; color: var(--ink); }
.md-bar button:hover { background: var(--surface-2); }
.md-bar .spacer { flex: 1; }
.long-text { border: 0 !important; background: transparent !important; font-size: 1.05rem; line-height: 1.7; min-height: 320px; padding: 6px 2px !important; }
.long-text:focus { outline: none; }
.md-preview { min-height: 320px; padding: 6px 2px; }

/* talk */
.talk h2, .actions-box h2 { margin: 0 0 4px; font-size: 1.15rem; }
.chat { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; max-height: 60vh; overflow-y: auto; padding: 2px; }
.msg { display: flex; gap: 8px; max-width: 92%; }
.msg.me { align-self: flex-end; }
.msg .bubble { background: var(--surface-2); border-radius: 16px; padding: 4px 12px; }
.msg.me .bubble { background: var(--brand); color: var(--brand-ink); border-bottom-right-radius: 4px; }
.msg.ai .bubble { border-bottom-left-radius: 4px; }
.chat-input { border-top: 1px solid var(--line); padding-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.chat-input .row-inline { justify-content: flex-end; }
.action-list { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 6px; }
.action-list li { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.action-list label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; flex: 1; }
.action-list input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--brand); flex: 0 0 auto; }
.action-list label > span { display: flex; flex-direction: column; }
.action-list li.done strong { text-decoration: line-through; color: var(--muted); }
.done-list summary { cursor: pointer; color: var(--muted); margin: 12px 0; }

/* calendar */
.cal-head { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 8px 0; }
.cal-head h2 { margin: 0; font-size: 1.15rem; min-width: 12em; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-name { text-align: center; font-size: .75rem; color: var(--muted); font-weight: 600; }
.cal-cell { aspect-ratio: 1; max-height: 88px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; padding: 0; color: var(--ink); min-width: 0; }
.cal-cell.empty { border: 0; background: transparent; cursor: default; }
.cal-cell .d { font-size: .75rem; color: var(--muted); }
.cal-cell .e { font-size: 1.15rem; line-height: 1; }
.cal-cell.today { outline: 2px solid var(--brand); outline-offset: -2px; }
.cal-cell.sel { box-shadow: 0 0 0 3px var(--brand); }
.cal-cell.has.m0 { background: var(--m0); }
.cal-cell.m1, .yd.m1, .sw.m1, .bar.m1, .dist .m1 { background: var(--m1); } .cal-cell.m2, .yd.m2, .sw.m2, .bar.m2, .dist .m2 { background: var(--m2); } .cal-cell.m3, .yd.m3, .sw.m3, .bar.m3, .dist .m3 { background: var(--m3); }
.cal-cell.m4, .yd.m4, .sw.m4, .bar.m4, .dist .m4 { background: var(--m4); } .cal-cell.m5, .yd.m5, .sw.m5, .bar.m5, .dist .m5 { background: var(--m5); }
.cal-cell.m1 .d, .cal-cell.m2 .d, .cal-cell.m3 .d, .cal-cell.m4 .d, .cal-cell.m5 .d { color: rgba(0,0,0,.6); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; justify-content: center; font-size: .8rem; color: var(--muted); margin: 10px 0; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin: 12px 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; }
.stat b { display: block; font-size: 1.35rem; }
.stat span { font-size: .8rem; color: var(--muted); }
.dist { display: flex; height: 26px; border-radius: 8px; overflow: hidden; margin: 8px 0 16px; }
.dist span { display: flex; align-items: center; justify-content: center; font-size: .85rem; min-width: 22px; }
.year-map { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 3px; overflow-x: auto; padding-bottom: 6px; }
.yd { width: 12px; height: 12px; border-radius: 3px; border: 0; padding: 0; background: var(--surface-2); cursor: pointer; }
.yd.has.m0 { background: var(--m0); }

/* report */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 4px; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--ink); }
.chart { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .g { stroke: var(--line); stroke-width: 1; }
.chart .lab { fill: var(--muted); font-size: 11px; }
.chart .line { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.chart .dot.m1 { fill: var(--m1); } .chart .dot.m2 { fill: var(--m2); } .chart .dot.m3 { fill: var(--m3); } .chart .dot.m4 { fill: var(--m4); } .chart .dot.m5 { fill: var(--m5); }
.chart .cnt { fill: var(--brand-soft); }
.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; }
@media (max-width: 640px) { .two-col { grid-template-columns: 1fr; } }
.cloud { line-height: 1.9; }
.cloud span { display: inline-block; margin: 0 6px 0 0; color: var(--brand-dark); }
.wd-bars { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding-top: 10px; }
.wd { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; }
.wd .bar { width: 100%; max-width: 30px; border-radius: 6px 6px 2px 2px; background: var(--m0); }
.wd .lab { font-size: .75rem; color: var(--muted); }
.ai-report { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 16px; margin-bottom: 10px; }
.ai-report:empty { display: none; }
.report-tools { margin: 16px 0; }
.report details summary { cursor: pointer; color: var(--muted); margin: 10px 0; }

/* settings */
.set-card h2 { margin: 0 0 6px; font-size: 1.1rem; }
.set-card p { margin: 6px 0; }
.byok { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
.byok summary { cursor: pointer; font-weight: 600; }

/* lock */
.lock-screen { min-height: 60vh; display: flex; align-items: center; justify-content: center; }
.lock-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; max-width: 420px; text-align: center; }
.lock-card form { display: flex; gap: 8px; margin-top: 12px; }
.lock-ico { font-size: 2.4rem; margin: 0; }

/* read aloud */
.speak-btn { border: 0; background: transparent; cursor: pointer; font-size: .85rem; padding: 2px 4px; border-radius: 6px; opacity: .55; vertical-align: middle; }
.speak-btn:hover, .speak-btn:focus-visible { opacity: 1; background: var(--surface-2); }
.speak-btn.speaking { opacity: 1; background: var(--brand-soft); animation: pulse 1.2s infinite; }
.msg.ai { align-items: flex-end; }

/* month as a book */
.print-tools { margin: 8px 0; }
.book { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; margin: 12px 0 24px; font-family: Georgia, "Iowan Old Style", "Times New Roman", serif; }
.book-cover { text-align: center; border-bottom: 1px solid var(--line); padding-bottom: 20px; margin-bottom: 8px; }
.book-cover h1 { font-size: 2.2rem; margin: .1em 0; }
.book-brand { font-family: var(--font); letter-spacing: .2em; text-transform: uppercase; font-size: .75rem; color: var(--brand-dark); margin: 0; }
.book-day h2 { font-size: 1.15rem; border-bottom: 1px solid var(--line); padding-bottom: 4px; margin: 26px 0 8px; }
.book-entry { margin: 10px 0 18px; }
.book-entry h3 { margin: .2em 0; }
.book-meta { font-family: var(--font); font-size: .8rem; color: var(--muted); margin: 0; }
.book-text p { margin: .4em 0; }
.book-imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 6px; margin: 8px 0; }
.book-imgs img { width: 100%; max-height: 220px; object-fit: cover; border-radius: 6px; }
.book-replies { border-left: 3px solid var(--brand-soft); padding-left: 12px; margin: 8px 0; font-size: .92rem; color: var(--muted); }
.book-replies p { margin: .3em 0; }
.book-actions { list-style: none; padding: 0; font-family: var(--font); font-size: .9rem; }
.book-foot { text-align: center; margin-top: 28px; font-family: var(--font); }

/* print: the report as a clean document */
@media print {
  body { background: #fff; color: #000; }
  .topbar, .app-nav, .footer, .no-print, .toast, dialog, .skip-link, .post-bar, .replies { display: none !important; }
  .app { max-width: none; padding: 0; }
  .chart, .stat, .ai-report, .post { border-color: #ccc; box-shadow: none; break-inside: avoid; }
  .speak-btn { display: none !important; }
  .book { border: 0; padding: 0; margin: 0; background: #fff; }
  .book-cover { break-after: page; padding-top: 30vh; border: 0; }
  .book-entry, .book-imgs img { break-inside: avoid; }
  .book-day h2 { break-after: avoid; }
  .report details { display: block; } .report details > summary { display: none; } .report details[open] > *, .report details > * { display: block; }
  a { color: #000; text-decoration: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
