/* ============================================================
   VELVET — Apple HIG-inspired design system
   ============================================================ */

:root {
  --accent: #ff2d55;          /* systemPink — velvet magenta */
  --accent-press: #e02448;
  --accent-soft: rgba(255, 45, 85, 0.16);

  --r-card: 16px;
  --r-control: 12px;
  --r-tile: 14px;

  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --bar-h: 56px;
  --tab-h: 64px;

  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Dark (default) ---------- */
[data-theme="dark"] {
  --bg: #000000;
  --bg-2: #0a0a0c;
  --elevated: #1c1c1e;
  --elevated-2: #2c2c2e;
  --grouped-bg: #000000;
  --grouped-cell: #1c1c1e;
  --fill: rgba(118, 118, 128, 0.24);
  --fill-2: rgba(118, 118, 128, 0.36);
  --separator: rgba(84, 84, 88, 0.55);
  --separator-opaque: #38383a;
  --label: #ffffff;
  --label-2: rgba(235, 235, 245, 0.6);
  --label-3: rgba(235, 235, 245, 0.3);
  --label-4: rgba(235, 235, 245, 0.18);
  --material: rgba(20, 20, 22, 0.72);
  --material-thick: rgba(18, 18, 20, 0.9);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  --tile-bg: #1c1c1e;
  color-scheme: dark;
}

/* ---------- Light ---------- */
[data-theme="light"] {
  --bg: #ffffff;
  --bg-2: #f2f2f7;
  --elevated: #ffffff;
  --elevated-2: #f2f2f7;
  --grouped-bg: #f2f2f7;
  --grouped-cell: #ffffff;
  --fill: rgba(118, 118, 128, 0.12);
  --fill-2: rgba(118, 118, 128, 0.2);
  --separator: rgba(60, 60, 67, 0.22);
  --separator-opaque: #d1d1d6;
  --label: #000000;
  --label-2: rgba(60, 60, 67, 0.6);
  --label-3: rgba(60, 60, 67, 0.3);
  --label-4: rgba(60, 60, 67, 0.18);
  --material: rgba(250, 250, 252, 0.72);
  --material-thick: rgba(248, 248, 250, 0.92);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.16);
  --tile-bg: #e9e9ee;
  color-scheme: light;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body, #root { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Helvetica Neue", system-ui, sans-serif;
  background: var(--bg);
  color: var(--label);
  letter-spacing: -0.01em;
  overflow: hidden;
  transition: background 0.4s var(--ease), color 0.4s var(--ease);
}

::selection { background: var(--accent-soft); }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: inherit; }

/* ---------- App shell ---------- */
.app { display: flex; flex-direction: column; height: 100dvh; position: relative; }

.scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  padding-bottom: calc(var(--tab-h) + 40px + env(safe-area-inset-bottom));
}
.scroll::-webkit-scrollbar { width: 0; height: 0; }

.page { max-width: 1320px; margin: 0 auto; padding: 0 22px; }
@media (max-width: 600px) { .page { padding: 0 16px; } }

