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

@property --karaoke-primary {
  syntax: "<color>";
  inherits: false;
  initial-value: #ff2f7d;
}

@property --karaoke-secondary {
  syntax: "<color>";
  inherits: false;
  initial-value: #ffe600;
}

:root {
  --page-bg: #050506;
  --ink: #fff9ef;
  --muted: rgba(255, 249, 239, 0.68);
  --panel: rgba(5, 5, 6, 0.72);
  --stroke: rgba(255, 249, 239, 0.16);
  --shadow: rgba(0, 0, 0, 0.48);
}

html,
body {
  width: 100%;
  min-height: 100%;
  background: var(--page-bg);
  color: var(--ink);
  font-family: "Space Grotesk", sans-serif;
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100dvh;
  background:
    linear-gradient(120deg, rgba(255, 47, 125, 0.16), transparent 34%),
    linear-gradient(240deg, rgba(52, 245, 197, 0.12), transparent 38%),
    #050506;
}

.topbar {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: max(0.85rem, env(safe-area-inset-top)) clamp(0.9rem, 3vw, 2rem) 0.75rem;
  pointer-events: none;
}

.topbar-actions {
  display: flex;
  min-width: 0;
  max-width: min(64vw, 42rem);
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

.brand {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink);
  font-family: "Bungee", cursive;
  font-size: clamp(1rem, 3vw, 1.35rem);
  letter-spacing: 0;
  text-decoration: none;
  text-shadow: 0 0 22px rgba(255, 47, 125, 0.62);
  pointer-events: auto;
}

.brand-mark {
  display: grid;
  width: 2.35rem;
  height: 2.35rem;
  place-items: center;
  border: 2px solid rgba(255, 249, 239, 0.82);
  border-radius: 0.6rem;
  background: #ff2f7d;
  color: #050506;
  box-shadow: 0 0 0 3px rgba(5, 5, 6, 0.34), 0 0 24px rgba(255, 47, 125, 0.5);
}

.feed-status {
  min-width: 0;
  max-width: min(36vw, 24rem);
  padding: 0.48rem 0.7rem;
  border: 1px solid var(--stroke);
  border-radius: 999px;
  background: rgba(5, 5, 6, 0.52);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  backdrop-filter: blur(18px);
  pointer-events: auto;
}

