*{
  box-sizing:border-box;
}

:root{
  color-scheme:dark;
  --feed-max-width:560px;
  --top-safe:env(safe-area-inset-top);
  --bottom-safe:env(safe-area-inset-bottom);
}

html,
body{
  margin:0;
  width:100%;
  height:100%;
  overflow:hidden;
  background:#000;
  color:#fff;
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Helvetica Neue",
    Arial,
    sans-serif;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}

button,
a{
  font:inherit;
}

button{
  color:inherit;
}

button:focus-visible,
a:focus-visible{
  outline:2px solid #fff;
  outline-offset:3px;
}

.app{
  position:relative;
  width:100%;
  height:100dvh;
  overflow:hidden;
  background:#000;
}

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

.feed::-webkit-scrollbar{
  display:none;
}

.card{
  position:relative;
  width:100%;
  height:100dvh;
  min-height:100dvh;
  overflow:hidden;
  scroll-snap-align:start;
  scroll-snap-stop:always;
  background:#000;
  isolation:isolate;
}

.media-wrap{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  background:#000;
  touch-action:pan-y;
}

.media-wrap video,
.media-wrap img{
  display:block;
  width:100%;
  height:100%;
  max-width:100%;
  max-height:100%;
  object-fit:contain;
  background:#000;
}

.media-wrap img{
  user-select:none;
  -webkit-user-drag:none;
}

.media-placeholder{
  display:flex;
  align-items:center;
  justify-content:center;
  width:100%;
  height:100%;
  color:#777;
  font-size:14px;
  background:
    radial-gradient(
      circle at center,
      #181818,
      #000 72%
    );
}

.card-shade{
  position:absolute;
  z-index:2;
  inset:0;
  pointer-events:none;
  background:
    linear-gradient(
      to bottom,
      rgba(0,0,0,.36) 0,
      rgba(0,0,0,0) 20%,
      rgba(0,0,0,0) 54%,
      rgba(0,0,0,.16) 66%,
      rgba(0,0,0,.88) 100%
    );
}

.play-state{
  position:absolute;
  z-index:8;
  top:50%;
  left:50%;
  width:76px;
  height:76px;
  transform:translate(-50%,-50%) scale(.88);
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:50%;
  background:rgba(0,0,0,.42);
  color:#fff;
  opacity:0;
  pointer-events:none;
  backdrop-filter:blur(10px);
  -webkit-backdrop-filter:blur(10px);
  transition:
    opacity .14s ease,
    transform .14s ease;
}

.play-state.show{
  opacity:1;
  transform:translate(-50%,-50%) scale(1);
}

.play-state svg{
  width:36px;
  height:36px;
  fill:currentColor;
}

.card-info{
  position:absolute;
  z-index:5;
  left:0;
  right:82px;
  bottom:0;
  padding:
    18px
    10px
    calc(var(--bottom-safe) + 22px)
    14px;
  pointer-events:none;
  text-shadow:
    0 1px 2px rgba(0,0,0,.7),
    0 2px 8px rgba(0,0,0,.72);
}

.source-line{
  display:flex;
  align-items:center;
  gap:8px;
  min-width:0;
  margin-bottom:8px;
}

.source-handle{
  max-width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:15px;
  line-height:1.2;
  font-weight:800;
  letter-spacing:-.1px;
}

.card-title-button{
  display:block;
  width:100%;
  max-width:100%;
  padding:0;
  border:0;
  background:transparent;
  color:#fff;
  text-align:left;
  cursor:pointer;
  pointer-events:auto;
}

.card-title{
  font-size:15px;
  font-weight:500;
  line-height:1.42;
  letter-spacing:-.1px;
  display:-webkit-box;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:3;
  overflow:hidden;
}

.open-hint{
  display:inline-flex;
  align-items:center;
  gap:5px;
  margin-top:9px;
  padding:0;
  border:0;
  background:transparent;
  color:rgba(255,255,255,.92);
  font-size:13px;
  font-weight:700;
  cursor:pointer;
  pointer-events:auto;
}

.open-hint svg{
  width:14px;
  height:14px;
  fill:currentColor;
}

.action-rail{
  position:absolute;
  z-index:7;
  right:max(10px, env(safe-area-inset-right));
  bottom:calc(var(--bottom-safe) + 22px);
  width:60px;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:18px;
}

