/* --- RESET + GLOBALE --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  outline: none !important;
  -webkit-tap-highlight-color: transparent !important;
  -webkit-touch-callout: none !important;
}

:root {
  --bg: #000000;
  --bg-card: #0a0a0a;
  --blood: #b91c1c;
  --blood-bright: #ef4444;
  --text: #e8d5c4;
  --text-dim: #6b5f5a;
  --line: rgba(255, 255, 255, 0.06);
}

html,
body {
  background: #000000;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  scroll-behavior: smooth;
  overflow-x: hidden;
  user-select: text;
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  -webkit-overflow-scrolling: touch;
}

::selection {
  background: var(--blood-bright) !important;
  color: #ffffff !important;
}
::-moz-selection {
  background: var(--blood-bright) !important;
  color: #ffffff !important;
}

button,
.p-btn,
.logo,
.card,
.recommended-card,
.thumb,
.thumb-sm,
.player-wrapper,
.progress-bar,
.progress-bar-sm,
.video-duration,
.video-duration-sm,
.thumb-placeholder,
.p-progress,
.p-vol {
  user-select: none !important;
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
}

h1, h2, h3, h4, h5, h6, p, span, a, li, td, th, figcaption, blockquote, label,
.meta,
.meta h3,
.meta-sm,
.meta-sm h4,
.video-title,
footer p,
.recommended-section h3,
.p-time {
  user-select: text !important;
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
}

/* HEADER */
header {
  padding: clamp(14px, 2.5vw, 22px) 5vw clamp(12px, 2vw, 18px);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  border-bottom: 1px solid var(--line);
  background: #000000;
}

.logo {
  cursor: pointer;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
}

.logo:hover { opacity: 0.8; }

.logo img {
  height: clamp(48px, 8vw, 90px);
  width: auto;
  display: block;
}

/* GRID HOME */
.grid {
  padding: clamp(14px, 2.5vw, 30px) 3vw 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: clamp(8px, 1.2vw, 14px);
  max-width: 1800px;
  margin: 0 auto;
}

.card {
  background: var(--bg-card);
  border: none;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease;
  will-change: transform;
  -webkit-tap-highlight-color: transparent;
}
.card:hover { transform: scale(1.02); }
.card:active { transform: scale(0.98); }

.thumb {
  aspect-ratio: 16 / 9;
  background: #000000;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none !important;
  background: #000000;
}

.thumb video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: none;
  pointer-events: none !important;
  background: #000000;
}

.progress-bar {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 2px;
  background: rgba(255, 255, 255, 0.05);
  z-index: 3; overflow: hidden;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none !important;
}
.progress-bar.active { opacity: 1; }
.progress-bar .fill {
  height: 100%; width: 0%;
  background: var(--blood-bright);
  transition: width 0.3s ease;
}

.video-duration {
  position: absolute;
  bottom: 6px; right: 6px;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 500;
  z-index: 2;
  font-family: 'Inter', sans-serif;
  pointer-events: none !important;
}

.meta { padding: 8px 10px 12px; }
.meta h3 {
  font-size: clamp(0.68rem, 1vw, 0.82rem);
  font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
  line-height: 1.3;
}

footer {
  text-align: center;
  padding: 24px 5vw 40px;
  color: var(--text-dim);
  font-size: 0.8rem;
  border-top: 1px solid var(--line);
  background: #000000;
}

/* PAGINATION */
.pagination-wrapper {
  padding: 16px 5vw 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.pagination-wrapper button {
  background: #0a0a0a;
  color: #e8d5c4;
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.25s ease;
  min-width: 40px;
  text-align: center;
}

.pagination-wrapper button:hover:not(:disabled):not(.active) {
  background: #1a1a1a;
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}

.pagination-wrapper button.active {
  background: #b91c1c;
  color: #ffffff;
  border-color: #b91c1c;
  font-weight: 600;
  box-shadow: 0 0 15px rgba(185, 28, 28, 0.3);
}

.pagination-wrapper button:disabled {
  opacity: 0.25;
  cursor: not-allowed;
  pointer-events: none;
}

.pagination-wrapper .page-numbers {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

#prevPage, #nextPage {
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 8px 20px;
}

.home-page.active { display: block; }
.home-page { display: none; }

/* PLAYER PAGE */
.player-page {
  display: none;
  background: #000000;
  min-height: 100vh;
  flex-direction: column;
}
.player-page.active { display: flex; }
.player-page header { flex-shrink: 0; }

.player-page-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.player-page .player-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}

.player-wrapper {
  position: relative;
  width: 100%;
  max-width: 1100px;
  margin: 20px auto 0;
  background: #000000;
  border-radius: 8px;
  overflow: hidden;
}

.player-wrapper video {
  width: 100%;
  height: auto;
  display: block;
  background: #000000;
  aspect-ratio: 16 / 9;
}

.player-controls {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 8px 12px 12px;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.95), transparent);
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 10;
}