/* ============================================================
   NAV BAR — large title that collapses on scroll
   ============================================================ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: var(--bar-h);
  padding: 0 max(22px, env(safe-area-inset-left)) 0 max(22px, env(safe-area-inset-left));
  background: transparent;
  transition: background 0.3s var(--ease);
}
.navbar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--material);
  backdrop-filter: saturate(180%) blur(22px);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  border-bottom: 0.5px solid transparent;
  opacity: 0;
  transition: opacity 0.3s var(--ease), border-color 0.3s var(--ease);
  z-index: -1;
}
.navbar.stuck::after { opacity: 1; border-bottom-color: var(--separator); }
.navbar .nav-title {
  font-size: 17px; font-weight: 600; letter-spacing: -0.02em;
  opacity: 0; transform: translateY(6px);
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  pointer-events: none;
}
.navbar.stuck .nav-title { opacity: 1; transform: none; }

.nav-actions { display: flex; align-items: center; gap: 8px; }

/* circular toolbar buttons (Apple toolbar glyph buttons) */
.icon-btn {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--fill); color: var(--accent);
  transition: transform 0.15s var(--ease), background 0.2s var(--ease);
}
.icon-btn:hover { background: var(--fill-2); }
.icon-btn:active { transform: scale(0.9); }
.icon-btn.plain { color: var(--label); }
.icon-btn.spinning svg { animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* large title block */
.large-head { padding: 6px 0 4px; }
.large-title {
  font-size: 34px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.05;
}
.large-sub { font-size: 15px; color: var(--label-2); margin-top: 3px; font-weight: 400; }

/* ============================================================
   SEGMENTED CONTROL  (All / Videos / GIFs / Images)
   ============================================================ */
.segmented {
  position: relative;
  display: inline-flex;
  background: var(--fill);
  border-radius: 10px;
  padding: 2px;
  gap: 0;
}
.segmented .seg {
  position: relative; z-index: 2;
  border-radius: 8px;
  padding: 6px 16px;
  font-size: 13px; font-weight: 600;
  color: var(--label);
  white-space: nowrap;
  transition: color 0.2s var(--ease), transform 0.1s var(--ease);
}
.segmented .seg.dim { color: var(--label-2); font-weight: 500; }
.segmented .seg:active { transform: scale(0.96); }
.segmented .thumb {
  position: absolute; z-index: 1; top: 2px; bottom: 2px;
  background: var(--elevated-2);
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.18), 0 0 0 0.5px rgba(0,0,0,0.04);
  transition: transform 0.32s var(--ease), width 0.32s var(--ease);
}
[data-theme="light"] .segmented .thumb { background: #ffffff; }

/* ============================================================
   SEARCH FIELD
   ============================================================ */
.search {
  display: flex; align-items: center; gap: 7px;
  background: var(--fill);
  border-radius: var(--r-control);
  padding: 8px 11px;
  color: var(--label-2);
  transition: background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.search:focus-within { box-shadow: 0 0 0 3.5px var(--accent-soft); }
.search input {
  border: none; outline: none; background: none; flex: 1;
  font-size: 16px; color: var(--label); letter-spacing: -0.01em;
}
.search input::placeholder { color: var(--label-2); }
.search .clear { width: 18px; height: 18px; border-radius: 50%; background: var(--label-3);
  display: grid; place-items: center; color: var(--bg); flex-shrink: 0; }

/* ============================================================
   SORT MENU (popover)
   ============================================================ */
.menu-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--fill); border-radius: var(--r-control);
  padding: 9px 11px; font-size: 15px; font-weight: 500; color: var(--label);
  transition: background 0.2s var(--ease), transform 0.1s var(--ease);
}
.menu-btn:hover { background: var(--fill-2); }
.menu-btn:active { transform: scale(0.97); }
.menu-btn .chev { color: var(--label-2); }

.popover {
  position: absolute; z-index: 60;
  min-width: 200px;
  background: var(--material-thick);
  backdrop-filter: saturate(180%) blur(28px);
  -webkit-backdrop-filter: saturate(180%) blur(28px);
  border: 0.5px solid var(--separator);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 6px;
  transform-origin: top right;
  animation: pop 0.18s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: scale(0.94) translateY(-6px); } }
.popover .mrow {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 11px; border-radius: 9px; font-size: 15px; font-weight: 400;
  color: var(--label); width: 100%; text-align: left;
}
.popover .mrow:hover { background: var(--fill); }
.popover .mrow .check { color: var(--accent); opacity: 0; }
.popover .mrow.on .check { opacity: 1; }
.popover .mrow.on { font-weight: 500; }
.menu-scrim { position: fixed; inset: 0; z-index: 55; }

/* ============================================================
   CHIPS (interests)
   ============================================================ */
.chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 4px;
  scrollbar-width: none; -ms-overflow-style: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap; flex-shrink: 0;
  background: var(--fill);
  border-radius: 100px;
  padding: 8px 14px;
  font-size: 14px; font-weight: 500; color: var(--label);
  transition: background 0.2s var(--ease), transform 0.12s var(--ease), color 0.2s var(--ease);
}
.chip:active { transform: scale(0.95); }
.chip.active { background: var(--accent); color: #fff; }
.chip.active .chip-ico { color: #fff; }
.chip-ico { color: var(--label-2); }
.chip .x {
  width: 17px; height: 17px; border-radius: 50%;
  background: rgba(255,255,255,0.25); display: grid; place-items: center;
  margin-right: -3px; margin-left: 1px;
}
.chip.add { color: var(--accent); background: var(--accent-soft); }
.chip.wiggle { animation: wiggle 0.32s ease; }
@keyframes wiggle { 0%,100%{transform:rotate(0)} 25%{transform:rotate(-1.6deg)} 75%{transform:rotate(1.6deg)} }

/* ============================================================
   TOOLBAR ROW (search + sort + segmented)
   ============================================================ */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar .search { flex: 1; min-width: 200px; }
.toolbar-seg { margin-left: auto; }
@media (max-width: 720px) {
  .toolbar .search { flex: 1 1 100%; order: -1; }
  .toolbar-seg { margin-left: 0; width: 100%; }
  .segmented { display: flex; width: 100%; }
  .segmented .seg { flex: 1; text-align: center; padding: 6px 6px; }
}

/* ============================================================
   MEDIA WALL — masonry
   ============================================================ */
.wall {
  display: grid;
  grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr));
  align-items: start;
  gap: 16px;
  margin-top: 18px;
  contain: layout paint style;
  transform: translateZ(0);
}
.wall-column {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 22px;
}
@media (max-width: 640px)  { .wall { gap: 10px; } .wall-column { gap: 18px; } }

