/* ══════════════════════════════════════════════════════════════
   TikSwipe — Global Design System
   Dark Mode, Mobile-First, Inter font
═══════════════════════════════════════════════════════════════ */

/* ── Variables ──────────────────────────────────────────────── */
:root {
  --bg:           #0a0a0a;
  --bg-elevated:  #141414;
  --bg-card:      #1a1a1a;
  --bg-sheet:     #1c1c1e;
  --surface:      #242424;
  --surface-2:    #2e2e2e;
  --border:       rgba(255,255,255,.08);

  --accent:       #fe2c55;
  --accent-glow:  rgba(254, 44, 85, .35);
  --accent-light: #ff6b81;

  --cyan:         #25f4ee;
  --cyan-glow:    rgba(37, 244, 238, .3);

  --text-primary:   #ffffff;
  --text-secondary: rgba(255,255,255,.65);
  --text-muted:     rgba(255,255,255,.38);

  --font:         'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --text-xs:      11px;
  --text-sm:      13px;
  --text-base:    15px;
  --text-md:      17px;
  --text-lg:      20px;
  --text-xl:      24px;
  --text-2xl:     30px;

  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  20px;
  --sp-6:  24px;

  --r-sm:   8px;
  --r-md:   12px;
  --r-lg:   16px;
  --r-xl:   24px;
  --r-full: 9999px;

  --shadow-card: 0 4px 24px rgba(0,0,0,.6);
  --shadow-glow: 0 0 20px var(--accent-glow);

  --nav-height:    64px;
  --header-height: 58px;
  --safe-bottom:   env(safe-area-inset-bottom, 0px);

  --ease:     cubic-bezier(.4, 0, .2, 1);
  --ease-out: cubic-bezier(0, 0, .2, 1);
  --dur-fast: 150ms;
  --dur:      250ms;
  --dur-slow: 400ms;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  font-family: var(--font);
  font-size: var(--text-base);
  background: var(--bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior: none;
}
body {
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
img, video { display: block; max-width: 100%; }
button { font-family: var(--font); cursor: pointer; background: none; border: none; color: inherit; }
input, textarea { font-family: var(--font); }
a { color: inherit; text-decoration: none; }
svg { display: inline-block; vertical-align: middle; }

/* ── App shell ──────────────────────────────────────────────── */
#app {
  position: relative;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Tab pages ──────────────────────────────────────────────── */
.tab-page {
  position: absolute;
  inset: 0;
  bottom: calc(var(--nav-height) + var(--safe-bottom));
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
  background: var(--bg);
  -webkit-overflow-scrolling: touch;
}
.tab-page.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  z-index: 1;
}
/* Feed tab is fullscreen */
#tab-feed.tab-page {
  bottom: 0;
  z-index: 2;
}

/* ══════════════════════════════════════════════════════════════
   BOTTOM NAVIGATION
═══════════════════════════════════════════════════════════════ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  background: rgba(10,10,10,.92);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid var(--border);
  z-index: 100;
}
.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding-top: 10px;
  height: var(--nav-height);
  color: var(--text-muted);
  transition: color var(--dur-fast) var(--ease);
}
.nav-btn svg { width: 24px; height: 24px; transition: transform var(--dur-fast) var(--ease); }
.nav-btn span { font-size: 10px; font-weight: 500; letter-spacing: .2px; }
.nav-btn.active { color: var(--text-primary); }
.nav-btn.active svg { transform: scale(1.12); filter: drop-shadow(0 0 6px var(--accent-glow)); }
.nav-btn[data-tab="feed"].active svg { color: var(--accent); }
.nav-btn:active svg { transform: scale(.9); }

/* ══════════════════════════════════════════════════════════════
   HOME TAB
═══════════════════════════════════════════════════════════════ */
.home-header {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-4);
  background: rgba(10,10,10,.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.lang-btn {
  padding: 5px 11px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .8px;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: color var(--dur-fast), border-color var(--dur-fast), background var(--dur-fast);
}
.lang-btn:active { background: var(--surface-2); color: var(--text-primary); }

.home-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.4px;
}
.home-content {
  padding: var(--sp-4) 0 var(--sp-6);
}

