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

:root {
  --bg: #0a0a0a;
  --bg-remote: #111;
  --card-bg: #1a1a2e;
  --card-hover: #252545;
  --accent: #e94560;
  --accent-glow: rgba(233, 69, 96, 0.35);
  --text: #eee;
  --text-dim: #888;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

#player {
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background: #000;
  position: relative;
}

#splash {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  opacity: 1;
  transition: opacity 0.5s ease;
}

#splash.hidden {
  opacity: 0;
  pointer-events: none;
}

#splash .logo {
  font-size: clamp(3rem, 10vw, 8rem);
  font-weight: 900;
  letter-spacing: 0.3em;
  color: var(--accent);
  text-shadow:
    0 0 40px var(--accent-glow),
    0 0 80px var(--accent-glow),
    0 0 120px rgba(233, 69, 96, 0.15);
  animation: pulse 2.5s ease-in-out infinite;
  user-select: none;
}

#splash .subtitle {
  font-size: clamp(0.9rem, 2vw, 1.4rem);
  color: var(--text-dim);
  margin-top: 1rem;
  letter-spacing: 0.15em;
  animation: fadeInUp 1s ease 0.5s both;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(1.03); }
}

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

.video-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.85);
  width: 85vw;
  max-width: 1100px;
  aspect-ratio: 16 / 9;
  background: #0d0d0d;
  border-radius: 14px;
  overflow: hidden;
  border: 3px solid #222;
  box-shadow:
    0 0 40px rgba(0, 0, 0, 0.5),
    0 0 80px rgba(0, 0, 0, 0.3);
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease, transform 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease;
}

.video-frame.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.video-frame.playing {
  border-color: var(--accent);
  box-shadow:
    0 0 30px var(--accent-glow),
    0 0 80px rgba(233, 69, 96, 0.1),
    0 20px 60px rgba(0, 0, 0, 0.4);
}

.video-frame video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
  cursor: pointer;
}

#unmute-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 100;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: rgba(26, 26, 46, 0.9);
  color: var(--accent);
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 0 20px var(--accent-glow);
  animation: unmote-pulse 2s ease-in-out infinite;
}

#unmute-btn:hover {
  background: var(--accent);
  color: #fff;
  transform: scale(1.1);
}

#unmute-btn.hidden {
  display: none;
}

#fullscreen-btn {
  position: fixed;
  bottom: 20px;
  right: 86px;
  z-index: 100;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid #555;
  background: rgba(26, 26, 46, 0.9);
  color: #ccc;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

#fullscreen-btn:hover {
  background: #333;
  color: #fff;
  border-color: #888;
  transform: scale(1.1);
}

#start-btn {
  margin-top: 1.5rem;
  padding: 0.8rem 2rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: all 0.2s ease;
  box-shadow: 0 0 20px var(--accent-glow);
}

#start-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 30px var(--accent-glow);
}

#start-btn.hidden {
  display: none;
}

@keyframes unmote-pulse {
  0%, 100% { box-shadow: 0 0 15px var(--accent-glow); }
  50% { box-shadow: 0 0 30px var(--accent-glow), 0 0 50px rgba(233, 69, 96, 0.15); }
}

/* ========== REMOTE ========== */

#remote {
  background: var(--bg-remote);
  min-height: 100vh;
  overflow-y: auto;
  padding: 1rem 1rem calc(14rem + env(safe-area-inset-bottom, 0px));
}

.remote-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(17, 17, 17, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 1rem;
  border-bottom: 1px solid #222;
  margin: -1rem -1rem 1rem;
}

.remote-header h1 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

#now-playing {
  font-size: 1rem;
  color: var(--text);
  min-height: 1.4rem;
}

.now-playing-empty {
  color: var(--text-dim);
  font-size: 0.9rem;
}

.section-header {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 1.5rem 0 0.6rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
  letter-spacing: 0.08em;
}

.section-header:first-of-type {
  margin-top: 0.5rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.card {
  background: var(--card-bg);
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 0.6rem 0.5rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.2s ease;
  text-align: center;
  outline: none;
  font-family: var(--font);
}

.card:hover {
  background: var(--card-hover);
  border-color: rgba(233, 69, 96, 0.4);
  transform: translateY(-2px);
}

.card:active {
  transform: translateY(0);
}

.card.active {
  border-color: var(--accent);
  background: rgba(233, 69, 96, 0.15);
  box-shadow: 0 0 15px var(--accent-glow);
}

.card.active .card-num::after {
  content: ' \25B6';
  font-size: 0.6em;
}

.card.stopped .card-num::after {
  content: '';
}

.card-num {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

.card-title {
  font-size: 0.72rem;
  color: var(--text);
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* ========== RESPONSIVE ========== */

@media (max-width: 900px) {
  .card-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .video-frame {
    width: 92vw;
    border-radius: 10px;
  }
}

@media (max-width: 640px) {
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
  }
  .card {
    padding: 0.4rem 0.3rem;
  }
  .card-num {
    font-size: 0.95rem;
  }
  .card-title {
    font-size: 0.65rem;
  }
  .video-frame {
    width: 96vw;
    border-radius: 8px;
  }
  #splash .subtitle {
    font-size: 0.85rem;
  }
}