/* ===== WatchFap theme ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }

/* Light */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-2: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --border: #e4e8ee;
  --text: #10151c;
  --text-dim: #667085;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --on-accent: #ffffff;
  --gate-bg: rgba(246, 247, 249, 0.6);
  --shadow: 0 1px 3px rgba(16, 21, 28, 0.08), 0 1px 2px rgba(16, 21, 28, 0.04);
  --shadow-lg: 0 10px 30px rgba(16, 21, 28, 0.16);
  --radius: 12px;
  --radius-sm: 8px;
  --page: 1480px;
}

/* Dark */
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f141c;
  --bg-2: #151c26;
  --surface: #161d28;
  --surface-2: #1f2836;
  --border: #29323f;
  --text: #e8edf3;
  --text-dim: #98a2b3;
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --on-accent: #ffffff;
  --gate-bg: rgba(10, 14, 21, 0.6);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 34px rgba(0, 0, 0, 0.55);
}

html {
  background: var(--bg);
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  min-height: 100vh;
}

.hidden { display: none !important; }
a { color: inherit; }

/* ===== Logo ===== */
.logo {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  max-width: 46%;
  text-decoration: none;
  line-height: 0;
}
.logo img {
  display: block;
  height: 44px;
  width: auto;
  max-width: 100%;
}
.logo img.logo-on-light { display: none; }
:root:not([data-theme="dark"]) .logo img.logo-on-dark { display: none; }
:root:not([data-theme="dark"]) .logo img.logo-on-light { display: block; }

/* ===== Age gate ===== */
.age-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--gate-bg);
  backdrop-filter: blur(16px) saturate(115%);
  -webkit-backdrop-filter: blur(16px) saturate(115%);
}
.age-ok .age-gate { display: none; }
html:not(.age-ok):has(.age-gate) body { overflow: hidden; }
html:not(.age-ok) #app { pointer-events: none; user-select: none; }

.age-gate-box {
  width: calc(100% - 32px);
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 20px 32px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.age-gate-box .logo {
  display: flex;
  justify-content: center;
  margin: 0 auto 16px;
  max-width: 100%;
}
.age-gate-box .logo img {
  height: 52px;
}
.age-gate-box h1, .age-gate-box .age-gate-title { font-size: 22px; margin-bottom: 14px; }
.age-gate-box p { color: var(--text-dim); line-height: 1.6; margin-bottom: 26px; }
.age-gate-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 10px;
  border: none;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, filter 0.12s ease, background 0.12s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); }

/* ===== Masthead ===== */
.masthead {
  max-width: var(--page);
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  gap: 48px;
}
.masthead-top { display: contents; }
.menu-toggle,
.menu-toggle-spacer { display: none; }
.site-head { display: contents; }
.search-form {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  background: #2b3038;
  border: none;
  border-radius: 999px;
  padding: 3px 3px 3px 2px;
  overflow: hidden;
}
.search-form:focus-within { box-shadow: none; }
#search {
  flex: 1;
  min-width: 0;
  padding: 10px 12px 10px 18px;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 15px;
  outline: none;
}
#search::placeholder { color: #8b93a0; }
#search::-webkit-search-cancel-button { filter: invert(1); }
.search-btn {
  flex: 0 0 auto;
  width: 42px;
  height: 36px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.search-btn:hover { background: var(--accent-hover); }
[data-theme="dark"] .search-form { background: #3a4150; }

/* ===== Tier 3: main nav ===== */
.mainnav {
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.mainnav-inner {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: stretch;
}
.nav-left {
  display: flex;
  align-items: stretch;
  flex: 1;
  min-width: 0;
}
.nav-dd { display: flex; flex: 1; min-width: 0; position: relative; }
.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 700;
  padding: 15px 10px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.12s ease, border-color 0.12s ease;
  white-space: nowrap;
}
a.nav-link { text-decoration: none; color: var(--text-dim); }
a.more-sort, a.more-dur, a.cat-chip { display: block; text-decoration: none; box-sizing: border-box; }
.nav-link:hover { color: var(--text); }
.nav-link.active { color: var(--accent); border-bottom-color: var(--accent); }
.nav-theme {
  flex: 0 0 48px;
  width: 48px;
  padding: 0;
  color: var(--text-dim);
}
.nav-theme:hover { color: var(--text); }
.nav-theme svg { display: block; }

.more-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 200;
  width: auto;
  min-width: 220px;
  max-height: 70vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 6px 0;
  text-align: left;
}
.more-section + .more-section { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--border); }
.more-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-dim);
  font-weight: 700;
  padding: 8px 16px 4px;
}
.more-row { display: flex; flex-direction: column; }
.more-sort, .more-dur, .cat-chip {
  background: none;
  border: none;
  border-radius: 0;
  color: var(--text);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-transform: capitalize;
  text-align: left;
  width: 100%;
  transition: background 0.12s ease, color 0.12s ease;
}
.more-sort:hover, .more-dur:hover, .cat-chip:hover { background: var(--surface-2); color: var(--accent); }
.more-sort.active, .more-dur.active, .cat-chip.active { color: var(--accent); background: var(--surface-2); }
.more-cats { max-height: 280px; overflow-y: auto; }

