:root {
  --bg: #000;
  --card: #111;
  --muted: #9a9a9a;
  --line: #2a2a2a;
  --blue: #3b9dff;
  --pink: #fe2c55;
  --cyan: #25f4ee;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --bar: 58px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #000; color: #fff; }
html { height: 100dvh; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
  overflow: hidden;
  user-select: none;
}
button, input { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; padding: 0; }
code { color: var(--cyan); }

.phone {
  width: 100%;
  max-width: 430px;
  height: 100%;
  height: 100dvh;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  background: #000;
}

.splash {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: #000;
  transition: opacity .35s ease;
}
.splash.is-gone { opacity: 0; pointer-events: none; }

.tik-spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--cyan), #fff 40%, var(--pink) 70%, #fff 90%, var(--cyan));
  -webkit-mask: radial-gradient(farthest-side, transparent 62%, #000 63%);
  mask: radial-gradient(farthest-side, transparent 62%, #000 63%);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(1turn); } }

.feed {
  height: 100%;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
}
.feed::-webkit-scrollbar { display: none; }

.slide {
  position: relative;
  height: 100%;
  height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
  background: #0a0a0a;
}
.slide video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}
.shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0,0,0,.45) 0%, transparent 18%, transparent 58%, rgba(0,0,0,.72) 100%);
}
.play-badge,
.play-badge {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(0,0,0,.35);
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  z-index: 3;
}
.play-badge svg,
.play-badge svg { width: 34px; height: 34px; fill: #fff; margin-left: 4px; }
.slide.is-paused .play-badge,
.slide.is-paused .play-badge { opacity: 1; }
.slide.is-loading .play-badge,
.slide.is-loading .play-badge { opacity: 0; }

.vid-loading,
.vid-loading {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transition: opacity .18s ease;
}
.slide.is-loading .vid-loading,
.slide.is-loading .vid-loading { opacity: 1; }
.vid-loading .tik-spinner,
.vid-loading .tik-spinner {
  width: 36px;
  height: 36px;
}

.heart-pop,
.heart-pop {
  position: absolute;
  width: 84px;
  height: 84px;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(.4);
  opacity: 0;
  animation: heartpop .7s ease forwards;
}
.heart-pop svg,
.heart-pop svg { width: 84px; height: 84px; fill: #fe2c55; }
@keyframes heartpop {
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -70%) scale(1.4); }
}

