/* Library — lists on the left, links on the right (cards or rows). */

/* Design-language tokens the shared base.css doesn't have (claude/design-language.md):
   radius 6 for cards and inputs, 12 for sheets; motion fast 160 ms / base 240 ms on one curve */
:root {
  --radius-card: 6px;
  --radius-sheet: 12px;
  --line-hover: #3a3a45;
  --paper: #f7f5f0;
  --ink: #0e0e11;
  --ease: cubic-bezier(0.4, 0, 0.22, 1);
  --fast: 160ms;
  --base: 240ms;
  --card-shadow: none; /* none in dark mode */
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
  /* Softer than base.css's paper + pure white, which glared over long reading;
     cards keep a clearer edge */
  --bg-primary: #ece8e0; --bg-secondary: #f6f3ed; --bg-tertiary: #e5e0d6; --bg-hover: #ddd7cb;
  --border: #d3ccbf; --line-hover: #b9b0a0; --card-shadow: 0 1px 2px rgba(60, 45, 20, 0.07);
  --folder-back: #e2ddd2; --folder-tab: #d9d3c6; --folder-front: #f3f0e9; --folder-front-hover: #f8f6f1; /* base.css's tab = this page bg, so the tab vanished */
}
}
:root[data-theme="light"] {
  /* Softer than base.css's paper + pure white, which glared over long reading;
     cards keep a clearer edge */
  --bg-primary: #ece8e0; --bg-secondary: #f6f3ed; --bg-tertiary: #e5e0d6; --bg-hover: #ddd7cb;
  --border: #d3ccbf; --line-hover: #b9b0a0; --card-shadow: 0 1px 2px rgba(60, 45, 20, 0.07);
  --folder-back: #e2ddd2; --folder-tab: #d9d3c6; --folder-front: #f3f0e9; --folder-front-hover: #f8f6f1; /* base.css's tab = this page bg, so the tab vanished */
}

.btn-primary { border-radius: var(--radius-pill); }
@keyframes fade { from { opacity: 0; } }

body { min-height: 100vh; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.round {
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-secondary); color: var(--text-primary);
}
.round:hover { background: var(--bg-tertiary); }
.round.spinning svg { animation: spin 0.8s linear infinite; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px;
  border-radius: var(--radius-pill); background: var(--bg-tertiary); font-weight: 500; font-size: 14px;
}
.chip:hover { background: var(--bg-hover); }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; }
.chip.selected { background: var(--text-primary); color: var(--bg-primary); font-weight: 600; }
.chip .n { color: var(--text-secondary); font-weight: 500; }
.chip.selected .n { color: var(--text-muted); }

/* ── Date sections + grouped rows (the app's list) ── */
.section-title { font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-muted); margin: 0 2px 10px; }
/* Each day's box fades in whole (rows fading one by one left it empty for a moment).
   Wide screens: two boxes side by side, left one filled first (groupedList splits them) */
