/* ══════════════════════════════════════════════════════════
   Nogomi — Shared Stylesheet
   Used by: index2.php, find.php, result.php
   ══════════════════════════════════════════════════════════ */

:root {
  --primary: #ff2e63;
  --primary-2: #ff6b9d;
  --accent: #08d9d6;
  --bg-0: #0a0a15;
  --bg-1: #12121f;
  --bg-2: #1a1a2e;
  --bg-3: #252540;
  --surface: rgba(255,255,255,0.04);
  --surface-hover: rgba(255,255,255,0.07);
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.15);
  --text: #f4f4f6;
  --text-dim: #a8a8b8;
  --text-mute: #6b6b80;
  --font: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, system-ui, sans-serif;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --shadow-glow: 0 8px 32px rgba(255,46,99,0.25);
  --shadow-card: 0 8px 24px rgba(0,0,0,0.25);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --t: 0.35s var(--ease);
}

[data-theme="light"] {
  --bg-0: #f5f6fa;
  --bg-1: #ffffff;
  --bg-2: #f0f2f7;
  --bg-3: #e4e7ef;
  --surface: rgba(255,255,255,0.7);
  --surface-hover: rgba(255,255,255,0.95);
  --border: rgba(0,0,0,0.08);
  --border-strong: rgba(0,0,0,0.15);
  --text: #1a1a2e;
  --text-dim: #555566;
  --text-mute: #8a8a99;
  --shadow-card: 0 4px 16px rgba(0,0,0,0.06);
}
[data-theme="light"] .site-header { background: rgba(255,255,255,0.8); }
[data-theme="light"] body::before,
[data-theme="light"] body::after { opacity: 0.15; }
[data-theme="light"] .card-rank { background: rgba(255,255,255,0.9); color: var(--text); }
[data-theme="light"] .site-footer { background: var(--bg-1); }


*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  overflow-x: hidden;
  max-width: 100%;
  width: 100%;
  position: relative;
}
html { scroll-behavior: smooth; }

/* Defensive containment for page-level wrappers */
main, .container, .search-hero, .trending-section, .filter-bar, .hero {
  max-width: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg-0);
  color: var(--text);
  /* Direction inherits from <html dir="..."> so language switching works */
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* Animated gradient orbs in background (desktop only — mobile hides them for perf) */
@media (min-width: 1025px) and (hover: hover) and (pointer: fine) {
  body::before, body::after {
    content: '';
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.35;
    z-index: -1;
    pointer-events: none;
    animation: float 20s ease-in-out infinite;
  }
  body::before { background: var(--primary); top: -200px; right: -200px; }
  body::after  { background: var(--accent);  bottom: -200px; left: -200px; animation-delay: -10s; }
}
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(50px, 50px) scale(1.1); }
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
ul { list-style: none; }

::selection { background: var(--primary); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-1); }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ══ HEADER ══ */
.site-header {
  position: static;
  z-index: 1000;
  background: rgba(10,10,21,0.75);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  gap: 20px;
}
.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 24px;
  font-weight: 900;
  color: var(--text);
  white-space: nowrap;
  letter-spacing: 0.5px;
  transition: var(--t);
}
.logo-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  display: grid;
  place-items: center;
  font-size: 18px;
  box-shadow: var(--shadow-glow);
  transition: var(--t);
}
.site-logo:hover .logo-icon { transform: rotate(-8deg) scale(1.05); }
.site-logo span {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.header-search { flex: 1; max-width: 520px; }
.header-search form {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50px;
  overflow: hidden;
  transition: var(--t);
  padding-right: 16px;
}
.header-search form:focus-within {
  background: var(--surface-hover);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(255,46,99,0.15);
}
.header-search .s-icon { color: var(--text-dim); font-size: 16px; display: flex; }
.header-search input[type="text"] {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 11px 12px;
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
}
.header-search input::placeholder { color: var(--text-mute); }
.header-search button {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border: none;
  padding: 10px 24px;
  color: #fff;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--t);
  white-space: nowrap;
}
.header-search button:hover { filter: brightness(1.1); transform: scale(1.02); }

.header-nav { display: flex; gap: 4px; }
.header-nav a {
  color: var(--text-dim);
  font-size: 15px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 10px;
  transition: var(--t);
  white-space: nowrap;
}
.header-nav a:hover { background: var(--surface); color: var(--text); }

.menu-toggle {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
  padding: 10px;
  transition: var(--t);
}
.menu-toggle:hover { background: var(--surface-hover); border-color: var(--primary); }
.menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: var(--t);
}
.menu-toggle.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle.active span:nth-child(2) { opacity: 0; }
.menu-toggle.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-nav {
  max-height: 0;
  overflow: hidden;
  background: var(--bg-1);
  transition: max-height 0.4s var(--ease);
}
.mobile-nav.open { max-height: 320px; border-top: 1px solid var(--border); }
.mobile-nav-inner { padding: 18px 20px; }
.mobile-nav .search-row {
  display: flex;
  background: var(--surface);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 14px;
  border: 1px solid var(--border);
}
.mobile-nav .search-row input {
  flex: 1; background: transparent; border: none; outline: none;
  padding: 12px 14px; color: var(--text); font-family: var(--font);
  font-size: 15px;
}
.mobile-nav .search-row input::placeholder { color: var(--text-mute); }
.mobile-nav .search-row button {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border: none; padding: 0 20px;
  color: #fff; font-family: var(--font); font-weight: 700; cursor: pointer; font-size: 14px;
}
.mobile-nav-links a {
  display: block; padding: 12px 14px; color: var(--text-dim);
  font-size: 15px; font-weight: 600; border-radius: 10px; transition: var(--t);
}
.mobile-nav-links a:hover { background: var(--surface); color: var(--text); }

