/* pocketvalt: bold, friendly, rounded. Light by default, dark via
   prefers-color-scheme. System fonts only; nothing is loaded from elsewhere. */
:root {
  --ink: #1A1033; --ground: #F6F3FF;
  --lime: #9BE564; --violet: #7A3CF0; --pink: #FF4D8D; --blue: #1F55E0; --teal: #17C3B2;

  --bg: var(--ground); --surface: #FFFFFF; --text: var(--ink); --muted: #5E5577; --border: #E3DCF7;
  --link: var(--violet); --focus: var(--violet); --danger: #D11A63; --ok: #0E8577;
  /* Lines and fills that must stand out: ink by day, lilac white by night. */
  --strong: var(--ink);
  --primary: var(--lime); --on-primary: var(--ink);
  --radius: 22px; --radius-sm: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #120B26; --surface: #1F1640; --text: var(--ground); --muted: #B3A9D3; --border: #342A5C;
    --link: #B08CFF; --focus: #B08CFF; --danger: #FF6FA3; --ok: #3FE0CE;
    --strong: #E9E3FF;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 var(--font); }
/* The footer sits at the bottom of the screen on short pages. */
body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
body > * { width: 100%; }
body > main { flex: 1 0 auto; }
a { color: var(--link); font-weight: 600; text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
code, pre { font-family: var(--mono); font-size: 14px; }
pre { background: var(--bg); border: 2px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
h1, h2 { font-weight: 900; letter-spacing: -0.02em; line-height: 1.15; margin: 0; }
h1 { font-size: 34px; }
h2 { font-size: 20px; margin-bottom: 4px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.lead { font-size: 22px; font-weight: 800; margin: 0; }

header.top { display: flex; align-items: center; gap: 16px; padding: 14px 20px; max-width: 960px; margin: 0 auto; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 900; letter-spacing: -0.03em; color: var(--text); }
.brand b { color: var(--violet); font-weight: inherit; }
@media (prefers-color-scheme: dark) { .brand b { color: var(--link); } }
.brand:hover { text-decoration: none; }
.brand-mark { width: 26px; height: 26px; border-radius: 9px; background: var(--lime); box-shadow: 6px 6px 0 -1px var(--pink); }
/* The account menu: one round button (initials) instead of a row of links,
   which didn't fit next to the brand on a phone. */
.menu { position: relative; margin-left: auto; }
.avatar { list-style: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--ink); color: var(--lime); font-size: 15px; font-weight: 900; cursor: pointer; user-select: none; }
.avatar::-webkit-details-marker { display: none; }
@media (prefers-color-scheme: dark) { .avatar { box-shadow: inset 0 0 0 2px #5B4E86; } }
.avatar:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.menu-panel { position: absolute; z-index: 10; right: 0; top: calc(100% + 8px); min-width: 220px; display: flex; flex-direction: column; padding: 8px; background: var(--surface); border: 2px solid var(--strong); border-radius: 20px; box-shadow: 6px 6px 0 -1px var(--violet); }
.menu-panel a, .menu-logout { display: flex; align-items: center; min-height: 48px; padding: 0 14px; border-radius: 14px; font-size: 17px; font-weight: 800; color: var(--text); text-decoration: none; }
.menu-panel a:hover, .menu-logout:hover { background: var(--bg); text-decoration: none; }
.menu-panel form { margin: 0; }
.menu-logout { width: 100%; border: 0; background: transparent; text-align: left; }
.menu-who { margin: 4px 14px 6px; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
main { max-width: 960px; margin: 0 auto; padding: 8px 20px 24px; }
.site-footer { max-width: 960px; margin: 0 auto; padding: 24px 20px; color: var(--muted); font-size: 13px; }

.card { background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); padding: 24px; }
.card > :last-child { margin-bottom: 0; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row:has(> .field) { align-items: flex-start; }
.row > .field { flex: 1 1 220px; }

button, .button { font: inherit; font-weight: 800; padding: 10px 18px; border-radius: var(--radius-sm); border: 2px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
button:hover { border-color: var(--violet); }
button.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
button.primary:hover { filter: brightness(1.05); border-color: var(--ink); }
button.ghost { background: transparent; }
button.danger { color: var(--danger); border-color: currentColor; background: transparent; padding: 6px 14px; }
input, textarea { font: inherit; padding: 10px 14px; border-radius: var(--radius-sm); border: 2px solid var(--border); background: var(--bg); color: var(--text); width: 100%; max-width: 100%; }
textarea { display: block; resize: vertical; min-height: 88px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; color: var(--text); text-decoration: none; }
.button:hover { text-decoration: none; border-color: var(--violet); }
.button.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
[hidden] { display: none !important; }
.row > input { width: auto; flex: 1 1 220px; }
input[type="checkbox"] { width: auto; }
label { display: block; font-weight: 800; margin-bottom: 6px; }
.field + .field { margin-top: 14px; }
.row > .field + .field { margin-top: 0; }
.hint { color: var(--muted); font-size: 14px; margin: 6px 0 0; }
.error { color: var(--danger); font-weight: 700; }
.ok { color: var(--ok); font-weight: 700; }
.narrow { max-width: 420px; margin: 40px auto; }
.narrow button.primary { width: 100%; }
.notice { background: var(--bg); border-left: 6px solid var(--teal); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 14px; margin-bottom: 0; }

.hero { position: relative; overflow: hidden; padding: 40px 32px; margin-top: 24px; }
.hero h1 { font-size: 56px; }
.hero p { max-width: 36em; }
.blobs { display: flex; gap: 10px; }
.blobs i { width: 34px; height: 34px; border-radius: 12px; display: block; }
.blobs .violet { background: var(--violet); }
.blobs .pink { background: var(--pink); border-radius: 50%; }
.blobs .blue { background: var(--blue); }
.blobs .teal { background: var(--teal); border-radius: 50%; }

table.list { width: 100%; border-collapse: collapse; }
table.list td, table.list th { padding: 10px 6px; border-bottom: 2px solid var(--border); text-align: left; }
table.list th { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
td.num { text-align: right; }
.mono { font-family: var(--mono); font-size: 14px; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 800; background: var(--bg); color: var(--muted); border: 2px solid var(--border); }
.badge.pending, .badge.active { background: var(--lime); border-color: var(--lime); color: var(--ink); }
.badge.used { background: var(--blue); border-color: var(--blue); color: #FFFFFF; }
.badge.revoked, .badge.disabled { color: var(--danger); border-color: currentColor; background: transparent; }
.new-link { background: var(--bg); border: 2px dashed var(--violet); border-radius: var(--radius-sm); padding: 14px; }
.new-link p { margin: 0; }
.empty { color: var(--muted); }
.htmx-request { opacity: .6; transition: opacity .2s; }

/* --- The vault (design D: search and kinds first, then the grid) ------- */
.vault { display: flex; flex-direction: column; gap: 14px; }
.finder { display: flex; flex-direction: column; gap: 14px; margin: 4px 0 0; }
.search { display: flex; align-items: center; gap: 10px; height: 58px; padding: 0 16px; background: var(--surface); border: 2px solid var(--strong); border-radius: 20px; }
.search:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.search svg { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; padding: 0; background: transparent; font-size: 18px; font-weight: 600; outline: 0; }
.search input:focus-visible { outline: 0; }
.search input::placeholder { color: var(--muted); font-weight: 500; }
.search input::-webkit-search-cancel-button { width: 20px; height: 20px; cursor: pointer; }
#results { display: flex; flex-direction: column; gap: 14px; }
.filters { display: flex; flex-direction: column; gap: 12px; }
.kinds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.kind-button { position: relative; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 60px; padding: 6px 10px; border-radius: 18px; font-size: 17px; font-weight: 900; letter-spacing: -0.01em; line-height: 1.1; text-align: center; text-decoration: none; }
.kind-button:hover { text-decoration: none; filter: brightness(1.06); }
.kind-button .kind-name { min-width: 0; overflow-wrap: break-word; hyphens: none; }
/* On a phone the count sits in the corner, so the name has the button's
   whole width and never breaks inside a word. */
@media (max-width: 599px) {
  .kind-button { padding: 6px 8px; font-size: 16px; }
  .kinds .kind-button .kind-count { position: absolute; top: 6px; right: 6px; min-width: 20px; height: 18px; padding: 0 5px; border-radius: 9px; font-size: 11px; }
}
.kind-count { display: inline-grid; place-items: center; min-width: 24px; height: 22px; padding: 0 6px; border-radius: 11px; background: rgba(255, 255, 255, .9); color: var(--ink); font-size: 12px; font-weight: 900; }
.kind-button.k-0 .kind-count, .kind-button.k-3 .kind-count, .kind-button.k-4 .kind-count, .kind-button.k-6 .kind-count,
.kind-button.k-7 .kind-count, .kind-button.k-8 .kind-count, .kind-button.k-9 .kind-count, .kind-button.k-10 .kind-count,
.kind-button.k-11 .kind-count, .kind-button.k-12 .kind-count { background: var(--ink); color: #FFFFFF; }
.kind-button.active { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--strong); }
.kind-button.active .kind-name::before { content: "✓ "; }
.kind-button.all { background: transparent; color: var(--text); border: 2px solid var(--strong); }
.kind-button.all[aria-expanded="true"] { background: var(--strong); color: var(--bg); }
.kind-button.small { min-height: 46px; padding: 6px 14px; font-size: 15px; border-radius: 16px; }
.more-kinds { background: var(--surface); border: 2px solid var(--border); border-radius: 20px; padding: 14px; }
.kinds-more { display: flex; flex-wrap: wrap; gap: 8px; }
.more-label { margin: 14px 0 8px; font-size: 13px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.kinds-more + .more-label { margin-top: 16px; }
.more-label:first-child { margin-top: 0; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 18px; background: var(--surface); border: 2px solid var(--border); color: var(--text); font-size: 15px; font-weight: 800; text-decoration: none; }
a.tag:hover { border-color: var(--violet); text-decoration: none; }
.tag.active { background: var(--strong); border-color: var(--strong); color: var(--bg); }
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip-filter { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 18px; border-radius: 22px; background: var(--surface); border: 2px solid var(--border); color: var(--text); font-size: 15px; font-weight: 800; white-space: nowrap; text-decoration: none; }
.chip-filter:hover { border-color: var(--violet); text-decoration: none; }
.chip-filter.active { background: var(--strong); border-color: var(--strong); color: var(--bg); }
.chip-filter.help { border-color: var(--pink); }
.chip-filter.help.active { background: var(--pink); border-color: var(--pink); color: var(--ink); }
.chip-filter .x { font-size: 20px; line-height: 1; }
.results-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; margin-top: 6px; }
.results-head h1 { font-size: 24px; }
.active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.active-chip { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 18px; font-size: 14px; font-weight: 900; text-decoration: none; }
.active-chip:hover { text-decoration: none; filter: brightness(1.06); }
.active-chip.tag-chip { background: var(--strong); color: var(--bg); }
.clear-all { display: inline-flex; align-items: center; height: 36px; padding: 0 4px; font-size: 15px; }
.group + .group { margin-top: 18px; }
h2.section { margin: 0 0 10px; font-size: 18px; font-weight: 900; }
.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
/* A tile is 4:5 unless its text needs more; the row then grows with it, so
   a title is never cut through the middle of a line. */
.grid > li { display: flex; min-width: 0; }
.grid > li::before { content: ""; flex: none; width: 0; padding-top: 125%; }
.grid > li > .tile { flex: 1; min-width: 0; }
.tile > * { flex: none; }
.tile { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 20px; overflow: hidden; color: var(--ink); text-decoration: none; }
.tile:hover { text-decoration: none; filter: brightness(1.04); }
.tile:focus-visible { outline-offset: 3px; }
.c-violet { background: var(--violet); color: #FFFFFF; }
.c-pink { background: var(--pink); color: var(--ink); }
.c-blue { background: var(--blue); color: #FFFFFF; }
.c-teal { background: var(--teal); color: var(--ink); }
.c-lime { background: var(--lime); color: var(--ink); }
.tile-kind { font-weight: 900; text-transform: lowercase; }
.kicker { font-size: 12px; font-weight: 800; letter-spacing: .02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-title { flex: none; font-size: 19px; line-height: 1.2; font-weight: 800; letter-spacing: -0.01em; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 6; line-clamp: 6; overflow: hidden; }
.tile.text .tile-title { font-size: 16px; line-height: 1.35; font-weight: 600; -webkit-line-clamp: 8; line-clamp: 8; }
.tile-foot { margin-top: auto; padding-top: 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 12px; font-weight: 700; }
.tile-foot svg.pin { vertical-align: -2px; margin-right: 3px; }
.tile.photo { padding: 10px; justify-content: flex-end; background: var(--border); }
.tile.photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile-chips { position: relative; display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 3px; max-width: 100%; height: 26px; padding: 0 10px; border-radius: 13px; background: rgba(255, 255, 255, .94); color: var(--ink); font-size: 12px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.more { position: absolute; top: 10px; right: 10px; background: var(--ink); color: #FFFFFF; }
.chip.busy { background: var(--ink); color: #FFFFFF; }
.tile.with-image .tile-img { flex: none; width: calc(100% + 28px); height: auto; aspect-ratio: 16 / 9; margin: -14px -14px 4px; object-fit: cover; background: rgba(255, 255, 255, .25); }
.tile.with-image .tile-title { -webkit-line-clamp: 3; line-clamp: 3; font-size: 17px; }
.tile.with-image.text .tile-title { -webkit-line-clamp: 4; line-clamp: 4; font-size: 15px; }
.tile-alert { display: inline-block; white-space: nowrap; padding: 1px 8px; border-radius: 10px; background: #FFFFFF; color: #B0124F; font-weight: 800; }
.chip.alert { background: #B0124F; color: #FFFFFF; }
/* Kind colours, in the order of pv_core::kinds::PALETTE (no yellow or orange). */
.k-0 { background: #FF4D8D; color: var(--ink); }
.k-1 { background: #1F55E0; color: #FFFFFF; }
.k-2 { background: #7A3CF0; color: #FFFFFF; }
.k-3 { background: #17C3B2; color: var(--ink); }
.k-4 { background: #9BE564; color: var(--ink); }
.k-5 { background: #1A1033; color: #FFFFFF; }
.k-6 { background: #FF9EC0; color: var(--ink); }
.k-7 { background: #8FA9F0; color: var(--ink); }
.k-8 { background: #BC9DF7; color: var(--ink); }
.k-9 { background: #8BE1D8; color: var(--ink); }
.k-10 { background: #CDF2B1; color: var(--ink); }
.k-11 { background: #38BDF8; color: var(--ink); }
.k-12 { background: #E040FB; color: var(--ink); }
/* The ink colours sit close to the dark ground: give them an edge there. */
@media (prefers-color-scheme: dark) {
  .tile.k-5, .link-card.k-5, .kind-button.k-5, .trash-thumb.k-5 { box-shadow: inset 0 0 0 2px #5B4E86; }
  .kind-button.k-5.active { box-shadow: inset 0 0 0 2px #5B4E86, 0 0 0 3px var(--bg), 0 0 0 6px var(--strong); }
}
svg.pin { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.more-row { display: flex; justify-content: center; margin: 18px 0 4px; }
.more-button { min-height: 52px; padding: 0 28px; border-radius: 26px; border-color: var(--strong); font-size: 16px; }
.outbox { background: var(--surface); border: 2px dashed var(--violet); border-radius: var(--radius-sm); padding: 12px 14px; font-weight: 700; }
.outbox p { margin: 0; }
.outbox p + p { margin-top: 8px; }
.outbox .danger { margin-left: 8px; }
.empty-vault, .nothing { background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); padding: 28px 24px; }
.empty-vault h2, .nothing h2 { font-size: 26px; margin: 18px 0 8px; overflow-wrap: anywhere; }
.empty-vault p { margin: 0 0 12px; }
.tips { margin: 12px 0 0; padding: 0; list-style: none; }
.tips li { padding: 10px 0; border-top: 2px solid var(--border); }
.tips a { display: inline-block; padding: 4px 0; font-size: 17px; }
.how { margin: 18px 0; padding: 0; list-style: none; }
.how li { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--bg); margin-bottom: 8px; }
.fab { position: fixed; z-index: 5; right: max(20px, env(safe-area-inset-right)); bottom: max(20px, env(safe-area-inset-bottom)); width: 64px; height: 64px; border-radius: 22px; background: var(--lime); color: var(--ink); display: grid; place-items: center; box-shadow: 6px 6px 0 -1px var(--pink); }
.fab svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; }
.fab:hover { filter: brightness(1.05); }
/* Room under the last row for the "+" button, so it never covers a tile's
   label (and the footer). */
main:has(.fab) { padding-bottom: calc(112px + env(safe-area-inset-bottom)); }
body:has(.fab) .site-footer { padding-right: 100px; }
.toast { position: fixed; z-index: 6; left: max(16px, env(safe-area-inset-left)); right: 100px; bottom: max(24px, env(safe-area-inset-bottom)); max-width: 460px; display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px; border-radius: 18px; background: var(--ink); color: #FFFFFF; font-weight: 700; box-shadow: 0 0 0 2px #5B4E86; }
.toast span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast-undo { flex: none; min-height: 44px; border: 0; background: var(--lime); color: var(--ink); }
@media (prefers-reduced-motion: no-preference) { .toast { animation: rise .2s ease-out; } }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } }

/* --- An entry ------------------------------------------------------------ */
.entry { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.entry-top { display: flex; align-items: center; justify-content: space-between; }
.back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-size: 17px; font-weight: 800; }
.entry-body { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.gallery { position: relative; }
.slides { list-style: none; margin: 0; padding: 0; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; border-radius: 22px; scrollbar-width: none; background: var(--border); }
.slides::-webkit-scrollbar { display: none; }
.slides:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.slide { flex: 0 0 100%; scroll-snap-align: center; display: grid; place-items: center; }
.slide a { display: block; width: 100%; }
.slide img { display: block; width: 100%; height: auto; max-height: 72vh; object-fit: contain; }
.slide-count { position: absolute; right: 12px; bottom: 12px; margin: 0; padding: 4px 12px; border-radius: 14px; background: var(--ink); color: #FFFFFF; font-size: 14px; font-weight: 800; }
.slide-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; padding: 0; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .92); color: var(--ink); font-size: 30px; line-height: 1; }
.slide-nav.prev { left: 10px; }
.slide-nav.next { right: 10px; }
@media (pointer: coarse) { .slide-nav { display: none; } }
.slide { position: relative; }
.slide-tag { position: absolute; left: 12px; top: 12px; padding: 3px 10px; border-radius: 12px; background: var(--ink); color: #FFFFFF; font-size: 12px; font-weight: 800; }
.pictures { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.picture-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.pill-button { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin: 0; padding: 0 18px; border-radius: 22px; border: 2px dashed var(--violet); background: var(--surface); color: var(--text); font-size: 16px; font-weight: 900; cursor: pointer; }
.pill-button:hover { border-style: solid; }
.pill-button:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.pill-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; }
.add-pictures .if-busy, .add-pictures.htmx-request .if-idle { display: none; }
.add-pictures.htmx-request .if-busy { display: inline; }
.edit-pictures summary { display: inline-flex; align-items: center; min-height: 44px; font-weight: 800; color: var(--link); cursor: pointer; }
.edit-pictures[open] { flex-basis: 100%; }
.picture-list { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.picture-list li { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.picture-list img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 14px; background: var(--border); }
.viewer { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #000000; color: #FFFFFF; }
.viewer::backdrop { background: #000000; }
.viewer-slides { list-style: none; margin: 0; padding: 0; height: 100%; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.viewer-slides li { flex: 0 0 100%; height: 100%; scroll-snap-align: center; display: grid; place-items: center; }
.viewer-slides img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-close { position: fixed; top: max(14px, env(safe-area-inset-top)); right: 14px; width: 52px; height: 52px; padding: 0; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .92); color: var(--ink); font-size: 30px; line-height: 1; }
.entry-title { font-size: 30px; overflow-wrap: anywhere; }
.entry-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.entry-meta details[open] { flex-basis: 100%; }
.entry-meta summary, .tag-edit summary, .page-text summary { cursor: pointer; }
.entry-meta summary, .tag-edit summary { list-style: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 800; color: var(--link); }
.entry-meta summary::-webkit-details-marker, .tag-edit summary::-webkit-details-marker { display: none; }
.rename summary svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linejoin: round; }
.kind-pick .change { font-size: 15px; }
.kind-pick summary .chip { height: 34px; padding: 0 14px; border-radius: 17px; font-size: 15px; }
.kind-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.kind-list .chip { height: 44px; padding: 0 16px; border-radius: 22px; font-size: 15px; }
.kind-list .chip.current { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--strong); }
.chip.kind { font-weight: 900; border: 0; cursor: pointer; }
.title-form { margin-top: 8px; background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius-sm); padding: 14px; }
.stack-sm > * + * { margin-top: 10px; }
.title-form label { margin: 0; }
.link-card { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; border-radius: 20px; text-decoration: none; overflow-wrap: anywhere; }
a.link-card:hover { text-decoration: none; filter: brightness(1.04); }
.link-card .kicker { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }
.link-title { font-size: 21px; line-height: 1.2; font-weight: 900; letter-spacing: -0.01em; }
.link-url { font-size: 13px; font-weight: 700; }
.link-desc { font-size: 15px; line-height: 1.45; font-weight: 500; }
.link-card.with-image { padding-top: 0; overflow: hidden; }
.link-card .link-image { display: block; width: calc(100% + 36px); max-width: none; margin: 0 -18px 8px; aspect-ratio: 1.91 / 1; object-fit: cover; background: rgba(255, 255, 255, .25); }
.copied { display: flex; flex-direction: column; gap: 16px; }
.copied > * { margin-top: 0; margin-bottom: 0; }
.help-box { background: var(--surface); border: 3px solid var(--pink); border-radius: var(--radius); padding: 18px 20px; }
.help-box.failed { border-color: var(--danger); }
.help-box > * { margin: 0; }
.help-box > * + * { margin-top: 10px; }
.help-title { font-size: 19px; font-weight: 900; line-height: 1.25; letter-spacing: -0.01em; }
.add-shots { display: flex; flex-direction: column; gap: 10px; }
.add-shots .add-photos { flex-wrap: wrap; margin: 0; cursor: pointer; font-weight: 800; padding: 10px; }
.add-shots input[type="file"] { flex-basis: 100%; border: 0; padding: 4px 0 0; background: transparent; font-size: 14px; text-align: center; }
.post { margin: 0; }
.post figcaption { margin-top: 6px; color: var(--muted); font-size: 14px; font-weight: 700; }
.recipe h2 { font-size: 24px; }
.recipe h3 { font-size: 17px; font-weight: 900; margin: 18px 0 0; }
.recipe-facts { margin: 6px 0 0; color: var(--muted); font-weight: 700; }
.ingredients { margin: 8px 0 0; padding-left: 1.2em; font-size: 17px; }
.ingredients li + li { margin-top: 6px; }
.steps { list-style: none; counter-reset: step; margin: 8px 0 0; padding: 0; font-size: 17px; }
.steps li { position: relative; padding-left: 42px; margin-top: 12px; }
.steps li:not(.step-section) { counter-increment: step; }
.steps li:not(.step-section)::before { content: counter(step); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 10px; background: var(--lime); color: var(--ink); font-weight: 900; font-size: 15px; display: grid; place-items: center; }
.steps li.step-section { padding-left: 0; margin-top: 18px; font-weight: 900; }
.block-title { font-size: 15px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 10px; }
.block { display: flex; flex-direction: column; }
.page-text { background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); padding: 14px 20px; }
.page-text summary { font-weight: 800; min-height: 32px; display: flex; align-items: center; }
.page-body { margin-top: 10px; }
.page-body p { margin: 0 0 12px; overflow-wrap: anywhere; font-size: 17px; line-height: 1.6; }
.shared-text { margin: 0; padding: 14px 16px; border-left: 6px solid var(--violet); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--surface); white-space: pre-wrap; overflow-wrap: anywhere; }
.notes { display: flex; flex-direction: column; gap: 12px; }
.notes .block-title { margin: 0; }
.note-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.note { background: var(--surface); border: 2px solid var(--border); border-left: 8px solid var(--violet); border-radius: var(--radius-sm); padding: 14px 14px 8px 16px; }
.note-body { margin: 0; font-size: 17px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; margin-top: 8px; }
.note-when { margin: 0; font-size: 14px; font-weight: 800; color: var(--link); }
.note-edited { font-weight: 600; color: var(--muted); }
.note-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-left: auto; }
.note-actions:has(details[open]) { flex-basis: 100%; }
.note-edit { order: 0; }
.note-edit[open] { flex-basis: 100%; order: 1; }
.note-edit summary { list-style: none; display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; font-weight: 800; color: var(--link); cursor: pointer; }
.note-edit summary::-webkit-details-marker { display: none; }
.note-edit form { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 8px; }
.note-edit-buttons { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.note-edit-buttons .primary { min-height: 44px; padding: 0 24px; }
.note-edit .if-open, .note-edit[open] .if-closed { display: none; }
.note-edit[open] .if-open { display: inline; }
.note-actions:has(.note-edit[open]) .note-delete.outside { display: none; }
.note-delete { min-height: 44px; padding: 0 12px; border: 0; background: transparent; color: var(--danger); font-weight: 800; }
.note-delete:hover { text-decoration: underline; }
.note-add { display: flex; flex-direction: column; gap: 10px; background: var(--surface); border: 2px dashed var(--violet); border-radius: var(--radius); padding: 14px; }
.note-add label { margin: 0; font-size: 17px; font-weight: 900; }
.note-add textarea { min-height: 96px; }
.add-note { min-height: 56px; border: 0; border-radius: 18px; background: var(--lime); color: var(--ink); font-size: 18px; font-weight: 900; }
.add-note:hover { border: 0; filter: brightness(1.05); }
.jump-note { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 22px; background: var(--lime); color: var(--ink); font-weight: 900; text-decoration: none; }
.jump-note:hover { text-decoration: none; filter: brightness(1.05); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; }
.facts dt { font-weight: 800; color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.map-frame { margin-top: 14px; border-radius: var(--radius-sm); overflow: hidden; border: 2px solid var(--border); background: var(--border); }
.map-frame iframe { display: block; width: 100%; height: 260px; border: 0; }
@media (min-width: 600px) { .map-frame iframe { height: 320px; } }
.where-when .map-link { margin-top: 14px; min-height: 48px; border-color: var(--blue); }
.map-link svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
/* Text turned into links: long addresses wrap instead of widening the page. */
a.autolink { overflow-wrap: anywhere; word-break: break-word; }
.badge { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 12px; border-radius: 15px; background: var(--ink); color: var(--lime); font-size: 13px; font-weight: 900; cursor: help; }
@media (prefers-color-scheme: dark) { .badge { background: var(--lime); color: var(--ink); } }
.badge svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.place-card, .game-card { display: flex; flex-direction: column; gap: 10px; padding: 20px; }
.place-card { border-color: var(--blue); border-width: 3px; }
.game-card { border-color: #E040FB; border-width: 3px; }
.place-card h2, .game-card h2 { font-size: 24px; overflow-wrap: anywhere; }
.card-kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; font-size: 13px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.card-kicker .what { padding: 3px 10px; border-radius: 12px; background: var(--blue); color: #FFFFFF; text-transform: none; letter-spacing: 0; font-size: 13px; }
.game-card .card-kicker .what { background: #E040FB; color: var(--ink); }
.card-text { margin: 0; font-size: 17px; line-height: 1.5; overflow-wrap: anywhere; }
.card-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.card-actions .button { min-height: 48px; }
.place-card .hint, .game-card .hint, .recipe .extracted { margin: 0; }
.recipe .extracted { margin-top: 4px; }
.tags-block { display: flex; flex-direction: column; gap: 6px; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; }
.tag-edit summary { font-size: 15px; }
.tag-editor { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius-sm); padding: 14px; }
.tag-editor .hint { margin: 0; }
.tags.editable li form { display: inline-flex; align-items: center; gap: 2px; min-height: 40px; padding: 0 4px 0 14px; border-radius: 20px; background: var(--bg); border: 2px solid var(--border); font-weight: 800; }
.tag-remove { width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: transparent; font-size: 22px; line-height: 1; color: var(--text); }
.tag-remove:hover { background: var(--border); }
.tag-add { display: flex; gap: 8px; }
.tag-add input { flex: 1; min-width: 0; }
.suggested { display: flex; flex-wrap: wrap; gap: 8px; }
.tag.suggestion { cursor: pointer; font-size: 14px; min-height: 36px; background: var(--bg); }
.summary { font-size: 18px; line-height: 1.5; font-weight: 600; }
.not-classified { color: var(--muted); font-size: 14px; font-weight: 700; }
.image-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.reprocess .ghost { font-size: 14px; }
.quiet-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 15px; font-weight: 700; }
.dot { width: 10px; height: 10px; flex: none; border-radius: 50%; border: 2px solid var(--teal); }
.dot.pulse { background: var(--teal); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.6); opacity: .5; } }
@media (prefers-reduced-motion: reduce) { .dot.pulse { animation: none; } * { scroll-behavior: auto !important; } }
.delete-form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 8px; }
.delete-form .danger { min-height: 44px; }
.delete-form .hint { margin: 0; }
.dup { background: var(--bg); border-left: 6px solid var(--blue); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 15px; margin: 0; }
.dup a { white-space: nowrap; }

/* --- The trash ------------------------------------------------------------ */
.trash { max-width: 760px; margin: 0 auto; }
.trash h1 { margin-top: 4px; }
.trash-list { margin-top: 18px; display: flex; flex-direction: column; gap: 12px; }
.trash-list > p { margin: 0; }
.trash-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.trash-item { display: grid; grid-template-columns: 72px 1fr; gap: 12px 14px; align-items: center; background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); padding: 12px; }
.trash-thumb { width: 72px; height: 72px; border-radius: 16px; object-fit: cover; display: block; }
img.trash-thumb { background: var(--border); }
.trash-text { min-width: 0; }
.trash-title { margin: 0; font-weight: 900; font-size: 17px; line-height: 1.25; overflow-wrap: anywhere; }
.trash-when { margin: 4px 0 0; color: var(--muted); font-size: 14px; font-weight: 600; }
.trash-when .chip { height: 24px; font-size: 12px; vertical-align: middle; margin-right: 4px; }
.trash-actions { grid-column: 1 / -1; display: flex; gap: 10px; flex-wrap: wrap; }
.trash-actions button { min-height: 44px; flex: 1 1 140px; }
.trash-actions .danger { padding: 10px 18px; }
@media (min-width: 640px) {
  .trash-item { grid-template-columns: 72px 1fr auto; }
  .trash-actions { grid-column: auto; }
  .trash-actions button { flex: none; }
}

/* --- Wider screens ------------------------------------------------------- */
@media (min-width: 720px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
  .chips { margin: 0; padding: 2px 0 4px; flex-wrap: wrap; overflow: visible; }
}
@media (min-width: 900px) {
  main, header.top, .site-footer { max-width: 1120px; }
  .kinds { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .vault .search { height: 64px; }
  .vault .search input { font-size: 20px; }
}
@media (min-width: 960px) {
  .entry.has-photos { max-width: 1120px; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px 32px; align-items: start; }
  .entry.has-photos .entry-top { grid-column: 1 / -1; }
  .entry.has-photos .pictures { position: sticky; top: 16px; }
  .entry.has-photos .slide img { max-height: 82vh; }
}

/* --- The share sheet (design D: violet sheet, white card, lime Save) ---- */
body.sheet { background: var(--violet); }
@media (prefers-color-scheme: dark) { body.sheet { background: #4B1FA3; } }
body.sheet main { max-width: 560px; padding: max(20px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom)); min-height: 100vh; min-height: 100dvh; display: flex; }
.share { display: flex; flex-direction: column; gap: 16px; width: 100%; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-head h1 { color: #FFFFFF; font-size: 34px; letter-spacing: -0.04em; line-height: 1; }
.sheet-cancel { color: #FFFFFF; font-size: 16px; padding: 12px 0 12px 12px; }
.sheet-card { flex: 1; display: flex; flex-direction: column; gap: 14px; background: var(--surface); border-radius: 24px; padding: 18px; }
.sheet-card .field + .field { margin-top: 0; }
.sheet-card label { font-size: 16px; }
.sheet-card textarea { border-color: var(--ink); background: var(--bg); border-radius: 16px; resize: none; }
@media (prefers-color-scheme: dark) { .sheet-card textarea { border-color: var(--border); } }
.optional { font-weight: 400; color: var(--muted); }
.thumbs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.thumbs li { position: relative; aspect-ratio: 1; border-radius: 16px; overflow: hidden; background: var(--border); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumbs .remove { position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; padding: 0; border-radius: 50%; border: 0; background: var(--ink); color: #FFFFFF; font-size: 20px; line-height: 1; }
.add-photos { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; width: 100%; border: 2px dashed currentColor; border-radius: 16px; background: transparent; color: var(--text); }
.add-photos svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; }
.drop-hint { margin-top: -6px; }
@media (pointer: coarse) { .drop-hint { display: none; } }
body.dragging .sheet-card { outline: 4px dashed var(--lime); outline-offset: 4px; }
.location { display: flex; align-items: center; gap: 12px; margin: 0; }
.location > svg { width: 24px; height: 24px; flex: none; fill: none; stroke: var(--blue); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
@media (prefers-color-scheme: dark) { .location > svg { stroke: #8FB0FF; } }
.location label { flex: 1; margin: 0; font-weight: 600; }
p.location { font-weight: 700; }
.loc-status { display: block; font-size: 13px; font-weight: 400; color: var(--muted); }
.loc-status:empty { display: none; }
input.switch { appearance: none; -webkit-appearance: none; flex: none; width: 56px; height: 34px; padding: 0; border-radius: 17px; border: 2px solid var(--ink); background: var(--bg); position: relative; cursor: pointer; transition: background .15s; }
input.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); transition: transform .15s; }
input.switch:checked { background: var(--blue); border-color: var(--blue); }
input.switch:checked::after { transform: translateX(22px); background: #FFFFFF; }
@media (prefers-color-scheme: dark) { input.switch { border-color: var(--muted); } input.switch::after { background: var(--muted); } }
.save { height: 64px; width: 100%; border: 0; border-radius: 22px; background: var(--lime); color: var(--ink); font-size: 22px; font-weight: 900; letter-spacing: -0.01em; }
.save:hover { border: 0; filter: brightness(1.05); }
.save:disabled { background: #D9F5C4; color: var(--ink); cursor: progress; }
.sheet .notice, .sheet .error { margin: 0; }
.sheet-card > .shared-text { margin: 0; }

@media (max-width: 600px) {
  h1 { font-size: 28px; }
  /* Tables of records become one small card per row. */
  table.cards thead { display: none; }
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; }
  table.cards tr { padding: 10px 0; border-bottom: 2px solid var(--border); }
  table.cards td { border: 0; padding: 3px 0; text-align: left; overflow-wrap: anywhere; }
  table.cards td[data-label]::before { content: attr(data-label); display: inline-block; min-width: 84px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
  table.cards td.num:empty, table.cards td.num:not(:has(*)) { display: none; }
  table.cards td.num { padding-top: 8px; }
  table.cards tr:last-child { border-bottom: 0; padding-bottom: 0; }
  header.top { padding: 14px 16px; gap: 10px; }
  .brand { font-size: 20px; }
  main { padding: 8px 16px 24px; }
  .hero { padding: 28px 20px; }
  .hero h1 { font-size: 42px; }
  .card { padding: 18px; }
}