/* ===== Main / grid head ===== */
main { padding: 20px 24px 44px; max-width: var(--page); margin: 0 auto; }
.grid-head { display: flex; align-items: baseline; margin-bottom: 18px; }
.grid-title { font-size: 22px; font-weight: 800; text-transform: capitalize; }
.browse-note {
  margin: -6px 0 16px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 13px;
}

.model-row {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 4px 2px 18px;
  margin: 0 0 6px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.model-row.hidden { display: none !important; }
.model-chip {
  flex: 0 0 auto;
  width: 84px;
  text-decoration: none;
  color: var(--text);
  text-align: center;
}
.model-chip img {
  display: block;
  width: 72px;
  height: 72px;
  margin: 0 auto 8px;
  object-fit: cover;
  border-radius: 50%;
  background: var(--surface-2);
  border: 2px solid var(--border);
}
.model-chip span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
}
.model-chip:hover img,
.model-chip.active img { border-color: var(--accent); }
.model-chip:hover span,
.model-chip.active span { color: var(--accent); }

.grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 20px;
}

/* ===== Cards ===== */
.card {
  display: block;
  background: var(--surface);
  border: none;
  border-radius: 0;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: none;
  transform: none;
}
.card:hover { transform: none; border-color: transparent; box-shadow: none; }

.thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--surface-2);
  overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-empty::before {
  content: "▶";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 34px;
}
.duration {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
}
.badge-hd {
  position: absolute;
  left: 8px;
  top: 8px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.4px;
  padding: 2px 8px;
  border-radius: 6px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
}

.card .meta {
  padding: 12px 14px 14px;
  border: 1px solid var(--border);
  border-top: none;
}
.card .meta h3 {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em;
}
.card .meta .sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 9px;
  color: var(--text-dim);
  font-size: 12.5px;
}
.card .meta .sub-left { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .meta .sub-right { white-space: nowrap; flex-shrink: 0; }

.empty-msg { text-align: center; color: var(--text-dim); padding: 60px 0; }

/* ===== Pagination ===== */
.pagination { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; padding: 40px 0 8px; }
.page-btn {
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.12s ease;
}
.page-btn:hover:not(:disabled):not(.active) { border-color: var(--accent); color: var(--accent); }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; cursor: default; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.page-ellipsis { color: var(--text-dim); padding: 0 4px; }
.page-note { width: 100%; text-align: center; color: var(--text-dim); font-size: 12px; margin-top: 10px; }

/* ===== Ad slots (dynamic) ===== */
.ad-slot { display: flex; align-items: center; justify-content: center; margin: 18px auto; }
.ad-leaderboard { max-width: var(--page); width: 100%; }
.ad-slot .ad-label { display: none; }
.ad-slot.ad-empty { display: none; }
.ad-slot.ad-preview {
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-dim);
}
.ad-slot.ad-preview .ad-label { display: block; font-size: 10px; letter-spacing: 1px; text-transform: uppercase; opacity: 0.6; }
.ad-leaderboard.ad-preview { min-height: 90px; }
.ad-rectangle.ad-preview { width: 100%; min-height: 250px; }
.ad-skyscraper.ad-preview { width: 100%; min-height: 600px; }

/* ===== Footer ===== */
.footer {
  padding: 32px 24px;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12.5px;
  line-height: 1.7;
  text-align: center;
  max-width: 980px;
  margin: 0 auto;
}
.footer-seo { margin-bottom: 14px; }
.footer a { color: var(--accent); }
.legal-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 18px;
  margin-bottom: 16px;
}
.legal-nav a { font-weight: 700; font-size: 13px; }

.doc {
  max-width: 760px;
  margin: 0 auto;
  padding: 12px 24px 48px;
  line-height: 1.65;
}
.doc h1 { font-size: 28px; margin-bottom: 10px; }
.doc h2 { font-size: 18px; margin: 28px 0 10px; }
.doc p, .doc li { color: var(--text); margin-bottom: 12px; }
.doc-updated { color: var(--text-dim); font-size: 13px; }