.source-avatar{
  position:relative;
  width:48px;
  height:48px;
  display:flex;
  align-items:center;
  justify-content:center;
  border:2px solid #fff;
  border-radius:50%;
  background:
    linear-gradient(
      145deg,
      #2f2f2f,
      #0d0d0d
    );
  color:#fff;
  font-size:19px;
  font-weight:900;
  box-shadow:0 3px 12px rgba(0,0,0,.45);
  user-select:none;
}

.source-avatar::after{
  content:"";
  position:absolute;
  right:-2px;
  bottom:-4px;
  width:15px;
  height:15px;
  border:2px solid #000;
  border-radius:50%;
  background:#fe2c55;
}

.action-button{
  width:60px;
  min-height:57px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:flex-start;
  gap:4px;
  padding:0;
  border:0;
  background:transparent;
  color:#fff;
  cursor:pointer;
  text-shadow:0 1px 4px rgba(0,0,0,.8);
}

.action-icon{
  width:44px;
  height:44px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:50%;
  color:#fff;
  filter:drop-shadow(0 2px 4px rgba(0,0,0,.55));
}

.action-icon svg{
  width:31px;
  height:31px;
  fill:currentColor;
  stroke:currentColor;
}

.action-button.favorite.active .action-icon{
  color:#fe2c55;
}

.action-label{
  min-height:13px;
  max-width:62px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:11px;
  font-weight:700;
  line-height:1.15;
}

.topbar{
  position:fixed;
  z-index:30;
  top:0;
  left:50%;
  width:min(100%, var(--feed-max-width));
  transform:translateX(-50%);
  display:flex;
  justify-content:center;
  align-items:flex-start;
  min-height:64px;
  padding:
    calc(var(--top-safe) + 10px)
    72px
    8px;
  pointer-events:none;
}

.top-tabs{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:18px;
  min-width:0;
  pointer-events:auto;
}

.top-tab{
  position:relative;
  min-height:36px;
  padding:5px 0 9px;
  border:0;
  background:transparent;
  color:rgba(255,255,255,.72);
  font-size:15px;
  font-weight:700;
  letter-spacing:-.1px;
  cursor:pointer;
  text-shadow:0 1px 5px rgba(0,0,0,.9);
}

.top-tab.active{
  color:#fff;
}

.top-tab.active::after{
  content:"";
  position:absolute;
  left:50%;
  bottom:2px;
  width:22px;
  height:2px;
  transform:translateX(-50%);
  border-radius:999px;
  background:#fff;
}

.source-tab{
  display:inline-flex;
  align-items:center;
  gap:3px;
}

.source-tab-arrow{
  margin-top:-2px;
  font-size:15px;
}

.counter{
  position:absolute;
  right:12px;
  top:calc(var(--top-safe) + 14px);
  min-width:46px;
  padding:5px 8px;
  border-radius:999px;
  background:rgba(0,0,0,.28);
  color:rgba(255,255,255,.88);
  font-size:11px;
  font-weight:700;
  text-align:center;
  pointer-events:auto;
  backdrop-filter:blur(8px);
  -webkit-backdrop-filter:blur(8px);
}

.filter-menu{
  position:absolute;
  z-index:50;
  top:calc(var(--top-safe) + 52px);
  left:50%;
  width:min(280px, calc(100vw - 24px));
  max-height:min(60dvh, 440px);
  overflow-y:auto;
  transform:translateX(-50%);
  border:1px solid rgba(255,255,255,.12);
  border-radius:14px;
  background:rgba(20,20,20,.96);
  box-shadow:0 18px 50px rgba(0,0,0,.55);
  backdrop-filter:blur(20px);
  -webkit-backdrop-filter:blur(20px);
  pointer-events:auto;
}

.filter-menu[hidden]{
  display:none;
}

.filter-option{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:13px 14px;
  border:0;
  border-bottom:1px solid rgba(255,255,255,.07);
  background:transparent;
  color:#fff;
  text-align:left;
  cursor:pointer;
}

.filter-option:last-child{
  border-bottom:0;
}

.filter-option:hover,
.filter-option.active{
  background:rgba(255,255,255,.10);
}