/* ── Pull-to-refresh indicator ──────────────────────────────── */
.ptr-indicator {
  position: absolute;
  top: var(--header-height);
  left: 50%;
  transform: translateX(-50%) translateY(-60px);
  opacity: 0;
  z-index: 20;
  transition: none;
  pointer-events: none;
}
.ptr-indicator .spinner { width: 28px; height: 28px; border-width: 2px; }

/* ── Content Row ────────────────────────────────────────────── */
.content-row { margin-bottom: var(--sp-5); }
.row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-4);
  margin-bottom: var(--sp-3);
}
.row-title { font-size: var(--text-md); font-weight: 700; letter-spacing: -.3px; }
.row-see-all {
  font-size: var(--text-sm); font-weight: 600; color: var(--accent);
  padding: var(--sp-1) var(--sp-2); border-radius: var(--r-sm);
  transition: background var(--dur-fast);
}
.row-see-all:active { background: rgba(254,44,85,.15); }

/* ── Cards Scroll Track ─────────────────────────────────────── */
.cards-track {
  display: flex;
  gap: var(--sp-3);
  padding: 0 var(--sp-4);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-left: var(--sp-4);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.cards-track::-webkit-scrollbar { display: none; }

/* ── Video Card (home rows) ─────────────────────────────────── */
.video-card {
  flex: 0 0 140px;
  width: 140px;
  aspect-ratio: 9/16;
  border-radius: var(--r-md);
  overflow: hidden;
  position: relative;
  scroll-snap-align: start;
  cursor: pointer;
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast);
}
.video-card:active { transform: scale(.96); }
.video-card img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.card-gradient {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.85) 0%, rgba(0,0,0,.2) 50%, transparent 100%);
}
.card-info { position: absolute; bottom: 0; left: 0; right: 0; padding: var(--sp-2) var(--sp-2) var(--sp-3); }
.card-title {
  font-size: var(--text-xs); font-weight: 600; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; margin-bottom: 4px;
}
.card-meta {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: 10px; color: rgba(255,255,255,.7);
}
.card-meta svg { width: 10px; height: 10px; }

/* ── Skeletons ──────────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.home-skeleton { padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-5); }
.skeleton-row {
  height: 180px; border-radius: var(--r-md);
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--surface) 50%, var(--bg-card) 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite;
}

/* ══════════════════════════════════════════════════════════════
   SEARCH TAB
═══════════════════════════════════════════════════════════════ */
.search-header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: var(--sp-3) var(--sp-4) 0;
  background: rgba(10,10,10,.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--sp-3);
}
.search-input-wrapper {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--surface);
  border-radius: var(--r-full);
  padding: 10px var(--sp-3);
  border: 1px solid var(--border);
  transition: border-color var(--dur-fast);
}
.search-input-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.search-icon { color: var(--text-muted); flex-shrink: 0; }
#search-input {
  flex: 1; font-size: var(--text-base); color: var(--text-primary);
  background: none; border: none; outline: none; min-width: 0;
}
#search-input::placeholder { color: var(--text-muted); }
#search-input::-webkit-search-cancel-button { display: none; }
.search-clear-btn { color: var(--text-muted); padding: 0 2px; }

/* ── Tag tiles ──────────────────────────────────────────────── */
.search-tag-tiles {
  display: none;
  flex-wrap: wrap;
  gap: var(--sp-2);
  padding: var(--sp-3) 0 0;
}
.search-tag-tiles:not([hidden]) { display: flex; }
.search-tag-pill {
  padding: 5px 12px;
  border-radius: var(--r-full);
  background: transparent;
  border: 1px solid rgba(255,255,255,.2);
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,.85);
  letter-spacing: .1px;
  transition: border-color var(--dur-fast), color var(--dur-fast), transform var(--dur-fast);
}
.search-tag-pill:active { border-color: rgba(255,255,255,.5); color: #fff; transform: scale(.94); }

/* ── Video Grid (3-col, Search & Profile) ───────────────────── */
.video-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 2px;
}
.video-grid .video-card {
  width: 100%; flex: none; border-radius: 0;
  aspect-ratio: 9/16; box-shadow: none; scroll-snap-align: none;
}
.search-placeholder {
  grid-column: 1/-1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-3); padding: 80px var(--sp-4);
  color: var(--text-muted); font-size: var(--text-sm); text-align: center;
}

