:root{
  --pink:#fe2c55; --cyan:#25f4ee; --bg:#000; --panel:#121212; --panel2:#1f1f1f;
  --text:#fff; --muted:rgba(255,255,255,.65); --nav-h:56px;
}
*{box-sizing:border-box; -webkit-tap-highlight-color:transparent;}
html,body{height:100%;}
html{overscroll-behavior:none;}
body{
  margin:0; background:var(--bg); color:var(--text);
  font-family:"Hiragino Kaku Gothic ProN","Hiragino Sans","Noto Sans JP",system-ui,sans-serif;
  position:fixed; inset:0; overflow:hidden; overscroll-behavior:none;
  touch-action:none;
}
button{font-family:inherit; cursor:pointer;}
img{user-select:none; -webkit-user-drag:none;}

/* ---------- age gate ---------- */
#gate{
  position:fixed; inset:0; z-index:200; background:#000;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  padding:24px; text-align:center;
}
#gate.hidden{display:none;}
#gate .gate-logo{width:min(78vw,340px); height:auto; margin-bottom:10px;}
#gate .gate-sub{color:var(--muted); font-size:14px; margin:6px 0 34px;}
#gate .gate-note{font-size:12px; color:var(--muted); max-width:340px; line-height:1.7; margin-bottom:26px;}
#gateEnter{
  background:var(--pink); color:#fff; border:none; border-radius:4px;
  font-size:17px; font-weight:700; padding:14px 44px; min-width:260px;
}
#gateLeave{margin-top:16px; color:var(--muted); background:none; border:none; font-size:14px; text-decoration:underline;}
#gate .gate-legal{position:absolute; bottom:22px; font-size:12px; color:var(--muted);}
#gate .gate-legal a{color:var(--muted); margin:0 8px;}

/* ---------- app layout ---------- */
#app{display:none; flex-direction:column; height:100dvh; height:100svh;}
#app.on{display:flex;}
#stage{flex:1; position:relative; overflow:hidden;}

/* ---------- feed ---------- */
#feed{
  position:absolute; inset:0; overflow-y:scroll; overflow-x:hidden;
  scroll-snap-type:y mandatory; overscroll-behavior:none; touch-action:pan-y;
  scrollbar-width:none;
}
#feed::-webkit-scrollbar{display:none;}
.slide{
  position:relative; width:100%; height:100%; scroll-snap-align:start; scroll-snap-stop:always;
  background:#000; overflow:hidden;
}
.slide video{position:absolute; inset:0; width:100%; height:100%; object-fit:contain; background:#000;}
.slide .poster{position:absolute; inset:0; width:100%; height:100%; object-fit:cover; filter:brightness(.9);}
.slide .shade{position:absolute; inset:0; background:linear-gradient(to top, rgba(0,0,0,.55), transparent 38%, rgba(0,0,0,.25) 18%, transparent 30%); pointer-events:none;}
.slide .bigplay{
  position:absolute; top:50%; left:50%; transform:translate(-50%,-50%);
  font-size:64px; color:rgba(255,255,255,.85); pointer-events:none; display:none;
  text-shadow:0 2px 14px rgba(0,0,0,.6);
}
.slide.paused .bigplay{display:block;}

/* top tabs */
#tabs{
  position:absolute; top:0; left:0; right:0; z-index:30;
  display:flex; align-items:flex-start; justify-content:center; gap:22px;
  padding:calc(10px + env(safe-area-inset-top)) 60px 8px;
  pointer-events:none;
}
#tabs button{
  pointer-events:auto; background:none; border:none; color:rgba(255,255,255,.72);
  font-size:16px; font-weight:600; padding:6px 2px; position:relative;
}
#tabs button.active{color:#fff;}
#tabs button.active::after{
  content:""; position:absolute; left:50%; transform:translateX(-50%); bottom:-2px;
  width:26px; height:3px; border-radius:2px; background:#fff;
}
#tabs .searchBtn{position:absolute; right:14px; top:calc(8px + env(safe-area-inset-top)); font-size:21px; color:#fff;}

