/* Version: 29.1G9nOX */

/* ===== reset ===== */
*{box-sizing:border-box;margin:0;padding:0}
body{
  background:var(--bg-color);
  color:var(--text-main);
  font-family:var(--font-stack);
  line-height:1.45;
  -webkit-font-smoothing:antialiased;
  padding-bottom:48px;
}
.wrap{max-width:460px;margin:0 auto;padding:0 14px}
a{color:var(--accent);text-decoration:none}
.muted{color:var(--text-muted)}

/* ===== offline banner ===== */
.offline{
  display:flex;align-items:center;gap:8px;justify-content:center;
  background:var(--surface-color);border-bottom:1px solid var(--border);
  color:var(--text-muted);font-size:12px;padding:8px 12px;
  position:sticky;top:0;z-index:20;
}
.dot{width:8px;height:8px;border-radius:50%;background:var(--accent);display:inline-block}
/* sync-failure banner: reuses .offline layout, reads a touch more prominent */
.syncwarn{color:var(--text-main);font-weight:600}

/* ===== theme switcher bar ===== */
/* auth-screen theme picker — a collapsible swatch picker below the card
   (shared builder buildThemePicker from views/themePicker.js;
    same picker used in the ☰ system menu — see views/shell.js buildMenu) */
.themepick{display:flex;align-items:center;justify-content:center;gap:8px;padding:14px 0 4px;font-size:13px}
/* reset the toggle button so it reads as inline text, not a form widget */
.themepick button{background:none;border:none;padding:0;cursor:pointer;font:inherit;color:inherit;display:flex;align-items:center;gap:4px}
.themepick .caret{color:var(--text-muted);font-size:12px}

/* ===== cards / sections ===== */
.card{
  background:var(--surface-color);border:1px solid var(--border);
  border-radius:16px;padding:16px;margin:12px 0;
  box-shadow:var(--shadow-card);
}
.sec-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}
.sec-title{
  font-size:11px;font-weight:700;letter-spacing:.08em;
  text-transform:uppercase;color:var(--text-muted);
}
.edit{
  font-size:12px;color:var(--text-muted);cursor:pointer;
  border:0;background:none;font-family:inherit;
}
.edit:hover{color:var(--accent)}
.add{
  font-size:12px;color:var(--text-muted);cursor:pointer;
  border:0;background:none;font-family:inherit;
}
.add:hover{color:var(--accent)}
/* per-row edit icon (block pages) — a bare ✏️ button, transparent (no UA chrome) */
.edit-affordance{
  border:0;background:none;cursor:pointer;font-family:inherit;
  font-size:14px;line-height:1;padding:2px;color:var(--text-muted);
}
.edit-affordance:hover{color:var(--accent)}
/* tappable block-title heading (home preview) — a <button> styled as a link:
   reset UA button chrome, keep the .sec-title uppercase look, accent so it reads
   as interactive. */
.sec-title.open{
  cursor:pointer;border:0;background:none;font-family:inherit;
  color:var(--accent);
}
.sec-title.open:hover{text-decoration:underline}
.backbtn{border:0;background:none;font-family:inherit;cursor:pointer;color:var(--accent);padding:0;font-size:14px}
.blockpage{padding-top:4px}

/* ===== B2 viewer bar — signed-in "view others" chrome (views/viewerBar.js) =====
   Slim bar between the public hero card and the content: back-home + relationship
   + Tree actions. Shown only to a signed-in viewer of someone else's nutshell. */
.viewerbar{
  display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;
  background:var(--surface-color);border:1px solid var(--border);
  border-radius:12px;padding:8px 12px;margin:0 0 4px;
}
.viewerbar .backbtn{font-weight:600}
.viewerbar-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;justify-content:flex-end}
.viewerbar-err{flex-basis:100%;text-align:right;color:var(--text-muted)}

