/* Home "reels" feed (see reels.js) */
.home-view {
  position: fixed;
  top: 0; left: 0; right: 0;
  bottom: calc(var(--tabbar-h, 58px) + 1px + env(safe-area-inset-bottom));
  z-index: 3;
  display: none;
}
.reels {
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: #000;
  outline: none;
}
.reels::-webkit-scrollbar { display: none; }
@media (min-width: 520px) {
  .reels { border-left: 1px solid rgba(255, 255, 255, 0.08); border-right: 1px solid rgba(255, 255, 255, 0.08); box-shadow: 0 0 70px rgba(0, 0, 0, 0.7); }
}

.reel {
  position: relative;
  height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
  background: #05060a;
  cursor: pointer;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* background: random image + random B&W filter + random zoom (all picked
   by the server from the item id, see reels.py _public) */
.reel-bg {
  position: absolute;
  inset: -3%;
  background-size: cover;
  background-position: center;
  will-change: transform;
  animation-duration: 26s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  animation-direction: alternate;
  animation-play-state: paused;
}
.reel.active .reel-bg { animation-play-state: running; }

/* half the variants are black & white, half keep the photo's colors */
.filt-0 { filter: grayscale(1) contrast(1.15) brightness(0.9); }
.filt-1 { filter: grayscale(1) contrast(1.45) brightness(0.75); }
.filt-2 { filter: grayscale(1) sepia(0.28) contrast(1.2) brightness(0.85); }
.filt-3 { filter: none; }
.filt-4 { filter: contrast(1.1) brightness(0.92); }
.filt-5 { filter: saturate(1.25) contrast(1.05) brightness(0.9); }

.zoom-0 { animation-name: kb0; }
.zoom-1 { animation-name: kb1; }
.zoom-2 { animation-name: kb2; }
.zoom-3 { animation-name: kb3; }
.zoom-4 { animation-name: kb4; }
.zoom-5 { animation-name: kb5; }
@keyframes kb0 { from { transform: scale(1); } to { transform: scale(1.16); } }
@keyframes kb1 { from { transform: scale(1.3); } to { transform: scale(1.1); } }
@keyframes kb2 { from { transform: scale(1.28) translate(-2%, 1%); } to { transform: scale(1.28) translate(2%, -1%); } }
@keyframes kb3 { from { transform: scale(1.08); } to { transform: scale(1.4); } }
@keyframes kb4 { from { transform: scale(1.45); } to { transform: scale(1.5); } }
@keyframes kb5 { from { transform: scale(1.18) translate(2%, 0); } to { transform: scale(1.18) translate(-2%, 0); } }
@media (prefers-reduced-motion: reduce) { .reel-bg { animation: none !important; } }

.reel-shade {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0) 20%, rgba(0,0,0,0.12) 40%, rgba(0,0,0,0.82) 100%);
  pointer-events: none;
}
.reel-brand {
  position: absolute; top: 14px; left: 16px;
  font-size: 15px; font-weight: 800; color: #fff; letter-spacing: 0.02em;
  text-shadow: 0 1px 8px rgba(0,0,0,0.7);
  pointer-events: none;
}

.reel-body {
  position: absolute; left: 0; right: 78px; bottom: 0;
  padding: 0 16px 24px;
  color: #fff;
}
.reel-quote {
  margin: 0 0 14px;
  font-size: clamp(21px, 5.6vw, 29px);
  line-height: 1.28;
  font-weight: 700;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.75);
  overflow-wrap: anywhere;
}
.reel-slot { min-height: 20px; }
.reel-cta {
  display: inline-block;
  max-width: 100%;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.38);
  color: #fff;
  border-radius: 22px;
  padding: 9px 15px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  text-align: left;
  line-height: 1.3;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  cursor: pointer;
}
.reel-ep { font-size: 14px; font-weight: 600; color: rgba(255, 255, 255, 0.85); text-shadow: 0 1px 8px rgba(0,0,0,0.7); }