.filter-option.active::before{
  content:"✓";
  margin-right:8px;
  color:#fff;
  font-weight:900;
}

.filter-option.active{
  justify-content:flex-start;
}

.filter-option.active .filter-count{
  margin-left:auto;
}

.filter-count{
  color:#aaa;
  font-size:12px;
}

.global-mute-control{
  position:fixed;
  z-index:25;
  top:calc(var(--top-safe) + 11px);
  left:
    max(
      12px,
      calc((100vw - var(--feed-max-width)) / 2 + 12px)
    );
  width:38px;
  height:38px;
  display:flex;
  align-items:center;
  justify-content:center;
  border:0;
  border-radius:50%;
  background:rgba(0,0,0,.28);
  color:#fff;
  cursor:pointer;
  backdrop-filter:blur(8px);
  -webkit-backdrop-filter:blur(8px);
}

.global-mute-icon{
  font-size:17px;
  line-height:1;
}

.loading{
  position:fixed;
  z-index:100;
  inset:0;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:16px;
  background:#000;
  color:#ddd;
  font-size:14px;
}

.loading-spinner{
  width:30px;
  height:30px;
  border:3px solid rgba(255,255,255,.2);
  border-top-color:#fff;
  border-radius:50%;
  animation:spin .8s linear infinite;
}

@keyframes spin{
  to{
    transform:rotate(360deg);
  }
}

.error-box{
  position:fixed;
  z-index:120;
  top:50%;
  left:50%;
  width:min(calc(100% - 40px), 420px);
  transform:translate(-50%,-50%);
  padding:20px;
  border-radius:16px;
  color:#fff;
  background:#1b1b1b;
  box-shadow:0 20px 60px rgba(0,0,0,.7);
  text-align:center;
}

.error-box button{
  margin-top:14px;
  padding:9px 18px;
  border:0;
  border-radius:999px;
  cursor:pointer;
}

.offline-badge{
  position:fixed;
  z-index:150;
  left:50%;
  bottom:calc(var(--bottom-safe) + 16px);
  transform:translateX(-50%);
  padding:6px 12px;
  border-radius:999px;
  background:#b42318;
  font-size:12px;
}

.toast{
  position:fixed;
  z-index:160;
  left:50%;
  bottom:calc(var(--bottom-safe) + 74px);
  max-width:min(340px, calc(100vw - 32px));
  transform:translateX(-50%);
  padding:10px 14px;
  border-radius:10px;
  background:rgba(24,24,24,.94);
  color:#fff;
  box-shadow:0 10px 30px rgba(0,0,0,.42);
  font-size:13px;
  font-weight:700;
  text-align:center;
  backdrop-filter:blur(10px);
  -webkit-backdrop-filter:blur(10px);
}

.toast[hidden]{
  display:none;
}

.empty{
  height:100dvh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:30px;
  color:#999;
  text-align:center;
}

@media(min-width:700px){

  body{
    background:#121212;
  }

  .app{
    background:
      radial-gradient(
        circle at center,
        #222 0,
        #111 45%,
        #090909 100%
      );
  }

  .feed{
    max-width:var(--feed-max-width);
    margin:0 auto;
    background:#000;
    box-shadow:
      0 0 0 1px rgba(255,255,255,.05),
      0 0 90px rgba(0,0,0,.72);
  }

  .card{
    max-width:var(--feed-max-width);
    margin:0 auto;
  }

  .media-wrap{
    border-left:1px solid rgba(255,255,255,.04);
    border-right:1px solid rgba(255,255,255,.04);
  }
}

@media(max-width:360px){

  .card-info{
    right:72px;
    padding-left:12px;
  }

  .action-rail{
    right:7px;
    width:56px;
    gap:14px;
  }

  .action-button{
    width:56px;
  }

  .action-icon{
    width:41px;
    height:41px;
  }

  .source-avatar{
    width:44px;
    height:44px;
  }

  .topbar{
    padding-left:58px;
    padding-right:58px;
  }

  .top-tabs{
    gap:13px;
  }
}

@media(prefers-reduced-motion:reduce){

  .feed{
    scroll-behavior:auto;
  }

  .play-state{
    transition:none;
  }

  .loading-spinner{
    animation-duration:1.5s;
  }
}
