/* ═══════════════════════════════════════════════════════════
   SODOMUS v3 — Sidebar Layout
   Base font: 1rem everywhere. Only tags < 1rem.
═══════════════════════════════════════════════════════════ */

:root {
  --bg: #0d0d12;
  --bg1: #13131a;
  --bg2: #1b1b24;
  --bg3: #23232f;
  --brd: rgba(255, 255, 255, 0.07);
  --brdh: rgba(255, 255, 255, 0.14);

  --red: #e0132b;
  --redg: linear-gradient(135deg, #e0132b 0%, #a80f20 100%);
  --glow: rgba(224, 19, 43, 0.3);

  --t0: #ffffff;
  --t1: rgba(255, 255, 255, 0.87);
  --t2: rgba(255, 255, 255, 0.52);
  --t3: rgba(255, 255, 255, 0.28);

  --sw: 240px;
  /* sidebar width */
  --ease: cubic-bezier(.4, 0, .2, 1);

  font-size: 16px;
  /* 1rem = 16px baseline */
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--t1);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.55;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  color: inherit;
  font-size: 1rem;
}

img {
  display: block;
  max-width: 100%;
}

input {
  font-family: inherit;
  font-size: 1rem;
}

/* ─── SIDEBAR ─────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sw);
  background: var(--bg1);
  border-right: 1px solid var(--brd);
  display: flex;
  flex-direction: column;
  gap: 0;
  z-index: 80;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--bg3) transparent;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--bg3);
  border-radius: 4px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  padding: 28px 24px 24px;
  flex-shrink: 0;
}

.logo-mark {
  font-family: 'Comfortaa', cursive;
  font-size: 1.6rem;
  font-weight: 700;
  background: var(--redg);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.logo-text {
  font-family: 'Comfortaa', cursive;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--t0);
  line-height: 1;
}

/* Sidebar search */
.sidebar-search {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 16px 24px;
  padding: 0 14px;
  height: 44px;
  background: var(--bg2);
  border: 1px solid var(--brd);
  border-radius: 10px;
  color: var(--t3);
  flex-shrink: 0;
  transition: border-color .2s;
}

.sidebar-search:focus-within {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--glow);
}

.sidebar-search input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--t0);
  font-size: 1rem;
}

.sidebar-search input::placeholder {
  color: var(--t3);
}

/* Sidebar nav */
.sidebar-nav {
  padding: 0 12px 20px;
  flex-shrink: 0;
}

.nav-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: .1em;
  padding: 0 10px;
  margin-bottom: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 500;
  color: var(--t2);
  transition: color .15s, background .15s;
  text-align: left;
  margin-bottom: 2px;
}

.nav-item svg {
  flex-shrink: 0;
  opacity: .6;
  transition: opacity .15s;
}

.nav-item:hover {
  color: var(--t0);
  background: var(--bg2);
}

.nav-item:hover svg {
  opacity: 1;
}

.nav-item.active {
  color: var(--t0);
  background: var(--bg3);
}

.nav-item.active svg {
  opacity: 1;
  color: var(--red);
}

/* Category list in sidebar */
.sidebar-cats {
  flex: 1;
}

#cat-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 400;
  color: var(--t2);
  cursor: pointer;
  transition: color .15s, background .15s;
  width: 100%;
  text-align: left;
}

.cat-item:hover {
  color: var(--t0);
  background: var(--bg2);
}

.cat-item.active {
  color: var(--red);
  background: rgba(224, 19, 43, .1);
  font-weight: 500;
}

.cat-count {
  font-size: 0.75rem;
  color: var(--t3);
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px 20px;
  font-size: 0.75rem;
  color: var(--t3);
  border-top: 1px solid var(--brd);
  margin-top: auto;
  flex-shrink: 0;
}

/* ─── MOBILE BAR ─────────────────────────────────────── */
.mobile-bar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 54px;
  background: rgba(13, 13, 18, .95);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--brd);
  z-index: 90;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
}

