:root {
  --bg: #000000;
  --bg-alt: #0b0b0b;
  --surface: #101010;
  --card: #141414;
  --accent: #33e307;
  --accent-2: #ffffff;
  --text: #ffffff;
  --muted: #c7c7c7;
  --danger: #ef6461;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.55);
  --radius: 18px;
  --grid-line: rgba(255, 255, 255, 0.05);
}

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

body {
  margin: 0;
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    linear-gradient(180deg, var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px),
    radial-gradient(circle at 20% 15%, rgba(51, 227, 7, 0.25), transparent 50%),
    radial-gradient(circle at 85% 10%, rgba(255, 255, 255, 0.08), transparent 55%),
    linear-gradient(140deg, #000000 0%, #050505 40%, #0b0b0b 100%);
  background-size: 42px 42px, 42px 42px, auto, auto, auto;
  min-height: 100vh;
}

.video-page {
  background: #000;
  overflow: hidden;
  height: 100dvh;
}

.video-only {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
}

.player-wrap {
  width: 100%;
  height: 100vh;
  background: #000;
  border-radius: 0;
  overflow: hidden;
  box-shadow: none;
  border: none;
  position: relative;
}

.back-home {
  position: absolute;
  top: 18px;
  left: 18px;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  z-index: 3;
}

.back-home svg {
  width: 22px;
  height: 22px;
  fill: #fff;
}

.player-wrap video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}

.controls {
  position: absolute;
  inset: auto 0 0 0;
  padding: 12px 18px 14px;
  background: rgba(0, 0, 0, 0.65);
  display: grid;
  gap: 10px;
  transition: opacity 0.3s ease;
}

.controls-row {
  display: grid;
  grid-template-columns: auto auto auto auto 1fr auto;
  align-items: center;
  gap: 12px;
}

.controls-hidden {
  opacity: 0;
  pointer-events: none;
}

.ctrl-btn {
  background: var(--accent);
  color: #000;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.ctrl-btn svg {
  width: 18px;
  height: 18px;
  fill: #000;
}

.ctrl-btn i {
  font-size: 18px;
  line-height: 1;
  color: #000;
  display: inline-flex;
}

.icon-flip {
  transform: scaleX(-1);
}

.ctrl-btn .icon-exit {
  display: none;
}

.ctrl-btn.is-fullscreen .icon-enter {
  display: none;
}

.ctrl-btn.is-fullscreen .icon-exit {
  display: block;
}

.icon-pause {
  display: none;
}

.is-playing .icon-play {
  display: none;
}

.is-playing .icon-pause {
  display: block;
}

.time {
  font-size: 12px;
  color: var(--muted);
  min-width: 90px;
  text-align: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.35);
}

.seek {
  width: 100%;
  accent-color: var(--accent);
}

.volume {
  width: 120px;
  accent-color: var(--accent);
}

