/* ipfs2fil explorer. Designs: docs/boards. No web fonts: IBM Plex is used when installed. */
:root {
  --bg: #F4F5F7; --card: #FFFFFF; --text: #15171C; --muted: #4B5260; --faint: #5B6270;
  --line: #E1E4E9; --row: #EEF0F3; --input: #CDD2DA; --accent: #1B5FD6; --accent-dark: #0F3F96;
  --sel: #E8EEFB; --warm: #C2410C; --new: #9A3412; --gray: #9AA1AD; --shade: rgba(21, 23, 28, .45);
  --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317; --card: #1A1D23; --text: #E8EAEE; --muted: #A9B0BC; --faint: #9AA1AD;
    --line: #2A2F38; --row: #23272F; --input: #3A404B; --accent: #6E9EF5; --accent-dark: #A9C5FA;
    --sel: #1F2B44; --warm: #F08A4B; --new: #F0A36E; --gray: #6B7280; --shade: rgba(0, 0, 0, .6);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--sans); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); text-decoration: underline; }
code, .mono { font-family: var(--mono); }
pre, code, textarea { tab-size: 4; -moz-tab-size: 4; }
kbd { font: 12px/18px var(--mono); min-width: 12px; text-align: center; padding: 0 6px; border: 1px solid var(--input); border-bottom-width: 2px; border-radius: 4px; background: var(--card); color: var(--text); display: inline-block; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-size: 34px; line-height: 1.2; overflow-wrap: anywhere; }
h2 { font-size: 18px; }
button { font: inherit; color: inherit; }
.sr { position: absolute; left: -9999px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); font-size: 13px; }

/* Header */
header.top { background: var(--card); border-bottom: 1px solid var(--line); }
.bar, main, .rail { max-width: 1200px; margin: 0 auto; padding-left: 24px; padding-right: 24px; width: 100%; }
.bar { padding-top: 14px; padding-bottom: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; }
.brand:hover { color: var(--text); text-decoration: none; }
nav.pages { display: flex; gap: 22px; font-size: 14px; }
nav.pages a { color: var(--muted); padding-bottom: 2px; border-bottom: 2px solid transparent; }
nav.pages a[aria-current] { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }
form.search { margin-left: auto; position: relative; flex: 0 1 340px; min-width: 220px; }
form.search input { width: 100%; height: 40px; padding: 0 40px 0 12px; border: 1px solid var(--input); border-radius: 6px; font: inherit; font-size: 14px; background: var(--card); color: var(--text); }
form.search kbd { position: absolute; right: 10px; top: 10px; color: var(--muted); }

