/* tinker — chrome styles */

:root {
  --color-background: #fffdf7;
  --color-foreground: #2d2a26;
  --color-muted: #6f6a65;
  --color-card: #fff9f0;
  --color-border: #ede8e0;
  --color-accent: #a5b4fc;
  --color-accent-dim: #eef2ff;
  --color-accent-strong: #6366f1;
  --color-surface: #ffffff;
  --color-surface-alt: #fff9f0;
  --color-hover: #fff9f0;

  --color-forest: #2d5a3d;
  --color-leaf: #7bc47a;
  --color-sprout: #5aad58;
  --color-ink: #1a1a1a;
  --color-cream: #f5f3ef;
  --color-parchment: #f7f0e3;

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;

  --sidebar-width: 252px;
  --shadow-soft: 0 1px 2px rgba(45, 90, 61, 0.05), 0 4px 16px rgba(45, 90, 61, 0.06);
  --shadow-purple: 0 1px 2px rgba(99, 102, 241, 0.18), 0 6px 18px rgba(99, 102, 241, 0.22);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100vh;
  /* Dynamic viewport height matches the *actually visible* area on
     iOS standalone PWAs, where 100vh otherwise resolves to the
     largest viewport (home-indicator area included) and the welcome
     form ends up sitting below the visual centre on initial load. */
  height: 100dvh;
  overflow: hidden;
  font-family: var(--font-sans);
  color: var(--color-foreground);
  background: var(--color-background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body { display: flex; flex-direction: row; }

::selection { background-color: rgba(123, 196, 122, 0.32); }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #c9c2b6; }

button { font: inherit; color: inherit; cursor: pointer; border: none; background: transparent; }
input, textarea { font: inherit; color: inherit; }
input:focus, button:focus, textarea:focus { outline: none; }

/* ── Sidebar ───────────────────────────────────────────────────────── */

/* Sidebar now feels like the main screen — same background, same
   density. The parchment gradient is gone; the only separator is a
   subtle right-border. The home-list (seeds) lives here. */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--color-background);
  border-right: 1px solid var(--color-border);
  user-select: none;
  position: relative;
  -webkit-app-region: drag;
  /* Keep the bottom rows (account list + footer) above the iOS home
     indicator when running as an installed PWA / Capacitor app. */
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.sidebar__top {
  padding: 52px 12px 8px 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
}
html.on-capacitor .sidebar__top,
html.on-web .sidebar__top {
  padding-top: calc(env(safe-area-inset-top, 0px) + 14px);
}

.sidebar__brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 4px 6px 4px 4px;
  border-radius: 10px;
  -webkit-app-region: no-drag;
  cursor: pointer;
  min-width: 0;
  justify-self: start;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px) url(#liquid-glass) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 0;
  box-shadow: none;
  transition: background 0.2s ease, transform 0.15s ease;
}
.sidebar__brand:hover { background: rgba(255, 255, 255, 0.16); }
.sidebar__brand:active { transform: scale(0.985); }

.sidebar__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.005em;
  color: var(--color-foreground);
}

.sidebar__footer {
  padding: 10px 12px 14px;
  font-size: 13px;
  color: var(--color-muted);
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 6px;
  -webkit-app-region: no-drag;
}
.sidebar__footer-copy { padding: 0 6px; font-size: 12px; }

.sidebar__account {
  padding: 8px 8px 10px;
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  -webkit-app-region: no-drag;
}
.sidebar__account-head {
  margin: 0;
  padding: 6px 10px 4px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}
.sidebar__account-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar__account-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--color-foreground);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}
.sidebar__account-item:hover { background: var(--color-hover); }
.sidebar__account-icon { color: var(--color-muted); flex-shrink: 0; }
.sidebar__account-flash {
  margin-left: auto;
  font-size: 12px;
  color: var(--color-muted);
  opacity: 0;
  transition: opacity 0.18s ease;
}
.sidebar__account-flash.is-visible { opacity: 1; }

/* Membership / plan row: a two-line stack (tier + price on top, status
 * beneath) with an optional trailing "Upgrade" pill for free accounts.
 * Reuses .sidebar__account-item for sizing/hover; align-items: flex-start
 * so the icon hugs the first line when the sub-text wraps. */
