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

:root {
  color-scheme: dark;
  --bg: #0d0d0f;
  --bg-card: #161618;
  --bg-skeleton: #1c1c1f;
  --shimmer-1: #1c1c1f;
  --shimmer-2: #2a2a2f;
  --accent: #E63950;
  --accent-hot: #FF6B2B;
  --text-primary: #f2f2f2;
  --text-secondary: #888;
  --border: #252528;
  --radius-card: 12px;
  --radius-badge: 6px;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ── Header ─────────────────────────────────────────── */

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  /* overflow:hidden clips backdrop-filter paint overflow that caused horizontal scroll */
  overflow: hidden;
  isolation: isolate;
  background: transparent;
  border-bottom: 1px solid var(--border);
}

/* backdrop-filter on pseudo-element stays contained inside overflow:hidden */
.header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(13, 13, 15, 0.9);
}

@supports (backdrop-filter: blur(1px)) {
  .header::before {
    background: rgba(13, 13, 15, 0.82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  user-select: none;
}

.logo-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-primary);
}

.header-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(230, 57, 80, 0.12);
  border: 1px solid rgba(230, 57, 80, 0.25);
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

/* ── Main ────────────────────────────────────────────── */

.main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  min-width: 0;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

/* ── Hero + Store badges ─────────────────────────────── */

.hero {
  margin-bottom: 36px;
}

.store-badges {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  pointer-events: none;
  user-select: none;
}

.store-badge {
  flex: 0 0 auto;
  height: 60px;
}

.store-badge svg {
  height: 60px;
  width: auto;
  display: block;
}

.hero-title {
  font-size: clamp(22px, 5vw, 36px);
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.2;
  margin-bottom: 8px;
}

.hero-sub {
  font-size: 15px;
  color: var(--text-secondary);
}

/* ── Catalog label ───────────────────────────────────── */

.catalog-label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* ── Grid ────────────────────────────────────────────── */

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  list-style: none;
}

@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
}

@media (max-width: 600px) {
  .grid            { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .main            { padding: 20px 12px 40px; }
  .hero            { margin-bottom: 24px; }
  .hero-title      { font-size: 22px; }
  .hero-sub        { font-size: 13px; }
  .header-inner    { padding: 0 12px; height: 52px; }
  .logo-text       { font-size: 16px; }
  .card-title      { font-size: 13px; }
  .card-meta       { font-size: 11px; }
  .card-info       { margin-top: 8px; gap: 2px; }
  .play-btn        { width: 36px; height: 36px; }
  .skeleton-play   { width: 36px; height: 36px; }
  .store-badges    { gap: 8px; margin-bottom: 20px; }
  .store-badge     { height: 54px; }
  .store-badge svg { height: 54px; }
}

@media (max-width: 380px) {
  .grid          { gap: 8px; }
  .main          { padding: 16px 10px 32px; }
  .play-btn      { width: 30px; height: 30px; }
  .skeleton-play { width: 30px; height: 30px; }
}

/* ── Reduced motion ──────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .shimmer       { animation: none; }
  .fade-out      { transition: none; }
  .fade-in       { animation: none; opacity: 1; transform: none; }
  .poster        { transition: none; }
}

/* ── Card ────────────────────────────────────────────── */

.card {
  pointer-events: none;
  user-select: none;
  min-width: 0;
}

.poster-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.3s ease;
}

.badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #fff;
  background: var(--accent);
  padding: 3px 8px;
  border-radius: var(--radius-badge);
}

.badge.hot {
  background: var(--accent-hot);
}

/* ── Play button ─────────────────────────────────────── */

.play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  pointer-events: none;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.6));
}

.play-btn svg {
  width: 100%;
  height: 100%;
}

.card-info {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  /* 2-line clamp instead of single-line truncate */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.1em;
}

.card-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ── Skeleton ────────────────────────────────────────── */

.skeleton-card {
  pointer-events: none;
  min-width: 0;
}

.skeleton-poster {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-card);
  background: var(--bg-skeleton);
  overflow: hidden;
}

.skeleton-line {
  height: 13px;
  border-radius: 6px;
  background: var(--bg-skeleton);
  margin-top: 10px;
}

.skeleton-line.short {
  width: 55%;
  margin-top: 6px;
  height: 11px;
}


.skeleton-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
}

.skeleton-play svg {
  width: 100%;
  height: 100%;
}

/* Shimmer animation */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}

.shimmer {
  background: linear-gradient(
    90deg,
    var(--shimmer-1) 0%,
    var(--shimmer-2) 40%,
    var(--shimmer-1) 80%
  );
  background-size: 1200px 100%;
  animation: shimmer 1.6s ease-in-out infinite;
}

/* ── Visibility helpers ──────────────────────────────── */

/* .hidden used only when JS is present */
.js .hidden {
  display: none !important;
}

/* No-JS: hide skeleton, show content immediately */
.no-js .skeleton-catalog {
  display: none !important;
}

.fade-out {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.fade-in {
  animation: fadeIn 0.4s ease forwards;
}

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

/* ── Footer ──────────────────────────────────────────── */

.footer {
  border-top: 1px solid var(--border);
  padding: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
}