.volume-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.volume-btn {
  background: transparent;
  border: none;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.volume-icon {
  font-size: 18px;
  color: #fff;
  display: inline-flex;
}

.volume-icon-mute {
  display: none;
}

.volume-wrap.is-muted .volume-icon {
  display: none;
}

.volume-wrap.is-muted .volume-icon-mute {
  display: inline-flex;
}


@media (max-width: 720px) {
  .controls {
    padding: 10px 12px;
  }

  .volume-wrap {
    display: none;
  }

  .video-only {
    min-height: 100dvh;
  }

  .player-wrap {
    height: 100dvh;
  }

  .back-home {
    top: 10px;
    left: 10px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .back-home svg {
    width: 18px;
    height: 18px;
  }

  .video-title {
    top: 10px;
    right: 10px;
    font-size: 12px;
    padding: 6px 10px;
  }

  .controls-row {
    grid-template-columns: auto auto auto 1fr auto;
    gap: 10px;
  }

  .ctrl-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .time {
    min-width: 70px;
    font-size: 11px;
  }

  .seek-toast-left {
    left: 12%;
  }

  .seek-toast-right {
    right: 12%;
  }

  .center-toast {
    width: 64px;
    height: 64px;
  }

  .center-toast svg {
    width: 30px;
    height: 30px;
  }
}

@media (max-width: 720px) and (orientation: portrait) {
  .controls {
    padding: 6px 10px 8px;
    gap: 6px;
    background: rgba(0, 0, 0, 0.55);
  }

  .controls-row {
    gap: 8px;
  }

  .ctrl-btn {
    width: 32px;
    height: 32px;
    border-radius: 9px;
  }

  .time {
    min-width: 60px;
    font-size: 10px;
  }

  .back-home {
    width: 32px;
    height: 32px;
  }

  .video-title {
    font-size: 11px;
  }

  .seek-toast {
    padding: 8px 12px;
    font-size: 12px;
  }

  .center-toast {
    width: 56px;
    height: 56px;
  }

  .center-toast svg {
    width: 26px;
    height: 26px;
  }
}

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

.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  padding: 28px clamp(20px, 4vw, 56px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand img {
  width: 88px;
  height: auto;
  display: block;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.6));
  border-radius: 6px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.brand h1,
.brand h2 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand h1 {
  font-size: clamp(28px, 3.2vw, 44px);
}

.brand span {
  color: var(--accent);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

.tagline {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}

.topbar nav {
  display: flex;
  gap: 14px;
  align-items: center;
}

.pill {
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  transition: transform 0.2s ease, border 0.2s ease;
}

.pill:hover {
  transform: translateY(-2px);
  border-color: rgba(51, 227, 7, 0.7);
}

.hero {
  padding: 0 clamp(20px, 4vw, 56px) 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
}

.hero p {
  max-width: 680px;
  color: var(--muted);
  margin: 0;
  line-height: 1.6;
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  min-width: min(320px, 100%);
  box-shadow: var(--shadow);
}

.search input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
}

.grid {
  padding: 16px clamp(20px, 4vw, 56px) 64px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 260px));
  justify-content: start;
  gap: 18px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 100%;
  position: relative;
  transform: translateY(0);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.45);
}

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

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

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

.card-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-body h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
  text-transform: uppercase;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-body p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.empty {
  padding: 40px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
}

.loader {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.skeleton {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 260px));
  justify-content: start;
}

.skeleton-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.skeleton-thumb {
  height: 140px;
  background: linear-gradient(90deg, #161616 0%, #1f1f1f 50%, #161616 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease infinite;
}

.skeleton-body {
  padding: 16px;
  display: grid;
  gap: 10px;
}

.skeleton-line {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #1a1a1a 0%, #222 50%, #1a1a1a 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease infinite;
}

.video-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  color: var(--text);
  z-index: 2;
}

.video-loading .loader {
  width: 140px;
  height: 140px;
  background: #000;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: rgba(255, 255, 255, 0.7);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.video-loading .spinner {
  width: 38px;
  height: 38px;
  border: 3px solid rgba(57, 255, 90, 0.2);
  border-top-color: #39ff5a;
  border-right-color: #39ff5a;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.seek-toast {
  position: absolute;
  top: 50%;
  transform: translateY(-50%) scale(0.96);
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 3;
}

.seek-toast-left {
  left: 16%;
}

.seek-toast-right {
  right: 16%;
}

