:root {
  --bg: #0f1115;
  --panel: #171a21;
  --tile: #1e222b;
  --line: #2a2f3a;
  --text: #e9ecf1;
  --muted: #9aa3b2;
  --accent: #5b8cff;
  --accent-ink: #fff;
  --radius: 10px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
a { color: inherit; }
button { font: inherit; cursor: pointer; }
code { background: var(--tile); padding: 1px 6px; border-radius: 5px; }

/* header */
.top { position: sticky; top: 0; z-index: 10; display: flex; gap: 16px; align-items: center;
  padding: 12px 20px; background: rgba(15,17,21,.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; text-decoration: none; white-space: nowrap; }
.search { display: flex; flex: 1; max-width: 640px; gap: 8px; }
.qwrap { position: relative; flex: 1; min-width: 0; display: flex; }
.search input { flex: 1; min-width: 0; padding: 10px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text); outline: none; }
.search input:focus { border-color: var(--accent); }
.search > button, .btn { padding: 9px 18px; border-radius: 999px; border: 0;
  background: var(--accent); color: var(--accent-ink); font-weight: 600; text-decoration: none;
  display: inline-block; }
.ghost { background: transparent !important; color: var(--text) !important;
  border: 1px solid var(--line) !important; padding: 7px 14px; border-radius: 999px; }
.ghost:hover { border-color: var(--muted) !important; }

/* live lookup dropdown */
.suggest { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 20;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 6px;
  box-shadow: 0 12px 32px rgba(0,0,0,.45); max-height: 70vh; overflow-y: auto; }
.sg-label { padding: 6px 10px 4px; font-size: 12px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .05em; }
.sg-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border: 0;
  border-radius: 10px; background: transparent; color: var(--text); text-align: left; }
.sg-row.active, .sg-row:hover { background: var(--tile); }
.sg-row img { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; flex: none; background: var(--tile); }
.sg-row.small img { width: 32px; height: 32px; border-radius: 8px; }
.sg-text { min-width: 0; flex: 1; }
.sg-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-go { color: var(--accent); font-size: 13px; font-weight: 600; flex: none; }
.sg-msg { display: flex; align-items: center; gap: 10px; padding: 10px; color: var(--muted); }
.sg-msg.bad { color: #ffb3b3; }
.sg-x { border: 0; background: transparent; color: var(--muted); padding: 4px 8px; border-radius: 6px; flex: none; }
.sg-x:hover { color: var(--text); background: var(--line); }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* menu (top right) */
.menuwrap { position: relative; margin-left: auto; flex: none; }
.menubtn { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text); }
.menubtn:hover, .menubtn[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
.menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: 290px; padding: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0,0,0,.45); }
.menu a { display: block; padding: 10px 12px; border-radius: 10px; text-decoration: none; font-weight: 600; }
.menu a small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }
.menu a:hover { background: var(--tile); }
.menu a.current { background: var(--tile); box-shadow: inset 3px 0 0 var(--accent); }

.menubtn { position: relative; }
.menubtn.signed::after { content: ""; position: absolute; top: 6px; right: 6px; width: 8px; height: 8px;
  border-radius: 50%; background: #3ddc84; box-shadow: 0 0 0 2px var(--panel); }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.acct { padding: 2px 0; }
.acct-who { padding: 8px 12px 6px; }
.acct-who small, .acct-note { display: block; color: var(--muted); font-size: 13px; }
.acct-note { padding: 8px 12px; }
.acct-btn { margin: 2px 12px 8px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: transparent; color: var(--text); }
.acct-btn:hover { border-color: var(--muted); }
.menu a.acct-signin { color: var(--accent); }

/* link downloader */
.dl-hero { max-width: 760px; margin: 0 auto; padding: 8vh 0 8px; text-align: center; }
.dl-hero h1 { font-size: 28px; margin: 0 0 6px; }
.dl-hero > p { color: var(--muted); margin: 0 0 20px; }
.dlform { display: flex; gap: 8px; }
.dlform input { flex: 1; min-width: 0; padding: 13px 18px; border-radius: 999px; font-size: 16px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text); outline: none; }
.dlform input:focus { border-color: var(--accent); }
.dlform button { padding: 12px 22px; border-radius: 999px; border: 0; background: var(--accent);
  color: var(--accent-ink); font-weight: 600; }