/* ══ ICON BUTTONS (theme + lang) ══ */
.icon-btn {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  transition: var(--t);
  padding: 0;
}
.icon-btn:hover {
  background: var(--surface-hover);
  border-color: var(--primary);
  color: var(--primary-2);
  transform: translateY(-1px);
}
.icon-btn svg { width: 18px; height: 18px; }
.theme-toggle .sun { display: none; }
.theme-toggle .moon { display: block; }
[data-theme="light"] .theme-toggle .sun { display: block; }
[data-theme="light"] .theme-toggle .moon { display: none; }
.header-actions { display: flex; align-items: center; gap: 8px; }

/* ══ MOBILE SEARCH (always visible on mobile) ══ */
.mobile-search {
  display: none;
  padding: 12px 18px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
}
@media (max-width: 768px) { .mobile-search { display: block !important; } }
.mobile-search form {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50px;
  overflow: hidden;
  padding-right: 14px;
}
.mobile-search form:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255,46,99,0.15);
}
.mobile-search .s-icon { color: var(--text-dim); font-size: 15px; }
.mobile-search input {
  flex: 1; background: transparent; border: none; outline: none;
  padding: 10px 10px; font-family: var(--font); font-size: 14px;
  color: var(--text);
}
.mobile-search input::placeholder { color: var(--text-mute); }
.mobile-search button {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border: none; padding: 9px 20px;
  color: #fff; font-family: var(--font); font-weight: 700;
  cursor: pointer; font-size: 14px;
}

/* ══ MAIN / CONTAINER ══ */
main { flex: 1; }
.container { max-width: 1400px; margin: 0 auto; padding: 0 24px; }

/* ══ HERO (home) ══ */
.hero { padding: 60px 0 30px; text-align: center; position: relative; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50px;
  color: var(--primary-2);
  font-size: 13px; font-weight: 700;
  margin-bottom: 18px;
}
.hero-eyebrow .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--primary); box-shadow: 0 0 12px var(--primary);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.3); }
}
.hero h1 {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 900;
  line-height: 1.2;
  margin-bottom: 14px;
  background: linear-gradient(135deg, #fff 0%, #ffb6c8 60%, var(--primary) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p {
  font-size: clamp(14px, 2vw, 17px);
  color: var(--text-dim);
  max-width: 600px;
  margin: 0 auto;
}

/* ══ SEARCH HERO (find / result) ══ */
.search-hero { padding: 40px 0 20px; }
.search-meta {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 24px;
}
.search-meta h1 {
  font-size: clamp(20px, 3vw, 28px); font-weight: 900;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.search-meta h1 .q {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ══ FILTER BAR (home) ══ */
.filter-bar { padding: 24px 0 12px; }
.filter-card {
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.filter-label {
  font-size: 14px; font-weight: 700;
  color: var(--text-dim);
  white-space: nowrap;
  display: flex; align-items: center; gap: 8px;
}
.filter-selects { display: flex; gap: 10px; flex-wrap: wrap; flex: 1; }
.filter-select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23a8a8b8' d='M6 8L0 0h12z'/%3E%3C/svg%3E") no-repeat left 14px center;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 10px 16px 10px 34px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: var(--t);
  min-width: 170px;
}
.filter-select option { background: var(--bg-2); color: var(--text); }
.filter-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255,46,99,0.2); }
.filter-select:hover { border-color: var(--primary-2); }

.results-badge {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  padding: 8px 16px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: var(--shadow-glow);
  display: flex; align-items: center; gap: 8px;
}
/* Push badge to the inline-end only inside the filter card (home page) */
.filter-card .results-badge { margin-inline-start: auto; }
.results-badge::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 8px #fff;
}

