/* ==========================================================================
   VAULT · iOS Dark Glassmorphism Waterfall Gallery
   Mobile-first, single-handed ergonomics, full iOS safe-area adaptation
   ========================================================================== */

:root {
  --bg-obsidian: #07080d;
  --bg-elevated: rgba(18, 20, 30, 0.72);
  --glass-header: rgba(11, 13, 21, 0.76);
  --glass-card: rgba(21, 24, 36, 0.66);
  --glass-sheet: rgba(16, 18, 28, 0.86);
  --glass-pill: rgba(255, 255, 255, 0.065);
  --glass-pill-hover: rgba(255, 255, 255, 0.11);

  --border-hairline: rgba(255, 255, 255, 0.085);
  --border-specular: rgba(255, 255, 255, 0.16);

  --text-primary: #f5f6fa;
  --text-secondary: rgba(235, 238, 248, 0.66);
  --text-muted: rgba(220, 225, 240, 0.42);

  --accent-indigo: #6e6aff;
  --accent-violet: #9d6bff;
  --accent-rose: #ff3b6b;
  --accent-amber: #ff9f43;
  --accent-emerald: #2ed573;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --radius-card: 18px;
  --radius-sheet: 28px;
  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html,
body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-obsidian);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  min-height: 100dvh;
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

/* --------------------------------------------------------------------------
   Ambient Aurora Glows (shining subtly behind frosted glass)
   -------------------------------------------------------------------------- */
.ambient-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.22;
  will-change: transform;
}

.orb-1 {
  width: 340px;
  height: 340px;
  top: -110px;
  left: -80px;
  background: radial-gradient(circle, #5e5ce6 0%, transparent 70%);
}

.orb-2 {
  width: 300px;
  height: 300px;
  top: 28%;
  right: -110px;
  background: radial-gradient(circle, #bf5af2 0%, transparent 70%);
  opacity: 0.14;
}

.orb-3 {
  width: 360px;
  height: 360px;
  bottom: -140px;
  left: 15%;
  background: radial-gradient(circle, #ff375f 0%, transparent 72%);
  opacity: 0.12;
}

/* --------------------------------------------------------------------------
   Sticky Frosted Glass Header
   -------------------------------------------------------------------------- */
.glass-header {
  position: sticky;
  top: 0;
  z-index: 40;
  padding: calc(8px + var(--safe-top)) 14px 10px;
  background: var(--glass-header);
  backdrop-filter: blur(28px) saturate(190%);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  border-bottom: 0.5px solid var(--border-hairline);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.36);
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 7px;
}

.brand-gem {
  font-size: 14px;
  background: linear-gradient(135deg, #9d6bff, #ff5e8e);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--text-primary);
}

.count-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.075);
  border: 0.5px solid var(--border-hairline);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.dev-pill {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 159, 67, 0.16);
  border: 0.5px solid rgba(255, 159, 67, 0.38);
  color: #ffb974;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.micro-glass-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 0.5px solid var(--border-hairline);
  background: var(--glass-pill);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.micro-glass-btn:active {
  transform: scale(0.95);
}

.micro-glass-btn.burn-active {
  background: rgba(255, 59, 107, 0.16);
  border-color: rgba(255, 59, 107, 0.42);
  color: #ff85a1;
}

.burn-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  transition: all 0.25s ease;
}

.micro-glass-btn.burn-active .burn-dot {
  background: #ff3b6b;
  box-shadow: 0 0 8px #ff3b6b;
}

.sort-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.sort-select {
  appearance: none;
  -webkit-appearance: none;
  height: 28px;
  padding: 0 24px 0 10px;
  border-radius: 999px;
  border: 0.5px solid var(--border-hairline);
  background: var(--glass-pill);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.sort-select option {
  background: #141724;
  color: var(--text-primary);
}

.sort-chevron {
  position: absolute;
  right: 7px;
  width: 13px;
  height: 13px;
  color: var(--text-muted);
  pointer-events: none;
}

/* Search Bar */
.search-row {
  margin-bottom: 9px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  height: 38px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.06);
  border: 0.5px solid rgba(255, 255, 255, 0.09);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.28);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.search-box:focus-within {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(125, 118, 255, 0.55);
}

.search-icon {
  width: 16px;
  height: 16px;
  margin-left: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

#searchInput {
  flex: 1;
  height: 100%;
  border: none;
  background: transparent;
  padding: 0 32px 0 9px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
}

#searchInput::placeholder {
  color: var(--text-muted);
}