.card {
  margin-bottom: 0;
  animation: none;
  content-visibility: auto;
  contain-intrinsic-size: 280px 360px;
  contain: layout paint style;
}
@media (max-width: 640px) { .card { margin-bottom: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

.tile {
  position: relative;
  width: 100%;
  border-radius: var(--r-tile);
  overflow: hidden;
  background: var(--tile-bg);
  cursor: pointer;
  transform: translateZ(0);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.tile .surface { position: absolute; inset: 0; }
.tile .surface::after {  /* subtle vignette for badge legibility */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.34), transparent 42%);
}
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.tile:active { transform: translateY(-1px) scale(0.992); }
.tile:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
  box-shadow: var(--shadow);
}

.tile .badge {
  position: absolute; right: 8px; bottom: 8px;
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  color: #fff; font-size: 11px; font-weight: 600;
  padding: 3px 8px; border-radius: 100px; letter-spacing: 0;
}
.tile .like {
  position: absolute; right: 8px; top: 8px;
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(0,0,0,0.32); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: grid; place-items: center; color: #fff;
  opacity: 0; transform: scale(0.8);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease), background 0.2s;
}
.tile:hover .like { opacity: 1; transform: none; }
.tile .like.on { opacity: 1; transform: none; color: var(--accent); }
.tile .like:active { transform: scale(0.85); }
.tile .hide-card {
  position: absolute;
  right: 8px;
  top: 48px;
  z-index: 3;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(0,0,0,0.42);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease), background 0.2s var(--ease);
}
.tile:hover .hide-card,
.tile .hide-card:focus-visible {
  opacity: 1;
  transform: none;
}
.tile .hide-card:active {
  transform: scale(0.88);
  background: rgba(255,59,48,0.82);
}
.tile .feedback-card {
  position: absolute;
  left: 8px;
  top: 44px;
  z-index: 3;
  display: flex;
  gap: 6px;
  opacity: 0;
  transform: scale(0.94);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}
.tile .feedback-card button {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: rgba(0,0,0,0.42);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.tile:hover .feedback-card,
.tile .feedback-card:focus-within {
  opacity: 1;
  transform: none;
}
.tile .feedback-card button:active {
  transform: scale(0.88);
  background: var(--accent);
}
.tile .follow-topic {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 3;
  height: 30px;
  padding: 0 11px;
  border-radius: 100px;
  color: #fff;
  background: rgba(255, 45, 85, 0.84);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease), background 0.2s var(--ease);
}
.tile:hover .follow-topic,
.tile .follow-topic:focus-visible {
  opacity: 1;
  transform: none;
}
.tile .follow-topic:active {
  transform: scale(0.9);
  background: var(--accent-press);
}
.tile .play {
  position: absolute; inset: 0; margin: auto;
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(0,0,0,0.32); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: grid; place-items: center; color: #fff;
  opacity: 0; transition: opacity 0.25s var(--ease);
}
.tile:hover .play { opacity: 1; }