/* ══ TRENDING / SECTION HEADING ══ */
.trending-section { padding: 20px 0 60px; }
.section-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.section-heading h2 {
  font-size: clamp(18px, 2.5vw, 24px);
  font-weight: 900;
  color: var(--text);
  display: flex; align-items: center; gap: 10px;
}
.heading-icon { font-size: 28px; filter: drop-shadow(0 0 10px rgba(255,46,99,0.6)); }
.heading-line {
  flex: 1; height: 1px;
  background: linear-gradient(to left, transparent, var(--border-strong), transparent);
}

/* ══ VIDEO GRID ══ */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 24px;
}

.video-card {
  background: var(--surface);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
  display: flex;
  flex-direction: column;
  position: relative;
  isolation: isolate;
  cursor: pointer;
  text-align: inherit;
  color: inherit;
  font-family: inherit;
  width: 100%;
  padding: 0;
}
.video-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: var(--t);
  pointer-events: none;
  z-index: 2;
}
.video-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 24px 50px rgba(0,0,0,0.5), 0 0 40px rgba(255,46,99,0.1);
}
.video-card:hover::before { opacity: 1; }

.card-thumb {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16/9;
  background: var(--bg-2);
}
.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}
.video-card:hover .card-thumb img { transform: scale(1.08); }

.card-rank {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(10,10,21,0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  padding: 5px 12px;
  border-radius: 50px;
  border: 1px solid var(--border-strong);
  z-index: 3;
}
.card-rank.top {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: transparent;
  box-shadow: var(--shadow-glow);
}

.card-duration {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(10,10,21,0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 50px;
  border: 1px solid var(--border-strong);
  z-index: 3;
}

.views-badge {
  position: absolute;
  left: 12px;
  bottom: 12px;
  background: rgba(10,10,21,0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  padding: 5px 10px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(255,255,255,0.12);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  z-index: 3;
}

.play-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.2) 50%, transparent 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: var(--t);
  z-index: 2;
}
.video-card:hover .play-overlay { opacity: 1; }
.play-icon {
  width: 58px;
  height: 58px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #fff;
  padding-right: 4px;
  box-shadow: 0 8px 25px rgba(255,46,99,0.6);
  transform: scale(0.7);
  transition: transform 0.4s var(--ease);
}
.video-card:hover .play-icon { transform: scale(1); }

.card-body { padding: 16px 18px 18px; flex: 1; display: flex; flex-direction: column; }
.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 44px;
}
.card-meta {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-bottom: 14px;
}
.meta-item {
  font-size: 12.5px;
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.meta-item b {
  color: var(--text);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-top: auto;
}
.card-footer .watch-btn,
.card-footer .download-btn { flex: 1; justify-content: center; }

.watch-btn, .download-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font);
  transition: var(--t);
  cursor: pointer;
}
.watch-btn {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.video-card:hover .watch-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: transparent;
  color: #fff;
}
.download-btn {
  background: linear-gradient(135deg, var(--accent), #0ea5a3);
  border: 1px solid transparent;
  color: #001f1f;
  text-decoration: none;
}
.download-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(8,217,214,0.35);
}
.download-btn svg { width: 14px; height: 14px; }

/* ══ EMPTY STATE ══ */
.empty-state {
  text-align: center;
  padding: 100px 20px;
  color: var(--text-dim);
  grid-column: 1 / -1;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}
.empty-state .emoji { font-size: 64px; margin-bottom: 18px; }
.empty-state p { font-size: 16px; }

/* ══ FOOTER ══ */
.site-footer {
  background: var(--bg-1);
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  padding: 32px 0;
  margin-top: auto;
}
.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}
.footer-links { display: flex; gap: 24px; flex-wrap: wrap; }
.footer-links a {
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
  transition: var(--t);
}
.footer-links a:hover { color: var(--primary-2); }
.footer-copy { font-size: 13px; color: var(--text-mute); }
.footer-copy .heart {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  font-weight: 900;
}

/* ══ INFINITE SCROLL SENTINEL ══ */
.load-sentinel {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 30px 0;
}
.load-sentinel .spinner {
  width: 34px; height: 34px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══ VIDEO MODAL ══ */
.video-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--t), visibility var(--t), background var(--t), padding var(--t);
}
.video-modal.open { opacity: 1; visibility: visible; }

.modal-box {
  width: 100%;
  max-width: 960px;
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  transform: scale(0.92);
  transition: transform var(--t), width var(--t), max-width var(--t);
}
.video-modal.open .modal-box { transform: scale(1); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.modal-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.modal-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  line-height: 0;
  transition: var(--t);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 20px;
}
.modal-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.modal-btn svg { width: 16px; height: 16px; }