#searchInput::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.search-clear {
  position: absolute;
  right: 8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.16);
  color: var(--text-primary);
  font-size: 11px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

/* iOS Segmented Control */
.segmented-tabs {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 3px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 0.5px solid rgba(255, 255, 255, 0.07);
  margin-bottom: 9px;
}

.seg-glider {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc((100% - 6px) / 5);
  border-radius: 9px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.17), rgba(255, 255, 255, 0.09));
  border: 0.5px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
  transition: transform 0.28s var(--ease-spring);
  pointer-events: none;
}

.seg-btn {
  position: relative;
  z-index: 1;
  height: 29px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s ease;
}

.seg-btn.active {
  color: var(--text-primary);
}

/* Multi-select Tag Capsules Rail */
.tags-rail-wrap {
  margin: 0 -14px;
  padding: 0 14px;
}

.tags-rail {
  display: flex;
  align-items: center;
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 2px 2px 3px;
}

.tags-rail::-webkit-scrollbar {
  display: none;
}

.tag-capsule {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 27px;
  padding: 0 11px;
  border-radius: 999px;
  border: 0.5px solid rgba(255, 255, 255, 0.085);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s var(--ease-spring);
}

.tag-capsule:active {
  transform: scale(0.94);
}

.tag-capsule .tag-cnt {
  font-size: 10.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.tag-capsule.selected {
  background: linear-gradient(135deg, rgba(110, 106, 255, 0.38), rgba(168, 85, 247, 0.32));
  border-color: rgba(157, 107, 255, 0.72);
  color: #ffffff;
  box-shadow: 0 2px 12px rgba(110, 106, 255, 0.28);
}

.tag-capsule.selected .tag-cnt {
  color: rgba(255, 255, 255, 0.8);
}

.tag-capsule.clear-tags-chip {
  background: rgba(255, 59, 107, 0.14);
  border-color: rgba(255, 59, 107, 0.4);
  color: #ff8ca8;
}

/* --------------------------------------------------------------------------
   Gallery Stage & Dual-Column Waterfall Masonry
   -------------------------------------------------------------------------- */
.gallery-stage {
  position: relative;
  z-index: 1;
  max-width: 820px;
  margin: 0 auto;
  padding: 12px 11px calc(98px + var(--safe-bottom));
}

.filter-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  margin-bottom: 10px;
  border-radius: 12px;
  background: rgba(110, 106, 255, 0.11);
  border: 0.5px solid rgba(125, 118, 255, 0.26);
  font-size: 12px;
  color: rgba(235, 238, 255, 0.85);
}

.reset-filter-link {
  border: none;
  background: none;
  color: #a99cff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.masonry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: start;
}

.masonry-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

/* --------------------------------------------------------------------------
   Waterfall Card
   -------------------------------------------------------------------------- */
.vault-card {
  position: relative;
  border-radius: var(--radius-card);
  background: var(--glass-card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 0.5px solid var(--border-hairline);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.32),
    inset 0 0.5px 0 rgba(255, 255, 255, 0.11);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.22s var(--ease-spring), border-color 0.2s ease;
  animation: cardFadeUp 0.34s var(--ease-spring) both;
}

@keyframes cardFadeUp {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.vault-card:active {
  transform: scale(0.972);
}

.card-cover {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: #121521;
}

/* Varied organic waterfall aspect ratios for luxury placeholder covers */
.card-cover.ratio-tall {
  aspect-ratio: 3 / 4.1;
}
.card-cover.ratio-mid {
  aspect-ratio: 4 / 4.3;
}
.card-cover.ratio-cinema {
  aspect-ratio: 16 / 11.5;
}
.card-cover.ratio-portrait {
  aspect-ratio: 3 / 3.7;
}

.card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.32s ease, transform 0.4s ease;
}

.card-img.loaded {
  opacity: 1;
}

/* Luxury Dark Silk Gradients for Legacy Items Without Thumbnails */
.card-art-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 12px;
  text-align: center;
  overflow: hidden;
}

.card-art-placeholder::before {
  content: "";
  position: absolute;
  inset: -20%;
  background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.12), transparent 55%);
  pointer-events: none;
}

.art-watermark {
  position: absolute;
  top: 10px;
  left: 11px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.28);
  font-variant-numeric: tabular-nums;
}