.sidebar__membership { align-items: flex-start; }
.sidebar__membership .sidebar__account-icon { margin-top: 2px; }
.sidebar__membership-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  line-height: 1.25;
}
.sidebar__membership-sub {
  font-size: 12px;
  color: var(--color-muted);
}
.sidebar__membership-badge {
  margin-left: auto;
  align-self: center;
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--color-accent-strong, #6366f1);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
/* "Already subscribed? Restore" — a quiet text button under the free-plan row
 * that links a subscription started elsewhere to this account. Indented to sit
 * under the row's label; membership.js toggles it with the free view. */
.sidebar__membership-restore {
  width: 100%;
  margin: -2px 0 2px;
  padding: 2px 10px 6px 36px;
  border: 0;
  background: transparent;
  color: var(--color-muted);
  font: inherit;
  font-size: 12px;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.sidebar__membership-restore:hover { color: var(--color-foreground); }

/* ── Floating bottom mode nav ──────────────────────────────────────────
 *
 * A liquid-glass pill, bottom-centre, that switches between writing with
 * AI (the Claude interview) and No AI mode (write freely). Two segments —
 * a sparkle for AI, a writing hand for No AI — with the live one filled
 * in. The "You're offline" sliver hangs off the bottom edge while the
 * device is offline. Fixed so it never disturbs the flex layout; clears
 * the iOS safe area and the macOS drag strip. */
.mode-nav {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  transform: translateX(-50%);
  z-index: 95;
  /* The AI / No AI switch is a pre-session choice that belongs to the
   * welcome screen only. Hidden by default; revealed below when the
   * welcome feed is the active view. */
  display: none;
  flex-direction: column;
  align-items: stretch;
  -webkit-app-region: no-drag;
  pointer-events: none;
}
/* Surface the mode switch only on the welcome screen. #welcome carries
 * data-active solely while the welcome feed is on screen (renderer.js
 * showFeed); every other view strips it, so the pill never follows the
 * founder into writing, reading, or the category feeds. */
body:has(#welcome[data-active]) .mode-nav {
  display: flex;
}
.mode-nav__bar {
  pointer-events: auto;
  display: flex;
  gap: 4px;
  padding: 5px;
  border-radius: var(--radius-pill);
  /* Frosted glass — matches the toast treatment: a translucent cream
   * pane that blurs whatever sits behind it, a bright top edge and soft
   * inner highlight so it reads as a sheet of glass. The opaque fallback
   * keeps it legible where backdrop-filter isn't supported. */
  background: rgba(255, 253, 247, 0.62);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow:
    0 12px 32px rgba(20, 20, 40, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .mode-nav__bar { background: var(--color-surface); }
}
.mode-nav__btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  transition: background 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}
.mode-nav__icon { flex-shrink: 0; }
.mode-nav__btn:hover { color: var(--color-foreground); }
.mode-nav__btn[aria-pressed="true"] {
  background: var(--color-surface);
  color: var(--color-accent-strong);
  box-shadow: var(--shadow-button);
}
.mode-nav__btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.mode-nav__btn:disabled:hover { color: var(--color-muted); }
/* Offline sliver — a thin strip tucked under the glass bar, narrower than
 * it so it reads as attached. Top corners square to butt against the bar;
 * bottom corners round off. */
.mode-nav__offline {
  pointer-events: auto;
  align-self: center;
  margin-top: -4px;
  padding: 5px 16px 4px;
  border-radius: 0 0 var(--radius-pill) var(--radius-pill);
  background: rgba(45, 42, 38, 0.85);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.4;
  box-shadow: 0 8px 18px rgba(20, 20, 40, 0.16);
}
.mode-nav__offline[hidden] { display: none; }

/* Centre the pill over the stage, not the viewport. On desktop the
 * sidebar sits inline (its --sidebar-width eats the left edge), so the
 * welcome copy — "You are a founder." — is centred in the space to its
 * right. A plain left: 50% would centre the switch on the whole window
 * and leave it sitting noticeably left of that text. Shift it right by
 * half the sidebar so its centre lands on the stage's centre, under the
 * heading. The var tracks the 252px/220px breakpoints automatically.
 * Below 541px the sidebar becomes the off-canvas drawer and the stage
 * goes full-width, so the base left: 50% is already correct — this
 * override deliberately doesn't apply there. */
@media (min-width: 541px) {
  .mode-nav { left: calc(50% + var(--sidebar-width) / 2); }
}

@media (max-width: 540px) {
  .mode-nav { bottom: calc(env(safe-area-inset-bottom, 0px) + 12px); }
}

/* ── Sidebar pitch-deck tree (v0.103) ─────────────────────────────
 *
 * Mirrors pitch-deck.md inside the sidebar. The top tier rows hold one
 * of the eleven slide titles; the inner rows hold verbatim phrases
 * lifted from the founder's own writings. Both reuse
 * `.sidebar__account-item` for sizing/hover/spacing so the surface is
 * visually continuous with the Account block below. The nav is hidden
 * (via the [hidden] attribute) on cold-start — no placeholder, no CTA.
 */

.sidebar__tree {
  padding: 8px 8px 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  -webkit-app-region: no-drag;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
.sidebar__tree-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar__deck-heading-row { display: contents; }
.sidebar__deck-heading {
  /* Top-tier row carries the deck-slide title — a fixed literal from
   * the renderer's const. The label sits flush with the Account
   * block's items to read as continuous chrome. */
  font-weight: 600;
}
.sidebar__deck-heading[aria-expanded="false"] .sidebar__account-label {
  color: var(--color-muted);
}
.sidebar__deck-heading[data-active] {
  background: var(--color-hover);
}
.sidebar__deck-heading[data-empty] {
  /* Slide hasn't earned a phrase yet — render as a grayed-out
   * placeholder so the founder can see the full eleven-slide outline
   * from the moment a pitch exists. Not interactive: no hover swap,
   * default cursor, no click handler bound in the renderer. */
  cursor: default;
  opacity: 0.5;
}
.sidebar__deck-heading[data-empty]:hover {
  background: transparent;
}
.sidebar__deck-heading[data-empty] .sidebar__account-label {
  color: var(--color-muted);
  font-weight: 500;
}
.sidebar__phrase-list {
  list-style: none;
  margin: 0;
  padding: 0 0 0 18px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
/* Each excerpt carries a vertical rainbow-palette line on its left,
 * mirroring the blockquote treatment in pitch-deck.md (section.tinker
 * blockquote { border-left: 2px solid <rainbow> }). The hue is set on
 * the deck-heading-row so every excerpt inside one section shares it,
 * and the cycle advances to the next rainbow-web logo hue on the next
 * section. `display: contents` on the row doesn't affect custom-property
 * inheritance, so the children still pick up --phrase-border-color. */
.sidebar__tree-list > .sidebar__deck-heading-row:nth-child(7n + 1) { --phrase-border-color: var(--logo-pink); }
.sidebar__tree-list > .sidebar__deck-heading-row:nth-child(7n + 2) { --phrase-border-color: var(--logo-orange); }
.sidebar__tree-list > .sidebar__deck-heading-row:nth-child(7n + 3) { --phrase-border-color: var(--logo-yellow); }
.sidebar__tree-list > .sidebar__deck-heading-row:nth-child(7n + 4) { --phrase-border-color: var(--logo-leaf); }
.sidebar__tree-list > .sidebar__deck-heading-row:nth-child(7n + 5) { --phrase-border-color: var(--logo-sky); }
.sidebar__tree-list > .sidebar__deck-heading-row:nth-child(7n + 6) { --phrase-border-color: var(--logo-mint); }
.sidebar__tree-list > .sidebar__deck-heading-row:nth-child(7n)     { --phrase-border-color: var(--logo-purple); }
.sidebar__phrase-list > li {
  border-left: 2px solid var(--phrase-border-color, var(--logo-purple));
}
.sidebar__phrase {
  /* Allow the row's flex container to shrink so wrapping text doesn't
   * push the row past the sidebar's width. */
  align-items: flex-start;
}
.sidebar__phrase .sidebar__account-label {
  font-size: 13px;
  color: var(--color-muted);
  display: block;
  /* Founder writing wraps instead of truncating — every phrase is a
   * verbatim slice of their own text, and clipping it hides the words
   * they wrote. Long phrases break on word boundaries first, then
   * break out of long unbroken runs as a last resort. */
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
}
.sidebar__phrase[data-active] {
  background: var(--color-hover);
}
.sidebar__phrase[data-active] .sidebar__account-label {
  color: var(--color-foreground);
}
.sidebar__tree-retry {
  margin-left: auto;
  font-size: 14px;
  color: var(--color-muted);
  cursor: pointer;
  padding: 0 4px;
  border-radius: 4px;
}
.sidebar__tree-retry:hover { background: var(--color-hover); color: var(--color-foreground); }

/* ── Pitch-progress bar ────────────────────────────────────────────
 *
 * Sits at the top of the sidebar tree, above the eleven deck-heading
 * rows. Shows how many of the eleven headings have at least one
 * resolvable phrase. Hidden alongside the tree on cold-start; visible
 * the moment the classifier lands its first hit.
 */
.sidebar__tree-progress {
  padding: 4px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sidebar__tree-progress-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.sidebar__tree-progress-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}
.sidebar__tree-progress-count {
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--color-muted);
}
.sidebar__tree-progress-track {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: var(--color-border);
  overflow: hidden;
}
.sidebar__tree-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--color-rose)   0%,
    var(--color-peach)  18%,
    var(--color-amber)  36%,
    var(--logo-leaf)    55%,
    var(--color-sky)    75%,
    var(--color-violet) 100%
  );
  transform-origin: left center;
  transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1);
  animation: rainbow-draw 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}
@keyframes rainbow-draw {
  from { transform: scaleX(0); opacity: 0; }
  to   { transform: scaleX(1); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar__tree-progress-fill {
    animation: none;
    transition: none;
  }
}

/* ── In-flight / strengthened / off-pitch states ──────────────────── */
/* The "stay tuned…" label sits inline alongside the "N / 8" count and
   is swapped in only while the classifier is reading the just-published
   writing. Both spans live inside [data-audit-ignore] so the visible-
   string audit (sidebar-tree.js:554) is unaffected. */
.sidebar__tree-progress-count-num {
  display: inline-block;
  transform-origin: center right;
}
.sidebar__tree-progress-count-flight {
  display: none;
  color: var(--color-muted);
  font-style: italic;
  font-weight: 500;
  font-variant-numeric: normal;
  letter-spacing: 0.01em;
}
[data-tree-progress-state="classifying"] .sidebar__tree-progress-count-num {
  display: none;
}
[data-tree-progress-state="classifying"] .sidebar__tree-progress-count-flight {
  display: inline-block;
}

/* Brand globe spins (and dims) only while a fresh classify is in flight.
   The selector matches the body-level mirror of the state attribute. */
[data-rainbow-logo] {
  transition: opacity 0.4s ease;
  transform-origin: 50% 50%;
}
body[data-tree-progress-state="classifying"] [data-rainbow-logo] {
  animation: tinker-spin 2.5s linear infinite;
  opacity: 0.4;
}

@keyframes tinker-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Strengthened: the covered count just grew. Count text bumps, bar
   fill briefly brightens. Lasts ~800ms then returns to idle. */
@keyframes tinker-count-bump {
  0%   { transform: scale(1); color: var(--color-muted); }
  35%  { transform: scale(1.4); color: var(--color-accent-strong); }
  100% { transform: scale(1); color: var(--color-muted); }
}
@keyframes tinker-bar-flash {
  0%   { filter: brightness(1) saturate(1); }
  35%  { filter: brightness(1.6) saturate(1.4); }
  100% { filter: brightness(1) saturate(1); }
}
[data-tree-progress-state="strengthened"] .sidebar__tree-progress-count-num {
  animation: tinker-count-bump 800ms ease-out;
}
[data-tree-progress-state="strengthened"] .sidebar__tree-progress-fill {
  animation: tinker-bar-flash 900ms ease-out;
}

/* ── Pitch switcher (v0.104) ──────────────────────────────────────
 *
 * A dropdown above the pitch-progress bar. The face button shows the
 * active pitch's title; tapping it expands a menu of all pitches.
 * Beneath the chip, a full-width outlined "Rename pitch" button
 * mirrors the writing-flow step-back treatment. The matching
 * go-forth action — the indigo "Pitch" button — sits separately at
 * the very bottom of the deck nav, below all eleven slide rows.
 * Every pitch is equal-status (no main/alt distinction), so the
 * menu lists them all the same way — title plus a "covered N/11"
 * hint. The whole surface sits inside [data-audit-ignore] because
 * pitch titles are model-generated or founder-edited rather than
 * verbatim founder phrases.
 */
.sidebar__pitch-switcher {
  padding: 4px 10px 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}
.sidebar__pitch-switcher-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sidebar__pitch-switcher-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}
.sidebar__pitch-refresh {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  padding: 0;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--color-muted);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.sidebar__pitch-refresh:not(:disabled):hover {
  color: var(--color-accent-strong);
  background: var(--color-accent-dim);
  border-color: var(--color-accent-strong);
}
.sidebar__pitch-refresh:active { transform: scale(0.94); }
.sidebar__pitch-refresh:disabled { cursor: default; }
.sidebar__pitch-refresh.is-busy {
  color: var(--color-accent-strong);
}
.sidebar__pitch-refresh.is-busy svg {
  animation: sidebar-pitch-refresh-spin 0.8s linear infinite;
}
@keyframes sidebar-pitch-refresh-spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar__pitch-refresh.is-busy svg { animation: none; }
}
.sidebar__pitch-switcher-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.sidebar__pitch-dropdown {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-foreground);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.sidebar__pitch-dropdown:hover {
  background: var(--color-hover);
}
.sidebar__pitch-dropdown[aria-expanded="true"] {
  background: var(--color-hover);
  border-color: var(--color-foreground);
}
.sidebar__pitch-dropdown-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar__pitch-dropdown-caret {
  font-size: 10px;
  color: var(--color-muted);
  flex-shrink: 0;
}
/* Two-line title block: personal recognition name on top, AI-
 * generated canonical name underneath as a muted subtitle. Used in
 * both the dropdown face and the menu items. */
