/* =============================================================================
   QuickPlay — production styles
   Tailwind handles layout utilities. This file owns the brand, motion,
   catalog chrome, player chrome, and ad placeholders.
   ============================================================================= */

:root {
  --qp-bg: #030712;
  --qp-cyan: #22d3ee;
  --qp-violet: #a78bfa;
  --qp-rose: #fb7185;
  --qp-glow: 0 0 40px rgba(34, 211, 238, 0.25);
  --qp-radius: 1.1rem;
  --qp-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background: var(--qp-bg);
  font-family: var(--qp-sans);
}

body.is-locked {
  overflow: hidden;
  touch-action: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 80;
  border-radius: 0.75rem;
  background: #fff;
  color: #030712;
  padding: 0.5rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.skip-link:focus {
  top: 1rem;
}

[hidden] {
  display: none !important;
}

/* ---------- Ambient canvas ---------- */
.qp-ambient {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 480px at 12% -10%, rgba(34, 211, 238, 0.14), transparent 55%),
    radial-gradient(720px 420px at 92% 0%, rgba(167, 139, 250, 0.16), transparent 50%),
    radial-gradient(600px 400px at 50% 120%, rgba(244, 63, 94, 0.08), transparent 50%),
    linear-gradient(180deg, #030712 0%, #070b16 100%);
}

.qp-ambient::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 70%);
}

/* ---------- Brand ---------- */
.qp-logo-badge {
  display: grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  overflow: hidden;
  border-radius: 0.7rem;
  background: #000;
  box-shadow: 0 8px 24px rgba(34, 211, 238, 0.2);
}

.qp-logo-badge img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}

.qp-logo-badge--sm {
  width: 1.85rem;
  height: 1.85rem;
}

.qp-gradient-text {
  background: linear-gradient(90deg, #67e8f9, #c4b5fd, #fda4af);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.qp-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(3, 7, 18, 0.72);
  backdrop-filter: blur(18px);
}

.qp-quick-link {
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  color: #94a3b8;
  transition: color 0.15s ease, background 0.15s ease;
}

.qp-quick-link:hover,
.qp-quick-link:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.qp-quick-link.is-active {
  color: #ecfeff;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.18), rgba(167, 139, 250, 0.16));
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.28);
}

.qp-source-badge {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  padding: 0.35rem 0.75rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
}

.qp-source-badge.is-live {
  color: #67e8f9;
  border-color: rgba(34, 211, 238, 0.3);
}

.qp-source-badge.is-fallback {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.28);
}

/* ---------- Ads ---------- */
.qp-ad {
  display: grid;
  gap: 0.4rem;
  justify-items: center;
}

.qp-ad-label {
  font-size: 0.65rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #64748b;
}

.qp-ad-frame {
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 728px;
  border-radius: 0.85rem;
  border: 1px dashed rgba(148, 163, 184, 0.28);
  background:
    repeating-linear-gradient(
      -45deg,
      rgba(255, 255, 255, 0.02),
      rgba(255, 255, 255, 0.02) 8px,
      transparent 8px,
      transparent 16px
    );
}

.qp-ad-frame--leaderboard {
  min-height: 50px;
}

.qp-ad-frame--box {
  width: 300px;
  height: 250px;
  min-height: 250px;
  max-width: 100%;
}

.ad-slot {
  min-height: 90px;
}

.qp-ad--box.ad-slot {
  min-height: 250px;
}

@media (min-width: 768px) {
  .qp-ad-frame--leaderboard {
    min-height: 90px;
  }
}

/* ---------- Hero ---------- */
.qp-hero-grid {
  display: grid;
  gap: 0.85rem;
}

@media (min-width: 900px) {
  .qp-hero-grid {
    grid-template-columns: 1.6fr 1fr;
    grid-template-rows: 1fr 1fr;
    min-height: 360px;
  }

  .qp-hero-card:first-child {
    grid-row: 1 / span 2;
  }
}

.qp-hero-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 180px;
  border-radius: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  text-align: left;
  background: #0b1220;
}

.qp-hero-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.02);
  transition: transform 0.5s ease;
}

.qp-hero-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 20%, rgba(3, 7, 18, 0.88) 100%);
}

.qp-hero-card:hover img,
.qp-hero-card:focus-visible img {
  transform: scale(1.08);
}