.modal-player {
  position: relative;
  width: 100%;
  background: #000;
  padding-top: 56.25%; /* 16:9 fallback for older mobile browsers */
}
@supports (aspect-ratio: 16 / 9) {
  .modal-player { padding-top: 0; aspect-ratio: 16 / 9; }
}
.modal-player iframe,
.modal-player > div {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
body.modal-open { overflow: hidden; }

/* ── Mini / Docked player ── */
.video-modal.mini {
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  padding: 0;
  pointer-events: none;
  display: block;
}
.video-modal.mini .modal-box {
  pointer-events: auto;
  position: fixed;
  bottom: 16px; left: 16px; right: auto; top: auto;
  width: 380px;
  max-width: calc(100vw - 32px);
  margin: 0;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5), 0 0 0 1px var(--primary);
  border-radius: var(--radius);
  animation: slideIn 0.35s var(--ease);
}
@keyframes slideIn {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.video-modal.mini .modal-header {
  padding: 8px 12px;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.video-modal.mini .modal-header:active { cursor: grabbing; }
.video-modal.mini.dragging .modal-box {
  animation: none;
  transition: none;
  box-shadow: 0 30px 70px rgba(0,0,0,0.7), 0 0 0 2px var(--primary);
}
.video-modal.mini .modal-title { font-size: 13px; pointer-events: none; }
.video-modal.mini .modal-btn { width: 30px; height: 30px; font-size: 16px; cursor: pointer; }
.video-modal.mini .modal-btn svg { width: 14px; height: 14px; }

.drag-handle {
  display: none;
  color: var(--text-mute);
  margin-left: 4px; margin-right: 4px;
  font-size: 14px; line-height: 1;
  flex-shrink: 0;
}
.video-modal.mini .drag-handle { display: inline-block; }

.dock-icon-mini { display: block; }
.dock-icon-expand { display: none; }
.video-modal.mini .dock-icon-mini { display: none; }
.video-modal.mini .dock-icon-expand { display: block; }

/* ══ RESPONSIVE ══ */
@media (max-width: 980px) {
  .header-search { max-width: 380px; }
  .video-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
}

@media (max-width: 768px) {
  .header-inner { padding: 0 18px; gap: 10px; }
  .header-search, .header-nav { display: none; }
  .menu-toggle { display: flex; }
  .container { padding: 0 18px; }
  .hero { padding: 40px 0 20px; }
  .filter-card { padding: 14px; }
  .filter-select { flex: 1; min-width: 0; }
  .filter-card .results-badge { margin-inline-start: 0; width: 100%; justify-content: center; order: -1; }
  .video-grid { grid-template-columns: 1fr !important; gap: 16px; }
  .card-title { min-height: auto; }
  .footer-inner { flex-direction: column; text-align: center; }
  .video-modal.mini .modal-box {
    width: calc(100vw - 16px);
    left: 8px !important;
    right: 8px !important;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    border-radius: var(--radius);
  }
  /* Search hero tighter on mobile */
  .search-hero { padding: 24px 0 12px; }
  .search-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
  }
}

@media (max-width: 480px) {
  .site-logo { font-size: 20px; }
  .logo-icon { width: 34px; height: 34px; font-size: 16px; }
  .header-inner { height: 64px; }
  .hero-eyebrow { font-size: 12px; padding: 5px 12px; }
  .section-heading { margin-bottom: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ══ MOBILE PERFORMANCE — disable heavy GPU effects on touch/small screens ══ */
@media (max-width: 1024px), (hover: none) and (pointer: coarse) {
  .site-header,
  .filter-card,
  .video-card,
  .card-rank,
  .card-duration,
  .views-badge,
  .video-modal,
  .mobile-search form {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  .site-header { background: var(--bg-1); }
  [data-theme="light"] .site-header { background: var(--bg-1); }
  .card-rank, .card-duration, .views-badge { background: rgba(10,10,21,0.92); }
  .video-modal { background: rgba(0,0,0,0.92); }

  .video-card::before { display: none !important; }
  .video-card { transition: none; }
  .video-card:hover { transform: none; box-shadow: var(--shadow-card); }
  .card-thumb img, .video-card:hover .card-thumb img { transition: none; transform: none; }

  /* Keep every card the same height even when meta rows are missing */
  .video-card { min-height: 260px; }
  .card-body { justify-content: space-between; }
  .card-title { min-height: auto; }

  /* Force the mini player above iOS address bar / notch & give it a GPU layer */
  .video-modal.mini .modal-box {
    z-index: 10000;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
  }
}

