@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/space-grotesk-700-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg-deep: #05060f;
  --bg-mid: #0b0e20;
  --accent: #8b7bff;
  --accent-soft: #5eead4;
  --text: #e8e9f5;
  --text-dim: #8d91b0;
  --card-bg: rgba(255, 255, 255, 0.03);
  --card-border: rgba(255, 255, 255, 0.07);
  --live-red: #ff5470;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: radial-gradient(ellipse at top, var(--bg-mid) 0%, var(--bg-deep) 55%, #020207 100%);
  color: var(--text);
  font-family: "Inter", system-ui, sans-serif;
  position: relative;
  overflow-x: hidden;
}

/* ---------- Starfield ---------- */
.starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1.5px 1.5px at 20% 30%, rgba(255,255,255,0.9), transparent),
    radial-gradient(1.5px 1.5px at 65% 15%, rgba(255,255,255,0.7), transparent),
    radial-gradient(1px 1px at 40% 70%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1.5px 1.5px at 80% 55%, rgba(255,255,255,0.8), transparent),
    radial-gradient(1px 1px at 90% 20%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1.5px 1.5px at 10% 85%, rgba(255,255,255,0.7), transparent),
    radial-gradient(1px 1px at 55% 45%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1.5px 1.5px at 30% 55%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 75% 80%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1.5px 1.5px at 95% 90%, rgba(255,255,255,0.7), transparent);
  background-repeat: repeat;
  background-size: 100% 100%;
  animation: twinkle 6s ease-in-out infinite alternate;
}

@keyframes twinkle {
  from { opacity: 0.6; }
  to { opacity: 1; }
}

/* ---------- Planets (subtle, decorative) ---------- */
.planet {
  position: fixed;
  z-index: 0;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(0.5px);
  opacity: 0.5;
}

.planet--one {
  top: 8%;
  right: -60px;
  width: 160px;
  height: 160px;
  background: radial-gradient(circle at 35% 30%, #9b8bff 0%, #4a3f9e 60%, #241f52 100%);
  box-shadow: 0 0 60px rgba(139, 123, 255, 0.25);
}

.planet--two {
  bottom: 5%;
  left: -40px;
  width: 90px;
  height: 90px;
  background: radial-gradient(circle at 40% 35%, #7fe9d8 0%, #2c8f82 60%, #164a44 100%);
  box-shadow: 0 0 40px rgba(94, 234, 212, 0.2);
  opacity: 0.35;
}

/* ---------- Layout ---------- */
main, .site-header, .site-footer {
  position: relative;
  z-index: 1;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 2rem;
  max-width: 1100px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-mark {
  color: var(--accent-soft);
}

.header-links {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.twitch-link {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.9rem;
  border: 1px solid var(--card-border);
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  transition: border-color 0.2s, color 0.2s;
}

.twitch-link:hover {
  border-color: var(--accent-soft);
  color: var(--text);
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem 4rem;
}

/* ---------- Live banner ---------- */
.live-banner {
  margin: 1rem 0;
  border-radius: 14px;
  background: linear-gradient(90deg, rgba(255, 84, 112, 0.15), rgba(139, 123, 255, 0.1));
  border: 1px solid rgba(255, 84, 112, 0.4);
  transition: opacity 0.3s ease;
}

.live-banner__inner {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.9rem 1.4rem;
}

.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--live-red);
  box-shadow: 0 0 0 0 rgba(255, 84, 112, 0.6);
  animation: pulse 1.6s infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 84, 112, 0.6); }
  70% { box-shadow: 0 0 0 10px rgba(255, 84, 112, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 84, 112, 0); }
}

.live-banner__text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.live-banner__text strong {
  color: var(--live-red);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
}

.live-banner__text span {
  color: var(--text-dim);
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-viewers {
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--text-dim);
  flex-shrink: 0;
}

/* ---------- Live player ---------- */
.watch-section {
  margin: 1.5rem 0;
}

/* Default layout matches the (far more common) offline state: chat only,
   right-aligned. JS adds .is-live for the two-column player+chat layout,
   so there's no post-load layout flip for the common case. */
.watch-layout {
  display: grid;
  grid-template-columns: 1fr;
  max-width: 420px;
  margin: 0 0 0 auto;
  gap: 1rem;
  align-items: stretch;
}

.watch-layout .chat-frame {
  height: 480px;
  min-height: 0;
}

.watch-layout.is-live {
  grid-template-columns: minmax(0, 1fr) 320px;
  max-width: none;
  margin: 0;
}

.watch-layout.is-live .chat-frame {
  height: auto;
  min-height: 300px;
}

.player-slot {
  position: relative;
  width: 100%;
  height: 0;
  padding-top: 56.25%;
}

.player-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--card-border);
  box-shadow: 0 0 50px rgba(139, 123, 255, 0.12);
}