.qp-hero-copy {
  position: relative;
  z-index: 1;
  display: flex;
  height: 100%;
  min-height: 180px;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.15rem;
}

.qp-hero-title {
  margin-top: 0.5rem;
  display: block;
  font-family: var(--qp-sans);
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
}

.qp-hero-copy .qp-play {
  margin-top: 0.6rem;
  width: fit-content;
}

.qp-hero-card:first-child .qp-hero-copy {
  min-height: 240px;
  padding: 1.4rem;
}

.qp-hero-card:first-child .qp-hero-title {
  font-size: 1.65rem;
}

/* ---------- Category pills ---------- */
.qp-pills-wrap {
  position: relative;
}

.qp-pills {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.35rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
}

.qp-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: #cbd5e1;
  padding: 0.45rem 0.95rem;
  font-size: 0.82rem;
  font-weight: 600;
  transition: 0.15s ease;
}

.qp-pill:hover,
.qp-pill:focus-visible {
  color: #fff;
  border-color: rgba(34, 211, 238, 0.4);
}

.qp-pill.is-active {
  color: #041016;
  background: linear-gradient(135deg, #67e8f9, #a78bfa);
  border-color: transparent;
}

/* ---------- Catalog grid ---------- */
.qp-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

@media (min-width: 640px) {
  .qp-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .qp-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1rem;
  }
}

@media (min-width: 1400px) {
  .qp-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.qp-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--qp-radius);
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: #0b1220;
  cursor: pointer;
  text-align: left;
  animation: qp-fade-up 0.45s ease both;
}

.qp-card:nth-child(n + 13) {
  animation-delay: 0s;
}

.qp-card:focus-visible {
  outline: 2px solid var(--qp-cyan);
  outline-offset: 3px;
}

.qp-card-media {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #111827;
}

.qp-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s ease, filter 0.45s ease;
}

.qp-card-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at center, rgba(3, 7, 18, 0.2), rgba(3, 7, 18, 0.72));
  opacity: 0;
  transition: opacity 0.25s ease;
}

