:root {
  /* Treasure cave (DECISIONS 93): warm stone, brass for actions. Inside a category the accent is the category's colour. */
  --bg: #13110e; --panel: #1b1814; --panel2: #241f1a; --line: #362e26; --text: #f0ebe3; --muted: #a89c8c;
  --accent: #d4a24c; --on-accent: #1b1206; --danger: #ef4444; --radius: 12px;
  /* Each with one meaning (DECISIONS 90, 93): green = done, purple = proposed by the AI, orange = needs a look. */
  --ok: #4ade80; --ai: #c084fc; --warn: #fb923c;
  color-scheme: dark;
}
/* Light values apply when the system asks for light (unless dark was chosen), or when light was chosen. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme=dark]) { --bg: #f7f4ee; --panel: #fffdf9; --panel2: #f0ebe2; --line: #e0d7c8; --text: #1f1a14; --muted: #6b6152; --accent: #8f5e0c; --on-accent: #fff; --ok: #15803d; --ai: #9333ea; --warn: #c2410c; color-scheme: light; }
}
:root[data-theme=light] { --bg: #f7f4ee; --panel: #fffdf9; --panel2: #f0ebe2; --line: #e0d7c8; --text: #1f1a14; --muted: #6b6152; --accent: #8f5e0c; --on-accent: #fff; --ok: #15803d; --ai: #9333ea; --warn: #c2410c; color-scheme: light; }
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; min-height: 100vh; }
a { color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.grow { flex: 1; }

#backdrop { position: fixed; inset: 0; z-index: -1; background-size: cover; background-position: center; opacity: 0; filter: blur(28px) saturate(1.1); transform: scale(1.1); transition: opacity .3s; }
#backdrop.on { opacity: .16; }

input, select, textarea, button { font: inherit; color: inherit; }
input[type=text], input[type=url], input[type=search], input[type=password], input[type=number], select {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px; min-width: 0; width: 100%;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type=color] { width: 46px; height: 38px; padding: 2px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel2); }

.btn { background: var(--panel2); border: 1px solid var(--line); border-radius: 9px; padding: 8px 13px; cursor: pointer; white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 4px 9px; font-size: 13px; }
.btn.icon { padding: 6px 9px; }
.btn:disabled { opacity: .5; cursor: default; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; }
.badge { background: #fb923c; color: #111; font-size: 12px; font-weight: 700; border-radius: 99px; padding: 3px 9px; }

/* header */
#top { position: sticky; top: 0; z-index: 20; display: flex; gap: 10px; align-items: center; padding: 10px 16px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
#brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 17px; letter-spacing: -.2px; text-decoration: none; }
#brand .wm { color: var(--ok); }
#dump { display: flex; gap: 8px; flex: 3 1 300px; }
#dump-input { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); }
#search { flex: 1 1 140px; max-width: 260px; }
#actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }
#notice { background: color-mix(in srgb, var(--warn) 16%, var(--panel)); border-bottom: 1px solid var(--line); padding: 8px 16px; font-size: 13px; }

