*{box-sizing:border-box}
:root{
  --reel-max-width:470px;
  --safe-top:max(12px,env(safe-area-inset-top));
  --safe-bottom:max(14px,env(safe-area-inset-bottom));
}
html,body{
  margin:0;
  padding:0;
  width:100%;
  height:100%;
  background:#000;
  color:#fff;
  font-family:Tahoma,Arial,sans-serif;
}
body{
  overflow:hidden;
  -webkit-tap-highlight-color:transparent;
  user-select:none;
}
button,a{font:inherit}
button{border:0}
svg{
  display:block;
  width:24px;
  height:24px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.9;
  stroke-linecap:round;
  stroke-linejoin:round;
}

.topbar{
  position:fixed;
  z-index:100;
  top:0;
  left:0;
  right:0;
  pointer-events:none;
  padding-top:var(--safe-top);
}
.topbar__inner{
  height:48px;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  padding:0 16px;
  margin:0 auto;
  max-width:var(--reel-max-width);
  text-shadow:0 1px 10px rgba(0,0,0,.85);
}
.topbar__title{
  font-family:Arial,sans-serif;
  font-weight:800;
  font-size:23px;
  letter-spacing:-.5px;
}
.topbar__home{
  width:38px;
  height:38px;
  border-radius:50%;
  display:grid;
  place-items:center;
  color:#fff;
  text-decoration:none;
  background:rgba(0,0,0,.18);
  backdrop-filter:blur(8px);
  -webkit-backdrop-filter:blur(8px);
  pointer-events:auto;
}
.topbar__home svg{width:22px;height:22px}

.reels{
  width:100%;
  height:100dvh;
  overflow-y:auto;
  overflow-x:hidden;
  scroll-snap-type:y mandatory;
  overscroll-behavior-y:contain;
  scrollbar-width:none;
  background:#000;
}
.reels::-webkit-scrollbar{display:none}

.reel{
  position:relative;
  width:100%;
  height:100dvh;
  min-height:100dvh;
  scroll-snap-align:start;
  scroll-snap-stop:always;
  overflow:hidden;
  display:flex;
  align-items:center;
  justify-content:center;
  background:#000;
  isolation:isolate;
}

.bg-video-wrap{
  position:absolute;
  inset:-3%;
  overflow:hidden;
  z-index:0;
  background:#000;
}
.bg-video{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit:cover;
  filter:blur(34px) saturate(1.05) brightness(.55);
  transform:scale(1.20);
  opacity:.98;
  background:#000;
}
.bg-overlay{
  position:absolute;
  inset:0;
  z-index:1;
  background:
    linear-gradient(to right,rgba(0,0,0,.34),rgba(0,0,0,.05) 30%,rgba(0,0,0,.05) 70%,rgba(0,0,0,.34)),
    linear-gradient(to bottom,rgba(0,0,0,.30),transparent 24%,transparent 66%,rgba(0,0,0,.66));
}

.main-video-wrap{
  position:relative;
  z-index:2;
  width:100%;
  height:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  background:#000;
}
.main-video{
  width:100%;
  height:100%;
  object-fit:contain;
  background:transparent;
}

.reel-shade{
  position:absolute;
  z-index:3;
  inset:0;
  pointer-events:none;
  background:
    linear-gradient(to bottom,rgba(0,0,0,.34),rgba(0,0,0,0) 18%),
    linear-gradient(to top,rgba(0,0,0,.88),rgba(0,0,0,.18) 36%,rgba(0,0,0,0) 55%);
}

.progress{
  position:absolute;
  z-index:8;
  top:0;
  left:0;
  right:0;
  height:2px;
  background:rgba(255,255,255,.16);
}
.progress>span{
  display:block;
  width:0%;
  height:100%;
  background:#fff;
}

.meta{
  position:absolute;
  z-index:7;
  right:max(16px,env(safe-area-inset-right));
  left:84px;
  bottom:calc(var(--safe-bottom) + 14px);
  direction:rtl;
  text-align:right;
  text-shadow:0 1px 3px rgba(0,0,0,.9);
  pointer-events:none;
}
.creator{
  display:flex;
  align-items:center;
  gap:9px;
  margin-bottom:9px;
}
.creator__avatar{
  width:32px;
  height:32px;
  flex:0 0 32px;
  border-radius:50%;
  display:grid;
  place-items:center;
  border:1px solid rgba(255,255,255,.75);
  background:rgba(0,0,0,.28);
  color:#fff;
  font-weight:700;
  font-size:14px;
}
.creator__name{
  font-size:13px;
  font-weight:700;
}
.meta h2{
  margin:0 0 4px;
  font-size:15px;
  line-height:1.7;
  font-weight:700;
}
.meta p{
  margin:0;
  font-size:13px;
  line-height:1.8;
  color:rgba(255,255,255,.94);
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}
.audio-line{
  margin-top:8px;
  display:flex;
  align-items:center;
  gap:6px;
  font-size:11px;
  color:rgba(255,255,255,.88);
}
.audio-line svg{width:15px;height:15px}

