:root {
  color-scheme: dark;
  --bg: #111111;
  --panel: #1a1a1a;
  --panel-soft: #242424;
  --text: #f6f2ea;
  --muted: #b7b0a5;
  --accent: #ff4d5f;
  --accent-2: #24d2b5;
  --line: rgba(255, 255, 255, 0.12);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  min-height: 100%;
  background:
    linear-gradient(135deg, rgba(36, 210, 181, 0.14), transparent 34%),
    linear-gradient(315deg, rgba(255, 77, 95, 0.15), transparent 30%),
    var(--bg);
  color: var(--text);
  overflow: hidden;
}

button,
video {
  font: inherit;
}

.shell {
  width: min(100vw, 560px);
  height: 100svh;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
}

.topbar {
  position: relative;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand-group {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.menu-toggle {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(26, 26, 26, 0.74);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.menu-toggle span {
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.menu-toggle:hover,
.menu-toggle:focus-visible {
  border-color: var(--accent-2);
  outline: none;
}

.main-menu {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 8;
  width: min(220px, calc(100vw - 32px));
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 17, 17, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.main-menu button {
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: block;
  text-align: left;
}

.main-menu button:hover,
.main-menu button:focus-visible {
  background: rgba(36, 210, 181, 0.14);
  outline: none;
}

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

.topbar h1 {
  margin: 0;
  font-size: clamp(1.4rem, 5vw, 2rem);
  line-height: 1;
  letter-spacing: 0;
}

.counter {
  min-width: 56px;
  min-height: 30px;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(26, 26, 26, 0.74);
  color: var(--muted);
  font-size: 0.84rem;
}

.hls-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #2f8cff;
  box-shadow: 0 0 0 4px rgba(47, 140, 255, 0.18);
}

.player-frame {
  position: relative;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.feed {
  height: 100%;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

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

.video-card {
  position: relative;
  height: 100%;
  min-height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  background: #050505;
  isolation: isolate;
}

.video-card.is-placeholder {
  background:
    linear-gradient(135deg, rgba(36, 210, 181, 0.12), transparent 38%),
    #050505;
}

.video-card video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  background: #000000;
}

.video-poster-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000000;
  opacity: 1;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.video-card.is-video-ready .video-poster-overlay {
  opacity: 0;
}

.video-loader {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  width: 42px;
  height: 42px;
  border: 3px solid rgba(255, 255, 255, 0.22);
  border-top-color: var(--accent-2);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: opacity 160ms ease;
  animation: spin 900ms linear infinite;
}

.video-card.is-loading .video-loader {
  opacity: 1;
}

.video-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  height: 3px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.18);
  pointer-events: none;
}

.video-progress-bar {
  width: 100%;
  height: 100%;
  display: block;
  background: var(--accent-2);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 120ms linear;
}

.video-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 46%;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.78));
  z-index: 2;
}

.play-state {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  min-width: 84px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.62);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  text-align: center;
  transform: translate(-50%, -50%) scale(0.94);
  transition: opacity 180ms ease, transform 180ms ease;
}

.play-state.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.sound-toggle {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 5;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid rgba(36, 210, 181, 0.95);
  border-radius: 999px;
  background: rgba(5, 5, 5, 0.78);
  color: #ffffff;
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 700;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.42), 0 0 0 3px rgba(36, 210, 181, 0.16);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.75);
}

.sound-toggle:hover,
.sound-toggle:focus-visible {
  background: rgba(5, 5, 5, 0.9);
  border-color: var(--accent-2);
  outline: none;
}

.desktop-nav {
  position: absolute;
  right: 14px;
  top: 50%;
  z-index: 5;
  display: none;
  flex-direction: column;
  gap: 10px;
  transform: translateY(-50%);
}

.nav-button {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(5, 5, 5, 0.72);
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.38);
}

.nav-button span {
  width: 12px;
  height: 12px;
  border-left: 2px solid currentColor;
  border-top: 2px solid currentColor;
}

.nav-button-up span {
  transform: translateY(3px) rotate(45deg);
}

.nav-button-down span {
  transform: translateY(-3px) rotate(225deg);
}

.nav-button:hover,
.nav-button:focus-visible {
  border-color: var(--accent-2);
  outline: none;
}