.group {
  display: grid; grid-template-columns: minmax(0, 1fr); column-gap: 24px; align-items: start;
  margin-bottom: 24px; animation: fade var(--base) var(--ease) both;
}
@media (min-width: 1280px) { .group { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.group-col { background: var(--bg-secondary); border: 1px solid var(--border); box-shadow: var(--card-shadow); border-radius: var(--radius-card); overflow: hidden; }
.item {
  display: flex; align-items: center; gap: 12px; padding: 0 12px 0 10px; min-height: 56px; width: 100%;
  position: relative; cursor: pointer; color: inherit; text-decoration: none; text-align: left; font: inherit;
  border-bottom: 1px solid var(--border); transition: background var(--fast) ease-out;
}
.item:last-child { border-bottom: 0; }
.item:hover { background: var(--bg-tertiary); }
/* 52 px thumbnail (36 px in list rows): picture, the site's icon at 16 px, or a paper swatch for a note */
.thumb {
  width: 52px; height: 52px; border-radius: var(--radius-card); flex-shrink: 0; overflow: hidden;
  background: var(--bg-tertiary); display: flex; align-items: center; justify-content: center;
}
.item .thumb { width: 36px; height: 36px; border-radius: 4px; background: var(--line-hover); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb img.icon { width: 16px; height: 16px; object-fit: contain; }
.thumb.paper { background: var(--paper); flex-direction: column; align-items: stretch; gap: 6px; padding: 0 11px; }
.item .thumb.paper { background: var(--paper); gap: 4px; padding: 0 8px; }
.thumb.paper i { height: 2px; border-radius: 1px; background: var(--ink); opacity: 0.18; }
.thumb.paper i:nth-child(2) { width: 70%; }
.thumb.paper i:nth-child(3) { width: 80%; }
.item-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.item-title { font-size: 14px; font-weight: 500; line-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-meta { display: flex; align-items: center; gap: 4px; color: var(--text-muted); font-size: 12px; line-height: 14px; min-width: 0; transition: color var(--fast) ease-out; }
.item:hover .item-meta { color: var(--text-secondary); }
.item-meta span { white-space: nowrap; flex-shrink: 0; }
.item-meta .lead { flex-shrink: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.item-end { display: flex; align-items: center; gap: 8px; flex-shrink: 0; color: var(--text-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.unread { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.unread.read { background: transparent; }
/* Saved here, not on the server yet (retried on the next load or when back online) */
.unsynced { margin-left: 6px; font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.item.queued .item-title, .card.queued .cap-title { color: var(--text-secondary); }
.more {
  width: 34px; height: 34px; border-radius: 50%; color: var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.more:hover { background: var(--bg-tertiary); color: var(--text-primary); }
/* Rows: the actions show on hover (right-click / long-press feel without a permanent ···) */
/* In list rows it sits over the time + dot instead of taking width from the title */
.item .more { position: absolute; right: 6px; top: 50%; margin-top: -17px; background: var(--bg-tertiary); opacity: 0; transition: opacity var(--fast) var(--ease); }
.item:hover .more, .item .more:focus-visible { opacity: 1; }
.selecting .item .item-end { visibility: hidden; }


.row-actions { display: flex; gap: 8px; align-items: center; }
.pill-btn {
  height: 36px; padding: 0 16px; border-radius: var(--radius-pill); white-space: nowrap;
  background: var(--accent); color: var(--on-accent); font-weight: 600;
}
.pill-btn:hover { background: var(--accent-hover); }
/* ── Empty + loading ── */
.empty { text-align: center; padding: 80px 20px; color: var(--text-secondary); }
.empty h3 { color: var(--text-primary); font-size: 20px; margin-bottom: 6px; }
.empty .retry { margin-top: 18px; padding: 0 22px; height: 42px; }
/* Next page of links drawn: only the first page animates in */
.settled .group, .settled .card { animation: none; }
.page-end { height: 1px; } /* infinite-scroll marker */
.loading { display: flex; justify-content: center; padding: 60px; }

/* ── Dialog ── */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); z-index: 20;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.sheet {
  width: 440px; max-width: 100%; max-height: 80vh; display: flex; flex-direction: column;
  background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-sheet);
  animation: pop var(--base) var(--ease);
}
/* Fades in while settling from 98% — eased, no spring */
@keyframes pop { from { opacity: 0; transform: scale(0.98); } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 8px 22px; }
.sheet-head h3 { font-size: 19px; font-weight: 700; }
.sheet-head .round { width: 32px; height: 32px; background: var(--bg-tertiary); }
.sheet-head svg { width: 16px; height: 16px; }
.sheet-body { padding: 8px 22px 16px; overflow-y: auto; }
.sheet-foot { padding: 0 22px 22px; }
.sheet-foot .btn-primary { width: 100%; }

/* ── First run: the empty stash's three tiles and the welcome slides. Their
   pictures (.art) are sample cards in the real card / note / folder styles ── */
.art {
  box-sizing: border-box; height: 184px; overflow: hidden; pointer-events: none; user-select: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  border-radius: var(--radius-card); background: var(--bg-tertiary);
}
.art .card { width: min(232px, 84%); flex-shrink: 0; animation: none; }
.art-link { justify-content: flex-start; padding-top: 18px; } /* the card runs off the bottom edge */
.art-link .card-box img.cover { height: 86px; }
.art-pill {
  display: flex; align-items: center; gap: 7px; width: min(232px, 84%); height: 32px; padding: 0 4px 0 10px; flex-shrink: 0;
  border-radius: var(--radius-pill); background: var(--bg-secondary); border: 1px solid var(--border); font-size: 12px;
}
.art-pill svg { width: 14px; height: 14px; flex-shrink: 0; color: var(--text-secondary); }
.art-pill span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.art-pill b { height: 24px; padding: 0 9px; border-radius: var(--radius-pill); background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 600; line-height: 24px; white-space: nowrap; }
.art-note .card { width: min(216px, 80%); }
.art-board .folder { width: min(184px, 70%); flex-shrink: 0; margin-top: 14px; }
.art-board .folder .name { font-size: 15px; }
.art-board .folder .meta { font-size: 12px; }
.art-board .folder .front { padding: 10px 12px; }

.start { max-width: 980px; margin: 0 auto; padding: 28px 0 20px; animation: fade var(--base) var(--ease) both; }
.start .eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.15em; text-transform: uppercase; color: var(--accent); }
.start h2 { margin: 8px 0 26px; font-size: 34px; line-height: 1.1; letter-spacing: -0.035em; }
.start-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.start-tile {
  padding: 6px 6px 18px; text-align: left; background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: calc(var(--radius-card) + 4px); box-shadow: var(--card-shadow);
  transition: transform var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.start-tile:hover { transform: translateY(-2px); border-color: var(--line-hover); }
.start-title { margin: 14px 10px 4px; font-family: var(--font-display); font-weight: 600; font-size: 19px; letter-spacing: -0.03em; }
.start-hint { margin: 0 10px; font-size: 14px; line-height: 20px; color: var(--text-secondary); }
.start-ext { margin-top: 22px; font-size: 14px; color: var(--text-secondary); }
.start-ext a { color: var(--accent); font-weight: 600; text-decoration: none; }
.start-ext a:hover { text-decoration: underline; }
@media (max-width: 820px) {
  .start { padding-top: 8px; }
  .start h2 { font-size: 28px; margin-bottom: 20px; }
  .start-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Welcome slides: the locked dialog has no title bar; the picture leads, inset like a card's */
.sheet-backdrop.locked .sheet { width: 460px; }
.locked .sheet-head { display: none; }
.locked .sheet-body { padding: 6px 6px 0; }
.locked .sheet-body > * { animation: fade var(--base) var(--ease) both; }
.locked .art { height: 196px; zoom: 1.15; border-radius: calc(var(--radius-sheet) - 6px); }
.locked .sheet-body h3 { margin: 22px 16px 8px; font-size: 24px; line-height: 1.15; letter-spacing: -0.035em; }
.welcome-text { margin: 0 16px; min-height: 4.65em; font-size: 15px; line-height: 1.55; color: var(--text-secondary); }
.welcome-dots { display: flex; gap: 6px; margin: 14px 16px 18px; }
.welcome-dots i { width: 6px; height: 6px; border-radius: 3px; background: var(--border); }
.welcome-dots i.on { width: 18px; background: var(--accent); }
.sheet input[type="text"], .panel input[type="text"] {
  width: 100%; height: 46px; padding: 0 14px; border-radius: var(--radius-card); font: inherit; font-size: 15px;
  border: 1px solid var(--border); background: var(--bg-primary); color: var(--text-primary); outline: none;
}
.sheet input[type="text"]:focus, .panel input[type="text"]:focus { border-color: var(--accent); }
.pick { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-radius: var(--radius-card); cursor: pointer; }
.pick[hidden] { display: none; }
.pick:hover { background: var(--bg-tertiary); }
.pick .thumb { width: 40px; height: 40px; }
.pick .item-title { font-size: 14px; -webkit-line-clamp: 1; }
.tick {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--text-muted); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.pick.on .tick { background: var(--accent); border-color: var(--accent); }
.pick.on .tick::after { content: ""; width: 5px; height: 9px; border: solid var(--on-accent); border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }

/* ── Menu ── */
.menu {
  position: fixed; z-index: 30; min-width: 220px; padding: 6px;
  background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: var(--radius-sheet);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5); animation: pop var(--fast) var(--ease);
}
.menu button { display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: var(--radius-card); font-size: 14px; }
.menu button:hover { background: var(--bg-hover); }
.menu button.danger { color: var(--danger); }
.menu hr { border: 0; height: 1px; background: var(--border); margin: 4px 6px; }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 96px; left: calc(50% + 28px); transform: translateX(-50%); z-index: 40; /* above the search pill */
  background: var(--text-primary); color: var(--bg-primary); font-weight: 600; padding: 11px 18px; border-radius: var(--radius-pill);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4); animation: fade var(--base) var(--ease);
}


/* ── Sign-in ── */

.signin-form input {
  flex: 1; min-width: 0; height: 44px; padding: 0 16px; border: 1px solid var(--border); outline: none;
  border-radius: var(--radius-card); background: var(--bg-secondary); color: var(--text-primary);
  font: inherit; font-size: 16px;
}
.signin-form input:focus { border-color: var(--accent); }
.signin-form input::placeholder { color: var(--text-muted); }

.signin { max-width: 380px; margin: 0 auto; padding: 96px 24px; text-align: center; }
.signin-logo { width: 56px; height: 56px; border-radius: 14px; margin-bottom: 20px; }
.signin h1 { font-size: 28px; font-weight: 700; margin-bottom: 10px; }
.signin-sub { color: var(--text-secondary); line-height: 1.5; margin-bottom: 24px; }
.signin-form { display: flex; flex-direction: column; gap: 10px; }
.signin-form .btn-primary { height: 48px; }
#code { text-align: center; letter-spacing: 6px; font-size: 22px; }
.link-btn { color: var(--text-secondary); font-size: 14px; padding: 8px; }
.link-btn:hover { color: var(--text-primary); }
.qr { margin-top: 28px; }
.qr-label { color: var(--text-muted); font-size: 14px; margin-bottom: 12px; }
/* QR stays dark-on-white in both themes so phone cameras read it */
.qr-code { display: inline-block; padding: 10px; border-radius: 14px; background: #fff; line-height: 0; }
.qr-code svg { width: 168px; height: 168px; }
.signin-error { color: var(--danger, #ff453a); font-size: 14px; min-height: 20px; margin-top: 12px; }
/* "Saveyor everywhere": Chrome (live) and the phone apps (soon) under sign-in */
.get { margin-top: 36px; }
.get-label { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; color: var(--accent); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.14em; }
.get-label::before, .get-label::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.get-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.get-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 8px 14px; border-radius: 16px; border: 1px solid var(--border); background: var(--bg-secondary); color: var(--text-primary); text-decoration: none; }
.get-icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 4px; border-radius: 12px; background: var(--bg-tertiary); color: var(--text-secondary); }
.get-icon svg { width: 22px; height: 22px; fill: currentColor; }
.get-icon .get-stroke { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.get-icon .get-eye { fill: var(--bg-tertiary); }
.get-name { font-family: var(--font-display); font-size: 15px; font-weight: 700; letter-spacing: -0.02em; }
.get-status { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 500; color: var(--text-muted); }
.get-status svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.get-tile.live { border-color: var(--accent); transition: transform 0.2s ease, background 0.2s ease; }
.get-tile.live .get-icon { background: var(--accent); color: var(--on-accent); }
.get-tile.live .get-status { color: var(--accent); font-weight: 600; }
.get-tile.live:hover { transform: translateY(-2px); background: var(--accent-subtle); }
@media (prefers-reduced-motion: reduce) { .get-tile.live { transition: none; } .get-tile.live:hover { transform: none; } }

.shared-icon { display: inline-flex; vertical-align: -2px; margin-right: 3px; }
.shared-icon svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* column layout: inputs keep their height */
.signin-form input { flex: none; }

/* Edit link sheet */
.field-label { font-size: 12px; font-weight: 600; letter-spacing: 0.6px; text-transform: uppercase;
  color: var(--text-secondary); margin: 14px 0 8px; }
.field-label:first-child { margin-top: 4px; }
.sheet textarea, .panel textarea {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-card); resize: vertical; min-height: 72px;
  background: var(--bg-primary); border: 1px solid var(--border); color: var(--text-primary);
  font: inherit; font-size: 15px; outline: none;
}
.sheet textarea:focus, .panel textarea:focus { border-color: var(--accent); }
.sheet .chips, .panel .chips { margin-bottom: 10px; }

/* ── Shell: a 56 px rail + the main column (like the phone's home tab) ── */
.shell { display: flex; min-height: 100vh; }
/* Fixed 56px rail; on hover (or keyboard focus) it slides open over the page to show labels */
.rail {
  position: fixed; top: 0; left: 0; bottom: 0; width: 56px; z-index: 10; overflow: hidden;
  display: flex; flex-direction: column; align-items: stretch; gap: 18px; padding: 18px 8px 14px;
  background: var(--bg-primary); border-right: 1px solid var(--border);
  transition: width var(--base) var(--ease), box-shadow var(--base) var(--ease);
}
.rail:hover, .rail:focus-within { width: 212px; box-shadow: 12px 0 40px -20px rgba(0, 0, 0, 0.45); }
/* The lowercase wordmark, turned upright, in muted */
.rail-mark {
  display: none; /* hidden for now: delete this line to bring the wordmark back */
  align-self: flex-start; margin-left: 6px; writing-mode: vertical-rl; transform: rotate(180deg); padding: 4px 0 8px;
  font-family: var(--font-display); font-weight: 700; font-size: 24px; letter-spacing: -0.035em;
  color: var(--text-secondary); text-decoration: none;
  opacity: var(--s, 0); transition: opacity var(--fast) var(--ease); /* only once the header logo has scrolled away */
}
.rail-group { display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
.rail-bottom { margin-top: auto; }
.rail-btn {
  position: relative; width: 100%; height: 40px; padding: 0 10px; border-radius: var(--radius-card);
  display: flex; align-items: center; justify-content: flex-start; gap: 14px; color: var(--text-secondary); white-space: nowrap;
  transition: color var(--fast) var(--ease), background var(--fast) var(--ease);
}
.rail-btn svg { width: 20px; height: 20px; flex-shrink: 0; stroke-width: 1.5; }
.rail-btn:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.rail-btn.active { color: var(--text-primary); }
.rail-label, .account-email { font-size: 14px; font-weight: 500; opacity: 0; transition: opacity var(--fast) var(--ease); }
.rail:hover .rail-label, .rail:focus-within .rail-label,
.rail:hover .account-email, .rail:focus-within .account-email { opacity: 1; }
.rail .theme-toggle svg { width: 20px; height: 20px; stroke-width: 1.5; }
.rail .theme-toggle { border-radius: var(--radius-card); }
.account {
  position: relative; width: 100%; height: 44px; padding: 0 6px; border-radius: var(--radius-card);
  display: flex; align-items: center; gap: 12px; text-align: left; white-space: nowrap;
}
.account:hover { background: var(--bg-tertiary); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--text-primary); color: var(--bg-primary); font-weight: 700; font-size: 13px;
}
.account-email { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; }

.main { flex: 1; min-width: 0; padding: 24px 24px 120px; margin-left: 56px; } /* room below for the search pill */
/* Header: the logo. It scrolls away with the page (shrinking a little as it goes) and the rail's
   wordmark fades in as it leaves (--s 0→1, set on <html> from the scroll). */
.main-head {
  height: 72px; margin: -24px -24px 6px; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand-head {
  display: flex; align-items: center; gap: 10px; color: var(--text-primary); text-decoration: none;
  transform: scale(calc(1 - 0.2 * var(--s, 0))); transform-origin: left center;
}
.brand-head svg { width: 34px; height: 34px; }
.brand-head span { font-family: var(--font-display); font-weight: 700; font-size: 36px; line-height: 1; letter-spacing: -0.035em; }
.mark-rib { fill: var(--text-primary); } .mark-body { fill: var(--bg-primary); stroke: var(--bg-primary); } .mark-wing { fill: var(--accent); }

/* Dock, floating at the bottom centre: the search pill and the + (save a link) */
.dock {
  position: fixed; left: calc(50% + 28px); bottom: 24px; transform: translateX(-50%); z-index: 9;
  width: min(626px, calc(100% - 56px - 32px)); display: flex; align-items: center; gap: 12px;
}
.add-link {
  width: 54px; height: 54px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--on-accent); box-shadow: 0 16px 40px -18px rgba(0, 0, 0, 0.55);
  transition: background var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.add-link:hover { background: var(--accent-hover); transform: scale(1.05); }
.add-link svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
/* Selecting: the dock gives way to the selection bar; ticked cards get an ember ring and tick */
.selecting .dock, .selecting .compose-item { display: none; }
.select-bar {
  position: fixed; left: calc(50% + 28px); bottom: 24px; transform: translateX(-50%); z-index: 9;
  width: min(760px, calc(100% - 56px - 32px)); display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 10px; border-radius: 22px; background: var(--bg-secondary); border: 1px solid var(--border);
  box-shadow: 0 16px 40px -18px rgba(0, 0, 0, 0.55);
}
.select-bar .round svg { width: 16px; height: 16px; }
.select-count { font-weight: 600; font-size: 14px; padding: 0 4px; }
.select-gap { flex: 1; }
.select-bar button:disabled { opacity: 0.4; pointer-events: none; }
.select-bar .danger-text { padding: 0 16px; }
.selecting .card .card-box :is(.more, .pin), .selecting .item .more { display: none; }
.selecting .card .card-box::after, .selecting .item::after {
  content: ""; position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid #fff; background: rgba(0, 0, 0, 0.35); box-sizing: border-box;
}
.selecting .item::after { top: 50%; transform: translateY(-50%); right: 14px; border-color: var(--line-hover); background: none; }
.card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.selecting .card.selected .card-box::after, .selecting .item.selected::after {
  border-color: var(--accent); background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230E0E11' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E") center / 14px no-repeat;
}
.item.selected { background: var(--accent-subtle); }
@media (max-width: 640px) { .select-bar { left: 50%; width: calc(100% - 24px); bottom: 68px; } }

.search-pill {
  position: relative; flex: 1; min-width: 0; height: 54px; padding: 0 10px 0 20px;
  display: flex; align-items: center; gap: 12px; border-radius: var(--radius-pill);
  /* Mostly solid, so the text stays readable over busy pictures; a little of the page shows through */
  background: color-mix(in srgb, var(--bg-secondary) 88%, transparent); border: 1px solid var(--border);
  backdrop-filter: blur(24px) saturate(1.2); -webkit-backdrop-filter: blur(24px) saturate(1.2);
  box-shadow: 0 16px 40px -18px rgba(0, 0, 0, 0.55); color: var(--text-secondary);
}
.search-pill > svg { width: 18px; height: 18px; flex-shrink: 0; }
.search-pill input {
  flex: 1; min-width: 0; padding: 0; border: 0; outline: none; background: none; color: var(--text-primary);
  font: inherit; font-size: 16px;
}
.search-pill input::placeholder { color: var(--text-secondary); }
.search-pill input::-webkit-search-cancel-button { display: none; }
.search-pill:focus-within { border-color: var(--line-hover); }
/* Flare: an ember highlight that runs round the pill's edge, with a soft halo behind it */
@property --flare { syntax: "<angle>"; inherits: true; initial-value: 0deg; }
.search-pill { animation: flare 5s linear infinite; }
.search-pill::before, .search-pill::after {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  background: conic-gradient(from var(--flare), transparent 0 55%, var(--accent) 80%, transparent 97%);
}
.search-pill::before { /* the ring: only the 2px edge shows */
  padding: 2px;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.search-pill::after { z-index: -1; filter: blur(16px); opacity: 0.5; } /* the halo, glowing through the translucent pill */
.search-pill:focus-within { animation-duration: 2.5s; }
@keyframes flare { to { --flare: 360deg; } }
@media (prefers-reduced-motion: reduce) {
  .search-pill { animation: none; border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
  .search-pill::before, .search-pill::after { display: none; }
}
.search-key {
  flex-shrink: 0; min-width: 24px; height: 24px; padding: 0 7px; border-radius: var(--radius-card); border: 1px solid var(--border);
  font: inherit; font-size: 12px; line-height: 22px; text-align: center; color: var(--text-secondary);
}
.search-pill:focus-within .search-key, .save-hint:not(.hidden) ~ .search-key { display: none; }
.save-hint {
  flex-shrink: 0; height: 32px; padding: 0 14px; border-radius: var(--radius-pill);
  background: var(--accent); color: var(--on-accent); font-size: 13px; font-weight: 600;
  animation: fade var(--fast) var(--ease);
}
.row-actions { display: flex; gap: 8px; align-items: center; }
.count { color: var(--text-secondary); }

/* Chips under the search (the phone's filter row): lists, tags, collections */
.chips-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -24px 18px; padding: 0 24px; }
.chips-row::-webkit-scrollbar { display: none; }
.chips-row .chip { flex-shrink: 0; height: 32px; padding: 0 14px; background: var(--bg-tertiary); }
.chips-row .chip.selected { background: var(--text-primary); color: var(--bg-primary); }
.list-compose { margin-bottom: 20px; }
/* In the list it's a slim row, not a card */
.list-compose .composer { min-height: 0; flex-direction: row; align-items: baseline; gap: 14px; padding: 10px 14px; }
/* ── Pinned shelf: one row of short cards (boards first) above the list or the
   columns. Scrolls sideways with snapping, never wraps; a 48px fade at each
   edge while there's more that way; ‹ › on hover (pointer screens) ── */
.shelf { position: relative; margin-bottom: 20px; }
.shelf-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.shelf-head .eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.15em; text-transform: uppercase; color: var(--text-muted); transition: color var(--fast) var(--ease); }
.shelf-head .eyebrow.full { color: var(--accent); }
.shelf-head .link-btn { padding: 4px 8px; font-size: 13px; }
.shelf-row {
  display: flex; gap: 14px; align-items: flex-start; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scrollbar-width: none; outline-offset: 4px; border-radius: var(--radius-card);
  --ml: 48px; --mr: 48px; /* the fades; 0 at an edge you've reached */
  -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--ml), #000 calc(100% - var(--mr)), transparent);
  mask-image: linear-gradient(to right, transparent, #000 var(--ml), #000 calc(100% - var(--mr)), transparent);
}
.shelf-row::-webkit-scrollbar { display: none; }
.shelf-row.at-start { --ml: 0px; }
.shelf-row.at-end { --mr: 0px; }
.shelf-row > * { flex: 0 0 180px; scroll-snap-align: start; }
.shelf-row .card-box { height: 130px; }
.shelf-row .card-box img.cover { height: 100%; }
.shelf-arrow {
  position: absolute; top: 50%; width: 36px; height: 36px; margin-top: -6px; border-radius: 50%; z-index: 1;
  display: none; align-items: center; justify-content: center; color: var(--text-primary);
  background: var(--bg-secondary); border: 1px solid var(--border); opacity: 0; transition: opacity var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.shelf-arrow.prev { left: -6px; } .shelf-arrow.next { right: -6px; }
.shelf-arrow svg { width: 16px; height: 16px; }
.shelf-arrow:hover { border-color: var(--line-hover); }
@media (hover: hover) { .shelf-arrow { display: flex; } }
.shelf:hover .shelf-arrow, .shelf-arrow:focus-visible { opacity: 1; }
.shelf-row.at-start ~ .shelf-arrow.prev, .shelf-row.at-end ~ .shelf-arrow.next { opacity: 0; pointer-events: none; }
/* The pin on a card: beside the ⋯, ember when pinned, dim when the shelf is full */
.card-box .pin { right: 46px; }
.card-box .pin.on { opacity: 1; color: var(--accent); }
.shelf-full .card-box .pin:not(.on) { color: var(--text-muted); }
.card .card-box .pin.on, .card:hover .card-box .pin, .card-box .pin:focus-visible { opacity: 1; }
/* Surface toast: a title, a line, and ghost actions */
.toast.surface {
  max-width: min(420px, calc(100% - 32px)); padding: 14px 16px; text-align: left; font-weight: 400; border-radius: var(--radius-sheet);
  background: var(--bg-secondary); color: var(--text-primary); border: 1px solid var(--border);
}
.toast.surface b { display: block; font-weight: 600; margin-bottom: 2px; }
.toast.surface p { color: var(--text-secondary); font-size: 14px; }
.toast.surface .toast-actions { display: flex; gap: 4px; margin: 10px 0 -6px -8px; }
.toast.surface .link-btn { color: var(--accent); font-weight: 500; }
/* Pin / Unpin: the card flies to its new place, the rest settle around it */
::view-transition-group(pin-move) { animation-duration: 420ms; animation-timing-function: var(--ease); }

/* ── Cards: masonry columns. Each card is one tile (content + caption inside),
   so a caption never reads as belonging to the card below it ── */
.cards { display: flex; gap: 14px; align-items: flex-start; }
.cards .col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.card {
  cursor: pointer; min-width: 0; padding: 6px 6px 10px; animation: fade var(--base) var(--ease) both;
  background: var(--bg-secondary); border: 1px solid var(--border); border-radius: calc(var(--radius-card) + 4px);
  box-shadow: var(--card-shadow); transition: transform var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.card:hover { transform: translateY(-2px); border-color: var(--line-hover); }
.card-box { position: relative; overflow: hidden; border-radius: var(--radius-card); background: var(--bg-tertiary); }
.card-box img.cover { display: block; width: 100%; height: auto; object-fit: cover; filter: var(--img-veil); }
/* No picture: the title alone on surface */
.plain-body { padding: 14px; }
.plain-title {
  font-family: var(--font-display); font-weight: 600; font-size: 18px; line-height: 23px; letter-spacing: -0.035em;
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
/* A PDF with no picture: "PDF" in ember over its site, on raised surface */
.card-box.pdf { aspect-ratio: 2 / 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 14px; }
.pdf-tag { font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: 0.04em; color: var(--accent); }
.pdf-site { font-size: 13px; color: var(--text-muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb .pdf-tag { font-size: 10px; }
/* Notes: a soft two-tone paper picked from the note's id (same tint every visit), heading in the tint's own ink */
.card-box.note {
  padding: 14px; color: #1c1b19; --text-primary: #1c1b19; --text-secondary: #6b6862;
  background: linear-gradient(140deg, var(--tint-a), var(--tint-b));
}
.tint-0 { --tint-a: #fcf3e8; --tint-b: #f9e7da; --tint-ink: #9a4a1f; } /* peach */
.tint-1 { --tint-a: #f2f5eb; --tint-b: #e4edde; --tint-ink: #3d6a37; } /* sage */
.tint-2 { --tint-a: #f0f3f6; --tint-b: #e3ebf2; --tint-ink: #2d5b88; } /* sky */
.tint-3 { --tint-a: #f4f0f5; --tint-b: #eae2f1; --tint-ink: #5d448f; } /* lilac */
.tint-4 { --tint-a: #fbf6e5; --tint-b: #f7ecce; --tint-ink: #7d5a0c; } /* butter */
.tint-5 { --tint-a: #faefee; --tint-b: #f5e1e3; --tint-ink: #973a50; } /* rose */
.note-head {
  font-family: var(--font-display); font-weight: 700; font-size: 17px; line-height: 22px; letter-spacing: -0.03em;
  color: var(--tint-ink); margin-bottom: 6px; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.note-text { width: 100%; font-size: 14px; line-height: 20px; color: var(--text-primary); overflow: hidden; }
.note-line { white-space: pre-wrap; overflow: hidden; text-overflow: ellipsis; }
.note-line.more { color: var(--text-secondary); }
/* A card shows 6 rows at most: a long pasted paragraph is one "line" that would wrap on and on */
.card-box .note-text { max-height: 120px; }
.card-box .note-line { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 6; }
.note-check {
  display: flex; align-items: flex-start; gap: 7px; width: 100%; padding: 2px 0;
  text-align: left; font: inherit; color: inherit; cursor: pointer; border-radius: 4px;
}
.note-check:hover .box { border-color: var(--accent); }
.note-check .box {
  position: relative; width: 14px; height: 14px; margin-top: 3px; flex-shrink: 0;
  border: 1.5px solid var(--text-secondary); border-radius: 4px; transition: background var(--fast), border-color var(--fast);
}
.note-check.done .box { background: var(--accent); border-color: var(--accent); }
.note-check.done .box::after {
  content: ""; position: absolute; left: 3.5px; top: 0.5px; width: 3.5px; height: 7px;
  border: solid var(--on-accent); border-width: 0 1.8px 1.8px 0; transform: rotate(45deg);
}
.note-check .label { min-width: 0; overflow-wrap: anywhere; }
.note-check.done .label { text-decoration: line-through; color: var(--text-secondary); }
.card-box .more {
  position: absolute; top: 8px; right: 8px; opacity: 0; transition: opacity var(--fast) var(--ease);
  background: rgba(0, 0, 0, 0.6); color: #fff; backdrop-filter: blur(6px);
}
.card:hover .card-box .more, .card-box .more:focus-visible { opacity: 1; }
.card-box .more:hover { background: rgba(0, 0, 0, 0.8); color: #fff; }
/* Caption: title over source, unread dot at the end */
.cap { display: flex; align-items: center; gap: 8px; padding: 10px 6px 0; }
.cap-icon { width: 16px; height: 16px; border-radius: 3px; flex-shrink: 0; align-self: flex-start; margin-top: 2px; }
.cap-text { flex: 1; min-width: 0; }
.cap-title, .cap-src { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cap-title { font-size: 14px; font-weight: 500; line-height: 19px; }
.cap-src { font-size: 13px; line-height: 18px; color: var(--text-secondary); }
.cap .unsynced { margin-left: 0; }
/* Card 0: write a note in place */
/* Ember-tinted so it stands apart from the saved cards */
.composer {
  display: flex; flex-direction: column; gap: 4px; min-height: 60px; padding: 10px 12px; cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); border-radius: calc(var(--radius-card) + 4px);
  background: var(--accent-subtle); box-shadow: var(--card-shadow);
  transition: border-color var(--fast) var(--ease);
}
.composer:hover, .composer:focus-within { border-color: var(--accent); }
.composer .eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.15em; text-transform: uppercase; color: var(--accent); }
.composer { width: 100%; text-align: left; font: inherit; color: inherit; }
.composer-hint { font-size: 15px; line-height: 20px; color: var(--text-muted); }
/* Tag name box with its n/15 count */
.tag-field { position: relative; }
.tag-field input { width: 100%; padding-right: 56px; }
.tag-count {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%); pointer-events: none;
  font-size: 12px; font-variant-numeric: tabular-nums; color: var(--text-muted);
}
.tag-count.full { color: var(--accent); font-weight: 600; }

/* ── Narrow screens: the rail becomes a bar along the bottom ── */
@media (max-width: 640px) {
  .shell { flex-direction: column; }
  .rail, .rail:hover, .rail:focus-within {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; width: auto; height: 56px; padding: 0 8px;
    flex-direction: row; justify-content: space-around; gap: 0; border-right: 0; border-top: 1px solid var(--border);
    background: var(--bg-primary); box-shadow: none;
  }
  .rail-btn, .account { width: 40px; padding: 0; justify-content: center; }
  .rail-label, .account-email { display: none; }
  .rail-mark { display: none; }
  .rail-group { flex-direction: row; gap: 2px; }
  .rail-bottom { margin-top: 0; }
  .main { padding: 18px 16px 140px; margin-left: 0; }
  .chips-row { margin: 0 -16px 16px; padding: 0 16px; }
  .main-head { margin: -18px -16px 6px; padding: 0 16px; height: 64px; }
  .brand-head span { font-size: 30px; }
  .brand-head svg { width: 28px; height: 28px; }
  .dock { left: 50%; bottom: 68px; width: calc(100% - 24px); gap: 8px; }
  .search-key { display: none; }
  .toast { bottom: 136px; left: 50%; }
}

/* ── Save / note sheets ── */
.sheet textarea.note-area { min-height: 180px; line-height: 1.55; margin-top: 10px; }
.note-tools { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.note-tools .count.over { color: var(--danger); }

/* Note dialog: wider, with smaller boxes and Save below the text */
.sheet.wide { width: 640px; }
.sheet.wide .note-side input[type="text"] { height: 38px; font-size: 14px; }
.sheet.wide .note-side .field-label { margin-top: 12px; }
/* Save floats over the bottom right corner, like the + button, instead of taking a row */
.sheet.wide { position: relative; }
.sheet.wide .sheet-body { padding-bottom: 72px; }
.sheet.wide .sheet-foot { position: absolute; right: 22px; bottom: 18px; padding: 0; }
.sheet.wide .sheet-foot .btn-primary { width: auto; min-width: 120px; height: 42px; font-size: 14px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35); }
.full > .sheet .sheet-foot { position: static; }
.full > .sheet .sheet-foot .btn-primary { width: 100%; box-shadow: none; }

/* Full-screen note: just the heading (first line) and the text, in a reading column */
.sheet-head .sheet-tools { display: flex; gap: 8px; }
.sheet { view-transition-name: sheet; }
::view-transition-group(sheet) { animation-duration: var(--base); animation-timing-function: var(--ease); }
.sheet-backdrop.full { padding: 0; background: var(--bg-primary); }
.full > .sheet { width: 100%; height: 100%; max-height: none; border: 0; border-radius: 0; background: var(--bg-primary); }
.full > .sheet .sheet-head { justify-content: flex-end; padding: 14px 18px 0; }
.full > .sheet #sheet-title, .full > .sheet .note-main .field-label { display: none; }
/* Full screen: tags, boards and Save in a column on the left, the note fills the rest */
.full > .sheet {
  display: grid; grid-template-columns: 300px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto;
}
.full > .sheet .sheet-head { grid-column: 1 / -1; }
.full > .sheet .sheet-body { display: contents; }
.full > .sheet .note-main {
  grid-column: 2; grid-row: 2 / 4; display: flex; flex-direction: column; overflow-y: auto;
  width: 100%; max-width: 720px; margin: 0 auto; padding: 24px 24px 24px;
}
.full > .sheet .note-side { grid-column: 1; grid-row: 2; overflow-y: auto; padding: 24px 20px 12px; border-right: 1px solid var(--border); }
.full > .sheet .sheet-foot { grid-column: 1; grid-row: 3; padding: 12px 20px 20px; border-right: 1px solid var(--border); }
.full > .sheet .note-side .field-label:first-child { margin-top: 0; }
@media (max-width: 640px) {
  .full > .sheet { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; }
  .full > .sheet .note-main { grid-column: 1; grid-row: 2; }
  .full > .sheet .note-side { display: none; }
  .full > .sheet .sheet-foot { grid-column: 1; border-right: 0; }
}
.full > .sheet .sheet-body input.note-title {
  height: auto; padding: 0 0 12px; border: 0; border-radius: 0; background: none;
  font-family: var(--font-display); font-weight: 700; font-size: 34px; line-height: 1.15; letter-spacing: -0.03em;
}
.full > .sheet textarea.note-area { flex: 1; margin: 0; padding: 0; border: 0; background: none; resize: none; font-size: 18px; line-height: 1.7; }
/* Dialog or details panel open: the page behind stays put */
body:has(#sheet:not(.hidden), #panel:not(.hidden)) { overflow: hidden; }
.sheet-body, .panel { overscroll-behavior: contain; }
.pill-btn.ghost { background: var(--bg-tertiary); color: var(--text-primary); height: 32px; padding: 0 12px; font-size: 13px; }
.pill-btn.ghost:hover { background: var(--bg-hover); opacity: 1; }

/* ── Search passages: where a full-text match was found ── */
.card-snip, .item-snip {
  font-size: 12.5px; line-height: 1.45; color: var(--text-secondary);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card-snip { margin-top: 4px; padding: 0 6px; }
.item-snip { margin-top: 2px; -webkit-line-clamp: 2; }
.card-snip mark, .item-snip mark { background: var(--accent-subtle); color: var(--text-primary); font-weight: 600; border-radius: 3px; padding: 0 2px; }


/* Board description under the H1: two lines, then "… Show more" */
.board-desc { margin-top: 8px; max-width: 620px; }
.board-desc .desc { color: var(--text-secondary); font-size: 14px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.board-desc .desc.clamped { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.note-read { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; font-size: 15px; }
.note-read a { color: var(--accent); overflow-wrap: anywhere; }
/* Share sheet */
.pill-btn.ghost-lg { background: var(--bg-tertiary); color: var(--text-primary); }
.pill-btn.ghost-lg:hover { background: var(--bg-hover); }
.sheet input.share-link, .share-pw input {
  width: 100%; font: inherit; font-size: 14px; padding: 11px 13px; border-radius: 12px;
  background: var(--bg-primary); border: 1px solid var(--border); color: var(--text-primary);
}
.share-actions { display: flex; gap: 8px; margin: 10px 0 6px; }
.share-toggle { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; cursor: pointer; font-size: 15px; }
.share-toggle input { width: 18px; height: 18px; accent-color: var(--accent); }
.share-pw { display: flex; gap: 8px; margin-top: 6px; }
.share-pw .pill-btn { flex-shrink: 0; }
.danger-text { color: var(--danger); padding: 14px 0 0; }
.danger-text:hover { color: var(--danger); text-decoration: underline; }

/* ── Link details: a panel on the right; a bottom sheet on phones ── */
.panel {
  position: fixed; top: 12px; right: 12px; bottom: 12px; width: 400px; z-index: 15; overflow-y: auto;
  background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-sheet);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35); animation: slide-in var(--base) var(--ease);
}
/* Dims the page behind the panel, like a sheet's backdrop; a click on it closes the panel */
.panel-scrim { position: fixed; inset: 0; z-index: 14; background: rgba(0, 0, 0, 0.55); animation: fade var(--base) var(--ease); }
@keyframes slide-in { from { opacity: 0; transform: translateX(16px); } }
/* Closing: the opening in reverse (closePanel hides it after) */
.panel.closing { animation: slide-out var(--base) var(--ease) forwards; pointer-events: none; }
.panel.full.closing, .panel-scrim.closing, .panel-grow.closing { animation: fade-out var(--base) var(--ease) forwards; pointer-events: none; }
@keyframes slide-out { to { opacity: 0; transform: translateX(16px); } }
@keyframes fade-out { to { opacity: 0; } }
.panel-close { position: sticky; top: 12px; float: right; margin: 12px 12px -52px 0; z-index: 1; width: 36px; height: 36px; }
.panel-close svg { width: 16px; height: 16px; }
.panel-cover { display: block; width: 100%; max-height: 320px; object-fit: cover; background: var(--bg-tertiary); }
.panel-body { padding: 20px 22px 24px; }
.panel-title {
  font-family: var(--font-display); font-weight: 700; font-size: 22px; line-height: 1.2; letter-spacing: -0.03em;
  padding-right: 40px; overflow-wrap: anywhere;
}
.panel-cover + .panel-body .panel-title { padding-right: 0; }
.panel-site { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; font-size: 14px; color: var(--text-secondary); }
.panel-site .dim { color: var(--text-muted); }
.panel-desc { margin-top: 12px; font-size: 14px; line-height: 1.5; color: var(--text-secondary); overflow-wrap: anywhere; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 6px; }
.panel-actions .danger-text { padding: 0 16px; color: var(--danger); }
.panel-actions .danger-text:hover { text-decoration: none; background: var(--bg-hover); }
.panel .note-read { font-size: 14px; }
/* A note in the panel */
.panel .eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.15em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.panel-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.panel-note { margin-top: 16px; font-size: 15px; line-height: 24px; }
@media (max-width: 640px) {
  .panel {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 85vh; z-index: 25;
    border-radius: var(--radius-sheet) var(--radius-sheet) 0 0; border-bottom: 0;
    box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.55); animation: slide-up var(--base) var(--ease);
  }
  @keyframes slide-up { from { transform: translateY(24px); opacity: 0; } }
  .panel.closing { animation-name: slide-down; }
  @keyframes slide-down { to { transform: translateY(24px); opacity: 0; } }
  .panel-grow { display: none; } /* the sheet is nearly full screen already */
}

/* ── Boards and Tags screens ── */
.index-screen { min-height: calc(100vh - 140px); padding-bottom: 120px; animation: fade var(--base) var(--ease) both; }
.index-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 28px; }
.index-head .eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.15em; text-transform: uppercase; color: var(--accent); }

/* Tags: a wall of huge #words, sized by how many links carry them */
.tag-wall { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.1em 0.45em; font-size: clamp(44px, 8.5vw, 132px); }
.big-tag { position: relative; font-size: calc(1em * var(--size)); }
.big-tag-word {
  font-family: var(--font-display); font-weight: 700; font-size: inherit; line-height: 1; letter-spacing: -0.05em;
  color: var(--text-primary); text-align: left; transition: color var(--fast) var(--ease);
}
.big-tag-word .hash { color: var(--tag); margin-right: 0.02em; }
.big-tag-word .n { font-family: var(--font-ui); font-size: max(12px, 0.18em); font-weight: 600; letter-spacing: 0; color: var(--text-muted); vertical-align: super; margin-left: 0.15em; }
.big-tag-word:hover { color: var(--tag); }
.editing .big-tag-word { cursor: default; }
.editing .big-tag-word:hover { color: var(--text-primary); }
/* Edit: every tag jiggles (each a little out of step) and shows a − to remove it */
.editing .big-tag { animation: jiggle 0.3s ease-in-out infinite alternate; }
@keyframes jiggle { from { transform: rotate(-1.2deg); } to { transform: rotate(1.2deg); } }
.big-tag .minus {
  position: absolute; top: 0; left: 0; width: 24px; height: 24px; border-radius: 50%; translate: -55% -35%;
  display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; line-height: 1;
  background: var(--danger); color: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); animation: pop var(--base) var(--ease);
}
.big-tag .minus:hover { transform: scale(1.1); }

/* Boards: folder cards. Tab + back panel, the 3 newest links peeking out, a front
   flap with the name; hover/focus tips the flap open and fans the links out. */
.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 20px 16px; }
.board-tile { display: block; width: 100%; text-align: left; border-radius: 12px; outline: 0; animation: fade var(--base) var(--ease) both; }
.folder { position: relative; aspect-ratio: 1 / 0.78; perspective: 900px; perspective-origin: 50% 120%; transition: transform var(--fast) ease-out; }
.folder > * { position: absolute; }
.folder .back { inset: 12% 0 0; background: var(--folder-back); border: 1px solid var(--border); border-radius: 10px; transition: border-color var(--fast) ease-out; }
.folder .tab {
  top: 0; left: 0; width: 30%; height: 16%; background: var(--folder-tab);
  border-radius: 8px 8px 0 0; clip-path: polygon(0 0, 78% 0, 100% 100%, 0 100%);
}
.folder .peek { inset: 10% 9% 26%; pointer-events: none; }
.folder .fcard {
  position: absolute; inset: 0; border-radius: var(--radius-card); background: var(--bg-secondary); border: 1px solid var(--border);
  overflow: hidden; transform-origin: 50% 100%; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  transition: transform 420ms var(--ease);
}
.folder .fcard img { width: 100%; height: 100%; object-fit: cover; }
.folder .fcard .ph {
  height: 100%; display: flex; align-items: flex-end; padding: 8px; font-size: 11px; font-weight: 500; line-height: 1.3;
  color: var(--text-secondary); background: var(--bg-tertiary); overflow: hidden;
}
.folder .c1 { transform: translateY(-24%) scale(0.86); }
.folder .c2 { transform: translateY(-12%) scale(0.93); }
.folder .c3 { transform: translateY(0) scale(1); }
.folder .front {
  inset: 40% 0 0; background: var(--folder-front); border: 1px solid var(--border); border-radius: 10px;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 3px; padding: 14px;
  transform-origin: 50% 100%; backface-visibility: hidden;
  transition: transform 420ms var(--ease), background-color var(--fast) ease-out, border-color var(--fast) ease-out;
}
.folder .name {
  max-width: 100%; font-family: var(--font-display); font-weight: 600; font-size: 18px; letter-spacing: -0.03em; line-height: 1.15;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.folder .meta { display: flex; gap: 6px; align-items: center; max-width: 100%; font-size: 13px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; }
.folder .shared { font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
/* A folder's ⋯: bottom-right of the flap, on hover / focus (always on touch screens) */
.board-item { position: relative; }
.board-item > .more {
  position: absolute; right: 6px; bottom: 6px; opacity: 0; transition: opacity var(--fast) var(--ease);
}
.board-item:hover > .more, .board-item > .more:focus-visible, .board-item:focus-within > .more { opacity: 1; }
.board-item > .more:hover { background: var(--folder-front-hover); }
@media (hover: none) { .board-item > .more { opacity: 1; } }
.folder .folder-pin { position: absolute; top: 10px; right: 10px; display: flex; color: var(--text-secondary); }
.folder .folder-pin svg { width: 14px; height: 14px; stroke-width: 1.8; }
:is(.board-item:hover, .board-tile:focus-visible, .start-tile:hover, .start-tile:focus-visible, .locked .art-board) .front { transform: rotateX(-36deg) translateY(6%); background: var(--folder-front-hover); border-color: var(--line-hover); }
:is(.board-item:hover, .board-tile:focus-visible, .start-tile:hover, .start-tile:focus-visible, .locked .art-board) .back { border-color: var(--line-hover); }
:is(.board-item:hover, .board-tile:focus-visible, .start-tile:hover, .start-tile:focus-visible, .locked .art-board) .c1 { transform: translate(-18%, -34%) rotate(-7deg) scale(0.9); }
:is(.board-item:hover, .board-tile:focus-visible, .start-tile:hover, .start-tile:focus-visible, .locked .art-board) .c2 { transform: translate(18%, -32%) rotate(6deg) scale(0.94); }
:is(.board-item:hover, .board-tile:focus-visible, .start-tile:hover, .start-tile:focus-visible, .locked .art-board) .c3 { transform: translateY(-22%) scale(1); }
.board-tile:focus-visible .folder { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 10px; }
.board-tile:active .folder { transform: scale(0.97); }
@media (prefers-reduced-motion: reduce) {
  .board-tile { animation-delay: 0s !important; }
  .folder, .folder .fcard, .folder .front { transition-duration: 1ms; }
  :is(.board-item:hover, .board-tile:focus-visible, .start-tile:hover, .start-tile:focus-visible, .locked .art-board) .front { transform: translateY(14%); }
}

/* Still loading: the spinner alone, no search dock */
.shell:has(#loading:not(.hidden)) .dock { display: none; }

/* A note's reader: full-screen button beside close; full screen is a reading column */
.panel { view-transition-name: panel; }
::view-transition-group(panel) { animation-duration: var(--base); animation-timing-function: var(--ease); }
.panel-tools { position: sticky; top: 12px; float: right; display: flex; gap: 8px; margin: 12px 12px -52px 0; z-index: 1; }
.panel-tools .round { width: 36px; height: 36px; }
.panel-tools svg { width: 16px; height: 16px; }
.panel-tools .panel-close { position: static; float: none; margin: 0; }
.panel.full { inset: 0; width: auto; max-height: none; border: 0; border-radius: 0; box-shadow: none; background: var(--bg-primary); }
.panel.full .panel-body { max-width: 720px; margin: 0 auto; padding: 72px 24px 64px; }
.panel.full .panel-title { font-size: 40px; line-height: 1.1; padding-right: 0; margin-bottom: 8px; }
.panel.full .panel-note { font-size: 18px; line-height: 1.7; }
/* « nudges left a few times: it grows the panel over the page */
/* Grow button: sits on the panel's left edge, halfway down (outside it, so the
   panel's scrolling doesn't clip it); top left of the page once full screen */
.panel-grow {
  position: fixed; top: 50%; right: 392px; margin-top: -20px; z-index: 16; width: 40px; height: 40px;
  background: var(--bg-secondary); border: 1px solid var(--border); color: var(--text-primary);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35); animation: slide-in var(--base) var(--ease); view-transition-name: panel-grow;
}
.panel-grow:hover { background: var(--bg-tertiary); }
.panel-grow svg { width: 20px; height: 20px; }
.panel.full ~ .panel-grow { top: 12px; left: 12px; right: auto; margin-top: 0; box-shadow: none; }
::view-transition-group(panel-grow) { animation-duration: var(--base); animation-timing-function: var(--ease); }
.panel-grow.nudge svg { animation: nudge 1.2s var(--ease) 0.4s 3; }
@keyframes nudge { 50% { transform: translateX(-3px); } }
@media (prefers-reduced-motion: reduce) { .panel-grow.nudge svg { animation: none; } }
.note-source { display: inline-flex; align-items: center; margin-top: 20px; gap: 6px; max-width: 100%; text-decoration: none; }
.note-source span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-source svg { width: 16px; height: 16px; flex-shrink: 0; }

/* Tag and board pickers: small chips, no colour dots; boards carry a folder outline */
.chips.compact { gap: 6px; margin-bottom: 10px; }
.chips.compact .chip { height: 28px; padding: 0 11px; gap: 5px; font-size: 13px; }
.chips.compact .chip svg { width: 14px; height: 14px; flex-shrink: 0; }
.chip.more-chip { background: none; border: 1px dashed var(--border); color: var(--text-secondary); }
.chip.more-chip:hover { background: var(--bg-tertiary); color: var(--text-primary); }

/* ── Board page: claude/collection-header-reference.html ──
   The boards strip along the top, a small muted wordmark, then the header:
   ember eyebrow, the name as the H1 (click it to search the board), description,
   actions on the right. The filter chips below count this board only. */
.board .main { padding: 28px 32px 120px; }
.board .dock { display: none; } /* the H1 is the search here */
.strip { display: flex; gap: 4px; margin: -28px -32px 28px; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px; overflow-x: auto; scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.strip button {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0; padding: 4px 8px; border-radius: var(--radius-card);
  color: var(--text-secondary); transition: color var(--fast) ease-out;
}
.strip svg { width: 14px; height: 14px; stroke-width: 1.5; }
.strip button:hover { color: var(--text-primary); }
.strip button.active { color: var(--text-primary); background: var(--bg-secondary); }
.strip button.active::after { content: ""; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); margin-left: 2px; }
.board .main-head { height: auto; margin: 0 0 34px; padding: 0; }
.board .brand-head { gap: 8px; color: var(--text-secondary); transform: none; }
.board .brand-head svg { width: 22px; height: 22px; }
.board .brand-head span { font-size: 20px; }
.board .mark-rib { fill: var(--text-secondary); }

.board-head { animation: fade var(--base) var(--ease) both; }
.board-head .eyebrow { display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 600; letter-spacing: 0.15em; text-transform: uppercase; color: var(--accent); }
.board-head .eyebrow button { display: flex; align-items: center; gap: 6px; font: inherit; letter-spacing: inherit; text-transform: inherit; transition: opacity var(--fast) ease-out; }
.board-head .eyebrow button:hover { opacity: 0.75; }
.board-head .eyebrow svg { width: 14px; height: 14px; stroke-width: 1.8; }
.board-head .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--accent); opacity: 0.6; }
.board-head .meta { color: var(--text-secondary); letter-spacing: 0.12em; }
.titlerow { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-top: 8px; }
.titlerow .title { flex: 1; min-width: 0; }
.board-head h1 {
  font-family: var(--font-display); font-weight: 700; font-size: 36px; letter-spacing: -0.035em; line-height: 1.05;
  outline: 0; caret-color: var(--accent); overflow-wrap: anywhere; cursor: text;
}
.board-head h1:empty::before { content: attr(data-ph); color: var(--text-muted); }
.titlerow .actions { display: flex; gap: 8px; flex: none; }
.btn {
  display: inline-flex; align-items: center; padding: 8px 14px; border-radius: var(--radius-pill); font-weight: 500; font-size: 14px;
  border: 1px solid var(--border); background: var(--bg-secondary); white-space: nowrap;
  transition: border-color var(--fast) ease-out, transform var(--fast) ease-out;
}
.btn:hover { border-color: var(--line-hover); }
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.icon { padding: 8px 10px; }
.btn svg { width: 16px; height: 16px; fill: currentColor; stroke: none; }

/* Scoped chips: outlined, wrapping, no inverted state */
.board .chips-row { flex-wrap: wrap; gap: 6px; margin: 22px 0 24px; padding: 0; overflow: visible; }
.board .chips-row .chip {
  height: auto; padding: 5px 11px; gap: 6px; font-size: 13px; font-weight: 400;
  background: var(--bg-secondary); border: 1px solid var(--border); color: var(--text-secondary);
  transition: border-color var(--fast) ease-out, color var(--fast) ease-out;
}
.board .chips-row .chip:hover, .board .chips-row .chip.selected { color: var(--text-primary); border-color: var(--line-hover); background: var(--bg-secondary); font-weight: 400; }
.board .chips-row .chip .n, .board .chips-row .chip.selected .n { color: var(--text-muted); font-weight: 400; }
.board .chips-row .scope { align-self: center; font-size: 12px; color: var(--text-muted); margin-left: 4px; }

/* Card 0's caption sits under the composer, outside the card: where the note will go */
.compose-cap { display: flex; align-items: center; gap: 6px; padding: 0 2px; margin-top: 8px; font-size: 12px; color: var(--text-muted); }
.compose-cap svg { width: 12px; height: 12px; stroke-width: 1.5; flex-shrink: 0; }
.compose-cap em { font-style: normal; color: var(--text-secondary); }

@media (max-width: 640px) {
  .board .main { padding: 18px 16px 140px; }
  .strip { margin: -18px -16px 24px; }
  .board .main-head { margin-bottom: 24px; }
  .titlerow { flex-wrap: wrap; row-gap: 14px; }
  .titlerow .title { flex-basis: 100%; } /* the actions go under the name */
  .board-head h1 { font-size: 30px; }
}
