/* ═══════════════════════════════════════
   СДВИГ — Cinematic Void Design System
   ═══════════════════════════════════════ */

/* ── Reset & Base ── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* ── Native App Behavior ── */
html, body {
  overscroll-behavior: none;          /* No pull-to-refresh / rubber-band */
  -webkit-overflow-scrolling: touch;  /* Smooth inertia scroll */
  touch-action: pan-y;                /* Prevent accidental horizontal gestures */
  overflow: hidden;                   /* Prevent body scroll */
  height: 100%;
  width: 100%;
  position: fixed;                    /* Lock viewport to prevent address-bar resize */
}

/* Safe area insets for notch/rounded corners */
:root {
  --status-bar-height: 0px;
}
#app {
  padding-top: env(safe-area-inset-top, var(--status-bar-height));
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* Native app: ensure top bar content doesn't overlap system bar */
.capacitor-native #mobileTopBar {
  padding-top: var(--status-bar-height);
  height: auto !important;
  min-height: 140px;
}
.capacitor-native #mobileTopBar > div {
  padding-top: 6px !important;
}
/* Hide sound toggle on all mobile devices (both native app and mobile web) */
@media (max-width: 767px) {
  :root {
    --bnav-h: calc(80px + env(safe-area-inset-bottom, 0px));
  }
  .sound-toggle, .pf-sound-toggle, .cv-sound-toggle {
    display: none !important;
  }
  /* Shift feed info & actions above the bottom nav bar */
  .snap-item .overlay-bottom .feed-info-anim {
    padding-bottom: var(--bnav-h) !important;
  }
  .snap-item .feed-actions {
    bottom: calc(112px + var(--bnav-h)) !important;
  }
  .snap-item .subtitle-overlay {
    bottom: calc(230px + var(--bnav-h)) !important;
  }
}

/* Ad card: desktop overrides (no mobile header/nav) */
@media (min-width: 768px) {
  .ad-card [style*="top: 140px"] {
    top: 16px !important;
  }
  .ad-card [style*="bottom: max"] {
    bottom: 16px !important;
  }
}

/* Prevent text magnification on double-tap */
p, span, div, a, button, h1, h2, h3, h4, h5, h6 {
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

/* Hide number input spinners globally */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}

/* Range slider styling */
input[type="range"] {
  -webkit-appearance: none;
  height: 6px;
  border-radius: 999px;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #E040FB;
  cursor: pointer;
  box-shadow: 0 0 6px rgba(224, 64, 251, 0.4);
  border: 2px solid #181820;
}
input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #E040FB;
  cursor: pointer;
  border: 2px solid #181820;
}

/* Allow text selection in inputs/textareas */
input, textarea {
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

/* Override browser autofill white background */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--autofill-bg) inset !important;
  -webkit-text-fill-color: var(--autofill-color) !important;
  transition: background-color 5000s ease-in-out 0s;
}

/* Remove focus outlines, use custom ring on focus-visible */
*:focus {
  outline: none;
}

/* Hide native video controls long-press menus */
video::-webkit-media-controls {
  display: none !important;
}
video::-webkit-media-controls-enclosure {
  display: none !important;
}
video {
  -webkit-touch-callout: none;
  pointer-events: none;
}

/* Disable image/video drag ghost */
img, video {
  -webkit-user-drag: none;
}

/* ── Theme Variables ── */
:root {
  --bg-base: #0c0e12;
  --bg-surface: #12151a;
  --bg-elevated: #181c23;
  --bg-card: rgba(255,255,255,0.04);
  --bg-input: rgba(255,255,255,0.06);
  --bg-hover: rgba(255,255,255,0.06);
  --text-primary: #fff;
  --text-secondary: rgba(255,255,255,0.65);
  --text-muted: rgba(255,255,255,0.35);
  --text-faint: rgba(255,255,255,0.18);
  --border-subtle: rgba(255,255,255,0.06);
  --border-accent: rgba(0,255,163,0.15);
  --overlay: rgba(0,0,0,0.65);
  --glass-bg: rgba(0,0,0,0.30);
  --cyber: #00FFA3;
  --shadow: rgba(0,0,0,0.5);
  --sidebar-bg: #0e1016;
  --phone-bg: #0c0e12;
  --modal-bg: #12151a;
  --toast-bg: rgba(20,24,32,0.95);
  --gradient-top: radial-gradient(ellipse 90% 35% at 50% 0%, rgba(0,255,163,0.045) 0%, transparent 65%);
  --gradient-bl: radial-gradient(ellipse 50% 40% at 0% 100%, rgba(0,40,30,0.05) 0%, transparent 55%);
  --gradient-br: radial-gradient(ellipse 50% 40% at 100% 80%, rgba(0,20,60,0.04) 0%, transparent 55%);
  --autofill-bg: rgba(255,255,255,0.05);
  --autofill-color: white;
  color-scheme: dark;
}