.sidebar__pitch-title-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  flex: 1 1 auto;
  gap: 1px;
  overflow: hidden;
}
.sidebar__pitch-title-personal {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.sidebar__pitch-title-ai {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.sidebar__pitch-title-ai--sub {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-muted);
  font-style: italic;
}
.sidebar__pitch-title-date {
  font-size: 10px;
  font-weight: 500;
  color: var(--color-muted);
  opacity: 0.8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
/* Full-width pill button — same outlined / indigo treatment as
 * .writing__end and .writing__next in the onboarding answer flow,
 * scaled down to fit the sidebar. Used for "Rename pitch" inside
 * the switcher and for the "Pitch" go-forth button at the bottom
 * of the deck nav. */
.sidebar__pitch-action {
  display: block;
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0 12px;
  margin-top: 2px;
  border-radius: 999px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.15s ease, transform 0.05s ease, color 0.15s ease, border-color 0.15s ease;
}
.sidebar__pitch-action--secondary {
  background: var(--color-surface);
  color: var(--color-foreground);
  border: 1px solid var(--color-border);
}
.sidebar__pitch-action--secondary:not(:disabled):hover {
  border-color: var(--color-accent-strong);
  color: var(--color-accent-strong);
  background: var(--color-accent-dim);
}
.sidebar__pitch-action--primary {
  background: var(--color-accent-strong);
  color: #fff;
  border: 1px solid var(--color-accent-strong);
  box-shadow: var(--shadow-purple);
}
.sidebar__pitch-action--primary:not(:disabled):hover {
  background: #4f46e5;
  border-color: #4f46e5;
}
.sidebar__pitch-action:active { transform: scale(0.98); }
.sidebar__pitch-action:disabled { opacity: 0.55; cursor: not-allowed; }
/* Bottom-of-nav mount for the indigo "Pitch" go-forth button.
 * Sits below the eleven deck-heading rows. Padding matches the
 * switcher so the button aligns vertically with the chip above. */
.sidebar__pitch-post {
  padding: 6px 10px 10px;
}
.sidebar__pitch-redistribute-note {
  margin: 0 2px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--color-muted);
}
.sidebar__pitch-rename-form {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}
.sidebar__pitch-rename-input {
  flex: 1 1 auto;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--color-foreground);
  background: var(--color-background);
  color: var(--color-foreground);
  font: inherit;
  font-size: 13px;
}
.sidebar__pitch-rename-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--color-accent-strong);
}
.sidebar__pitch-rename-save {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--color-foreground);
  background: var(--color-foreground);
  color: var(--color-background);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.sidebar__pitch-menu {
  list-style: none;
  margin: 4px 0 0;
  padding: 4px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-background);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 280px;
  overflow-y: auto;
}
.sidebar__pitch-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--color-foreground);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}
.sidebar__pitch-menu-item:hover {
  background: var(--color-hover);
}
.sidebar__pitch-menu-item[data-active] {
  background: var(--color-hover);
}
.sidebar__pitch-menu-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar__pitch-menu-meta {
  font-size: 11px;
  color: var(--color-muted);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  flex-shrink: 0;
}

/* ── Welcome (empty state on main when no draft/read is active) ──── */

.stage > .welcome.feed[data-active] {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  /* Fluid padding tuned so the form sits visually centred with the
     same breathing room as the login pill on the auth-gate. The
     auth-gate pill has 16px outer padding + 8px inner pill padding
     before the input border — ~24px effective on mobile. Without a
     pill wrapper here, we lean harder on outer padding (40px min on
     small screens) to land in the same visual neighbourhood. */
  padding: clamp(40px, 6vh, 64px) clamp(40px, 10vw, 96px);
  background: var(--color-background);
  position: relative;
  overflow: hidden;
}
/* Prism wedge hugging the top-left corner of the welcome page.
 * Consumes the design-system Edge tokens
 * (--edge-fill / --edge-size / --edge-fade / --edge-bleed /
 * --edge-clip) — keep visuals in sync via those tokens, not by
 * patching values here. The hypotenuse stays hard; the LEFT edge
 * stays solid (flush against the device's left bezel); only the TOP
 * edge fades so the phone's status bar can't break continuity on PWA.
 * --edge-bleed extends the wedge up through the safe-area on devices
 * with a notch and resolves to 0 on desktop. */
.stage > .welcome.feed[data-active]::before {
  content: "";
  position: absolute;
  top: calc(-1 * var(--edge-bleed));
  left: 0;
  width: var(--edge-size);
  height: calc(var(--edge-size) + var(--edge-bleed));
  background: var(--edge-fill);
  clip-path: var(--edge-clip);
  mask-image: linear-gradient(to bottom, transparent 0, black var(--edge-fade));
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, black var(--edge-fade));
  pointer-events: none;
  z-index: 0;
}

/* Sidebar mirror wedge — top-right of the sidebar, mirroring the
 * welcome corner wedge across the sidebar/stage boundary. Mobile-only:
 * on mobile the sidebar is the drawer, and the wedge slides in/out
 * with the drawer's translateX transform (defined in
 * mobile-drawer.css), so it's only visible when the drawer is open.
 * On desktop the sidebar is always inline; we deliberately drop this
 * wedge there (see the min-width: 541px rule below) so the welcome
 * screen shows only the single top-left corner flag. Sized via
 * --edge-sidebar-size (60px on mobile) so it doesn't reach the
 * dropdown row below the brand.
 *
 * isolation: isolate gives .sidebar its own stacking context (only
 * when welcome is active) so the wedge can sit at z-index: -1 —
 * above the sidebar's paper background, below all sidebar content
 * (brand, dropdown, account list). No sidebar child uses z-index
 * elsewhere, so isolating doesn't break anything. */
body:has(.stage > .welcome.feed[data-active]) .sidebar {
  isolation: isolate;
}
body:has(.stage > .welcome.feed[data-active]) .sidebar::before {
  content: "";
  position: absolute;
  top: calc(-1 * var(--edge-bleed));
  right: 0;
  width: var(--edge-sidebar-size);
  height: calc(var(--edge-sidebar-size) + var(--edge-bleed));
  background: var(--edge-fill-mirror);
  clip-path: var(--edge-clip-mirror);
  mask-image: linear-gradient(to bottom, transparent 0, black calc(var(--edge-sidebar-size) * 0.85));
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, black calc(var(--edge-sidebar-size) * 0.85));
  pointer-events: none;
  z-index: -1;
}
/* Desktop: drop the sidebar's top-right mirror wedge. At >=541px the
 * sidebar is permanently inline (no drawer), so this wedge would mirror
 * the welcome corner flag across the sidebar/stage boundary. We instead
 * keep just the single triangle in the top-left of the main screen. The
 * base rule above still draws the wedge on mobile, where it rides the
 * slide-in drawer. */
@media (min-width: 541px) {
  body:has(.stage > .welcome.feed[data-active]) .sidebar::before {
    display: none;
  }
}
.welcome .welcome__inner { position: relative; z-index: 1; }
.welcome__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  max-width: 480px;
  width: 100%;
}
.welcome__logo {
  opacity: 0.85;
  margin-bottom: 4px;
}
.welcome__logo svg rect { display: none; }
.welcome__question {
  margin: 0;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--color-foreground);
  line-height: 1.25;
}
.welcome__sub {
  margin: -4px 0 0;
  font-size: 15px;
  color: var(--color-muted);
  line-height: 1.4;
}

