/* Reset */
* { margin:0; padding:0; box-sizing:border-box; }

:root {
  /* dynamic viewport unit set by JS: --vh */
  --vh: 1vh;
  --overlay-pad: 14px;
  --text-shadow: 0 2px 8px rgba(0,0,0,.6);
  --seek-height: 4px;
  --seek-fill: #ffffffcc;
  --seek-buffer: #ffffff44;
  --seek-handle: #3ea8ff; /* blue handle */
}

html, body {
  height: 100%;
  width: 100%;
  background: #000;
  overflow: hidden;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: #fff;
}

/* Feed container uses translate3d pager (no native scroll) */
#feed {
  position: relative;
  height: calc(var(--vh) * 100);
  width: 100%;
  will-change: transform;
  transform: translate3d(0,0,0);
}

/* Slide */
.slide {
  position: relative;
  height: calc(var(--vh) * 100);
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #000;
  overflow: hidden;
}

/* Video wrapper */
.video-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  touch-action: none; /* we manage gestures */
}

video {
  width: 100%;
  height: 100%;
  max-height: calc(var(--vh) * 100);
  object-fit: cover;
  background: #000;
  aspect-ratio: 9/16;
}

/* Share button (right center, PNG icon inside) */
.share-btn {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #111a; /* subtle */
  backdrop-filter: blur(6px);
  border: 1px solid #ffffff22;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 10;
}
.share-btn img {
  width: 26px;
  height: 26px;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.6));
}

/* First-video overlay (tap to start) */
.flag-overlay {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  width: 100px; height: 100px;
  border-radius: 50%;
  background: #4189dd;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 20;
  animation: pulse 1.5s infinite;
}
.flag-overlay::after {
  content: "";
  display: block;
  margin-left: 8px;
  width: 0; height: 0;
  border-left: 30px solid white;
  border-top: 18px solid transparent;
  border-bottom: 18px solid transparent;
}
.flag-overlay.hidden { opacity: 0; pointer-events: none; animation: none; transition: opacity .35s ease; }
@keyframes pulse {
  0% { transform: translate(-50%,-50%) scale(1); }
  50%{ transform: translate(-50%,-50%) scale(1.08); }
  100%{transform: translate(-50%,-50%) scale(1); }
}

/* Meta overlay (title/desc/tags stacked above seekbar) */
.meta-overlay {
  position: absolute;
  left: 0; right: 0;
  bottom: 0;
  padding: calc(var(--overlay-pad) + 6px) calc(var(--overlay-pad) + 12px);
  padding-bottom: calc(var(--overlay-pad) + 8px + 12px); /* room for seek bar */
  background: linear-gradient(to top, rgba(0,0,0,.55), rgba(0,0,0,0));
  z-index: 9;
}

.meta-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.meta-title {
  font-weight: 700;
  font-size: 16px;
  line-height: 1.25;
  text-shadow: var(--text-shadow);
  white-space: pre-wrap;
  word-break: break-word;
}

.meta-desc {
  font-size: 14px;
  line-height: 1.25;
  color: #f0f0f0;
  opacity: .95;
  text-shadow: var(--text-shadow);
  display: -webkit-box;
  -webkit-line-clamp: 2; /* show 2 lines */
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.meta-desc.expanded {
  -webkit-line-clamp: unset;
  display: block;
}

.meta-more {
  font-size: 13px;
  color: #9ad0ff;
  text-decoration: none;
  opacity: .95;
}

.meta-tags {
  display: none;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.meta-tags.show { display: flex; }
.meta-tags span { opacity: .95; font-size: 13px; color: #9ad0ff; }

/* Player controls container (seek only) on very bottom */
.player-controls {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 10px 12px 12px;
  opacity: .25;
  transition: opacity .15s ease;
}
.player-controls:hover,
.player-controls.interacting { opacity: 1; }

/* Seek bar: full width */
.seek {
  position: relative;
  height: var(--seek-height);
  width: 100%;
  background: #ffffff14;
  border-radius: 999px;
  overflow: visible;
}
.seek__buffer,
.seek__fill {
  position: absolute; left: 0; top: 0; height: 100%;
  border-radius: 999px;
}
.seek__buffer { background: var(--seek-buffer); width: 0%; }
.seek__fill   { background: var(--seek-fill);   width: 0%; }

.seek__handle {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--seek-handle);
  box-shadow: 0 0 0 3px rgba(62,168,255,.25);
  pointer-events: none;
}

/* Double-tap hint bubbles */
.dtap-hint {
  position: absolute;
  bottom: 90px;
  font-size: 13px;
  padding: 6px 8px;
  background: #000c;
  border: 1px solid #ffffff2a;
  border-radius: 999px;
  opacity: 0; transform: translateY(8px);
  transition: opacity .15s ease, transform .15s ease;
  pointer-events: none;
  z-index: 8;
}
.dtap-hint.left  { left: 16px; }
.dtap-hint.right { right: 16px; }
.dtap-hint.show { opacity: 1; transform: translateY(0); }
.dtap-hint.bump { transform: translateY(-2px) scale(1.02); }