html.light {
  --bg-base: #f5f6f8;
  --bg-surface: #ffffff;
  --bg-elevated: #eef0f4;
  --bg-card: rgba(0,0,0,0.03);
  --bg-input: rgba(0,0,0,0.05);
  --bg-hover: rgba(0,0,0,0.04);
  --text-primary: #1a1c20;
  --text-secondary: rgba(0,0,0,0.60);
  --text-muted: rgba(0,0,0,0.38);
  --text-faint: rgba(0,0,0,0.15);
  --border-subtle: rgba(0,0,0,0.08);
  --border-accent: rgba(0,180,100,0.20);
  --overlay: rgba(0,0,0,0.35);
  --glass-bg: rgba(255,255,255,0.70);
  --cyber: #00c27a;
  --shadow: rgba(0,0,0,0.12);
  --sidebar-bg: #ffffff;
  --phone-bg: #f5f6f8;
  --modal-bg: #ffffff;
  --toast-bg: rgba(255,255,255,0.95);
  --gradient-top: radial-gradient(ellipse 90% 35% at 50% 0%, rgba(0,180,100,0.06) 0%, transparent 65%);
  --gradient-bl: radial-gradient(ellipse 50% 40% at 0% 100%, rgba(0,180,100,0.04) 0%, transparent 55%);
  --gradient-br: radial-gradient(ellipse 50% 40% at 100% 80%, rgba(0,100,200,0.04) 0%, transparent 55%);
  --autofill-bg: rgba(0,0,0,0.03);
  --autofill-color: #1a1c20;
  color-scheme: light;
}

html,
body {
  height: 100%;
  overflow: hidden;
  background: var(--bg-base);
  background-image:
    var(--gradient-top),
    var(--gradient-bl),
    var(--gradient-br);
  font-family: 'Space Grotesk', sans-serif;
  color: var(--text-primary);
}

/* ── Scrollbar Hide ── */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* ── Thin styled scrollbar ── */
.thin-scrollbar { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.15) transparent; }
.thin-scrollbar::-webkit-scrollbar { width: 4px; }
.thin-scrollbar::-webkit-scrollbar-track { background: transparent; }
.thin-scrollbar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }
.thin-scrollbar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.3); }

/* ── Snap Container ── */
.snap-feed {
  scroll-snap-type: y mandatory;
  overflow-y: scroll;
  height: 100%;
  -webkit-overflow-scrolling: touch;
  transform: translateZ(0);
}

.snap-item {
  scroll-snap-align: start;
  scroll-snap-stop: always;
  height: 100%;
  min-height: 100%;
  position: relative;
  overflow: hidden;
  background: #000;
  contain: layout style paint;
  will-change: transform;
}

/* Hide all video elements until first frame is decoded (prevents grey placeholder) */
video {
  background: #000;
  opacity: 0;
  transition: opacity .15s ease;
}
video.video-ready {
  opacity: 1;
}

/* Video: contain so nothing is cropped, centered on black bg */
.snap-item video {
  object-fit: contain;
  object-position: center;
  will-change: transform;
}

/* ── Gradient Overlays ── */
.overlay-top {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.80) 0%, rgba(0, 0, 0, 0.40) 50%, transparent 100%);
}

/* ── Feed Quick-Access Tabs ── */
.feed-tab {
  color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid transparent;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.feed-tab:hover {
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.10);
}
.feed-tab-active {
  color: #00FFA3;
  background: rgba(0, 255, 163, 0.10);
  border-color: rgba(0, 255, 163, 0.25);
  text-shadow: 0 0 12px rgba(0, 255, 163, 0.4);
}