.welcome__prompt {
  margin: 10px 0 2px;
  font-size: 15px;
  color: var(--color-foreground);
  font-weight: 600;
  line-height: 1.3;
}
.welcome__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  max-width: min(380px, 88%);
  margin: 6px auto 0;
}
.welcome__tile {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 12px;
  min-height: 72px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-surface);
  color: var(--color-foreground);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.06s ease, background 0.15s ease;
}
.welcome__tile:hover {
  border-color: var(--color-accent-strong);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}
.welcome__tile:active { transform: scale(0.98); }
.welcome__tile[aria-pressed="true"] {
  border-color: var(--color-accent-strong);
  background: rgba(99, 102, 241, 0.08);
}
.welcome__tile-label {
  font-size: 15px;
  font-weight: 600;
}
.welcome__form {
  display: flex;
  gap: 8px;
  width: 100%;
  /* Cap form width at 88% of the inner column AND a 380px ceiling so
     the input + Start button stop spanning the full available width.
     With the section's clamp padding outside this, total visual margin
     from the screen edge ends up roughly 56-72px on mobile — matches
     the breathing room of the auth-gate pill. */
  max-width: min(380px, 88%);
  margin-left: auto;
  margin-right: auto;
  margin-top: 6px;
}
.welcome__form[hidden] { display: none; }
.welcome__input {
  flex: 1;
  padding: 14px 18px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  font: inherit;
  font-size: 16px;
  background: var(--color-surface);
  color: var(--color-foreground);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  min-width: 0;
}
.welcome__input::placeholder {
  color: var(--color-muted);
}
.welcome__input:focus {
  border-color: var(--color-accent-strong);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
  outline: none;
}
.welcome__submit {
  padding: 0 18px;
  height: 48px;
  border: 0;
  border-radius: 12px;
  background: var(--color-accent-strong);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.06s ease;
  white-space: nowrap;
}
.welcome__submit:hover { background: #4f46e5; }
.welcome__submit:active { transform: scale(0.98); }
.welcome__hint {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--color-muted);
  line-height: 1.5;
}

@media (max-width: 540px) {
  /* Horizontal + vertical padding handled by the clamp() on .welcome
     so it scales the same across mobile and narrow-desktop widths.
     Only the layout + type knobs change here. */
  .welcome__question { font-size: 22px; }
  .welcome__tile { min-height: 64px; padding: 14px 10px; }
  .welcome__form { flex-direction: column; gap: 10px; }
  .welcome__submit { width: 100%; height: 46px; }
}

/* ── Loading bar ───────────────────────────────────────────────────── */

.loadbar {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 2px; overflow: hidden; pointer-events: none;
  opacity: 0; transition: opacity 0.2s ease;
}
.loadbar[data-active] { opacity: 1; }
.loadbar span {
  display: block; height: 100%; width: 30%;
  background: linear-gradient(90deg, var(--color-leaf), var(--color-forest), var(--color-leaf));
  animation: loadbar-slide 1.2s ease-in-out infinite;
}
@keyframes loadbar-slide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(380%); }
}

/* ── Stage ─────────────────────────────────────────────────────────── */

.stage {
  flex: 1; position: relative;
  background: var(--color-background);
  overflow: hidden;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.stage > section {
  position: absolute;
  inset: 0;
  background: var(--color-background);
  overflow: auto;
}

.stage > .feed { display: none; }
.stage > .feed[data-active] { display: block; }

/* ── Feed ──────────────────────────────────────────────────────────── */

.feed {
  padding: 32px 24px 80px;
  background:
    radial-gradient(circle at 20% 0%, rgba(123, 196, 122, 0.08), transparent 38%),
    radial-gradient(circle at 90% 5%, rgba(165, 180, 252, 0.10), transparent 40%),
    var(--color-background);
}

.feed__inner {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.feed__label {
  margin-top: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
  padding-left: 4px;
}

.feed__list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.feed-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 18px;
  padding: 18px 20px 16px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.06s ease, box-shadow 0.15s ease;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.feed-card:hover { border-color: var(--color-accent); box-shadow: var(--shadow-soft); }
.feed-card:active { transform: scale(0.997); }
.feed-card:focus { outline: none; border-color: var(--color-accent-strong); box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15); }

.feed-card__head {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px;
  color: var(--color-muted);
}
.feed-card__avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, #6ee7b7, #7dd3fc);
}
.feed-card__author { font-weight: 600; color: var(--color-foreground); }
.feed-card__dot { color: var(--color-muted); }
.feed-card__when { color: var(--color-muted); font-size: 12px; }

.feed-card__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--color-foreground);
}

.feed-card__preview {
  font-size: 15px;
  line-height: 1.6;
  color: var(--color-foreground);
}
.feed-card__preview p {
  margin: 0 0 8px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.feed-card__preview p:nth-child(2) { display: none; }
.feed-card:hover .feed-card__preview p:nth-child(2) { display: -webkit-box; }

.feed-card__more {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-accent-strong);
}

.feed__empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--color-muted);
  font-style: italic;
}

/* ── Writing flow ──────────────────────────────────────────────────── */

.writing[hidden] { display: none !important; }
.writing {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 8%, rgba(123, 196, 122, 0.08), transparent 38%),
    radial-gradient(circle at 88% 4%, rgba(165, 180, 252, 0.10), transparent 38%),
    var(--color-background);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.writing__top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 28px;
  border-bottom: 1px solid rgba(237, 232, 224, 0.6);
}
.writing__close {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--color-foreground);
  transition: background 0.15s ease;
}
.writing__close:hover { background: rgba(45, 90, 61, 0.08); }

.writing__progress {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
}
.progress-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--color-border);
  transition: background 0.2s ease, transform 0.2s ease;
}
.progress-dot[data-done] { background: var(--color-leaf); }
.progress-dot[data-active] { background: var(--color-accent-strong); transform: scale(1.4); }

.writing__step {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
  flex-shrink: 0;
}

.writing__body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 24px 24px;
}

.writing__stage {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
}

.writing-card {
  background: transparent;
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: fade-up 0.28s ease;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.writing-question {
  margin: 0;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: var(--color-foreground);
}

.writing-input {
  width: 100%;
  min-height: 220px;
  padding: 18px 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  font-size: 17px;
  line-height: 1.65;
  color: var(--color-foreground);
  resize: vertical;
  font-family: var(--font-sans);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.writing-input:focus {
  border-color: var(--color-accent-strong);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}
.writing-input::placeholder { color: var(--color-muted); }

.writing-note {
  font-size: 13px;
  color: var(--color-muted);
}
.writing-note code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  background: rgba(45, 42, 38, 0.06);
  padding: 1px 5px;
  border-radius: 4px;
}

.writing-card--loading {
  align-items: flex-start;
  flex-direction: row;
  gap: 14px;
  padding: 40px 0;
  color: var(--color-muted);
  font-size: 15px;
}
.writing-loading__text { font-family: var(--font-display); }

.thinking-dots { display: inline-flex; gap: 4px; align-items: center; height: 22px; }
.thinking-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--color-accent-strong);
  animation: thinking-bounce 1.2s ease-in-out infinite;
}
.thinking-dot:nth-child(2) { animation-delay: 0.18s; }
.thinking-dot:nth-child(3) { animation-delay: 0.36s; }
@keyframes thinking-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-4px); opacity: 1; }
}

.writing-card--error .writing-error {
  white-space: pre-wrap;
  background: #fdf0eb;
  border: 1px solid #f0d3c5;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  color: #8b3a1a;
}

.writing__foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 28px 22px;
  border-top: 1px solid rgba(237, 232, 224, 0.6);
}
.writing__end, .writing__next {
  height: 44px;
  padding: 0 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.15s ease, transform 0.05s ease, color 0.15s ease, border-color 0.15s ease;
}
/* "This is everything" — same pill shape and footer position as Next,
 * but a soft outlined treatment so the two buttons don't fight. */
.writing__end {
  background: var(--color-surface);
  color: var(--color-foreground);
  border: 1px solid var(--color-border);
}
.writing__end:not(:disabled):hover {
  border-color: var(--color-accent-strong);
  color: var(--color-accent-strong);
  background: var(--color-accent-dim);
}
.writing__end:active { transform: scale(0.98); }
.writing__end:disabled { opacity: 0.45; cursor: default; }
.writing__end[hidden] { display: none; }

