* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: #f3eee6;
  color: #141414;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
body.dark { background: #111; }
#app {
  min-height: 100vh;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}
button {
  font-family: inherit;
  border: 0;
  background: none;
  padding: 0;
  color: inherit;
  cursor: pointer;
}
button:focus-visible,
input:focus-visible {
  outline: 2px solid #ff3b6b;
  outline-offset: 2px;
}
input {
  font-family: inherit;
}
img { max-width: 100%; }
.hidden { display: none !important; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 48px;
  transform: translateX(-50%);
  background: rgba(20, 20, 20, .88);
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  z-index: 200;
  max-width: 80%;
}

.home { padding: 12px 20px 40px; }
.nav { display: flex; align-items: center; justify-content: center; height: 44px; }
.kicker { font-size: 10px; letter-spacing: 2px; color: #ff3b6b; font-weight: 700; }
.hero { padding: 24px 0 16px; text-align: center; }
.logo-row { display: flex; justify-content: center; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.logo { font-size: 36px; font-weight: 800; line-height: 1; }
.logo.accent { color: #ff3b6b; }
.subtitle { display: block; margin-top: 9px; color: #7a7468; font-size: 14px; }
.search-card { background: #fff; border-radius: 14px; padding: 6px; box-shadow: 0 8px 20px rgba(40,24,8,.08); }
.search-input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  font-size: 14px;
  border: 0;
  outline: none;
  background: transparent;
}
.search-input::placeholder { color: #b3ab9e; }
.search-actions { display: flex; gap: 6px; padding: 4px; }
.icon-btn, .go-btn {
  height: 38px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}
.icon-btn { flex: 0 0 70px; background: #f3eee6; color: #7a7468; font-size: 13px; }
.go-btn { flex: 1; background: #111; color: #fff; font-size: 14px; font-weight: 700; letter-spacing: 2px; }
.go-btn:disabled { opacity: .55; }
.error { display: block; color: #ff3b6b; margin-top: 10px; font-size: 13px; min-height: 1em; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0; }
.chip { background: #fff; color: #7a7468; font-size: 12px; padding: 5px 10px; border-radius: 999px; }
.block { background: #fff; border-radius: 12px; padding: 4px 12px; }
.block-head { display: flex; justify-content: space-between; padding: 9px 0; }
.block-title { font-size: 12px; color: #7a7468; }
.block-clear { font-size: 12px; color: #ff3b6b; }
.history-item { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; border-top: 1px solid #f0eae0; width: 100%; text-align: left; }
.history-text { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-del { width: 24px; text-align: right; color: #b3ab9e; }
.tips { margin-top: 24px; }
.tip-title { display: block; font-weight: 700; margin-bottom: 6px; }
.tip { display: block; color: #7a7468; font-size: 13px; line-height: 1.7; }

.video-page { min-height: 100vh; background: #111; padding-bottom: 20px; color: #f4efe6; position: relative; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  padding: 0 8px;
  position: sticky;
  top: 0;
  z-index: 5;
}
.video-page .topbar { background: #111; }
.profile-page .topbar { background: #f3eee6; margin: 0 -12px; padding: 0 4px; }
.back {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: inherit;
  flex: 0 0 40px;
}
.back svg { width: 22px; height: 22px; display: block; }
.video-page .back {
  background: rgba(255,255,255,.08);
  color: #fff;
}
.back.spacer { visibility: hidden; pointer-events: none; }
.topbar .title { font-size: 15px; font-weight: 700; }
.state { text-align: center; padding: 60px 20px; }
.video-page .state { color: #fff; }
.video-page .state.error { color: #ff8aa8; }
.video-stage { width: 100%; }
.player, .media { width: 100%; height: 420px; background: #000; position: relative; }
.nav-photo {
  display: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0,0,0,.45);
  color: #fff;
  font-size: 28px;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.nav-photo.prev { left: 12px; }
.nav-photo.next { right: 12px; }
.swiper {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  height: 420px;
}
.photo {
  flex: 0 0 100%;
  width: 100%;
  height: 420px;
  object-fit: contain;
  scroll-snap-align: start;
  background: #000;
}
.photo-count { position: absolute; right: 12px; bottom: 12px; color: #fff; font-size: 12px; }
.vcard { margin: 12px; background: #1b1916; border-radius: 12px; padding: 16px; color: #f4efe6; }
.author { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: #333; object-fit: cover; }
.author-meta { display: flex; flex-direction: column; }
.name { font-size: 16px; font-weight: 700; }
.handle { color: #ff5c86; font-size: 13px; margin-top: 2px; }
.caption { display: block; margin-top: 10px; color: #cfc6b8; font-size: 14px; }
.stats { display: flex; justify-content: space-between; margin-top: 14px; padding: 12px 0; border-top: 1px solid #2c2924; border-bottom: 1px solid #2c2924; }
.stat { text-align: center; }
.num { display: block; font-weight: 700; }
.lbl { display: block; color: #9a9386; font-size: 11px; margin-top: 3px; }
.dl-row { display: flex; gap: 8px; margin-top: 14px; }
.dl {
  flex: 1;
  height: 40px;
  border-radius: 8px;
  background: #2c2924;
  color: #f4efe6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}
.dl.accent { background: #ff3b6b; color: #fff; font-weight: 700; }
.comments { margin-top: 0; }
.comments .block-title { font-size: 12px; letter-spacing: 2px; color: #9a9386; display: block; padding-bottom: 8px; }
.empty { color: #9a9386; padding: 12px 0; }
.comment { display: flex; gap: 8px; padding: 12px 0; border-top: 1px solid #2c2924; }
.comment.nested { padding: 8px 0 0; border-top: 0; }
.c-avatar { width: 32px; height: 32px; border-radius: 50%; background: #333; object-fit: cover; }
.c-avatar.sm { width: 24px; height: 24px; }
.c-body { flex: 1; }
.c-user { display: block; color: #ff5c86; font-size: 12px; }
.c-text { display: block; margin-top: 4px; font-size: 14px; }
.c-meta { display: block; margin-top: 4px; color: #9a9386; font-size: 11px; }
.c-reply { display: block; margin-top: 5px; color: #cfc6b8; font-size: 12px; }
.more { text-align: center; color: #cfc6b8; padding: 8px 0 4px; width: 100%; }
.dl-mask {
  position: fixed; left: 0; right: 0; top: 0; bottom: 0;
  background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; z-index: 99;
}
.dl-panel { width: 260px; background: #1b1916; border-radius: 12px; padding: 20px 18px 16px; }
.dl-label { display: block; color: #f4efe6; text-align: center; font-size: 14px; }
.dl-track { margin-top: 14px; height: 8px; background: #2c2924; border-radius: 999px; overflow: hidden; }
.dl-fill { height: 8px; background: #ff3b6b; border-radius: 999px; width: 0; }
.dl-pct { display: block; margin-top: 8px; text-align: center; color: #cfc6b8; font-size: 12px; }

.profile-page { padding: 0 12px 30px; }
.profile-page .state { color: #7a7468; }
.profile-page .state.error { color: #ff3b6b; }
.header { background: #fff; border-radius: 12px; padding: 16px; display: flex; gap: 12px; }
.header .avatar { width: 70px; height: 70px; background: #eee; }
.meta { flex: 1; min-width: 0; }
.header .name { display: block; font-size: 18px; }
.header .handle { display: block; color: #ff3b6b; margin-top: 4px; }
.bio { display: block; color: #7a7468; margin-top: 6px; font-size: 13px; }
.p-stats { display: flex; background: #fff; border-radius: 12px; margin-top: 8px; padding: 14px 0; }
.p-stats .stat { flex: 1; }
.p-stats .num { font-size: 16px; }
.p-stats .lbl { color: #7a7468; }
.tabs { display: flex; gap: 8px; margin: 12px 0; }
.tab {
  flex: 1;
  height: 36px;
  border-radius: 8px;
  background: #fff;
  color: #7a7468;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tab.on { background: #111; color: #fff; font-weight: 700; }
.profile-page .empty { text-align: center; color: #7a7468; padding: 24px 10px; line-height: 1.6; }
.grid { display: flex; flex-wrap: wrap; margin: 0 -2px; }
.gcard { width: 33.33%; box-sizing: border-box; padding: 2px; position: relative; overflow: hidden; }
.cover { width: 100%; height: auto; aspect-ratio: 3 / 4; border-radius: 4px; background: #111; object-fit: cover; display: block; }
.plays, .time { position: absolute; color: #fff; font-size: 11px; text-shadow: 0 1px 4px #000; }
.plays { left: 6px; bottom: 6px; }
.time { right: 6px; bottom: 6px; }
.profile-page .more { color: #7a7468; padding: 14px 0; }

@media (hover: hover) and (pointer: fine) {
  .go-btn:hover { background: #2a2a2a; }
  .icon-btn:hover,
  .history-del:hover { color: #141414; }
  .history-item:hover { background: #faf7f2; }
  .block-clear:hover,
  .c-reply:hover,
  .more:hover { opacity: .8; }
  .author:hover .handle { text-decoration: underline; }
  .video-page .back:hover { background: rgba(255,255,255,.18); }
  .profile-page .back:hover { background: rgba(0,0,0,.06); }
  .dl:hover { filter: brightness(1.12); }
  .tab:hover:not(.on) { background: #efeae3; }
  .gcard:hover .cover { filter: brightness(1.08); }
  .nav-photo:hover { background: rgba(0,0,0,.7); }
}

@media (min-width: 768px) {
  #app { max-width: 720px; }
  .home { padding: 28px 24px 56px; }
  .kicker { font-size: 11px; letter-spacing: 3px; }
  .logo { font-size: 44px; }
  .subtitle { font-size: 16px; }
  .search-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 8px 8px 16px;
  }
  .search-input { flex: 1; height: 48px; font-size: 16px; }
  .search-actions { padding: 0; flex: 0 0 auto; }
  .icon-btn, .go-btn { height: 44px; }
  .go-btn { flex: 0 0 132px; }
  .chips { justify-content: center; }
  .gcard { width: 25%; }
  .header { padding: 20px; }
  .header .avatar { width: 88px; height: 88px; }
  .profile-page { padding: 0 20px 48px; }
  .profile-page .topbar { margin: 0 -20px; padding: 0 12px; }
}

@media (min-width: 1024px) {
  #app { max-width: 1180px; }
  .home {
    max-width: 760px;
    margin: 0 auto;
    padding: 48px 24px 80px;
  }
  .video-page .topbar {
    position: absolute;
    left: 20px;
    top: 16px;
    width: auto;
    height: auto;
    padding: 0;
    background: transparent;
    z-index: 8;
  }
  .video-page .topbar .title,
  .video-page .topbar .spacer { display: none; }
  .video-page .back {
    width: 44px;
    height: 44px;
    background: rgba(0,0,0,.48);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 16px rgba(0,0,0,.28);
  }
  .video-page .back svg { width: 24px; height: 24px; }
  .video-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) 400px;
    gap: 18px;
    padding: 16px 20px 40px;
    align-items: start;
  }
  .video-side {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow: hidden;
  }
  .video-side .comments {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .video-side #comments-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: #4a453f transparent;
  }
  .video-side #comments-list::-webkit-scrollbar { width: 6px; }
  .video-side #comments-list::-webkit-scrollbar-track { background: transparent; }
  .video-side #comments-list::-webkit-scrollbar-thumb {
    background: #4a453f;
    border-radius: 99px;
  }
  .video-side #comments-list::-webkit-scrollbar-thumb:hover { background: #6a635b; }
  .vcard { margin: 0 0 12px; }
  .player, .media, .swiper, .photo { height: min(82vh, 900px); border-radius: 12px; }
  .video-stage { overflow: hidden; border-radius: 12px; }
  .nav-photo { display: flex; }
  .gcard { width: 20%; }
  .stats { gap: 8px; }
  .dl { min-width: 0; }
}