.reel-actions {
  position: absolute; right: 10px; bottom: 28px;
  display: flex; flex-direction: column; align-items: center; gap: 20px;
}
.reel-act {
  background: none; border: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: #fff; font-size: 12px; font-weight: 700; font-family: inherit;
  text-shadow: 0 1px 6px rgba(0,0,0,0.8);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.reel-act .bubble-ico {
  width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.38);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  font-size: 26px; line-height: 1;
}
.reel-act svg { width: 24px; height: 24px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.reel-star.liked .bubble-ico { color: #ffd43b; animation: star-pop 0.35s ease; }
@keyframes star-pop { 0% { transform: scale(0.7); } 55% { transform: scale(1.25); } 100% { transform: scale(1); } }

/* playback bar: thin by default, thicker with a thumb on hover/drag; the 22px
   strip is the actual hit area so it's easy to grab with a mouse */
.reel-progress {
  position: absolute; left: 0; right: 0; bottom: 0; height: 22px;
  display: flex; align-items: flex-end;
  z-index: 3; cursor: pointer; touch-action: none;
  -webkit-user-select: none; user-select: none;
}
.reel-progress .track {
  position: relative; width: 100%; height: 3px;
  background: rgba(255, 255, 255, 0.22);
  transition: height 0.12s ease;
}
.reel-progress i {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0;
  background: #fff;
}
.reel-progress i::after {
  content: ''; position: absolute; right: -6px; top: 50%;
  width: 12px; height: 12px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.6);
  transform: translateY(-50%) scale(0); transition: transform 0.12s ease;
}
.reel-progress:hover .track, .reel.seeking .reel-progress .track { height: 7px; }
.reel-progress:hover i::after, .reel.seeking .reel-progress i::after { transform: translateY(-50%) scale(1); }
.reel-time {
  position: absolute; right: 12px; bottom: 14px;
  font-size: 12px; font-weight: 600; color: #fff;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
  opacity: 0; transition: opacity 0.12s ease; pointer-events: none;
}
.reel-progress:hover .reel-time, .reel.seeking .reel-time { opacity: 1; }

.reel-flash {
  position: absolute; top: 46%; left: 50%;
  transform: translate(-50%, -50%) scale(0.6);
  font-size: 72px; line-height: 1; color: #fff;
  opacity: 0; pointer-events: none;
  text-shadow: 0 2px 20px rgba(0,0,0,0.6);
}
.reel-flash.show { animation: reel-flash 0.6s ease; }
@keyframes reel-flash { 0% { opacity: 0.9; transform: translate(-50%, -50%) scale(0.6); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.25); } }

.reels-hint {
  position: absolute; top: 56px; left: 50%; transform: translateX(-50%);
  z-index: 4; display: none;
  background: rgba(0, 0, 0, 0.6); color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-radius: 22px; padding: 9px 16px; font-size: 13.5px; font-weight: 600;
  pointer-events: none; white-space: nowrap;
  animation: hint-pulse 1.8s ease-in-out infinite;
}
@keyframes hint-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

.reels-toast {
  position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 4; display: none;
  background: rgba(20, 24, 32, 0.95); color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px; padding: 10px 16px; font-size: 13.5px;
}
.reels-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: #8b93a3; font-size: 14px; }
.reels-empty button { background: #4dabf7; color: #0b0d12; border: none; border-radius: 10px; padding: 9px 18px; font-weight: 700; cursor: pointer; }

.reel-slot .reel-ep + .reel-cta { margin-top: 10px; }

/* mouse-and-keyboard screens: up/down buttons beside the frame (touch screens just swipe) */
.reels-nav { display: none; }
@media (hover: hover) and (pointer: fine) and (min-width: 620px) {
  .reels-nav {
    position: absolute; top: 50%; left: calc(50% + 240px + 22px); transform: translateY(-50%);
    display: flex; flex-direction: column; gap: 14px;
  }
  .reels-nav button {
    width: 46px; height: 46px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; padding: 0;
    background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.22);
    cursor: pointer; transition: background 0.15s, opacity 0.15s;
  }
  .reels-nav button:hover:not(:disabled) { background: rgba(255, 255, 255, 0.22); }
  .reels-nav button:disabled { opacity: 0.3; cursor: default; }
  .reels-nav svg { width: 24px; height: 24px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
}