.cap { padding: 9px 3px 0; }
.cap .t { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.cap .s { font-size: 12.5px; color: var(--label-2); margin-top: 2px; }

/* skeleton while reloading */
.tile.skel .surface { background: var(--fill); }
.tile.skel .surface::after { display: none; }
.card.skel .cap .t, .card.skel .cap .s {
  background: var(--fill); border-radius: 5px; color: transparent; height: 12px;
}
.card.skel .cap .s { width: 55%; margin-top: 7px; }
.shimmer { position: relative; overflow: hidden; }
.shimmer::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,0.08) 50%, transparent 70%);
  transform: translateX(-100%); animation: sh 1.3s infinite;
}
@keyframes sh { to { transform: translateX(100%); } }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 14px; padding: 80px 24px; color: var(--label-2);
  min-height: 50vh;
}
.empty .glyph {
  width: 76px; height: 76px; border-radius: 22px;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center;
}
.empty h3 { color: var(--label); font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.empty p { font-size: 15px; max-width: 320px; line-height: 1.4; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: var(--r-control); padding: 11px 18px;
  font-size: 16px; font-weight: 600; letter-spacing: -0.01em;
  transition: transform 0.12s var(--ease), background 0.2s var(--ease), opacity 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn.filled { background: var(--accent); color: #fff; }
.btn.filled:hover { background: var(--accent-press); }
.btn.tinted { background: var(--accent-soft); color: var(--accent); }
.btn.gray { background: var(--fill); color: var(--label); }
.btn:disabled { opacity: 0.4; cursor: default; transform: none; }
.btn.block { width: 100%; }

/* add-interest field row (Browse) */
.field {
  display: flex; align-items: center;
  background: var(--fill); border-radius: var(--r-control);
  padding: 13px 15px;
}
.field input { border: none; outline: none; background: none; flex: 1; font-size: 16px; color: var(--label); }
.field input::placeholder { color: var(--label-2); }

/* ============================================================
   GROUPED LISTS (Settings)
   ============================================================ */
.group { margin-top: 26px; }
.group-title { font-size: 13px; font-weight: 600; color: var(--label-2);
  text-transform: uppercase; letter-spacing: 0.04em; padding: 0 16px 8px; }
.list {
  background: var(--grouped-cell);
  border-radius: var(--r-card);
  overflow: hidden;
  border: 0.5px solid var(--separator);
}
.row {
  display: flex; align-items: center; gap: 13px;
  padding: 13px 16px; position: relative;
}
.row + .row::before {
  content: ""; position: absolute; top: 0; left: 52px; right: 0;
  height: 0.5px; background: var(--separator);
}
.row .ricon {
  width: 29px; height: 29px; border-radius: 7px; flex-shrink: 0;
  display: grid; place-items: center; color: #fff;
}
.row .rlabel { flex: 1; font-size: 16px; }
.row .rvalue { color: var(--label-2); font-size: 16px; }
.row.tappable:hover { background: var(--fill); }
.row.tappable { cursor: pointer; }
.group-foot { font-size: 12.5px; color: var(--label-2); padding: 8px 16px 0; line-height: 1.4; }

/* iOS switch */
.switch {
  width: 51px; height: 31px; border-radius: 100px; flex-shrink: 0;
  background: var(--fill-2); position: relative;
  transition: background 0.28s var(--ease);
}
.switch.on { background: #34c759; }
.switch .knob {
  position: absolute; top: 2px; left: 2px; width: 27px; height: 27px;
  border-radius: 50%; background: #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,0.25);
  transition: transform 0.28s var(--ease);
}
.switch.on .knob { transform: translateX(20px); }

/* ============================================================
   TAB BAR (bottom, iOS) — floating capsule on wide screens
   ============================================================ */
.tabbar-wrap {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; justify-content: center;
  padding-bottom: env(safe-area-inset-bottom);
  pointer-events: none;
}
.tabbar {
  pointer-events: auto;
  display: flex; align-items: stretch;
  background: var(--material-thick);
  backdrop-filter: saturate(180%) blur(28px);
  -webkit-backdrop-filter: saturate(180%) blur(28px);
  border-top: 0.5px solid var(--separator);
  width: 100%;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--label-2); font-size: 10.5px; font-weight: 500;
  transition: color 0.2s var(--ease), transform 0.12s var(--ease);
}
.tab:active { transform: scale(0.9); }
.tab.on { color: var(--accent); }
.tab .dot { transition: transform 0.2s var(--ease); }
.tab.on .dot { transform: translateY(-1px); }

/* desktop / wide: floating capsule */
@media (min-width: 760px) {
  .tabbar-wrap { padding-bottom: 18px; }
  .tabbar {
    width: auto; height: auto; border-radius: 100px;
    border: 0.5px solid var(--separator);
    box-shadow: var(--shadow);
    padding: 8px 10px; gap: 4px;
  }
  .tab {
    flex: 0 0 auto; flex-direction: row; gap: 7px;
    padding: 9px 18px; border-radius: 100px; font-size: 14px; font-weight: 500;
  }
  .tab.on { background: var(--accent-soft); }
}

/* ============================================================
   LIGHTBOX
   ============================================================ */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column;
  background: var(--material-thick);
  backdrop-filter: saturate(160%) blur(34px);
  -webkit-backdrop-filter: saturate(160%) blur(34px);
  animation: fade 0.28s var(--ease);
}
@keyframes fade { from { opacity: 0; } }
.lb-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px max(18px, env(safe-area-inset-left));
  flex-shrink: 0;
}
.lb-bar .icon-btn { background: var(--fill); color: var(--label); }
.lb-stage {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 0 18px 18px; min-height: 0; position: relative;
}
.lb-media {
  position: relative;
  max-width: min(960px, 100%); max-height: 100%;
  aspect-ratio: var(--ar, 3/4);
  width: auto; height: 100%;
  border-radius: 18px; overflow: hidden;
  box-shadow: var(--shadow);
  animation: zoom 0.32s var(--ease);
}
@keyframes zoom { from { opacity: 0; transform: scale(0.96); } }
.lb-media .surface { position: absolute; inset: 0; }
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--material); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 0.5px solid var(--separator);
  display: grid; place-items: center; color: var(--label); z-index: 2;
  transition: transform 0.15s var(--ease), background 0.2s;
}
.lb-nav:hover { background: var(--fill-2); }
.lb-nav:active { transform: translateY(-50%) scale(0.9); }
.lb-nav.prev { left: 22px; } .lb-nav.next { right: 22px; }
@media (max-width: 720px) { .lb-nav { display: none; } }
.lb-info {
  flex-shrink: 0; padding: 14px max(18px, env(safe-area-inset-left)) max(22px, env(safe-area-inset-bottom));
  max-width: 960px; margin: 0 auto; width: 100%;
}
.lb-info h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.lb-info .meta { color: var(--label-2); font-size: 14px; margin-top: 3px; }
.lb-tags { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 12px; }
.lb-actions { display: flex; gap: 10px; margin-top: 16px; }
.lb-actions .btn { flex: 1; }
.tag {
  background: var(--fill); border-radius: 100px; padding: 6px 12px;
  font-size: 13px; font-weight: 500; color: var(--label-2);
}

