/* drop - mobile-first stylesheet */

:root {
  --bg: #0e1015;
  --panel: #171a22;
  --panel-2: #1e222c;
  --line: #2a2f3a;
  --text: #e6e9ef;
  --muted: #8b93a4;
  --accent: #5b8cff;
  --danger: #ff5f6d;
  --warm: #f0b429;
  --ok: #3ddc97;
  --radius: 14px;
  --tap: 46px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.spacer { flex: 1; }
.row { display: flex; gap: 8px; align-items: center; }
.row.end { justify-content: flex-end; }
.err { color: var(--danger); font-size: 13px; min-height: 18px; }

button, a.btn {
  font: inherit;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 11px 15px;
  min-height: var(--tap);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
button:active { transform: scale(.98); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.big { min-height: 52px; font-size: 16px; }
button.icon {
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 19px;
}
button.icon:active { background: var(--panel-2); }
button.danger { color: var(--danger); }

input, textarea {
  font: inherit;
  width: 100%;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 12px 14px;
  outline: none;
  min-height: var(--tap);
}
input:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; line-height: 1.5; }

/* ------------------------------------------------------------ login --- */
.gate { min-height: 100dvh; display: grid; place-items: center; padding: 22px; }
.gate .card {
  width: min(360px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 30px 24px;
  display: grid;
  gap: 14px;
}
.logo { font-size: 32px; font-weight: 700; letter-spacing: -1.2px; }

/* ----------------------------------------------------------- header --- */
header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 16px;
  padding-top: calc(8px + var(--safe-t));
  background: rgba(14, 16, 21, .93);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 20px; letter-spacing: -.6px; }

/* ---------------------------------------------------------- compose --- */
.compose { padding: 16px; display: grid; gap: 12px; max-width: 1100px; margin: 0 auto; }
.dropzone {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 26px;
  text-align: center;
}
.dropzone.hot { border-color: var(--accent); background: #182036; }
.dz-inner { display: grid; gap: 10px; justify-items: center; }
.dz-icon { font-size: 26px; color: var(--muted); }
.textbox {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  display: grid;
  gap: 8px;
}

/* ---------------------------------------------------------- toolbar --- */
.toolbar {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 10px 12px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

.progress {
  position: relative;
  margin: 0 12px 8px;
  height: 40px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 11px;
  overflow: hidden;
  display: grid;
  place-items: center;
  max-width: 1100px;
}
#progFill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--accent); opacity: .3; transition: width .15s; }
.progress span { position: relative; font-size: 13px; }

/* ------------------------------------------------------------- list --- */
main {
  padding: 0 12px calc(96px + var(--safe-b));
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}
main.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
main.rows { display: flex; flex-direction: column; gap: 8px; }

.item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}
.item.pinned { border-color: #574718; }

.item .tapzone {
  -webkit-touch-callout: none;   /* long-press opens our sheet, not the OS menu */
  -webkit-user-select: none;
  user-select: none;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  cursor: pointer;
  border: none;
  background: transparent;
  padding: 0;
  border-radius: 0;
  text-align: left;
  align-items: stretch;
  justify-content: flex-start;
}
.item .thumb {
  height: 108px;
  background: var(--panel-2) center/cover no-repeat;
  display: grid;
  place-items: center;
  font-size: 28px;
  color: var(--muted);
  flex: 0 0 auto;
}
.item .thumb .ext {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  margin-top: 2px;
  color: var(--muted);
}
.item .snippet {
  font: 11.5px/1.4 ui-monospace, Consolas, monospace;
  color: var(--muted);
  padding: 10px;
  height: 108px;
  overflow: hidden;
  text-align: left;
  background: var(--panel-2);
  white-space: pre-wrap;
  word-break: break-word;
}
.item .meta { padding: 9px 10px 10px; display: grid; gap: 3px; min-width: 0; }
.item .name {
  font-size: 13px;
  font-weight: 600;
  word-break: break-word;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.item .sub { font-size: 11.5px; color: var(--muted); }
.item .more {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  border-radius: 99px;
  background: rgba(10, 12, 16, .6);
  backdrop-filter: blur(4px);
  color: var(--text);
  font-size: 17px;
  line-height: 1;
  /* The cover (.thumb) is position:relative for the media overlays, and a
     positioned later sibling paints over an earlier one. Without this the
     button vanished on every tile that has a cover, i.e. all but text clips. */
  z-index: 3;
}
.badge {
  position: absolute;
  z-index: 3;
  top: 8px;
  left: 8px;
  background: rgba(10, 12, 16, .7);
  border-radius: 99px;
  padding: 2px 7px;
  font-size: 11px;
  color: var(--warm);
}

/* rows layout */
main.rows .item { flex-direction: row; align-items: center; }
main.rows .item .tapzone { flex-direction: row; align-items: center; gap: 10px; padding: 8px; }
main.rows .item .thumb, main.rows .item .snippet {
  height: 44px; width: 44px; flex: 0 0 44px; border-radius: 10px; font-size: 18px; padding: 0;
  display: grid; place-items: center; overflow: hidden;
}
main.rows .item .snippet { font-size: 9px; line-height: 1.1; padding: 4px; display: block; }
main.rows .item .ext { display: none; }
main.rows .item .meta { flex: 1; padding: 0; }
main.rows .item .name { -webkit-line-clamp: 1; }
main.rows .item .more { position: static; margin-right: 6px; }
main.rows .badge { position: static; margin-left: 8px; }

.empty { text-align: center; padding: 50px 20px; }
.empty-icon { font-size: 40px; opacity: .5; margin-bottom: 6px; }

/* -------------------------------------------------- multi-selection --- */
.item.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.item .check {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 99px;
  border: 2px solid #fff;
  background: rgba(10, 12, 16, .55);
  display: grid;
  place-items: center;
  font-size: 15px;
  color: #fff;
  z-index: 2;
}
.item.sel .check { background: var(--accent); border-color: var(--accent); }
main.rows .item .check { position: static; margin: 0 8px; flex: 0 0 26px; }

.selbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 35;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px calc(8px + var(--safe-b));
  background: #1b2637;
  border-top: 1px solid var(--accent);
}
.selbar span { font-weight: 600; font-size: 14px; }
body.selecting .tabbar { display: none !important; }

/* ------------------------------------------------------------ inbox --- */
.msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
}
.msg.unread { background: #1a1f2b; border-color: #33405c; }
.msg.pending { border-color: var(--warm); }
.msg .dot { width: 9px; height: 9px; border-radius: 99px; margin-top: 6px; flex: 0 0 9px; }
.lv-silent { background: var(--muted); }
.lv-ping { background: var(--accent); }
.lv-buzz { background: var(--danger); }
.msg-main { flex: 1; min-width: 0; }
.msg-top { display: flex; gap: 8px; align-items: baseline; }
.msg-title { font-weight: 600; font-size: 14.5px; flex: 1; word-break: break-word; }
.msg.unread .msg-title { font-weight: 700; }
.msg-time { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.msg-sub { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 5px; }
.msg-body {
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-wrap;
}
.chip {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--muted);
}
.chip.warn { color: var(--warm); border-color: #574718; }
.chip.ok { color: var(--ok, #3ddc97); border-color: #1e4a38; }

.msg-full {
  white-space: pre-wrap;
  word-break: break-word;
  font: 13px/1.55 ui-monospace, Consolas, monospace;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin: 0 0 12px;
  max-height: 40dvh;
  overflow: auto;
}
.opts { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.opts .opt { flex: 1 1 auto; min-width: 40%; background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.replied { padding: 10px 12px; background: var(--panel-2); border-radius: 10px; font-size: 14px; }

.badge-dot {
  position: absolute;
  top: 4px;
  right: 50%;
  transform: translateX(18px);
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
  min-width: 17px;
  height: 17px;
  border-radius: 99px;
  display: grid;
  place-items: center;
  padding: 0 4px;
}

/* ----------------------------------------------------------- tabbar --- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: flex;
  gap: 6px;
  padding: 8px 10px calc(8px + var(--safe-b));
  background: rgba(14, 16, 21, .95);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tabbar button {
  position: relative;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-height: 54px;
  font-size: 11.5px;
  background: transparent;
  border: none;
  color: var(--muted);
}
.tabbar button span { font-size: 19px; }
.tabbar button:active { background: var(--panel-2); border-radius: 12px; }
.tabbar button.active { color: var(--accent); }

/* ------------------------------------------------------------ sheet --- */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 54; }
.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 55;
  background: var(--panel);
  border-top: 1px solid var(--line);
  border-radius: 20px 20px 0 0;
  padding: 8px 14px calc(16px + var(--safe-b));
  max-height: 85dvh;
  overflow: auto;
  animation: rise .18s ease-out;
}
@keyframes rise { from { transform: translateY(100%); } to { transform: translateY(0); } }
.grabber { width: 38px; height: 4px; border-radius: 99px; background: var(--line); margin: 6px auto 12px; }
.sheet h3 { margin: 0 0 4px; font-size: 15px; word-break: break-word; }
.sheet .sheet-sub { color: var(--muted); font-size: 12.5px; margin-bottom: 12px; }
.sheet-actions { display: grid; gap: 8px; }
.sheet-actions button, .sheet-actions a.btn {
  justify-content: flex-start;
  min-height: 50px;
  font-size: 15px;
  background: var(--panel-2);
}
.sheet-compose { display: grid; gap: 10px; }
.sheet-compose textarea { min-height: 150px; }

/* ----------------------------------------------------------- viewer --- */
.viewer { position: fixed; inset: 0; z-index: 50; background: #0a0b0f; display: flex; flex-direction: column; }
.viewer-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 2px 6px;
  padding-top: calc(6px + var(--safe-t));
  transition: opacity .2s;
}
.vhead { flex: 1; min-width: 0; padding: 2px 0; }
.vtitle {
  font-weight: 650;
  font-size: 15.5px;
  line-height: 1.3;
  word-break: break-word;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;           /* the whole name, up to two lines, not an ellipsis */
  -webkit-box-orient: vertical;
}
.vsub { font-size: 12px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wide-only { display: none !important; }

.viewer-actions {
  display: flex;
  gap: 8px;
  padding: 6px 10px 10px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--line);
  transition: opacity .2s;
}
.viewer-actions::-webkit-scrollbar { display: none; }
.vbtn {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
}
a.vbtn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text); text-decoration: none;
}
.vbtn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
#vDownload { flex: 1 1 auto; min-width: 150px; font-size: 16px; min-height: 48px; }
/* phones: secondary actions become 48px squares so Download stays wide */
@media (max-width: 520px) {
  .viewer-actions .vbtn:not(#vDownload) { width: 48px; min-height: 48px; padding: 0; font-size: 19px; }
  .viewer-actions .vbtn .lbl { display: none; }
}   /* the big one */
.vbtn.lit { color: var(--accent); border-color: var(--accent); }

.viewer.bare .viewer-bar, .viewer.bare .viewer-actions, .viewer.bare .vtools { opacity: 0; pointer-events: none; }

.viewer-body { flex: 1; min-height: 0; overflow: auto; display: grid; place-items: center; padding: 10px; position: relative; }
.viewer-body:not(.pdfmode) > * { min-width: 0; max-width: 100%; }
.viewer-body iframe { width: 100%; height: 100%; border: 0; background: #fff; border-radius: 8px; }
.viewer-body .fallback { text-align: center; display: grid; gap: 14px; justify-items: center; color: var(--muted); }
.viewer-body .fallback .btn { min-height: 50px; padding: 0 22px; font-size: 16px; }

/* floating tool pill (zoom, pages, text size) */
.vtools {
  position: absolute;
  left: 50%;
  bottom: calc(14px + var(--safe-b));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  max-width: calc(100vw - 20px);
  background: rgba(23, 26, 34, .9);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 99px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .5);
  z-index: 5;
  transition: opacity .2s;
}
.vtools button {
  min-height: 42px; min-width: 42px; padding: 0 10px;
  border: none; background: transparent; border-radius: 99px;
  font-size: 18px; font-weight: 600; color: var(--text); white-space: nowrap;
}
.vtools button:active { background: var(--panel-2); }
.vtools .pct { font-size: 13.5px; min-width: 58px; font-variant-numeric: tabular-nums; }
.vtools button.on { color: var(--accent); }
.vtools .sep { width: 1px; height: 22px; background: var(--line); margin: 0 3px; }

/* find bar */
.vfind { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.vfind input { flex: 1; min-width: 0; }
.vfind .icon { min-width: 40px; min-height: 40px; }

/* image */
.viewer-body.imgmode { display: block; padding: 0; overflow: hidden; }
.iv { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: grab;
      background: rgba(0, 0, 0, calc(1 - var(--fade, 1))); opacity: var(--fade, 1); }
.iv:active { cursor: grabbing; }
.iv img {
  position: absolute; left: 0; top: 0;
  max-width: none; max-height: none;
  transform-origin: 50% 50%;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  opacity: 0; will-change: transform;
}
.iv.ready img { opacity: 1; }
.iv img.anim { transition: transform .22s cubic-bezier(.2, .7, .3, 1); }
.iv-spin {
  position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; margin: -17px;
  border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%;
  animation: spin .8s linear infinite;
}
.iv.ready .iv-spin { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* text and markdown: block layout, so a long line can never widen the page */
.viewer-body.textmode { display: block; padding: 12px 12px 90px; --vfs: 14px; }
.viewer-body pre.plain {
  margin: 0; white-space: pre-wrap; overflow-wrap: anywhere;
  font: var(--vfs)/1.6 ui-monospace, Consolas, monospace;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px;
}
.viewer-body pre.plain a { color: var(--accent); }
.viewer-body.nowrap pre.plain { white-space: pre; overflow-x: auto; overflow-wrap: normal; }

/* pdf */
.viewer-body.pdfmode { display: block; padding: 0; touch-action: pan-x pan-y; }
.pdf-doc {
  width: max-content;
  min-width: 100%;
  margin: 0 auto;
  padding: 10px 8px 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transform-origin: 0 0;
}
.pdf-page {
  position: relative;
  background: #fff;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .45);
  flex: 0 0 auto;
}
.pdf-page canvas { display: block; width: 100%; height: 100%; }
.pdf-doc.dark .pdf-page { background: #16181d; }
.pdf-doc.dark canvas { filter: invert(.9) hue-rotate(180deg); }

/* pdf.js text layer: invisible text over the canvas, there to be selected,
   copied and searched (after pdf.js 3.11 pdf_viewer.css, trimmed) */
.textLayer {
  position: absolute; inset: 0; overflow: hidden; line-height: 1;
  text-align: initial; -webkit-text-size-adjust: none; text-size-adjust: none;
  forced-color-adjust: none; transform-origin: 0 0; z-index: 2; caret-color: transparent;
}
.textLayer :is(span, br) {
  color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0% 0%;
}
.textLayer span.markedContent { top: 0; height: 0; }
.textLayer ::selection { background: rgba(60, 120, 255, .35); }
.textLayer br::selection { background: transparent; }
.textLayer .hl { background: rgba(255, 196, 0, .42); border-radius: 2px; }
.textLayer .hl.cur { background: rgba(255, 110, 0, .65); }

@media (min-width: 720px) {
  .wide-only { display: inline-flex !important; }
  .viewer-actions { padding-left: 56px; }
  #vDownload { flex: 0 0 auto; }
}

/* rendered markdown */
.md-body {
  width: 100%;
  min-width: 0;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 2px 40px;
  font-size: calc(var(--vfs, 14px) + 1.5px);
  line-height: 1.65;
  /* break-word, not anywhere: only a string too long for a line on its own
     (a URL, a path) is split; words in prose and in table cells stay whole */
  overflow-wrap: break-word;
}
.md-body h1, .md-body h2, .md-body h3, .md-body h4, .md-body h5, .md-body h6 {
  line-height: 1.25;
  margin: 1.5em 0 .5em;
  font-weight: 650;
}
.md-body h1 { font-size: 1.7em; margin-top: .2em; }
.md-body h2 { font-size: 1.35em; border-bottom: 1px solid var(--line); padding-bottom: .25em; }
.md-body h3 { font-size: 1.15em; }
.md-body h4, .md-body h5, .md-body h6 { font-size: 1em; color: var(--muted); }
.md-body p { margin: 0 0 1em; }
.md-body a { color: var(--accent); }
.md-body strong { font-weight: 660; }
.md-body ul, .md-body ol { margin: 0 0 1em; padding-left: 1.4em; }
.md-body li { margin: .25em 0; }
.md-body li > input[type=checkbox] { margin-right: .4em; }
.md-body blockquote {
  margin: 0 0 1em;
  padding: 2px 14px;
  border-left: 3px solid var(--accent);
  background: rgba(91, 140, 255, .07);
  border-radius: 0 8px 8px 0;
  color: #c3cadb;
}
.md-body blockquote p:last-child { margin-bottom: 0; }
.md-body code {
  font: .88em/1.5 ui-monospace, Consolas, monospace;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .1em .35em;
}
.md-body pre.code {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px 14px;
  overflow-x: auto;
  margin: 0 0 1em;
}
.md-body pre.code code {
  background: none; border: none; padding: 0;
  font-size: .85em; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere;
}
.viewer-body.nowrap .md-body pre.code code { white-space: pre; overflow-wrap: normal; }
.md-body pre.code { white-space: normal; }
.md-body pre.code[data-lang]::before {
  content: attr(data-lang);
  position: absolute; top: 0; right: 10px;
  font-size: 10.5px; letter-spacing: .5px; text-transform: uppercase;
  color: var(--muted);
}
.md-body hr { border: none; border-top: 1px solid var(--line); margin: 1.8em 0; }
.md-body img { max-width: 100%; height: auto; border-radius: 8px; }
.md-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1em;
  font-size: 14px;
  display: block;
  overflow-x: auto;
}
.md-body th, .md-body td { border: 1px solid var(--line); padding: 7px 10px; overflow-wrap: normal; min-width: 4.5em; }
.md-body th { background: var(--panel-2); font-weight: 650; }
.md-body del { color: var(--muted); }

/* ----------------------------------------------------- media: covers --- */
.playdot {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 38px; height: 38px;
  border-radius: 99px;
  background: rgba(10, 12, 16, .62);
  backdrop-filter: blur(3px);
  display: grid; place-items: center;
  font-size: 15px;
  color: #fff;
  pointer-events: none;
}
.durpill {
  position: absolute;
  right: 6px; bottom: 6px;
  background: rgba(10, 12, 16, .78);
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  color: #fff;
  pointer-events: none;
}
.item .thumb { position: relative; }
.item.playing { border-color: var(--accent); }
.item.playing .playdot { background: var(--accent); }
main.rows .durpill { display: none; }
main.rows .playdot { width: 24px; height: 24px; font-size: 11px; }

/* ------------------------------------------------------ mini player --- */
.mini {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(70px + var(--safe-b));
  z-index: 32;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  margin: 0 8px;
  border-radius: 14px;
  background: rgba(30, 34, 44, .97);
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  overflow: hidden;
}
.mini-progress { position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--line); }
.mini-progress i { display: block; height: 100%; width: 0; background: var(--accent); }
.mini-face {
  width: 40px; min-width: 40px; height: 40px; min-height: 40px;
  padding: 0; border: none; background: none; border-radius: 9px; overflow: hidden;
}
.mini-face .cover {
  display: grid; place-items: center;
  width: 100%; height: 100%;
  background: var(--panel-2) center/cover no-repeat;
  border-radius: 9px;
  font-size: 17px;
}
.mini-meta {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 1px;
  text-align: left;
  justify-items: start;
  background: none;
  border: none;
  padding: 0 2px;
  min-height: 40px;
}
.mini-title {
  font-size: 13px; font-weight: 600;
  max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mini-time { font-variant-numeric: tabular-nums; }
.mini .icon { min-width: 38px; min-height: 38px; font-size: 15px; color: var(--text); }
body.has-mini main { padding-bottom: calc(150px + var(--safe-b)); }
body.selecting .mini { display: none !important; }

/* ---------------------------------------------------- audio / video --- */
.viewer-body.mediamode { display: block; padding: 0; }
.viewer-body.videomode { background: #000; display: grid; place-items: center; }

/* shared range styling: a thin track that fills up to --pct */
.scrub {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  min-height: 0;
  height: 22px;
  padding: 0;
  border: none;
  background: transparent;
  outline: none;
}
.scrub::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 99px;
  background: linear-gradient(to right, var(--accent) var(--pct, 0%), var(--line) var(--pct, 0%));
}
.scrub::-moz-range-track { height: 4px; border-radius: 99px; background: var(--line); }
.scrub::-moz-range-progress { height: 4px; border-radius: 99px; background: var(--accent); }
.scrub::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px; height: 15px;
  margin-top: -5.5px;
  border-radius: 99px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .6);
}
.scrub::-moz-range-thumb { width: 15px; height: 15px; border: none; border-radius: 99px; background: #fff; }

.aplayer {
  max-width: 460px;
  margin: 0 auto;
  padding: 18px 18px calc(30px + var(--safe-b));
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
}
.aplayer .art {
  width: min(64vw, 280px);
  aspect-ratio: 1;
  border-radius: 18px;
  overflow: hidden;
  background: var(--panel-2);
  display: grid;
  place-items: center;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .5);
  margin-bottom: 6px;
}
.aplayer .art img { width: 100%; height: 100%; object-fit: cover; }
.aplayer .art-ph { font-size: 56px; opacity: .5; }
.aplayer .a-title { font-size: 16px; font-weight: 650; word-break: break-word; }
.aplayer .scrub { width: 100%; margin-top: 8px; }
.aplayer .times {
  width: 100%;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-top: -6px;
}
.aplayer .controls { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.aplayer .controls .icon { position: relative; font-size: 22px; color: var(--text); }
.aplayer .controls .icon i {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-style: normal; font-size: 9px; font-weight: 700;
  margin-top: 2px;
}
.big-round {
  width: 62px; height: 62px; min-height: 62px;
  border-radius: 99px;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-size: 21px;
}
.aplayer .extras { display: flex; gap: 8px; margin-top: 8px; }
.aplayer .extras button { min-height: 38px; padding: 0 14px; font-size: 13px; }
.aplayer .extras .on { color: var(--accent); border-color: var(--accent); }

.vplayer { position: relative; width: 100%; max-height: 100%; background: #000; }
.vplayer video { display: block; width: 100%; max-height: calc(100dvh - 120px); background: #000; }
.vplayer .vtap { position: absolute; inset: 0; background: none; border: none; border-radius: 0; }
.vplayer .vbig {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 72px; height: 72px;
  border-radius: 99px;
  background: rgba(10, 12, 16, .55);
  backdrop-filter: blur(4px);
  display: grid; place-items: center;
  font-size: 26px;
  color: #fff;
  pointer-events: none;
}
.vplayer .vhint {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  padding: 10px 14px;
  border-radius: 99px;
  background: rgba(10, 12, 16, .6);
  font-size: 13px;
  color: #fff;
  opacity: 0;
  transition: opacity .12s;
  pointer-events: none;
}
.vplayer .vhint.left { left: 8%; }
.vplayer .vhint.right { right: 8%; }
.vplayer .vhint.flash { opacity: 1; }
.vplayer .vbar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 4px 10px calc(6px + var(--safe-b));
  background: linear-gradient(to top, rgba(0, 0, 0, .82), rgba(0, 0, 0, 0));
  transition: opacity .2s;
}
.vplayer .vrow { display: flex; align-items: center; gap: 4px; }
.vplayer .vrow .icon { color: #fff; min-height: 40px; min-width: 40px; }
.vplayer .times { font-size: 12px; color: #dfe3ec; font-variant-numeric: tabular-nums; padding-left: 2px; }
.vplayer .rate { min-height: 32px; padding: 0 10px; font-size: 12px; background: rgba(255, 255, 255, .12); border-color: transparent; color: #fff; }
.vplayer.idle .vbar { opacity: 0; pointer-events: none; }
.vplayer:fullscreen video { max-height: 100dvh; height: 100dvh; object-fit: contain; }

/* device list in settings */
.devs { display: grid; gap: 8px; }
.dev {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 11px;
}
.dev.me { border-color: var(--accent); }
.dev-main { flex: 1; min-width: 0; }
.dev button { min-height: 36px; padding: 0 12px; font-size: 13px; }

/* ------------------------------------------------------------ toast --- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + var(--safe-b));
  transform: translateX(-50%);
  background: #2b3140;
  border: 1px solid var(--line);
  padding: 11px 18px;
  border-radius: 99px;
  z-index: 60;
  font-size: 14px;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,.55);
}
body.has-mini .toast { bottom: calc(146px + var(--safe-b)); }

/* view switcher (desktop, where there is no bottom bar) */
.seg { display: none; gap: 2px; background: var(--panel-2); border-radius: 11px; padding: 3px; margin-left: 8px; }
.seg button {
  min-height: 34px; padding: 0 14px; font-size: 13.5px; border: none;
  background: transparent; color: var(--muted); border-radius: 9px;
}
.seg button.on { background: var(--panel); color: var(--text); font-weight: 600; }
.segb {
  background: var(--danger); color: #fff; font-style: normal; font-weight: 700;
  font-size: 10px; border-radius: 99px; padding: 1px 5px; margin-left: 4px;
}

/* --------------------------------------------------------- responsive - */
.desktop-only, .desktop-flex { display: none; }
@media (min-width: 720px) {
  .desktop-only { display: grid; }
  .desktop-flex { display: flex; }
  .mobile-only { display: none !important; }
  main { padding-bottom: 60px; }
  main.grid { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 12px; }
  .toast { bottom: 26px; }
  .mini { left: auto; right: 16px; bottom: 16px; margin: 0; width: min(420px, calc(100vw - 32px)); }
  body.has-mini main { padding-bottom: 110px; }
  body.has-mini .toast { bottom: 96px; }
  .sheet {
    left: 50%; right: auto; bottom: auto; top: 50%;
    transform: translate(-50%, -50%);
    width: min(420px, 92vw);
    border-radius: 16px;
    border: 1px solid var(--line);
    animation: none;
  }
  .grabber { display: none; }
}

/* ------------------------------------------------- public share links --- */
/* The one part of the app that faces outward, so it is coloured like a
   warning rather than like the rest of the furniture. */
.badge.lnk { color: var(--accent); }
.lit { color: var(--accent); }

.share-warn {
  margin: 12px 0 2px;
  padding: 11px 13px;
  border: 1px solid rgba(240, 180, 41, .35);
  background: rgba(240, 180, 41, .08);
  color: #f3d69a;
  border-radius: 11px;
  font-size: 13.5px;
  line-height: 1.5;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 99px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 14px;
}
.chip.on {
  background: rgba(91, 140, 255, .16);
  border-color: var(--accent);
  color: #cfdcff;
}

.linkbox {
  width: 100%;
  margin-top: 12px;
  padding: 12px 13px;
  min-height: var(--tap);
  background: #0b0d12;
  border: 1px solid var(--accent);
  border-radius: 11px;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  /* A long URL that wraps is unreadable and a long URL that is cut off is
     uncopyable, so it scrolls horizontally inside its own box. */
  white-space: nowrap;
  overflow-x: auto;
}

.foot-note { margin-top: 14px; line-height: 1.55; }
#linkList { display: grid; gap: 8px; }
#linkList button { min-height: 36px; padding: 0 12px; font-size: 13px; }

/* ------------------------------------------ 2026-09-29 list additions --- */
.chips-row {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  padding: 0 12px 10px; margin-top: -2px;
}
.chips-row::-webkit-scrollbar { display: none; }
.fchip {
  flex: 0 0 auto; min-height: 34px; padding: 0 13px; border-radius: 99px;
  font-size: 13px; font-weight: 600; color: var(--muted); background: var(--panel);
}
.fchip.on { color: #fff; background: var(--accent); border-color: var(--accent); }
.fchip.sort { margin-left: auto; color: var(--text); }
.item .sub .exp { color: var(--warm); }
.opts.inline { margin: 9px 0 2px; }
.opts.inline .opt { min-height: 40px; padding: 7px 12px; min-width: 0; font-size: 14px; }

/* viewer icons: one stroke style everywhere, no colour emoji */
.vbtn svg, .vico svg {
  width: 21px; height: 21px; flex: 0 0 auto;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.vico svg { width: 24px; height: 24px; }
.vbtn svg .dot, .vico svg .dot { fill: currentColor; stroke: none; }
.vbtn { gap: 8px; }

/* send sheet: big tiles, two per row */
.send-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 10px; }
.send-grid button {
  flex-direction: column; gap: 6px; min-height: 88px; padding: 12px 8px;
  font-size: 14px; font-weight: 600; border-radius: 14px; background: var(--panel-2);
}
.send-grid .si { font-size: 26px; line-height: 1; }
.send-note { line-height: 1.45; }

/* pdf link layer: real anchors over the page, above the text layer */
.linkLayer { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.linkLayer a { position: absolute; pointer-events: auto; border-radius: 3px; }
.linkLayer a:hover, .linkLayer a:active { background: rgba(91, 140, 255, .22); outline: 1px solid rgba(91, 140, 255, .5); }