.request-open,
.request-submit {
  border: 1px solid color-mix(in srgb, #34f5c5, transparent 42%);
  border-radius: 999px;
  background: rgba(52, 245, 197, 0.14);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: auto;
}

.request-open {
  flex: 0 0 auto;
  padding: 0.48rem 0.7rem;
}

.feed {
  height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
}

.feed::-webkit-scrollbar {
  display: none;
}

.video-card {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.video-card:focus-visible {
  outline: 3px solid #34f5c5;
  outline-offset: -3px;
}

.video-frame {
  --video-primary: #ff2f7d;
  --video-secondary: #ffe600;
  --video-accent: #34f5c5;
  --video-backdrop: #07070a;
  position: relative;
  width: min(100vw, 56.25dvh);
  height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  background: var(--video-backdrop);
  box-shadow: 0 0 120px color-mix(in srgb, var(--video-primary), transparent 52%);
}

.video-backdrop,
.video-scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.video-backdrop {
  z-index: -1;
  background:
    radial-gradient(
      ellipse 58% 42% at 18% 24%,
      color-mix(in srgb, var(--video-primary), transparent 26%),
      transparent 62%
    ),
    radial-gradient(
      ellipse 52% 45% at 82% 80%,
      color-mix(in srgb, var(--video-accent), transparent 32%),
      transparent 60%
    ),
    linear-gradient(180deg, var(--video-backdrop), #050506);
  filter: saturate(1.26);
  animation: backdropDrift 7s ease-in-out infinite alternate;
}

.video-frame[data-animation="strobe"] .video-backdrop {
  animation: backdropDrift 5s ease-in-out infinite alternate, strobeWash 0.78s ease-in-out infinite;
}

.video-frame[data-animation="slide"] .video-backdrop {
  animation: slideWash 5.4s ease-in-out infinite alternate;
}

.media-slot,
.video-media {
  width: 100%;
  height: 100%;
}

.media-slot {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--video-backdrop);
}

.video-media {
  display: block;
  border: none;
  object-fit: cover;
}

iframe.video-media {
  aspect-ratio: 9/16;
}

.media-fallback {
  position: absolute;
  inset: 38% 1rem auto;
  z-index: 4;
  display: grid;
  gap: 0.4rem;
  padding: 1rem;
  border: 1px solid var(--stroke);
  border-radius: 0.7rem;
  background: rgba(5, 5, 6, 0.82);
  text-align: center;
}

.media-fallback[hidden] {
  display: none;
}

.video-scrim {
  z-index: 1;
  background:
    linear-gradient(180deg, rgba(5, 5, 6, 0.34) 0%, transparent 20%, transparent 52%, rgba(5, 5, 6, 0.9) 100%),
    linear-gradient(90deg, rgba(5, 5, 6, 0.68), transparent 32%, transparent 68%, rgba(5, 5, 6, 0.58));
}

.video-copy {
  position: absolute;
  right: clamp(0.9rem, 4vw, 1.5rem);
  bottom: max(1.3rem, env(safe-area-inset-bottom));
  left: clamp(0.9rem, 4vw, 1.5rem);
  z-index: 3;
  display: grid;
  gap: 0.45rem;
  padding-right: 4.2rem;
}

.eyebrow {
  width: fit-content;
  max-width: 100%;
  padding: 0.32rem 0.55rem;
  border: 1px solid color-mix(in srgb, var(--video-accent), transparent 34%);
  border-radius: 999px;
  background: color-mix(in srgb, var(--video-accent), transparent 82%);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.video-title {
  display: -webkit-box;
  overflow: hidden;
  max-width: 100%;
  font-family: "Bungee", cursive;
  font-size: clamp(1.7rem, 8vw, 3rem);
  line-height: 0.98;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  text-overflow: ellipsis;
  text-wrap: balance;
  text-shadow:
    0 3px 0 rgba(5, 5, 6, 0.82),
    0 0 24px color-mix(in srgb, var(--video-primary), transparent 22%);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.video-meta {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.video-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-height: 1.6rem;
}

.video-tag {
  padding: 0.26rem 0.48rem;
  border-radius: 0.4rem;
  background: rgba(255, 249, 239, 0.12);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
}

.feed-actions {
  position: absolute;
  right: clamp(0.85rem, 3vw, 1.2rem);
  bottom: max(2.1rem, env(safe-area-inset-bottom));
  z-index: 5;
  display: grid;
  gap: 0.62rem;
}

.icon-button {
  display: grid;
  width: 3rem;
  height: 3rem;
  place-items: center;
  border: 1px solid rgba(255, 249, 239, 0.36);
  border-radius: 999px;
  background: rgba(5, 5, 6, 0.42);
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 700;
  box-shadow: 0 10px 24px var(--shadow);
  backdrop-filter: blur(14px);
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    transform 0.16s ease;
}

.reaction-button {
  grid-template-rows: 1.32rem 0.72rem;
  align-content: center;
  justify-items: center;
  gap: 0.08rem;
}

.reaction-button > [aria-hidden="true"] {
  display: grid;
  min-width: 1.5rem;
  height: 1.32rem;
  place-items: center;
  font-size: 1.28rem;
  line-height: 1;
}

.action-count {
  min-width: 2.25rem;
  color: rgba(255, 249, 239, 0.78);
  font-size: 0.62rem;
  line-height: 1;
  text-align: center;
}

.icon-button:hover,
.icon-button:focus-visible,
.icon-button.is-on {
  border-color: var(--video-accent);
  background: color-mix(in srgb, var(--video-accent), transparent 74%);
  transform: translateY(-0.12rem);
  outline: none;
}

.karaoke-stage {
  position: absolute;
  right: clamp(0.8rem, 3vw, 1.2rem);
  bottom: clamp(12rem, 31vh, 19rem);
  left: clamp(0.8rem, 3vw, 1.2rem);
  z-index: 2;
  display: grid;
  gap: 0.35rem;
  text-align: center;
  opacity: 0;
  transform: translateY(1.25rem);
  transition:
    opacity 0.22s ease,
    transform 0.22s ease;
  pointer-events: none;
}

.karaoke-stage.is-active {
  opacity: 1;
  transform: translateY(0);
}

.karaoke-now {
  position: relative;
  display: block;
  justify-self: center;
  max-width: 100%;
  font-family: "Bungee", cursive;
  font-size: clamp(1.35rem, 6.9vw, 2.72rem);
  line-height: 1.02;
  text-transform: uppercase;
}

.karaoke-now.is-entering {
  animation: lyricRise 0.34s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.karaoke-now.is-swapping {
  animation: lyricSwap 0.42s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.karaoke-base {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.05em 0.24em;
  overflow-wrap: anywhere;
}

.karaoke-fill {
  display: none;
}

.karaoke-word {
  --word-progress: 0%;
  display: inline-block;
  color: transparent;
  background: linear-gradient(
    90deg,
    var(--karaoke-primary) 0%,
    var(--karaoke-secondary) var(--word-progress),
    rgba(255, 249, 239, 0.92) var(--word-progress),
    rgba(255, 249, 239, 0.92) 100%
  );
  background-clip: text;
  -webkit-background-clip: text;
  filter:
    drop-shadow(0 3px 0 rgba(5, 5, 6, 0.88))
    drop-shadow(0 0 18px color-mix(in srgb, var(--karaoke-primary), transparent 42%));
  animation:
    colorCycle 1.4s ease-in-out infinite alternate,
    lyricPulse 1s infinite alternate;
  transition: transform 0.12s ease;
}

.video-frame[data-animation="pulse"] .karaoke-word {
  animation: lyricPulse 0.72s infinite alternate;
}

.video-frame[data-animation="strobe"] .karaoke-word {
  animation: lyricPulse 0.36s infinite alternate, colorCycle 0.92s ease-in-out infinite alternate;
}

.video-frame[data-animation="slide"] .karaoke-word.is-active {
  transform: translateX(0.08em) skewX(-4deg) scale(1.04);
}

.karaoke-word.is-active {
  transform: translateY(-0.04em) scale(1.05);
}

.karaoke-next {
  color: rgba(255, 249, 239, 0.72);
  font-size: 0.9rem;
  font-weight: 700;
  text-shadow:
    0 2px 12px rgba(5, 5, 6, 0.86),
    0 0 18px color-mix(in srgb, var(--video-accent), transparent 66%);
  transform: translateY(0);
  transition:
    opacity 0.22s ease,
    transform 0.22s ease;
}

.karaoke-now.is-swapping + .karaoke-next {
  opacity: 0.45;
  transform: translateY(0.4rem);
}

.empty-feed {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 2rem;
  color: var(--muted);
  text-align: center;
}

.request-dialog {
  width: min(92vw, 27rem);
  margin: auto;
  border: 1px solid var(--stroke);
  border-radius: 0.7rem;
  background: rgba(5, 5, 6, 0.94);
  color: var(--ink);
  box-shadow: 0 24px 80px var(--shadow);
}

.request-dialog::backdrop {
  background: rgba(5, 5, 6, 0.72);
  backdrop-filter: blur(10px);
}

.request-form {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
}

.request-heading,
.request-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.request-heading h2 {
  font-family: "Bungee", cursive;
  font-size: 1.25rem;
  line-height: 1;
}

.request-close {
  width: 2.35rem;
  height: 2.35rem;
}

.request-form label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.request-form input,
.request-form textarea {
  width: 100%;
  border: 1px solid var(--stroke);
  border-radius: 0.45rem;
  background: rgba(255, 249, 239, 0.08);
  color: var(--ink);
  font-size: 0.95rem;
}

.request-form input {
  min-height: 2.6rem;
  padding: 0 0.7rem;
}

.request-form textarea {
  min-height: 6rem;
  resize: vertical;
  padding: 0.65rem 0.7rem;
}

.request-form input:focus-visible,
.request-form textarea:focus-visible {
  border-color: #34f5c5;
  outline: none;
}

.request-status {
  min-height: 1rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.request-submit {
  min-height: 2.6rem;
  padding: 0 0.9rem;
}

.request-submit:disabled {
  cursor: wait;
  opacity: 0.58;
}

@keyframes backdropDrift {
  from {
    transform: scale(1) translate(-2%, -1%);
    filter: saturate(1.16) hue-rotate(0deg);
  }

  to {
    transform: scale(1.12) translate(2%, 1%);
    filter: saturate(1.55) hue-rotate(18deg);
  }
}

@keyframes slideWash {
  from {
    transform: translateX(-9%) scale(1.08);
  }

  to {
    transform: translateX(9%) scale(1.08);
  }
}

@keyframes strobeWash {
  0%,
  100% {
    opacity: 0.74;
  }

  18% {
    opacity: 1;
  }

  32% {
    opacity: 0.46;
  }
}

@keyframes lyricRise {
  from {
    opacity: 0;
    transform: translateY(1.35rem) scale(0.96);
    filter: blur(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes lyricSwap {
  from {
    opacity: 0;
    transform: translateY(0.8rem) scale(0.98);
    filter: blur(3px);
  }

  45% {
    opacity: 1;
    transform: translateY(-0.2rem) scale(1.015);
    filter: blur(0);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes lyricPulse {
  from {
    filter:
      drop-shadow(0 3px 0 rgba(5, 5, 6, 0.88))
      drop-shadow(0 0 18px color-mix(in srgb, var(--karaoke-secondary), transparent 42%));
  }

  to {
    filter:
      drop-shadow(0 3px 0 rgba(5, 5, 6, 0.88))
      drop-shadow(0 0 34px color-mix(in srgb, var(--karaoke-primary), transparent 18%));
  }
}

@keyframes colorCycle {
  from {
    --karaoke-primary: var(--video-primary);
    --karaoke-secondary: var(--video-secondary);
  }

  to {
    --karaoke-primary: var(--video-accent);
    --karaoke-secondary: var(--video-primary);
  }
}

@media (min-width: 760px) {
  .video-frame {
    border-right: 1px solid var(--stroke);
    border-left: 1px solid var(--stroke);
  }
}

@media (max-width: 480px) {
  .topbar {
    align-items: flex-start;
  }

  .topbar-actions {
    max-width: 56vw;
    gap: 0.45rem;
  }

  .brand {
    font-size: 0.92rem;
  }

  .brand-mark {
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
  }

  .feed-status {
    max-width: 28vw;
    font-size: 0.7rem;
  }

  .request-open {
    font-size: 0.7rem;
  }

  .video-copy {
    padding-right: 3.8rem;
  }

  .video-title {
    font-size: clamp(1.35rem, 9vw, 2.05rem);
    -webkit-line-clamp: 2;
  }

  .karaoke-stage {
    bottom: 14.25rem;
  }

  .karaoke-now {
    font-size: clamp(1.05rem, 8.5vw, 1.85rem);
  }
}

@media (max-width: 360px) {
  .feed-status {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
