:root {
  --bg: #050505;
  --ink: #f4f1ec;
  --muted: rgba(244, 241, 236, 0.62);
  --accent: #ff4d6d;
  --accent-soft: rgba(255, 77, 109, 0.35);
  --glass: rgba(8, 8, 10, 0.42);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --brand: "Bricolage Grotesque", system-ui, sans-serif;
  --body: "Outfit", system-ui, sans-serif;
}

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

html,
body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: pan-y;
}

body {
  position: fixed;
  inset: 0;
  width: 100%;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(255, 77, 109, 0.12), transparent 55%),
    radial-gradient(90% 60% at 80% 100%, rgba(30, 90, 180, 0.18), transparent 50%),
    var(--bg);
}

.boot-loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background:
    radial-gradient(90% 70% at 50% 30%, rgba(255, 77, 109, 0.14), transparent 55%),
    #050505;
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

.boot-loader.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.boot-loader-inner {
  width: min(280px, 78vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.boot-brand {
  font-family: var(--brand);
  font-weight: 800;
  font-size: 1.8rem;
  letter-spacing: -0.04em;
}

.boot-bar {
  width: 100%;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.boot-bar-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #ff8fa3);
  transition: width 0.25s ease;
}

.boot-status {
  font-family: var(--brand);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
}

.boot-hint {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.feed {
  height: 100%;
  width: 100%;
  overflow: hidden;
  position: relative;
  touch-action: none;
}

.track {
  position: relative;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

.slide {
  position: absolute;
  inset: 0;
  height: 100%;
  height: 100dvh;
  width: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #000;
  transform: translate3d(0, 100%, 0);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  visibility: hidden;
  pointer-events: none;
  z-index: 0;
}

.slide.is-active {
  transform: translate3d(0, 0, 0);
  visibility: visible;
  pointer-events: auto;
  z-index: 2;
}

.slide.is-prep-below {
  transform: translate3d(0, 100%, 0);
  transition: none;
  visibility: visible;
  z-index: 1;
}

.slide.is-prep-above {
  transform: translate3d(0, -100%, 0);
  transition: none;
  visibility: visible;
  z-index: 1;
}

.slide.is-exit-up {
  transform: translate3d(0, -100%, 0);
  visibility: visible;
  z-index: 1;
}

.slide.is-exit-down {
  transform: translate3d(0, 100%, 0);
  visibility: visible;
  z-index: 1;
}

.slide video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  background: #000;
}

.slide::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(
      180deg,
      rgba(0, 0, 0, 0.22) 0%,
      rgba(0, 0, 0, 0.06) 18%,
      rgba(0, 0, 0, 0.09) 45%,
      rgba(0, 0, 0, 0.28) 68%,
      rgba(0, 0, 0, 0.41) 100%
    );
  z-index: 1;
}

.slide-meta {
  position: absolute;
  left: 18px;
  right: 72px;
  bottom: calc(28px + var(--safe-bottom));
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  padding: 16px 14px 14px;
  margin: 0 -6px;
  border-radius: 14px;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.08) 0%,
    rgba(0, 0, 0, 0.28) 100%
  );
}

.slide-tag {
  display: inline-flex;
  align-self: flex-start;
  font-family: var(--brand);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.55);
}

.slide-title {
  font-family: var(--brand);
  font-weight: 800;
  font-size: clamp(1.05rem, 4.2vw, 1.55rem);
  line-height: 1.12;
  letter-spacing: -0.03em;
  max-width: 34ch;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.55);
}

.slide-copy {
  max-width: 36ch;
  font-size: 0.9rem;
  line-height: 1.35;
  color: var(--muted);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.65);
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(14px + var(--safe-top)) 16px 12px;
  pointer-events: none;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0;
  line-height: 1;
}

.brand-mark {
  font-family: var(--brand);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.04em;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.6);
}

.brand-sub {
  margin-top: 4px;
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.55);
}

.sound-btn {
  pointer-events: auto;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: var(--glass);
  color: var(--ink);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.sound-btn:active {
  transform: scale(0.94);
}

.sound-btn.is-on {
  background: rgba(255, 77, 109, 0.22);
  border-color: rgba(255, 77, 109, 0.45);
}

.time-control {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(118px + var(--safe-bottom));
  z-index: 36;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(8, 8, 10, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
  pointer-events: none;
}

.time-control.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.time-current,
.time-total {
  flex: 0 0 auto;
  min-width: 2.4em;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: rgba(244, 241, 236, 0.88);
}

.time-total {
  text-align: right;
  color: var(--muted);
}

.time-scrub {
  flex: 1 1 auto;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  outline: none;
  cursor: pointer;
}

.time-scrub::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.4);
  cursor: grab;
}