.writing__next {
  background: var(--color-accent-strong);
  color: #fff;
  box-shadow: var(--shadow-purple);
}
.writing__next:hover { background: #4f46e5; }
.writing__next:active { transform: scale(0.98); }
.writing__next:disabled { opacity: 0.5; cursor: default; }
.writing__next[hidden] { display: none; }

.writing-action {
  height: 44px;
  padding: 0 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  background: var(--color-surface);
  color: var(--color-foreground);
  border: 1px solid var(--color-border);
  transition: background 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
}
.writing-action:hover { background: var(--color-hover); }
.writing-action--primary {
  background: var(--color-accent-strong);
  color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-purple);
}
.writing-action--primary:hover { background: #4f46e5; }
.writing-action--primary:active { transform: scale(0.98); }
.writing-action:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

/* ── No AI mode ────────────────────────────────────────────────────────
 * The composer reuses the AI interview's question card wholesale — the
 * .writing-card / .writing-question / .writing-input rules above — so No
 * AI is visually identical to AI. The only No-AI-specific surface left is
 * the "Saved on this device" confirmation below. */
.writing-freewrite__sub {
  margin: 0;
  color: var(--color-muted);
  font-size: 14px;
  line-height: var(--leading-body);
}

.writing-card--freewrite-saved {
  align-items: center;
  text-align: center;
  gap: 16px;
  padding-top: 8px;
}
.writing-freewrite__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-accent-dim);
  color: var(--color-accent-strong);
}
.writing-card--freewrite-saved .writing-freewrite__sub { max-width: 32ch; }

/* ── Read view ─────────────────────────────────────────────────────── */

.read[hidden] { display: none !important; }
.read {
  display: flex;
  flex-direction: column;
  background: var(--color-background);
  position: relative;
}

.read__menu {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  right: 24px;
  z-index: 70;
  transition: opacity 0.18s ease;
}
/* When the founder avatar is shown (profile.js adds .has-avatar to <html>)
 * it sits fixed in this same top-right corner — 40px wide at right:12px —
 * so the two controls overlap and the kebab's dots fall on the photo. Slide
 * the kebab left to clear the avatar's 52px footprint (12px inset + 40px)
 * with a 12px gap, leaving the two side by side. Higher specificity than the
 * base rule and the ≤540px override below, so it holds at every width. */
.has-avatar .read__menu {
  right: calc(env(safe-area-inset-right, 0px) + 64px);
}
/* The same fixed avatar overlaps the writing header's step label, which
 * sits flush at the header's right edge (the rightmost flex child after the
 * progress dots). Pad the header right to clear the avatar's 52px footprint
 * (12px inset + 40px) plus a 12px gap, so "Question N" no longer falls under
 * the photo. Two classes outrank the base and the ≤540px / mobile-drawer
 * .writing__top rules, so this holds at every width. */
.has-avatar .writing__top {
  padding-right: calc(env(safe-area-inset-right, 0px) + 64px);
}
.read__menu-trigger {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px) url(#liquid-glass) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 0;
  color: var(--color-foreground);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}
.read__menu-trigger:hover { background: rgba(255, 255, 255, 0.16); }
.read__menu-trigger:active { transform: scale(0.96); }
.read__menu-trigger[aria-expanded="true"] { background: rgba(255, 255, 255, 0.22); }

.read__menu-pop {
  position: absolute;
  top: 48px;
  right: 0;
  list-style: none;
  margin: 0;
  padding: 4px;
  min-width: 160px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-background);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.read__menu-pop[hidden] { display: none; }
.read__menu-item {
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--color-foreground);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.read__menu-item:hover { background: var(--color-hover); }
.read__menu-item--danger { color: #b23a3a; }
.read__menu-item--danger:hover { background: rgba(196, 64, 64, 0.08); color: #8f2a2a; }

/* The read view's stage. Holds a single essay page, or — on a wide
 * desktop — a two-page "book" spread (the opened essay plus the next
 * essay in the pitch deck). It only frames what it holds; the prose
 * typography lives on .read__page. */
.read__body {
  width: 100%;
  margin: 0;
}
.read__book {
  display: flex;
  justify-content: flex-start;
  width: 100%;
}
/* One page of prose — carries the type the single .read__body used to
 * own, so a lone essay looks exactly as it did before. */
.read__page {
  width: 100%;
  max-width: 720px;
  padding: 56px 32px 80px;
  box-sizing: border-box;
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1.75;
  color: var(--color-foreground);
  text-align: left;
}
/* The neighbouring page is hidden until there's room to open the book
 * (see the min-width: 1200px rule). This is also what every narrow
 * screen gets — including mobile, where the floating title bar needs
 * exactly one .read__title to pin. */
.read__page--adjacent { display: none; }
.read__head { margin-bottom: 24px; }
.read__author {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-forest);
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}

/* Used by the read view's .read__author subtitle (pitch name · slide).
 * The slide title piece is coloured
 * inline (style="color: var(--logo-…)") to match the slide's row in
 * the sidebar — kept as inline-style so the renderer can mint the
 * exact CSS variable per heading without a class explosion. */
.essay-subtitle__slide {
  font-weight: 700;
}
/* The middle-dot separator sits between PitchName and SlideTitle.
 * Slightly muted and given a touch of horizontal breathing room so it
 * reads as a floating bullet rather than punctuation. */
.essay-subtitle__sep {
  display: inline-block;
  margin: 0 2px;
  color: var(--color-muted);
  opacity: 0.7;
}
.read__title {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  text-align: center;
}
.read__author { text-align: center; }
.read__page p { margin: 0 0 1em; }

/* Wide desktop: open the book. The opened essay and its pitch neighbour
 * sit side by side, centred as a pair and split by a centre spine, each
 * page capped so a line of prose keeps a comfortable measure. Below this
 * width the book collapses to the single .read__page--current and sits
 * where the essay always did. */
@media (min-width: 1200px) {
  .read__book--spread {
    justify-content: center;
    align-items: stretch;
  }
  .read__book--spread .read__page {
    flex: 1 1 0;
    max-width: 600px;
    min-width: 0;
  }
  .read__book--spread .read__page--adjacent { display: block; }
  .read__book--spread .read__page--left {
    border-right: 1px solid var(--color-border);
  }
}

/* ── Pitch assessing (post-publish confirmation) ──────────────────── */

.writing-fit[hidden] { display: none !important; }
.writing-fit {
  display: flex;
  flex-direction: column;
  background: var(--color-background);
  min-height: 100%;
  overflow-y: auto;
}
.writing-fit__inner {
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  padding: 56px 32px 80px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.assessing {
  margin: auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
}
.assessing__mark {
  width: 56px; height: 56px;
  border-radius: 999px;
  background: var(--color-accent-dim);
  display: grid; place-items: center;
  margin-bottom: 6px;
}
.assessing__pulse {
  width: 14px; height: 14px;
  border-radius: 999px;
  background: var(--color-accent-strong);
  box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.45);
  animation: assessing-pulse 1.8s ease-out infinite;
}
@keyframes assessing-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.45); }
  70%  { box-shadow: 0 0 0 16px rgba(99, 102, 241, 0); }
  100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}
