:root {
  color-scheme: dark;
  --bg: #0d1117;
  --surface: #141b24;
  --surface-2: #1b2531;
  --surface-3: #223040;
  --text: #f4f7fb;
  --muted: #9eacbb;
  --line: #2a3948;
  --accent: #ffb454;
  --accent-strong: #ff7a59;
  --accent-soft: rgba(255, 180, 84, .14);
  --danger: #ff6b6b;
  --shadow: 0 18px 50px rgba(0, 0, 0, .28);
  --radius: 5px;
  --radius-sm: 5px;
  --max: 1240px;
  --font: "Trebuchet MS", "Segoe UI", sans-serif;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #edf1f5;
  --surface-3: #e3e9ef;
  --text: #17212b;
  --muted: #5f6d7a;
  --line: #d4dde6;
  --accent: #c96d00;
  --accent-strong: #d94e30;
  --accent-soft: rgba(201, 109, 0, .12);
  --shadow: 0 18px 50px rgba(32, 49, 66, .12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: radial-gradient(circle at 92% 0, rgba(255, 180, 84, .09), transparent 30rem), var(--bg);
  color: var(--text);
  font: 400 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
body.menu-open { overflow: hidden; }
a { color: inherit; }
button, input, select { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 100; padding: .7rem 1rem; background: var(--accent); color: #111; border-radius: var(--radius-sm); font-weight: 700; }
.skip-link:focus { top: 1rem; }
.container { width: min(100% - 2rem, var(--max)); margin-inline: auto; }
.site-header {
  position: sticky;
  top: 0;
  z-index: 99999;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(16px);
}
.navbar { display: flex; align-items: center; justify-content: space-between; min-height: 68px; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .65rem; color: var(--text); text-decoration: none; font-size: 1.2rem; font-weight: 800; letter-spacing: .04em; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), var(--accent-strong)); color: #131313; font-weight: 900; }
.nav-toggle, .theme-toggle { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: var(--radius-sm); min-width: 44px; min-height: 44px; }
.nav-toggle { display: inline-grid; place-items: center; font-size: 1.3rem; }
.nav-links { display: flex; align-items: center; gap: .4rem; }
.nav-link { padding: .65rem .85rem; color: var(--muted); border-radius: var(--radius-sm); text-decoration: none; font-weight: 700; }
.nav-link:hover, .nav-link.active { color: var(--text); background: var(--accent-soft); }
.header-actions { display: flex; align-items: center; gap: .5rem; }
.theme-toggle { color: var(--accent); }
.nav-dropdown { position: relative; }
.nav-dropdown-toggle { display: inline-flex; align-items: center; gap: .4rem; border: 0; background: transparent; font: inherit; cursor: pointer; }
.nav-dropdown-menu { position: absolute; top: calc(100% + .4rem); right: 0; display: none; min-width: 180px; padding: .35rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.nav-dropdown.open .nav-dropdown-menu { display: grid; }
.nav-dropdown-menu .nav-link { display: block; }

main { padding-block: 1rem 1rem; }
.eyebrow { margin: 0 0 .45rem; color: var(--accent); font-size: .75rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 760px; margin-bottom: .55rem; font-size: clamp(2rem, 6vw, 4.3rem); line-height: .98; letter-spacing: -.04em; }
.lede { max-width: 650px; margin-bottom: 0; color: var(--muted); font-size: 1rem; }
.page-heading, .home-intro h1 { margin-bottom: .65rem; font-size: 2.1rem; line-height: 1.1; letter-spacing: 0; }
.player-back {
  position: absolute;
  top: .9rem;
  left: .9rem;
  z-index: 10;
  display: none;
  align-items: center;
  gap: .5rem;
  padding: .6rem .8rem;
  background: rgba(20, 27, 36, .82);
  color: var(--text);
  border: 1px solid rgba(255, 180, 84, .32);
  border-radius: 1px;
  box-shadow: 0 10px 28px rgba(0,0,0,.24);
  backdrop-filter: blur(8px);
  font-weight: 700;
  text-decoration: none;
}
.player-back:hover {
  background: rgba(255, 180, 84, .12);
  border-color: rgba(255, 180, 84, .7);
  color: var(--accent);
}
.home-intro { margin-block: 1.5rem 2rem; }
.home-section { margin-block: 2rem; }
.home-section-panel {
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.home-section-header { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: .85rem; }
.home-section-header h2 { margin: 0; font-size: 1.3rem; }
.home-section-kicker {
  margin: 0 0 .2rem;
  color: var(--accent);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.home-section-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: .7rem .9rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 700;
  text-decoration: none;
}
.home-section-link:hover { color: var(--accent); border-color: var(--accent); }
.home-collection-note { min-height: 1.4em; margin-bottom: .75rem; color: var(--muted); font-size: .9rem; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin: 1rem 0 1.25rem; padding: .75rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.field { flex: 1 1 150px; min-width: 0; }
.field label { display: block; margin-bottom: .25rem; color: var(--muted); font-size: .75rem; font-weight: 700; }
select, .search-input { width: 100%; min-height: 44px; padding: .65rem .75rem; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.view-toggle { display: flex; gap: .25rem; align-self: end; padding: .2rem; background: var(--surface-2); border-radius: var(--radius-sm); }
.view-toggle button { min-width: 44px; min-height: 40px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); }
.view-toggle button.active { background: var(--accent); color: #131313; }

.video-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
.video-grid.list-view { grid-template-columns: 1fr; }
.video-card { display: flex; flex-direction: column; min-width: 0; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 22px rgba(0,0,0,.12); transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease; }
.video-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow); }
.thumbnail { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: var(--surface-3); }
.thumbnail img { display: block; width: 100%; height: 100%; object-fit: cover; }
.play-badge { position: absolute; inset: auto .75rem .75rem auto; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--accent); color: #151515; font-weight: 900; }
.new-badge { position: absolute; top: .7rem; left: .7rem; padding: .2rem .45rem; background: var(--accent-strong); color: #fff; border-radius: 6px; font-size: .68rem; font-weight: 800; letter-spacing: .08em; }
.video-info { display: flex; flex: 1; flex-direction: column; gap: .6rem; padding: .85rem; }
.video-title { display: -webkit-box; overflow: hidden; margin: 0; color: var(--text); font-size: .95rem; line-height: 1.3; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.video-meta { display: flex; flex-wrap: wrap; gap: .35rem .65rem; color: var(--muted); font-size: .75rem; }
.video-actions { display: flex; gap: .45rem; margin-top: auto; padding-top: .25rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 42px; padding: .6rem .8rem; border: 1px solid var(--line); border-radius: var(--radius-sm); text-decoration: none; font-weight: 800; }
.icon-button { width: 44px; min-width: 44px; padding: 0; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #151515; }
.btn.secondary { background: var(--surface-2); color: var(--text); }
.btn:hover { filter: brightness(1.08); }
.video-actions .btn { flex: 1; font-size: .8rem; }

.status-panel { padding: 3rem 1rem; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }
.status-panel h2 { color: var(--text); }
.hidden { display: none !important; }
.skeleton { min-height: 240px; background: linear-gradient(110deg, var(--surface) 30%, var(--surface-2) 45%, var(--surface) 60%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; border-radius: var(--radius); }
.home-skeleton-card { pointer-events: none; }
.home-skeleton-block { display: block; border-radius: 3px; background: linear-gradient(110deg, var(--surface-2) 30%, var(--surface-3) 45%, var(--surface-2) 60%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.home-skeleton-image { position: absolute; inset: 0; }
.home-skeleton-title { height: 2.6em; }
.home-skeleton-action-row { margin-top: auto; padding-top: .25rem; }
.home-skeleton-action { width: 44px; height: 42px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; margin-top: 1.5rem; }
.page-btn { min-width: 42px; min-height: 42px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--text); }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: #151515; font-weight: 800; }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }
.pagination-current { display: inline-flex; align-items: center; min-height: 42px; padding-inline: .35rem; color: var(--muted); font-size: .8rem; font-weight: 800; }

.toast { position: fixed; right: 1rem; bottom: 1rem; z-index: 50; max-width: min(90vw, 360px); padding: .8rem 1rem; background: var(--surface-3); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.age-gate { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 1rem; background: rgba(5, 8, 12, .9); backdrop-filter: blur(12px); }
.age-dialog { width: min(100%, 440px); padding: 1.5rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.age-dialog h2 { font-size: 1.6rem; }
.age-actions { display: flex; gap: .6rem; margin-top: 1.25rem; }
.age-actions .btn { flex: 1; }

.player-shell {
  width: min(100%, 1100px);
  margin: 1rem auto 1.5rem;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.player-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
}

.player-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.player-frame iframe[hidden] {
  display: none;
}

.player-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: .5rem;
  padding: 1rem;
  text-align: center;
  background: #000;
  color: var(--muted);
}

.player-state strong {
  color: var(--text);
}

.player-state.error {
  color: var(--danger);
}

.player-details {
  display: grid;
  gap: 1rem;
}

.panel {
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.panel h1,
.panel h2 {
  margin-bottom: .8rem;
  font-size: 1.1rem;
}

.panel h1 {
  max-width: none;
  line-height: 1.3;
}

.url-row {
  display: flex;
  gap: .5rem;
  margin-top: .65rem;
}

.url-row input {
  min-width: 0;
  flex: 1;
  padding: .65rem .75rem;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.url-row .btn {
  flex: 0 0 auto;
}

.notice {
  color: var(--muted);
  font-size: .85rem;
}

.site-footer {
  margin-top: 3rem;
  padding: 2.25rem 0 1.25rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.footer-grid {
  display: grid;
  gap: 1.5rem;
}

.site-footer h2,
.site-footer h3 {
  color: var(--text);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1.25rem;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--accent);
}

.footer-bottom {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: .8rem;
}

/* Tablet */
@media (min-width: 620px) {
  .video-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .footer-grid {
    grid-template-columns: 1.2fr 1fr;
  }
}

/* Desktop */
@media (min-width: 920px) {
  .player-back {
    display: inline-flex;
  }

  .video-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .nav-toggle {
    display: none;
  }
}

/* Mobile navigation */
@media (max-width: 919px) {
  .nav-links {
    position: absolute;
    top: calc(100% + 1px);
    left: 1rem;
    right: 1rem;
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: .6rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-link {
    padding: .85rem;
  }

  .nav-dropdown-menu {
    position: static;
    min-width: 0;
    margin-top: .25rem;
    padding: .25rem 0 .25rem .75rem;
    border: 0;
    border-left: 1px solid var(--line);
    border-radius: 0;
    box-shadow: none;
  }

  .nav-dropdown-toggle {
    justify-content: space-between;
    width: 100%;
    text-align: left;
  }
}

/* Mobile player */
@media (max-width: 768px) {
  .player-shell {
    width: 100%;
    margin: .75rem 0 1.25rem;
    border-radius: var(--radius-sm);
  }

  .player-frame {
    aspect-ratio: auto;
    height: 78vh;
    min-height: 400px;
    max-height: 800px;
  }

  .player-frame iframe {
    width: 100%;
    height: 100%;
    min-height: 0;
  }
}

/* Small mobile */
@media (max-width: 560px) {
  .player-frame {
    height: 5vh;
    min-height: 400px;
    max-height: 500px;
  }

  .home-section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .home-section-link {
    width: 100%;
    justify-content: center;
  }

  .toolbar {
    align-items: stretch;
  }

  .url-row {
    flex-wrap: wrap;
  }

  .url-row .btn {
    width: 100%;
  }
}

/* Very small screens */
@media (max-width: 380px) {
  .player-frame {
    height: 80vh;
    min-height: 400px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}