.dl-status { min-height: 1.5em; margin: 14px 0 0; color: var(--muted); display: flex; gap: 10px;
  justify-content: center; align-items: center; }
.dl-status.bad { color: #ffb3b3; }
.dl-result { max-width: 1100px; margin: 8px auto 0; }
.dl-head { display: flex; align-items: center; gap: 12px; padding: 16px 0 6px; border-top: 1px solid var(--line); }
.dl-head img { width: 48px; height: 48px; border-radius: 12px; background: var(--tile); flex: none; }
.dl-headtext { flex: 1; min-width: 0; }
.dl-blog { font-weight: 700; text-decoration: none; cursor: pointer; }
.dl-blog:hover { color: var(--accent); }
.dl-meta { color: var(--muted); font-size: 13px; }
.dl-meta a { color: var(--accent); text-decoration: none; cursor: pointer; }
.dl-summary { color: var(--muted); margin: 4px 0 12px; max-height: 4.5em; overflow: auto; }
.dl-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0 14px; }
.dl-bar .btn:disabled { opacity: .5; cursor: not-allowed; }
.dl-check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.dl-check input { width: 18px; height: 18px; accent-color: var(--accent); }
.dl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.dl-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  display: flex; flex-direction: column; }
.dl-card.off { opacity: .55; }
.dl-media { background: #000; display: grid; place-items: center; aspect-ratio: 4 / 3; }
.dl-media img, .dl-media video { width: 100%; height: 100%; object-fit: contain; display: block; }
.dl-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; }
.dl-row .btn { padding: 6px 14px; font-size: 14px; }
.dl-ext { padding: 10px 12px; color: var(--muted); font-size: 14px; }
.dl-ext a { color: var(--accent); }
.empty-hint { margin-top: 18px; font-size: 14px; }
.empty-hint a { color: var(--accent); }

main { max-width: 1400px; margin: 0 auto; padding: 0 20px 60px; }

