*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #fff5f7;
  --bg-soft: #ffe4ec;
  --card: #ffffff;
  --text: #4a2c35;
  --muted: #a67b88;
  --grad-start: #fb7185;
  --grad-end: #f472b6;
  --grad-warm: #fdba74;
  --tag-active: #ec4899;
  --tag-active-glow: rgba(236, 72, 153, 0.4);
  --nav-active: #db2777;
  --fab-bg: linear-gradient(180deg, #f472b6 0%, #ec4899 100%);
  --shadow-soft: 0 4px 20px rgba(236, 72, 153, 0.12);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 56px;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

/* 统一点击反馈 */
button,
.tag,
.fab-item,
.search-submit,
.tags-toggle,
.video-card,
.tab {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button:not(:disabled),
.tag,
.fab-item,
.search-submit,
.tags-toggle {
  transition: transform 0.14s cubic-bezier(0.34, 1.2, 0.64, 1), box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

button:not(:disabled):active,
.tag:active,
.fab-item:active,
.search-submit:active,
.tags-toggle:active {
  transform: scale(0.94);
}

.video-card {
  transition: transform 0.16s ease, opacity 0.16s ease;
  border-radius: 4px;
}

.video-card:active {
  transform: scale(0.97);
  opacity: 0.92;
}

.tab {
  transition: transform 0.12s ease, color 0.18s ease;
}

.tab:active {
  transform: scale(0.92);
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 8px);
  background: linear-gradient(180deg, var(--bg-soft) 0%, var(--bg) 28%, var(--bg) 100%);
}

/* 顶栏品牌 */
.top-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px 6px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
}

.brand-shield {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: linear-gradient(135deg, #fb7185, #ec4899);
  box-shadow: 0 2px 8px rgba(236, 72, 153, 0.35), inset 0 0 0 2px rgba(255, 255, 255, 0.4);
  position: relative;
}

.brand-shield::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
}

.brand-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: linear-gradient(90deg, #db2777, #f472b6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* 搜索区渐变 */
.search-bar-wrap {
  padding: 10px 12px 14px;
  background: linear-gradient(135deg, var(--grad-start) 0%, var(--grad-end) 55%, var(--grad-warm) 100%);
  box-shadow: 0 6px 24px rgba(244, 114, 182, 0.25);
}

.search-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-field {
  flex: 1;
  min-width: 0;
}

.search-field input {
  width: 100%;
  height: 40px;
  border: none;
  border-radius: 20px;
  padding: 0 16px;
  font-size: 14px;
  background: #fff;
  outline: none;
}

.search-field input::placeholder {
  color: #aaa;
}

.search-submit {
  flex-shrink: 0;
  height: 40px;
  padding: 0 18px;
  border: none;
  border-radius: 999px;
  background: #fff;
  color: #db2777;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(157, 23, 77, 0.2);
}

.search-submit:active {
  background: #fff5f7;
  box-shadow: 0 2px 8px rgba(157, 23, 77, 0.15);
}

/* 分类标签 */
.tags-section {
  position: relative;
  padding: 12px 40px 8px 12px;
  background: var(--bg);
}

.tags-section.collapsed .tags-grid {
  max-height: 88px;
  overflow: hidden;
}

.tags-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: none;
  transition: max-height 0.25s ease;
}

.tag {
  border: 1px solid rgba(251, 207, 232, 0.8);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: #7c4d58;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s, color 0.15s;
}

.tag.active {
  color: #fff;
  background: var(--tag-active);
  box-shadow: 0 0 0 1px var(--tag-active), 0 4px 14px var(--tag-active-glow);
  font-weight: 700;
}

.tags-toggle {
  position: absolute;
  right: 10px;
  top: 14px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: var(--card);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.tags-section.collapsed .tags-toggle svg {
  transform: rotate(180deg);
}

/* 视频网格 */
.feed {
  padding: 4px 10px 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 10px;
}

.video-card {
  display: block;
  background: transparent;
}

.thumb-wrap {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 16 / 11;
  background: #fecdd3;
  box-shadow: var(--shadow-soft);
}

.thumb-wrap img,
.thumb-wrap .thumb-ph {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-ph {
  background: linear-gradient(145deg, #64748b, #94a3b8);
}

.thumb-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fb7185;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9);
}

.thumb-meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 8px 6px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
  font-size: 11px;
  color: #fff;
}

.thumb-views {
  display: flex;
  align-items: center;
  gap: 3px;
  opacity: 0.95;
}

.thumb-views svg {
  width: 12px;
  height: 12px;
  opacity: 0.9;
}

.video-title {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em;
}

/* 右侧浮条 */
.fab-rail {
  position: fixed;
  right: max(8px, calc(50% - 240px + 8px));
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 72px);
  z-index: 120;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  width: 44px;
  border-radius: 22px;
  overflow: hidden;
  background: var(--fab-bg);
  box-shadow: 0 6px 20px rgba(236, 72, 153, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.fab-item {
  border: none;
  background: transparent;
  color: #fff;
  padding: 10px 0 8px;
  font-size: 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.fab-item + .fab-item {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.fab-item:active {
  background: rgba(255, 255, 255, 0.08);
}

/* 底栏 */
.tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 480px;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex;
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid #fce7f3;
  box-shadow: 0 -4px 24px rgba(244, 114, 182, 0.08);
  z-index: 100;
  backdrop-filter: blur(10px);
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 11px;
  color: var(--muted);
  padding-top: 6px;
}

.tab-icon {
  width: 22px;
  height: 22px;
}

.tab.active {
  color: var(--nav-active);
  font-weight: 600;
}

.tab.active .tab-icon {
  stroke: var(--nav-active);
}

/* 子页 */
.sub-page {
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom));
}

.sub-header {
  text-align: center;
  padding: 14px;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(90deg, #fb7185, #f472b6);
  border-bottom: none;
  box-shadow: 0 4px 16px rgba(244, 114, 182, 0.2);
}

.sub-main {
  padding: 24px 16px;
}

.empty-tip {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-top: 40px;
}

.profile-btn {
  width: 100%;
  max-width: 280px;
  height: 46px;
  border: none;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.14s cubic-bezier(0.34, 1.2, 0.64, 1), box-shadow 0.18s ease, filter 0.15s ease;
}

.profile-btn:active {
  transform: scale(0.96);
  filter: brightness(1.03);
}

.profile-btn.outline:active {
  background: #fff5f7;
}

.profile-name {
  font-size: 16px;
  font-weight: 600;
}

@media (min-width: 481px) {
  body {
    background: linear-gradient(160deg, #ffe4e6 0%, #fce7f3 50%, #ffedd5 100%);
  }
  .app {
    box-shadow: 0 12px 48px rgba(236, 72, 153, 0.15);
    border-radius: 0 0 16px 16px;
  }
}
