/* ============================================
   PornTok - Premium Dark Theme Styles
   TikTok-style NSFW Video Viewer
   ============================================ */

/* ---------- CSS Custom Properties ---------- */
:root {
  --bg-primary: #000000;
  --bg-surface: #0a0a0f;
  --bg-card: rgba(255, 255, 255, 0.05);
  --bg-glass: rgba(10, 10, 15, 0.75);
  --bg-glass-heavy: rgba(10, 10, 15, 0.92);

  --accent-pink: #ff2d55;
  --accent-purple: #7c3aed;
  --accent-gradient: linear-gradient(135deg, #ff2d55, #c025d1, #7c3aed);
  --accent-gradient-h: linear-gradient(90deg, #ff2d55, #c025d1, #7c3aed);

  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-muted: rgba(255, 255, 255, 0.4);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(255, 45, 85, 0.3);

  --shadow-glow: 0 0 20px rgba(255, 45, 85, 0.2);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --z-feed: 1;
  --z-overlay: 10;
  --z-topbar: 50;
  --z-drawer: 100;
  --z-splash: 200;
  --z-toast: 300;
  --z-install: 150;

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

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 0; height: 0; }
* { scrollbar-width: none; }

/* ---------- Top Bar ---------- */
#top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-topbar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(4px + var(--safe-top)) 16px 12px;
  background: transparent;
  pointer-events: none;
}

#top-bar > * { pointer-events: auto; }

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

.logo-icon {
  width: 32px;
  height: 32px;
  filter: drop-shadow(0 0 8px rgba(255, 45, 85, 0.5));
}

.logo-text {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.accent {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.top-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

/* ---------- Icon Buttons ---------- */
.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
}

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

.icon-btn svg {
  width: 20px;
  height: 20px;
}

.icon-btn.active {
  background: var(--accent-pink);
  border-color: var(--accent-pink);
  box-shadow: 0 0 16px rgba(255, 45, 85, 0.4);
}

/* ---------- Tags Drawer ---------- */
.drawer {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-drawer);
  pointer-events: none;
  visibility: hidden;
}

.drawer.open {
  pointer-events: auto;
  visibility: visible;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: opacity 0.3s ease;
}

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

.drawer-content {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(340px, 85vw);
  background: var(--bg-glass-heavy);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border-left: 1px solid var(--border-subtle);
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.drawer.open .drawer-content {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(16px + var(--safe-top)) 20px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.drawer-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---------- Tags Grid ---------- */
.tags-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 20px;
}

.tag-card {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: capitalize;
  position: relative;
  overflow: hidden;
}

.tag-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.tag-card:hover {
  border-color: var(--border-accent);
  color: var(--text-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.tag-card:hover::before {
  opacity: 0.1;
}

.tag-card.active {
  border-color: var(--accent-pink);
  color: var(--text-primary);
  background: rgba(255, 45, 85, 0.12);
}

.tag-card.active::before {
  opacity: 0.15;
}

/* ---------- Active Tag Bar ---------- */
.active-tag {
  display: none !important;
  top: calc(64px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-topbar);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 16px;
  background: var(--bg-glass-heavy);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-pink);
  box-shadow: var(--shadow-glow);
  animation: slideDown 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  text-transform: capitalize;
}

.clear-btn {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  transition: all 0.2s;
}

.clear-btn:hover {
  background: var(--accent-pink);
  color: white;
}

/* ---------- Feed Container ---------- */
.feed-container {
  width: 100%;
  height: 100%;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* ---------- Video Slide ---------- */
.video-slide {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  position: relative;
  overflow: hidden;
  background: var(--bg-primary);
}

.video-wrapper {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.video-player {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
  /* Hide until actually playing to prevent half-screen flash */
  opacity: 0;
  transition: opacity 0.15s ease;
}

.video-player.is-playing {
  opacity: 1;
}

/* Anti-download: transparent shield over video */
.video-shield {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  background: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Disable selection and callout on all media */
video, img {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  pointer-events: none;
}

/* Re-enable pointer events on video for play/pause via wrapper click */
.video-wrapper {
  position: relative;
  cursor: pointer;
}

/* Smart zoom for landscape/horizontal videos */
.video-player.landscape-zoom {
  object-fit: cover;
  transform: scale(1.15);
  animation: smartPan 12s ease-in-out infinite alternate;
}

@keyframes smartPan {
  0%   { object-position: 30% 40%; }
  25%  { object-position: 70% 50%; }
  50%  { object-position: 50% 60%; }
  75%  { object-position: 40% 35%; }
  100% { object-position: 60% 55%; }
}

/* ---------- Video Loading ---------- */
.video-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  z-index: 2;
  transition: opacity 0.3s;
}

.video-loading.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent-pink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ---------- Video Poster ---------- */
.video-poster {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease;
  cursor: pointer;
}

.video-poster.hidden {
  opacity: 0;
  pointer-events: none;
}

.play-big {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-full);
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 2px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: white;
  transition: all 0.25s;
  cursor: pointer;
}

.play-big:hover {
  transform: scale(1.1);
  border-color: var(--accent-pink);
  box-shadow: 0 0 30px rgba(255, 45, 85, 0.3);
}

/* ---------- Slide Overlay ---------- */
.slide-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 70px;
  z-index: var(--z-overlay);
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.slide-overlay.overlay-hidden {
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none !important;
}

/* Keep tags always visible — they live outside the overlay */

.slide-overlay.overlay-hidden .slide-info {
  pointer-events: none !important;
}

.slide-gradient {
  position: absolute;
  bottom: 0;
  left: 0;
  right: -70px;
  height: 280px;
  background: linear-gradient(0deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 50%, transparent 100%);
  pointer-events: none;
}

.slide-info {
  position: relative;
  padding: 0 16px calc(80px + var(--safe-bottom));
  pointer-events: auto;
}

.slide-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.slide-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.slide-tags-fixed {
  position: absolute;
  bottom: calc(24px + var(--safe-bottom));
  left: 16px;
  right: 70px;
  z-index: var(--z-overlay);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  pointer-events: auto;
}

.tag-pill {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  pointer-events: auto;
  text-transform: capitalize;
}

.tag-pill:hover {
  background: rgba(255, 45, 85, 0.2);
  border-color: var(--border-accent);
  color: var(--accent-pink);
}

.tag-pill.tag-active {
  background: var(--accent-gradient);
  border-color: rgba(192, 37, 209, 0.6);
  color: #fff;
  box-shadow: 0 0 14px rgba(124, 58, 237, 0.5), 0 0 6px rgba(255, 45, 85, 0.3);
  transform: scale(1.08);
}

/* ---------- Slide Actions (Right sidebar) ---------- */
.slide-actions {
  position: absolute;
  right: 10px;
  bottom: calc(100px + var(--safe-bottom));
  z-index: var(--z-overlay);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-primary);
  transition: all 0.2s;
}

.action-btn svg {
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
  transition: transform 0.2s;
}

.action-btn span {
  font-size: 0.65rem;
  font-weight: 500;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  color: var(--text-secondary);
}

.action-btn:hover svg {
  transform: scale(1.15);
}

.action-btn:active svg {
  transform: scale(0.9);
}

.like-btn.liked svg {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  fill: url(#like-gradient);
  animation: popHeart 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.like-btn.liked span {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---------- Heart Animation (double-tap) ---------- */
.heart-animation {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  pointer-events: none;
}

.heart-animation svg {
  width: 100px;
  height: 100px;
  fill: url(#like-gradient);
  opacity: 0;
  transform: scale(0);
}

.heart-animation.pop svg {
  animation: heartPop 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* ---------- Pause Indicator ---------- */
.pause-indicator {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 15;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}

.pause-indicator.show {
  opacity: 1;
}

.pause-icon {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-full);
  background: var(--bg-glass);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pause-icon svg {
  width: 28px;
  height: 28px;
}

/* ---------- No Video Fallback ---------- */
.no-video-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--bg-surface);
  z-index: 5;
}

.no-video-fallback .fallback-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
}

.no-video-fallback .fallback-icon svg {
  width: 28px;
  height: 28px;
  color: var(--text-muted);
}

.no-video-fallback p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.btn-primary {
  padding: 10px 24px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--accent-gradient);
  color: white;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
  box-shadow: 0 4px 16px rgba(255, 45, 85, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(255, 45, 85, 0.4);
}

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

.btn-ghost {
  padding: 10px 24px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-ghost:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

/* ---------- Loading More ---------- */
.loading-more {
  position: fixed;
  bottom: calc(20px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-overlay);
  padding: 12px 24px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.loading-more .spinner {
  width: 24px;
  height: 24px;
  border-width: 2px;
}

/* ---------- Splash Screen ---------- */
.splash {
  position: fixed;
  inset: 0;
  z-index: var(--z-splash);
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.splash.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.splash-logo svg {
  animation: pulseLogo 2s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(255, 45, 85, 0.4));
}

.splash-title {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.splash-sub {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.splash-bar {
  width: 180px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.splash-bar-fill {
  width: 30%;
  height: 100%;
  border-radius: 2px;
  background: var(--accent-gradient-h);
  animation: loadingBar 1.5s ease-in-out infinite;
}

/* ---------- Install Banner ---------- */
.install-banner {
  position: fixed;
  bottom: calc(20px + var(--safe-bottom));
  left: 16px;
  right: 16px;
  z-index: var(--z-install);
  background: var(--bg-glass-heavy);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-card);
  animation: slideUp 0.4s cubic-bezier(0.32, 0.72, 0, 1);
}

.install-banner p {
  font-size: 0.9rem;
  font-weight: 500;
}

.install-actions {
  display: flex;
  gap: 10px;
}

.install-actions .btn-primary,
.install-actions .btn-ghost {
  flex: 1;
  padding: 10px 16px;
  font-size: 0.85rem;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: calc(80px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  background: var(--bg-glass-heavy);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 10px 20px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  box-shadow: var(--shadow-card);
  animation: slideUp 0.3s ease, fadeOut 0.3s ease 2s forwards;
  white-space: nowrap;
}

/* ---------- Empty State ---------- */
.empty-state {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 40px;
  text-align: center;
}

.empty-state svg {
  width: 64px;
  height: 64px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.empty-state h3 {
  font-size: 1.2rem;
  font-weight: 600;
}

.empty-state p {
  font-size: 0.9rem;
  color: var(--text-muted);
  max-width: 280px;
}

/* ---------- Muted Indicator ---------- */
.muted-indicator {
  position: absolute;
  top: calc(72px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-overlay);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  color: var(--text-secondary);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.muted-indicator.show {
  opacity: 1;
  pointer-events: auto;
  cursor: pointer;
}

.muted-indicator svg {
  width: 16px;
  height: 16px;
}

/* ---------- Animations ---------- */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes popHeart {
  0% { transform: scale(0.5); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

@keyframes heartPop {
  0% { opacity: 0; transform: scale(0); }
  15% { opacity: 1; transform: scale(1.2); }
  30% { transform: scale(0.95); }
  45% { transform: scale(1.05); }
  60% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes fadeOut {
  to { opacity: 0; visibility: hidden; }
}

@keyframes loadingBar {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(200%); }
  100% { transform: translateX(400%); }
}

@keyframes pulseLogo {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.8; }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ---------- Skeleton Loading ---------- */
.skeleton {
  background: linear-gradient(90deg,
    rgba(255,255,255,0.04) 25%,
    rgba(255,255,255,0.08) 50%,
    rgba(255,255,255,0.04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* ---------- Responsive ---------- */
@media (min-width: 768px) {
  .feed-container {
    max-width: 480px;
    margin: 0 auto;
    border-left: 1px solid var(--border-subtle);
    border-right: 1px solid var(--border-subtle);
  }

  .video-slide {
    max-width: 480px;
  }

  #top-bar {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%);
  }

  .active-tag {
    max-width: 300px;
  }

  .slide-actions {
    right: calc(50% - 240px + 10px);
  }

  .slide-overlay {
    max-width: 410px;
    left: calc(50% - 240px);
  }

  .install-banner {
    max-width: 420px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }

  .drawer-content {
    width: 360px;
  }
}

@media (max-width: 360px) {
  .slide-title {
    font-size: 0.85rem;
  }

  .tag-pill {
    font-size: 0.68rem;
    padding: 3px 8px;
  }

  .action-btn svg {
    width: 24px;
    height: 24px;
  }
}

/* ---------- Progress Bar (video) ---------- */
.video-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  z-index: var(--z-overlay);
}

.video-progress-fill {
  height: 100%;
  background: var(--accent-gradient-h);
  width: 0%;
  transition: width 0.1s linear;
  border-radius: 0 2px 2px 0;
}

/* ---------- Autoplay Badge ---------- */
.autoplay-badge {
  position: fixed;
  top: calc(66px + var(--safe-top));
  right: 16px;
  z-index: var(--z-topbar);
  padding: 4px 10px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.autoplay-badge.show {
  opacity: 1;
}

/* ---------- Repeat Mode Button ---------- */
.mode-btn {
  position: relative;
  min-width: 52px;
  padding: 4px 10px !important;
  border-radius: var(--radius-full) !important;
  font-size: 0.7rem;
  font-weight: 700;
  transition: all 0.3s ease;
}

.mode-btn .mode-label {
  font-size: 0.65rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.mode-btn.active {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: white;
}

.mode-btn.active .mode-label {
  color: white;
}

/* ---------- Slide Number ---------- */
.slide-number {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 5;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.5);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  pointer-events: none;
}

/* ---------- Source Badge ---------- */
.source-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 5;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  pointer-events: none;
  text-transform: uppercase;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.source-rm {
  background: rgba(59, 130, 246, 0.7);
  color: #e0eaff;
}

.source-tp {
  background: rgba(255, 45, 85, 0.7);
  color: #ffe0e8;
}

.source-og {
  background: rgba(255, 149, 0, 0.7);
  color: #fff3e0;
}

.source-pn {
  background: rgba(16, 185, 129, 0.5);
  color: #fff;
}

.source-ph {
  background: rgba(255, 153, 0, 0.7);
  color: #fff;
}

/* ---------- Feed scroll override for PC ---------- */
.feed-container {
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
}

.video-slide {
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

@media (min-width: 768px) {
  .autoplay-badge {
    right: calc(50% - 240px + 16px);
  }
}

/* Mobile: raise action buttons */
@media (max-width: 767px) {
  .slide-actions {
    bottom: calc(200px + var(--safe-bottom));
  }
}
