:root {
  --bg: #0b0b0d;
  --bg-2: #131317;
  --card: #1a1a20;
  --text: #f5f5f7;
  --muted: #9a9aa4;
  --accent: #ff5a2c;
  --accent-2: #ffb03a;
  --radius: 14px;
  --gap: 12px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body.no-scroll { overflow: hidden; }

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  padding: calc(10px + var(--safe-t)) 16px 10px;
  background: linear-gradient(180deg, rgba(11,11,13,0.96) 60%, rgba(11,11,13,0));
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
}

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

.brand-flame { filter: drop-shadow(0 2px 6px rgba(255,90,44,0.45)); }

.brand-word {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- home / rows ---------- */

.home { padding-bottom: calc(28px + var(--safe-b)); }

.rows { display: flex; flex-direction: column; gap: 22px; padding-top: 6px; }

.row-title {
  margin: 0 0 10px 16px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.row-track {
  display: flex;
  gap: var(--gap);
  overflow-x: auto;
  padding: 2px 16px 6px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.row-track::-webkit-scrollbar { display: none; }

/* ---------- poster card ---------- */

.card {
  position: relative;
  flex: 0 0 auto;
  width: 128px;
  padding: 0;
  border: none;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  scroll-snap-align: start;
  color: inherit;
  text-align: left;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.card:active { transform: scale(0.96); }
@media (hover: hover) {
  .card:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(0,0,0,0.5); }
}

.card-img {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  background: linear-gradient(135deg, #24242c, #16161b);
}

.card.noimg .card-img { visibility: hidden; }
.card.noimg::before {
  content: "🎬";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  opacity: 0.5;
}

.card-label {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 22px 10px 8px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.25;
  color: #fff;
  background: linear-gradient(0deg, rgba(0,0,0,0.86) 10%, rgba(0,0,0,0));
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- skeleton ---------- */

.skeleton {
  width: 128px;
  aspect-ratio: 2 / 3;
  background: linear-gradient(100deg, #17171c 30%, #22222a 50%, #17171c 70%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite linear;
  box-shadow: none;
  pointer-events: none;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- global states ---------- */

.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  min-height: 62vh;
  padding: 24px;
  color: var(--muted);
}
.state-icon { font-size: 46px; }
.state p { margin: 0; font-size: 15px; }

.retry-btn {
  margin-top: 4px;
  padding: 11px 22px;
  border: none;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  cursor: pointer;
}
.retry-btn:active { transform: scale(0.97); }

/* ---------- spinner ---------- */

.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
.spinner.big { width: 46px; height: 46px; border-width: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- player ---------- */

.player {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: #000;
  display: flex;
  flex-direction: column;
}

.player-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + var(--safe-t)) 14px 22px;
  background: linear-gradient(180deg, rgba(0,0,0,0.75), rgba(0,0,0,0));
  pointer-events: none;
}
.player-close {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px 8px 6px;
  border: none;
  border-radius: 999px;
  background: rgba(20,20,24,0.7);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.player-close:active { transform: scale(0.96); }
.player-title {
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

.player-stage {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video {
  width: 100%;
  height: 100%;
  max-height: 100%;
  background: #000;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.video.ready { opacity: 1; }

.player-msg {
  position: absolute;
  left: 24px; right: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.4;
}

/* ---------- desktop niceties ---------- */

@media (min-width: 760px) {
  .card, .skeleton { width: 150px; }
  .brand-word { font-size: 24px; }
  .row-title { font-size: 18px; }
}