.player-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.popout-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(5, 6, 15, 0.65);
  color: var(--text);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background 0.15s, border-color 0.15s;
}

.popout-btn:hover {
  background: rgba(139, 123, 255, 0.35);
  border-color: var(--accent-soft);
}

.player-frame.is-popped-out {
  position: fixed;
  inset: auto;
  top: auto;
  bottom: 1.25rem;
  right: 1.25rem;
  left: auto;
  width: min(360px, 90vw);
  height: auto;
  padding-top: min(202px, 50.6vw);
  z-index: 500;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.65);
}

.player-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  border-radius: 16px;
  border: 1px dashed var(--card-border);
  background: var(--card-bg);
  color: var(--text-dim);
  font-size: 0.9rem;
  text-align: center;
}

.popout-restore-btn {
  border: 1px solid var(--card-border);
  background: transparent;
  color: var(--text);
  padding: 0.4rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: border-color 0.15s, color 0.15s;
}

.popout-restore-btn:hover {
  border-color: var(--accent-soft);
  color: var(--accent-soft);
}

.chat-frame {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--card-border);
  min-height: 300px;
}

.chat-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

@media (max-width: 800px) {
  .watch-layout.is-live {
    grid-template-columns: 1fr;
  }
  .watch-layout.is-live .chat-frame {
    height: 420px;
    min-height: 0;
  }
}

/* ---------- Hero ---------- */
.hero {
  padding: 3rem 0 2rem;
  text-align: center;
}

.hero h1 {
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin: 0 0 0.75rem;
  background: linear-gradient(90deg, var(--text) 20%, var(--accent-soft) 60%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p {
  color: var(--text-dim);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ---------- VODs ---------- */
.vods-section h2 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.3rem;
  margin-bottom: 1rem;
}

.vods-status {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.vods-status.is-hidden,
.is-hidden {
  display: none !important;
}

.vods-carousel {
  position: relative;
}

.vods-grid {
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 0.25rem;
}

.vods-grid::-webkit-scrollbar {
  display: none;
}

.vod-card {
  flex: 0 0 calc((100% - 3rem) / 3);
  min-width: 0;
  scroll-snap-align: start;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.vods-nav {
  position: absolute;
  top: 40%;
  transform: translateY(-50%);
  z-index: 5;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--card-border);
  background: rgba(5, 6, 15, 0.75);
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}

.vods-nav:hover {
  background: rgba(139, 123, 255, 0.35);
  border-color: var(--accent-soft);
}

.vods-nav:disabled {
  opacity: 0.25;
  cursor: default;
}

.vods-nav--prev {
  left: -14px;
}

.vods-nav--next {
  right: -14px;
}

@media (max-width: 800px) {
  .vod-card {
    flex-basis: 78%;
  }
}

@media (max-width: 480px) {
  .vod-card {
    flex-basis: 88%;
  }
  .vods-nav {
    display: none;
  }
}

.vod-card:hover {
  transform: translateY(-3px);
  border-color: rgba(139, 123, 255, 0.4);
}

/* Placeholder cards rendered in the HTML so the carousel occupies its
   final height before the VOD data arrives (avoids layout shift). */
.vod-card--skeleton {
  pointer-events: none;
}

.vod-card--skeleton:hover {
  transform: none;
  border-color: var(--card-border);
}

.vod-card--skeleton .vod-card__player {
  background: linear-gradient(100deg, #0c0f1e 30%, #141830 50%, #0c0f1e 70%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
  from { background-position: 150% 0; }
  to { background-position: -50% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .vod-card--skeleton .vod-card__player {
    animation: none;
  }
}

.vod-card__player {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  background: #000;
}

.vod-card__player iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.vod-card__player img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
}

.vod-card__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: rgba(5, 6, 15, 0.6);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
  backdrop-filter: blur(3px);
  transition: background 0.15s, transform 0.15s;
}

.vod-card__player:hover .vod-card__play {
  background: rgba(139, 123, 255, 0.55);
  transform: translate(-50%, -50%) scale(1.08);
}

.vod-card__body {
  padding: 0.9rem 1rem 1.1rem;
}

.vod-card__title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
  /* Always reserve exactly two lines so cards keep a constant height
     whether the title wraps, is one line, or is empty. Prevents layout
     shift when real VOD data replaces the skeleton placeholders. */
  height: 2.7em;
  margin: 0 0 0.4rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.vod-card__meta {
  color: var(--text-dim);
  font-size: 0.8rem;
  display: flex;
  gap: 0.6rem;
}

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-dim);
  font-size: 0.75rem;
  opacity: 0.7;
}

@media (max-width: 640px) {
  .site-header {
    padding: 1.25rem 1.25rem;
  }
  main {
    padding: 0 1.25rem 3rem;
  }
  .planet--one {
    width: 100px;
    height: 100px;
  }
  .planet--two {
    width: 60px;
    height: 60px;
  }
}