main { flex: 1; padding-top: 32px; padding-bottom: 40px; display: flex; flex-direction: column; gap: 28px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 20px 22px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card.tight { padding: 16px 18px; gap: 2px; }
.head { display: flex; flex-direction: column; gap: 10px; }
.eyebrow { font-size: 13px; color: var(--faint); font-weight: 500; letter-spacing: .04em; text-transform: uppercase; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.meta { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 14px; color: var(--muted); align-items: center; }
.chipcode { font-family: var(--mono); color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 4px; padding: 2px 6px; overflow-wrap: anywhere; }
.link { border: 0; background: none; color: var(--accent); font-size: 14px; cursor: pointer; padding: 0 4px; }
.link:hover { color: var(--accent-dark); text-decoration: underline; }
.lead { margin: 0; color: var(--muted); max-width: 760px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat .k { font-size: 13px; color: var(--faint); }
.stat .v { font-size: 26px; font-weight: 600; line-height: 1.3; }
.stat .s { font-size: 13px; color: var(--faint); }

.split { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.split > .wide { flex: 999 1 560px; }
.split > .side { flex: 1 1 300px; display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.titled { display: flex; align-items: baseline; gap: 12px; }
.titled > :last-child:not(:first-child) { margin-left: auto; font-size: 14px; }

/* Bars and legends */
.barchart { display: flex; height: 16px; border-radius: 4px; overflow: hidden; gap: 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 14px; color: var(--muted); }
.legend a, .legend span, .typerow { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.sw { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.typerow { border: 0; background: none; padding: 4px 0; cursor: pointer; width: 100%; text-align: left; font-size: 14px; }
.typerow .n { margin-left: auto; color: var(--faint); font-size: 13px; }
.typerow:hover span:nth-child(2) { color: var(--accent); }
.pmap { display: grid; grid-template-columns: repeat(18, minmax(0, 1fr)); gap: 3px; }
.pmap a { aspect-ratio: 1; border-radius: 2px; display: block; }
.pmap a:hover { outline: 2px solid var(--text); }
.toggle { display: flex; gap: 6px; }
.pill { height: 32px; padding: 0 12px; border-radius: 16px; border: 1px solid var(--input); background: var(--card); font-size: 13px; cursor: pointer; white-space: nowrap; }
.pill[aria-pressed="true"] { background: var(--sel); border-color: var(--accent); }
.pill .n { color: var(--faint); margin-left: 2px; }

/* Facts list (aside) */
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.facts > :nth-child(odd) { color: var(--faint); }
.facts code { font-size: 12px; overflow-wrap: anywhere; }
.gw { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; }
.stack { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }

/* Lists */
.tools { display: flex; flex-direction: column; gap: 12px; }
.tools .row1 { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.filter { position: relative; flex: 1 1 260px; display: flex; align-items: center; }
.filter svg { position: absolute; left: 10px; }
.filter input { width: 100%; height: 36px; padding: 0 36px 0 32px; border: 1px solid var(--input); border-radius: 6px; font: inherit; font-size: 14px; background: var(--card); color: var(--text); }
.filter kbd { position: absolute; right: 8px; color: var(--muted); }
.selects { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; font-size: 13px; color: var(--muted); }
.selects label { display: flex; align-items: center; gap: 6px; }
select, .flip { height: 36px; border: 1px solid var(--input); border-radius: 6px; background: var(--card); color: var(--text); font: inherit; font-size: 14px; padding: 0 8px; }
.flip { width: 36px; cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.scroll { overflow-x: auto; outline: none; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--faint); font-size: 13px; font-weight: 500; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th button { border: 0; background: none; padding: 0; color: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
th button:hover { color: var(--accent); }
td { padding: 7px 8px; border-bottom: 1px solid var(--row); vertical-align: top; }
tr[aria-selected="true"] td { background: var(--sel); }
tbody tr { cursor: default; }
.r { text-align: right; white-space: nowrap; }
td.cid { font: 12px/20px var(--mono); color: var(--muted); white-space: nowrap; }
td.cid a { margin-left: 6px; }
.nm { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.nm svg { flex: none; margin-top: 2px; }
.nm a, .nm span { overflow-wrap: anywhere; font-weight: 500; }
.sub { font: 12px var(--mono); color: var(--faint); overflow-wrap: anywhere; }
.tags { display: flex; gap: 4px; flex-wrap: wrap; }
.tag { font: 12px var(--mono); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; color: var(--muted); }
.new { color: var(--new); font-weight: 500; }
.foot { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; font-size: 13px; color: var(--faint); }
.more { height: 32px; padding: 0 12px; border: 1px solid var(--input); border-radius: 6px; background: var(--card); cursor: pointer; font-size: 13px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: 14px; color: var(--faint); }
.crumbs span[aria-current] { color: var(--text); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-left: auto; }
.btn { height: 36px; display: inline-flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--input); border-radius: 6px; background: var(--card); color: var(--text); font-size: 14px; cursor: pointer; }
.btn:hover { text-decoration: none; border-color: var(--accent); color: var(--text); }
.titlebar { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; }
.note { margin: 0; font-size: 14px; color: var(--muted); max-width: 760px; }
.err { background: var(--card); border: 1px solid var(--warm); border-radius: 8px; padding: 16px 18px; }

/* Bottom shortcut rail */
footer.rail-wrap { position: sticky; bottom: 0; background: var(--card); border-top: 1px solid var(--line); }
.rail { padding-top: 8px; padding-bottom: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; font-size: 13px; color: var(--muted); }
.rail span, .rail button { display: inline-flex; gap: 4px; align-items: center; }
.rail button { border: 0; background: none; padding: 0; cursor: pointer; color: var(--muted); font-size: 13px; }
.rail .status { margin-left: auto; font: 12px var(--mono); }

/* Shortcuts dialog */
.shade { position: fixed; inset: 0; background: var(--shade); z-index: 10; }
.dialog { position: fixed; z-index: 11; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(880px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; background: var(--card); border-radius: 10px; border: 1px solid var(--line); padding: 22px 24px; display: flex; flex-direction: column; gap: 18px; }
.dialog .titled span { font-size: 13px; color: var(--faint); }
.dialog .close { margin-left: auto; border: 1px solid var(--input); background: var(--card); border-radius: 6px; height: 32px; padding: 0 10px; cursor: pointer; display: inline-flex; gap: 8px; align-items: center; }
.groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px 28px; }
.groups h3 { font-size: 13px; color: var(--faint); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.groups .k { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px solid var(--row); font-size: 14px; }
.groups .k span:last-child { display: flex; gap: 4px; }
.toast { position: fixed; left: 50%; bottom: 56px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 6px 12px; border-radius: 6px; font-size: 13px; z-index: 12; }


/* Files: library, search, list and preview, filling the window */
body[data-page="browse"] { height: 100vh; min-height: 0; overflow: hidden; }
main.files-main { max-width: none; padding: 0; gap: 0; min-height: 0; }
body[data-page="browse"] .bar, body[data-page="browse"] .rail { max-width: none; padding-left: 20px; padding-right: 20px; }
.flist .nm a { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.flist td:first-child { max-width: 0; width: 55%; }
.files { flex: 1; min-height: 0; display: grid; grid-template-columns: 212px minmax(0, 1fr); }
.lib { background: var(--card); border-right: 1px solid var(--line); padding: 10px 8px; display: flex; flex-direction: column; gap: 1px; overflow-y: auto; font-size: 14px; }
.lib .h { font-size: 12px; color: var(--faint); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; padding: 12px 10px 4px; }
.lib .h:first-child { padding-top: 4px; }
.lib a { display: flex; align-items: center; gap: 10px; min-height: 30px; padding: 0 10px; border-radius: 6px; color: var(--text); }
.lib a:hover { background: var(--row); text-decoration: none; }
.lib a[aria-current] { background: var(--sel); font-weight: 600; }
.lib a svg { flex: none; }
.lib .n { margin-left: auto; font-size: 12px; color: var(--faint); font-weight: 400; }
.fmain { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.fbar, .fsearch, .fchips { background: var(--card); padding-left: 20px; padding-right: 20px; }
.fbar { padding-top: 10px; display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; }
.fcrumbs { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.seg { display: flex; border: 1px solid var(--input); border-radius: 7px; overflow: hidden; }
.seg button { border: 0; background: var(--card); height: 30px; min-width: 34px; padding: 0 8px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--sel); color: var(--accent-dark); }
.fsearch { padding-top: 10px; display: flex; }
.sbox { flex: 1; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 8px 0 12px; border: 1px solid var(--input); border-radius: 8px; background: var(--card); min-width: 0; }
.sbox:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--sel); }
.sbox > svg { color: var(--muted); flex: none; }
.sbox input { flex: 1; height: 36px; border: 0; outline: none; padding: 0; font: inherit; font-size: 14px; background: none; color: var(--text); min-width: 0; }
.sbox kbd { color: var(--muted); }
.scope:empty { display: none; }
.scope .pill { height: 26px; font-size: 12px; padding: 0 8px; }
.pill.on { display: inline-flex; align-items: center; gap: 4px; background: var(--sel); border-color: var(--accent); color: var(--accent-dark); }
.pill.on button { border: 0; background: none; color: inherit; cursor: pointer; font-size: 15px; padding: 0 0 0 4px; }
.fchips { padding-top: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.fchips .chips { flex: 1 1 400px; }
.fchips .pill { height: 28px; }
.fchips select, .fchips .flip { height: 30px; font-size: 13px; }
.fchips .flip { width: 30px; }
.deep input { margin: 0; }
.fbody { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.files[data-ly="list"] .fbody { grid-template-columns: minmax(0, 1fr) 360px; }
.files[data-ly="file"] .fbody { grid-template-columns: 300px minmax(0, 1fr); }
.files[data-ly="file"] .flist .k, .files[data-ly="file"] .flist .pc, .files[data-ly="file"] .flist .w { display: none; }
.flist { overflow: auto; background: var(--card); border-right: 1px solid var(--line); outline: none; min-height: 0; }
.flist table td { vertical-align: middle; padding: 5px 8px; }
.flist table th { position: sticky; top: 0; background: var(--card); z-index: 1; }
.flist tbody tr { cursor: pointer; }
.flist tbody tr:hover td { background: var(--row); }
.flist tbody tr[aria-selected="true"] td { background: var(--sel); }
.flist td.w { font-size: 13px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flist .nm { align-items: center; }
.th { width: 36px; height: 27px; border-radius: 4px; object-fit: cover; flex: none; background: var(--row); }
.th.ic { display: flex; align-items: center; justify-content: center; background: none; }
.pad { padding: 16px 20px; margin: 0; }
.pad2 { padding: 0 16px 12px; display: flex; flex-direction: column; gap: 8px; }
.flist .foot { padding: 10px 16px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 12px; padding: 8px 16px 14px; }
.gh { padding: 14px 16px 0; font-size: 13px; font-weight: 500; }
.gh a { color: var(--text); }
.tile { border: 0; padding: 0; background: none; cursor: pointer; display: flex; flex-direction: column; gap: 4px; text-align: left; font: inherit; color: var(--text); min-width: 0; }
.tt { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; background: var(--row); display: block; }
.tt.ic { display: flex; align-items: center; justify-content: center; }
.tt.ic svg { width: 34px; height: 34px; }
.tile[aria-selected="true"] .tt { outline: 3px solid var(--accent); outline-offset: 2px; }
.tn { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree { padding: 6px 8px; }
.tr, .ci { display: flex; align-items: center; gap: 6px; min-height: 30px; padding-right: 10px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.tr:hover, .ci:hover { background: var(--row); }
.tr[aria-selected="true"], .ci[aria-selected="true"] { background: var(--sel); }
.tr .th { width: 24px; height: 18px; }
.tw { border: 0; background: none; width: 16px; padding: 0; color: var(--faint); cursor: pointer; font-size: 12px; flex: none; }
.tnm { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr .n, .ci .n { font-size: 12px; color: var(--faint); }
.cols { display: flex; height: 100%; overflow-x: auto; }
.col { flex: none; width: 190px; border-right: 1px solid var(--line); overflow-y: auto; padding: 6px; }
.col:last-child { flex: 1 0 220px; }
.ci svg { flex: none; }
.fprev { background: var(--card); display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
.ph { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.ph strong { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ib { height: 28px; width: 28px; border: 1px solid var(--input); border-radius: 6px; background: var(--card); color: var(--text); cursor: pointer; flex: none; }
.btn.sm { height: 28px; font-size: 13px; padding: 0 10px; }
.stage { flex: 1 0 280px; min-height: 280px; background: #15171C; display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; }
.stage img, .stage video { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.stage video { width: 100%; }
.stage iframe { width: 100%; height: 100%; min-height: 420px; border: 0; background: #FFFFFF; }
.stage:has(> .book) { flex-basis: 560px; }
.stage .book { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.stage .bkbar { display: flex; gap: 6px; align-items: center; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.stage .bkbar select { flex: 1; min-width: 0; height: 28px; }
.stage .bkbar .ib:disabled { opacity: .4; cursor: default; }
.stage .book iframe { flex: 1; height: auto; }
.stage[data-kind="text"], .stage[data-kind="code"], .stage[data-kind="doc"], .stage[data-kind="page"] { background: var(--card); align-items: stretch; flex-direction: column; justify-content: flex-start; }
.stage[data-kind="other"], .stage[data-kind="archive"], .stage[data-kind="disk"] { flex-direction: column; align-items: stretch; justify-content: flex-start; }
.stage > .faint { color: #9AA1AD; }
.stage .none { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 24px; text-align: center; color: #C9CDD5; font-size: 14px; max-width: 420px; }
.stage[data-kind="text"] .none, .stage[data-kind="code"] .none, .stage[data-kind="doc"] .none, .stage[data-kind="page"] .none { color: var(--muted); align-self: center; }
.stage .none code { color: inherit; }
.stage .none svg { width: 40px; height: 40px; }
.stage audio { width: 300px; max-width: 100%; }
pre.code, pre.hex { margin: 0; padding: 12px 16px; font: 12px/1.6 var(--mono); overflow: auto; flex: 1; width: 100%; color: var(--text); background: var(--card); white-space: pre; }
pre.hex { color: #C9CDD5; background: none; }
pre.code code { counter-reset: ln; }
pre.code.wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
/* wrapped lines are blocks; the newlines between them must not add lines */
pre.code.wrap code { white-space: normal; }
pre.code.wrap code span { display: block; min-height: 1.6em; white-space: pre-wrap; padding-left: 4.5em; text-indent: -4.5em; }
pre.code i { font-style: normal; }
.t-com { color: #6B7280; font-style: italic !important; }
.t-str { color: #0F7B3F; }
.t-num { color: #B45309; }
.t-kw { color: #7C3AED; }
.t-fn { color: #1B5FD6; }
.t-key { color: #9F1239; }
.t-tag { color: #1B5FD6; }
.t-attr { color: #B45309; }
@media (prefers-color-scheme: dark) {
  .t-com { color: #8B93A1; } .t-str { color: #7FD99A; } .t-num { color: #F5B26B; } .t-kw { color: #C4A5FF; }
  .t-fn { color: #8CB4FF; } .t-key { color: #FF9EB5; } .t-tag { color: #8CB4FF; } .t-attr { color: #F5B26B; }
}
pre.code code span { counter-increment: ln; }
pre.code code span::before { content: counter(ln); display: inline-block; width: 3.5em; margin-right: 1em; text-align: right; color: var(--faint); user-select: none; }
/* viewers.js: documents, tables, listings, code that runs */
.stage:has(> .vbody), .stage:has(> .vtable), .stage:has(> .vbar), .stage:has(> .runout) { background: var(--card); align-items: stretch; flex-direction: column; justify-content: flex-start; overflow: auto; }
.stage:has(> .vbody), .stage:has(> .vtable) { flex-basis: 420px; }
.vbar { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--card); position: sticky; top: 0; z-index: 1; }
.vbar .pill { height: 28px; }
.vbar.run { order: -1; }
.btn.sm { height: 28px; font-size: 13px; padding: 0 10px; }
.vbody { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
.vbody.doc { display: block; padding: 16px 22px 40px; font-size: 15px; line-height: 1.6; color: var(--text); max-width: 52em; }
.vbody.doc img { max-width: 100%; }
.vbody.doc pre.code { margin: 8px 0; border: 1px solid var(--line); border-radius: 6px; flex: none; white-space: pre-wrap; }
.vbody.doc pre.code code span::before, .runout pre.code code span::before, .cell pre.code code span::before { content: none; }
.vbody.doc table { width: auto; margin: 10px 0; }
.vbody.doc td, .vbody.doc th { border: 1px solid var(--line); }
.vbody.doc blockquote { margin: 8px 0; padding: 0 14px; border-left: 3px solid var(--line); color: var(--muted); }
.vbody.doc code { font-size: 90%; background: var(--row); padding: 1px 4px; border-radius: 3px; }
.vbody.doc pre code { background: none; padding: 0; }
.vbody .cell { margin: 0 0 14px; }
.vbody .cell.md { padding: 0 2px; }
.vbody pre.code.out { background: var(--bg); }
.vbody .slide { border: 1px solid var(--line); border-radius: 8px; padding: 10px 16px; margin: 0 0 12px; }
.vbody .slide h3 { margin: 4px 0 6px; }
.vtable { overflow: auto; flex: 1; min-height: 0; }
.vtable table { font-size: 13px; }
.vtable td { white-space: nowrap; max-width: 28em; overflow: hidden; text-overflow: ellipsis; padding: 4px 8px; }
.vtable td.r, .vtable th.r { text-align: right; }
.stage > .faint.pad, .stage > .muted.pad { color: var(--muted); padding: 10px 14px; margin: 0; }
.runout { border-top: 1px solid var(--line); max-height: 45%; overflow: auto; flex: none; }
.runout pre.code { white-space: pre-wrap; }
.runout .o-err { color: var(--warm); }
.runout .o-note { color: var(--faint); font-style: italic; }
.stage iframe.runner { display: none; }
.stage .cover { width: 220px; height: 220px; object-fit: cover; border-radius: 6px; }
.tt.txt { display: block; padding: 8px 9px; font: 7px/1.35 var(--mono); color: var(--muted); background: var(--card); border: 1px solid var(--line); white-space: pre; overflow: hidden; text-align: left; }
.tile, .nm, .tr { position: relative; }
.partial { font: 10px/14px var(--sans); color: var(--warm); border: 1px solid var(--warm); border-radius: 3px; padding: 0 3px; background: var(--card); }
.tile .partial { position: absolute; top: 6px; left: 6px; }
.stage.folder { flex: 0 0 auto; min-height: 0; background: var(--card); padding: 12px 16px 0; }
.mosaic { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; width: 100%; }
.mosaic img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 4px; }
.facts2 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--row); }
.facts2 span { display: block; font-size: 12px; color: var(--faint); }
.facts2 b { font-weight: 600; font-size: 15px; }
.facts.dl { padding: 12px 16px 16px; font-size: 13px; grid-template-columns: 64px minmax(0, 1fr); }
.places { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.places a, .places details a { display: block; overflow-wrap: anywhere; }
.places summary { cursor: pointer; }
.legend.sm { font-size: 13px; gap: 4px 14px; }
/* Posts: a Bluesky account */
.at-profile { overflow: hidden; gap: 10px; }
.at-banner { margin: -20px -22px 0; height: 180px; background: linear-gradient(120deg, #1185FE33, #1185FE11); }
.at-banner-img { width: 100%; height: 180px; object-fit: cover; display: block; }
.at-who { display: flex; gap: 18px; align-items: flex-end; }
.at-names { min-width: 0; padding-bottom: 4px; }
.at-avatar { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; border: 4px solid var(--card); background: var(--row); flex: none; margin-top: -48px; display: flex; align-items: center; justify-content: center; }
.at-counts { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 14px; color: var(--muted); }
.at-counts b { color: var(--text); }
.at-bio { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.at-held { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 18px; margin: 0; font-size: 14px; }
.at-held dt { color: var(--faint); }
.at-held dd { margin: 0; overflow-wrap: anywhere; }
.at-held .warn { color: var(--warm); }
.at-cols { display: grid; grid-template-columns: minmax(0, 680px) minmax(0, 1fr); gap: 24px; align-items: start; }
.at-side { position: sticky; top: 16px; }
.at-side .at-held { grid-template-columns: minmax(0, 1fr); gap: 2px; }
.at-side .at-held dd { margin-bottom: 10px; }
@media (max-width: 1000px) { .at-cols { grid-template-columns: minmax(0, 1fr); } .at-side { position: static; order: -1; } }
.at-feedcard { padding-top: 0; gap: 0; }
.at-tabs { display: flex; border-bottom: 1px solid var(--line); margin: 0 -22px 12px; padding: 0 12px; overflow-x: auto; }
.at-tabs button { border: 0; background: none; padding: 14px 14px 12px; cursor: pointer; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; }
.at-tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: #1185FE; }
.at-tabs .n { font-weight: 400; color: var(--faint); font-size: 13px; }
.at-feedcard .filter { margin-bottom: 4px; flex: none; }
.at-feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.at-feed > li { border-bottom: 1px solid var(--line); }
.at-post { display: flex; gap: 12px; padding: 14px 0; scroll-margin-top: 80px; position: relative; }
.at-post.line { padding-bottom: 6px; }
.at-post.line .at-left::after { content: ''; position: absolute; left: 21px; top: 62px; bottom: 0; width: 2px; background: var(--line); }
.at-post.focus .at-text.big { font-size: 18px; line-height: 1.45; }
.at-left { flex: none; }
.at-av { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--row); display: flex; align-items: center; justify-content: center; }
.at-av.sm { width: 18px; height: 18px; }
.at-av.sm svg { width: 12px; }
.at-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.at-head { display: flex; flex-wrap: wrap; gap: 2px 6px; align-items: baseline; min-width: 0; }
.at-head .faint { font-size: 14px; }
.at-time::before { content: '·'; margin-right: 6px; color: var(--faint); }
.at-ctx { font-size: 13px; margin-top: -4px; }
.at-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.at-media { display: grid; gap: 4px; grid-template-columns: repeat(2, minmax(0, 1fr)); border-radius: 10px; overflow: hidden; max-height: 520px; }
.at-media.n1 { grid-template-columns: minmax(0, 1fr); max-width: 100%; }
.at-media.n3 { grid-template-rows: 1fr 1fr; }
.at-media.n3 .at-img:first-child { grid-row: span 2; }
.at-img { width: 100%; height: 100%; min-height: 120px; max-height: 520px; object-fit: cover; background: var(--row); display: block; cursor: zoom-in; }
.at-media.n1 .at-img { height: auto; object-fit: contain; min-height: 0; }
.at-media .noblob, .at-avatar.noblob { display: flex; align-items: center; justify-content: center; }
.at-video { width: 100%; max-height: 560px; border-radius: 10px; background: #000; }
.at-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; color: var(--text); }
.at-card:hover { text-decoration: none; border-color: var(--accent); color: var(--text); }
.at-card > span { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; min-width: 0; }
.at-card .at-desc { font-size: 14px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.at-thumb { width: 100%; max-height: 300px; aspect-ratio: 1.91; object-fit: cover; display: block; border-bottom: 1px solid var(--line); }
.at-quote { display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--text); }
.at-quote:hover { text-decoration: none; border-color: var(--accent); color: var(--text); }
.at-quote .at-media { max-height: 200px; }
.at-quote .at-head { align-items: center; }
.at-foot { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.at-links { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.at-more { padding: 14px 0; }
.at-thread { max-width: 680px; gap: 0; }
.at-thread .titled { margin-bottom: 6px; }
.at-thread .at-post { border-bottom: 0; }
.at-thread .at-post.focus { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.at-replies { font-size: 15px; margin: 14px 0 0; }
.at-reply { border-bottom: 1px solid var(--row); }
.at-coll { margin-top: 4px; }
.at-coll summary { cursor: pointer; padding: 4px 0; }
.at-rec pre.code { margin: 4px 0 10px; border-radius: 6px; background: var(--row); max-height: 320px; }
.at-lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, .88); z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; cursor: zoom-out; padding: 24px; }
.at-lightbox img { max-width: 100%; max-height: calc(100vh - 100px); object-fit: contain; }
.at-lightbox p { color: #ddd; max-width: 720px; margin: 0; font-size: 14px; }

@media (max-width: 900px) {
  body[data-page="browse"] { height: auto; overflow: visible; }
  .files { grid-template-columns: minmax(0, 1fr); }
  .lib { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; }
  .lib .h { display: none; }
  .lib a { white-space: nowrap; }
  .lib .n { margin-left: 6px; }
  .fbody, .files[data-ly] .fbody { grid-template-columns: minmax(0, 1fr); }
  .flist { max-height: 60vh; border-right: 0; }
  .fbar, .fsearch, .fchips { padding-left: 16px; padding-right: 16px; }
  .stage { min-height: 240px; }
  .flist .k, .flist .pc, .fbar .seg.ly { display: none; }
}
@media (max-width: 600px) {
  .flist .w { display: none; }
}

/* Phone */
@media (max-width: 700px) {
  .bar { gap: 12px; padding-left: 16px; padding-right: 16px; }
  nav.pages { margin-left: auto; gap: 16px; }
  form.search { flex: 1 1 100%; margin-left: 0; min-width: 0; }
  form.search kbd { display: none; }
  main { padding: 20px 16px 28px; gap: 20px; }
  h1 { font-size: 24px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat .v { font-size: 20px; }
  .card { padding: 16px; }
  .hide-sm { display: none; }
  footer.rail-wrap { display: none; }
  .pmap { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .actions { margin-left: 0; }
}
/* shortened CIDs: click to show all of one, the icon next to it copies it */
.cidx { font: 12px/1.5 var(--mono); color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline dotted var(--faint); text-underline-offset: 3px; text-align: left; }
.cidx:hover { color: var(--text); }
.cidx.open { overflow-wrap: anywhere; white-space: normal; }
.cpy { background: none; border: 0; padding: 0 2px; margin-left: 4px; color: var(--faint); cursor: pointer; vertical-align: -2px; }
.cpy:hover { color: var(--accent, var(--text)); }
.crumbs .cidx { font-size: inherit; }
.fcid { margin-left: 10px; color: var(--muted); }
.fcid a { margin-left: 6px; }
/* PDFs: frames laid over the stage; only the one showing is visible */
.fprev { position: relative; }
.fprev .pv { display: contents; }
.deck { position: absolute; left: 0; right: 0; top: 0; height: 0; pointer-events: none; z-index: 1; }
.deck iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #FFFFFF; visibility: hidden; }
.deck iframe.on { visibility: visible; pointer-events: auto; }
/* Content: posts, accounts and the Bluesky App viewer */
.fapp { overflow-y: auto; min-width: 0; min-height: 0; padding: 24px 28px 40px; display: flex; flex-direction: column; gap: 24px; }
.fapp > * { flex-shrink: 0; } /* a long list of posts must not squash the profile card above it */
.stage[data-kind="post"], .stage[data-kind="account"] { background: var(--card); display: block; overflow: auto; flex-basis: 420px; }
.stage[data-kind="post"] .at-thread { padding: 4px 16px 12px; display: flex; flex-direction: column; }
.stage[data-kind="post"] img, .stage[data-kind="account"] img { max-height: none; }
.stage[data-kind="post"] .at-img { max-height: 520px; object-fit: cover; }
.stage[data-kind="post"] .at-media.n1 .at-img { object-fit: contain; }
.stage[data-kind="post"] .at-av, .stage[data-kind="account"] .at-avatar { object-fit: cover; }
.stage.acct .at-profile { padding: 20px 22px 12px; display: flex; flex-direction: column; }
.stage.acct .pad2 { padding-top: 4px; }
.tt.ptxt { display: block; padding: 10px 11px; font-size: 12px; line-height: 1.4; color: var(--text); background: var(--card); border: 1px solid var(--line); overflow: hidden; text-align: left; white-space: normal; overflow-wrap: anywhere; }
.th.av, .tt.av { border-radius: 50%; }
.tt.av { width: 70%; margin: 0 auto; aspect-ratio: 1; }
.ctable td:first-child a { display: inline-flex; align-items: center; gap: 8px; }
.ctable td.r, .ctable th.r { text-align: right; white-space: nowrap; }
/* Full screen: the pane's header and stage fill the screen; the facts go */
.fprev.full { position: fixed; inset: 0; z-index: 60; overflow: hidden; width: auto; height: auto; }
.fprev.full .facts2, .fprev.full .facts, .fprev.full .pv > :not(.ph):not(.stage) { display: none; }
.fprev.full .stage { flex: 1 1 auto; min-height: 0; }
.fprev.full .stage iframe { min-height: 0; }
.fprev.full .stage.folder { flex: 0 0 auto; }
.ib.fs { display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.fprev.full .stage > img, .fprev.full .stage > video { width: 100%; height: 100%; }
/* A .gz file's preview: what it unpacks to, or its bytes (viewers.js) */
.gzin { display: flex; flex-direction: column; flex: 1 0 auto; min-height: 0; }
.gzin > .stage { flex: 1 0 280px; }
.gzin pre.hex { color: var(--text); }
/* Git viewer */
.at-tabs a.git-tab { padding: 14px 14px 12px; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; text-decoration: none; }
.at-tabs a.git-tab[aria-selected="true"] { color: var(--text); border-bottom-color: #F05133; }
.git-head h1 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 22px; }
.git-ref { height: auto; padding: 1px 8px; font-size: 12px; cursor: default; display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.git-ref.tag { border-style: dashed; }
.git-log td.mono a, .git-log .mono { font-size: 13px; }
.git-log .nowrap { white-space: nowrap; }
.git-subject { margin: 8px 0 12px; font-size: 18px; }
.git-main { overflow-x: auto; }
.git-log { table-layout: fixed; }
.git-log td { overflow-wrap: anywhere; }
.git-log.commits td:nth-child(1) { width: 110px; }
.git-log.commits td:nth-child(3) { width: 18%; }
.git-log.refs td:nth-child(1) { width: 30%; }
.git-log.refs td:nth-child(2) { width: 110px; }
.git-log td.nowrap { width: 110px; }
.git-log a .git-ref { cursor: pointer; }
.git-log.snaps td:nth-child(1) { width: 40px; }
.git-crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 12px; font-weight: 600; }
.git-files { display: grid; grid-template-columns: minmax(220px, 2fr) minmax(0, 3fr); gap: 16px; align-items: start; }
.git-files:has(> .git-file[hidden]) { grid-template-columns: 1fr; }
.git-tree { min-width: 0; }
.git-log.tree td:nth-child(2) { width: 34%; }
.git-log.tree a { display: inline-flex; gap: 6px; align-items: center; }
.git-log.tree svg { flex: none; }
.git-log.tree tr[aria-current="true"] td { background: var(--row); }
.git-file { min-width: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--card); overflow: auto; display: flex; flex-direction: column; position: sticky; top: 0; max-height: calc(100vh - 140px); }
.git-file[hidden] { display: none; }
.git-main:has(.git-files) { overflow: visible; }
.git-file .stage { min-height: 360px; flex-shrink: 0; }
.git-note { margin-top: 12px; font-size: 12px; }
@media (max-width: 800px) { .git-files { grid-template-columns: 1fr; } }
/* A web page or site ends in a line, as it starts under the header. */
.stage[data-kind="page"], .stage[data-kind="site"] { border-bottom: 1px solid var(--line); }
/* Library > Web sites: site lists, then other archives */
.flist tr.grp th { position: static; text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 14px 8px 6px; background: none; }
/* Viewers: where you are, and Bluesky's accounts to choose from */
.app-crumbs { font-size: 15px; align-items: center; margin: 0 0 14px; }
.app-crumbs a, .app-crumbs span { display: inline-flex; align-items: center; gap: 6px; }
.app-crumbs [aria-current] { font-weight: 600; }
.at-accts { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.card.at-acct { display: flex; flex-direction: column; gap: 6px; padding: 0 0 14px; overflow: hidden; color: inherit; text-decoration: none; margin: 0; }
.card.at-acct:hover { border-color: var(--accent); text-decoration: none; color: inherit; }
.at-acct-banner { height: 84px; background: linear-gradient(120deg, #1185FE55, #1185FE18) center / cover no-repeat; }
.at-acct-av { width: 64px; height: 64px; border-radius: 50%; margin: -32px 0 0 16px; border: 3px solid var(--card); background: var(--card); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.at-acct-av img { width: 100%; height: 100%; object-fit: cover; }
.at-acct-av svg { width: 34px; height: 34px; }
.at-acct-names { display: flex; flex-direction: column; padding: 0 16px; line-height: 1.3; }
.at-acct-names b { font-size: 17px; }
.at-acct-bio { padding: 0 16px; font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.at-acct-stats { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 0 16px; font-size: 13px; color: var(--muted); }
.at-acct-stats b { color: var(--text); }
.at-acct-foot { padding: 0 16px; }
/* Git viewer: the repos by owner, a ref and commit to look at, short ids that open */
.git-orgs { display: flex; flex-direction: column; gap: 22px; }
.git-org > .titled { margin: 0 2px 10px; }
.git-org > .titled h2 a { color: var(--text); }
.git-org.on > .titled h2 a { color: var(--accent); }
.git-repos { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.card.git-repo { gap: 6px; padding: 14px 16px; margin: 0; color: inherit; text-decoration: none; }
.card.git-repo:hover { border-color: #F05133; text-decoration: none; color: inherit; }
.git-org.on .card.git-repo { border-color: #F0513380; }
.git-repo-name { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.git-repo-url { overflow-wrap: anywhere; }
.git-repo-stats { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); }
.git-repo-stats b { color: var(--text); }
.app-view-at { display: flex; align-self: center; }
.app-view-at:empty { display: none; }
/* A viewer's home as a list: one row per account or repo */
.app-list { background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; }
.app-table td { vertical-align: middle; padding: 9px 12px; }
.app-table th { padding: 10px 12px; position: sticky; top: 0; background: var(--card); }
.app-table tbody tr { cursor: pointer; }
.app-table tbody tr:last-child td { border-bottom: 0; }
.app-table tbody tr:hover td, .app-table tbody tr:focus-within td { background: var(--sel); }
.app-table td.r { font-variant-numeric: tabular-nums; }
.app-table a.app-main { color: inherit; text-decoration: none; outline: none; }
.app-table .nowrap { white-space: nowrap; }
.at-row-name { display: flex; align-items: center; gap: 12px; min-width: 260px; }
.at-row-name > span:last-child { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.at-row-av { width: 40px; height: 40px; border-radius: 50%; flex: none; overflow: hidden; display: flex; align-items: center; justify-content: center; background: #1185FE14; }
.at-row-av img { width: 100%; height: 100%; object-fit: cover; }
.at-row-av svg { width: 22px; height: 22px; }
.at-row-bio { font-size: 13px; color: var(--muted); max-width: 46ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-table tbody tr:hover .at-row-name b { color: #1185FE; }
.git-row-name { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.git-row-name > span { display: flex; flex-direction: column; line-height: 1.3; }
.git-row-name .git-repo-url { font-size: 12px; }
.app-table tbody tr:hover .git-row-name b { color: #F05133; }
.git-owner { white-space: nowrap; font-size: 13px; width: 1%; }
.git-owner a { color: var(--muted); }
.app-table tr.git-org-start td { border-top: 1px solid var(--line); }
.app-table tr.on td { background: #F051330F; }
.git-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 2px 0 12px; }
.git-tools .filter { flex: 1 1 220px; margin: 0; max-width: 520px; }
.git-sel { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.git-sel select { height: 34px; max-width: 220px; }
.git-sel input { height: 34px; font: 13px var(--mono); padding: 0 8px; border: 1px solid var(--input); border-radius: 6px; background: var(--card); color: var(--text); width: 13ch; }
.git-commitcard { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); padding: 10px 14px; margin: 0 0 12px; }
.git-cc-subject { font-weight: 600; overflow-wrap: anywhere; }
.hx { display: inline-flex; align-items: baseline; gap: 2px; }
.hxb { border: 0; background: none; padding: 0 3px; color: var(--faint); cursor: pointer; font-size: 12px; line-height: 1; border-radius: 3px; }
.hxb:hover { background: var(--row); color: var(--text); }
.git-log.refs td:nth-child(2) { width: 60px; }
.git-log.refs td:nth-child(3) { width: 130px; }
.git-log.commits td:nth-child(1) { width: 130px; }
.git-log.remotes td:nth-child(1) { width: 120px; }
.git-log.remotes td:nth-child(3) { width: 130px; }
