*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-bg: #f3f0ea;
  --color-text: #1a1a1a;
  --color-muted: rgba(26, 26, 26, 0.5);
  --color-accent: #f5a87a;
  --card-width: clamp(110px, 14vw, 160px);
  --card-aspect: 9 / 16;
  --card-border: 1.5px;
  --card-radius: 20px;
  --card-shadow: 6px 6px 0 0 #1a1a1a;
  --card-shadow-active: 8px 8px 0 0 #1a1a1a;
  --transition: 0.4s cubic-bezier(0.34, 1.2, 0.64, 1);
}

html, body {
  height: 100%;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.is-playing {
  overflow: hidden;
}

.play-backdrop {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(243, 240, 234, 0.35);
  backdrop-filter: blur(18px) saturate(1.05);
  -webkit-backdrop-filter: blur(18px) saturate(1.05);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease;
}

.play-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.28;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 180px 180px;
}

body.is-playing .play-backdrop {
  opacity: 1;
  pointer-events: auto;
}

.gallery-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: clamp(1.25rem, 4vw, 2.5rem);
}

body.is-playing .gallery-page {
  pointer-events: none;
}

.gallery-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-bottom: clamp(1.5rem, 5vh, 3rem);
}

.gallery-header__back {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  color: var(--color-text);
  text-decoration: none;
  transition: opacity 0.2s;
}

.gallery-header__back:hover {
  opacity: 0.6;
}

.gallery-header__back-icon {
  font-size: 1rem;
}

.gallery-header__title {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: center;
  padding-bottom: 0.35rem;
  border-bottom: 1.5px solid var(--color-text);
}

.gallery-header__badge {
  justify-self: end;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
  border: 1.5px solid var(--color-text);
  padding: 0.35rem 0.75rem;
  border-radius: 0;
  box-shadow: 3px 3px 0 0 var(--color-text);
}

.gallery-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52vh;
  padding-bottom: 0.5rem;
}

.video-card {
  width: var(--card-width);
  aspect-ratio: var(--card-aspect);
  border: var(--card-border) solid var(--color-text);
  border-radius: var(--card-radius);
  background: #ffffff;
  box-shadow: var(--card-shadow);
  cursor: pointer;
  overflow: hidden;
  transition:
    transform var(--transition),
    box-shadow var(--transition);
}

.video-card__media {
  position: relative;
  width: 100%;
  height: 100%;
  aspect-ratio: var(--card-aspect);
  background: #ffffff;
  line-height: 0;
}

.video-card__thumb {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
  user-select: none;
}

.video-card__player {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.video-card__player[hidden] {
  display: none;
}

.video-card__player iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.video-card--playing {
  z-index: 200 !important;
  box-shadow: none;
  cursor: default;
  filter: none;
  isolation: isolate;
  border-radius: 20px;
  overflow: hidden;
}

.gallery-footer {
  text-align: center;
  padding-top: clamp(2rem, 5vh, 3.5rem);
  padding-bottom: 1rem;
}

.gallery-footer__tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text);
  background: var(--color-accent);
  border: var(--card-border) solid var(--color-text);
  padding: 0.3rem 0.85rem;
  box-shadow: 3px 3px 0 0 var(--color-text);
  margin-bottom: 0.75rem;
}

.gallery-footer__title {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
  transition: opacity 0.3s;
}

.gallery-footer__hint {
  font-size: 0.75rem;
  color: var(--color-muted);
  letter-spacing: 0.04em;
}

@media (max-width: 640px) {
  .gallery-header {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .gallery-header__title {
    grid-column: 1 / -1;
    order: -1;
  }

  .gallery-header__badge {
    justify-self: end;
  }
}

/* 竖屏卡片平铺 */
.card-fan--flat {
  position: relative;
  width: auto;
  max-width: min(960px, 96vw);
  min-height: auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: clamp(1rem, 2.5vw, 2rem);
  padding: 1rem 0;
  overflow: visible;
  flex-wrap: nowrap;
}

.card-fan--flat.is-entering {
  pointer-events: none;
}

.card-fan--flat.is-entering .video-card {
  will-change: transform;
}

.card-fan--flat .video-card {
  position: relative;
  flex-shrink: 0;
  width: var(--card-width);
  transform: none;
  z-index: 1;
  border-radius: var(--card-radius);
  overflow: hidden;
}

.card-fan--flat .video-card[data-index] {
  transform: none;
}

.card-fan--flat .video-card--hovered:not(.video-card--playing) {
  transform: scale(1.1) !important;
  z-index: 9 !important;
  box-shadow: var(--card-shadow-active);
}

.card-fan--flat .video-card__media {
  aspect-ratio: var(--card-aspect);
  border-radius: var(--card-radius);
}

.card-fan--flat .video-card__thumb {
  object-fit: cover;
  object-position: center;
  border-radius: var(--card-radius);
}

@media (max-width: 768px) {
  :root {
    --card-shadow: 4px 4px 0 0 #1a1a1a;
    --card-shadow-active: 6px 6px 0 0 #1a1a1a;
  }
}

@media (max-width: 720px) {
  .card-fan--flat {
    flex-direction: column;
    gap: 1.75rem;
  }

  .card-fan--flat .video-card {
    width: min(52vw, 200px);
  }
}

/* ── 播放手机外框（与 TikTok 同款 Mockup，无数据面板时居中） ── */
.phone-stage {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 200;
  pointer-events: none;
}

.phone-shell {
  --phone-inset-x: 5.25%;
  --phone-inset-top: 2.15%;
  --phone-inset-bottom: 2.15%;
  --phone-video-scale: 1;
  --phone-video-aspect: 0.5625;
  position: relative;
  width: min(320px, 42vw);
  aspect-ratio: 1450 / 2936;
  overflow: visible;
  pointer-events: auto;
  transform-origin: center center;
  filter: drop-shadow(0 18px 36px rgba(0, 0, 0, 0.28));
}

.phone-shell__screen {
  position: absolute;
  top: var(--phone-inset-top);
  right: var(--phone-inset-x);
  bottom: var(--phone-inset-bottom);
  left: var(--phone-inset-x);
  z-index: 1;
  overflow: hidden;
  background: #000;
  border-radius: 0.8cqw;
  container-type: size;
}

.phone-shell__frame {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  user-select: none;
  opacity: 0;
  transition: opacity 0.4s ease 0.18s;
}

.phone-shell.is-framed .phone-shell__frame {
  opacity: 1;
}

.phone-shell .video-card,
.phone-shell .video-card--playing {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  aspect-ratio: auto !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  transform: none !important;
  overflow: hidden !important;
  background: #000;
}

.phone-shell .video-card__media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  line-height: 0;
}

.phone-shell .video-card__thumb {
  position: absolute;
  top: 50%;
  left: 50%;
  height: 100%;
  width: calc(100cqh * var(--phone-video-aspect));
  max-width: none;
  object-fit: cover;
  transform: translate(-50%, -50%) scale(var(--phone-video-scale));
  transform-origin: center center;
}

.phone-shell .video-card__player {
  position: absolute !important;
  inset: 0 !important;
  display: block !important;
  overflow: hidden;
  background: #000;
}

.phone-shell .video-card__player[hidden] {
  display: none !important;
}

.phone-shell .video-card__player iframe {
  position: absolute;
  top: 50%;
  left: 50%;
  height: 100%;
  width: calc(100cqh * var(--phone-video-aspect));
  max-width: none;
  border: none;
  transform: translate(-50%, -50%) scale(var(--phone-video-scale));
  transform-origin: center center;
  background: #000;
}
