:root {
  --bg: #090b0f;
  --text: #f5f7fa;
  --text-muted: rgba(245, 247, 250, 0.52);
  --text-dim: rgba(245, 247, 250, 0.3);
  --line: rgba(255, 255, 255, 0.08);
  --accent: #7dd3fc;
  --pink: #fb7185;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

/* Douyin-style Centered Plain-Text Top Nav */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  height: calc(var(--safe-top) + 54px);
  padding: calc(var(--safe-top) + 8px) 20px 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(9, 11, 15, 0.92) 0%, rgba(9, 11, 15, 0) 100%);
  pointer-events: none;
}

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 28px;
  pointer-events: auto;
}

.nav-tab {
  position: relative;
  border: none;
  background: transparent;
  padding: 6px 2px;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.16s ease;
}

.nav-tab.active {
  color: #ffffff;
  font-weight: 600;
}

.nav-tab.active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -2px;
  transform: translateX(-50%);
  width: 18px;
  height: 2.5px;
  border-radius: 999px;
  background: #ffffff;
}

.copy-btn {
  position: absolute;
  right: 18px;
  top: calc(var(--safe-top) + 14px);
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  padding: 4px 6px;
  cursor: pointer;
  pointer-events: auto;
}

/* Vertical Douyin Feed */
.feed {
  width: 100%;
  height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  overscroll-behavior-y: contain;
  scrollbar-width: none;
}

.feed::-webkit-scrollbar {
  display: none;
}

.product-card {
  position: relative;
  width: 100%;
  height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
  background: var(--bg);
}

/* Horizontal 2-Slide Track */
.slides-track {
  display: flex;
  width: 100%;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.slides-track::-webkit-scrollbar {
  display: none;
}

.slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow-y: auto;
  scrollbar-width: none;
}

.slide::-webkit-scrollbar {
  display: none;
}

/* Slide 1: Ultra-Clean Hero */
.slide-hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(var(--safe-top) + 64px) 64px calc(var(--safe-bottom) + 64px) 26px;
}

.hero-audience {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 14px;
  letter-spacing: 0.01em;
}

.hero-action {
  margin: 0;
  font-size: clamp(26px, 7vw, 34px);
  line-height: 1.42;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #ffffff;
}

.hero-proof {
  margin-top: 22px;
  font-size: 14px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Slide 2: Clean Typographic Breakdown */
.slide-detail {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(var(--safe-top) + 66px) 62px calc(var(--safe-bottom) + 64px) 26px;
}

.detail-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 24px;
}

.detail-name {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #ffffff;
}

.detail-rev {
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.detail-sections {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.detail-item {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.detail-item:first-child {
  padding-top: 0;
  border-top: none;
}

.detail-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: 0.03em;
}

.detail-label.accent {
  color: var(--accent);
}

.detail-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.62;
  color: rgba(245, 247, 250, 0.9);
}

.detail-links {
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.detail-link {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
}

.detail-link:hover {
  color: #ffffff;
}

/* Bottom Centered 2 Tiny Dots */
.dots-indicator {
  position: absolute;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 22px);
  transform: translateX(-50%);
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dot-hit {
  border: none;
  background: transparent;
  padding: 6px 2px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: width 0.18s ease, background 0.18s ease, border-radius 0.18s ease;
}

.dot-hit.active .dot {
  width: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
}

/* Right-Bottom Douyin Vertical Minimal Icons */
.rail-actions {
  position: absolute;
  right: 12px;
  bottom: calc(var(--safe-bottom) + 52px);
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.rail-btn {
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.14s ease, color 0.18s ease;
}

.rail-btn:active {
  transform: scale(0.86);
}

.rail-btn svg {
  width: 26px;
  height: 26px;
}

.rail-btn.liked {
  color: var(--pink);
}

/* Empty & Loading */
.state-screen {
  width: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.loader {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-top-color: rgba(255, 255, 255, 0.75);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 56px);
  transform: translateX(-50%) translateY(10px);
  background: rgba(28, 32, 42, 0.92);
  color: #ffffff;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 40;
}

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

@media (min-width: 768px) {
  .product-card {
    display: flex;
    justify-content: center;
  }

  .slides-track {
    max-width: 460px;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
  }

  .rail-actions {
    right: calc(50% - 222px);
  }
}