.player-wrapper:hover .player-controls,
.player-wrapper.paused .player-controls { opacity: 1; }

.p-btn {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px;
  width: 32px;
  text-align: center;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.p-btn:hover { color: var(--blood-bright); }

.p-progress {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
}
.p-progress-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0%;
  background: var(--blood-bright);
  border-radius: 2px;
  transition: width 0.1s linear;
}
.p-time {
  font-size: 0.75rem;
  color: var(--text-dim);
  white-space: nowrap;
  min-width: 80px;
  text-align: right;
}
.p-vol { width: 60px; accent-color: var(--blood-bright); }

.player-page .video-title {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: clamp(1rem, 2.2vw, 1.4rem);
  margin: 16px 0 8px;
  color: var(--text);
  width: 100%;
}

.player-wrapper:fullscreen {
  border-radius: 0;
  max-width: none;
  margin: 0;
}
.player-wrapper:fullscreen video {
  width: 100vw;
  height: 100vh;
  object-fit: contain;
}
.player-wrapper:fullscreen .player-controls { padding: 16px 24px 20px; }

/* RECOMMENDED */
.recommended-section {
  margin-top: 30px;
  padding: 20px 0 40px;
  border-top: 1px solid var(--line);
  background: #000000;
  width: 100%;
}

.recommended-section h3 {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: clamp(0.85rem, 1.4vw, 1rem);
  margin-bottom: 20px;
  color: var(--text);
  letter-spacing: 0.5px;
}

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

.recommended-card {
  background: var(--bg-card);
  border: none;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.25s ease;
}
.recommended-card:hover { transform: translateY(-3px); }

.recommended-card .thumb-sm {
  aspect-ratio: 16 / 9;
  background: #0a0a0a;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.recommended-card .thumb-sm video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: none;
  pointer-events: none !important;
  background: #000000;
}

.recommended-card .meta-sm { padding: 6px 8px 10px; }
.recommended-card .meta-sm h4 {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thumb-placeholder {
  width: 100%; height: 100%;
  background: radial-gradient(circle at 30% 30%, #1a1a1a, #0a0a0a);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #2a2a2a;
  font-weight: 700;
  letter-spacing: 4px;
  pointer-events: none;
  user-select: none;
}

.recommended-card .progress-bar-sm {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 2px;
  background: rgba(255, 255, 255, 0.05);
  z-index: 3; overflow: hidden;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none !important;
}
.recommended-card .progress-bar-sm.active { opacity: 1; }
.recommended-card .progress-bar-sm .fill-sm {
  height: 100%; width: 0%;
  background: var(--blood-bright);
  transition: width 0.3s ease;
}

.recommended-card .video-duration-sm {
  position: absolute;
  bottom: 4px; right: 4px;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  font-size: 0.6rem;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 500;
  z-index: 2;
  font-family: 'Inter', sans-serif;
  pointer-events: none !important;
}

/* ================================================================ */
/* RESPONSIVE */
/* ================================================================ */
@media (min-width: 1921px) {
  .grid, .recommended-section, .player-page .player-container { max-width: 2200px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

@media (max-width: 1600px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
}

@media (max-width: 1200px) {
  .grid { gap: 12px; }
  .recommended-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
}

@media (max-width: 992px) {
  .grid { padding: 20px 4vw; }
  .player-page .player-container { padding: 0 12px; }
  .player-wrapper { margin: 15px auto 0; }
}

@media (max-width: 768px) {
  header { justify-content: center !important; }
  .logo { margin: 0 auto; width: 100%; display: flex; justify-content: center; }
  .logo img { height: 32px; width: auto; max-width: none; }

  .grid { grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 14px 2vw; }
  .meta { padding: 5px 6px 8px; }
  .meta h3 { font-size: 0.72rem; }
  .video-duration { bottom: 4px; right: 4px; font-size: 0.6rem; padding: 1px 4px; }

  .player-wrapper { border-radius: 0; margin: 0 auto; max-width: 100%; }
  .player-page .player-container { padding: 0; }
  .player-page .video-title { margin: 10px 12px 6px; }
  .player-controls { display: none !important; }
  .player-wrapper video { pointer-events: auto !important; }

  .recommended-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .recommended-section { padding: 15px 10px 30px; }

  .pagination-wrapper { gap: 4px; padding: 12px 3vw 30px; }
  .pagination-wrapper button { padding: 6px 10px; font-size: 0.75rem; min-width: 32px; border-radius: 6px; }
  #prevPage, #nextPage { padding: 6px 12px; font-size: 0.75rem; }

  footer { padding: 16px 5vw 25px; font-size: 0.7rem; }
}

@media (max-width: 768px) {
  .logo img { height: 96px; width: auto; max-width: none; }
}

@media (max-width: 480px) {
  .logo img { height: 84px; width: auto; max-width: none; }
}

@media (max-width: 380px) {
  .logo img { height: 78px; width: auto; max-width: none; }
}

@media (max-width: 320px) {
  .logo img { height: 72px; width: auto; max-width: none; }
}