:root {
  color-scheme: dark;
  --header-height: 4.5rem;
  --ink: #f8f5ef;
  --muted: rgba(248, 245, 239, 0.68);
  --faint: rgba(248, 245, 239, 0.42);
  --line: rgba(255, 255, 255, 0.13);
  --panel: rgba(8, 8, 8, 0.72);
  --accent: #ff5533;
  --page: #050505;
  font-family: Inter, "SF Pro Display", "PingFang SC", "Noto Sans SC", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--page);
}

body {
  color: var(--ink);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

.site-header {
  position: fixed;
  z-index: 50;
  top: 0;
  right: 0;
  left: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  height: var(--header-height);
  align-items: center;
  padding: 0 clamp(1rem, 3vw, 2.5rem);
  border-bottom: 1px solid var(--line);
  background: rgba(5, 5, 5, 0.78);
  backdrop-filter: blur(22px) saturate(130%);
}

.brand {
  display: inline-flex;
  width: max-content;
  gap: 0.7rem;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 760;
  letter-spacing: 0.17em;
}

.brand-mark {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  font-family: Georgia, serif;
  font-size: 0.95rem;
  font-style: italic;
  letter-spacing: 0;
}

.axis-hint {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  color: var(--faint);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
}

.axis-hint span {
  display: inline-flex;
  gap: 0.36rem;
  align-items: center;
}

.axis-hint b {
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 500;
}

.axis-hint i {
  width: 1px;
  height: 0.8rem;
  background: var(--line);
}

.header-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  align-items: center;
}

.edition {
  color: var(--faint);
  font: 600 0.58rem/1 monospace;
  letter-spacing: 0.1em;
}

.auth-area {
  display: flex;
  gap: 0.55rem;
  align-items: center;
}

.jic-login,
.jic-logout {
  display: inline-flex;
  min-height: 2.25rem;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  font-size: 0.68rem;
  font-weight: 680;
  transition: border-color 160ms ease, background 160ms ease;
}

.jic-login:hover,
.jic-logout:hover {
  border-color: rgba(255, 255, 255, 0.48);
  background: rgba(255, 255, 255, 0.12);
}

.jic-identity {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  max-width: 11rem;
  font-size: 0.7rem;
}

.jic-identity strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.jic-avatar {
  display: grid;
  flex: 0 0 1.9rem;
  height: 1.9rem;
  place-items: center;
  color: #111;
  border-radius: 50%;
  background: var(--ink);
  font-family: Georgia, serif;
  font-weight: 700;
}

.jic-logout {
  min-height: auto;
  padding: 0.4rem 0.55rem;
  color: var(--muted);
  font-size: 0.6rem;
}

.series-feed {
  position: fixed;
  z-index: 1;
  top: var(--header-height);
  right: 0;
  bottom: 0;
  left: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scroll-behavior: smooth;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
}

.series-feed::-webkit-scrollbar,
.clip-track::-webkit-scrollbar {
  display: none;
}

.series-page {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  background:
    radial-gradient(circle at 50% 45%, rgba(102, 42, 26, 0.34), transparent 31rem),
    #080808;
}

.series-page[data-collection="fresh-off-the-boat"] {
  background:
    radial-gradient(circle at 50% 45%, rgba(25, 73, 91, 0.32), transparent 31rem),
    #07090a;
}

.clip-track {
  display: flex;
  width: 100%;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  touch-action: pan-x pan-y;
}

.clip-slide {
  position: relative;
  display: grid;
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  place-items: center;
  overflow: hidden;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.video-shell {
  position: relative;
  width: min(100%, calc((100svh - var(--header-height)) * 9 / 16));
  height: 100%;
  overflow: hidden;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  background: #000;
  box-shadow: 0 0 7rem rgba(0, 0, 0, 0.82);
}

.feed-video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
  cursor: pointer;
}

.video-scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.55) 0%, transparent 24%, transparent 53%, rgba(0, 0, 0, 0.84) 100%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.16), transparent 28%);
}