/* ── Profile grid: same card size as home ───────────────────── */
.profile-video-grid {
  grid-template-columns: repeat(3, 1fr);
}
.profile-video-grid .video-card {
  width: 100%;
  aspect-ratio: 9/16;
  border-radius: 0;
  flex: none;
  scroll-snap-align: none;
  box-shadow: none;
}

/* ══════════════════════════════════════════════════════════════
   FEED TAB — Fullscreen Vertical Swipe Player
═══════════════════════════════════════════════════════════════ */
.feed-container {
  height: 100%;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.feed-container::-webkit-scrollbar { display: none; }

/* ── Video Slide ────────────────────────────────────────────── */
.feed-slide {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.feed-slide video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain; /* no crop, no stretch */
}

/* ── Feed Gradient overlays ─────────────────────────────────── */
.feed-gradient-top {
  position: absolute; top: 0; left: 0; right: 0; height: 120px;
  background: linear-gradient(to bottom, rgba(0,0,0,.6) 0%, transparent 100%);
  pointer-events: none;
}
.feed-gradient-bottom {
  position: absolute; bottom: 0; left: 0; right: 0; height: 240px;
  background: linear-gradient(to top, rgba(0,0,0,.85) 0%, transparent 100%);
  pointer-events: none;
}

/* ── Seek via progress bar (bottom) ─────────────────────────── */

/* ── Right Action Bar ───────────────────────────────────────── */
.feed-actions {
  position: absolute;
  right: var(--sp-3);
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 20px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  z-index: 10;
}
.action-item { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.action-btn {
  width: 48px; height: 48px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: transform var(--dur-fast), opacity var(--dur-fast);
  filter: drop-shadow(0 1px 4px rgba(0,0,0,.6));
}
.action-btn:active { transform: scale(.84); opacity: .7; }
.action-btn svg { width: 26px; height: 26px; }
.action-btn.liked { color: var(--accent); }
.action-btn.liked svg { filter: drop-shadow(0 0 8px var(--accent-glow)); }
.action-count { font-size: 12px; font-weight: 700; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.8); }

@keyframes heartPulse {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.45); }
  60%  { transform: scale(.9); }
  100% { transform: scale(1); }
}
.action-btn.pulse { animation: heartPulse .4s var(--ease-out); }

.feed-author-avatar {
  width: 50px; height: 50px;
  border-radius: 50%;
  border: 2px solid #fff;
  object-fit: cover;
}

/* ── Feed Info Panel ────────────────────────────────────────── */
.feed-info {
  position: absolute;
  left: var(--sp-4);
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 20px);
  right: 80px;
  z-index: 10;
}
.feed-username { display: none; }
.feed-title {
  font-size: var(--text-base); font-weight: 600; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; color: rgba(255,255,255,.95); text-shadow: 0 1px 6px rgba(0,0,0,.7);
  margin-bottom: 10px;
}
.feed-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.feed-tag {
  font-size: 12px; font-weight: 500; color: rgba(255,255,255,.5);
  background: none; border: none; padding: 0;
  transition: color var(--dur-fast);
}
.feed-tag:active { color: rgba(255,255,255,.8); }

/* ── Pause overlay ──────────────────────────────────────────── */
.pause-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 8; opacity: 0; transition: opacity var(--dur-fast); pointer-events: none;
}
.pause-overlay.show { opacity: 1; }
.pause-icon {
  width: 72px; height: 72px; border-radius: 50%;
  background: rgba(0,0,0,.5); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
}
.pause-icon svg { width: 36px; height: 36px; }