/* ── Feed Bottom Navigation Bar ── */
#feedBottomBar {
  background: linear-gradient(0deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 60%, transparent 100%);
  padding-top: 12px;
}
.feed-bnav-btn {
  color: rgba(255,255,255,0.55);
  min-width: 44px;
}
.feed-bnav-btn:hover {
  color: rgba(255,255,255,0.85);
}
.feed-bnav-btn > div {
  background: rgba(255,255,255,0.05);
}
.feed-bnav-btn:hover > div {
  background: rgba(255,255,255,0.10);
}
.feed-bnav-upload > div {
  transition: all 0.2s;
}
.feed-bnav-upload:hover > div {
  background: rgba(0,255,163,0.22);
  box-shadow: 0 0 22px rgba(0,255,163,.25);
}
/* Update dot pulse */
@keyframes updateDotPulse {
  0%,100% { box-shadow: 0 0 4px rgba(0,255,163,.6); }
  50%      { box-shadow: 0 0 10px rgba(0,255,163,1); }
}
#feedBnavUpdateDot:not(.hidden) {
  animation: updateDotPulse 1.8s ease-in-out infinite;
}

.overlay-bottom {
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.70) 0%, rgba(0, 0, 0, 0.35) 40%, transparent 100%);
}

/* ── Glassmorphism ── */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
}

.glass-light {
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ── Progress Bar ── */
.progress-bar {
  transition: none;
}

/* ── Custom tooltip (JS-driven, see app.js initTooltips) ── */
#sdvigTooltip {
  position: fixed;
  z-index: 99999;
  pointer-events: none;
  background: var(--toast-bg);
  color: var(--cyber);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  padding: 3px 10px;
  border-radius: 8px;
  border: 1px solid rgba(0,255,163,0.22);
  font-family: 'Space Grotesk', sans-serif;
  white-space: nowrap;
  opacity: 0;
  transition: opacity .15s;
  box-shadow: 0 2px 12px rgba(0,255,163,0.1);
}

/* ── Page background (non-feed views) ── */
.page-bg {
  background: var(--bg-surface);
  background-image:
    radial-gradient(ellipse 100% 30% at 50% 0%, rgba(0,255,163,0.04) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 100% 100%, rgba(0,20,50,0.05) 0%, transparent 60%);
}

html.light .page-bg {
  background-image:
    radial-gradient(ellipse 100% 30% at 50% 0%, rgba(0,180,100,0.05) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 100% 100%, rgba(0,80,160,0.04) 0%, transparent 60%);
}

/* ── Neon Glow ── */
.neon-glow {
  filter: drop-shadow(0 0 6px rgba(0, 255, 163, 0.5))
          drop-shadow(0 0 20px rgba(0, 255, 163, 0.25));
}

.neon-text {
  text-shadow: 0 0 8px rgba(0, 255, 163, 0.4),
               0 0 30px rgba(0, 255, 163, 0.15);
}

