:root {
  --tile-size: 150px; --tile-columns: 3;
  --bg: #0e0f12; --panel: #17191e; --panel2: #1f2229; --line: #2a2e37;
  --text: #e8e9ec; --muted: #8b909c; --accent: #7cc4a4; --accent-ink: #0b1a13; --danger: #e5736b;
  color-scheme: dark;
}
.settings-panel, .feed-panel { position: fixed; inset: 0; z-index: 40; background: var(--bg); }
.settings-panel { overflow-y: auto; overscroll-behavior: contain; }
.panel-bar { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 12px; min-height: 64px; padding: max(10px, env(safe-area-inset-top)) 16px 10px; background: var(--panel); border-bottom: 1px solid var(--line); }
.panel-bar h1 { margin: 0; font-size: 20px; }
.settings-content { max-width: 760px; margin: auto; padding: 16px 18px max(40px, env(safe-area-inset-bottom)); }
.settings-content section { padding: 18px 0 24px; border-bottom: 1px solid var(--line); }
.settings-content h2 { font-size: 19px; margin: 0 0 16px; }
.settings-content section > button { margin: 5px 6px 5px 0; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 52px; padding: 8px 0; }
.setting-row input:not([type=checkbox]), .setting-row select { max-width: 160px; }
.setting-row input[type=checkbox], fieldset input { width: 21px; height: 21px; flex: 0 0 auto; accent-color: var(--accent); }
.setting-row select { padding: 10px; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.settings-content fieldset { border: 1px solid var(--line); border-radius: 10px; margin: 12px 0; display: flex; flex-wrap: wrap; gap: 12px; }
.settings-content fieldset label { display: inline-flex; align-items: center; gap: 5px; }
.settings-content .taste { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.settings-content input { font-size: 16px; }
.feed-panel { display: flex; flex-direction: column; background: #000; }
.feed-bar { position: relative; flex: 0 0 auto; gap: 8px; font-size: 13px; }
.feed-bar #feedSignals { flex: 1; }
.feed-bar button, .feed-bar .btn { padding: 8px; text-decoration: none; }
.feed-cold { position: absolute; top: max(76px, calc(env(safe-area-inset-top) + 60px)); left: 12px; right: 12px; z-index: 2; margin: 0; padding: 9px 12px; background: rgba(20,22,27,.85); border-radius: 8px; font-size: 12px; pointer-events: none; }
.feed-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-anchor: none; scroll-snap-type: y mandatory; overscroll-behavior: contain; scrollbar-width: none; position: relative; }
.feed-post, .feed-tail { height: 100%; min-height: 100%; width: 100%; position: relative; scroll-snap-align: start; scroll-snap-stop: always; overflow: hidden; }
.feed-media { display: block; width: 100%; height: 100%; object-fit: contain; position: relative; opacity: 0; }
.feed-post.media-ready .feed-media { opacity: 1; }
.feed-preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(12px); transform: scale(1.04); opacity: .65; pointer-events: none; }
.feed-loading { position: absolute; top: 0; left: 0; right: 0; height: 3px; overflow: hidden; background: #ffffff25; }
.feed-loading::after { content: ''; display: block; width: 35%; height: 100%; background: var(--accent); animation: feed-loading 1.2s ease-in-out infinite alternate; }
@keyframes feed-loading { to { transform: translateX(190%); } }
.feed-media-error { position: absolute; top: 30%; left: 15%; max-width: 70%; background: var(--panel); }
.feed-tools { position: absolute; right: max(12px, env(safe-area-inset-right)); bottom: max(140px, calc(env(safe-area-inset-bottom) + 120px)); display: grid; gap: 10px; justify-items: end; }
.feed-tools button, .feed-tools .btn { border-radius: 24px; max-width: 145px; font-size: 13px; padding: 11px 12px; background: rgba(25,27,33,.85); text-decoration: none; }
.feed-tools button.on { color: var(--accent); border-color: var(--accent); }
.feed-tools { max-height: calc(100% - 155px); overflow-y: auto; max-width: 180px; }
.feed-stars { display: flex; gap: 0; }
.feed-tools .feed-stars button { font-size: 25px; padding: 5px; min-width: 32px; border: 0; border-radius: 0; }
.feed-save-error { max-width: 170px; color: #ffb7ad; font-size: 12px; background: #181818e6; overflow-wrap: anywhere; }
.feed-save-error:empty { display: none; }
.feed-gif-badge { padding: 3px 7px; border: 1px solid #aaa; border-radius: 4px; font-size: 11px; background: #181818d9; }
.feed-caption { position: absolute; bottom: 0; left: 0; right: 0; padding: 50px 18px max(18px, env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0,0,0,.85)); pointer-events: none; overflow-wrap: anywhere; }
.feed-caption p { margin: 6px 0; font-size: 12px; max-width: 75%; color: #ccc; }
.feed-caption small { color: #bbb; }
.feed-tail { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 16px; padding: 24px; text-align: center; color: var(--muted); }
.feed-unsupported { position: absolute; inset: 20% 18% 40%; display: grid; align-content: center; justify-items: center; gap: 12px; text-align: center; background: var(--panel); padding: 15px; border-radius: 12px; }
.feed-heart { position: absolute; top: 40%; left: calc(50% - 40px); font-size: 80px; color: #ef6988; opacity: 0; pointer-events: none; }
.feed-heart.show { animation: feed-heart .8s ease-out; }
@keyframes feed-heart { 0% { transform: scale(.4); opacity: 0; } 25% { transform: scale(1.15); opacity: 1; } 70% { opacity: 1; } 100% { transform: translateY(-60px); opacity: 0; } }
.feed-bar i, .feed-tools i { font-style: normal; }
.feed-bar button i, .feed-bar .btn i, .feed-tools i { margin-right: 5px; }
/* Phones: TikTok layout — full-bleed media, see-through top bar, icon column on the right,
   author/tags/stars bottom-left. Nothing covers more than a thin strip of the picture. */
@media (max-width: 700px) {
  .feed-panel { height: 100dvh; }
  .feed-bar { position: absolute; top: 0; left: 0; right: 0; z-index: 5; min-height: 0; gap: 2px; flex-wrap: nowrap; padding: max(6px, env(safe-area-inset-top)) 6px 18px; background: linear-gradient(rgba(0,0,0,.55), transparent); border: 0; pointer-events: none; }
  .feed-bar > * { pointer-events: auto; }
  .feed-bar #feedSignals { font-size: 12px; color: #ddd; text-align: center; text-shadow: 0 1px 3px #000; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .feed-bar button, .feed-bar .btn { background: transparent; border: 0; padding: 8px; min-width: 40px; font-size: 20px; line-height: 1; color: #fff; text-shadow: 0 1px 4px #000; }
  .feed-bar button i, .feed-bar .btn i { margin: 0; }
  .feed-bar button span, .feed-bar .btn span { display: none; }
  .feed-cold { top: calc(env(safe-area-inset-top) + 52px); }
  .feed-media { object-fit: contain; }
  .feed-tools { right: max(4px, env(safe-area-inset-right)); bottom: calc(env(safe-area-inset-bottom) + 96px); max-height: calc(100% - 170px); max-width: 72px; gap: 14px; justify-items: center; overflow: visible; }
  .feed-tools button, .feed-tools .btn { display: grid; justify-items: center; gap: 3px; width: 64px; max-width: none; padding: 0; background: transparent; border: 0; border-radius: 0; color: #fff; font-size: 10px; line-height: 1.15; text-align: center; text-shadow: 0 1px 3px #000; }
  .feed-tools button i, .feed-tools .btn i { display: grid; place-items: center; width: 46px; height: 46px; margin: 0; border-radius: 50%; background: rgba(0,0,0,.35); font-size: 23px; backdrop-filter: blur(4px); }
  .feed-tools button span, .feed-tools .btn span { max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .feed-tools button.on { color: var(--accent); }
  .feed-tools button[data-action="like"].on i { color: #ff4d6d; }
  .feed-tools button.on i { background: rgba(0,0,0,.55); }
  .feed-gif-badge { font-size: 10px; padding: 2px 5px; }
  .feed-save-error { position: absolute; right: 70px; bottom: 0; width: 160px; }
  .feed-caption { padding: 70px 84px max(14px, env(safe-area-inset-bottom)) 14px; text-shadow: 0 1px 3px #000; background: linear-gradient(transparent, rgba(0,0,0,.6)); }
  .feed-caption strong { font-size: 15px; }
  .feed-caption p { max-width: none; font-size: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .feed-caption .feed-stars { pointer-events: auto; margin: 2px 0 2px -5px; }
  .feed-caption .feed-stars button { background: transparent; border: 0; padding: 4px 5px; font-size: 22px; min-width: 0; color: #fff; }
  .feed-caption .feed-stars button.on { color: #ffd257; }
}
@media (prefers-reduced-motion: reduce) { .feed-heart.show { animation-duration: .2s; } .feed-loading::after { animation: none; width: 100%; } }
.recommendations { flex: 0 0 auto; max-height: 37dvh; overflow-y: auto; padding: 10px 16px max(12px, env(safe-area-inset-bottom)); background: var(--panel); border-top: 1px solid var(--line); }
.recommendations section + section { margin-top: 14px; }
.rec-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 14px; }
.rec-heading h2 { margin: 0; font-size: 14px; font-weight: 600; }
.rec-heading small, .rec-note, .recommendations section > small { color: var(--muted); font-size: 12px; }
.rec-note { margin: 4px 0; }
.iqdb-progress { display: block; margin-top: 4px; }
.iqdb-progress:empty { display: none; }
.setting-row:has(input:disabled) { color: var(--muted); }
.rec-strip { display: flex; gap: 8px; overflow-x: auto; padding: 7px 2px; overscroll-behavior-x: contain; }
.rec-card { display: flex; flex: 0 0 100px; flex-direction: column; gap: 4px; width: 100px; padding: 0; border: 0; background: transparent; text-decoration: none; color: var(--text); font-size: 11px; overflow-wrap: anywhere; }
.rec-card img, .rec-skeleton { width: 100px; height: 76px; object-fit: cover; border-radius: 7px; background: var(--panel2); }
.rec-card small { color: var(--muted); }
.rec-skeleton { flex: 0 0 100px; opacity: .65; }
.viewer .vbody { min-height: 80px; }
@media (max-width: 560px) { .recommendations { padding-inline: 10px; max-height: 34dvh; } .rec-card { flex-basis: 84px; width: 84px; } .rec-card img { width: 84px; height: 64px; } }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
button, .btn { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
button:hover, .btn:hover { border-color: #3a3f4b; }
button:focus-visible, .btn:focus-within, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button[type=submit], .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.icon { padding: 9px; }
.ghost { background: transparent; }
.danger { color: var(--danger); }
input { font: inherit; width: 100%; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.muted { color: var(--muted); }
.err { color: var(--danger); min-height: 1.4em; margin: 0; font-size: 14px; }

.auth { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.card { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px 22px; display: grid; gap: 12px; }
.card h1, .card h2 { margin: 0; font-size: 22px; }
.card p { margin: 0; font-size: 14px; }
.card button[type=submit] { justify-content: center; padding: 12px; }
.logo svg { width: 40px; height: 40px; color: var(--accent); }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: rgba(14,15,18,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.brand svg { color: var(--accent); }
.tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.tabs button { background: none; border: 0; color: var(--muted); padding: 7px 10px; white-space: nowrap; }
.tabs button.on { color: var(--text); background: var(--panel2); }
.actions { display: flex; gap: 8px; }
@media (max-width: 560px) {
  .top { flex-wrap: wrap; }
  .tabs { order: 3; flex-basis: 100%; }
  .actions { margin-left: auto; }
  .btn.primary span { display: none; }
  .btn.primary { padding: 9px; }
}
.menu { position: fixed; right: 16px; top: 62px; z-index: 6; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px; display: grid; gap: 4px; width: min(300px, calc(100vw - 32px)); box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.menu button { background: none; border: 0; justify-content: flex-start; }
.menu button:hover { background: var(--panel2); }
.status { font-size: 13px; color: var(--muted); padding: 6px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.status b { color: var(--text); font-weight: 600; }
.status .warn { color: #e0b15c; }

.uploads { margin: 12px 16px 0; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; display: grid; gap: 6px; font-size: 13px; }
.up { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; }
.up .bar { grid-column: 1 / -1; height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; }
.up .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.up .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up.failed .bar i { background: var(--danger); }
.up .s { color: var(--muted, #999); font-variant-numeric: tabular-nums; text-align: right; }
.up-sum { font-weight: 600; font-variant-numeric: tabular-nums; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.up-retry { grid-column: 1 / -1; justify-self: start; padding: 2px 10px; font-size: 12px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--tile-size), 1fr)); gap: 4px; padding: 12px 16px 40px; }
@media (max-width: 560px) { .grid { grid-template-columns: repeat(var(--tile-columns), 1fr); gap: 3px; padding: 8px 16px 40px; } }
.tile { position: relative; aspect-ratio: 1; background: var(--panel); border-radius: 6px; overflow: hidden; cursor: pointer; border: 0; padding: 0; display: block; width: 100%; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .25s; }
.tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile img.ok { opacity: 1; }
.tile .ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 11px; padding: 8px; text-align: center; word-break: break-all; }
.tile .badge { position: absolute; right: 5px; bottom: 5px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 6px; }

.empty { text-align: center; color: var(--muted); padding: 60px 16px; }
.drop { position: fixed; inset: 10px; z-index: 20; border: 2px dashed var(--accent); border-radius: 18px; background: rgba(14,15,18,.85); display: grid; place-items: center; font-size: 18px; }

.viewer { position: fixed; inset: 0; z-index: 30; background: #000; display: grid; grid-template-rows: auto 1fr; }
.vbar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); background: rgba(0,0,0,.6); z-index: 2; }
.vbar .btn { background: transparent; border-color: transparent; }
.vname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; color: #ccc; }
.vbody { display: grid; place-items: center; min-height: 0; overflow: hidden; position: relative; }
/* Absolutely positioned so max-height is relative to the real free area under the toolbar. */
.vbody img, .vbody video { position: absolute; inset: 0; margin: auto; max-width: 100%; max-height: 100%; object-fit: contain; }
.vbody img { cursor: zoom-in; }
/* Tap a tall image to read it at full width and scroll; tap again to fit. */
.vbody.zoom { display: block; overflow: auto; overscroll-behavior: contain; }
.vbody.zoom img { position: static; display: block; width: 100%; max-width: 100%; max-height: none; margin: 0 auto; cursor: zoom-out; }
@media (min-width: 900px) { .vbody.zoom img { width: auto; max-width: 100%; } }
.vbody .loading { color: var(--muted); }
.vbody .file { text-align: center; color: var(--muted); display: grid; gap: 12px; justify-items: center; }
.nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,.4); border: 0; border-radius: 50%; padding: 10px; }
.nav.prev { left: 10px; } .nav.next { right: 10px; }
@media (hover: none) { .nav { display: none; } }

dialog { background: transparent; border: 0; padding: 16px; color: var(--text); }
dialog::backdrop { background: rgba(0,0,0,.6); }
.row { display: flex; gap: 8px; justify-content: flex-end; }
.toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 40; background: var(--panel2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; font-size: 14px; max-width: calc(100vw - 32px); }

.crumbs { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 10px 16px 0; }
.path { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; min-width: 0; font-size: 14px; }
.path button { background: none; border: 0; padding: 4px 6px; color: var(--muted); max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.path button.here { color: var(--text); font-weight: 600; }
.path span { color: var(--line); }
.cacts { display: flex; flex-wrap: wrap; gap: 4px; }
.cacts button { padding: 5px 10px; font-size: 13px; }
.tile.folder { background: var(--panel); border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 8px; color: var(--text); }
.tile.folder svg { width: 40%; height: auto; color: var(--accent); stroke-width: 1.4; }
.tile.folder .fname { font-size: 13px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile.folder .fcount { font-size: 11px; color: var(--muted); }
.mvlist { display: grid; gap: 2px; max-height: 50vh; overflow-y: auto; }
.mvlist button { background: none; border: 0; justify-content: flex-start; text-align: left; }
.mvlist button:hover:not(:disabled) { background: var(--panel2); }
.mvlist button:disabled { color: var(--muted); cursor: default; }
.mvlist svg { color: var(--accent); flex: none; }

.tagbar, .chips, .vtags { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.tagbar { padding: 10px 16px 0; }
.chips { flex-wrap: wrap; }
.chip { flex: none; padding: 4px 10px; border-radius: 999px; font-size: 13px; background: var(--panel); color: var(--muted); }
.chip small { margin-left: 4px; opacity: .6; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.vtags { padding: 0 12px 8px; background: rgba(0,0,0,.6); z-index: 2; }
.vtags .chip { background: rgba(255,255,255,.08); color: #ddd; border-color: transparent; }
.viewer { display: flex; flex-direction: column; }
.viewer .vbody { flex: 1; }
#vPin.on { color: var(--accent); }
#vPin.on svg { fill: currentColor; }
.tile .pin { position: absolute; left: 5px; top: 5px; width: 18px; height: 18px; color: #fff; fill: var(--accent); stroke: #000; stroke-width: 1.2; filter: drop-shadow(0 1px 2px #000); }
@media (max-width: 560px) {
  .vbar { flex-wrap: wrap; gap: 2px; }
  .vbar .vname { order: 10; flex-basis: 100%; padding: 0 8px 4px; }
  .vbar #vClose { margin-right: auto; }
}

.tile.sel::after { content: ""; position: absolute; right: 6px; top: 6px; width: 20px; height: 20px; border-radius: 50%; border: 2px solid #fff; background: rgba(0,0,0,.35); box-shadow: 0 1px 3px #000; }
.tile.sel.on::after { background: var(--accent); border-color: var(--accent); }
.tile.sel.on img { transform: scale(.9); border-radius: 6px; }
.tile.sel img { transition: transform .15s, opacity .25s; }
.tile.dim { opacity: .35; }
.tile.group { background: var(--panel); }
.collage { position: absolute; inset: 0; display: grid; gap: 2px; grid-template-columns: 1fr; }
.tile.group.n2 .collage { grid-template-columns: 1fr 1fr; }
.tile.group.n3 .collage, .tile.group.n4 .collage { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.tile.group.n3 .collage img:first-child { grid-row: span 2; }
.collage img { width: 100%; height: 100%; min-height: 0; object-fit: cover; }
.tile.group .gname { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 8px 6px; font-size: 12px; color: #fff; text-align: left; background: linear-gradient(transparent, rgba(0,0,0,.75)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 48px; }
.tile.group .badge { display: flex; align-items: center; gap: 3px; z-index: 1; }
.tile.group .badge svg { width: 12px; height: 12px; }
.selbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 10; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 8px 10px; box-shadow: 0 10px 30px rgba(0,0,0,.5); width: max-content; max-width: calc(100vw - 32px); }
.selbar span { font-size: 13px; color: var(--muted); padding: 0 6px; }
.selbar button { padding: 7px 12px; font-size: 14px; }
.selbar button:disabled { opacity: .4; cursor: default; }

.tagbox { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px; cursor: text; }
.tagbox:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.tagbox input { flex: 1; min-width: 120px; border: 0; padding: 4px; background: none; outline: none; }
.tagbox .chip { display: inline-flex; align-items: center; gap: 2px; padding-right: 4px; cursor: default; border: 1px solid var(--accent); }
.chip .x { background: none; border: 0; padding: 0 4px; font-size: 16px; line-height: 1; color: inherit; opacity: .7; }
.chip .x:hover { opacity: 1; }
.chip.part { background: transparent; color: var(--accent); border: 1px dashed var(--accent); }
.tagbox .chip.part { cursor: pointer; }
.chip.create { color: var(--accent); border-style: dashed; }
.tgsug { max-height: 30vh; overflow-y: auto; }
.chip.add { color: #aaa; border: 1px dashed rgba(255,255,255,.25) !important; }

.tabs .flat { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; border: 1px dashed var(--line); }
.tabs .flat svg { width: 15px; height: 15px; }
.tabs .flat.on { color: var(--accent-ink); background: var(--accent); border: 1px solid var(--accent); }
@media (max-width: 560px) {
  .tabs { gap: 0; }
  .tabs button { padding: 7px 8px; }
  .tabs .flat svg { display: none; }
}

.tile .vbadge { position: absolute; right: 5px; top: 5px; display: flex; align-items: center; gap: 2px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; padding: 1px 6px 1px 4px; border-radius: 6px; }
.tile .vbadge svg { width: 12px; height: 12px; }
.tile.sel .vbadge { right: 32px; }
.vvars { display: flex; align-items: center; gap: 6px; padding: 0 12px 8px; background: rgba(0,0,0,.6); overflow-x: auto; scrollbar-width: none; z-index: 2; }
.vthumb { position: relative; flex: none; width: 48px; height: 48px; padding: 0; border-radius: 8px; overflow: hidden; border: 2px solid transparent; background: #222; justify-content: center; }
.vthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vthumb span { position: absolute; left: 0; right: 0; bottom: 0; font-size: 9px; text-align: center; background: rgba(0,0,0,.65); color: #fff; line-height: 14px; }
.vthumb.on { border-color: var(--accent); }
.vthumb.addv { border: 1px dashed rgba(255,255,255,.3); background: transparent; color: #aaa; font-size: 22px; }
.vvars .chip { background: rgba(255,255,255,.08); color: #ddd; border-color: transparent; white-space: nowrap; }
/* "What the model knows about me" */
.pf-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin: 6px 0 10px; }
.pf-stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.pf-stat strong { font-size: 22px; }
.pf-stat span { font-size: 12px; opacity: .7; }
.pf-bars { display: flex; flex-direction: column; gap: 6px; }
.pf-bar { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; align-items: center; gap: 10px; font-size: 14px; }
.pf-bar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-bar-track { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.pf-bar-track i { display: block; height: 100%; border-radius: 4px; background: #7cc6a4; }
.pf-bar.neg .pf-bar-track i { background: #e07a7a; }
.pf-bar-meta { font-size: 12px; opacity: .7; white-space: nowrap; }
.pf-artist { margin: 0 0 14px; }
.pf-artist-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.pf-artist-head small { opacity: .7; }
.pf-thumb { flex: 0 0 auto; width: 84px; height: 84px; border-radius: 10px; overflow: hidden; background: var(--panel); border: 1px solid var(--line); display: grid; place-items: center; font-size: 11px; color: inherit; text-decoration: none; }
.pf-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.pf-grid .pf-thumb { width: auto; aspect-ratio: 1; height: auto; }
.pf-cols { display: flex; align-items: flex-end; gap: 3px; height: 120px; margin: 8px 0 22px; }
.pf-col { flex: 1 1 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; position: relative; min-width: 0; }
.pf-col i { display: block; background: #7cc6a4; border-radius: 3px 3px 0 0; }
.pf-col small { position: absolute; top: 100%; left: 0; font-size: 10px; opacity: .6; white-space: nowrap; }
.pf-recent-row { display: flex; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.pf-recent-row .pf-thumb { width: 56px; height: 56px; }
.pf-recent-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pf-recent-text small { opacity: .7; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-recent-row.undone { opacity: .45; }
@media (max-width: 520px) { .pf-bar { grid-template-columns: minmax(80px, 40%) 1fr; } .pf-bar-meta { grid-column: 1 / -1; } }
/* Variation picker */
.vp-card { width: min(720px, 94vw); }
.vp-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 6px; }
.vp-tools input[type=search] { flex: 1 1 180px; min-width: 0; }
.vp-scope { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.vp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; max-height: 55vh; overflow-y: auto; margin: 6px 0 12px; }
.vp-item { position: relative; aspect-ratio: 1; padding: 0; border-radius: 10px; overflow: hidden; border: 2px solid transparent; background: var(--panel2); }
.vp-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vp-item.on { border-color: var(--accent); }
.vp-item.on::after { content: '✓'; position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #000; display: grid; place-items: center; font-size: 13px; }
.vp-item span { position: absolute; left: 4px; bottom: 4px; font-size: 11px; background: rgba(0,0,0,.6); padding: 1px 5px; border-radius: 6px; }
/* Vault search */
.searchbar { padding: 8px 16px 0; }
.searchbar input { width: 100%; }
#searchBtn.on { color: var(--accent-ink); background: var(--accent); }
/* Favorites page */
.liked-content { max-width: 1100px; margin: auto; padding: 12px 14px max(40px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
.liked-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.liked-filters button.on { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
#likedSearch { width: 100%; }
.liked-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; }
.liked-tile { position: relative; aspect-ratio: 1; padding: 0; border: 0; border-radius: 10px; overflow: hidden; background: var(--panel2); }
.liked-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.liked-tile.removed { opacity: .3; }
.liked-mark { position: absolute; right: 4px; bottom: 4px; font-size: 11px; background: rgba(0,0,0,.6); padding: 1px 6px; border-radius: 6px; }
.liked-mark:empty { display: none; }
#likedMore { align-self: center; }
.liked-box { position: fixed; inset: 0; z-index: 45; background: rgba(0,0,0,.94); display: flex; align-items: center; justify-content: center; }
.liked-img { max-width: 100%; max-height: calc(100% - 120px); object-fit: contain; }
.liked-x { position: absolute; top: max(10px, env(safe-area-inset-top)); right: 12px; z-index: 2; }
.liked-nav { position: absolute; top: 50%; transform: translateY(-50%); font-size: 28px; padding: 6px 14px; background: rgba(0,0,0,.4); }
.liked-nav.prev { left: 8px; } .liked-nav.next { right: 8px; }
.liked-bar { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 14px max(12px, env(safe-area-inset-bottom)); display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; background: linear-gradient(transparent, rgba(0,0,0,.85)); }
.liked-info { display: flex; flex-direction: column; min-width: 0; }
.liked-info small { opacity: .75; }
.liked-acts { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 520px) { .liked-grid { grid-template-columns: repeat(3, 1fr); gap: 3px; } .liked-nav { display: none; } }
/* e621 tags in the viewer: separate from the user's own tags */
.etags { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-left: 8px; padding-left: 8px; border-left: 1px solid var(--line); }
.etags a { font-size: 12px; color: var(--muted); margin-right: 2px; }
.chip.muted { opacity: .55; font-size: 12px; padding: 2px 8px; }
.chip.muted:hover { opacity: .9; }
/* Folder hidden from search and suggestions */
.tile .nosearch { position: absolute; top: 6px; right: 6px; font-size: 14px; opacity: .8; }
/* Public share page */
.share-page { min-height: 100vh; }
.share-top .brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60vw; }
.share-main { max-width: 1100px; margin: auto; padding: 14px 16px 48px; }
.share-path { font-size: 15px; margin: 18px 0 8px; color: var(--muted); }
.share-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.share-card { display: flex; flex-direction: column; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px; min-width: 0; }
.share-thumb { aspect-ratio: 1; padding: 0; border: 0; border-radius: 8px; overflow: hidden; background: var(--panel2); display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.share-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.share-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-card small { color: var(--muted); font-size: 12px; }
.share-view { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.94); display: grid; place-items: center; }
.share-view #shBody { max-width: 100%; max-height: 100%; color: var(--muted); }
.share-view img, .share-view video { max-width: 100vw; max-height: 100vh; object-fit: contain; display: block; }
/* Share dialog and links list */
.share-dlg { width: min(520px, 92vw); }
.share-out { display: flex; gap: 6px; margin: 10px 0; }
.share-out input { flex: 1; min-width: 0; font-size: 13px; }
.share-link-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.share-link-row > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.share-link-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-link-row small { color: var(--muted); }
.link-btn { background: none; border: 0; padding: 4px; color: var(--accent); justify-self: center; font-size: 14px; }
.link-btn:hover { text-decoration: underline; }