/* ===== Watch page ===== */
.watch {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  max-width: var(--page);
  margin: 0 auto;
  padding: 20px 24px 48px;
  align-items: start;
}
.player-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.player-wrap iframe { width: 100%; height: 100%; display: block; border: 0; }
.player-fs {
  display: none;
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 3;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.player-fs.is-needed { display: flex; }
.player-fs:hover { background: rgba(0, 0, 0, 0.75); }
.player-wrap.is-fs,
.player-wrap:fullscreen,
.player-wrap:-webkit-full-screen {
  position: fixed;
  inset: 0;
  z-index: 3000;
  width: 100%;
  height: 100%;
  max-height: 100dvh;
  aspect-ratio: auto;
  border-radius: 0;
  background: #000;
}
body.player-fs-on { overflow: hidden; }
@media (max-width: 640px) {
  .player-fs.is-needed { bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
}

.watch-title { font-size: 20px; font-weight: 800; margin: 18px 0 10px; line-height: 1.3; }
.watch-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.watch-bar .watch-meta { margin-bottom: 0; }
.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.12s ease;
  flex-shrink: 0;
}
.like-btn:hover { border-color: var(--accent); color: var(--accent); }
.like-btn svg { color: var(--text-dim); transition: color 0.12s ease; }
.like-btn:hover svg { color: var(--accent); }
.like-btn.liked { border-color: var(--accent); color: var(--accent); }
.like-btn.liked svg { color: var(--accent); }
.watch-meta { display: flex; flex-wrap: wrap; gap: 8px 10px; margin-bottom: 14px; }
.watch-meta .pill {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  text-transform: capitalize;
}
.watch-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.watch-tags a {
  font-size: 12px;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
  text-decoration: none;
  text-transform: capitalize;
}
.watch-tags a:hover { color: var(--accent); border-color: var(--accent); }

.section-title { font-size: 16px; font-weight: 800; margin: 8px 0 16px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }

.watch-side { display: flex; flex-direction: column; gap: 18px; }
.side-related { display: flex; flex-direction: column; gap: 12px; }
.side-card {
  display: flex;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  border: none;
  border-radius: 0;
  overflow: hidden;
}
.side-card:hover { border-color: transparent; box-shadow: none; }
.side-card .thumb { flex: 0 0 150px; aspect-ratio: 16 / 9; }
.side-card .s-meta { padding: 8px 10px 8px 0; min-width: 0; }
.side-card .s-meta h4 {
  font-size: 13px; font-weight: 600; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.side-card .s-sub { font-size: 11.5px; color: var(--text-dim); margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== Responsive ===== */
@media (max-width: 1000px) {
  .watch { grid-template-columns: 1fr; }
  .ad-skyscraper.ad-preview { min-height: 250px; }
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
}
@media (max-width: 768px) {
  .site-head {
    display: block;
    position: sticky;
    top: 0;
    z-index: 120;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
  }
  .masthead {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px 16px 12px;
  }
  .masthead-top {
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
  }
  .menu-toggle,
  .menu-toggle-spacer {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
  }
  .menu-toggle {
    border: none;
    background: none;
    color: var(--text);
    border-radius: 10px;
    cursor: pointer;
    padding: 0;
  }
  .menu-toggle:hover { background: var(--surface-2); }
  .menu-toggle .icon-close { display: none; }
  body.nav-open .menu-toggle .icon-bars { display: none; }
  body.nav-open .menu-toggle .icon-close { display: block; }
  .masthead-top .logo {
    justify-self: center;
    max-width: 100%;
  }
  .logo img { height: 36px; }
  .search-form { width: 100%; flex: none; }
  .mainnav {
    display: none;
    position: static;
    border-top: 1px solid var(--border);
    border-bottom: none;
  }
  body.nav-open .mainnav {
    display: block;
    max-height: min(70vh, calc(100dvh - 120px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
  }
  body.nav-open { overflow: hidden; }
  .mainnav-inner { padding: 0; }
  .nav-left,
  .nav-dd {
    flex-direction: column;
    align-items: stretch;
  }
  .nav-link {
    justify-content: flex-start;
    flex: none;
    width: 100%;
    font-size: 15px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
  }
  .nav-link.active {
    border-bottom-color: var(--border);
    box-shadow: inset 3px 0 0 var(--accent);
  }
  .nav-theme {
    width: 100%;
    flex: none;
    justify-content: flex-start;
    padding: 14px 20px;
    gap: 10px;
  }
  .more-panel {
    position: static;
    width: 100%;
    max-height: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: var(--bg-2);
  }
  .more-cats { max-height: 240px; }
  .model-chip { width: 72px; }
  .model-chip img { width: 60px; height: 60px; }
}
@media (max-width: 640px) {
  .age-gate-box .logo img { height: 40px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
}