.whatsapp-share {
  position: absolute;
  right: 18px;
  bottom: 24px;
  z-index: 3;
  min-height: 40px;
  padding: 9px 13px;
  display: none;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(36, 210, 181, 0.78);
  border-radius: 999px;
  background: rgba(36, 210, 181, 0.16);
  color: var(--accent-2);
  font-size: 0.84rem;
  font-weight: 800;
  text-decoration: none;
  backdrop-filter: blur(12px);
}

.whatsapp-share:hover,
.whatsapp-share:focus-visible {
  background: rgba(36, 210, 181, 0.24);
  border-color: var(--accent-2);
  outline: none;
}

.meta {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 28px;
  z-index: 3;
  display: grid;
  gap: 8px;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.7);
}

.meta.has-expandable-description {
  cursor: pointer;
}

.creator {
  width: fit-content;
  max-width: 100%;
  color: var(--accent-2);
  font-size: 0.95rem;
  font-weight: 750;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.creator:hover,
.creator:focus-visible {
  color: #63e4d0;
  text-decoration: none;
  outline: none;
}

.title {
  margin: 0;
  max-width: 100%;
  font-size: clamp(1.35rem, 7vw, 2.15rem);
  line-height: 1.03;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.description {
  max-width: min(42ch, 100%);
  margin: 0;
  color: rgba(246, 242, 234, 0.9);
  font-size: 0.98rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
  overflow: hidden;
}

.meta.has-expandable-description:not(.is-expanded) .description {
  display: flex;
  align-items: baseline;
  gap: 0.28em;
  white-space: nowrap;
}

.caption-preview {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.description:focus-visible {
  outline: 2px solid rgba(36, 210, 181, 0.85);
  outline-offset: 4px;
  border-radius: 4px;
}

.caption-more {
  color: #ffffff;
  flex: 0 0 auto;
  font-weight: 800;
}

.meta.is-expanded .description {
  max-width: min(48ch, 100%);
  display: block;
  white-space: normal;
}

.swipe-hint {
  position: absolute;
  top: 14px;
  left: 50%;
  z-index: 4;
  transform: translateX(-50%);
  min-width: 180px;
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.58);
  color: rgba(246, 242, 234, 0.88);
  font-size: 0.86rem;
  backdrop-filter: blur(12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.swipe-hint.is-hidden {
  opacity: 0;
  transform: translate(-50%, -10px);
}

.chevron {
  width: 10px;
  height: 10px;
  border-left: 2px solid currentColor;
  border-top: 2px solid currentColor;
  transform: rotate(45deg);
  animation: lift 1.2s ease-in-out infinite;
}

.empty-state {
  position: absolute;
  inset: 0;
  padding: 28px;
  display: grid;
  place-content: center;
  gap: 10px;
  text-align: center;
  color: var(--muted);
  background: var(--panel-soft);
}

.empty-state strong {
  color: var(--text);
  font-size: 1.2rem;
}

.empty-state code {
  color: var(--text);
}

.content-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  padding: 18px;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(10px);
}

.overlay-panel {
  width: min(520px, 100%);
  max-height: min(680px, calc(100svh - 36px));
  padding: 22px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #151515;
  box-shadow: var(--shadow);
}

.overlay-close {
  float: right;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
}

.overlay-close:hover,
.overlay-close:focus-visible {
  border-color: var(--accent-2);
  outline: none;
}

.overlay-panel h2 {
  margin: 0 0 16px;
  padding-right: 92px;
  font-size: 1.45rem;
  letter-spacing: 0;
}

.overlay-body {
  clear: both;
  display: grid;
  gap: 12px;
  color: rgba(246, 242, 234, 0.88);
  line-height: 1.5;
}

.overlay-body p {
  margin: 0;
}

@keyframes lift {
  0%,
  100% {
    translate: 0 3px;
  }

  50% {
    translate: 0 -3px;
  }
}

@keyframes spin {
  to {
    rotate: 360deg;
  }
}

@media (min-width: 720px) {
  .shell {
    padding-block: 22px;
  }

  .player-frame {
    max-height: calc(100svh - 92px);
  }

  .desktop-nav {
    display: flex;
  }
}

@media (hover: hover) and (pointer: fine) {
  .desktop-nav {
    display: flex;
  }
}

@media (max-width: 719px) {
  .whatsapp-share {
    display: inline-flex;
  }

  .meta {
    right: 118px;
  }
}

@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;
  }
}