/* ── Mock Gradient Placeholders ── */
.mock-grad-1 { background: linear-gradient(135deg, #0a0a0a, #1a0030, #000a1a); }
.mock-grad-2 { background: linear-gradient(135deg, #0a0a0a, #001a0a, #0a1a00); }
.mock-grad-3 { background: linear-gradient(135deg, #0a0a0a, #1a0a00, #1a1a00); }
.mock-grad-4 { background: linear-gradient(135deg, #0a0a0a, #00101a, #0a001a); }

/* ═══════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════ */

/* ── Like Burst ── */
@keyframes likeBurst {
  0%   { transform: scale(0.4); opacity: 1; }
  50%  { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(1);   opacity: 1; }
}
.like-burst { animation: likeBurst 0.45s cubic-bezier(0.17, 0.67, 0.35, 1.5) forwards; }

/* ── Floating Heart (double-tap) ── */
@keyframes floatHeart {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  60%  { opacity: 1; transform: translateY(-120px) scale(1.1); }
  100% { opacity: 0; transform: translateY(-200px) scale(0.6); }
}
.float-heart {
  position: absolute;
  pointer-events: none;
  animation: floatHeart 1.2s ease-out forwards;
}

/* ── Sheet Slide ── */
@keyframes sheetUp   { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes sheetDown { from { transform: translateY(0); }    to { transform: translateY(100%); } }
.sheet-up   { animation: sheetUp   0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
.sheet-down { animation: sheetDown 0.3s ease-in forwards; }

/* ── Modal Fade / Scale ── */
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }
@keyframes confirmIn { from { opacity: 0; transform: scale(0.92) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.fade-in  { animation: fadeIn  0.25s ease forwards; }
.fade-out { animation: fadeOut 0.2s  ease forwards; }
.scale-in { animation: scaleIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards; }

/* ── Pause Icon Pop ── */
@keyframes pausePop {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  40%  { opacity: 0.8; transform: translate(-50%, -50%) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}
.pause-pop { animation: pausePop 0.7s ease forwards; }

/* ── Sidebar Slide ── */
@keyframes slideRight { from { transform: translateX(-100%); } to { transform: translateX(0); } }
@keyframes slideLeft  { from { transform: translateX(0); }     to { transform: translateX(-100%); } }
.slide-right { animation: slideRight 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
.slide-left  { animation: slideLeft  0.3s  ease-in forwards; }

/* ── Feed Action Buttons stagger entrance ── */
@keyframes feedActionIn {
  from { opacity: 0; transform: translateX(20px) scale(0.7); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

/* ── Feed Bottom Info slide up ── */
@keyframes feedInfoUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.feed-info-anim { animation: feedInfoUp .45s cubic-bezier(.22,1,.36,1) both; }

/* ── Section entrance animations ── */
@keyframes viewFadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes viewItemIn {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.view-anim { animation: viewFadeUp .4s cubic-bezier(.22,1,.36,1) both; }
.view-item { animation: viewItemIn .35s cubic-bezier(.22,1,.36,1) both; }

/* ── Marquee ── */
@keyframes marquee {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.marquee-text { animation: marquee 12s linear infinite; }

/* ── Spin (share) ── */
@keyframes spin360 { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.spin-once { animation: spin360 0.5s ease; }

/* ── Ring Pulse (profile avatar) ── */
@keyframes ringPulse {
  0%, 100% { box-shadow: 0 0 0 0  rgba(0, 255, 163, 0.5); }
  50%      { box-shadow: 0 0 0 5px rgba(0, 255, 163, 0); }
}
.ring-pulse { animation: ringPulse 2s ease infinite; }

/* ═══════════════════════════════════════
   LAYOUT — TikTok Desktop Style
   ═══════════════════════════════════════ */

/* Mobile: fullscreen */
.phone-frame {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* Desktop: 9:16 centered video player */
@media (min-width: 768px) {
  .phone-frame {
    aspect-ratio: 9 / 16;
    height: 96vh;
    width: auto;
    border-radius: 16px;
    overflow: hidden;
  }

  /* Sidebar nav items */
  .sidebar-nav-item {
    border-radius: 8px;
  }

  /* Desktop sidebar subtly off-black */
  #desktopSidebar {
    background: var(--sidebar-bg) !important;
    background-image: linear-gradient(180deg, rgba(0,255,163,0.05) 0%, transparent 25%) !important;
    border-right-color: var(--border-accent) !important;
  }

  html.light #desktopSidebar {
    background-image: none !important;
    border-right-color: var(--border-subtle) !important;
  }

  /* Desktop area around phone frame */
  #app {
    background: var(--bg-base);
    background-image:
      radial-gradient(ellipse 70% 70% at 60% 50%, rgba(0,255,163,0.03) 0%, transparent 65%),
      radial-gradient(ellipse 40% 40% at 90% 10%, rgba(0,30,60,0.06) 0%, transparent 60%);
  }

  html.light #app {
    background-image:
      radial-gradient(ellipse 70% 70% at 60% 50%, rgba(0,180,100,0.04) 0%, transparent 65%),
      radial-gradient(ellipse 40% 40% at 90% 10%, rgba(0,80,160,0.05) 0%, transparent 60%);
  }
}

/* ═══════════════════════════════════════
   UPLOAD & TOAST
   ═══════════════════════════════════════ */

/* Upload drop zone active state */
#uploadDropZone.border-cyber\/40 {
  border-color: rgba(0, 255, 163, 0.4);
  background: rgba(0, 255, 163, 0.03);
}

/* Upload progress bar animation */
#uploadProgressBar {
  transition: width 0.3s ease;
}

/* Toast notification */
#appToast {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 200;
  background: var(--toast-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-accent);
  border-radius: 16px;
  padding: 12px 24px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  text-align: center;
  max-width: 85%;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  box-shadow: 0 8px 32px var(--shadow), 0 0 20px rgba(0, 255, 163, 0.08);
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1), transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

#appToast.toast-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#appToast.toast-exit {
  opacity: 0;
  transform: translateX(-50%) translateY(-10px);
}



/* Loading spinner for feed */
.feed-loading::after {
  content: '';
  display: block;
  width: 24px;
  height: 24px;
  border: 2px solid rgba(0,255,163,0.2);
  border-top-color: #00FFA3;
  border-radius: 50%;
  animation: spin360 0.8s linear infinite;
  margin: 20px auto;
}

/* Animate spin */
@keyframes animateSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.animate-spin {
  animation: animateSpin 0.8s linear infinite;
}

/* Line clamp */
.line-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Drop shadow for text */
.drop-shadow {
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.8));
}

/* ── Legal Modal ── */
.legal-tab {
  color: var(--text-muted);
}
.legal-tab:hover {
  color: var(--text-secondary);
}
/* active tab state is set via JS classList (bg-cyber/15 text-cyber) */

#legalContent p {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  line-height: 1.65;
  margin-bottom: 0.5rem;
}

/* ═══════════════════════════════════════
   LIGHT THEME OVERRIDES
   ═══════════════════════════════════════ */

/* Light theme: Override key Tailwind utility-like colors that are hardcoded in templates */
html.light {
  /* Neon glow toned down for light theme */
  --cyber: #00b36f;
}

html.light .neon-text {
  text-shadow: none;
  color: var(--cyber);
}

html.light .neon-glow {
  filter: drop-shadow(0 0 4px rgba(0,179,111,0.35));
}

/* Theme toggle switch */
.theme-toggle {
  position: relative;
  width: 48px;
  height: 26px;
  border-radius: 13px;
  background: rgba(255,255,255,0.1);
  cursor: pointer;
  transition: background 0.3s;
  flex-shrink: 0;
}
.theme-toggle.active {
  background: var(--cyber);
}
.theme-toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  transition: transform 0.3s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.theme-toggle.active::after {
  transform: translateX(22px);
}

html.light .theme-toggle {
  background: rgba(0,0,0,0.12);
}
html.light .theme-toggle.active {
  background: var(--cyber);
}

/* ── Light theme: structural overrides ── */
html.light #phone {
  background: var(--bg-surface);
}

html.light .snap-item {
  background: #000; /* video items stay dark — it's video content */
}

html.light .glass {
  background: rgba(255,255,255,0.80);
  border-color: rgba(0,0,0,0.08);
}

html.light .glass-light {
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.06);
}

/* Override Tailwind bg-white/X → black/X in light mode for contrast */
html.light .bg-white\/5 { background: rgba(0,0,0,0.04) !important; }
html.light .bg-white\/\[0\.02\] { background: rgba(0,0,0,0.02) !important; }
html.light .bg-white\/\[0\.03\] { background: rgba(0,0,0,0.03) !important; }
html.light .bg-white\/6 { background: rgba(0,0,0,0.05) !important; }
html.light .bg-white\/8 { background: rgba(0,0,0,0.06) !important; }
html.light .bg-white\/10 { background: rgba(0,0,0,0.06) !important; }
html.light .hover\:bg-white\/5:hover { background: rgba(0,0,0,0.05) !important; }
html.light .hover\:bg-white\/8:hover { background: rgba(0,0,0,0.06) !important; }
html.light .hover\:bg-white\/10:hover { background: rgba(0,0,0,0.08) !important; }
html.light .hover\:bg-white\/15:hover { background: rgba(0,0,0,0.10) !important; }
html.light .active\:bg-white\/10:active { background: rgba(0,0,0,0.08) !important; }
html.light .focus\:bg-white\/8:focus { background: rgba(0,0,0,0.06) !important; }

/* Text colors */
html.light .text-white { color: var(--text-primary) !important; }
html.light .text-white\/80 { color: rgba(0,0,0,0.72) !important; }
html.light .text-white\/70 { color: rgba(0,0,0,0.62) !important; }
html.light .text-white\/60 { color: rgba(0,0,0,0.55) !important; }
html.light .text-white\/50 { color: rgba(0,0,0,0.45) !important; }
html.light .text-white\/40 { color: rgba(0,0,0,0.38) !important; }
html.light .text-white\/30 { color: rgba(0,0,0,0.30) !important; }
html.light .text-white\/25 { color: rgba(0,0,0,0.22) !important; }
html.light .text-white\/20 { color: rgba(0,0,0,0.18) !important; }
html.light .text-white\/15 { color: rgba(0,0,0,0.12) !important; }
html.light .hover\:text-white\/50:hover { color: rgba(0,0,0,0.45) !important; }
html.light .hover\:text-white\/80:hover { color: rgba(0,0,0,0.72) !important; }
html.light .hover\:text-white:hover { color: var(--text-primary) !important; }
html.light .placeholder-white\/30::placeholder { color: rgba(0,0,0,0.30) !important; }
html.light .placeholder\:text-white\/30::placeholder { color: rgba(0,0,0,0.30) !important; }

/* Borders */
html.light .border-white\/5 { border-color: rgba(0,0,0,0.07) !important; }
html.light .border-white\/10 { border-color: rgba(0,0,0,0.08) !important; }
html.light .focus\:border-cyber\/40:focus { border-color: rgba(0,179,111,0.4) !important; }
html.light .focus\:ring-cyber\/30 { --tw-ring-color: rgba(0,179,111,0.3) !important; }
html.light .ring-cyber\/30 { --tw-ring-color: rgba(0,179,111,0.3) !important; }
html.light .border-cyber { border-color: var(--cyber) !important; }
html.light .border-black { border-color: white !important; }

/* Backgrounds */
html.light .bg-black { background: var(--bg-surface) !important; }
html.light .bg-black\/60 { background: rgba(0,0,0,0.25) !important; }
html.light .bg-black\/70 { background: rgba(0,0,0,0.30) !important; }
html.light .bg-black\/75 { background: rgba(0,0,0,0.35) !important; }
html.light .bg-black\/80 { background: rgba(0,0,0,0.40) !important; }

/* Modal inline backgrounds */
html.light [style*="background:#0d0f10"] {
  background: #ffffff !important;
  border-color: rgba(0,0,0,0.10) !important;
}

/* Cyber accent adjustments */
html.light .text-cyber { color: var(--cyber) !important; }
html.light .bg-cyber { background: var(--cyber) !important; }
html.light .bg-cyber\/10 { background: rgba(0,179,111,0.10) !important; }
html.light .bg-cyber\/15 { background: rgba(0,179,111,0.12) !important; }
html.light .bg-cyber\/20 { background: rgba(0,179,111,0.15) !important; }
html.light .hover\:bg-cyber\/25:hover { background: rgba(0,179,111,0.20) !important; }
html.light .hover\:bg-cyber\/30:hover { background: rgba(0,179,111,0.25) !important; }
html.light .hover\:bg-cyber\/80:hover { background: rgba(0,179,111,0.85) !important; }
html.light .hover\:bg-cyber\/90:hover { background: rgba(0,179,111,0.90) !important; }

/* Dividers */
html.light .bg-white\/5.h-px, html.light .h-px.bg-white\/5 {
  background: rgba(0,0,0,0.07) !important;
}

/* Drop shadow for light mode — lighter */
html.light .drop-shadow {
  filter: none;
}

/* Scrollbar on light */
html.light ::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.12);
}

/* Feed loading spinner → keep cyber color */
html.light .feed-loading::after {
  border-color: rgba(0,179,111,0.2);
  border-top-color: var(--cyber);
}

/* Hardcoded dark backgrounds → light equivalents */
html.light .bg-\[\#111\] { background: #ebedef !important; }
html.light .bg-\[\#1a1a1a\] { background: #f0f1f3 !important; }
html.light .bg-\[\#181818\] { background: #f0f1f3 !important; }
html.light .bg-\[\#0c0e12\] { background: var(--bg-base) !important; }
html.light .bg-\[\#f5f6f8\] { background: #f5f6f8 !important; } /* keep as-is */

/* Text fallbacks: .text-white/XX already handled. Ensure "35" variant (used in settings) */
html.light .text-white\/35 { color: rgba(0,0,0,0.32) !important; }

/* SVG stroke/fill overrides for non-video contexts */
html.light .stroke-white { stroke: var(--text-primary) !important; }
html.light [stroke="white"]:not(video *) { stroke: var(--text-primary); }
html.light [fill="white"]:not(video *) { fill: var(--text-primary); }

/* Ring overrides */
html.light .ring-cyber\/30 { --tw-ring-color: rgba(0,179,111,0.3) !important; }

/* Ensure modals / overlays have proper light bg */
html.light [style*="background:#181818"],
html.light [style*="background: #181818"] {
  background: #ffffff !important;
}
html.light [style*="background:#1a1a1a"],
html.light [style*="background: #1a1a1a"] {
  background: #ffffff !important;
}

/* ═══════════════════════════════════════
   MOBILE PERFORMANCE OPTIMIZATIONS
   ═══════════════════════════════════════ */
@media (max-width: 767px) {
  /* Replace expensive backdrop-filter blur with solid bg on mobile */
  .glass {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: rgba(0, 0, 0, 0.55);
  }

  .glass-light {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  /* Disable infinite box-shadow animations on mobile */
  .ring-pulse {
    animation: none !important;
  }



  /* Enable content-visibility for off-screen snap items */
  .snap-item {
    content-visibility: auto;
    contain-intrinsic-size: 100vw 100vh;
  }

  /* Reduce overlay gradient complexity */
  .overlay-bottom {
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.70) 0%, transparent 100%);
  }

  /* Disable neon glow filter on mobile (causes repaint) */
  .neon-glow {
    filter: none;
  }

  /* Hardware-accelerate floating hearts */
  .float-heart {
    will-change: transform, opacity;
  }
}

/* ═══════════════════════════════════════
   REDUCED MOTION & LOW BATTERY
   ═══════════════════════════════════════ */

/* Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .marquee-text { animation: none !important; }
  .ring-pulse   { animation: none !important; }
  .float-heart  { display: none !important; }
}

/* GPU-accelerate common animated elements */
.action-btn,
.sound-toggle,
.feed-actions {
  will-change: transform;
  transform: translateZ(0);
}

/* Reduce paint when off-screen */
.snap-item {
  contain: layout style paint;
}

/* ── Low battery mode (JS-toggled via .low-battery on <html>) ── */
html.low-battery *,
html.low-battery *::before,
html.low-battery *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.05ms !important;
}
html.low-battery .ring-pulse,
html.low-battery .marquee-text,
html.low-battery .neon-text,
html.low-battery .neon-glow {
  animation: none !important;
  text-shadow: none !important;
  filter: none !important;
}
html.low-battery .float-heart { display: none !important; }
html.low-battery .glass {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: rgba(0,0,0,0.6);
}
html.low-battery video {
  image-rendering: optimizeSpeed;
}

/* ── User preference: no animations ── */
html.no-animations *,
html.no-animations *::before,
html.no-animations *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.05ms !important;
}
html.no-animations .marquee-text { animation: none !important; }

/* ── User preference: no blur ── */
html.no-blur .glass,
html.no-blur .glass-light {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
html.no-blur .glass {
  background: rgba(0,0,0,0.55);
}
html.no-blur .glass-light {
  background: rgba(255,255,255,0.08);
}

/* ── User preference: low quality video ── */
html.low-quality video {
  image-rendering: optimizeSpeed;
}

/* ── Slideshow ── */
.slideshow-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}
.slideshow-slide {
  position: absolute;
  inset: 0;
  transition: opacity 0.5s ease;
  will-change: transform, opacity;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.slideshow-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.slideshow-dots {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 5px;
  z-index: 10;
}
.slideshow-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
  transition: background 0.3s, transform 0.3s;
  cursor: pointer;
}
.slideshow-dot.active {
  background: #00FFA3;
  transform: scale(1.3);
}
.slideshow-counter {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  z-index: 10;
  pointer-events: none;
}
.slideshow-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 3px;
  z-index: 5;
}

/* ── Photo upload grid ── */
.photo-grid-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
}
.photo-grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-grid-item .photo-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
}
.photo-grid-item:hover .photo-remove {
  opacity: 1;
}
.photo-grid-item .photo-num {
  position: absolute;
  bottom: 4px;
  left: 4px;
  font-size: 10px;
  color: rgba(255,255,255,0.6);
  background: rgba(0,0,0,0.4);
  padding: 1px 5px;
  border-radius: 4px;
}

/* ── Photo Lightbox ── */
#lightboxOverlay {
  animation: lightboxFadeIn 0.25s ease;
}
#lightboxOverlay.lightbox-closing {
  animation: lightboxFadeOut 0.2s ease forwards;
}
@keyframes lightboxFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes lightboxFadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}
#lightboxImage {
  user-select: none;
  -webkit-user-drag: none;
}