.assessing__crumb {
  margin: 0;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--color-forest);
}
.assessing__headline {
  margin: 0;
  font-family: var(--font-display);
  font-size: 32px; font-weight: 700;
  letter-spacing: -0.01em; line-height: 1.2;
  color: var(--color-foreground);
}
.assessing__sub {
  margin: 0;
  max-width: 460px;
  font-size: 15px; line-height: 1.55;
  color: var(--color-muted);
}
.assessing__title { color: var(--color-foreground); font-weight: 600; }
.assessing__actions {
  margin-top: 18px;
  display: flex; gap: 12px; align-items: center;
}
.assessing__keep,
.assessing__read {
  height: 44px;
  padding: 0 22px;
  border-radius: 999px;
  font-weight: 600; font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease, color 0.15s ease, border-color 0.15s ease;
}
.assessing__keep {
  background: var(--color-accent-strong);
  color: #fff;
  border: 1px solid transparent;
  box-shadow: var(--shadow-purple);
}
.assessing__keep:hover { background: #4f46e5; }
.assessing__keep:active { transform: scale(0.98); }
.assessing__read {
  background: var(--color-surface);
  color: var(--color-foreground);
  border: 1px solid var(--color-border);
}
.assessing__read:hover {
  border-color: var(--color-accent-strong);
  color: var(--color-accent-strong);
  background: var(--color-accent-dim);
}
.assessing__read:active { transform: scale(0.98); }

/* ── Toast notifications (native-style placement alerts) ──────────── */

.tinker-toasts {
  position: fixed;
  top: 16px; right: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 360px;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}
.tinker-toast {
  pointer-events: auto;
  display: flex;
  gap: 12px;
  padding: 14px;
  /* Frosted glass: a translucent cream pane that blurs whatever sits
   * behind it (essay cards, the deck), with a bright top edge + soft
   * inner highlight so it reads as a physical sheet of glass rather than
   * a flat card. The opaque fallback colour keeps it legible where
   * backdrop-filter isn't supported. */
  background: rgba(255, 253, 247, 0.62);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 16px;
  box-shadow:
    0 12px 32px rgba(20, 20, 40, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  transition: opacity 0.25s ease, transform 0.25s ease, border-color 0.15s ease;
}
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .tinker-toast { background: var(--color-surface); }
}
.tinker-toast--in { opacity: 1; transform: translateY(0) scale(1); }
.tinker-toast--leaving { opacity: 0; transform: translateY(-8px) scale(0.98); }
.tinker-toast--clickable { cursor: pointer; }
.tinker-toast--clickable:hover { border-color: rgba(99, 102, 241, 0.55); }
/* Sticky notices stay until acknowledged — a left accent edge marks them
 * apart from the auto-dismissing placement toasts. */
.tinker-toast--sticky { border-left: 3px solid rgba(99, 102, 241, 0.7); }
.tinker-toast__icon {
  width: 34px; height: 34px;
  flex: none;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.5);
  padding: 5px;
}
.tinker-toast__body { flex: 1; min-width: 0; }
.tinker-toast__head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 3px;
}
.tinker-toast__app {
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--color-forest);
}
.tinker-toast__time { font-size: 11px; color: var(--color-muted); }
.tinker-toast__title {
  margin: 0;
  font-size: 14px; font-weight: 600;
  line-height: 1.3;
  color: var(--color-foreground);
}
.tinker-toast__text {
  margin: 2px 0 0;
  font-size: 13px; line-height: 1.4;
  color: var(--color-muted);
  overflow-wrap: anywhere;
}
.tinker-toast__close {
  flex: none;
  width: 22px; height: 22px;
  border: none; background: transparent;
  color: var(--color-muted);
  font-size: 18px; line-height: 1;
  cursor: pointer;
  border-radius: 6px;
}
.tinker-toast__close:hover { background: var(--color-hover); color: var(--color-foreground); }

@media (prefers-reduced-motion: reduce) {
  .assessing__pulse { animation: none; }
  .tinker-toast { transition: opacity 0.2s ease; transform: none; }
  .tinker-toast--in,
  .tinker-toast--leaving { transform: none; }
}
@media (max-width: 539px) {
  .writing-fit__inner { padding: 32px 18px 60px; }
  .assessing__headline { font-size: 26px; }
  .tinker-toasts { top: 10px; right: 10px; left: 10px; width: auto; }
}

/* ── Category feed (seed → category landing page) ───────────────── */
.category-feed[hidden] { display: none !important; }
.category-feed {
  display: flex;
  flex-direction: column;
  background: var(--color-background);
}
.category-feed__head {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 56px 32px 16px;
}
.category-feed__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--color-foreground);
}
.category-feed__sub {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--color-muted);
}
.category-feed__list {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 32px 80px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Status composer — single textarea + Post. Sits above the feed list
 * inside the same 720px column. Designed for short, top-of-mind notes
 * that don't justify an essay. */
.status-composer {
  width: 100%;
  max-width: 720px;
  margin: 16px auto 0;
  padding: 0 32px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.status-composer[hidden] { display: none !important; }
.status-composer__input {
  width: 100%;
  resize: vertical;
  min-height: 76px;
  padding: 14px 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--color-foreground);
  box-shadow: var(--shadow-card);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.status-composer__input::placeholder { color: var(--color-muted); }
.status-composer__input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: var(--focus-ring);
}
.status-composer__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.status-composer__hint {
  font-size: 12px;
  color: var(--color-muted);
}
.status-composer__post {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-accent-strong);
  background: var(--color-accent-strong);
  color: #ffffff;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
}
.status-composer__post:hover:not(:disabled) { background: var(--color-accent-press); }
.status-composer__post:active:not(:disabled) { transform: scale(0.98); }
.status-composer__post:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.category-feed__card--status .category-feed__card-body {
  color: var(--color-foreground);
  font-size: 15px;
}
.category-feed__card {
  text-align: left;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  font-family: var(--font-sans);
}
.category-feed__card:hover { background: var(--color-surface-alt); }
.category-feed__card:active { transform: scale(0.99); }
.category-feed__card-author {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--color-forest);
}
.category-feed__card-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--color-foreground);
}
.category-feed__card-body {
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-muted);
}
.category-feed__card-body p { margin: 0 0 1em; }
.category-feed__card-body p:last-child { margin-bottom: 0; }
.category-feed__empty {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 8px 32px 80px;
  font-size: 14px;
  color: var(--color-muted);
  font-style: italic;
}

/* ── Auth gate (web only) ─────────────────────────────────────────── */
/*
 * Mirrors the welcome page: pill-shaped input with an embedded pill
 * submit button, floated over the same warm cream + radial-gradient
 * backdrop. Uses the same brand mark, type ramp and accent colours.
 */

html.auth-gating, html.auth-gating body { overflow: hidden; }
@media (max-width: 539px) {
  html.auth-gating, html.auth-gating body { overflow: visible; }
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  min-height: 100dvh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding:
    max(20px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(20px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background:
    radial-gradient(circle at 20% 12%, rgba(123, 196, 122, 0.10), transparent 42%),
    radial-gradient(circle at 88% 18%, rgba(165, 180, 252, 0.12), transparent 38%),
    radial-gradient(circle at 50% 110%, rgba(253, 186, 116, 0.08), transparent 50%),
    var(--color-background);
}

.auth-gate__inner {
  max-width: 560px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding-top: 4vh;
}

.auth-gate__brand { display: flex; align-items: center; justify-content: center; }
.auth-gate__brand svg { width: 44px; height: 44px; }

.auth-gate__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-foreground);
  text-align: center;
}

.auth-gate__lede {
  margin: 0;
  max-width: 420px;
  color: var(--color-muted);
  font-size: 15px;
  line-height: 1.55;
  text-align: center;
}
.auth-gate__lede strong { color: var(--color-foreground); font-weight: 600; }

.auth-gate__pill {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  padding: 8px;
  gap: 8px;
  border-radius: 24px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  align-items: center;
  box-shadow: var(--shadow-soft);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.auth-gate[hidden],
.auth-gate__pill[hidden] { display: none !important; }

.auth-gate__pill:focus-within {
  border-color: var(--color-accent-strong);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18), var(--shadow-soft);
}

.auth-gate__cc {
  font-weight: 600;
  font-size: 16px;
  color: var(--color-muted);
  flex-shrink: 0;
  padding-left: 8px;
  letter-spacing: 0.01em;
}

.auth-gate__pill input {
  flex: 1 1 200px;
  min-width: 0;
  height: 48px;
  padding: 0 12px;
  background: transparent;
  border: none;
  font-size: 16px;
  color: var(--color-foreground);
}
.auth-gate__pill input::placeholder { color: var(--color-muted); }

.auth-gate__pill--pin input {
  flex-basis: 100%;
  font-feature-settings: "tnum";
  font-size: 22px;
  letter-spacing: 0.55em;
  padding-right: 0.55em;
  text-align: center;
}