/* ── Progress bar (bottom, seekable) ────────────────────────── */
.feed-progress {
  position: absolute;
  bottom: calc(var(--nav-height) + var(--safe-bottom));
  left: 0; right: 0;
  height: 20px; /* tall hit area, visually only 3px shown */
  z-index: 20; cursor: pointer;
}
/* grey track */
.feed-progress::before {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0;
  height: 3px; background: rgba(255,255,255,.2);
}
/* red fill — above the track */
.feed-progress-bar {
  position: absolute; bottom: 0; left: 0;
  width: 0%; height: 3px;
  background: #fe2c55;
  z-index: 1;
  transition: width .25s linear;
}

/* ── More (report) bottom sheet ─────────────────────────────── */
.more-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: flex-end;
}
.more-sheet {
  width: 100%; background: var(--bg-sheet);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: var(--sp-2) var(--sp-4) calc(var(--sp-5) + var(--safe-bottom));
  animation: slideUp var(--dur) var(--ease-out);
}
.more-sheet-handle { width: 36px; height: 4px; border-radius: var(--r-full); background: var(--surface-2); margin: var(--sp-3) auto var(--sp-4); }
.more-sheet-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-2);
  font-size: var(--text-base); font-weight: 600;
  border-radius: var(--r-md);
  transition: background var(--dur-fast);
}
.more-sheet-btn:active { background: rgba(255,255,255,.07); }
.more-sheet-btn.danger { color: var(--accent); }
.more-sheet-btn svg { width: 22px; height: 22px; flex-shrink: 0; }
/* Volume button top-right */
.feed-top-right {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + var(--sp-4));
  right: var(--sp-3);
  z-index: 20;
}

/* Feed Loader */
.feed-loader {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%,-50%); z-index: 50;
}
.spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(255,255,255,.2);
  border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════════════
   PROFILE TAB
═══════════════════════════════════════════════════════════════ */
.profile-header {
  display: flex; flex-direction: column; align-items: center;
  padding: var(--sp-6) var(--sp-4) var(--sp-4); gap: var(--sp-3);
}
.profile-avatar { width: 88px; height: 88px; border-radius: 50%; border: 3px solid var(--accent); object-fit: cover; box-shadow: 0 0 0 4px var(--accent-glow); }
.profile-username { font-size: var(--text-xl); font-weight: 800; letter-spacing: -.5px; }
.profile-stats { display: flex; gap: var(--sp-6); }
.stat { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.stat-num { font-size: var(--text-lg); font-weight: 800; }
.stat-label { font-size: var(--text-xs); color: var(--text-muted); font-weight: 500; }
.profile-auth-buttons { display: flex; gap: var(--sp-3); width: 100%; }
.profile-auth-buttons .btn-primary,
.profile-auth-buttons .btn-secondary { flex: 1; }
.btn-logout { color: var(--text-muted); }

.profile-tabs {
  display: flex; border-bottom: 1px solid var(--border); padding: 0 var(--sp-2);
}
.profile-tab {
  flex: 1; display: flex; align-items: center; justify-content: center;
  gap: var(--sp-2); padding: var(--sp-3) 0;
  font-size: var(--text-sm); font-weight: 600; color: var(--text-muted);
  border-bottom: 2px solid transparent;
  transition: color var(--dur-fast), border-color var(--dur-fast);
}
.profile-tab.active { color: var(--text-primary); border-bottom-color: var(--accent); }

/* ══════════════════════════════════════════════════════════════
   COMMENTS BOTTOM SHEET
═══════════════════════════════════════════════════════════════ */
.sheet-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: flex-end;
}
.sheet-overlay[hidden] { display: none; }