/* right rail */
.rail{
  position:absolute; right:8px; bottom:96px; z-index:20;
  display:flex; flex-direction:column; align-items:center; gap:18px;
}
.rail .avatarWrap{position:relative; width:48px; height:48px; margin-bottom:4px;}
.rail .avatarWrap img{width:48px; height:48px; border-radius:50%; border:2px solid #fff; object-fit:cover; background:#333;}
.rail .followBtn{
  position:absolute; left:50%; bottom:-9px; transform:translateX(-50%);
  width:19px; height:19px; border-radius:50%; border:none; background:var(--pink); color:#fff;
  font-size:14px; line-height:1; display:flex; align-items:center; justify-content:center; padding:0;
}
.rail .followBtn.following{background:#fff; color:var(--pink);}
.rail .act{display:flex; flex-direction:column; align-items:center; gap:2px; background:none; border:none; color:#fff; padding:0;}
.rail .act .ic{font-size:31px; line-height:1; filter:drop-shadow(0 1px 4px rgba(0,0,0,.5));}
.rail .act .num{font-size:12px; font-weight:600; text-shadow:0 1px 3px rgba(0,0,0,.6);}
.rail .act.liked .ic{color:var(--pink);}
.rail .act.saved .ic{color:#face15;}
.rail .disc{
  width:44px; height:44px; border-radius:50%; margin-top:2px;
  background:conic-gradient(#111 0 25%, #2b2b2b 0 50%, #111 0 75%, #2b2b2b 0);
  border:11px solid #181818; box-sizing:border-box;
  animation:spin 3.2s linear infinite;
}
@keyframes spin{to{transform:rotate(360deg);}}

/* bottom overlay */
.meta{
  position:absolute; left:10px; right:76px; bottom:16px; z-index:15; pointer-events:none;
}
.meta .handle{font-weight:700; font-size:17px; text-shadow:0 1px 4px rgba(0,0,0,.7); pointer-events:auto;}
.meta .cap{
  margin-top:6px; font-size:14px; line-height:1.45; white-space:pre-wrap; word-break:break-word;
  text-shadow:0 1px 3px rgba(0,0,0,.7); display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden;
}
.meta .music{margin-top:8px; font-size:13px; display:flex; align-items:center; gap:6px; overflow:hidden; max-width:230px;}
.meta .music .mq{display:inline-block; white-space:nowrap; animation:mq 7s linear infinite;}
@keyframes mq{0%{transform:translateX(0);}100%{transform:translateX(-50%);}}
.meta .vstats{margin-top:5px; font-size:12px; color:var(--muted);}

/* mute button */
.muteBtn{
  position:absolute; left:12px; top:calc(52px + env(safe-area-inset-top)); z-index:25;
  width:38px; height:38px; border-radius:50%; border:none;
  background:rgba(0,0,0,.45); color:#fff; font-size:17px;
}

/* ---------- bottom nav ---------- */
#nav{
  height:calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom:env(safe-area-inset-bottom);
  background:#000; border-top:1px solid rgba(255,255,255,.09);
  display:flex; align-items:stretch; z-index:40; position:relative;
}
#nav button{
  flex:1; background:none; border:none; color:var(--muted);
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px;
  font-size:10px; padding:4px 0 2px;
}
#nav button .nic{font-size:22px; line-height:1;}
#nav button.active{color:#fff;}
#nav .plusBtn{justify-content:center;}
#nav .plusBtn .plus{
  width:46px; height:31px; border-radius:9px; background:#fff; color:#000;
  display:flex; align-items:center; justify-content:center; font-size:21px; font-weight:700;
  box-shadow:-5px 0 0 var(--cyan), 5px 0 0 var(--pink);
}
#nav .badge{
  position:absolute; margin-left:26px; margin-top:-4px; background:var(--pink); color:#fff;
  font-size:9px; min-width:15px; height:15px; border-radius:8px; padding:0 4px;
  display:none; align-items:center; justify-content:center;
}

/* ---------- sub views ---------- */
.view{
  position:absolute; inset:0; background:#000; z-index:35; display:none;
  flex-direction:column; overflow:hidden;
}
.view.on{display:flex;}
.view header{
  padding:calc(10px + env(safe-area-inset-top)) 14px 10px; font-size:17px; font-weight:700;
  display:flex; align-items:center; gap:10px; border-bottom:1px solid rgba(255,255,255,.08);
}
.view .scroll{flex:1; overflow-y:auto; overscroll-behavior:contain; touch-action:pan-y; padding:12px 12px 20px;}
.searchBox{display:flex; gap:8px; margin-bottom:14px;}
.searchBox input{
  flex:1; background:var(--panel2); border:none; border-radius:8px; color:#fff;
  padding:11px 12px; font-size:15px; outline:none;
}
.searchBox button{background:var(--pink); color:#fff; border:none; border-radius:8px; padding:0 18px; font-weight:700;}
.secTitle{font-size:15px; font-weight:700; margin:18px 2px 10px;}
.chipRow{display:flex; gap:8px; margin-bottom:6px; flex-wrap:wrap;}
.chip{
  background:var(--panel2); color:var(--muted); border:none; border-radius:16px; padding:7px 14px; font-size:13px;
}
.chip.active{background:#fff; color:#000; font-weight:700;}
.grid{display:grid; grid-template-columns:repeat(3,1fr); gap:2px;}
.grid .cell{position:relative; aspect-ratio:3/4; background:#181818; overflow:hidden; border:none; padding:0;}
.grid .cell img{width:100%; height:100%; object-fit:cover;}
.grid .cell .cv{position:absolute; left:5px; bottom:4px; font-size:11px; color:#fff; text-shadow:0 1px 3px rgba(0,0,0,.8);}
.authorRow{display:flex; align-items:center; gap:11px; padding:9px 2px; width:100%; background:none; border:none; color:#fff; text-align:left;}
.authorRow img{width:46px; height:46px; border-radius:50%; object-fit:cover; background:#333;}
.authorRow .an{font-weight:700; font-size:14px;}
.authorRow .ah{color:var(--muted); font-size:12px;}
.authorRow .astat{margin-left:auto; color:var(--muted); font-size:12px; text-align:right;}
.inboxItem{display:flex; gap:11px; padding:11px 2px; border-bottom:1px solid rgba(255,255,255,.06); font-size:14px; align-items:flex-start;}
.inboxItem .iic{font-size:19px;}
.inboxItem .iat{color:var(--muted); font-size:12px; margin-top:2px;}
.emptyMsg{color:var(--muted); text-align:center; padding:34px 10px; font-size:14px; line-height:1.8;}

/* ---------- profile ---------- */
.profHead{display:flex; flex-direction:column; align-items:center; padding:16px 0 6px;}
.profHead .pname{font-size:19px; font-weight:700;}
.profHead .pmeta{color:var(--muted); font-size:12px; margin-top:4px;}
.profStats{display:flex; gap:26px; margin:12px 0 4px;}
.profStats div{text-align:center;}
.profStats b{display:block; font-size:16px;}
.profStats span{font-size:12px; color:var(--muted);}
.logoutBtn{margin-top:12px; background:var(--panel2); color:#fff; border:none; border-radius:6px; padding:9px 26px; font-size:14px;}
.myPostRow{display:flex; gap:10px; padding:9px 0; border-bottom:1px solid rgba(255,255,255,.06); align-items:center;}
.myPostRow img{width:52px; height:70px; object-fit:cover; border-radius:4px; background:#222;}
.myPostRow .pt{font-size:13px; flex:1; word-break:break-word;}
.myPostRow .del{background:none; border:1px solid rgba(255,255,255,.25); color:#fff; border-radius:6px; padding:6px 10px; font-size:12px;}

/* ---------- sheets & modals ---------- */
.sheetWrap{
  position:fixed; inset:0; z-index:120; background:rgba(0,0,0,.55);
  display:none; align-items:flex-end; justify-content:center;
}
.sheetWrap.on{display:flex;}
.sheet{
  background:#121212; width:100%; max-width:560px; max-height:78dvh; border-radius:14px 14px 0 0;
  display:flex; flex-direction:column; overflow:hidden; animation:up .18s ease-out;
}
@keyframes up{from{transform:translateY(26px);}to{transform:translateY(0);}}
.sheet header{padding:14px 16px 10px; font-weight:700; font-size:15px; display:flex; justify-content:space-between; align-items:center;}
.sheet header button{background:none; border:none; color:var(--muted); font-size:18px;}
.sheet .sheetBody{overflow-y:auto; overscroll-behavior:contain; touch-action:pan-y; padding:0 16px 18px;}
.sheetItem{
  display:flex; align-items:center; gap:12px; width:100%; padding:14px 2px;
  background:none; border:none; border-bottom:1px solid rgba(255,255,255,.06);
  color:#fff; font-size:15px; text-align:left;
}
.commentRow{display:flex; gap:10px; padding:10px 0; border-bottom:1px solid rgba(255,255,255,.05);}
.commentRow .cu{font-weight:700; font-size:13px;}
.commentRow .cb{font-size:14px; margin-top:2px; word-break:break-word; white-space:pre-wrap;}
.commentRow .ct{color:var(--muted); font-size:11px; margin-top:2px;}
.commentForm{display:flex; gap:8px; padding:10px 16px calc(12px + env(safe-area-inset-bottom)); border-top:1px solid rgba(255,255,255,.08);}
.commentForm input{flex:1; background:var(--panel2); border:none; border-radius:18px; color:#fff; padding:10px 14px; font-size:14px; outline:none;}
.commentForm button{background:none; border:none; color:var(--pink); font-weight:700; font-size:15px;}

.modalWrap{
  position:fixed; inset:0; z-index:130; background:rgba(0,0,0,.65);
  display:none; align-items:center; justify-content:center; padding:20px;
}
.modalWrap.on{display:flex;}
.modal{background:#121212; border-radius:14px; width:100%; max-width:400px; padding:22px 20px 20px; max-height:88dvh; overflow-y:auto; overscroll-behavior:contain; touch-action:pan-y;}
.modal .mlogo{display:block; width:170px; margin:2px auto 6px;}
.modal .msub{text-align:center; color:var(--muted); font-size:13px; margin-bottom:16px;}
.modal .mtabs{display:flex; gap:0; margin-bottom:16px; border-bottom:1px solid rgba(255,255,255,.12);}
.modal .mtabs button{flex:1; background:none; border:none; color:var(--muted); font-size:15px; font-weight:700; padding:9px 0;}
.modal .mtabs button.active{color:#fff; border-bottom:2px solid var(--pink);}
.modal label{display:block; font-size:12px; color:var(--muted); margin:12px 0 5px;}
.modal input[type=text], .modal input[type=password], .modal input[type=email], .modal textarea{
  width:100%; background:var(--panel2); border:1px solid rgba(255,255,255,.1); border-radius:6px;
  color:#fff; padding:12px; font-size:15px; outline:none; font-family:inherit;
}
.modal .submitBtn{
  width:100%; margin-top:18px; background:var(--pink); color:#fff; border:none; border-radius:4px;
  padding:13px; font-size:16px; font-weight:700;
}
.modal .err{color:#ff6b81; font-size:13px; margin-top:10px; min-height:16px; text-align:center;}
.modal .closeX{float:right; background:none; border:none; color:var(--muted); font-size:19px;}
.modal .hint{font-size:11px; color:var(--muted); margin-top:5px; line-height:1.6;}

#toast{
  position:fixed; left:50%; bottom:calc(var(--nav-h) + 26px); transform:translateX(-50%);
  background:rgba(38,38,38,.95); color:#fff; padding:10px 18px; border-radius:8px; font-size:14px;
  z-index:300; display:none; max-width:88vw; text-align:center;
}
.legalBody{max-width:760px; margin:0 auto; padding:26px 18px 60px; line-height:1.9; font-size:14px; color:#ddd;}
.legalBody h1{font-size:20px;}
.legalBody a{color:var(--cyan);}