.auth-gate__begin {
  flex: 1 1 100%;
  height: 52px;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--color-accent-strong);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.01em;
  transition: background 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
  box-shadow: var(--shadow-purple);
}
.auth-gate__begin:hover { background: #4f46e5; }
.auth-gate__begin:active { transform: scale(0.98); }

.auth-gate__status {
  min-height: 1.2em;
  font-size: 13px;
  color: var(--color-muted);
  text-align: center;
}
.auth-gate__status[data-kind="error"] { color: #b3261e; }
.auth-gate__status[data-kind="ok"]    { color: var(--color-forest); }

.auth-gate__link {
  font-size: 14px;
  color: var(--color-muted);
  background: transparent;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 999px;
  transition: color 0.15s ease, background 0.15s ease;
}
.auth-gate__link:hover {
  color: var(--color-foreground);
  background: rgba(45, 90, 61, 0.06);
}

.auth-gate__fineprint {
  margin: 4px 0 0;
  max-width: 360px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--color-muted);
  text-align: center;
}

@media (min-width: 540px) {
  .auth-gate { align-items: center; }
  .auth-gate__inner {
    gap: 18px;
    padding-top: 0;
    margin-top: -6vh;
  }
  .auth-gate__brand svg { width: 48px; height: 48px; }
  .auth-gate__title { font-size: 32px; }

  .auth-gate__pill {
    flex-wrap: nowrap;
    max-width: 520px;
    height: 56px;
    padding: 0 6px 0 20px;
    border-radius: 999px;
  }
  .auth-gate__cc { padding-left: 0; }
  .auth-gate__pill input {
    flex: 1 1 auto;
    height: auto;
    padding: 0;
  }
  .auth-gate__pill--pin { padding-left: 28px; }
  .auth-gate__pill--pin input {
    flex: 1 1 auto;
    height: auto;
    font-size: 18px;
  }
  .auth-gate__begin {
    flex: 0 0 auto;
    height: 44px;
    padding: 0 22px;
    font-size: 14px;
  }
  .auth-gate__link { min-height: auto; padding: 6px 10px; font-size: 13px; }
}

@media (min-width: 720px) {
  .auth-gate__title { font-size: 38px; }
}

/* ── Responsive ───────────────────────────────────────────────────── */

@media (max-width: 720px) {
  :root { --sidebar-width: 220px; }
  .writing-question { font-size: 24px; }
  .read__title { font-size: 28px; }
  .feed-card__title { font-size: 18px; }
}

@media (max-width: 540px) {
  :root { --sidebar-width: 64px; }
  .sidebar__name,
  .sidebar__new span,
  .sidebar__home span,
  .sidebar__label,
  .sidebar__footer,
  .sidebar__account,
  .session__title,
  .session__close { display: none; }
  .sidebar__new, .sidebar__home {
    margin: 6px 8px;
    padding: 10px;
    justify-content: center;
  }
  .session { padding: 8px; justify-content: center; }
  .feed { padding: 16px 14px 56px; }
  .writing__top { padding: 14px 16px; }
  .writing__body { padding: 24px 16px calc(env(safe-area-inset-bottom, 0px) + 24px); }
  .writing__foot { padding: 14px 16px calc(env(safe-area-inset-bottom, 0px) + 18px); }
  .read__page { padding: 32px 18px 60px; }
  .read__menu { top: calc(env(safe-area-inset-top, 0px) + 14px); right: 14px; }
  .category-feed__head { padding: 32px 18px 12px; }
  .category-feed__list { padding: 12px 18px 60px; }
  .category-feed__empty { padding: 8px 18px 60px; }
  .category-feed__title { font-size: 28px; }
  .status-composer { padding: 0 18px; }
}

/* ── Seed pre-prompt (Instagram tag-style head, regular textarea) ── */
.writing-seed__head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.writing-seed__pin {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: block;
}
.writing-seed__skip {
  align-self: flex-start;
  background: none;
  border: 0;
  padding: 4px 0;
  margin-top: 2px;
  font: inherit;
  font-size: 14px;
  color: var(--color-muted);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.writing-seed__skip:hover { color: var(--color-foreground); }
.writing-seed__label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--color-foreground);
  margin: 8px 0 -8px;
}
.writing-seed__input {
  min-height: 0;
  height: auto;
  padding: 14px 16px;
  font-size: 16px;
  line-height: 1.4;
  resize: none;
}
.writing-seed__label .writing-seed__pin {
  width: 20px;
  height: 20px;
}

.writing-recall {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 0 2px;
  font-size: 14px;
  font-style: italic;
  line-height: 1.55;
  color: var(--color-muted);
  white-space: pre-wrap;
}
.writing-recall__line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.writing-recall__pin {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 3px;
  display: block;
}
.writing-recall__label {
  font-style: normal;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-top: 4px;
  flex-shrink: 0;
  opacity: 0.7;
}
.writing-recall__text { min-width: 0; }