.art-big-tag {
  position: relative;
  z-index: 1;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1.25;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
  max-width: 100%;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.art-sub-hint {
  position: relative;
  z-index: 1;
  margin-top: 6px;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.44);
}

/* 8 Curated Moody Dark Glass Palettes */
.grad-0 { background: linear-gradient(145deg, #1b1838 0%, #2d1b4e 52%, #131629 100%); }
.grad-1 { background: linear-gradient(145deg, #2b1429 0%, #4a1936 52%, #161321 100%); }
.grad-2 { background: linear-gradient(145deg, #10252b 0%, #173b45 52%, #0e1624 100%); }
.grad-3 { background: linear-gradient(145deg, #291d15 0%, #462a1b 52%, #15141f 100%); }
.grad-4 { background: linear-gradient(145deg, #181f3d 0%, #253463 52%, #111424 100%); }
.grad-5 { background: linear-gradient(145deg, #231636 0%, #3d1e4f 52%, #121522 100%); }
.grad-6 { background: linear-gradient(145deg, #142824 0%, #1d4238 52%, #101621 100%); }
.grad-7 { background: linear-gradient(145deg, #2a1824 0%, #44223a 52%, #131524 100%); }

/* Card Floating Overlays */
.card-scrim {
  position: absolute;
  inset: auto 0 0 0;
  height: 54%;
  background: linear-gradient(to top, rgba(6, 7, 12, 0.78) 0%, transparent 100%);
  pointer-events: none;
}

.card-col-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  padding: 3px 7px;
  border-radius: 8px;
  background: rgba(10, 12, 20, 0.62);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 0.5px solid rgba(255, 255, 255, 0.16);
  color: #f0f2ff;
  font-size: 10.5px;
  font-weight: 700;
}

.card-fav-btn {
  position: absolute;
  top: 7px;
  right: 7px;
  z-index: 4;
  width: 31px;
  height: 31px;
  border-radius: 50%;
  border: 0.5px solid rgba(255, 255, 255, 0.16);
  background: rgba(10, 12, 20, 0.52);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: grid;
  place-items: center;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.22s var(--ease-spring), background 0.2s ease;
}

.card-fav-btn:active {
  transform: scale(1.25);
}

.card-fav-btn.is-fav {
  background: rgba(255, 59, 107, 0.24);
  border-color: rgba(255, 92, 133, 0.5);
}

.card-micro-bar {
  position: absolute;
  left: 7px;
  right: 7px;
  bottom: 7px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  pointer-events: none;
}

.micro-chip {
  padding: 2.5px 6.5px;
  border-radius: 7px;
  background: rgba(9, 11, 18, 0.66);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 0.5px solid rgba(255, 255, 255, 0.13);
  color: rgba(248, 250, 255, 0.94);
  font-size: 10.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.card-body {
  padding: 9px 10px 10px;
}

.card-title {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.36;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.card-meta-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.card-mini-tags {
  display: flex;
  flex-wrap: nowrap;
  overflow: hidden;
  gap: 4px;
  min-width: 0;
}

.mini-tag {
  flex-shrink: 0;
  font-size: 10.5px;
  padding: 1.5px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text-secondary);
  max-width: 78px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-plays {
  flex-shrink: 0;
  font-size: 10.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   Empty State & Infinite Scroll Sentinel
   -------------------------------------------------------------------------- */
.empty-state {
  text-align: center;
  padding: 68px 24px;
}

.empty-glyph {
  font-size: 42px;
  margin-bottom: 10px;
}

.empty-title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.empty-desc {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.load-sentinel {
  display: flex;
  justify-content: center;
  padding: 20px 0 8px;
}

.spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2.2px solid rgba(255, 255, 255, 0.14);
  border-top-color: #9d6bff;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --------------------------------------------------------------------------
   Floating Blindbox (盲盒抽片) Dock + Safe Area
   -------------------------------------------------------------------------- */
.floating-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(16px + var(--safe-bottom));
  z-index: 35;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.blindbox-fab {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 22px;
  border-radius: 999px;
  border: 0.5px solid rgba(255, 255, 255, 0.24);
  background: linear-gradient(
    135deg,
    rgba(30, 27, 58, 0.86) 0%,
    rgba(52, 28, 74, 0.88) 50%,
    rgba(28, 25, 48, 0.86) 100%
  );
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.52),
    0 0 24px rgba(139, 92, 246, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: transform 0.22s var(--ease-spring), box-shadow 0.22s ease;
}

.blindbox-fab:active {
  transform: scale(0.94);
}

.dice-icon {
  font-size: 18px;
  display: inline-block;
  transition: transform 0.45s var(--ease-spring);
}

.blindbox-fab.rolling .dice-icon {
  transform: rotate(360deg) scale(1.2);
}

/* --------------------------------------------------------------------------
   Glass Toast
   -------------------------------------------------------------------------- */
.glass-toast {
  position: fixed;
  top: calc(14px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 28px);
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(20, 23, 36, 0.9);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 0.5px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  animation: toastDrop 0.26s var(--ease-spring);
}

@keyframes toastDrop {
  from { opacity: 0; transform: translate(-50%, -12px) scale(0.96); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

.toast-action {
  border: none;
  border-radius: 999px;
  padding: 4px 10px;
  background: linear-gradient(135deg, #6e6aff, #9d6bff);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   Bottom Sheet Detail Drawer (Glassmorphism + iOS Safe Area)
   -------------------------------------------------------------------------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(3, 4, 8, 0.64);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.28s ease;
}

.sheet-backdrop.open {
  opacity: 1;
}

.bottom-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 70;
  max-width: 680px;
  margin: 0 auto;
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  background: var(--glass-sheet);
  backdrop-filter: blur(34px) saturate(190%);
  -webkit-backdrop-filter: blur(34px) saturate(190%);
  border-top: 0.5px solid var(--border-specular);
  box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.62);
  transform: translateY(104%);
  transition: transform 0.34s var(--ease-spring);
  will-change: transform;
}

.bottom-sheet.open {
  transform: translateY(0);
}

.sheet-drag-zone {
  padding: 10px 0 6px;
  display: flex;
  justify-content: center;
  cursor: grab;
  flex-shrink: 0;
  touch-action: none;
}

.sheet-grabber {
  width: 38px;
  height: 4.5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.24);
}

.sheet-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2px 16px 16px;
}

/* Sheet Visual Hero */
.sheet-hero {
  position: relative;
  height: 196px;
  border-radius: 20px;
  overflow: hidden;
  margin-bottom: 14px;
  border: 0.5px solid rgba(255, 255, 255, 0.11);
}

.sheet-hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sheet-hero-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
}

.hero-fallback-tag {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
}

.sheet-hero-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(6, 8, 14, 0.48) 0%,
    rgba(6, 8, 14, 0.12) 45%,
    rgba(6, 8, 14, 0.82) 100%
  );
  pointer-events: none;
}

.sheet-hero-top {
  position: absolute;
  top: 11px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hero-id-pill {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(10, 12, 20, 0.62);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 0.5px solid rgba(255, 255, 255, 0.15);
  font-size: 11.5px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.88);
  font-variant-numeric: tabular-nums;
}

.hero-top-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hero-circle-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0.5px solid rgba(255, 255, 255, 0.18);
  background: rgba(10, 12, 20, 0.58);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: #fff;
  font-size: 15px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.hero-circle-btn:active {
  transform: scale(0.92);
}

.sheet-hero-bottom {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 11px;
}

.hero-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.metric-pill {
  padding: 3.5px 9px;
  border-radius: 8px;
  background: rgba(12, 14, 24, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 0.5px solid rgba(255, 255, 255, 0.14);
  font-size: 11.5px;
  font-weight: 600;
  color: rgba(245, 247, 255, 0.94);
}

/* Sheet Content Sections */
.sheet-section {
  margin-bottom: 16px;
}

.sheet-title {
  margin: 0 0 6px;
  font-size: 16.5px;
  font-weight: 700;
  line-height: 1.42;
  color: var(--text-primary);
}

.sheet-desc {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 0.5px solid rgba(255, 255, 255, 0.06);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-secondary);
  white-space: pre-line;
  max-height: 110px;
  overflow-y: auto;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.section-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-secondary);
}

.section-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* Collection Episodes Vertical List in Bottom Sheet */
.episodes-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 215px;
  overflow-y: auto;
  padding-right: 2px;
}

.ep-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 0.5px solid var(--border-hairline);
  background: rgba(255, 255, 255, 0.045);
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.ep-row.active {
  background: rgba(110, 106, 255, 0.18);
  border-color: rgba(145, 135, 255, 0.55);
}

.ep-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.ep-index {
  flex-shrink: 0;
  padding: 2.5px 7px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.09);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ep-row.active .ep-index {
  background: linear-gradient(135deg, #6e6aff, #9d6bff);
  color: #fff;
}

.ep-meta-text {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.ep-send-mini {
  flex-shrink: 0;
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  border: 0.5px solid rgba(145, 135, 255, 0.48);
  background: rgba(110, 106, 255, 0.24);
  color: #f3f1ff;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease;
}

.ep-send-mini:active {
  transform: scale(0.93);
  background: rgba(110, 106, 255, 0.45);
}

.ep-send-mini:disabled {
  opacity: 0.5;
  cursor: wait;
}

.vault-card.is-collection {
  box-shadow:
    0 4px 0 -1.5px rgba(34, 38, 58, 0.85),
    0 5px 0 -1px rgba(255, 255, 255, 0.09),
    0 12px 26px rgba(0, 0, 0, 0.38),
    inset 0 0.5px 0 rgba(255, 255, 255, 0.13);
}

/* Sheet Interactive Tag Editor */
.sheet-tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 10px;
}

.edit-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(110, 106, 255, 0.16);
  border: 0.5px solid rgba(135, 125, 255, 0.36);
  color: #ecebff;
  font-size: 12.5px;
  font-weight: 600;
}

.edit-tag-remove {
  border: none;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  font-size: 10px;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}

.tag-add-form {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.tag-add-input {
  flex: 1;
  height: 36px;
  padding: 0 12px;
  border-radius: 11px;
  border: 0.5px solid var(--border-hairline);
  background: rgba(255, 255, 255, 0.055);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
}

.tag-add-input:focus {
  border-color: rgba(135, 125, 255, 0.6);
}

.tag-add-submit {
  height: 36px;
  padding: 0 14px;
  border-radius: 11px;
  border: 0.5px solid rgba(135, 125, 255, 0.45);
  background: rgba(110, 106, 255, 0.24);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

.quick-tags-suggest {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.quick-tags-suggest::-webkit-scrollbar {
  display: none;
}

.suggest-tag-btn {
  flex-shrink: 0;
  padding: 3.5px 9px;
  border-radius: 999px;
  border: 0.5px dashed rgba(255, 255, 255, 0.16);
  background: transparent;
  color: var(--text-muted);
  font-size: 11.5px;
  cursor: pointer;
}

.suggest-tag-btn:active {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

/* Sheet Pinned Action Footer + Safe Area */
.sheet-footer {
  flex-shrink: 0;
  padding: 11px 16px calc(14px + var(--safe-bottom));
  border-top: 0.5px solid var(--border-hairline);
  background: rgba(12, 14, 22, 0.85);
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.primary-cta-group {
  display: flex;
  gap: 8px;
}

.btn-primary-send {
  flex: 1;
  height: 46px;
  border-radius: 14px;
  border: 0.5px solid rgba(255, 255, 255, 0.22);
  background: linear-gradient(135deg, #635bff 0%, #9353ff 100%);
  box-shadow: 0 8px 22px rgba(105, 86, 255, 0.36);
  color: #ffffff;
  font-size: 14.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.btn-primary-send:active {
  transform: scale(0.975);
}

.btn-primary-send:disabled,
.btn-collection-send:disabled {
  opacity: 0.58;
  cursor: wait;
}

.btn-collection-send {
  height: 46px;
  padding: 0 15px;
  border-radius: 14px;
  border: 0.5px solid rgba(157, 107, 255, 0.5);
  background: rgba(139, 92, 246, 0.2);
  color: #efeaff;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.btn-danger-delete {
  height: 38px;
  border-radius: 12px;
  border: 0.5px solid rgba(255, 59, 107, 0.22);
  background: rgba(255, 59, 107, 0.08);
  color: rgba(255, 118, 148, 0.88);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-danger-delete.confirming {
  background: linear-gradient(135deg, #e11d48, #be123c);
  border-color: rgba(255, 255, 255, 0.3);
  color: #ffffff;
  font-weight: 700;
}

/* Desktop / Tablet Responsive Polish */
@media (min-width: 640px) {
  .masonry-grid {
    gap: 14px;
  }
  .masonry-col {
    gap: 14px;
  }
  .sheet-hero {
    height: 230px;
  }
}