@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.comments-sheet {
  width: 100%; max-height: 72vh; background: var(--bg-sheet);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  display: flex; flex-direction: column;
  animation: slideUp var(--dur) var(--ease-out);
  padding-bottom: var(--safe-bottom);
}
.sheet-handle { width: 36px; height: 4px; border-radius: var(--r-full); background: var(--surface-2); margin: var(--sp-3) auto var(--sp-1); }
.sheet-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-2) var(--sp-4) var(--sp-3); border-bottom: 1px solid var(--border);
}
.sheet-header h3 { font-size: var(--text-md); font-weight: 700; }
.comments-list {
  flex: 1; overflow-y: auto;
  padding: var(--sp-3) var(--sp-4);
  display: flex; flex-direction: column; gap: var(--sp-4);
  -webkit-overflow-scrolling: touch;
}
.comment-item {
  display: flex; gap: var(--sp-3); align-items: flex-start;
}
.comment-item img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.comment-body { flex: 1; min-width: 0; }
.comment-author { font-size: var(--text-sm); font-weight: 700; margin-bottom: 2px; }
.comment-text { font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.5; word-break: break-word; }
.comment-time { font-size: var(--text-xs); color: var(--text-muted); margin-top: 3px; }
.comment-delete-btn {
  flex-shrink: 0;
  padding: var(--sp-2);
  color: var(--text-muted);
  border-radius: var(--r-sm);
  transition: color var(--dur-fast), background var(--dur-fast);
  align-self: center;
}
.comment-delete-btn:active { color: var(--accent); background: rgba(254,44,85,.1); }
.comment-form {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--border);
  background: var(--bg-sheet); position: relative;
}
.comment-form-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.comment-input-wrap {
  flex: 1; display: flex; align-items: center;
  background: var(--surface); border-radius: var(--r-full);
  border: 1px solid var(--border); padding: 0 var(--sp-2) 0 var(--sp-3);
  min-width: 0; transition: border-color var(--dur-fast);
}
.comment-input-wrap:focus-within { border-color: var(--accent); }
#comment-input {
  flex: 1; font-size: var(--text-sm); color: var(--text-primary);
  background: none; border: none; outline: none; padding: 10px 0; min-width: 0;
}
#comment-input::placeholder { color: var(--text-muted); }
.comment-send-btn {
  color: var(--accent); padding: var(--sp-2);
  border-radius: 50%; transition: background var(--dur-fast), transform var(--dur-fast);
}
.comment-send-btn:active { transform: scale(.85); }

/* ══════════════════════════════════════════════════════════════
   AUTH MODAL
═══════════════════════════════════════════════════════════════ */
.auth-modal {
  width: 100%; max-height: 92vh; background: var(--bg-sheet);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  display: flex; flex-direction: column; gap: var(--sp-4);
  padding: var(--sp-2) var(--sp-5) calc(var(--sp-6) + var(--safe-bottom));
  animation: slideUp var(--dur) var(--ease-out);
  position: relative; overflow-y: auto;
}
.auth-header {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: var(--sp-4);
}
.auth-logo {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: 18px; font-weight: 800; letter-spacing: -.3px;
}
.auth-close { color: var(--text-muted); }
.auth-tabs {
  display: flex; background: var(--surface);
  border-radius: var(--r-full); padding: 3px;
}
.auth-tab {
  flex: 1; padding: 9px; border-radius: var(--r-full);
  font-size: var(--text-sm); font-weight: 600; color: var(--text-muted);
  transition: background var(--dur-fast), color var(--dur-fast); text-align: center;
}
.auth-tab.active { background: var(--accent); color: #fff; }
.auth-form { display: none; flex-direction: column; gap: var(--sp-4); }
.auth-form:not([hidden]) { display: flex; }
.auth-form label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: var(--text-sm); font-weight: 600; color: var(--text-secondary);
}
.auth-form input {
  padding: 13px var(--sp-4); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-md);
  color: var(--text-primary); font-size: var(--text-base); outline: none;
  transition: border-color var(--dur-fast);
}
.auth-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-error {
  font-size: var(--text-sm); color: var(--accent-light);
  padding: var(--sp-2) var(--sp-3); background: rgba(254,44,85,.1);
  border-radius: var(--r-sm); border: 1px solid rgba(254,44,85,.2);
}
.auth-switch-hint {
  font-size: var(--text-sm); color: var(--text-muted); text-align: center;
}
.auth-link {
  color: var(--accent); font-weight: 600;
  background: none; border: none; cursor: pointer; font-size: inherit;
}