.series-heading {
  position: absolute;
  z-index: 3;
  top: 1.2rem;
  left: 1.1rem;
  display: flex;
  flex-direction: column;
  pointer-events: none;
}

.series-eyebrow {
  margin-bottom: 0.18rem;
  color: rgba(255, 255, 255, 0.62);
  font: 650 0.5rem/1 monospace;
  letter-spacing: 0.16em;
}

.series-name {
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: 1.15rem;
  font-weight: 600;
}

.sound-toggle {
  position: absolute;
  z-index: 5;
  top: 4.6rem;
  left: 1.05rem;
  padding: 0.58rem 0.72rem;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  font: inherit;
  font-size: 0.66rem;
  cursor: pointer;
}

.clip-metadata {
  position: absolute;
  z-index: 3;
  right: 4.8rem;
  bottom: max(1.35rem, env(safe-area-inset-bottom));
  left: 1.1rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

.clip-badges {
  display: flex;
  gap: 0.38rem;
  align-items: center;
  margin-bottom: 0.7rem;
}

.clip-badges span {
  padding: 0.3rem 0.48rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  font-size: 0.52rem;
  font-weight: 680;
  letter-spacing: 0.04em;
}

.source-badge {
  color: #fff;
}

.topic-badge,
.duration-badge {
  color: rgba(255, 255, 255, 0.7);
}

.clip-title {
  max-width: 11em;
  margin: 0 0 0.5rem;
  font-family: "Songti SC", "STSong", "Noto Serif SC", Georgia, serif;
  font-size: clamp(1.75rem, 5vh, 2.7rem);
  font-weight: 650;
  line-height: 1.04;
  letter-spacing: -0.055em;
  text-wrap: balance;
}

.clip-summary {
  display: -webkit-box;
  max-width: 29rem;
  margin: 0 0 0.7rem;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.78);
  font-family: "Songti SC", "STSong", serif;
  font-size: 0.74rem;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.clip-creator {
  display: flex;
  gap: 0.48rem;
  align-items: center;
  font-size: 0.68rem;
}

.creator-avatar {
  display: grid;
  width: 1.65rem;
  height: 1.65rem;
  place-items: center;
  color: #111;
  border-radius: 50%;
  background: #fff;
  font-size: 0.64rem;
  text-shadow: none;
}

.action-rail {
  position: absolute;
  z-index: 4;
  right: 0.85rem;
  bottom: max(1.25rem, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.round-action {
  display: flex;
  width: 3rem;
  align-items: center;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0;
  color: #fff;
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.action-icon {
  display: grid;
  width: 2.45rem;
  height: 2.45rem;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(12px);
  font-size: 1.15rem;
  transition: transform 160ms ease, background 160ms ease;
}

.round-action:hover .action-icon {
  background: rgba(255, 255, 255, 0.14);
  transform: translateY(-1px);
}

.round-action small {
  font-size: 0.52rem;
}

.clip-position {
  position: absolute;
  z-index: 4;
  top: 1.25rem;
  right: 1rem;
  color: rgba(255, 255, 255, 0.68);
  font: 650 0.55rem/1 monospace;
  letter-spacing: 0.08em;
}

.axis-arrow {
  position: absolute;
  z-index: 8;
  top: 50%;
  display: grid;
  width: 2.7rem;
  height: 2.7rem;
  place-items: center;
  color: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  background: rgba(5, 5, 5, 0.46);
  backdrop-filter: blur(12px);
  font: 300 1.7rem/1 sans-serif;
  cursor: pointer;
  transform: translateY(-50%);
}

.axis-arrow-left {
  left: clamp(1rem, calc(50% - 18rem), 28%);
}

.axis-arrow-right {
  right: clamp(1rem, calc(50% - 18rem), 28%);
}

.series-nav {
  position: fixed;
  z-index: 25;
  top: 50%;
  left: clamp(1rem, 2.5vw, 2rem);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transform: translateY(-50%);
}

.series-nav-button {
  position: relative;
  padding: 0.45rem 0.65rem 0.45rem 1rem;
  color: rgba(255, 255, 255, 0.4);
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.62rem;
  text-align: left;
  cursor: pointer;
  transition: color 180ms ease;
}

.series-nav-button::before {
  position: absolute;
  top: 50%;
  left: 0;
  width: 0.3rem;
  height: 0.3rem;
  content: "";
  border: 1px solid currentColor;
  border-radius: 50%;
  transform: translateY(-50%);
  transition: background 180ms ease, transform 180ms ease;
}

.series-nav-button.is-active {
  color: #fff;
}

.series-nav-button.is-active::before {
  background: var(--accent);
  border-color: var(--accent);
  transform: translateY(-50%) scale(1.35);
}

.gesture-guide {
  position: fixed;
  z-index: 40;
  bottom: max(1rem, env(safe-area-inset-bottom));
  left: 50%;
  display: flex;
  gap: 0.7rem;
  padding: 0.55rem 0.7rem;
  color: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(14px);
  font-size: 0.58rem;
  pointer-events: none;
  transform: translateX(-50%);
  transition: opacity 260ms ease, transform 260ms ease;
}

.gesture-guide.is-hidden {
  opacity: 0;
  transform: translate(-50%, 0.7rem);
}

.loading-state {
  display: grid;
  width: 100%;
  height: 100%;
  place-content: center;
  color: var(--muted);
  text-align: center;
}

.loading-mark {
  display: grid;
  width: 3.5rem;
  height: 3.5rem;
  margin: 0 auto 1rem;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 50%;
  font-family: Georgia, serif;
  font-size: 1.35rem;
  font-style: italic;
  animation: loading-pulse 1.8s ease-in-out infinite;
}

.loading-state p {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

.toast {
  position: fixed;
  z-index: 80;
  bottom: max(1.25rem, env(safe-area-inset-bottom));
  left: 50%;
  padding: 0.72rem 0.95rem;
  color: #111;
  border-radius: 999px;
  background: #fff;
  font-size: 0.72rem;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 0.7rem);
  transition: opacity 180ms ease, transform 180ms ease;
}

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

@keyframes loading-pulse {
  0%, 100% { opacity: 0.45; transform: scale(0.94); }
  50% { opacity: 1; transform: scale(1); }
}

@media (max-width: 760px) {
  :root {
    --header-height: 3.75rem;
  }

  .site-header {
    grid-template-columns: 1fr auto;
    padding: 0 0.75rem;
  }

  .axis-hint,
  .edition,
  .series-nav {
    display: none;
  }

  .brand {
    gap: 0.5rem;
    font-size: 0.64rem;
  }

  .brand-mark {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.82rem;
  }

  .jic-login {
    min-height: 2rem;
    padding: 0.45rem 0.68rem;
    font-size: 0.62rem;
  }

  .jic-identity {
    max-width: 8rem;
  }

  .jic-avatar {
    flex-basis: 1.7rem;
    height: 1.7rem;
  }

  .video-shell {
    width: 100%;
    border: 0;
    box-shadow: none;
  }

  .axis-arrow {
    display: none;
  }

  .series-heading {
    top: 0.95rem;
    left: 0.9rem;
  }

  .sound-toggle {
    top: 4.2rem;
    left: 0.85rem;
  }

  .clip-metadata {
    right: 4.3rem;
    bottom: max(1.1rem, env(safe-area-inset-bottom));
    left: 0.9rem;
  }

  .clip-title {
    font-size: clamp(1.65rem, 7.5vw, 2.3rem);
  }

  .clip-summary {
    font-size: 0.7rem;
  }

  .action-rail {
    right: 0.55rem;
    bottom: max(1rem, env(safe-area-inset-bottom));
  }

  .clip-position {
    top: 1.05rem;
    right: 0.8rem;
  }

  .gesture-guide {
    bottom: max(0.65rem, env(safe-area-inset-bottom));
  }
}

@media (max-height: 620px) {
  .clip-summary {
    display: none;
  }

  .clip-title {
    font-size: 1.65rem;
  }

  .sound-toggle {
    top: 3.7rem;
  }
}

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