:root {
  --bg: #1d1d27;
  --panel: #29293a;
  --muted: #9c9ca8;
  --gold: #ffad16;
  --pink: #ff5d9c;
  --white: #f7f7fa;
  --header-h: 120px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { background: #111117; }

body {
  margin: 0;
  min-height: 100vh;
  background: #111117;
  color: var(--white);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { border: 0; color: inherit; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  position: relative;
  width: 100%;
  max-width: 520px;
  min-height: 100vh;
  margin: 0 auto;
  padding: calc(var(--header-h) + 7px) 0 calc(84px + env(safe-area-inset-bottom));
  background: var(--bg);
  box-shadow: 0 0 48px rgb(0 0 0 / .3);
}

.site-header {
  position: fixed;
  z-index: 20;
  top: 0;
  left: 50%;
  width: 100%;
  max-width: 520px;
  height: var(--header-h);
  transform: translateX(-50%);
  background: rgb(29 29 39 / .96);
  backdrop-filter: blur(14px);
}

.category-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 19px 4px 2px;
}

.category {
  position: relative;
  padding: 8px 2px 12px;
  background: transparent;
  color: #8f8f9d;
  font-size: 16px;
  cursor: pointer;
  transition: color .2s ease, transform .2s ease;
}

.category.active {
  color: #fff;
  font-weight: 750;
}

.category.active::after {
  position: absolute;
  bottom: 3px;
  left: 50%;
  width: 28px;
  height: 3px;
  border-radius: 3px;
  background: var(--gold);
  content: "";
  transform: translateX(-50%);
}

.category:active { transform: scale(.96); }

.search {
  display: flex;
  gap: 8px;
  padding: 13px 12px 12px;
}

.search-field {
  position: relative;
  flex: 1;
}

.search-field input {
  width: 100%;
  height: 37px;
  padding: 0 15px 0 40px;
  border: 1px solid #dedee4;
  border-radius: 22px;
  outline: none;
  background: #fff;
  color: #1b1b25;
  font-size: 14px;
}

.search-field input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgb(255 173 22 / .14);
}

.search-icon {
  position: absolute;
  z-index: 1;
  top: 9px;
  left: 15px;
  width: 16px;
  height: 16px;
  border: 2px solid #8e8e97;
  border-radius: 50%;
}

.search-icon::after {
  position: absolute;
  right: -5px;
  bottom: -3px;
  width: 7px;
  height: 2px;
  border-radius: 1px;
  background: #8e8e97;
  content: "";
  transform: rotate(45deg);
}

.search-button {
  min-width: 66px;
  height: 37px;
  border-radius: 20px;
  background: linear-gradient(135deg, #ff7600, #ffad16);
  box-shadow: 0 6px 18px rgb(255 132 0 / .22);
  color: #fff;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
}

.promo-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 12px;
}

.promo {
  position: relative;
  display: flex;
  min-width: 0;
  height: 105px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  overflow: hidden;
  border-radius: 18px;
  color: #fff;
  font-size: 16px;
  font-weight: 750;
  cursor: pointer;
  isolation: isolate;
  transition: transform .18s ease, filter .18s ease;
}

.promo::before,
.promo::after {
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  background: rgb(255 255 255 / .15);
  content: "";
}

.promo::before { top: -40px; right: -23px; width: 110px; height: 110px; }
.promo::after { bottom: -48px; left: -25px; width: 92px; height: 92px; }
.promo:active { transform: scale(.975); filter: brightness(.96); }

.promo-blue {
  background: linear-gradient(135deg, #4779fc, #812fe1);
  box-shadow: inset 0 0 0 2px rgb(129 60 241 / .35), 0 8px 24px rgb(76 65 225 / .18);
}

.promo-pink {
  background: linear-gradient(135deg, #ff4e94, #ff89bb);
  box-shadow: inset 0 0 0 2px rgb(255 118 175 / .32), 0 8px 24px rgb(255 77 145 / .18);
}

.promo-art {
  position: relative;
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 2px solid rgb(255 255 255 / .55);
  border-radius: 50%;
  background: rgb(255 255 255 / .2);
  box-shadow: 0 6px 12px rgb(0 0 0 / .12);
}

.gift-art i { width: 25px; height: 20px; border-radius: 4px; background: #fff; box-shadow: inset 0 8px 0 #ffd46a; }
.gift-art i::before { display: block; width: 3px; height: 20px; margin: 0 auto; background: #ff8466; content: ""; }
.gift-art i::after { position: absolute; top: 10px; left: 21px; width: 9px; height: 7px; border: 3px solid #fff; border-radius: 8px 8px 0 8px; content: ""; transform: rotate(-23deg); }
.task-art i { position: relative; width: 22px; height: 27px; border-radius: 4px; background: #fff; }
.task-art i::before { position: absolute; top: 6px; left: 5px; width: 12px; height: 2px; background: #ff7aa8; box-shadow: 0 5px #ff7aa8, 0 10px #ff7aa8; content: ""; }

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 13px 7px;
}

.section-heading h1 {
  position: relative;
  margin: 0;
  padding-left: 12px;
  color: #fff;
  font-size: 16px;
  line-height: 25px;
}

.section-heading h1::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  border-radius: 3px;
  background: var(--gold);
  content: "";
}

.section-heading span { color: #aaaab5; font-size: 13px; }

.video-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 10px;
  padding: 7px 12px 12px;
}

.video-card {
  min-width: 0;
  padding: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}

.thumbnail {
  position: relative;
  display: block;
  width: 100%;
  height: 130px;
  overflow: hidden;
  border-radius: 12px;
  background: var(--card);
  box-shadow: 0 7px 18px rgb(0 0 0 / .18);
}

.thumbnail-art {
  position: absolute;
  display: block;
  inset: 0;
  background: var(--art);
  transition: transform .3s ease;
}

.thumbnail-art::before {
  position: absolute;
  top: 14px;
  left: 15px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgb(255 255 255 / .2);
  box-shadow: 73px 52px 0 17px rgb(255 255 255 / .1), 116px -18px 0 10px rgb(255 255 255 / .12);
  content: "";
}

.thumbnail-art::after {
  position: absolute;
  right: -10%;
  bottom: -52%;
  left: -10%;
  height: 92%;
  border-radius: 50% 50% 0 0;
  background: rgb(14 16 35 / .32);
  content: "";
  transform: rotate(-5deg);
}

.thumbnail-image {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-card:hover .thumbnail-art { transform: scale(1.04); }

.play-lock {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgb(255 255 255 / .58);
  border-radius: 50%;
  background: rgb(17 17 27 / .55);
  box-shadow: 0 5px 15px rgb(0 0 0 / .22);
  transform: translate(-50%, -50%);
  backdrop-filter: blur(5px);
}

.play-lock::before {
  width: 0;
  height: 0;
  margin-left: 3px;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 9px solid #fff;
  content: "";
}

.thumb-meta {
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 19px 8px 6px;
  background: linear-gradient(transparent, rgb(0 0 0 / .62));
  color: #fff;
  font-size: 11px;
}

.video-title {
  display: -webkit-box;
  min-height: 36px;
  margin: 7px 1px 0;
  overflow: hidden;
  color: #a4a4ae;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 13px 12px 22px;
}

.page-button {
  width: 31px;
  height: 31px;
  border-radius: 50%;
  background: #2a2a3b;
  color: #bcbcc5;
  font-size: 13px;
  cursor: pointer;
}

.page-button.active {
  background: linear-gradient(135deg, #ff7900, #ffae15);
  color: #fff;
  font-weight: 750;
}

.empty-state {
  padding: 48px 20px;
  color: #858592;
  text-align: center;
}

.empty-state > span { font-size: 45px; line-height: 1; }
.empty-state p { margin: 10px 0 14px; }
.empty-state button { padding: 8px 14px; border-radius: 16px; background: #303043; cursor: pointer; }

.bottom-nav {
  position: fixed;
  z-index: 20;
  bottom: 0;
  left: 50%;
  display: grid;
  width: 100%;
  max-width: 520px;
  height: calc(62px + env(safe-area-inset-bottom));
  grid-template-columns: repeat(4, 1fr);
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 1px solid #33333f;
  background: rgb(23 23 31 / .97);
  transform: translateX(-50%);
  backdrop-filter: blur(16px);
}

.bottom-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: transparent;
  color: #8b8b96;
  font-size: 11px;
  cursor: pointer;
}

.bottom-item.active { color: var(--gold); }
.nav-glyph { position: relative; display: block; width: 22px; height: 22px; opacity: .75; }
.bottom-item.active .nav-glyph { opacity: 1; }
.home-icon::before { position: absolute; top: 7px; left: 4px; width: 14px; height: 12px; border-radius: 3px; background: currentColor; content: ""; }
.home-icon::after { position: absolute; top: 3px; left: 5px; width: 12px; height: 12px; background: currentColor; content: ""; transform: rotate(45deg); }
.circle-icon { border: 3px solid currentColor; border-radius: 50%; box-shadow: inset 0 0 0 3px var(--bg); }
.circle-icon::after { position: absolute; top: 7px; left: 7px; width: 3px; height: 3px; border-radius: 50%; background: currentColor; content: ""; }
.live-icon { width: 20px; height: 15px; margin-top: 3px; border: 2px solid currentColor; border-radius: 4px; }
.live-icon::after { position: absolute; top: 3px; right: -5px; border-top: 4px solid transparent; border-bottom: 4px solid transparent; border-left: 5px solid currentColor; content: ""; }
.person-icon::before { position: absolute; top: 1px; left: 7px; width: 9px; height: 9px; border-radius: 50%; background: currentColor; content: ""; }
.person-icon::after { position: absolute; bottom: 0; left: 3px; width: 16px; height: 10px; border-radius: 9px 9px 4px 4px; background: currentColor; content: ""; }

.modal {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  visibility: hidden;
  place-items: center;
  padding: 20px;
  opacity: 0;
  transition: visibility .22s, opacity .22s ease;
}

.modal.show { visibility: visible; opacity: 1; }
.modal-backdrop { position: absolute; inset: 0; background: rgb(5 5 10 / .72); cursor: pointer; backdrop-filter: blur(3px); }

.modal-card {
  position: relative;
  z-index: 1;
  width: min(100%, 340px);
  padding: 28px 22px 20px;
  border-radius: 16px;
  background: #fff;
  color: #22222a;
  text-align: center;
  box-shadow: 0 26px 80px rgb(0 0 0 / .42);
  transform: translateY(12px) scale(.98);
  transition: transform .22s ease;
}

.modal.show .modal-card { transform: none; }
.modal-close { position: absolute; top: 8px; right: 10px; padding: 4px 8px; background: transparent; color: #aaaab2; font-size: 25px; cursor: pointer; }
.modal-card h2 { margin: 0 0 7px; font-size: 19px; }
.modal-card > p { margin: 0; color: #666671; font-size: 13px; line-height: 1.55; }
.privacy-note { margin: 12px 0; padding: 7px 10px; border: 1px solid #ffe1a9; border-radius: 20px; background: #fff9ee; color: #986200; font-size: 12px; }
.privacy-note span { display: inline-block; width: 7px; height: 7px; margin-right: 3px; border-radius: 50%; background: #2fbd6d; }

.channel-buttons { display: grid; gap: 9px; margin-bottom: 12px; }
.channel-button { min-height: 42px; border-radius: 11px; color: #fff; font-size: 15px; font-weight: 750; cursor: pointer; }
.channel-button.gold { background: linear-gradient(135deg, #ff8500, #ffac16); }
.channel-button.pink { background: linear-gradient(135deg, #f22b8f, #ff6cad); }
.channel-button small { display: block; margin-top: 1px; font-size: 11px; font-weight: 400; }

.code-form { display: flex; gap: 9px; }
.code-form input { min-width: 0; height: 40px; flex: 1; padding: 0 11px; border: 1px solid #d7d7dd; border-radius: 8px; outline: none; background: #f5f5f7; color: #222; font-size: 13px; }
.code-form input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgb(255 173 22 / .13); }
.code-form button { height: 40px; padding: 0 18px; border-radius: 8px; background: linear-gradient(135deg, #ff7900, #ffad16); color: #fff; font-weight: 750; cursor: pointer; }
.modal-card .code-help { margin-top: 7px; color: #999; font-size: 11px; }
.modal-card .code-error { min-height: 16px; margin-top: 1px; color: #e93e51; font-size: 12px; }

.toast {
  position: fixed;
  z-index: 120;
  bottom: 82px;
  left: 50%;
  max-width: calc(100% - 40px);
  padding: 10px 16px;
  border: 1px solid rgb(255 255 255 / .1);
  border-radius: 20px;
  background: rgb(10 10 15 / .88);
  box-shadow: 0 8px 25px rgb(0 0 0 / .28);
  color: #fff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity .2s, transform .2s;
  backdrop-filter: blur(10px);
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 521px) {
  .thumbnail { height: 150px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