.burger,
.mobile-search-toggle {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--t1);
  transition: background .15s;
}

.burger:hover,
.mobile-search-toggle:hover {
  background: var(--bg2);
}

.mobile-logo {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0;
}

.mobile-bar .logo-mark,
.mobile-bar .logo-text {
  font-family: 'Comfortaa', cursive;
  font-size: 1.3rem;
}

/* Mobile search bar — slides down below top bar */
.mobile-search-bar {
  position: fixed;
  top: 54px;
  left: 0;
  right: 0;
  z-index: 89;
  background: var(--bg1);
  border-bottom: 1px solid var(--brd);
  padding: 10px 14px;
  animation: slideDown .18s ease;
}

.mobile-search-bar.hidden {
  display: none;
}

.mobile-search-form {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg2);
  border: 1px solid var(--brd);
  border-radius: 10px;
  padding: 0 12px;
  height: 42px;
  color: var(--t3);
}

.mobile-search-form:focus-within {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--glow);
}

.mobile-search-form input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--t0);
  font-size: 1rem;
}

.mobile-search-form input::placeholder {
  color: var(--t3);
}

.mobile-search-form button {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--t3);
  flex-shrink: 0;
  border-radius: 6px;
  transition: color .15s, background .15s;
}

.mobile-search-form button:hover {
  color: var(--t0);
  background: var(--bg3);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ─── LAYOUT ─────────────────────────────────────────── */
.layout {
  margin-left: var(--sw);
}

.main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px 56px;
}

/* ─── HERO ───────────────────────────────────────────── */
.hero {
  position: relative;
  height: 440px;
  margin: 0 -24px 36px;
  overflow: hidden;
  background: var(--bg2);
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(2px) brightness(.45);
  transform: scale(1.05);
  transition: background-image .4s;
}

.hero-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 36px 40px;
  background: linear-gradient(0deg, rgba(13, 13, 18, .97) 0%, rgba(13, 13, 18, .4) 55%, transparent 100%);
}

.hero-eyebrow {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.hero-tag {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .15);
  color: var(--t1);
  backdrop-filter: blur(4px);
}

.hero-title {
  font-family: 'Comfortaa', cursive;
  font-size: clamp(1.5rem, 3vw, 2.4rem);
  font-weight: 700;
  color: var(--t0);
  line-height: 1.25;
  margin-bottom: 12px;
  max-width: 680px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 1rem;
  color: var(--t2);
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.hero-rating {
  color: #f0a020;
  font-weight: 600;
}

.hero-actions {
  display: flex;
  gap: 10px;
}

.btn-play {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: var(--redg);
  color: #fff;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 600;
  transition: opacity .2s, transform .15s;
  box-shadow: 0 4px 20px var(--glow);
}

.btn-play:hover {
  opacity: .9;
  transform: translateY(-1px);
}

.btn-play svg {
  flex-shrink: 0;
}

/* Hero skeleton */
.hero-skeleton {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sk-block {
  border-radius: 6px;
  background: linear-gradient(90deg, var(--bg2) 25%, var(--bg3) 50%, var(--bg2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

/* ─── STATUS ─────────────────────────────────────────── */
.status-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
}

.status-label {
  font-family: 'Comfortaa', cursive;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--t0);
}

.status-count {
  font-size: 1rem;
  color: var(--t3);
}

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

/* ─── CARD ───────────────────────────────────────────── */
.card {
  background: var(--bg1);
  border-radius: 10px;
  border: 1px solid var(--brd);
  overflow: hidden;
  cursor: pointer;
  transition: border-color .22s var(--ease), box-shadow .22s var(--ease);
  animation: fadeUp .35s both;
}

.card:hover {
  border-color: var(--brdh);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .55);
}

.card:hover .card-thumb img {
  transform: scale(1.05);
}

.card:hover .play-btn {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.card-thumb {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--bg3);
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .38s var(--ease), opacity .1s;
}

.card-thumb-sk {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--bg2) 25%, var(--bg3) 50%, var(--bg2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

.badge-quality {
  position: absolute;
  top: 7px;
  left: 7px;
  background: rgba(0, 0, 0, .72);
  backdrop-filter: blur(4px);
  color: var(--t0);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: .04em;
}

.badge-dur {
  position: absolute;
  bottom: 7px;
  right: 7px;
  background: rgba(0, 0, 0, .78);
  backdrop-filter: blur(4px);
  color: var(--t0);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
}

.play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(.82);
  width: 42px;
  height: 42px;
  background: var(--redg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .2s, transform .2s var(--ease);
  box-shadow: 0 0 20px var(--glow);
}

.play-btn svg {
  margin-left: 3px;
}

/* Frame-strip indicator */
.card-thumb::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: var(--red);
  pointer-events: none;
  z-index: 2;
}

.card.previewing .card-thumb::after {
  animation: framestrip 15s linear infinite;
  /* 30 frames × 500ms = 15s */
}

@keyframes framestrip {
  from {
    width: 0%;
  }

  to {
    width: 100%;
  }
}

.card-body {
  padding: 10px 12px 12px;
}

.card-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--t0);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  color: var(--t3);
  margin-bottom: 6px;
}