/* ══════════════════════════════════════════════════════════════
   SHARED BUTTONS
═══════════════════════════════════════════════════════════════ */
.btn-primary {
  padding: 14px var(--sp-5); background: var(--accent); color: #fff;
  font-weight: 700; font-size: var(--text-base); border-radius: var(--r-full);
  border: none; cursor: pointer; text-align: center;
  transition: background var(--dur-fast), transform var(--dur-fast), box-shadow var(--dur-fast);
  box-shadow: 0 4px 16px var(--accent-glow);
}
.btn-primary:active { transform: scale(.96); background: #d4213f; }
.btn-primary:disabled { opacity: .6; pointer-events: none; }
.btn-full { width: 100%; }

.btn-secondary {
  padding: 14px var(--sp-5); background: var(--surface); color: var(--text-primary);
  font-weight: 700; font-size: var(--text-base); border-radius: var(--r-full);
  border: 1px solid var(--border); cursor: pointer; text-align: center;
  transition: background var(--dur-fast), transform var(--dur-fast);
}
.btn-secondary:active { transform: scale(.96); background: var(--surface-2); }

.icon-btn {
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; padding: var(--sp-2);
  transition: background var(--dur-fast); color: var(--text-secondary);
}
.icon-btn:active { background: rgba(255,255,255,.1); }

/* ── Toast notifications ────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + var(--sp-4));
  left: 50%; transform: translateX(-50%);
  z-index: 999; display: flex; flex-direction: column; align-items: center;
  gap: var(--sp-2); pointer-events: none;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.toast {
  background: var(--surface); color: var(--text-primary);
  padding: 10px var(--sp-4); border-radius: var(--r-full);
  font-size: var(--text-sm); font-weight: 500;
  box-shadow: var(--shadow-card); border: 1px solid var(--border);
  animation: fadeInUp .2s var(--ease-out); white-space: nowrap;
}

/* ── Empty state ────────────────────────────────────────────── */
.empty-state {
  grid-column: 1/-1;
  display: flex; flex-direction: column; align-items: center;
  gap: var(--sp-3); padding: 80px var(--sp-4);
  color: var(--text-muted); font-size: var(--text-sm); text-align: center;
}

/* ══════════════════════════════════════════════════════════════
   SCROLLBAR GLOBAL RESET
═══════════════════════════════════════════════════════════════ */
* { scrollbar-width: thin; scrollbar-color: var(--surface-2) transparent; }
*::-webkit-scrollbar { width: 4px; height: 4px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--surface-2); border-radius: 2px; }

/* ══════════════════════════════════════════════════════════════
   DESKTOP ADAPTATION (≥ 768px)
   Full-width app, vertical video centered in feed
═══════════════════════════════════════════════════════════════ */
@media (min-width: 768px) {
  /* Home, Search, Profile — use full screen width */
  #app { max-width: 100%; }
  .bottom-nav { max-width: 100%; left: 0; transform: none; border-left: none; border-right: none; }

  /* Home rows: show more cards */
  .video-card { flex: 0 0 160px; width: 160px; }

  /* Feed: video stays vertical, centered, black bars on sides */
  .feed-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
  }
  .feed-slide video {
    /* max width = 9/16 * 100vh so it never overflows vertically */
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  /* Wider search grid */
  #tab-search .video-grid { grid-template-columns: repeat(5, 1fr); }

  /* Profile: 4-column grid */
  .profile-video-grid { grid-template-columns: repeat(4, 1fr); }

  /* Auth modal — center on desktop */
  #auth-overlay { align-items: center; }
  .auth-modal {
    max-width: 440px;
    border-radius: var(--r-xl);
    margin: auto;
    padding-bottom: var(--sp-6);
  }
  .sheet-handle { display: none; }

  .comments-sheet { max-height: 80vh; }

  /* Content rows: wider home layout */
  .home-content { max-width: 1200px; margin: 0 auto; }
  .video-card { flex: 0 0 150px; width: 150px; }
}

@media (min-width: 1200px) {
  .video-card { flex: 0 0 160px; width: 160px; }
  #tab-search .video-grid { grid-template-columns: repeat(6, 1fr); }
  .profile-video-grid { grid-template-columns: repeat(5, 1fr); }
}

@media (min-width: 480px) {
  .feed-actions { right: var(--sp-5); }
}