/* browse grid of suggestions */
.sugg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 16px; }
.sugg {
  position: relative; height: 92px; border-radius: var(--r-tile); overflow: hidden;
  display: flex; align-items: flex-end; padding: 12px;
  color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
  transition: transform 0.2s var(--ease);
}
.sugg:hover { transform: translateY(-2px); }
.sugg::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.45), transparent 60%); }
.sugg span { position: relative; z-index: 1; }
.sugg .added { position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 24px; height: 24px; border-radius: 50%; background: rgba(0,0,0,0.4);
  display: grid; place-items: center; color: #fff; }

.section-label { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; margin: 26px 0 2px; }
.spacer-sm { height: 14px; }
.spacer { height: 22px; }

/* ============================================================
   REELS PLAYER — full-screen vertical media viewer
   ============================================================ */
.reels {
  position: fixed; inset: 0; z-index: 100; background: #000; color: #fff;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  touch-action: none;
  animation: fade 0.25s var(--ease);
}
.reels-scroll {
  position: absolute; inset: 0; overflow-y: scroll; overflow-x: hidden;
  scroll-snap-type: y mandatory; -webkit-overflow-scrolling: touch;
  touch-action: pan-y; scrollbar-width: none;
}
.reels-scroll::-webkit-scrollbar { display: none; }
.reel {
  position: relative; height: 100%; width: 100%;
  scroll-snap-align: start; scroll-snap-stop: always;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.reel-lite {
  contain: strict;
  background: #000;
}
.reel-media { position: absolute; inset: 0; cursor: pointer; }
.reel-media .surface { position: absolute; inset: 0; }
.reel-media .vignette {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to bottom, rgba(0,0,0,0.5), transparent 20%, transparent 58%, rgba(0,0,0,0.82));
}
@media (min-width: 760px) {
  .reel-media {
    position: absolute; inset: 0; height: auto; width: auto;
    aspect-ratio: auto; max-width: none;
    border-radius: 0;
  }
}

/* top chrome */
.reels-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 12;
  display: flex; align-items: center; gap: 12px;
  padding: max(16px, env(safe-area-inset-top)) 16px 30px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.55), transparent);
  transition: opacity 0.3s var(--ease);
}
.reels-top .icon-btn { background: rgba(255,255,255,0.16); color: #fff;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.reels-prog-wrap { flex: 1; }
.reels-prog { height: 3px; border-radius: 3px; background: rgba(255,255,255,0.22); overflow: hidden; }
.reels-prog span { display: block; height: 100%; background: #fff; border-radius: 3px;
  transition: width 0.08s linear; }
.pill-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 13px; border-radius: 100px; font-size: 13px; font-weight: 600;
  background: rgba(255,255,255,0.16); color: #fff;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: background 0.2s var(--ease), transform 0.12s var(--ease);
}
.pill-toggle:active { transform: scale(0.96); }
.pill-toggle.on { background: var(--accent); color: #fff; }

/* info + action rail */
.reel-info {
  position: absolute; left: 0; right: 84px; bottom: 0; z-index: 9;
  padding: 0 18px max(28px, env(safe-area-inset-bottom));
  transition: opacity 0.3s var(--ease);
  pointer-events: none;
}
.reel-info > * { pointer-events: auto; }
.reel-info h2 { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.reel-info .meta { color: rgba(255,255,255,0.78); font-size: 13.5px; margin-top: 4px; }
.reel-tags { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 11px; }
.reel-tags .tag {
  background: rgba(255,255,255,0.18);
  color: #fff;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.reel-tags .topic-tag {
  min-height: 30px;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 12.5px;
  font-weight: 700;
  touch-action: manipulation;
}
.reel-tags .topic-tag:active {
  transform: scale(0.96);
  background: var(--accent);
}
.reel-rail {
  position: absolute; right: 12px; bottom: 0; z-index: 10;
  display: flex; flex-direction: column; gap: 12px; align-items: center;
  padding-bottom: max(30px, env(safe-area-inset-bottom));
  transition: opacity 0.3s var(--ease);
}
.rail-btn { display: flex; flex-direction: column; align-items: center; gap: 5px;
  color: #fff; font-size: 11px; font-weight: 600; }
.rail-ico {
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,0.16);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: grid; place-items: center;
  transition: transform 0.15s var(--ease), background 0.2s, color 0.2s;
}
.rail-btn:active .rail-ico { transform: scale(0.86); }
.rail-btn.on .rail-ico { color: var(--accent); }
.hide-chrome { opacity: 0 !important; pointer-events: none !important; }

.reel-center { position: absolute; inset: 0; display: grid; place-items: center; z-index: 8; pointer-events: none; }
.reel-center .glyphbig {
  width: 86px; height: 86px; border-radius: 50%;
  background: rgba(0,0,0,0.42); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: grid; place-items: center; color: #fff; animation: zoom 0.22s var(--ease);
}
.badge-2x {
  position: absolute; top: 86px; left: 50%; transform: translateX(-50%); z-index: 11;
  background: rgba(0,0,0,0.55); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  color: #fff; font-weight: 700; font-size: 14px; letter-spacing: 0.02em;
  padding: 7px 15px; border-radius: 100px; display: flex; align-items: center; gap: 6px;
  animation: zoom 0.18s var(--ease);
}

/* ============================================================
   PRIVATE GATE — passcode lock
   ============================================================ */
.gate {
  position: fixed; inset: 0; z-index: 200; background: var(--bg); color: var(--label);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 24px max(40px, env(safe-area-inset-bottom));
  animation: fade 0.45s var(--ease); text-align: center;
}
.gate-lock { width: 56px; height: 56px; border-radius: 16px; background: var(--accent-soft);
  color: var(--accent); display: grid; place-items: center; }
.gate-word { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; margin-top: 20px; }
.gate-sub { color: var(--label-2); font-size: 15px; margin-top: 5px; }
.dots { display: flex; gap: 20px; margin: 30px 0 36px; }
.dots span { width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid var(--label-3);
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease), transform 0.18s var(--ease); }
.dots span.on { background: var(--accent); border-color: var(--accent); transform: scale(1.06); }
.dots.shake { animation: shk 0.4s ease; }
@keyframes shk { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-9px)} 40%{transform:translateX(8px)} 60%{transform:translateX(-6px)} 80%{transform:translateX(4px)} }
.keypad { display: grid; grid-template-columns: repeat(3, 74px); gap: 20px; }
.key {
  height: 74px; border-radius: 50%; background: var(--fill);
  font-size: 28px; font-weight: 400; color: var(--label);
  display: grid; place-items: center;
  transition: transform 0.12s var(--ease), background 0.2s var(--ease);
}
.key:hover { background: var(--fill-2); }
.key:active { transform: scale(0.92); }
.key.blank { background: none; pointer-events: none; }
.gate-hint { margin-top: 36px; color: var(--label-3); font-size: 13px; }