.actions{
  position:absolute;
  z-index:9;
  left:max(12px,env(safe-area-inset-left));
  bottom:calc(var(--safe-bottom) + 14px);
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:12px;
}
.action{
  width:48px;
  min-height:48px;
  padding:0;
  border-radius:50%;
  color:#fff;
  background:rgba(0,0,0,.14);
  backdrop-filter:blur(5px);
  -webkit-backdrop-filter:blur(5px);
  cursor:pointer;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:2px;
  text-shadow:0 1px 3px rgba(0,0,0,.7);
  transition:transform .12s ease,background .12s ease,opacity .12s ease;
}
.action:hover{background:rgba(0,0,0,.24)}
.action:active{transform:scale(.92)}
.action svg{width:26px;height:26px}
.action small{font-size:8px;font-weight:600}
.action.like.liked svg{
  fill:#fff;
  stroke:#fff;
}
.action.like.liked{
  color:#fff;
}

.play-indicator{
  position:absolute;
  z-index:10;
  inset:0;
  display:grid;
  place-items:center;
  pointer-events:none;
  opacity:0;
  transition:opacity .15s ease;
}
.reel.paused .play-indicator{opacity:1}
.play-indicator__circle{
  width:68px;
  height:68px;
  border-radius:50%;
  display:grid;
  place-items:center;
  background:rgba(0,0,0,.34);
  backdrop-filter:blur(6px);
  -webkit-backdrop-filter:blur(6px);
}
.play-indicator svg{
  width:32px;
  height:32px;
  fill:#fff;
  stroke:none;
  margin-left:3px;
}

.heart-burst{
  position:absolute;
  z-index:12;
  inset:0;
  pointer-events:none;
  display:grid;
  place-items:center;
  opacity:0;
}
.heart-burst.show{animation:heartBurst .65s ease both}
.heart-burst svg{
  width:88px;
  height:88px;
  fill:#fff;
  stroke:#fff;
  filter:drop-shadow(0 5px 18px rgba(0,0,0,.42));
}
@keyframes heartBurst{
  0%{opacity:0;transform:scale(.35)}
  28%{opacity:1;transform:scale(1.12)}
  58%{opacity:1;transform:scale(.98)}
  100%{opacity:0;transform:scale(1.06)}
}

.loading{
  position:fixed;
  z-index:120;
  left:0;
  right:0;
  bottom:calc(var(--safe-bottom) + 18px);
  display:flex;
  justify-content:center;
  pointer-events:none;
}
.loading.hidden{display:none}
.spinner{
  width:26px;
  height:26px;
  border:2px solid rgba(255,255,255,.22);
  border-top-color:#fff;
  border-radius:50%;
  animation:spin .7s linear infinite;
}
@keyframes spin{to{transform:rotate(360deg)}}

.state-panel{
  position:fixed;
  z-index:130;
  inset:0;
  background:#000;
  color:#fff;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:12px;
  text-align:center;
  padding:32px;
}
.state-panel[hidden]{display:none}
.state-panel span{color:#aaa;line-height:1.8}
.state-panel button{
  border:1px solid rgba(255,255,255,.8);
  border-radius:999px;
  padding:10px 20px;
  background:transparent;
  color:#fff;
  cursor:pointer;
  font-weight:700;
}

@media (min-width:720px){
  .main-video-wrap{
    width:min(var(--reel-max-width),100%);
    height:calc(100dvh - 18px);
    margin:auto;
    border-radius:14px;
    box-shadow:0 10px 50px rgba(0,0,0,.45),0 0 0 1px rgba(255,255,255,.06);
  }
  .reel-shade,
  .progress{
    width:min(var(--reel-max-width),100%);
    left:50%;
    right:auto;
    transform:translateX(-50%);
    border-radius:14px;
  }
  .progress{overflow:hidden}
  .meta{
    width:calc(min(var(--reel-max-width),100%) - 102px);
    right:calc(50% - (min(var(--reel-max-width),100%) / 2) + 16px);
    left:auto;
  }
  .actions{
    left:calc(50% - (min(var(--reel-max-width),100%) / 2) + 11px);
  }
  .topbar__inner{max-width:var(--reel-max-width)}
}
@media (max-width:719px){
  .topbar__inner{max-width:none}
  .main-video-wrap{border-radius:0}
}

.video-title-link{
  color:inherit;
  text-decoration:none;
  pointer-events:auto;
}
.video-title-link:hover{text-decoration:underline}
