:root{
  --bg:#0f0f0f;
  --panel:#181818;
  --text:#f1f1f1;
  --muted:#aaa;
  --pill:#2a2a2a;
  --pill2:#3a3a3a;
  --accent:#ff0000;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*{box-sizing:border-box}
html,body{height:100%; margin:0; background:var(--bg); color:var(--text); font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;}
button{font:inherit}

.topbar{
  position:sticky; top:0; z-index:50;
  height:56px;
  padding-top:var(--safe-top);
  display:flex; align-items:center; gap:10px;
  background:rgba(15,15,15,0.92);
  backdrop-filter: blur(10px);
  border-bottom:1px solid #222;
  padding-left:12px; padding-right:12px;
}

.logo{
  width:40px; height:40px;
  display:flex; align-items:center; justify-content:center;
  border-radius:12px;
  cursor:pointer;
}
.logo img{width:34px; height:34px}

.title{font-weight:700; letter-spacing:0.2px}
.spacer{flex:1}

.iconbtn{
  border:0;
  background:transparent;
  color:var(--text);
  font-size:22px;
  width:44px; height:44px;
  border-radius:12px;
}
.iconbtn:active{background:#222}

.pill{
  border:0;
  background:var(--pill);
  color:var(--text);
  padding:10px 14px;
  border-radius:999px;
  cursor:pointer;
}
.pill:active{background:var(--pill2)}
.pill.primary{background:var(--accent); color:#fff}

.home{
  padding:14px 12px calc(14px + var(--safe-bottom));
}

.homeHeader{
  display:flex; align-items:center; gap:12px;
  margin-bottom:12px;
}
.homeHeaderTitle{font-size:18px; font-weight:700}
.grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:10px;
}
@media (min-width: 720px){
  .grid{grid-template-columns: repeat(4, minmax(0, 1fr));}
}
.card{
  background:var(--panel);
  border-radius:14px;
  overflow:hidden;
  cursor:pointer;
  border:1px solid #222;
}
.thumb{
  width:100%;
  aspect-ratio: 9 / 16;
  object-fit:cover;
  display:block;
  background:#111;
}
.cardMeta{
  padding:8px 10px 10px;
}
.cardTitle{
  font-size:12px;
  color:var(--text);
  overflow:hidden;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  line-height:1.2;
}
.cardChannel{font-size:11px; color:var(--muted); margin-top:6px}

.hidden{display:none !important}

.player{
  height: calc(100vh - 56px - var(--safe-top));
  padding-bottom: var(--safe-bottom);
}

.feed{
  height:100%;
  overflow-y:auto;
  scroll-snap-type:y mandatory;
  -webkit-overflow-scrolling: touch;
}
.reel{
  height:100%;
  scroll-snap-align:start;
  position:relative;
  background:#000;
}
.reel video{
  width:100%;
  height:100%;
  object-fit:contain; /* keep full video visible; change to cover if you prefer */
  background:#000;
}
.reelOverlay{
  position:absolute;
  left:12px; right:12px; bottom: calc(14px + var(--safe-bottom));
  display:flex; align-items:flex-end; justify-content:space-between;
  gap:12px;
  pointer-events:none;
}
.reelInfo{
  max-width:75%;
}
.reelChannel{
  font-weight:700;
  margin-bottom:6px;
}
.reelTitle{
  color:var(--text);
  font-size:13px;
  opacity:0.95;
}
.reelActions{
  display:flex; flex-direction:column; gap:10px;
  align-items:center; justify-content:flex-end;
}
.action{
  pointer-events:auto;
  width:48px; height:48px;
  border-radius:999px;
  border:1px solid #333;
  background:rgba(20,20,20,0.7);
  color:#fff;
  display:flex; align-items:center; justify-content:center;
  font-size:20px;
}

.backdrop{
  position:fixed; inset:0;
  background:rgba(0,0,0,0.6);
  z-index:80;
}
.sheet{
  position:fixed;
  left:0; right:0; bottom:0;
  max-height:78vh;
  background:var(--panel);
  border-top-left-radius:18px;
  border-top-right-radius:18px;
  border:1px solid #222;
  z-index:90;
  display:flex; flex-direction:column;
  padding-bottom: var(--safe-bottom);
}
.sheetHeader, .sheetFooter{
  padding:12px;
  display:flex; align-items:center; justify-content:space-between;
  border-bottom:1px solid #222;
}
.sheetFooter{border-bottom:0; border-top:1px solid #222}
.sheetTitle{font-weight:800}
.sheetBody{padding:12px; overflow:auto}
.hint{color:var(--muted); margin:0 0 12px 0; font-size:12px}

.channelList{
  display:flex; flex-direction:column; gap:10px;
}
.chRow{
  display:flex; align-items:center; justify-content:space-between;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid #222;
  background:#141414;
}
.chName{font-weight:600}