/* gate uses the Velvet mark */
.gate-mark { border-radius: 22px; box-shadow: 0 16px 44px rgba(255,40,90,0.28), 0 6px 18px rgba(0,0,0,0.5); }
.gate-mark svg { display: block; border-radius: 22px; }

/* brand mark beside the large title */
.brandtitle { display: flex; align-items: center; gap: 11px; }
.brandtitle svg { border-radius: 8px; flex-shrink: 0; }
.adult-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 700;
  padding: 3px 9px; border-radius: 100px; letter-spacing: 0.02em;
}

/* ============================================================
   AFTER DARK (adult mode) — non-explicit theming + gating
   ============================================================ */
[data-mode="nsfw"] {
  --bg: #0a0406; --bg-2: #0c0507;
  --elevated: #1b1014; --elevated-2: #241419;
  --grouped-bg: #0a0406; --grouped-cell: #1b1014;
  --tile-bg: #1b0f13;
  --material: rgba(20, 8, 12, 0.74); --material-thick: rgba(16, 6, 9, 0.92);
  --separator: rgba(120, 70, 84, 0.4);
}
[data-mode="nsfw"] body { background-image: radial-gradient(120% 70% at 50% -8%, rgba(224,17,76,0.16), transparent 62%); }

.tile.sensitive { cursor: pointer; }
.tile.sensitive .surface { filter: blur(24px) saturate(0.85) brightness(0.78); transform: scale(1.18); }
.tile.sensitive .surface::after { background: linear-gradient(to top, rgba(0,0,0,0.45), transparent 50%); }
.tile.sensitive .badge, .tile.sensitive .like, .tile.sensitive .play { display: none; }
.reveal {
  position: absolute; inset: 0; z-index: 3;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px;
  color: #fff; background: rgba(10,4,6,0.22);
}
.reveal .lk {
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255,255,255,0.15); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: grid; place-items: center;
  border: 1px solid rgba(255,255,255,0.14);
}
.reveal span { font-size: 12px; font-weight: 600; letter-spacing: 0.02em; color: rgba(255,255,255,0.92); }