.card-rating {
  color: #f0a020;
  font-weight: 600;
}

.card-tags-row {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.card-tag {
  font-size: 0.72rem;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--bg3);
  color: var(--t3);
  border: 1px solid var(--brd);
}

/* ─── SKELETON CARD ──────────────────────────────────── */
.card-sk {
  background: var(--bg1);
  border-radius: 10px;
  border: 1px solid var(--brd);
  overflow: hidden;
  animation: fadeUp .35s both;
}

.card-sk-thumb {
  aspect-ratio: 16/9;
  background: linear-gradient(90deg, var(--bg2) 25%, var(--bg3) 50%, var(--bg2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

.card-sk-body {
  padding: 10px 12px 12px;
}

.sk-line {
  height: 14px;
  border-radius: 4px;
  margin-bottom: 6px;
  background: linear-gradient(90deg, var(--bg2) 25%, var(--bg3) 50%, var(--bg2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

.sk-line.short {
  width: 55%;
}

/* ─── PAGINATION ─────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 40px;
  flex-wrap: wrap;
}

.pg-btn {
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  color: var(--t2);
  background: var(--bg1);
  border: 1px solid var(--brd);
  cursor: pointer;
  transition: all .18s;
  user-select: none;
}

.pg-btn:hover:not(:disabled):not(.pg-active) {
  border-color: var(--brdh);
  color: var(--t0);
}

.pg-btn.pg-active {
  background: var(--red);
  color: #fff;
  border-color: transparent;
}

.pg-btn:disabled {
  opacity: .3;
  cursor: not-allowed;
}

.pg-ellipsis {
  color: var(--t3);
  padding: 0 4px;
  font-size: 1rem;
}

/* ─── PLAYER OVERLAY ─────────────────────────────────── */
.player-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.player-overlay.hidden {
  display: none;
}

.player-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 0 60px;
}

.player-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 52px;
  padding: 0 20px;
  border-bottom: 1px solid var(--brd);
  position: sticky;
  top: 0;
  background: rgba(13, 13, 18, .96);
  backdrop-filter: blur(12px);
  z-index: 10;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 1rem;
  font-weight: 500;
  color: var(--t2);
  padding: 6px 10px;
  border-radius: 8px;
  transition: color .18s, background .18s;
}

.back-btn:hover {
  color: var(--t0);
  background: var(--bg2);
}

.player-breadcrumb {
  font-size: 1rem;
  color: var(--t3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-stage {
  position: relative;
  background: #000;
}

.player-loading,
.player-error {
  aspect-ratio: 16/9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--bg1);
  color: var(--t2);
  font-size: 1rem;
}

.player-error svg {
  color: var(--red);
  opacity: .7;
}

.pill-btn {
  padding: 8px 24px;
  background: var(--red);
  color: #fff;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 600;
  transition: opacity .18s;
}

.pill-btn:hover {
  opacity: .85;
}

/* Debug panel */
.debug-panel {
  margin-top: 14px;
  width: 100%;
  max-width: 600px;
  background: #0a0a10;
  border: 1px solid rgba(224, 19, 43, .3);
  border-radius: 8px;
  overflow: hidden;
  text-align: left;
}

.debug-panel summary {
  padding: 8px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--red);
  cursor: pointer;
  user-select: none;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.debug-panel pre {
  padding: 12px 14px;
  font-size: 0.75rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--t2);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  border-top: 1px solid rgba(224, 19, 43, .2);
  max-height: 260px;
  overflow-y: auto;
}

#video-player {
  width: 100%;
  aspect-ratio: 16/9;
  display: block;
  background: #000;
  outline: none;
  max-height: 78vh;
  object-fit: contain;
}

.player-body {
  padding: 20px;
}

.player-title {
  font-family: 'Comfortaa', cursive;
  font-size: clamp(1.1rem, 2.5vw, 1.6rem);
  font-weight: 700;
  color: var(--t0);
  line-height: 1.3;
  margin-bottom: 12px;
}

.player-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 1rem;
  color: var(--t2);
  margin-bottom: 14px;
}

.dot {
  color: var(--t3);
}

.rating-text {
  color: #f0a020;
  font-weight: 600;
}

.player-actors {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.pactor {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  padding: 4px 12px 4px 10px;
  border-radius: 999px;
  background: var(--bg3);
  color: var(--t1);
  border: 1px solid var(--brd);
  cursor: pointer;
  font-weight: 500;
  transition: all .18s;
}

.pactor::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
  flex-shrink: 0;
}

.pactor:hover {
  border-color: var(--red);
  color: var(--t0);
  background: rgba(224, 19, 43, .08);
}

.player-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.ptag {
  font-size: 0.75rem;
  padding: 3px 12px;
  border-radius: 999px;
  border: 1px solid var(--brd);
  color: var(--t3);
  cursor: pointer;
  transition: all .18s;
}

.ptag:hover {
  border-color: var(--red);
  color: var(--red);
}

.related-title {
  font-family: 'Comfortaa', cursive;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--t0);
  margin-bottom: 16px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

/* ─── SPINNER ────────────────────────────────────────── */
.spinner {
  width: 38px;
  height: 38px;
  border: 3px solid var(--bg3);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}

/* ─── SIDEBAR OVERLAY (mobile) ───────────────────────── */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 79;
  background: rgba(0, 0, 0, .6);
  backdrop-filter: blur(4px);
}

.sidebar-overlay.hidden {
  display: none;
}

/* ─── Utility ────────────────────────────────────────── */
.hidden {
  display: none !important;
}

/* ─── Animations ─────────────────────────────────────── */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ─── RESPONSIVE ─────────────────────────────────────── */
@media (max-width: 900px) {
  :root {
    --sw: 260px;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform .28s var(--ease);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .layout {
    margin-left: 0;
  }

  .main {
    padding-top: 64px;
  }

  .mobile-bar {
    display: flex;
  }

  .hero {
    margin: 64px -24px 24px;
    height: 340px;
  }
}

@media (max-width: 600px) {
  .video-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .related-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .main {
    padding: 64px 14px 48px;
  }

  .hero {
    margin: 64px -14px 20px;
    height: 260px;
  }

  .hero-content {
    padding: 20px 18px;
  }
}

@media (max-width: 380px) {
  .video-grid {
    grid-template-columns: 1fr;
  }
}