/* ── Add-transactions modal (opened from the home top-bar + button) ── */
.txn-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.txn-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(45, 42, 38, 0.45);
  backdrop-filter: blur(2px);
}
.txn-modal__card {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #ede8e0);
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(45, 42, 38, 0.25);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.txn-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.txn-modal__title {
  margin: 0;
  font-family: var(--font-display, "Plus Jakarta Sans", sans-serif);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.txn-modal__close {
  background: none;
  border: 0;
  font-size: 24px;
  line-height: 1;
  color: var(--color-muted, #6f6a65);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}
.txn-modal__close:hover { background: var(--color-hover, #f5f3ef); }
.txn-modal__note {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-muted, #6f6a65);
}
.txn-modal__section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.txn-modal__label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted, #6f6a65);
}
.txn-modal__count { text-transform: none; letter-spacing: 0; font-weight: 500; opacity: 0.8; }
.txn-modal__paste {
  width: 100%;
  font: 13px/1.5 ui-monospace, "SF Mono", Menlo, monospace;
  padding: 10px 12px;
  border: 1px solid var(--color-border, #ede8e0);
  border-radius: 10px;
  resize: vertical;
  background: var(--color-bg, #fffdf7);
}
.txn-modal__row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.txn-modal__btn {
  padding: 8px 14px;
  background: var(--color-hover, #f5f3ef);
  border: 1px solid var(--color-border, #ede8e0);
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.txn-modal__btn:hover { background: var(--color-border, #ede8e0); }
.txn-modal__btn--primary {
  background: var(--color-accent-strong, #4f46e5);
  color: #fff;
  border-color: transparent;
}
.txn-modal__btn--primary:hover { background: #4338ca; }
.txn-modal__msg { font-size: 12px; }
.txn-modal__msg[data-kind="ok"] { color: var(--color-forest, #2d5a3d); }
.txn-modal__msg[data-kind="err"] { color: #b03a2e; }
.txn-modal__manual {
  display: grid;
  grid-template-columns: 130px 1fr 100px 130px auto;
  gap: 8px;
  align-items: center;
}
.txn-modal__input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--color-border, #ede8e0);
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
}
.txn-modal__input--num { text-align: right; }
.txn-modal__list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--color-border, #ede8e0);
  border-radius: 10px;
  padding: 6px;
  background: var(--color-bg, #fffdf7);
}
.txn-modal__empty { padding: 14px; font-size: 13px; color: var(--color-muted, #6f6a65); }
.txn-modal__item {
  display: grid;
  grid-template-columns: 90px 1fr 80px 110px 24px;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 13px;
}
.txn-modal__item:hover { background: var(--color-hover, #f5f3ef); }
.txn-modal__item-date { color: var(--color-muted, #6f6a65); font-variant-numeric: tabular-nums; }
.txn-modal__item-merchant { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.txn-modal__item-amount { text-align: right; font-variant-numeric: tabular-nums; }
.txn-modal__item-category { color: var(--color-muted, #6f6a65); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.txn-modal__item-del {
  background: none;
  border: 0;
  color: var(--color-muted, #6f6a65);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 6px;
}
.txn-modal__item-del:hover { background: rgba(176, 58, 46, 0.1); color: #b03a2e; }
.txn-modal__foot { display: flex; justify-content: flex-end; }
html.txn-modal-open { overflow: hidden; }
@media (max-width: 720px) {
  .txn-modal__manual { grid-template-columns: 1fr 1fr; }
  .txn-modal__item { grid-template-columns: 70px 1fr 70px 24px; }
  .txn-modal__item-category { display: none; }
}

/* ── Home view (seeds list) ──────────────────────────────────────────
 *
 * Light theme — tinker palette. Top bar pattern mirrors Claude Code
 * mobile (☰ on the left, title in the middle, + on the right) but
 * styled to fit the rest of the app. No filter chips on this view;
 * the list is a simple time-grouped feed of previous seeds.
 */

#welcome.feed[data-active] {
  background: var(--color-background);
  display: flex;
  flex-direction: column;
  padding: 0;
}

.home-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 12px 8px 40px;
}
.home-list__section { display: flex; flex-direction: column; gap: 2px; }
.home-list__group-head {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 8px 10px 4px;
}
.home-list__group {
  margin: 0;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}
.home-list__group-sub {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--color-muted);
  opacity: 0.85;
}
.home-list__group--loading {
  color: var(--color-muted);
  font-style: italic;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  font-size: 13px;
  animation: home-group-pulse 1.4s ease-in-out infinite;
}
.home-list__group--awaiting {
  color: var(--color-muted);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
  font-size: 13px;
}
.home-list__section--awaiting .home-card {
  opacity: 0.78;
}
.home-list__section--awaiting .home-card__meta { font-style: italic; }

/* Nested (sub-category) sections sit inset under their parent and
   carry a small indigo rail so the eye reads them as "more specific
   inside this thread" rather than a sibling top-level. */
.home-list__section--nested {
  position: relative;
  padding-left: 10px;
  margin-left: 6px;
}
.home-list__section--nested::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 6px;
  width: 2px;
  border-radius: 2px;
  background: var(--color-accent-strong);
  opacity: 0.30;
}
.home-list__group--nested {
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-foreground);
}
.home-list__crumb { display: inline; }
.home-list__crumb--leaf { color: var(--color-accent-strong); }
.home-list__crumb-sep {
  display: inline-block;
  margin: 0 5px;
  color: var(--color-muted);
  font-weight: 400;
}
@keyframes home-group-pulse {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 0.9; }
}
/* Seed card */
.home-card {
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  background: transparent;
  border: 0;
  border-radius: 7px;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s ease;
}
.home-card:hover { background: rgba(99, 102, 241, 0.08); }
.home-card:active { background: rgba(99, 102, 241, 0.14); }
.home-card__avatar {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  color: #2d2a26;
  flex-shrink: 0;
}
/* Body stacks the seed name above the writing title (when one
   exists). Single-line row when no writing is anchored yet. */
.home-card__body {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  line-height: 1.25;
}
.home-card__name {
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 500;
  color: var(--color-foreground);
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.home-card--has-writing .home-card__name { font-weight: 600; }
.home-card__sub {
  font-size: 12px;
  color: var(--color-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.home-card__sub--title {
  font-style: italic;
  color: var(--color-muted);
}

/* ── Add-seed modal (light, tinker-styled) ──────────────────────── */
.seed-modal {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.seed-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(45, 42, 38, 0.45);
  backdrop-filter: blur(2px);
}
.seed-modal__card {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(45, 42, 38, 0.25);
  padding: 22px 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.seed-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.seed-modal__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--color-foreground);
}
.seed-modal__close {
  background: none;
  border: 0;
  font-size: 24px;
  line-height: 1;
  color: var(--color-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}
.seed-modal__close:hover { background: var(--color-hover); }
.seed-modal__sub {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-muted);
}
.seed-modal__input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  font: inherit;
  font-size: 16px;
  background: var(--color-bg, var(--color-background));
  color: var(--color-foreground);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.seed-modal__input:focus {
  border-color: var(--color-accent-strong);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
  outline: none;
}
.seed-modal__msg { font-size: 12px; min-height: 1em; }
.seed-modal__msg[data-kind="err"] { color: #b03a2e; }
.seed-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}
.seed-modal__btn {
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-hover);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-foreground);
  cursor: pointer;
  transition: background 0.12s ease;
}
.seed-modal__btn:hover { background: var(--color-border); }
.seed-modal__btn--primary {
  background: var(--color-accent-strong);
  border-color: transparent;
  color: #fff;
}
.seed-modal__btn--primary:hover { background: #4f46e5; }
html.seed-modal-open { overflow: hidden; }

/* ── founders (social-feed adjacency tool) ─────────────────────────
 *
 * A quiet paper-card surface — generous padding (the "quiet home" cue
 * from the spec). No animations, no engagement chrome, no scroll feed. */
.founders {
  display: block;
  width: 100%;
  min-height: 100%;
  box-sizing: border-box;
  padding: 0;
}
.founders[hidden] { display: none; }

.founders__inner {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 56px 32px 80px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.founders__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--color-foreground);
}

.founders__lede {
  margin: 0;
  font-family: var(--font-body, var(--font-sans));
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-foreground);
  max-width: 56ch;
}

.founders__loading,
.founders__results-loading {
  padding: 40px 0;
  text-align: center;
  color: var(--color-muted);
  font-family: var(--font-sans);
  font-size: 14px;
}

.founders__primary {
  align-self: flex-start;
  padding: 14px 24px;
  border-radius: var(--radius-pill, 999px);
  border: 1px solid var(--color-accent-strong, var(--color-foreground));
  background: var(--color-foreground);
  color: var(--color-background);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.founders__primary:hover { background: #000; }
.founders__primary:active { transform: translateY(1px); }
.founders__primary[disabled] { opacity: 0.55; cursor: default; }

.founders__secondary {
  align-self: flex-start;
  padding: 10px 16px;
  border-radius: var(--radius-pill, 999px);
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-muted);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.founders__secondary:hover {
  background: var(--color-hover);
  color: var(--color-foreground);
}
.founders__secondary[disabled] { opacity: 0.55; cursor: default; }

.founders__opt-in,
.founders__find,
.founders__hide {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
}

/* Picker: a vertical list of radio rows, one per published pitch. */
.founders__picker-prompt {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-muted);
  letter-spacing: 0.01em;
}
.founders__picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.founders__picker-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-card, 12px);
  border: 1px solid var(--color-border);
  background: var(--color-background);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.founders__picker-option:hover {
  border-color: var(--color-accent-strong);
  background: var(--color-hover);
}
.founders__picker-option input[type="radio"] {
  margin: 0;
  accent-color: var(--color-accent-strong);
}
.founders__picker-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--color-foreground);
}

/* Inline text-button for "Change pitch" — sits under the shared-pitch
 * card; muted, no border, opens the picker. */
.founders__inline-link {
  margin-top: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-muted);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.founders__inline-link:hover { color: var(--color-foreground); }
.founders__inline-link[disabled] { opacity: 0.55; cursor: default; }

.founders__fineprint {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--color-muted);
}

.founders__error {
  margin: 0;
  padding: 12px 16px;
  border-radius: var(--radius-card, 12px);
  background: rgba(176, 58, 46, 0.08);
  color: #8a2a1f;
  font-family: var(--font-sans);
  font-size: 13px;
}

.founders__own {
  padding: 20px 24px;
  border-radius: var(--radius-card, 14px);
  border: 1px solid var(--color-border);
  background: var(--color-background);
}
.founders__own-label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: 6px;
}
.founders__own-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--color-foreground);
}

.founders__results {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.founders__results-heading {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--color-foreground);
}

.founders__empty {
  margin: 0;
  padding: 24px 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-muted);
  max-width: 52ch;
}

.founders__cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.founders__card {
  margin: 0;
  padding: 0;
}
.founders__card-link {
  display: block;
  padding: 28px 28px;
  border-radius: var(--radius-card, 14px);
  border: 1px solid var(--color-border);
  background: var(--color-background);
  color: var(--color-foreground);
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}
.founders__card-link:hover {
  border-color: var(--color-accent-strong, var(--color-foreground));
  background: var(--color-hover);
}
.founders__card-link:active { transform: translateY(1px); }
.founders__card-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
  color: var(--color-foreground);
}
.founders__card-summary {
  font-family: var(--font-body, var(--font-sans));
  font-size: 15px;
  line-height: 1.55;
  color: var(--color-muted);
}


/* ── pitch-script ──────────────────────────────────────────────────
 *
 * "Prepare a script for a video" view. Modeled on .founders — same
 * column width, same padding, same typographic scale. One section
 * per slide with the founder's resolved phrases verbatim; a copy
 * button at the bottom for the full plain-text script.
 */
.pitch-script { display: block; width: 100%; min-height: 100%; box-sizing: border-box; padding: 0; }
.pitch-script[hidden] { display: none; }

.pitch-script__inner {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 32px 80px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.pitch-script__back {
  align-self: flex-start;
  padding: 6px 12px;
  border-radius: var(--radius-pill, 999px);
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-muted);
  font-family: var(--font-sans);
  font-size: 13px;
  cursor: pointer;
}
.pitch-script__back:hover { background: var(--color-hover); color: var(--color-foreground); }

.pitch-script__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--color-foreground);
}

.pitch-script__pitch-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--color-foreground);
}

.pitch-script__total {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--color-muted);
  letter-spacing: 0.02em;
}

.pitch-script__empty {
  margin: 0;
  font-family: var(--font-body, var(--font-sans));
  font-size: 15px;
  line-height: 1.55;
  color: var(--color-muted);
}

.pitch-script__storyboard {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.pitch-script__slide {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 16px 18px 8px;
  background: var(--color-surface, transparent);
}

.pitch-script__slide-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--color-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.pitch-script__slide-index { font-weight: 700; color: var(--color-foreground); }
.pitch-script__slide-heading { flex: 1; text-transform: none; letter-spacing: 0; color: var(--color-foreground); font-weight: 600; font-size: 14px; }
.pitch-script__slide-time { color: var(--color-muted); font-variant-numeric: tabular-nums; }

.pitch-script__slide-body { display: flex; flex-direction: column; gap: 8px; }

.pitch-script__phrase {
  margin: 0;
  font-family: var(--font-body, var(--font-sans));
  font-size: 15px;
  line-height: 1.55;
  color: var(--color-foreground);
}

.pitch-script__actions { display: flex; gap: 12px; padding-top: 8px; }
.pitch-script__copy {
  padding: 10px 18px;
  border-radius: var(--radius-pill, 999px);
  border: 1px solid var(--color-accent-strong, var(--color-foreground));
  background: var(--color-foreground);
  color: var(--color-background);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.pitch-script__copy:hover { background: #000; }