/* special After Dark swatch in the accent row */
.swatch-ad {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #e0114c 0%, #2a0509 100%);
  transition: box-shadow 0.2s var(--ease), transform 0.12s var(--ease);
}
.swatch-ad:active { transform: scale(0.92); }

/* ============================================================
   ALERT (age confirmation) — Apple-style
   ============================================================ */
.alert-scrim {
  position: fixed; inset: 0; z-index: 150; padding: 24px;
  background: rgba(0,0,0,0.45); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: grid; place-items: center; animation: fade 0.2s var(--ease);
}
.alert {
  width: min(300px, 100%);
  background: var(--material-thick);
  backdrop-filter: saturate(180%) blur(30px); -webkit-backdrop-filter: saturate(180%) blur(30px);
  border: 0.5px solid var(--separator); border-radius: 20px; overflow: hidden;
  box-shadow: var(--shadow); text-align: center; animation: pop 0.2s var(--ease);
}
.alert .ahead { padding: 24px 22px 18px; }
.alert .ahead .amark { width: 46px; height: 46px; border-radius: 13px; margin: 0 auto 12px; }
.alert h3 { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.alert p { font-size: 13px; color: var(--label-2); margin-top: 6px; line-height: 1.45; }
.alert .abtns { display: flex; border-top: 0.5px solid var(--separator); }
.alert .abtns button { flex: 1; padding: 13px 8px; font-size: 16px; color: var(--accent); }
.alert .abtns button:hover { background: var(--fill); }
.alert .abtns button.primary { font-weight: 600; }
.alert .abtns button + button { border-left: 0.5px solid var(--separator); }

/* ============================================================
   LIVE MEDIA ADAPTER — preserve ASD design, render real feeds
   ============================================================ */
html {
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

body {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
}

input {
  -webkit-touch-callout: default;
  -webkit-user-select: text;
  user-select: text;
}

[hidden] {
  display: none !important;
}

.tile .surface img,
.tile .surface video,
.reel-media .surface img,
.reel-media .surface video,
.reel-media .surface iframe {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: cover;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.tile .surface img {
  transition: transform 0.35s var(--ease), filter 0.35s var(--ease);
}

.tile .surface video {
  z-index: 1;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s var(--ease);
}

.tile .surface video.is-ready {
  opacity: 1;
}

.tile:hover .surface img {
  transform: scale(1.035);
  filter: brightness(1.06);
}

.tile .surface::after {
  z-index: 1;
}

.tile .sheen,
.tile .like,
.tile .hide-card,
.tile .feedback-card,
.tile .follow-topic,
.tile .play,
.tile .badge,
.tile .overlay {
  z-index: 2;
}

.tile .overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 56px 12px 11px;
  color: #fff;
  background: linear-gradient(to top, rgba(0,0,0,0.72), rgba(0,0,0,0));
  pointer-events: none;
}

.tile .overlay .t {
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.18;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile .overlay .s {
  overflow: hidden;
  margin-top: 3px;
  color: rgba(255,255,255,0.74);
  font-size: 12px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cap {
  display: none;
}

.reel-media .surface img,
.reel-media .surface video,
.reel-media .surface iframe {
  background: #000;
  pointer-events: none;
}

.reel-media.is-image .surface img {
  object-fit: contain;
}

.reel-media.is-embed .surface img,
.reel-media.is-embed .surface iframe {
  object-fit: cover;
}

.reel-media.is-video .surface video {
  object-fit: contain;
}

.reel-media.is-embed .surface iframe {
  pointer-events: auto;
}

@media (min-width: 760px) {
  .reel-media .surface img,
  .reel-media .surface video,
  .reel-media .surface iframe {
    border-radius: 0;
  }
}

.feed-note {
  margin: 12px 0;
  padding: 14px 16px;
  border: 0.5px solid var(--separator);
  border-radius: var(--r-card);
  color: var(--label-2);
  background: var(--fill);
  font-size: 14px;
  line-height: 1.35;
}

.load-live {
  margin: 14px 0 44px;
}

.community-sugg {
  min-height: 124px;
  align-items: flex-start;
  justify-content: flex-end;
  flex-direction: column;
  text-align: left;
}

.community-sugg small {
  position: relative;
  z-index: 1;
  display: -webkit-box;
  margin-top: 5px;
  overflow: hidden;
  color: rgba(255,255,255,0.78);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.community-sugg.is-added {
  opacity: 0.62;
}

.topic-sugg {
  outline: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
}

.sugg.shimmer {
  background: var(--fill);
}

/* topic management sheet */
.sheet-scrim {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 18px;
  background: rgba(0,0,0,0.48);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: fade 0.2s var(--ease);
}

.topic-sheet {
  width: min(720px, 100%);
  max-height: min(760px, calc(100dvh - 34px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 0.5px solid var(--separator);
  border-radius: 22px;
  background: var(--material-thick);
  box-shadow: var(--shadow);
  animation: sheetUp 0.28s var(--ease);
}

@keyframes sheetUp {
  from { opacity: 0; transform: translateY(24px) scale(0.98); }
}

.sheet-grabber {
  width: 38px;
  height: 5px;
  flex: 0 0 auto;
  margin: 9px auto 3px;
  border-radius: 999px;
  background: var(--label-3);
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px 14px;
  border-bottom: 0.5px solid var(--separator);
}

.sheet-head h2 {
  font-size: 22px;
  line-height: 1.05;
  letter-spacing: 0;
}

.sheet-head p {
  margin-top: 4px;
  color: var(--label-2);
  font-size: 13px;
}

.topic-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 14px;
}

.topic-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 12px;
  border: 0.5px solid var(--separator);
  border-radius: 16px;
  background: var(--grouped-cell);
}

.topic-row.is-current {
  border-color: color-mix(in srgb, var(--accent) 64%, var(--separator));
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.topic-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
}

.topic-icon {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: #fff;
  background: var(--accent);
}

.topic-main strong,
.topic-main small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topic-main strong {
  font-size: 16px;
  letter-spacing: 0;
}

.topic-main small {
  margin-top: 2px;
  color: var(--label-2);
  font-size: 12px;
}

.topic-controls {
  display: flex;
  align-items: center;
  gap: 7px;
}

.mini-btn {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--label);
  background: var(--fill);
}

.mini-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.mini-btn.danger {
  color: #ff453a;
}

.topic-toggles,
.topic-relevance {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.source-pill,
.topic-relevance button {
  min-height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  color: var(--label-2);
  background: var(--fill);
  font-size: 12px;
  font-weight: 700;
}

.source-pill.on,
.topic-relevance button.on {
  color: #fff;
  background: var(--accent);
}

.sheet-actions {
  display: flex;
  gap: 10px;
  padding: 14px;
  border-top: 0.5px solid var(--separator);
}

.sheet-actions .btn {
  flex: 1;
}

@media (max-width: 640px) {
  .tile .overlay {
    padding: 44px 9px 9px;
  }

  .tile .overlay .t {
    font-size: 12.5px;
  }

  .tile .overlay .s {
    font-size: 10.5px;
  }

  .tile .follow-topic,
  .tile .feedback-card {
    opacity: 1;
    transform: none;
  }

  .tile .hide-card {
    opacity: 1;
    transform: none;
  }

  .reel-info {
    right: 70px;
  }

  .reel-info h2 {
    display: -webkit-box;
    overflow: hidden;
    font-size: 16px;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .sheet-scrim {
    padding: 0;
  }

  .topic-sheet {
    max-height: calc(100dvh - 10px);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 20px 20px 0 0;
  }

  .topic-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .topic-controls {
    justify-content: flex-end;
  }

  .sheet-actions {
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }
}