.notice { max-width: 1400px; margin: 16px auto 0; padding: 12px 16px; border-radius: var(--radius);
  background: #3a2a12; color: #ffd9a0; border: 1px solid #5c4318; }
.notice.error { background: #3a1616; color: #ffb3b3; border-color: #5c2222; }

.empty { text-align: center; padding: 15vh 0; color: var(--muted); }
.empty h1 { color: var(--text); font-size: 28px; margin: 0 0 8px; }

/* profile */
.profile { display: flex; gap: 20px; align-items: center; padding: 28px 0 8px; }
.avatar { width: 96px; height: 96px; border-radius: 16px; background: var(--tile); flex: none; object-fit: cover; }
.profile h2 { margin: 0; font-size: 24px; }
.handle { color: var(--muted); text-decoration: none; }
.handle:hover { text-decoration: underline; }
.desc { margin: 6px 0 0; max-width: 70ch; color: var(--muted); white-space: pre-line; }
.count { margin: 4px 0 0; font-weight: 600; }

/* posts / likes tabs */
.tabs { display: flex; gap: 4px; margin-top: 16px; border-bottom: 1px solid var(--line); }
.tab { border: 0; background: transparent; color: var(--muted); padding: 10px 16px; font-weight: 600;
  border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab:disabled { opacity: .45; cursor: not-allowed; }
.tab-count { color: var(--muted); font-weight: 400; }

/* toolbar */
.toolbar-left { display: flex; gap: 14px; flex-wrap: wrap; }
.filter2 { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: transparent; color: var(--muted); }
.filter2.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tile .rb { position: absolute; top: 8px; right: 8px; padding: 1px 7px; border-radius: 6px;
  background: rgba(0,0,0,.65); color: #fff; font-size: 13px; }
.lb-source { margin: 6px 0 0; font-size: 14px; color: var(--muted); }
.lb-source a { color: var(--accent); text-decoration: none; cursor: pointer; }
.lb-source a:hover { text-decoration: underline; }
.lb-reblogs { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; max-height: 120px; overflow-y: auto; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 999px;
  background: var(--tile); border: 1px solid var(--line); color: var(--text); font-size: 13px; }
.chip:hover { border-color: var(--accent); }
.chip img { width: 22px; height: 22px; border-radius: 50%; }
.lb-reblogs .muted { color: var(--muted); font-size: 13px; }

/* toolbar */
.toolbar { position: sticky; top: 61px; z-index: 5; display: flex; justify-content: space-between;
  align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 0; background: var(--bg); }
.filters { display: flex; gap: 6px; }
.filter { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: transparent; color: var(--muted); }
.filter.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.toolbar-right { display: flex; align-items: center; gap: 12px; }
.loaded { color: var(--muted); font-size: 13px; }

/* grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }
.tile { position: relative; aspect-ratio: 1 / 1; background: var(--tile); border-radius: 6px;
  overflow: hidden; border: 0; padding: 0; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.tile:hover img { transform: scale(1.04); }
.tile .badge { position: absolute; top: 8px; left: 8px; padding: 2px 8px; border-radius: 6px;
  background: rgba(0,0,0,.65); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .03em; }
.tile .play { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.tile .play span { width: 54px; height: 54px; border-radius: 50%; background: rgba(0,0,0,.6);
  display: grid; place-items: center; font-size: 22px; color: #fff; padding-left: 4px; }
.tile .noposter { width: 100%; height: 100%; display: grid; place-items: center; color: var(--muted); }
.tile.hidden { display: none; }

.sentinel { height: 1px; }
.status { text-align: center; color: var(--muted); padding: 24px 0; min-height: 1.5em; }

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(5,6,8,.96);
  display: grid; grid-template-rows: 1fr auto; }
.lightbox[hidden] { display: none; }
.lb-stage { display: grid; place-items: center; min-height: 0; padding: 48px 72px 12px; }
.lb-stage img, .lb-stage video { max-width: 100%; max-height: calc(100vh - 230px); width: auto; height: auto;
  object-fit: contain; border-radius: 4px; }
.lb-stage .external { text-align: center; color: var(--muted); }
.lb-stage .external img { max-height: calc(100vh - 300px); display: block; margin: 0 auto 16px; }
.lb-info { padding: 12px 24px 20px; max-width: 900px; width: 100%; margin: 0 auto; }
.lb-meta { color: var(--muted); font-size: 13px; }
.lb-summary { margin: 6px 0; max-height: 4.5em; overflow: auto; }
.lb-tags { margin: 0 0 12px; color: var(--accent); font-size: 13px; }
.lb-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.lb-close, .lb-nav { position: absolute; border: 0; background: rgba(255,255,255,.08); color: #fff;
  border-radius: 50%; width: 44px; height: 44px; font-size: 22px; line-height: 1; }
.lb-close:hover, .lb-nav:hover { background: rgba(255,255,255,.18); }
.lb-close { top: 14px; right: 16px; }
.lb-nav { top: 45%; font-size: 32px; }
.lb-prev { left: 14px; }
.lb-next { right: 14px; }

@media (max-width: 640px) {
  .top { flex-wrap: wrap; padding: 10px 16px; }
  .search { max-width: none; flex-basis: 100%; order: 3; }
  .menuwrap { order: 2; }
  .menubtn { width: 38px; height: 38px; }
  .dl-hero { padding-top: 4vh; }
  .dlform { flex-direction: column; }
  .dl-bar { position: sticky; top: 106px; background: var(--bg); z-index: 4; }
  main { padding: 0 16px 60px; }
  .toolbar { top: 106px; }
  .grid { grid-template-columns: repeat(3, 1fr); gap: 3px; }
  .profile { gap: 14px; }
  .avatar { width: 64px; height: 64px; }
  .lb-stage { padding: 56px 8px 8px; }
  .lb-nav { top: auto; bottom: 12px; }
}


/* bookmarks */
.tile .savebtn { position: absolute; right: 8px; bottom: 8px; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(0,0,0,.65); color: #fff; font-size: 17px;
  line-height: 1; opacity: 0; transition: opacity .15s; cursor: pointer; }
.tile:hover .savebtn, .tile:focus-visible .savebtn, .tile.saved .savebtn { opacity: 1; }
.tile .savebtn { font-family: "Times New Roman", Georgia, serif; font-size: 19px; }
.tile.saved .savebtn { background: #ffd166; color: #1b1b1b; }
.tile.saved .savebtn:hover { background: #ffdf8a; }
.tile:not(.saved) .savebtn:hover { background: rgba(0,0,0,.85); }
@media (hover: none) { .tile .savebtn { opacity: .85; } }
#lbsave.on { color: #ffd166 !important; border-color: #ffd166 !important; }
.savedhead { margin-top: 20px; }
.savedhead h2 { margin: 0; font-size: 22px; }
.savedhead p { margin: 6px 0 0; color: var(--muted); }
.lb-reblogs .rb-more { padding: 4px 12px; color: var(--accent); }

/* note counts on tiles */
.tile .notes { position: absolute; left: 8px; bottom: 8px; padding: 2px 8px; border-radius: 6px;
  background: rgba(0,0,0,.65); color: #fff; font-size: 12px; font-weight: 600; pointer-events: none; }

/* view options (sort) */
.viewopts { position: relative; }
.viewbtn { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: transparent; color: var(--text); }
.viewbtn b { font-weight: 600; color: var(--accent); }
.viewbtn .chev { display: inline-block; margin-left: 6px; font-size: 17px; line-height: 1; font-weight: 700;
  transition: transform .15s; }
.viewopts.open .chev { transform: rotate(90deg); }
.viewopts.open .viewbtn { border-color: var(--text); }
.viewmenu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 20; min-width: 240px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 6px;
  box-shadow: 0 12px 30px rgba(0,0,0,.45); }
.viewmenu[hidden] { display: none; }
.vopt { display: block; width: 100%; text-align: left; border: 0; background: transparent;
  color: var(--text); padding: 8px 12px; border-radius: 8px; font-weight: 600; }
.vopt small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; margin-top: 2px; }
.vopt:hover { background: var(--tile); }
.vopt.active { color: var(--accent); }
.vopt { position: relative; padding-right: 32px; }
.vopt.active::after { content: "✓"; position: absolute; right: 12px; top: 8px; }

/* ranking progress */
.scanbar { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
  padding: 20px 0 4px; color: var(--muted); text-align: center; }

/* ∇ bookmarks: accounts */
.nablabtn { margin-left: auto; align-self: flex-start; flex: none; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--text); font-weight: 600; }
.nablabtn:hover { border-color: #ffd166; }
.nablabtn.on { background: #ffd166; border-color: #ffd166; color: #1b1b1b; }
.savedhead .tabs { margin-top: 14px; }
.stab { border: 0; background: transparent; color: var(--muted); padding: 10px 16px; font-weight: 600;
  border-bottom: 2px solid transparent; margin-bottom: -1px; }
.stab.active { color: var(--text); border-bottom-color: #ffd166; }
.savedblogs { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; margin-top: 16px; }
.savedblogs[hidden] { display: none; }
.acard { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line); cursor: pointer; min-width: 0; }
.acard:hover, .acard:focus-visible { border-color: var(--accent); outline: none; }
.acard img { width: 52px; height: 52px; border-radius: 10px; flex: none; object-fit: cover; background: var(--tile); }
.acard-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.acard-text b, .acard-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acard-text span { color: var(--muted); font-size: 13px; }
.acard-text small { color: var(--muted); font-size: 12px; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; }
.acard .nablabtn { padding: 4px 10px; font-family: "Times New Roman", Georgia, serif; font-size: 17px; }
@media (max-width: 640px) {
  .profile { flex-wrap: wrap; }
  .profile .nablabtn { margin-left: 0; }
  .savedblogs { grid-template-columns: 1fr; }
  .viewmenu { min-width: 220px; }
}

/* hosted site footer */
.sitefoot { text-align: center; color: var(--muted); font-size: 12px; padding: 24px 16px 32px; }
.sitefoot[hidden] { display: none; }
.sitefoot a, .lb-reblogs .muted a { color: var(--accent); }