/* ═══════════════════════════════════════
   AUTH TABS & QR
   ═══════════════════════════════════════ */
.auth-tab {
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
}
.auth-tab:hover {
  color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.04);
}
.auth-tab.active {
  background: rgba(0, 255, 163, 0.12);
  color: #00FFA3;
  box-shadow: 0 0 12px rgba(0, 255, 163, 0.1);
}
.auth-pane {
  animation: authPaneIn 0.25s ease;
}
@keyframes authPaneIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* QR scanning animation */
@keyframes qrScanline {
  0%   { top: 0; }
  100% { top: calc(100% - 2px); }
}
#qrCodeContainer .qr-scanline {
  position: absolute;
  left: 8px;
  right: 8px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #00FFA3, transparent);
  animation: qrScanline 2s ease-in-out infinite alternate;
  pointer-events: none;
}

/* QR mode toggle buttons */
.qr-mode-btn {
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
}
.qr-mode-btn:hover {
  color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.04);
}
.qr-mode-btn.active {
  background: rgba(0, 255, 163, 0.12);
  color: #00FFA3;
}

/* QR scanner viewfinder corners */
.qr-scan-corner {
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: #00FFA3;
  border-style: solid;
  border-width: 0;
}
.qr-scan-corner.tl { top: -1px; left: -1px;   border-top-width: 3px; border-left-width: 3px;   border-top-left-radius: 8px; }
.qr-scan-corner.tr { top: -1px; right: -1px;  border-top-width: 3px; border-right-width: 3px;  border-top-right-radius: 8px; }
.qr-scan-corner.bl { bottom: -1px; left: -1px; border-bottom-width: 3px; border-left-width: 3px; border-bottom-left-radius: 8px; }
.qr-scan-corner.br { bottom: -1px; right: -1px; border-bottom-width: 3px; border-right-width: 3px; border-bottom-right-radius: 8px; }

