/* Layout: one phone-width column. Fixed top bar, a scrolling view, fixed
   bottom tab bar, and a slide-up sheet for adding and editing. */
:root {
  --bg: #f6f1e9;
  --surface: #fffdf9;
  --surface-2: #efe8dc;
  --ink: #1d1a17;
  --ink-2: #6b625a;
  --line: #e4dacb;
  --accent: #e8552b;
  --accent-ink: #ffffff;
  --accent-btn: #cc4b26; /* the accent deepened so button text passes contrast */
  --accent-soft: #fbe3d8;
  --danger: #b3302a;

  /* One color per visibility, used wherever it appears */
  --public: #2a7352;
  --followers: #3a63d8;
  --private: #7c7268;

  --shadow: 0 1px 2px rgb(29 26 23 / .06), 0 8px 24px rgb(29 26 23 / .07);
  --radius: 16px;
  --font-display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --top-h: 60px;
  --tab-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141210;
    --surface: #1e1b18;
    --surface-2: #2a2622;
    --ink: #f1ebe3;
    --ink-2: #a89e93;
    --line: #34302b;
    --accent: #ff7247;
    --accent-ink: #1a0d07;
    --accent-btn: #ff7247;
    --accent-soft: #3b2117;
    --danger: #ff6b5e;
    --public: #5cc293;
    --followers: #7f9dff;
    --private: #a89e93;
    --shadow: 0 1px 2px rgb(0 0 0 / .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141210;
  --surface: #1e1b18;
  --surface-2: #2a2622;
  --ink: #f1ebe3;
  --ink-2: #a89e93;
  --line: #34302b;
  --accent: #ff7247;
  --accent-ink: #1a0d07;
  --accent-btn: #ff7247;
  --accent-soft: #3b2117;
  --danger: #ff6b5e;
  --public: #5cc293;
  --followers: #7f9dff;
  --private: #a89e93;
  --shadow: 0 1px 2px rgb(0 0 0 / .4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
/* Quick taps (like toggling a filter) shouldn't zoom in; pinch zoom still works on the web. */
html { touch-action: manipulation; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 var(--font-body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; }
svg { display: block; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

.app { position: fixed; inset: 0; max-width: 680px; margin: 0 auto; }

/* ---------- Top bar ---------- */
.topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 10;
  height: calc(var(--top-h) + var(--safe-top)); padding: var(--safe-top) 12px 0 16px;
  display: flex; align-items: center; gap: 6px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; }
.brand-mark { width: 28px; height: 28px; color: var(--ink); flex: none; animation: spin 9s linear infinite; }
.brand.compact .brand-mark { display: none; }
.brand h1 { font-size: 21px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .brand-mark, .boot-mark { animation: none !important; } }
.topbar-actions { display: flex; gap: 4px; }
.icon-btn {
  position: relative; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; color: var(--ink); flex: none;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.small { width: 32px; height: 32px; }
.icon-btn.small svg { width: 18px; height: 18px; }
.back-btn { margin-left: -8px; }

/* ---------- Boot ---------- */
.boot {
  position: fixed; inset: 0; z-index: 50; background: var(--bg);
  display: grid; place-content: center; justify-items: center; gap: 16px;
  transition: opacity .3s;
}
.boot.done { opacity: 0; pointer-events: none; }
.boot-mark { width: 72px; height: 72px; color: var(--ink); animation: spin 2.4s linear infinite; }
.boot-text { color: var(--ink-2); }

/* ---------- View ---------- */
.view {
  position: absolute; left: 0; right: 0;
  top: calc(var(--top-h) + var(--safe-top)); bottom: calc(var(--tab-h) + var(--safe-bottom));
  overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: 16px 16px 40px; outline: none;
}
.section-label {
  font-size: 13px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .06em;
  margin: 4px 2px 12px;
}
.loading { display: grid; place-items: center; padding: 60px 0; }
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite;
}
.empty { text-align: center; padding: 48px 20px; display: grid; gap: 10px; justify-items: center; }
.empty h3 { font-size: 22px; }
.empty p { color: var(--ink-2); max-width: 32ch; }
.muted { color: var(--ink-2); }
.hint { font-size: 13px; color: var(--ink-2); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.center { justify-content: center; }
.row.end { justify-content: flex-end; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 0 18px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink); font-weight: 600; text-decoration: none;
  transition: transform .1s, background .15s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--accent-btn, var(--accent)); color: var(--accent-ink); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger-ghost { color: var(--danger); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 34px; padding: 0 14px; font-size: 14px; }
.btn.wide { width: 100%; }
.btn.dashed { background: transparent; border: 1.5px dashed var(--line); color: var(--ink-2); }
.btn.dashed.wide { margin: 16px 0; }
.link { color: inherit; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; display: inline-flex; align-items: center; gap: 6px; }
.link.strong { font-weight: 700; text-decoration: none; }
.link.muted { color: var(--ink-2); }

.avatar {
  width: var(--size); height: var(--size); border-radius: 50%; flex: none;
  display: inline-grid; place-items: center;
  background: var(--c); color: #fff; font: 700 calc(var(--size) * .42) / 1 var(--font-display);
}

/* ---------- Covers ---------- */
.cover { position: relative; display: block; overflow: hidden; background: var(--surface-2); border-radius: 10px; aspect-ratio: 1; }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.tile {
  position: absolute; inset: 0; display: flex; align-items: flex-end; padding: 10px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c, #8a7f74) 82%, white), var(--c, #8a7f74));
  color: #fff; font: 700 15px/1.15 var(--font-display); letter-spacing: -0.01em;
}
.tile span { overflow-wrap: break-word; hyphens: auto; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.tile.plus { align-items: center; justify-content: center; background: var(--surface-2); color: var(--ink-2); }
.tile.plus svg { width: 30px; height: 30px; }
.cover.empty .tile { background: var(--surface-2); color: var(--ink-2); font-weight: 600; align-items: center; justify-content: center; }
/* Books, films and shows are posters; the rest are square. */
.kind-book .cover, .kind-movie .cover, .kind-tv .cover { aspect-ratio: 2 / 3; }

/* ---------- Home: two equal-height cards per row ---------- */
.home-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px; }
@media (min-width: 560px) { .home-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.home-card { position: relative; display: flex; flex-direction: column; min-width: 0; }
.home-cover { display: block; width: 100%; }
.home-cover .cover { aspect-ratio: 4 / 5 !important; border-radius: 14px; box-shadow: var(--shadow); }
.save-fab {
  position: absolute; top: 8px; right: 8px; z-index: 2; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; background: rgb(255 255 255 / .92); color: #1d1a17; box-shadow: 0 1px 4px rgb(0 0 0 / .2);
}
.save-fab svg { width: 17px; height: 17px; }
.home-text { display: grid; gap: 1px; padding: 8px 2px 0; width: 100%; }
.home-text .item-title { font-size: 15px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.4em; }
.home-text .item-creator { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-note { font-size: 13px; line-height: 1.35; margin-top: 3px; white-space: pre-line; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* Name and list sit at the bottom, so cards in a row line up whether or not they have a note. */
.home-who { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--ink-2); padding: 6px 2px 0; min-width: 0; margin-top: auto; }
.home-who button { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.home-who .home-board { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; font-weight: 600; color: var(--ink); }
.kind-label { font-size: 12px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .06em; }
.item-title { font: 700 18px/1.2 var(--font-display); }
.item-creator { color: var(--ink-2); font-size: 14px; }
.item-note { font-size: 14px; margin-top: 4px; white-space: pre-line; overflow-wrap: anywhere; }

/* ---------- Grids (Discover, boards) ---------- */
.grid { columns: 2; column-gap: 12px; }
@media (min-width: 560px) { .grid { columns: 3; } }
.grid .item-card { break-inside: avoid; }
/* Discover: three uneven columns of pictures. */
.discover-grid { columns: 3; column-gap: 8px; }
.discover-card { position: relative; display: block; width: 100%; break-inside: avoid; margin-bottom: 12px; }
.discover-open { display: block; width: 100%; text-align: left; }
.save-fab.small { top: 6px; right: 6px; width: 28px; height: 28px; }
.save-fab.small svg { width: 14px; height: 14px; }
.discover-card .cover { border-radius: 12px; box-shadow: var(--shadow); }
.discover-card .tile { font-size: 12px; padding: 7px; }
.saved-line { display: flex; align-items: flex-start; gap: 5px; padding: 5px 1px 0; font-size: 11.5px; line-height: 1.3; color: var(--ink-2); }
.saved-line .avatar { margin-top: 1px; }
.link-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; margin: 6px 0 4px; }
.link-row.one { grid-template-columns: 1fr; }
.link-row > :nth-child(3) { grid-column: 1 / -1; }
.masonry { display: flex; gap: 12px; align-items: flex-start; }
.masonry-col { flex: 1; min-width: 0; }
.item-card { display: block; width: 100%; margin-bottom: 16px; }
.item-card .cover { border-radius: 14px; box-shadow: var(--shadow); }
.item-text { display: grid; gap: 1px; padding: 8px 2px 0; }
.item-card .item-title { font-size: 15px; }
.item-card .item-creator { font-size: 13px; }
.item-card .item-note { font-size: 13px; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Profile ---------- */
.profile-head { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 8px 0 18px; }
.profile-head h2 { font-size: 26px; margin-top: 6px; }
.handle { color: var(--ink-2); }
.bio { max-width: 40ch; overflow-wrap: anywhere; }
.stats { display: flex; gap: 18px; margin: 6px 0 10px; color: var(--ink-2); font-size: 15px; }
.stats b { color: var(--ink); }
.chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px 10px; margin: 0 -16px 6px; scrollbar-width: none;
  scroll-snap-type: x proximity; scroll-padding-inline: 16px; overscroll-behavior-x: contain; cursor: grab;
  --fade-l: 0px; --fade-r: 0px;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent);
  mask-image: linear-gradient(to right, transparent, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent);
}
.chips.more-left { --fade-l: 36px; }
.chips.more-right { --fade-r: 48px; }
.chips .chip { scroll-snap-align: start; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 7px 14px; border-radius: 999px; font-size: 14px; font-weight: 600;
  background: var(--surface); border: 1.5px solid var(--line); white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.category { margin: 10px 0 22px; }
.category-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.category-head h3 { font-size: 21px; display: flex; gap: 8px; align-items: center; }
.boards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 12px; }
@media (min-width: 560px) { .boards { grid-template-columns: repeat(3, 1fr); } }
.board-card { display: grid; gap: 2px; min-width: 0; }
.mosaic { display: grid; gap: 2px; aspect-ratio: 1; border-radius: 16px; overflow: hidden; margin-bottom: 6px; box-shadow: var(--shadow); }
.mosaic .cover { border-radius: 0; aspect-ratio: auto !important; height: 100%; }
.mosaic .tile { font-size: 12px; padding: 7px; }
.mosaic.n1 .tile { font-size: 16px; padding: 10px; }
.mosaic.n2 { grid-template-columns: 1fr 1fr; }
.mosaic.n3 { grid-template-columns: 3fr 2fr; grid-template-rows: 1fr 1fr; }
.mosaic.n3 .cover:first-child { grid-row: span 2; }
.mosaic.n4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.board-card.add .mosaic { box-shadow: none; border: 1.5px dashed var(--line); }
.board-title { font: 700 16px/1.2 var(--font-display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-meta { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--ink-2); }
.vis-icon svg { width: 14px; height: 14px; }

/* ---------- Board ---------- */
.board-head { display: grid; gap: 8px; justify-items: start; padding: 4px 0 20px; }
.board-head h2 { font-size: 30px; line-height: 1.1; }
.board-by { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--ink-2); font-size: 14px; }
.board-by .link { color: var(--ink); font-weight: 600; text-decoration: none; }
.vis { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.vis svg { width: 15px; height: 15px; }
.vis-public { color: var(--public); }
.vis-followers { color: var(--followers); }
.vis-private { color: var(--private); }

/* ---------- People ---------- */
.searchbar { margin-bottom: 14px; }
.searchbar input {
  width: 100%; height: 46px; padding: 0 16px; border-radius: 999px;
  background: var(--surface); border: 1.5px solid var(--line); outline: none;
}
.searchbar input:focus { border-color: var(--accent); }
.people { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.person { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.person-main { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.person-main span:last-child { display: grid; min-width: 0; }
.person-main b, .person-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-main small { color: var(--ink-2); font-size: 14px; }
.person-actions { display: flex; gap: 6px; }

.feed-end { text-align: center; padding: 18px 0 8px; font-size: 14px; }

.add-typed b { color: var(--accent); }
.add-typed .tile.plus { background: var(--accent-soft, var(--surface-2)); color: var(--accent); display: grid; place-items: center; }
.add-typed .tile.plus svg { width: 22px; height: 22px; }

/* ---------- Saved for later ---------- */
.later-btn svg { width: 17px; height: 17px; }
.later-btn.on { color: var(--accent); }
.mini-mosaic { width: 52px; flex: none; border-radius: 10px; overflow: hidden; }
.saved-list .person-main { gap: 12px; }

/* ---------- More like this ---------- */
.similar { width: 100%; text-align: left; margin: 10px 0 4px; }
.similar h4 { margin: 0 0 8px; font: 700 16px var(--font-display); }
.similar-row { display: flex; gap: 10px; overflow-x: auto; margin: 0 -20px; padding: 2px 20px 6px; scrollbar-width: none; scroll-snap-type: x proximity; scroll-padding-inline: 20px; }
.similar-row::-webkit-scrollbar { display: none; }
.similar-card { flex: none; width: 104px; display: grid; gap: 2px; text-align: left; scroll-snap-align: start; }
.similar-card .cover { border-radius: 10px; box-shadow: var(--shadow); }
.similar-card .tile { font-size: 10px; padding: 5px; }
.similar-card .board-title { font-size: 13px; margin-top: 4px; }
.similar-card .board-meta { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }

/* ---------- Top 10 ---------- */
.top10 { margin-bottom: 8px; }
.top10-row { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x proximity; scroll-padding-inline: 16px;
  margin: 0 -16px; padding: 2px 16px 8px; scrollbar-width: none; }
.top10-row::-webkit-scrollbar { display: none; }
.top10-card { position: relative; flex: none; width: 116px; display: grid; gap: 2px; text-align: left; scroll-snap-align: start; }
.top10-card .cover { border-radius: 12px; box-shadow: var(--shadow); }
.top10-card .tile { font-size: 11px; padding: 6px; }
.top10-card .board-title { font-size: 14px; margin-top: 6px; }
.rank { font: 800 15px/1 var(--font-display); }
.top10-card .rank { position: absolute; z-index: 5; top: 6px; left: 6px; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 13px;
  display: grid; place-items: center; background: var(--accent-btn, var(--accent)); color: var(--accent-ink, #fff); box-shadow: 0 1px 4px rgb(0 0 0 / .2); }
.star-btn { width: 100%; margin: 4px 0; }
.star-btn svg { width: 18px; height: 18px; }
.star-btn.on { color: var(--accent); }
.bump-list .person-main { gap: 10px; }
.bump-list .cover { width: 44px; flex: none; border-radius: 8px; }
.bump-list .tile { font-size: 7px; padding: 3px; }
.bump-list .rank { width: 22px; text-align: center; flex: none; }
.year-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 14px; }
.year-grid figure { margin: 0; display: grid; gap: 8px; justify-items: center; }
.year-grid.one { grid-template-columns: minmax(0, 260px); justify-content: center; }
.year-grid img { width: 100%; border-radius: 12px; box-shadow: var(--shadow); -webkit-touch-callout: default; user-select: auto; }

/* ---------- Collaboration invitations ---------- */
.invite-banner { display: grid; gap: 10px; padding: 14px 16px; border-radius: 14px; background: var(--accent-soft, var(--surface-2)); margin: 4px 0 6px; }
.invite-banner p { margin: 0; font-size: 15px; }
.invite-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.updates.invites { margin-bottom: 10px; }
.people.requests { margin-bottom: 16px; }
.updates .invite { padding: 4px 0 12px; border-bottom: 1px solid var(--line); }
.updates .invite .update { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.updates .invite .invite-actions { padding: 8px 8px 0 56px; }
.small-note { font-size: 13px; margin-right: 6px; }
.invite-card { display: grid; gap: 10px; padding: 12px 14px; margin-bottom: 14px; border-radius: 14px; background: var(--accent-soft, var(--surface-2)); }
.invite-card-main { display: flex; align-items: center; gap: 10px; text-align: left; font-size: 15px; line-height: 1.35; }
.invite-card .invite-actions { padding-left: 46px; }
.board-note svg { width: 13px; height: 13px; }

/* ---------- Following lists and categories ---------- */
.follow-ctl { display: inline-flex; align-items: center; gap: 2px; }
.follow-ctl .btn svg { width: 16px; height: 16px; }
.follow-ctl .bell { color: var(--accent); }
.follow-ctl .bell[aria-pressed="false"] { color: var(--ink-2); }
.updates { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 2px; }
.update { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 8px; border-radius: 12px; text-align: left; }
.update:hover { background: var(--surface-2); }
.update.unseen { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.update-text { flex: 1; min-width: 0; font-size: 14px; line-height: 1.35; }
.update-text small { display: block; color: var(--ink-2); font-size: 12px; margin-top: 2px; }
.update-covers { display: flex; flex: none; }
.update-covers .cover { width: 34px; border-radius: 6px; box-shadow: 0 0 0 2px var(--surface); }
.update-covers .cover + .cover { margin-left: -14px; }
.update-covers .tile { font-size: 6px; padding: 3px; }
.sheet-text.muted.small { font-size: 13px; padding: 6px 0 0; }

/* ---------- Tab bar ---------- */
.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 10;
  height: calc(var(--tab-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tab { position: relative; display: grid; place-items: center; align-content: center; gap: 2px; color: var(--ink-2); font-size: 11px; font-weight: 600; }
.tab svg { width: 24px; height: 24px; }
.tab.active { color: var(--ink); }
.tab-add-disc { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-btn, var(--accent)); color: var(--accent-ink); box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 40%, transparent); }
.dot { position: absolute; top: 10px; right: calc(50% - 16px); width: 9px; height: 9px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); }
.icon-btn .dot { top: 6px; right: 6px; }

/* ---------- Sheet ---------- */
.scrim { position: fixed; inset: 0; z-index: 20; background: rgb(0 0 0 / .4); opacity: 0; transition: opacity .2s; }
.scrim.open { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-width: 680px; margin: 0 auto;
  max-height: calc(100% - var(--safe-top) - 40px);
  background: var(--surface); border-radius: 22px 22px 0 0;
  display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform .22s cubic-bezier(.3, .8, .4, 1);
  padding-bottom: var(--safe-bottom);
}
.sheet.tall { height: calc(100% - var(--safe-top) - 40px); }
.sheet.open { transform: none; }
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 8px auto 0; flex: none; }
.sheet-body { overflow-y: auto; padding: 4px 18px 24px; overscroll-behavior: contain; }
.sheet-head { display: flex; align-items: center; gap: 4px; position: sticky; top: -4px; background: var(--surface); padding: 6px 0 10px; margin: 0 -6px; z-index: 2; }
.sheet-head h2 { flex: 1; font-size: 19px; padding: 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-text { color: var(--ink); margin: 4px 0 16px; }
.sheet-text.muted { color: var(--ink-2); text-align: center; padding: 24px 0; }
.menu { display: grid; }
.menu-item { padding: 15px 4px; border-bottom: 1px solid var(--line); font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.menu-item:last-child { border-bottom: 0; }
.menu-item.danger { color: var(--danger); }
.badge { font-style: normal; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--accent); color: var(--accent-ink); font-size: 13px; display: grid; place-items: center; }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; margin: 0 0 14px; border: 0; padding: 0; min-width: 0; }
.field > span, .field legend { font-size: 14px; font-weight: 600; padding: 0; }
.field small { color: var(--ink-2); font-weight: 400; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 13px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--bg); outline: none; resize: vertical;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.field-row { display: grid; grid-template-columns: 84px 1fr; gap: 10px; }
.emoji-field input { text-align: center; font-size: 20px; padding: 8px; }
.emoji-picker {
  max-height: 220px; overflow-y: auto; overscroll-behavior: contain; margin: -4px 0 16px;
  padding: 2px 8px 8px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--bg);
}
.emoji-group {
  position: sticky; top: -2px; z-index: 1; background: var(--bg);
  font-size: 12px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .06em; padding: 8px 2px 4px;
}
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 2px; }
.emoji-grid button { height: 40px; border-radius: 10px; font-size: 22px; display: grid; place-items: center; }
.emoji-grid button:hover { background: var(--surface-2); }
.emoji-grid button[aria-pressed="true"] { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
.form-error { color: var(--danger); font-size: 14px; margin: -4px 0 12px; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.segmented label, .kind-grid label { position: relative; }
.segmented input, .kind-grid input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span, .kind-grid span {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 12px;
  border: 1.5px solid var(--line); font-size: 14px; font-weight: 600; text-align: center; cursor: pointer;
}
.segmented svg { width: 20px; height: 20px; }
.segmented input:checked + span, .kind-grid input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.segmented input:focus-visible + span, .kind-grid input:focus-visible + span { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.kind-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.kind-grid i { font-style: normal; font-size: 22px; }

/* ---------- Add flow ---------- */
.kinds { margin-top: 0; }
.results, .board-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.results button, .board-list button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 4px; border-radius: 12px; }
.results button:hover, .board-list button:hover { background: var(--surface-2); }
.results .cover, .board-list .cover { width: 52px; flex: none; border-radius: 8px; aspect-ratio: 1; }
.results .tile, .board-list .tile, .pick-preview .tile { font-size: 9px; padding: 4px; }
.results span:not(.cover):not(.tile), .board-list span:not(.cover):not(.tile):not(.mini) { display: grid; min-width: 0; flex: 1; }
.results b, .board-list b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.results small, .board-list small { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.add-dot { font-style: normal; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.add-dot svg { width: 18px; height: 18px; }
.mini { width: 52px; flex: none; }
.pick-preview { display: flex; gap: 14px; align-items: center; padding: 6px 0 16px; }
.pick-preview .cover { width: 56px; flex: none; }
.pick-preview.big .cover { width: 96px; }
.pick-preview.big .tile { font-size: 12px; padding: 8px; }
.pick-preview > span:last-child { display: grid; gap: 2px; min-width: 0; }
.pick-preview b { font: 700 19px/1.2 var(--font-display); }
.pick-preview small { color: var(--ink-2); }

/* ---------- Item detail ---------- */
.item-detail { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; gap: 8px; padding-bottom: 8px; }
.cover.big { width: min(58%, 240px); border-radius: 14px; box-shadow: var(--shadow); margin-bottom: 8px; }
.cover.big .tile { font-size: 20px; padding: 14px; }
.item-detail h3 { font-size: 24px; line-height: 1.15; }
.note { margin: 6px 0; padding: 12px 16px; background: var(--bg); border-radius: 12px; text-align: left; white-space: pre-line; overflow-wrap: anywhere; width: 100%; }
.saved-by { color: var(--ink-2); font-size: 14px; }
.item-detail .btn.wide { margin: 6px 0 4px; }

/* ---------- Auth ---------- */
.auth { max-width: 380px; margin: 0 auto; padding: 24px 4px; display: grid; gap: 14px; text-align: center; }
.auth h2 { font-size: 30px; }
.auth form { text-align: left; margin-top: 10px; }
.auth .btn.wide { margin-top: 6px; }
.fine { font-size: 12px; color: var(--ink-2); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--safe-bottom) + 16px); z-index: 40;
  transform: translate(-50%, 10px); opacity: 0; transition: opacity .2s, transform .2s;
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 15px;
  max-width: calc(100% - 32px); box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Reorder ---------- */
.reorder-hint { margin: -8px 0 12px; }
.reorder-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.reorder-list li {
  display: flex; align-items: center; gap: 12px; padding: 8px 6px 8px 8px;
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow);
  transition: box-shadow .15s, transform .15s;
}
.reorder-list li.dragging { transform: scale(1.02); box-shadow: 0 10px 30px rgb(0 0 0 / .18); position: relative; z-index: 2; }
.reorder-list .cover { width: 48px; flex: none; border-radius: 8px; }
.reorder-list .tile { font-size: 8px; padding: 4px; }
.reorder-text { display: grid; flex: 1; min-width: 0; }
.reorder-text b, .reorder-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reorder-text small { color: var(--ink-2); font-size: 13px; }
.drag-handle { width: 44px; height: 44px; display: grid; place-items: center; color: var(--ink-2); cursor: grab; touch-action: none; border-radius: 10px; flex: none; }
.drag-handle svg { width: 22px; height: 22px; }
.dragging .drag-handle { cursor: grabbing; color: var(--accent); }

/* ---------- Collaborators ---------- */
.collab-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }
.collab-faces { display: inline-flex; }
.collab-faces .avatar { margin-right: -6px; box-shadow: 0 0 0 2px var(--bg); }
.collab-faces + span { margin-left: 6px; }
.collab-row .link svg { width: 18px; height: 18px; }
.sheet-text.muted-left { color: var(--ink-2); font-size: 14px; }
.field-row.wide-first { grid-template-columns: 1fr 96px; }

/* ---------- Pull to refresh ---------- */
.ptr {
  position: absolute; left: 50%; top: calc(var(--top-h) + var(--safe-top) + 8px); z-index: 9;
  display: flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px;
  background: var(--surface); box-shadow: var(--shadow); color: var(--ink-2); font-size: 13px; font-weight: 700;
  opacity: 0; pointer-events: none; transform: translate(-50%, calc(var(--pull, 0px) - 44px));
}
.ptr.is-pulling, .ptr.is-refreshing { opacity: 1; }
.ptr.is-settling { transition: transform .2s ease, opacity .2s ease; }
.ptr-spinner {
  width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--ink); border-radius: 50%;
  transform: rotate(calc(var(--pull, 0px) * 4deg / 1px));
}
.ptr.is-refreshing .ptr-spinner { animation: spin .7s linear infinite; }

/* ---------- Profile photo and link ---------- */
.avatar { position: relative; overflow: hidden; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-field { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.photo-field label.btn { cursor: pointer; }
.profile-link { color: color-mix(in srgb, var(--accent) 70%, var(--ink)); font-weight: 600; text-decoration: none; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Checklists ---------- */
.switch-field { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; cursor: pointer; position: relative; }
.switch-field > span { display: grid; flex: 1; gap: 2px; }
.switch-field small { color: var(--ink-2); font-size: 13px; }
.switch-field input { position: absolute; opacity: 0; pointer-events: none; }
.switch-field i { width: 46px; height: 28px; border-radius: 14px; background: var(--line); position: relative; flex: none; transition: background .15s; }
.switch-field i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .25); transition: transform .15s; }
.switch-field input:checked + i { background: var(--accent); }
.switch-field input:checked + i::after { transform: translateX(18px); }
.switch-field input:focus-visible + i { outline: 2.5px solid var(--accent); outline-offset: 2px; }

.check-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.check-list li { display: flex; align-items: center; gap: 6px; padding: 8px 10px 8px 4px; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); }
.check { width: 44px; height: 44px; flex: none; display: grid; place-items: center; }
.check svg { width: 26px; height: 26px; padding: 3px; border-radius: 50%; border: 2px solid var(--line); color: transparent; transition: background .15s, border-color .15s; }
.check[aria-checked="true"] svg { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.check:disabled { cursor: default; }
.check-main { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.check-main .cover { width: 52px; flex: none; border-radius: 8px; }
.check-main .tile { font-size: 8px; padding: 4px; }
.check-text { display: grid; min-width: 0; }
.check-text b, .check-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check-text small { color: var(--ink-2); font-size: 13px; }
.check-note { font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.check-list li.done .check-text { text-decoration: line-through; text-decoration-thickness: 1.5px; color: var(--ink-2); }
.check-list li.done .check-text small, .check-list li.done .check-note { color: inherit; }
.check-list li.done .cover { opacity: .5; }

/* ---------- Guests (public list opened from a link) ---------- */
.guest-bar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 10;
  padding: 14px 16px calc(14px + var(--safe-bottom)); display: grid; gap: 10px;
  background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -6px 24px rgb(0 0 0 / .08);
}
.guest-bar p { display: grid; gap: 2px; }
.guest-bar p span { color: var(--ink-2); font-size: 14px; }
.guest-bar .row .btn { flex: 1; }
body.guest .view { bottom: calc(132px + var(--safe-bottom)); }
.auth-note { background: var(--accent-soft); color: var(--ink); padding: 10px 14px; border-radius: 12px; font-weight: 600; }

/* ---------- Uploaded pictures ---------- */
.pic-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.pic-preview:not(:empty) { width: 56px; }
.pic-preview .cover { width: 56px; border-radius: 8px; }
.pic-preview .tile { font-size: 8px; padding: 4px; }
.pic-row label.btn { cursor: pointer; }
.own-photo { margin-top: 6px; font-size: 14px; font-weight: 600; color: var(--accent); cursor: pointer; text-decoration: none; }
.own-photo svg, .pic-row svg { width: 17px; height: 17px; }
.own-photo-row { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.hours { width: 100%; text-align: left; margin: 4px 0 8px; padding: 12px 16px; background: var(--bg); border-radius: 12px; }
.hours h4 { margin: 0 0 6px; font: 700 15px var(--font-display); }
.hours dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 16px; margin: 0 0 6px; font-size: 14px; }
.hours dt { font-weight: 600; }
.hours dd { margin: 0; }
.hours small { color: var(--ink-2); font-size: 12px; }
.cover img[data-photo] { transition: opacity .2s; }
.fine a { color: inherit; text-decoration: underline; }

/* ---------- Password field ---------- */
.password-row { position: relative; }
.password-row input { width: 100%; padding-right: 64px; }
.password-row .link { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 14px; font-weight: 600; color: var(--ink-2); text-decoration: none; }
.field > label { font-size: 14px; font-weight: 600; }
.suggest { justify-self: start; margin-top: 2px; font-size: 14px; font-weight: 600; color: var(--accent); text-decoration: none; }

/* ---------- Profile color ---------- */
.color-preview { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px; margin-bottom: 14px; border-radius: 14px; background: var(--bg); }
.color-preview .chip { background: var(--accent-soft); border-color: var(--accent); }
.swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 16px; }
.swatch { aspect-ratio: 1; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgb(0 0 0 / .12); }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--c); }
.custom-color { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.custom-pick { position: relative; overflow: hidden; cursor: pointer; white-space: nowrap; flex: none; }
.custom-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.hex-field { display: flex; align-items: center; gap: 8px; flex: 1; font-weight: 600; font-size: 14px; }
.hex-field input { flex: 1; min-width: 0; padding: 9px 12px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--bg); font-family: ui-monospace, Menlo, monospace; text-transform: uppercase; }
.color-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; margin-bottom: 14px; border-radius: 12px; background: var(--bg); font-weight: 600; }
.color-row small { margin-left: auto; color: var(--ink-2); font-weight: 600; }
.swatch-dot { width: 22px; height: 22px; border-radius: 50%; background: var(--c); }
/* On someone's profile or list, the selected chip uses their color. */
.view[style*="--accent"] .chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ---------- Save picker: pick a list (the newest fitting one is picked), then Save ---------- */
.save-picker .note-field textarea { resize: none; field-sizing: content; max-height: 7em; }
.pick-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 4px; border-radius: 12px; cursor: pointer; }
.pick-row input { position: absolute; opacity: 0; pointer-events: none; }
.pick-row:hover { background: var(--surface-2); }
.pick-row:has(input:checked) { background: var(--surface-2); box-shadow: inset 0 0 0 2px var(--accent); }
.pick-row:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.pick-check { flex: none; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; color: transparent; }
.pick-check svg { width: 15px; height: 15px; }
.pick-row:has(input:checked) .pick-check { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.board-list .new-in { color: var(--ink-2); }
.board-list .new-in .cover { width: 52px; aspect-ratio: 1; }
.board-list .new-in b { font-weight: 600; }
.save-foot {
  position: sticky; bottom: -24px; z-index: 2; display: flex; gap: 10px; justify-content: space-between;
  margin: 12px -18px -24px; padding: 12px 18px calc(16px + 0px); background: var(--surface); border-top: 1px solid var(--line);
}
.save-foot .btn.primary { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