/* ===== header / hero ===== */
.hero{display:flex;gap:14px;align-items:center;margin-top:6px}
.avatar{
  width:64px;height:64px;border-radius:50%;
  background:var(--accent);color:var(--on-accent);
  display:flex;align-items:center;justify-content:center;
  font-size:24px;font-weight:700;flex:0 0 auto;
  overflow:hidden;   /* clip any swapped-in <img> to the circular frame */
}
.name{font-size:20px;font-weight:700;display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.handle{color:var(--text-muted);font-size:13px}

/* ===== ☰ system menu (hero card) ===== */
.hero-card{position:relative}
.menubtn{
  position:absolute;top:12px;right:12px;
  background:none;border:0;cursor:pointer;font-family:inherit;
  color:var(--text-muted);font-size:20px;line-height:1;
  padding:4px 7px;border-radius:8px;
}
.menubtn:hover{color:var(--text-main);background:var(--bg-color)}
.menu{
  position:absolute;top:44px;right:12px;z-index:50;
  min-width:210px;max-width:84%;
  background:var(--surface-color);border:1px solid var(--border);
  border-radius:12px;box-shadow:var(--shadow-card);padding:6px;
  display:none;
}
.menu.open{display:block}
.menu-row{
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  width:100%;background:none;border:0;cursor:pointer;
  font-family:inherit;font-size:14px;color:var(--text-main);
  text-align:left;padding:9px 10px;border-radius:8px;
}
.menu-row:hover{background:var(--bg-color)}
.menu-row .caret{color:var(--text-muted);font-size:12px}
.menu-sep{height:1px;border:0;background:var(--border);margin:5px 4px}
.submenu{display:none;max-height:264px;overflow-y:auto;padding:2px 0}
.submenu.open{display:block}
/* Each row carries data-theme="X" (set in shell.js), so var(--*) below resolve to
   THAT theme — the whole row previews its bg + text + accent, not just the swatch.
   Painting --bg-color (not transparent) is what makes the preview real and fixes
   the light-theme-on-a-dark-menu unreadability. */
.theme-opt{
  display:flex;align-items:center;gap:9px;
  width:100%;border:1px solid var(--border);cursor:pointer;
  font-family:inherit;font-size:13px;
  background:var(--bg-color);color:var(--text-main);
  text-align:left;padding:6px 9px;border-radius:7px;margin-bottom:4px;
}
.theme-opt:last-child{margin-bottom:0}
.theme-opt:hover{border-color:var(--accent)}
.theme-opt.sel{font-weight:600;outline:2px solid var(--accent);outline-offset:-2px}
.theme-opt .check{margin-left:auto;color:var(--accent)}
.swatch{
  flex:0 0 auto;width:18px;height:18px;border-radius:5px;position:relative;
  background:var(--surface-color);border:1px solid var(--border);
}
.swatch-dot{position:absolute;inset:4px;border-radius:50%;background:var(--accent)}
.bio{margin-top:8px;font-size:14px}
.tier1{
  font-size:11px;border:1px solid var(--border);color:var(--text-muted);
  border-radius:999px;padding:2px 8px;font-weight:600;
}

/* ===== visibility chips ===== */
.chip{
  font-size:10px;border:1px solid var(--border);color:var(--text-muted);
  border-radius:999px;padding:1px 7px;white-space:nowrap;
}
.queued{border-style:dashed;color:var(--accent)}
.failed{border-style:dashed;color:var(--danger);border-color:var(--danger)}

/* ===== rows (fact matrix / link list) ===== */
.row{
  display:flex;justify-content:space-between;align-items:flex-start;
  gap:10px;padding:8px 0;border-bottom:1px solid var(--border);
}
.row:last-child{border-bottom:0}
.cat{
  font-size:11px;font-weight:700;text-transform:uppercase;
  color:var(--text-muted);margin:6px 0 2px;
}
.ltitle{font-weight:600;font-size:14px}
.ldesc{font-size:12px;color:var(--text-muted)}

/* ===== zebra striping — book lists (Factbook / Linkbook / Journeybook) =====
   Subtle alternating-row shade evoking green-bar report paper, but THEME-
   CONSISTENT (not literally green): a small color-mix of --text-main into the
   card's --surface-color, so the tint stays on-palette + subtle on light /
   medium / dark (no literal colors here — those live only in themes.css).
   "of .row" / "of .post" counts ONLY rows, so interleaved .cat headers, the
   .sec-head, and the .esub capacity meter never throw off the alternation.
   Even rows get the tint; odd rows keep the plain surface. Background only —
   no padding/margin change, so no layout shift on the verified lists. */
.row:nth-child(even of .row),
.post:nth-child(even of .post){
  background:color-mix(in srgb, var(--text-main) 7%, var(--surface-color));
}

/* ===== photobook strip ===== */
.strip{display:flex;gap:10px;overflow-x:auto;padding-bottom:4px}
.cover{flex:0 0 auto;width:104px}
.cover .img{
  height:104px;border-radius:12px;border:1px solid var(--border);
  background:var(--bg-color);display:flex;align-items:center;
  justify-content:center;color:var(--text-muted);font-size:11px;
}
.cover .cap{font-size:12px;margin-top:4px;display:flex;justify-content:space-between;gap:6px}

/* ===== stream composer + posts ===== */
.composer{
  background:var(--bg-color);border:1px solid var(--border);
  border-radius:12px;padding:10px;margin-bottom:8px;
}
.composer .ph{color:var(--text-muted);font-size:14px}
.composer .cbar{display:flex;justify-content:space-between;align-items:center;margin-top:8px}
.pill{
  font:inherit;font-size:12px;border:1px solid var(--border);
  background:var(--surface-color);color:var(--text-muted);
  border-radius:999px;padding:4px 12px;cursor:pointer;
}
.pill.go{
  background:var(--accent);color:var(--on-accent);
  border-color:var(--accent);font-weight:600;
}
.post{padding:12px 0;border-bottom:1px solid var(--border)}
.post:last-child{border-bottom:0}
.post .body{font-size:14px}
.post .meta{
  display:flex;align-items:center;gap:8px;
  margin-top:6px;color:var(--text-muted);font-size:11px;
}
.count{font-size:11px;color:var(--text-muted)}
.note{font-size:11px;color:var(--text-muted);text-align:center;margin:4px 0 16px}

/* ===== editing / form elements ===== */
.ehead{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}
.etitle{font-size:13px;font-weight:700}
.esub{font-size:11px;color:var(--text-muted)}
.x{border:0;background:none;color:var(--text-muted);font-size:16px;cursor:pointer}

.flabel{
  font-size:11px;font-weight:600;color:var(--text-muted);
  text-transform:uppercase;letter-spacing:.05em;
  display:block;margin:32px 0 6px;
}
input,textarea,select{
  width:100%;font:inherit;font-size:14px;
  background:var(--bg-color);color:var(--text-main);
  border:1px solid var(--border);border-radius:10px;
  padding:9px 10px;outline:none;
}
input:focus,textarea:focus,select:focus{border-color:var(--accent)}
/* Keyboard-only focus ring (a11y): a visible outline when navigating by keyboard,
   suppressed for mouse/touch (:focus-visible). Uses the theme accent so it reads on
   every theme. Applies to buttons, links, pills, and the menu rows that had no
   visible focus affordance before. */
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
textarea{resize:none}
.ccount,.charctr{font-size:11px;color:var(--text-muted);text-align:right;margin-top:2px}
.ro{opacity:.6}

/* Single-item editor form (fact/link/post/chapter/photo). Kept minimal by design:
   fields space themselves via .flabel margins, so this is just a semantic wrapper
   (a block form) so the class isn't an orphan and has a hook for future tweaks.
   .charctr is the editors' live char counter — shares .ccount's treatment above. */
.editform{display:block}

/* Destructive .pill variant (the editors' Delete button). Filled danger color so
   it is unmistakably NOT the Save button (was rendering identically). --danger is
   the theme-independent token defined in themes.css. */
.pill.danger{background:var(--danger);color:var(--on-danger);border-color:var(--danger);font-weight:600}
/* In an editor button row, push the destructive Delete to the far right so it is
   spatially separated from the primary Save (they sat side by side before). */
.btnrow .danger{margin-left:auto}

/* A fact's optional link (factbook rows) — small accent-colored click-through. */
.factlink{display:inline-block;margin-top:3px;font-size:12px;color:var(--accent);cursor:pointer}

/* ===== visibility picker ===== */
.vispick{display:flex;border:1px solid var(--border);border-radius:10px;overflow:hidden;margin-top:2px}
/* v6 (ad-hoc #4): denser buttons (padding 8->4, font 12->11) trim ~1/3 of the bar
   height — the picker is stacked ~9x in the profile editor. */
.vispick button{
  flex:1;font:inherit;font-size:11px;padding:4px 4px;
  background:var(--surface-color);color:var(--text-muted);
  border:0;border-right:1px solid var(--border);cursor:pointer;
}
.vispick button:last-child{border-right:0}
/* Cumulative "sliding bar": .fill is the included band (selected + everything to
   its left, i.e. narrower) — same solid accent as the selection for a clear bar;
   .sel is the exact handle (adds weight) and follows .fill so it wins on overlap. */
.vispick button.fill{background:var(--accent);color:var(--on-accent)}
.vispick button.sel{background:var(--accent);color:var(--on-accent);font-weight:600}
.vishelp{font-size:11px;color:var(--text-muted);margin-top:4px}
/* v6: the help line is lazy (empty until a level is tapped); collapse its margin
   when empty so stacked pickers take no extra vertical space at rest. */
.vishelp:empty{margin-top:0}

/* ===== editing row / avatar (smaller in edit context) ===== */
.avatarrow{display:flex;gap:14px;align-items:center}
.btnrow{display:flex;gap:8px;margin-top:32px;align-items:center}

/* info pages (#/page/<slug>) — Markdown content + footer links */
.pagemeta{font-size:12px;color:var(--text-muted);margin:2px 0 14px;text-align:right}
.pagebody{line-height:1.55;font-size:15px}
.pagebody h1,.pagebody h2,.pagebody h3,.pagebody h4{margin:18px 0 8px;line-height:1.25}
.pagebody h1{font-size:20px}
.pagebody h2{font-size:17px}
.pagebody h3{font-size:15px}
.pagebody p{margin:9px 0}
.pagebody ul,.pagebody ol{margin:9px 0 9px 20px}
.pagebody li{margin:3px 0}
.pagebody a{color:var(--accent)}
.pagebody code{font-family:ui-monospace,Menlo,Consolas,monospace;font-size:.9em;background:var(--surface-color);padding:1px 5px;border-radius:4px}
.pagebody pre{background:var(--surface-color);padding:10px;border-radius:6px;overflow-x:auto}
.pagebody pre code{background:none;padding:0}
.pagebody blockquote{border-left:3px solid var(--border);margin:9px 0;padding-left:12px;color:var(--text-muted)}
.pagebody hr{border:none;border-top:1px solid var(--border);margin:14px 0}
.pagebody table{border-collapse:collapse;margin:9px 0}
.pagebody th,.pagebody td{border:1px solid var(--border);padding:4px 9px}
/* Footer info-links line (above the copyright) */
.pagefoot{margin-bottom:5px;line-height:1.8}
.pagefoot a{color:inherit;text-decoration:none;margin:0 6px}
.pagefoot a:hover{text-decoration:underline}
.saved{font-size:12px;color:var(--accent)}
.frow{
  display:flex;align-items:center;gap:10px;
  padding:9px 0;border-bottom:1px solid var(--border);
}
.frow:last-child{border-bottom:0}
.grip{color:var(--text-muted);cursor:grab;font-size:14px}
.ftext{flex:1;font-size:14px}
.iconbtn{border:0;background:none;color:var(--text-muted);cursor:pointer;font-size:13px}
.iconbtn:hover{color:var(--accent)}
.addbox{
  background:var(--bg-color);border:1px dashed var(--border);
  border-radius:12px;padding:12px;margin-top:12px;
}

/* ===== auth screens (sign-in / create / forgot / reset) ===== */
.brand{text-align:center;margin:18px 0 4px;font-size:26px;font-weight:800;letter-spacing:-.02em}
.brand .nut{color:var(--accent)}
.tagline{text-align:center;color:var(--text-muted);font-size:13px;margin-bottom:6px}
.seclabel{
  font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.08em;
  color:var(--text-muted);margin:0 0 10px;
}
.tabs{display:flex;border:1px solid var(--border);border-radius:10px;overflow:hidden;margin-bottom:14px}
.tabs button{
  flex:1;font:inherit;font-size:13px;padding:9px;
  background:var(--surface-color);color:var(--text-muted);
  border:0;border-right:1px solid var(--border);cursor:pointer;
}
.tabs button:last-child{border-right:0}
.tabs button.sel{background:var(--accent);color:var(--on-accent);font-weight:600}
.auth-submit{
  display:block;width:100%;text-align:center;font:inherit;font-size:14px;font-weight:600;
  background:var(--accent);color:var(--on-accent);border:1px solid var(--accent);
  border-radius:10px;padding:11px;margin-top:16px;cursor:pointer;
}
.auth-submit:disabled{opacity:.6;cursor:default}
.link{font-size:12px;color:var(--accent);text-align:center;margin-top:12px;cursor:pointer}
.hint{font-size:11px;color:var(--text-muted);margin-top:6px}
.ok{font-size:13px;color:var(--accent);margin-top:8px}
.hide{display:none}

/* ===== image field (avatar / cover picker) ===== */
.imagefield{display:flex;flex-direction:column;gap:8px;margin:8px 0}
.imagefield-preview{
  width:100%;max-height:200px;object-fit:contain;
  border-radius:12px;border:1px solid var(--border);
  background:var(--bg-color);display:block;
}
.imagefield-controls{display:flex;gap:8px}

/* ===== lightbox — full-size photo viewer overlay ===== */
.lightbox{
  position:fixed;inset:0;z-index:100;
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:12px;padding:16px;
  background:var(--bg-color);
}
.lightbox-inner{
  display:flex;flex-direction:column;align-items:center;gap:10px;
  max-width:min(96vw,900px);
}
.lightbox img{
  max-width:min(96vw,900px);max-height:80vh;
  object-fit:contain;border-radius:12px;border:1px solid var(--border);
  display:block;
}
.lightbox-unavailable{
  color:var(--text-muted);font-size:14px;padding:32px 0;
}
.lightbox-caption{
  color:var(--text-main);font-size:14px;text-align:center;
  max-width:min(96vw,700px);
}
.lightbox-controls{
  display:flex;align-items:center;gap:16px;margin-top:4px;
}
.lightbox-nav{
  background:none;border:1px solid var(--border);border-radius:8px;
  color:var(--text-main);cursor:pointer;
  font-size:22px;line-height:1;padding:6px 14px;
  font-family:inherit;
}
.lightbox-nav:hover:not(:disabled){background:var(--surface-color)}
.lightbox-nav:disabled{opacity:.35;cursor:default}
.lightbox-close{
  background:none;border:1px solid var(--border);border-radius:8px;
  color:var(--text-muted);cursor:pointer;
  font-size:20px;line-height:1;padding:6px 12px;
  font-family:inherit;
}
.lightbox-close:hover{color:var(--text-main);background:var(--surface-color)}

/* ===== My Tree management view (B3) ===== */
.treesec{margin-bottom:14px}
.treeid{
  display:flex;align-items:center;gap:10px;flex:1 1 auto;min-width:0;
  border:0;background:none;cursor:pointer;font:inherit;color:inherit;
  text-align:left;padding:0;
}
.treetxt{display:flex;flex-direction:column;min-width:0}
.treetxt .ltitle,.treetxt .ldesc{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:46vw}
.avatar-sm{
  width:36px;height:36px;font-size:14px;flex:0 0 auto;
  background-repeat:no-repeat;
}
.treeacts{display:flex;gap:6px;flex:0 0 auto;align-items:center;flex-wrap:wrap;justify-content:flex-end}
.row .treeacts .pill{padding:3px 10px}

/* ===== share sheet — QR / copy / share / download (B4) ===== */
.share-overlay{
  position:fixed;inset:0;z-index:100;
  display:flex;align-items:center;justify-content:center;
  padding:16px;background:var(--bg-color);
}
.share-inner{
  position:relative;
  display:flex;flex-direction:column;align-items:center;gap:14px;
  width:min(92vw,360px);
  background:var(--surface-color);
  border:1px solid var(--border);border-radius:16px;
  box-shadow:var(--shadow-card);
  padding:24px 20px 20px;
}
.share-title{font-size:16px;font-weight:600;color:var(--text-main)}
/* The tile is the QR quiet zone -- intentionally theme-independent (a QR needs a
   light field to scan). Color lives in themes.css (--qr-light); the canvas draws
   its own matching field via shareSheet.js cssColor(). */
.qr-tile{background:var(--qr-light);padding:12px;border-radius:12px;line-height:0}
.qr-canvas{display:block;max-width:100%;height:auto;image-rendering:pixelated}
.share-url{
  font-size:13px;color:var(--text-muted);
  word-break:break-all;text-align:center;max-width:100%;
  user-select:all;-webkit-user-select:all;
}
.share-actions{display:flex;flex-wrap:wrap;gap:8px;justify-content:center}
.share-close{
  position:absolute;top:8px;right:10px;
  background:none;border:0;cursor:pointer;font-family:inherit;
  font-size:22px;line-height:1;color:var(--text-muted);padding:4px 6px;
}
.share-close:hover{color:var(--text-main)}
.image-slot { width: 320px; height: 50px; margin: 0 auto; display: block; }
.image-media { display:block; max-width:100%; height:auto; }
