:root {
  color-scheme: dark;
  --bg: #07111f;
  --bg-soft: #0e2036;
  --card: rgba(18, 38, 61, 0.82);
  --card-border: rgba(174, 220, 255, 0.16);
  --text: #f5f9ff;
  --muted: #9bb1c9;
  --accent: #66d9ff;
  --accent-2: #ffb86c;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  background:
    radial-gradient(circle at 8% 12%, rgba(34, 137, 255, 0.24), transparent 34rem),
    radial-gradient(circle at 92% 88%, rgba(255, 146, 78, 0.16), transparent 32rem),
    linear-gradient(145deg, var(--bg) 0%, var(--bg-soft) 52%, #07111f 100%);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  opacity: 0.34;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 82%);
}

.page-shell {
  width: min(1180px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  padding:
    max(26px, env(safe-area-inset-top))
    clamp(16px, 4vw, 48px)
    max(26px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.page-header {
  max-width: 760px;
  margin: 0 auto clamp(28px, 5vw, 54px);
  text-align: center;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

body.is-ready .page-header {
  opacity: 1;
  transform: translateY(0);
}

.eyebrow {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.24em;
}

.page-header h1 {
  margin: 0;
  font-size: clamp(2.2rem, 8vw, 4.8rem);
  line-height: 1.02;
  letter-spacing: -0.055em;
  text-wrap: balance;
}

.page-header p {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: clamp(0.94rem, 2.5vw, 1.1rem);
}

.nav-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(16px, 3vw, 30px);
  align-items: start;
}

.gif-card {
  display: block;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  border-radius: var(--radius);
  outline: none;
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.65s ease, transform 0.65s ease;
}

body.is-ready .gif-card {
  opacity: 1;
  transform: translateY(0);
}

body.is-ready .gif-card:nth-child(2) {
  transition-delay: 0.1s;
}

.gif-frame {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(102, 217, 255, 0.14), rgba(255, 184, 108, 0.08));
  box-shadow: var(--shadow);
  isolation: isolate;
  transform: translateZ(0);
  transition: transform 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
}

.gif-frame::after {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  content: "";
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.gif-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #12243a;
}

.gif-shine {
  position: absolute;
  inset: -45% auto -45% -35%;
  z-index: 1;
  width: 28%;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transform: rotate(16deg);
  transition: transform 0.7s ease, opacity 0.25s ease;
}

.gif-badge {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 3;
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(5, 15, 28, 0.74);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.gif-badge b {
  color: var(--accent);
  font-size: 0.96rem;
}

.gif-caption {
  display: block;
  margin: 13px 4px 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: center;
  transition: color 0.25s ease;
}

.gif-card:focus-visible .gif-frame {
  border-color: var(--accent);
  box-shadow:
    var(--shadow),
    0 0 0 4px rgba(102, 217, 255, 0.2);
}

.gif-card:focus-visible .gif-caption {
  color: var(--text);
}

.gif-card.is-broken .gif-frame {
  display: grid;
  place-items: center;
  background:
    linear-gradient(145deg, rgba(102, 217, 255, 0.18), rgba(255, 184, 108, 0.12)),
    #10233a;
}

.gif-card.is-broken .gif-frame::before {
  content: "GIF 图片未找到";
  color: var(--muted);
  font-size: 0.9rem;
}

.gif-card.is-broken img {
  display: none;
}

.noscript-tip {
  margin: 0;
  padding: 12px;
  color: #ffd7a6;
  text-align: center;
  background: #2c1b08;
}

@media (hover: hover) and (pointer: fine) {
  .gif-card:hover .gif-frame {
    border-color: rgba(102, 217, 255, 0.56);
    box-shadow:
      0 30px 80px rgba(0, 0, 0, 0.48),
      0 0 0 1px rgba(102, 217, 255, 0.18);
    transform: translateY(-5px);
  }

  .gif-card:hover .gif-shine {
    opacity: 1;
    transform: translateX(560%) rotate(16deg);
  }

  .gif-card:hover .gif-caption {
    color: var(--text);
  }
}

@media (max-width: 720px) {
  .page-shell {
    justify-content: flex-start;
    padding-top: max(42px, env(safe-area-inset-top));
  }

  .page-header {
    margin-bottom: 26px;
  }

  .nav-grid {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .gif-frame {
    aspect-ratio: 16 / 11;
    border-radius: 20px;
  }

  .gif-badge {
    right: 12px;
    bottom: 12px;
    padding: 7px 10px;
  }
}

@media (max-width: 380px) {
  .page-shell {
    padding-right: 12px;
    padding-left: 12px;
  }

  .page-header h1 {
    font-size: 2rem;
  }

  .gif-frame {
    border-radius: 17px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .page-header,
  .gif-card {
    opacity: 1;
    transform: none;
  }
}