/* drafts + forms */
#drafts { display: grid; gap: 12px; padding: 0 16px; max-width: 1100px; margin: 0 auto; }
#drafts:not(:empty) { padding-top: 14px; }
.form { display: flex; gap: 14px; }
.form.draft { background: var(--panel); border: 1px solid var(--accent); border-radius: var(--radius); padding: 12px; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.fimg { width: 170px; flex: none; display: grid; gap: 6px; align-content: start; }
.fthumb { position: relative; aspect-ratio: 16/10; border-radius: 9px; overflow: hidden; background: var(--panel2); }
.fthumb img, .fthumb .ph { width: 100%; height: 100%; object-fit: cover; }
.inherit { position: absolute; left: 6px; bottom: 6px; background: rgba(0,0,0,.65); color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 6px; }
.frow { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.fmain { flex: 1; min-width: 0; display: grid; gap: 8px; align-content: start; }
.ftitle { font-weight: 600; font-size: 16px; }
.furl { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
/* An AI error gets its own line above the buttons, so it can be read in full on a phone. */
.fbar .status:has(.warn) { flex-basis: 100%; }
.status { flex: 1; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; min-width: 120px; }
.warn { color: var(--warn); font-size: 13px; }
.spin { width: 13px; height: 13px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 3s; } html { scroll-behavior: auto; } }

.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chips input { width: 170px; padding: 4px 9px; border-radius: 99px; font-size: 13px; }
.taghints:empty { display: none; }
.taghints .chip { border-style: dashed; }
.chip { display: inline-flex; align-items: center; gap: 5px; background: var(--panel2); border: 1px solid var(--line); border-radius: 99px; padding: 3px 10px; font-size: 13px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.chip small { color: var(--muted); font-size: 11px; }
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chip.on small { color: rgba(255,255,255,.8); }
.chip.cat { border-color: color-mix(in srgb, var(--c) 55%, var(--line)); }
.chip.cat.on { background: var(--c); border-color: var(--c); color: #fff; }
.chip.new { border-style: dashed; }
/* What the AI proposed: a gold dashed edge while not taken, and a sparkle either way. */
.chip.ai:not(.cat)::before { content: '✨'; font-size: 11px; }
.chip.ai:not(.on), .chip.cat.new.ai:not(.on) { border-color: var(--ai); border-style: dashed; }
.chip.ai.on { border-color: var(--ai); }
.aitext { color: var(--ai); }
.chip.more { color: var(--muted); }
.chip.tiny { padding: 1px 7px; font-size: 12px; }

/* tabs */
#tabs { display: flex; gap: 6px; overflow-x: auto; padding: 14px 16px 0; scrollbar-width: thin; }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 11px 11px 0 0; border: 1px solid var(--line); border-bottom: 3px solid var(--c, var(--line)); background: var(--panel); text-decoration: none; white-space: nowrap; cursor: pointer; opacity: .78; }
.tab:hover { opacity: 1; }
.tab.active { opacity: 1; background: color-mix(in srgb, var(--c) 22%, var(--panel)); border-color: var(--c); font-weight: 600; }
.tab .count { font-size: 11px; color: var(--muted); background: var(--panel2); border-radius: 99px; padding: 0 7px; }
.tab.add { border-bottom-color: var(--line); color: var(--muted); }
.ticon { font-size: 17px; }

/* A box of its own below the tabs: joined to the tab row it looked as if it slid under the tabs that are not active. */
#hero { position: relative; margin: 12px 16px 0; padding: 18px 20px; display: flex; gap: 16px; align-items: center; border: 1px solid var(--c); border-radius: var(--radius); background: linear-gradient(90deg, color-mix(in srgb, var(--c) 34%, var(--panel)), var(--panel)); background-size: cover; background-position: center; }
#hero[style*="url("] { color: #fff; min-height: 150px; }
#hero[style*="url("] p { color: rgba(255,255,255,.8); }
/* The edit button sits in the corner over the picture, half see-through so the picture stays visible. */
#hero .hedit { position: absolute; top: 8px; right: 8px; background: color-mix(in srgb, var(--panel) 70%, transparent); backdrop-filter: blur(4px); }
#hero .htext { padding-right: 36px; }
.hpending { display: grid; gap: 8px; margin-top: 6px; }
.hicon { font-size: 44px; line-height: 1; }
.htext { flex: 1; min-width: 0; }
.htext h1 { margin: 0; font-size: 26px; }
.htext p { margin: 4px 0 0; color: var(--muted); }

#tagbar { display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px 4px; }
#tag-search { width: 150px; flex: none; padding: 4px 10px; border-radius: 99px; font-size: 13px; }
#tag-chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; align-items: center; }

/* grid */
#grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; padding: 12px 16px 60px; }
.card { position: relative; background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--c); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: transform .12s, border-color .12s; }
.card:hover { transform: translateY(-2px); border-color: var(--c); }
.thumb { position: relative; display: block; aspect-ratio: 16/9; background: var(--panel2); overflow: hidden; }
.thumb { text-decoration: none; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .ph { width: 100%; height: 100%; }
.ph { display: grid; place-items: center; background: linear-gradient(135deg, color-mix(in srgb, var(--c) 70%, #000), color-mix(in srgb, var(--c) 25%, var(--panel2))); }
.ph span { font-size: 44px; filter: drop-shadow(0 2px 6px rgba(0,0,0,.4)); }
.play { position: absolute; right: 8px; bottom: 8px; background: rgba(0,0,0,.7); color: #fff; border-radius: 6px; padding: 1px 7px; font-size: 12px; }
.cbody { padding: 10px 12px 12px; display: grid; gap: 6px; }
.ctitle { font-weight: 600; text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.ctitle:hover { text-decoration: underline; }
.cmeta { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.cmeta .cat { color: var(--text); text-decoration: none; }
.ctags { display: flex; flex-wrap: wrap; gap: 4px; }
.cactions { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; opacity: 0; transition: opacity .12s; }
.card:hover .cactions, .card:focus-within .cactions { opacity: 1; }
@media (hover: none) { .cactions { opacity: 1; } }
.cactions button { background: rgba(0,0,0,.72); color: #fff; border: 0; border-radius: 7px; width: 30px; height: 30px; cursor: pointer; }
.cactions button:hover { background: var(--accent); color: var(--on-accent); }
.empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 60px 0; }
div.empty { display: grid; justify-items: center; gap: 10px; }
div.empty p { margin: 0; max-width: 34ch; }
.morebtn { grid-column: 1 / -1; justify-self: center; }

/* dialogs */
.modal-wrap { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.6); display: grid; place-items: start center; padding: 6vh 12px; overflow: auto; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; width: min(520px, 100%); box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.modal.wide { width: min(820px, 100%); }
.mhead { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.mhead h2 { margin: 0; font-size: 17px; }
.mbody { padding: 16px; display: grid; gap: 12px; }
.mfoot { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.field { display: grid; gap: 4px; flex: 1; min-width: 0; }
.field > span { font-size: 13px; color: var(--muted); }
.row { display: flex; gap: 10px; align-items: end; }
.row .field:first-child:has(.emoji) { flex: 0 0 70px; }
.row .field:has(input[type=color]) { flex: 0 0 auto; }
.emoji { text-align: center; font-size: 20px; padding: 4px; }
.check { display: flex; gap: 8px; align-items: flex-start; }
.swatches { display: flex; flex-wrap: wrap; gap: 4px; }
.swatches button { background: var(--panel2); border: 1px solid var(--line); border-radius: 7px; width: 32px; height: 32px; cursor: pointer; font-size: 17px; padding: 0; }
.swatches .sw { border-radius: 50%; width: 26px; height: 26px; border: 2px solid transparent; }
.swatches .sw.on { border-color: var(--text); }
.imgfield { display: flex; gap: 6px; align-items: center; }
.imgfield img, .noimg { width: 54px; height: 36px; object-fit: cover; border-radius: 6px; background: var(--panel2); flex: none; display: grid; place-items: center; color: var(--muted); }
.imgfield.square img, .imgfield.square .noimg { width: 40px; height: 40px; object-fit: contain; }
.settings details { border: 1px solid var(--line); border-radius: 10px; padding: 0 14px; }
.settings summary { cursor: pointer; padding: 12px 0; font-weight: 600; }
.stack { display: grid; gap: 12px; padding-bottom: 14px; }
/* Grid gaps already space the parts of a dialog; default paragraph margins on top doubled the gaps. */
.mbody p, .stack p { margin: 0; }
.aiout { font-size: 13px; color: var(--muted); min-height: 1.4em; overflow-wrap: anywhere; }
.taglist { display: grid; gap: 4px; max-height: 320px; overflow: auto; }
.tagrow { display: flex; gap: 8px; align-items: center; padding: 3px 0; }
.tagrow img, .tagrow .noimg { width: 34px; height: 24px; }
.tagrow.wrap { flex-wrap: wrap; }
.stack > a.btn { justify-self: start; text-decoration: none; }
.implist { max-height: 52vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.improw { display: flex; gap: 10px; align-items: center; padding: 6px 10px; border-bottom: 1px solid var(--line); cursor: pointer; }
.improw:last-child { border-bottom: 0; }
.improw img, .improw .noimg { width: 64px; height: 44px; object-fit: cover; border-radius: 6px; flex: none; }
.improw .meta { min-width: 0; flex: 1; display: grid; gap: 2px; }
.improw .meta strong, .improw .meta small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
progress { width: 100%; accent-color: var(--accent); }

#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 80; width: max-content; max-width: 92vw; pointer-events: none; }
.toast button { pointer-events: auto; }
.toast { background: #1f1a14; color: #fff; border: 1px solid #3a3128; border-radius: 10px; padding: 9px 15px; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.toast.error { border-color: var(--danger); }
/* Toasts are dark in both themes; "done" is the goblin's green. */
.toast.ok { background: #14532d; border-color: #22c55e; color: #dcfce7; }
.toast.ok .link { color: #bbf7d0; }
#dropzone { position: fixed; inset: 10px; z-index: 90; border: 3px dashed var(--accent); border-radius: 18px; background: color-mix(in srgb, var(--accent) 18%, rgba(0,0,0,.6)); display: grid; place-items: center; font-size: 26px; font-weight: 700; color: #fff; pointer-events: none; }

@media (max-width: 640px) {
  #top { padding: 8px 12px; }
  #dump { order: 3; flex-basis: 100%; }
  #search { max-width: none; }
  .form { flex-direction: column; }
  .fimg { width: 100%; grid-template-columns: 120px 1fr; align-items: center; }
  #grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; padding: 10px 12px 60px; }
  #tabs, #tagbar { padding-left: 12px; padding-right: 12px; }
  #hero { margin: 10px 12px 0; padding: 12px 14px; flex-wrap: wrap; }
  #tagbar { flex-direction: column; }
  #tag-search { width: 100%; }
  .row { flex-wrap: wrap; }
  /* Fields in a wrapping row keep a usable width instead of shrinking to a few letters. */
  .row > .field { flex: 1 1 130px; }
  .tagrow { flex-wrap: wrap; }
  /* Long labels get a short form on phones (the full one stays in the tooltip). */
  .label-long { display: none; }
  /* Picture fields: preview and buttons on one line, the rarely used address field on its own line below. */
  .imgfield input[type=url] { order: 9; flex-basis: 100%; }
}
@media (min-width: 641px) { .label-short { display: none; } }
.fsum { display: grid; gap: 3px; }
.fsum small { font-size: 12px; }

.csum { margin: 0; font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.settings h3 { margin: 6px 0 0; font-size: 14px; }
.settings code { background: var(--panel2); border-radius: 5px; padding: 1px 5px; }
.dcrow { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.dcrow .field { flex: 1 1 150px; }
.dcrow .check { flex: 0 0 auto; font-size: 13px; padding-bottom: 8px; }

.unlock { display: flex; gap: 8px; flex-wrap: wrap; }
.unlock input { width: 200px; }
details.access { border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; }
details.access summary { cursor: pointer; padding: 10px 0; font-weight: 600; }

.toast { display: flex; gap: 12px; align-items: center; }
.toast .link { color: #e8c27a; font-weight: 600; }
.loglist { display: grid; max-height: 60vh; overflow: auto; }
.logrow { display: flex; gap: 12px; justify-content: space-between; align-items: center; padding: 7px 2px; border-bottom: 1px solid var(--line); }
.logrow > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.logrow em { font-style: normal; font-weight: 600; }
.logrow > small { white-space: nowrap; }

.settings ol { margin: 0; padding-left: 20px; display: grid; gap: 4px; }

/* toolbar next to the tags */
#tools { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
#tools select, #bulkbar select { width: auto; padding: 4px 8px; font-size: 13px; }
/* Order, view, select and copy fit on one line even on 360-pixel phones in German. */
@media (max-width: 640px) {
  #tools { gap: 4px; }
  #tools .btn.small { padding-left: 7px; padding-right: 7px; }
  #tools select { padding-left: 6px; padding-right: 4px; }
}

/* compact list */
#grid.list { grid-template-columns: 1fr; gap: 6px; }
#grid.list .card { flex-direction: row; border-top: 1px solid var(--line); border-left: 3px solid var(--c); }
#grid.list .thumb { width: 104px; flex: none; aspect-ratio: 16/10; }
#grid.list .cbody { flex: 1; min-width: 0; padding: 6px 10px; gap: 3px; }
#grid.list .csum, #grid.list .ph span { display: none; }
#grid.list .ctitle { -webkit-line-clamp: 1; }

/* approval queue and selection */
.card.pending { border-style: dashed; }
.flag { position: absolute; left: 8px; top: 8px; background: #fb923c; color: #111; font-size: 12px; font-weight: 600; border-radius: 6px; padding: 1px 7px; }
.cactions .ok { background: #16a34a; }
body.selecting .card { cursor: pointer; }
body.selecting #grid { padding-bottom: 150px; }
.card.selected { outline: 3px solid var(--accent); outline-offset: 1px; }
.pick { position: absolute; right: 8px; top: 8px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center; font-size: 14px; font-weight: 700; }
.card.selected .pick { background: var(--accent); }
#bulkbar { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 30; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; background: var(--panel); border: 1px solid var(--accent); border-radius: 12px; padding: 10px 12px; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
#bulkbar input { width: 130px; padding: 4px 9px; font-size: 13px; }
label.logrow { cursor: pointer; }
body.selecting #toasts { bottom: auto; top: 72px; }
.flag.dead { background: #ef4444; color: #fff; }
pre.code { margin: 8px 0 12px; padding: 10px; background: var(--panel2); border-radius: 8px; font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.modal h3 { margin: 4px 0 0; font-size: 15px; }

/* text notes */
textarea { background: var(--panel2); border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px; width: 100%; min-height: 44px; resize: vertical; font: inherit; color: inherit; }
textarea:focus-visible, code.copy:focus-visible, .notebody:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.notebody { padding: 12px 14px; background: color-mix(in srgb, var(--c) 16%, var(--panel2)); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; cursor: pointer; flex: 1; min-height: 84px;
  display: -webkit-box; -webkit-line-clamp: 8; -webkit-box-orient: vertical; overflow: hidden; }
.cnote { margin: 0; font-size: 13px; border-left: 3px solid var(--c); padding-left: 8px; white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.notefull { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; background: var(--panel2); border-radius: 10px; padding: 14px; max-height: 60vh; overflow: auto; }
code.copy { background: var(--panel); border: 1px dashed var(--accent); border-radius: 6px; padding: 0 6px; cursor: copy; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .95em; white-space: nowrap; }
code.copy:hover { background: var(--accent); color: var(--on-accent); }
button.ctitle { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; font: inherit; font-weight: 600; color: inherit; }
.card.note .cbody { flex: 0 0 auto; }
#grid.list .card.note { flex-direction: column; }
#grid.list .notebody { -webkit-line-clamp: 2; min-height: 0; padding: 8px 10px; }
#note-btn, #image-btn { padding: 8px 10px; }
#tag-rules { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; min-height: 180px; }

/* a delete button waiting for its second press */
.cactions button.armed { background: var(--danger); width: auto; padding: 0 8px; }
.btn.armed { background: var(--danger); border-color: var(--danger); color: #fff; }
.titlehint { font-size: 13px; color: var(--muted); margin-top: -4px; overflow-wrap: anywhere; }
.titlehint .link { text-align: left; }

/* the field pictures are pasted into on phones */
#paste-zone { min-height: 96px; padding: 12px; border: 2px dashed var(--line); border-radius: 10px; background: var(--panel2); overflow: hidden; outline: none; cursor: text; }
#paste-zone:focus { border-color: var(--accent); }
#paste-zone:empty::before { content: attr(data-placeholder); color: var(--muted); font-size: 14px; }
#paste-zone img { max-height: 80px; }

/* details of a link */
.csum[role=button] { cursor: pointer; }
.csum[role=button]:hover { color: var(--text); }
.cmeta .info { font-size: 14px; line-height: 1; padding: 0 2px; text-decoration: none; }
.details .detail h3 { margin: 0 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.details .detail p { margin: 0; overflow-wrap: anywhere; }
.details .prewrap { white-space: pre-wrap; }
.detailpic { display: block; border-radius: 10px; overflow: hidden; background: var(--panel2); max-height: 280px; }
.detailpic img, .detailpic .ph { width: 100%; max-height: 280px; object-fit: contain; display: block; }
.detailpic .ph { height: 160px; }
.details .furl { white-space: normal; overflow-wrap: anywhere; }
/* Addresses are shown exactly as they are: no typographic substitutions such as 1x8 → 1×8. */
.furl, .furl a, .cnote a, .notefull a { font-feature-settings: 'calt' 0, 'liga' 0; font-variant-ligatures: none; }

/* Result of "Check installation": one finding per line, readable on a phone screenshot. */
.checklist { list-style: none; padding: 0; margin: 6px 0 0; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }

/* Several drafts: a bar to step through them, with one chip per link showing whether it is ready. */
#draftbar { display: grid; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.dbhead { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dbnav { display: inline-flex; gap: 6px; align-items: center; }
.dbchips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.dbchip { flex: 0 0 auto; max-width: 220px; display: inline-flex; gap: 5px; align-items: center; border: 1px solid var(--line); background: var(--panel2); color: inherit; border-radius: 99px; padding: 4px 10px; font-size: 13px; cursor: pointer; }
.dbchip span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dbchip.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

/* Category icons that are pictures: sized like the emoji they replace. */
/* contain: an icon that is not square is shown whole, not cropped. */
.cicon { width: 1.15em; height: 1.15em; object-fit: contain; border-radius: 4px; vertical-align: -0.2em; }
.hicon .cicon { width: 48px; height: 48px; border-radius: 10px; vertical-align: middle; }
.swatches.ai { align-items: center; }
.swatches.ai button { border-color: var(--ai); }
.swatches button.on { box-shadow: 0 0 0 2px var(--accent); }

/* Picture search results: small squares for icons, larger tiles for covers and artwork. */
.picker { display: grid; gap: 12px; }
.pgrid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.pgrid.icon { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
.ptile { display: grid; gap: 4px; padding: 6px; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; color: inherit; text-align: left; min-width: 0; align-content: start; }
.ptile:hover, .ptile:focus-visible { border-color: var(--accent); }
.ptile img { width: 100%; object-fit: cover; border-radius: 6px; background: color-mix(in srgb, var(--text) 6%, transparent); }
/* Each tile shows the crop the picture will get: square icons whole, 16:9 like a card, wide like the header. */
.ptile.icon img { aspect-ratio: 1; object-fit: contain; }
.ptile.card img { aspect-ratio: 16 / 9; object-fit: cover; }
.ptile.background img { aspect-ratio: 3 / 1; object-fit: cover; }
.pgrid.background { grid-template-columns: 1fr; }
.ptile small { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ptile.busy { opacity: .5; }
/* A picture of another shape shows the part a centred crop would keep. */
.ptile.crop img { object-fit: cover; }
.pgroup { margin: 4px 0 -4px; font-size: 13px; font-weight: 600; color: var(--muted); }

/* The cropper: a frame in the target shape; the picture moves and scales inside it. */
.cropframe { position: relative; width: 100%; overflow: hidden; border-radius: 10px; touch-action: none; cursor: grab; user-select: none;
  background: repeating-conic-gradient(color-mix(in srgb, var(--text) 10%, transparent) 0% 25%, transparent 0% 50%) 0 0 / 20px 20px; outline: 2px solid var(--accent); }
.cropframe:active { cursor: grabbing; }
.cropimg { position: absolute; left: 0; top: 0; transform-origin: 0 0; max-width: none; pointer-events: none; }
.imgfield { flex-wrap: wrap; }
.imgfield input[type=url] { flex: 1 1 120px; min-width: 0; }
.mfoot { flex-wrap: wrap; }
.cropframe ~ .mfoot .btn { white-space: normal; }