.qp-play {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: 999px;
  padding: 0.55rem 0.95rem;
  background: linear-gradient(135deg, #22d3ee, #818cf8);
  color: #041016;
  font-size: 0.78rem;
  font-weight: 800;
  box-shadow: var(--qp-glow);
}

.qp-play i {
  width: 0.95rem;
  height: 0.95rem;
}

.qp-card:hover,
.qp-card:focus-visible {
  border-color: rgba(34, 211, 238, 0.45);
  box-shadow: 0 12px 40px rgba(34, 211, 238, 0.12);
}

.qp-card:hover img,
.qp-card:focus-visible img {
  transform: scale(1.08);
  filter: brightness(1.08) saturate(1.08);
}

.qp-card:hover .qp-card-overlay,
.qp-card:focus-visible .qp-card-overlay {
  opacity: 1;
}

.qp-card-body {
  padding: 0.7rem 0.75rem 0.85rem;
}

.qp-card-title {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-family: var(--qp-sans);
  font-size: 0.9rem;
  font-weight: 700;
  color: #f8fafc;
}

.qp-card-meta {
  margin-top: 0.35rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.qp-tag {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.15rem 0.5rem;
  font-size: 0.65rem;
  font-weight: 600;
  color: #94a3b8;
}

.qp-badge {
  position: absolute;
  top: 0.55rem;
  left: 0.55rem;
  z-index: 2;
  border-radius: 999px;
  padding: 0.18rem 0.5rem;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.qp-badge--hot {
  background: linear-gradient(135deg, #fb7185, #f59e0b);
  color: #1c0a0a;
  box-shadow: 0 6px 16px rgba(251, 113, 133, 0.35);
}

.qp-badge--rate {
  left: auto;
  right: 0.55rem;
  background: rgba(3, 7, 18, 0.78);
  color: #fde68a;
  backdrop-filter: blur(8px);
}

/* Touch devices: keep Play visible so the CTA is not hover-only */
@media (hover: none) {
  .qp-card-overlay {
    opacity: 1;
    background: linear-gradient(180deg, transparent 45%, rgba(3, 7, 18, 0.55) 100%);
    align-items: end;
    padding-bottom: 0.7rem;
  }
}

/* ---------- Skeleton ---------- */
.qp-skel {
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border-radius: var(--qp-radius);
  background: linear-gradient(90deg, #0b1220 25%, #152033 50%, #0b1220 75%);
  background-size: 200% 100%;
  animation: qp-shimmer 1.2s ease-in-out infinite;
}

.qp-empty {
  display: grid;
  place-items: center;
  padding: 3.5rem 1rem;
  text-align: center;
}

/* ---------- Buttons ---------- */
.qp-btn-primary,
.qp-btn-ghost,
.qp-btn-bar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  transition: 0.15s ease;
}

.qp-btn-primary {
  background: linear-gradient(135deg, #22d3ee, #818cf8);
  color: #041016;
  padding: 0.7rem 1.2rem;
  box-shadow: var(--qp-glow);
}

.qp-btn-primary:hover,
.qp-btn-primary:focus-visible {
  filter: brightness(1.08);
}

.qp-btn-ghost {
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.5rem 0.9rem;
  color: #e2e8f0;
}

.qp-btn-bar {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: #e2e8f0;
  padding: 0.5rem 0.8rem;
}

.qp-btn-bar:hover,
.qp-btn-bar:focus-visible {
  background: rgba(255, 255, 255, 0.1);
}

.qp-btn-bar--danger:hover,
.qp-btn-bar--danger:focus-visible {
  border-color: rgba(251, 113, 133, 0.5);
  color: #fecdd3;
}

/* ---------- Player modal ---------- */
.qp-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
}

.qp-modal[hidden] {
  display: none;
}

.qp-modal-scrim {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 14, 0.78);
  backdrop-filter: blur(10px);
}

.qp-modal-panel {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 0;
  width: min(1280px, calc(100vw - 1.25rem));
  height: min(92vh, 900px);
  margin: auto;
  flex-direction: column;
  overflow: hidden;
  border-radius: 1.15rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #070b14;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  animation: qp-fade-up 0.25s ease both;
}

.qp-player-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
}

.qp-player-layout {
  display: grid;
  min-height: 0;
  flex: 1;
}

@media (min-width: 1024px) {
  .qp-player-layout {
    grid-template-columns: minmax(0, 1fr) 320px;
  }
}

.qp-player-stage {
  position: relative;
  min-height: 52vh;
  background: #000;
}

.qp-player-stage iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

.qp-player-aside {
  display: none;
  gap: 1rem;
  overflow: auto;
  padding: 1rem;
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  background: #080d18;
}

@media (min-width: 1024px) {
  .qp-player-aside {
    display: grid;
    align-content: start;
  }
}

.qp-modal.is-fullscreen .qp-modal-panel {
  width: 100vw;
  height: 100vh;
  max-width: none;
  border-radius: 0;
}

.qp-modal.is-fullscreen .qp-player-aside {
  display: none;
}

.qp-modal.is-fullscreen .qp-player-stage {
  min-height: 0;
  flex: 1;
}

/* ---------- FAQ ---------- */
.qp-faq {
  border-radius: 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.03);
  padding: 0.15rem 0.9rem;
}

.qp-faq summary {
  cursor: pointer;
  list-style: none;
  padding: 0.8rem 0;
  font-weight: 600;
  color: #e2e8f0;
}

.qp-faq summary::-webkit-details-marker {
  display: none;
}

.qp-faq p {
  padding-bottom: 0.85rem;
  font-size: 0.9rem;
  line-height: 1.6;
  color: #94a3b8;
}

.qp-steps {
  display: grid;
  gap: 0.85rem;
  padding: 0;
  margin: 0;
  list-style: none;
  counter-reset: qp-step;
}

@media (min-width: 768px) {
  .qp-steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.qp-steps li {
  counter-increment: qp-step;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.03);
  padding: 1.1rem 1.15rem 1.2rem;
}

.qp-steps h3 {
  margin: 0 0 0.45rem;
  font-size: 1rem;
  font-weight: 700;
  color: #f8fafc;
}

.qp-steps h3::before {
  content: counter(qp-step) ". ";
  color: #67e8f9;
}

.qp-steps p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.6;
  color: #94a3b8;
}

/* ---------- Motion ---------- */
@keyframes qp-fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .qp-card,
  .qp-modal-panel,
  .qp-skel,
  .qp-card-media img {
    animation: none !important;
    transition: none !important;
  }
}
