* {
  box-sizing: border-box;
}

:root {
  --bg: #07111f;
  --panel: #0e1c31;
  --panel-2: #142744;
  --line: rgba(255,255,255,.08);
  --text: #ffffff;
  --muted: #9fb1cf;
  --red: #e50914;
  --red-2: #b20710;
  --blue: #2563eb;
  --blue-2: #3b82f6;
  --shadow: 0 20px 70px rgba(0,0,0,.3);
  --sidebar-width: 280px;
  --sidebar-collapsed: 92px;
  --radius: 18px;
}

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at top, #10213f 0%, var(--bg) 30%);
  color: var(--text);
  font-family: Arial, sans-serif;
}

body {
  min-height: 100vh;
}

button, input {
  font: inherit;
}

.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
  transition: grid-template-columns .25s ease;
}

.app.sidebar-collapsed {
  grid-template-columns: var(--sidebar-collapsed) 1fr;
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(0,0,0,.78), rgba(8,17,34,.96)),
    radial-gradient(circle at top left, rgba(229,9,20,.18), transparent 28%);
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  z-index: 20;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--red), var(--red-2));
  color: #fff;
  font-weight: 800;
  font-size: 22px;
  flex: 0 0 auto;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: opacity .2s ease, width .2s ease;
}

.brand-text strong {
  font-size: 20px;
  white-space: nowrap;
}

.brand-text span {
  font-size: 12px;
  color: #b9c3da;
  white-space: nowrap;
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0 18px;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
  color: #fff;
  padding: 12px 14px;
  border-radius: 14px;
  cursor: pointer;
  text-align: left;
  transition: .2s ease;
}

.nav-item:hover {
  background: rgba(255,255,255,.08);
  transform: translateY(-1px);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(229,9,20,.96), rgba(178,7,16,.96));
  border-color: transparent;
}

.nav-icon {
  width: 18px;
  text-align: center;
  flex: 0 0 auto;
}

.nav-label {
  white-space: nowrap;
}

.side-block {
  margin-top: 18px;
}

.side-title {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.3px;
  font-size: 12px;
  margin: 0 0 10px;
  transition: opacity .2s ease, width .2s ease;
}

.page-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: calc(100vh - 230px);
  overflow-y: auto;
  padding-right: 2px;
}

.page-btn {
  width: 100%;
  border: 1px solid rgba(255,255,255,.06);
  background: rgba(255,255,255,.035);
  color: #fff;
  padding: 12px 14px;
  border-radius: 14px;
  cursor: pointer;
  text-align: left;
  transition: .2s ease;
}

.page-btn:hover {
  background: rgba(255,255,255,.08);
}

.page-btn.active {
  background: linear-gradient(135deg, var(--blue), var(--blue-2));
  border-color: transparent;
}

.main {
  min-width: 0;
}

.mobile-topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 15;
  background: rgba(7,17,31,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
  align-items: center;
  gap: 12px;
}

.mobile-brand {
  font-weight: 700;
}

.content {
  padding: 28px;
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.hero-kicker {
  display: inline-block;
  margin-bottom: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(229,9,20,.14);
  color: #ffb6bb;
  border: 1px solid rgba(229,9,20,.25);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: 42px;
}

.hero p {
  margin: 0;
  color: var(--muted);
}

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

.hero-actions input,
.link-box input {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 14px;
  outline: none;
}

.hero-actions input {
  min-width: 300px;
}

.btn,
.icon-btn {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 14px;
  cursor: pointer;
  transition: .2s ease;
}

.btn {
  padding: 12px 15px;
}

.icon-btn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  font-size: 18px;
}

.btn:hover,
.icon-btn:hover {
  transform: translateY(-1px);
  background: #18315d;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.015));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.stat-card small {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.stat-card strong {
  font-size: 26px;
}

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

.card {
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.01));
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  cursor: pointer;
  transition: .2s ease;
  box-shadow: var(--shadow);
}

.card:hover {
  transform: translateY(-4px);
  border-color: rgba(59,130,246,.35);
}

.thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #132644 center/cover no-repeat;
  position: relative;
}

.badge {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 6px 9px;
  border-radius: 10px;
  font-size: 12px;
  background: rgba(0,0,0,.72);
}

.card-body {
  padding: 14px;
}

.card-title {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.45;
  min-height: 44px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(59,130,246,.12);
  color: #a8c7ff;
  border: 1px solid rgba(59,130,246,.18);
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
}

.loading,
.empty {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  color: var(--muted);
  text-align: center;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(2,8,20,.72);
  z-index: 60;
}

.modal.show {
  display: flex;
}

.modal-card {
  width: min(980px, 100%);
  background: #09162d;
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 0 0 6px;
  font-size: 24px;
}

.player-wrap {
  background: black;
}

#videoPlayer {
  width: 100%;
  max-height: 70vh;
  display: block;
  background: black;
}

.modal-body {
  padding: 16px 18px 22px;
}

.muted {
  color: var(--muted);
}

.link-box {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
}

.link-box label {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
}

.backdrop {
  display: none;
}

.desktop-only {
  display: inline-grid;
}

.app.sidebar-collapsed .brand-text,
.app.sidebar-collapsed .nav-label,
.app.sidebar-collapsed .side-title {
  width: 0;
  opacity: 0;
  overflow: hidden;
}

.app.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 12px;
}

.app.sidebar-collapsed .page-btn {
  text-indent: -9999px;
  position: relative;
  padding: 12px;
  min-height: 46px;
}

.app.sidebar-collapsed .page-btn::after {
  content: "•";
  text-indent: 0;
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 20px;
}

@media (max-width: 1100px) {
  .stats {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

@media (max-width: 860px) {
  .app,
  .app.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .mobile-topbar {
    display: flex;
  }

  .desktop-only {
    display: none;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(84vw, 320px);
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: var(--shadow);
  }

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

  .backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 19;
  }

  .backdrop.show {
    display: block;
  }

  .content {
    padding: 20px;
  }

  .hero h1 {
    font-size: 32px;
  }

  .hero-actions {
    width: 100%;
  }

  .hero-actions input {
    min-width: 100%;
    width: 100%;
  }

  .link-box {
    grid-template-columns: 1fr;
  }
}

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

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

  .modal {
    padding: 10px;
  }

  .modal-head h2 {
    font-size: 20px;
  }
}