.time-scrub::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.4);
  cursor: grab;
}

.time-scrub::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
}

/* Swipe-up onboarding hint */
.swipe-hint {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  place-content: center;
  gap: 10px;
  background: radial-gradient(circle at 50% 62%, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.62) 70%);
  opacity: 1;
  transition: opacity 0.45s ease, visibility 0.45s ease;
  pointer-events: none;
}

.swipe-hint.is-gone {
  opacity: 0;
  visibility: hidden;
}

.swipe-hint-glow {
  position: absolute;
  width: min(70vw, 280px);
  height: min(70vw, 280px);
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft), transparent 68%);
  filter: blur(8px);
  animation: glowPulse 2.2s ease-in-out infinite;
}

.swipe-gesture {
  position: relative;
  width: 56px;
  height: 110px;
  z-index: 1;
}

.swipe-finger {
  position: absolute;
  left: 50%;
  top: 62%;
  width: 28px;
  height: 28px;
  margin-left: -14px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  box-shadow:
    0 0 0 8px rgba(255, 255, 255, 0.12),
    0 8px 24px rgba(0, 0, 0, 0.35);
  animation: fingerSwipe 1.55s cubic-bezier(0.45, 0.05, 0.25, 1) infinite;
}

.swipe-trail {
  position: absolute;
  left: 50%;
  top: 28%;
  width: 3px;
  height: 48px;
  margin-left: -1.5px;
  border-radius: 999px;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.75));
  opacity: 0;
  animation: trailFade 1.55s ease-in-out infinite;
}

.swipe-chevrons {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-top: 4px;
}

.swipe-chevrons span {
  width: 14px;
  height: 14px;
  border-left: 2.5px solid rgba(255, 255, 255, 0.9);
  border-bottom: 2.5px solid rgba(255, 255, 255, 0.9);
  transform: rotate(135deg);
  opacity: 0.2;
  animation: chevronRise 1.4s ease-in-out infinite;
}

.swipe-chevrons span:nth-child(1) { animation-delay: 0s; }
.swipe-chevrons span:nth-child(2) { animation-delay: 0.15s; }
.swipe-chevrons span:nth-child(3) { animation-delay: 0.3s; }

.swipe-label {
  position: relative;
  z-index: 1;
  margin-top: 8px;
  font-family: var(--brand);
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.55);
}

.swipe-sub {
  position: relative;
  z-index: 1;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

@keyframes fingerSwipe {
  0%   { transform: translateY(18px) scale(1); opacity: 0; }
  18%  { opacity: 1; }
  55%  { transform: translateY(-34px) scale(0.92); opacity: 1; }
  100% { transform: translateY(-48px) scale(0.86); opacity: 0; }
}

@keyframes trailFade {
  0%, 15% { opacity: 0; transform: scaleY(0.4); }
  40% { opacity: 0.85; transform: scaleY(1); }
  100% { opacity: 0; transform: scaleY(1.15); }
}

@keyframes chevronRise {
  0%, 100% { opacity: 0.15; transform: translateY(6px) rotate(135deg); }
  45% { opacity: 1; transform: translateY(-2px) rotate(135deg); }
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.45; transform: scale(0.92); }
  50% { opacity: 0.9; transform: scale(1.05); }
}

@media (min-width: 900px) {
  .feed {
    display: flex;
    justify-content: center;
    background: #000;
  }

  .track {
    width: min(420px, 100%);
    max-width: 420px;
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
  }

  .slide {
    width: 100%;
  }

  .topbar {
    max-width: 420px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: 100%;
  }

  .time-control {
    left: 50%;
    right: auto;
    width: min(388px, calc(100% - 32px));
    transform: translateX(-50%) translateY(8px);
  }

  .time-control.is-visible {
    transform: translateX(-50%) translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .swipe-finger,
  .swipe-trail,
  .swipe-chevrons span,
  .swipe-hint-glow {
    animation: none;
  }

  .slide {
    transition: none;
  }
}