.meta {
  position: absolute;
  left: 12px;
  right: 76px;
  bottom: calc(var(--bar) + var(--safe-b) + 16px);
  z-index: 3;
}
.author {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 16px;
  margin-bottom: 8px;
}
.follow-mini {
  border: 1px solid #fff;
  border-radius: 4px;
  padding: 1px 8px;
  font-size: 12px;
  font-weight: 700;
}
.follow-mini.is-on { background: #fff; color: #000; }
.caption { font-size: 14px; line-height: 1.4; color: #f3f3f3; }
.caption .tag { color: #fff; font-weight: 700; }
.music {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 13px;
  max-width: 70%;
}
.music .scroll { overflow: hidden; white-space: nowrap; flex: 1; }
.music svg { width: 14px; height: 14px; stroke: #fff; fill: none; stroke-width: 1.8; }

.rail {
  position: absolute;
  right: 8px;
  bottom: calc(var(--bar) + var(--safe-b) + 18px);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.avatar-wrap { position: relative; }
.avatar-wrap img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid #fff;
  object-fit: cover;
  background: #333;
}
.plus {
  position: absolute;
  left: 50%;
  bottom: -8px;
  transform: translateX(-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--pink);
  color: #fff;
  font-size: 16px;
  line-height: 18px;
  font-weight: 800;
}
.plus.is-on { background: #22c55e; font-size: 12px; line-height: 20px; }
.act { display: grid; place-items: center; gap: 2px; color: #fff; }
.act svg { width: 32px; height: 32px; fill: #fff; filter: drop-shadow(0 2px 4px rgba(0,0,0,.45)); }
.act span { font-size: 12px; font-weight: 700; text-shadow: 0 1px 2px #000; }
.act.is-liked svg { fill: var(--pink); }
.act.is-saved svg { fill: #ffd54a; }
.disc {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 8px solid #1a1a1a;
  background: center/cover no-repeat #222;
  box-shadow: 0 0 0 2px #3a3a3a;
  animation: spin 4s linear infinite;
  animation-play-state: paused;
}
.slide.is-playing .disc { animation-play-state: running; }

.progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--bar) + var(--safe-b));
  height: 3px;
  background: rgba(255,255,255,.18);
  z-index: 4;
}
.progress > i { display: block; height: 100%; width: 0; background: #fff; }

.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  padding: calc(10px + var(--safe-t)) 8px 8px;
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
}
.tabs { display: flex; justify-content: center; gap: 18px; }
.tab {
  font-size: 17px;
  font-weight: 700;
  color: rgba(255,255,255,.55);
  text-shadow: 0 1px 3px rgba(0,0,0,.6);
}
.tab.is-on { color: #fff; position: relative; }
.tab.is-on::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 22px;
  height: 3px;
  border-radius: 3px;
  background: #fff;
  transform: translateX(-50%);
}
.icon-btn,
.icon-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  color: #fff;
}
.icon-btn svg,
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: #fff; stroke-width: 2; }
.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff3b5c;
  box-shadow: 0 0 0 4px rgba(255,59,92,.25);
}

.tabbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  height: calc(var(--bar) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: #000;
  border-top: 1px solid #1c1c1c;
}
.tabbar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #8a8a8a;
  font-size: 10px;
  font-weight: 600;
}
.tabbar-item svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.tabbar-item.is-on { color: #fff; }
.tabbar-plus { color: #fff; cursor: default; }
.plus-stack {
  width: 44px;
  height: 28px;
  position: relative;
  display: grid;
  place-items: center;
}
.plus-stack i { position: absolute; width: 34px; height: 22px; border-radius: 8px; }
.plus-stack i:first-child { background: var(--cyan); transform: translateX(-4px); }
.plus-stack i:nth-child(2) { background: var(--pink); transform: translateX(4px); }
.plus-stack b {
  position: relative;
  z-index: 1;
  width: 34px;
  height: 22px;
  border-radius: 8px;
  background: #fff;
  color: #000;
  display: grid;
  place-items: center;
  font-size: 22px;
  line-height: 1;
}

.overlay, .sheet { position: absolute; inset: 0; z-index: 25; }
.overlay { background: rgba(0,0,0,.55); backdrop-filter: blur(18px); }
.gate { z-index: 40; display: grid; place-items: center; padding: 20px; }
.sheet { z-index: 45; }
.gate[hidden], .sheet[hidden] { display: none !important; }
.gate-card {
  width: min(100%, 340px);
  background: #0b0b0b;
  border: 1px solid #2a2a2a;
  border-radius: 16px;
  padding: 28px 22px 24px;
  text-align: center;
  position: relative;
}
.logo { font-size: 42px; font-weight: 900; letter-spacing: -1px; }
.logo sup { font-size: 14px; top: -18px; left: -4px; letter-spacing: 1px; font-weight: 800; }
.gate-copy { color: #ddd; font-size: 14px; line-height: 1.45; margin: 12px 0 18px; }
.btn-enter {
  width: 100%;
  border-radius: 999px;
  background: var(--blue);
  padding: 12px 12px 10px;
  display: grid;
}
.btn-enter strong { font-size: 20px; letter-spacing: 1px; }
.btn-enter small { font-size: 12px; opacity: .95; }

.sheet {
  background: #000;
  display: flex;
  flex-direction: column;
  animation: up .28s ease;
  bottom: calc(var(--bar) + var(--safe-b));
  z-index: 45;
}
.phone.has-sheet .topbar { visibility: hidden; pointer-events: none; }
.sheet-half {
  top: auto;
  height: min(72%, 560px);
  border-radius: 16px 16px 0 0;
  background: #161616;
  padding: 8px 16px calc(16px + var(--safe-b));
}
@keyframes up { from { transform: translateY(24px); opacity: .6; } }
.grabber {
  width: 36px;
  height: 4px;
  border-radius: 4px;
  background: #4a4a4a;
  margin: 6px auto 10px;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(8px + var(--safe-t)) 12px 8px;
  border-bottom: 1px solid #1f1f1f;
}
.sheet-head.tight, .sheet-half .sheet-head { padding: 0 0 8px; border: 0; }
.sheet-head h2, .sheet-head h3, .sheet-half h3 { margin: 0; font-size: 18px; }
.search-head { gap: 8px; }
.search-head input {
  flex: 1;
  background: #1c1c1c;
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
}
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  padding: 7px 12px;
  border-radius: 999px;
  background: #1c1c1c;
  font-size: 13px;
  font-weight: 600;
}
.chip.is-on { background: #fff; color: #000; }

.grid {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 0 2px 70px;
}
.tile {
  position: relative;
  aspect-ratio: 9/14;
  background: #1a1a1a;
  overflow: hidden;
}
.tile video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  background: #111;
}
.tile .n {
  position: absolute;
  left: 6px;
  bottom: 6px;
  font-size: 12px;
  font-weight: 700;
  text-shadow: 0 1px 3px #000;
}
.live-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: #ff2d55;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
}

.comments { flex: 1; min-height: 0; overflow: auto; padding: 4px 0 8px; }
.cmt { display: flex; gap: 10px; padding: 10px 0; }
.cmt img { width: 36px; height: 36px; border-radius: 50%; background: #333; }
.cmt b { display: block; font-size: 13px; color: #9a9a9a; }
.cmt p { margin: 2px 0 0; font-size: 14px; }
.composer {
  display: flex;
  gap: 8px;
  border-top: 1px solid #2a2a2a;
  padding-top: 10px;
}
.composer input {
  flex: 1;
  background: #222;
  border: 0;
  border-radius: 20px;
  padding: 10px 14px;
  outline: none;
}
.btn-primary, .composer button { font-weight: 700; }
.btn-primary {
  width: 100%;
  margin-top: 10px;
  background: var(--blue);
  border-radius: 999px;
  padding: 12px;
}
.btn-ghost { width: 100%; margin-top: 12px; padding: 12px; color: #bbb; }
.text-btn { color: #ddd; padding: 8px; font-weight: 700; }

.share-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 8px 0 4px;
}
.share-item { display: grid; place-items: center; gap: 6px; font-size: 12px; }
.share-item i {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 20px;
  background: #2a2a2a;
}

.profile { padding: 18px 16px 80px; overflow: auto; }
.p-top { display: flex; gap: 16px; align-items: center; }
.p-top img { width: 84px; height: 84px; border-radius: 50%; background: #333; object-fit: cover; }
.stats { display: flex; gap: 18px; }
.stats b { display: block; font-size: 18px; }
.stats span { color: #9a9a9a; font-size: 12px; }
.p-name { margin: 14px 0 4px; font-size: 20px; }
.muted { color: var(--muted); font-size: 13px; line-height: 1.5; }
.auth-form { display: grid; gap: 10px; margin-top: 8px; }
.auth-form input {
  background: #222;
  border: 0;
  border-radius: 10px;
  padding: 12px;
  outline: none;
}
.auth-error {
  margin: 0;
  color: #ff5a7a;
  font-size: 13px;
}
.empty-works {
  margin-top: 28px;
  text-align: center;
  padding: 36px 16px;
  color: #8a8a8a;
}
.empty-works strong {
  display: block;
  color: #fff;
  font-size: 16px;
  margin-bottom: 8px;
}
.legal { padding: 16px; overflow: auto; color: #ccc; font-size: 14px; line-height: 1.6; }
.legal h3 { color: #fff; }

.toast {
  position: absolute;
  left: 50%;
  bottom: 110px;
  transform: translateX(-50%);
  background: rgba(20,20,20,.92);
  border: 1px solid #333;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 50;
  pointer-events: none;
}
.mute-hint,
.mute-hint {
  position: absolute;
  top: calc(58px + var(--safe-t));
  left: 50%;
  transform: translateX(-50%);
  z-index: 7;
  background: rgba(0,0,0,.55);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
}

.caption, .music, .disc { display: none; }

.gate-lang {
  position: absolute;
  top: 10px;
  right: 10px;
  min-width: 40px;
  height: 28px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid #333;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}
.lang-list {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 0 8px;
  max-height: 52vh;
}
.lang-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  padding: 12px;
  border-radius: 10px;
  background: #1c1c1c;
}
.lang-item small { color: #8a8a8a; }
.lang-item.is-on { background: #fff; color: #000; }
.lang-item.is-on small { color: #555; }
.lang-row {
  width: 100%;
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 12px;
  border-radius: 12px;
  background: #1a1a1a;
  color: #fff;
  font-size: 15px;
}
.lang-row b { font-weight: 600; color: #bdbdbd; }

@media (min-width: 500px) {
  body { background: #050505; }
  .phone { box-shadow: 0 0 0 1px #1a1a1a, 0 20px 80px rgba(0,0,0,.6); }
}