@keyframes qrScanBeam {
  0%   { top: 0; }
  100% { top: calc(100% - 2px); }
}
#qrScanViewfinder .qr-scan-beam {
  position: absolute;
  left: 20%;
  right: 20%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #00FFA3, transparent);
  animation: qrScanBeam 2s ease-in-out infinite alternate;
  pointer-events: none;
}

/* Account switcher */
.account-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 10px;
  transition: background 0.15s, opacity 0.15s;
  cursor: pointer;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
}
.account-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.85);
}
.account-item.active {
  background: rgba(0, 255, 163, 0.08);
  color: #00FFA3;
}
.account-item .account-check {
  margin-left: auto;
  width: 16px;
  height: 16px;
  opacity: 0;
  transition: opacity 0.15s;
}
.account-item.active .account-check {
  opacity: 1;
}

/* ── Light theme overrides ── */
html.light .auth-tab {
  color: rgba(0, 0, 0, 0.4);
}
html.light .auth-tab:hover {
  color: rgba(0, 0, 0, 0.6);
  background: rgba(0, 0, 0, 0.04);
}
html.light .auth-tab.active {
  background: rgba(0, 153, 80, 0.12);
  color: #009950;
}
html.light .qr-mode-btn {
  color: rgba(0, 0, 0, 0.4);
}
html.light .qr-mode-btn:hover {
  color: rgba(0, 0, 0, 0.6);
  background: rgba(0, 0, 0, 0.04);
}
html.light .qr-mode-btn.active {
  background: rgba(0, 153, 80, 0.12);
  color: #009950;
}
html.light .account-item {
  color: rgba(0, 0, 0, 0.6);
}
html.light .account-item:hover {
  background: rgba(0, 0, 0, 0.05);
  color: rgba(0, 0, 0, 0.85);
}
html.light .account-item.active {
  background: rgba(0, 153, 80, 0.08);
  color: #009950;
}