.seek-toast.is-visible {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

.center-toast {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 72px;
  height: 72px;
  transform: translate(-50%, -50%) scale(0.92);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 3;
}

.center-toast svg {
  width: 34px;
  height: 34px;
  fill: #fff;
}

.center-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.player-shell {
  padding: 12px clamp(20px, 4vw, 56px) 60px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
}

.video-frame {
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

video {
  width: 100%;
  height: auto;
  display: block;
  background: #000;
}

.player-wrap:fullscreen {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-wrap:fullscreen video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-meta {
  background: var(--surface);
  padding: 22px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.video-meta h2 {
  margin: 0 0 8px;
  font-size: clamp(24px, 3vw, 32px);
}

.video-meta p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.video-page.ui-hidden {
  cursor: none;
}

.video-title {
  position: absolute;
  top: 16px;
  right: 18px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  backdrop-filter: blur(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.video-page.ui-hidden .back-home,
.video-page.ui-hidden .video-title {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
}

.admin-layout {
  padding: 0 clamp(20px, 4vw, 56px) 64px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 360px);
  gap: 24px;
}

body:not([data-admin-ready="true"]) #adminPanel {
  display: none;
}

body.modal-open {
  overflow: hidden;
}

.panel {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
}

.panel h3 {
  margin-top: 0;
}

.panel label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin: 14px 0 6px;
}

.panel input,
.panel textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #111117;
  color: var(--text);
  font-family: inherit;
}

.panel input[type="file"] {
  padding: 8px;
  background: #0d0d0f;
  cursor: pointer;
}

.panel input[type="file"]::file-selector-button {
  margin-right: 12px;
  border: none;
  background: var(--accent);
  color: #000;
  padding: 8px 12px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
}

.panel input[type="file"]::file-selector-button:hover {
  transform: translateY(-1px);
}

.panel textarea {
  min-height: 110px;
  resize: vertical;
}

.btn {
  padding: 10px 16px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  background: var(--accent);
  color: #000000;
  margin-top: 16px;
  transition: transform 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.accent-line {
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  margin: 0 clamp(20px, 4vw, 56px);
}

.section-title {
  padding: 12px clamp(20px, 4vw, 56px) 0;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  font-size: 12px;
}

.admin-list {
  display: grid;
  gap: 14px;
}

.storage {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 16px;
}

.storage strong {
  color: var(--accent);
}

.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 13px;
  color: var(--muted);
}

.stat-row strong {
  color: var(--text);
}

.stat-row:last-of-type {
  border-bottom: none;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.stat-card strong {
  color: var(--text);
  font-size: 18px;
}

.chart-grid {
  display: grid;
  gap: 12px;
}

.chart-box {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 14px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.chart-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin-bottom: 8px;
}

.chart {
  width: 100%;
  height: 120px;
  display: block;
}

.admin-item {
  padding: 16px;
  border-radius: 14px;
  background: var(--card);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

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

.btn-ghost {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

.btn-ghost:hover {
  transform: translateY(-2px);
}

.admin-item h4 {
  margin: 0 0 6px;
  text-transform: uppercase;
}

.admin-item span {
  color: var(--muted);
  font-size: 13px;
}

.auth-wall {
  padding: 60px clamp(20px, 4vw, 56px);
  display: flex;
  justify-content: center;
  align-items: center;
}

.auth-box {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow);
}

.auth-box input {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: #0d0d0f;
  color: var(--text);
  width: 100%;
  font-size: 15px;
}

.auth-box .btn {
  width: 100%;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 6, 10, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 10;
}

.modal-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: min(420px, 100%);
  background: var(--surface);
  border-radius: 18px;
  padding: 24px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
}

.modal-card h4 {
  margin: 0 0 16px;
}

.progress-wrap {
  display: flex;
  justify-content: center;
  margin: 12px 0 8px;
}

.progress-ring {
  --progress: 0%;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) var(--progress), rgba(255, 255, 255, 0.12) 0);
  position: relative;
  display: grid;
  place-items: center;
}

.progress-ring::before {
  content: "";
  position: absolute;
  inset: 12px;
  background: #0d0d0f;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.progress-ring span {
  position: relative;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.note {
  font-size: 12px;
  color: var(--muted);
}

.fade-in {
  animation: fadeIn 0.6s ease both;
}

.stagger > * {
  animation: rise 0.6s ease both;
  animation-delay: calc(var(--i) * 0.06s);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

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

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

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .brand {
    width: 100%;
    justify-content: space-between;
  }

  .brand img {
    width: 72px;
  }

  .search {
    width: 100%;
  }
}
