:root {
  color-scheme: dark;
  --bg: #101112;
  --surface: #17191a;
  --surface-strong: #202224;
  --text: #ece8df;
  --muted: #aaa69d;
  --faint: #7d7a73;
  --line: rgba(236, 232, 223, 0.14);
  --line-strong: rgba(236, 232, 223, 0.28);
  --accent: #c6533e;
  --accent-hover: #d56852;
  --accent-ink: #fff8f3;
  --field: #111314;
  --scrim: rgba(8, 10, 11, 0.72);
  --shadow: rgba(3, 4, 5, 0.42);
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --page: min(1380px, calc(100vw - 64px));
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --radius-card: 20px;
  --radius-field: 12px;
  --radius-control: 999px;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #e8e7e3;
  --surface: #f3f2ee;
  --surface-strong: #dcdbd6;
  --text: #202225;
  --muted: #5f605e;
  --faint: #7d7d78;
  --line: rgba(32, 34, 37, 0.15);
  --line-strong: rgba(32, 34, 37, 0.3);
  --accent: #a94130;
  --accent-hover: #8f3426;
  --accent-ink: #fff9f5;
  --field: #f7f6f2;
  --scrim: rgba(19, 20, 21, 0.7);
  --shadow: rgba(42, 44, 46, 0.14);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

#top,
#library,
#about-access {
  scroll-margin-top: 84px;
}

body {
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  color: inherit;
  font: inherit;
}

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

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

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

img {
  display: block;
  max-width: 100%;
}

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.88' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.75'/%3E%3C/svg%3E");
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: var(--radius-field);
  background: var(--text);
  color: var(--bg);
  transform: translateY(-160%);
  transition: transform 180ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: 100%;
  min-height: 72px;
  padding: 0 max(24px, calc((100vw - 1380px) / 2));
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 12px;
  width: max-content;
}

.brand img {
  width: 42px;
  height: 42px;
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand-copy b {
  font-family: var(--serif);
  font-size: 16px;
  letter-spacing: 0.08em;
}

.brand-copy small {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
}

.primary-nav,
.header-actions,
.hero-actions,
.filter-row,
.access-tabs {
  display: flex;
  align-items: center;
}

.primary-nav {
  justify-self: center;
  gap: 28px;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.primary-nav a,
.text-button {
  transition: color 180ms ease;
}

.primary-nav a:hover,
.text-button:hover {
  color: var(--accent);
}

.header-actions {
  justify-self: end;
  gap: 16px;
}

.text-button,
.theme-button {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.text-button {
  padding: 8px 0;
  color: var(--muted);
}

.theme-button {
  min-width: 54px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  color: var(--muted);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(520px, 1.3fr);
  align-items: center;
  gap: clamp(44px, 7vw, 112px);
  width: var(--page);
  min-height: calc(100dvh - 72px);
  margin: 0 auto;
  padding: 64px 0;
}

.hero-copy {
  position: relative;
  z-index: 2;
  max-width: 590px;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
}

h1,
h2,
h3,
p {
  text-wrap: pretty;
}

h1,
h2,
h3 {
  margin: 0;
}

h1,
h2 {
  font-family: var(--serif);
  font-weight: 650;
}

h1 {
  max-width: 8.5em;
  font-size: clamp(48px, 6vw, 82px);
  line-height: 1.04;
  letter-spacing: -0.04em;
}

.hero-intro {
  max-width: 28em;
  margin: 28px 0 0;
  color: var(--muted);
  font-size: clamp(16px, 1.4vw, 19px);
  line-height: 1.8;
}

.hero-actions {
  gap: 12px;
  margin-top: 34px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  cursor: pointer;
  font-weight: 650;
  white-space: nowrap;
  transition: transform 180ms var(--ease), background 180ms ease, border-color 180ms ease, color 180ms ease;
}

.button:active,
.video-card:active,
.filter-button:active {
  transform: translateY(1px) scale(0.985);
}

.button-primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.button-primary:hover {
  background: var(--accent-hover);
}

.button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.button-secondary {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--text);
}

.button-secondary:hover {
  border-color: var(--text);
}

.hero-visual {
  position: relative;
  margin: 0;
  overflow: hidden;
  border-radius: var(--radius-card);
  box-shadow: 0 42px 110px var(--shadow);
}

.hero-visual::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 56%, rgba(6, 7, 8, 0.74));
  content: "";
  pointer-events: none;
}

.hero-visual img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.hero-visual figcaption {
  position: absolute;
  right: 24px;
  bottom: 22px;
  left: 24px;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: rgba(255, 249, 241, 0.86);
  font-size: 13px;
}

.library {
  width: var(--page);
  margin: 0 auto;
  padding: 112px 0 132px;
}

.section-heading {
  max-width: 690px;
}

.section-heading h2,
.access-note h2 {
  font-size: clamp(38px, 5vw, 64px);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.section-heading p,
.access-note p {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.75;
}

.catalog-tools {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin: 44px 0 30px;
}

.filter-row {
  flex-wrap: wrap;
  gap: 8px;
}

.filter-button {
  min-height: 42px;
  padding: 0 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: transform 160ms var(--ease), border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.filter-button:hover,
.filter-button.is-active {
  border-color: var(--text);
  color: var(--text);
}

.filter-button.is-active {
  background: var(--surface-strong);
}

.search-field {
  display: grid;
  gap: 8px;
  min-width: min(320px, 100%);
  color: var(--muted);
  font-size: 13px;
}

.search-field input,
.access-form input {
  width: 100%;
  min-height: 48px;
  padding: 0 15px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-field);
  background: var(--field);
  color: var(--text);
}

.search-field input::placeholder,
.access-form input::placeholder {
  color: var(--faint);
}

.video-grid,
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 42px 22px;
}

.video-card {
  grid-column: span 6;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
  transition: transform 320ms var(--ease);
}

.video-card:nth-child(1) {
  grid-column: span 7;
}

.video-card:nth-child(2) {
  grid-column: span 5;
  padding-top: 62px;
}

.video-card:nth-child(3) {
  grid-column: span 4;
}

.video-card:nth-child(4) {
  grid-column: span 8;
}

.video-card:nth-child(5) {
  grid-column: 4 / span 7;
}

.video-card:hover {
  transform: translateY(-5px);
}

.video-image {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-card);
  background: var(--surface-strong);
}

.video-image::after {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: inherit;
  content: "";
  pointer-events: none;
}

.video-image img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  transition: transform 700ms var(--ease), filter 300ms ease;
}

.video-card:hover .video-image img {
  transform: scale(1.025);
}

.video-info {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  padding: 17px 3px 0;
}

.video-info h3 {
  font-family: var(--serif);
  font-size: clamp(21px, 2.2vw, 31px);
  font-weight: 650;
  line-height: 1.2;
}

.video-info p,
.video-duration {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.video-language {
  display: block;
  margin-top: 9px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.video-duration {
  margin-top: 5px;
  font-family: var(--mono);
}

.video-side {
  display: grid;
  justify-items: end;
  gap: 10px;
  min-width: 84px;
  text-align: right;
}

.video-access {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.skeleton-grid {
  transition: opacity 240ms ease;
}

.skeleton {
  min-height: 310px;
  border-radius: var(--radius-card);
  background: var(--surface-strong);
}

.skeleton-wide {
  grid-column: span 7;
}

.skeleton-narrow {
  grid-column: span 5;
  margin-top: 62px;
}

.skeleton-small {
  grid-column: span 4;
}

.skeleton-long {
  grid-column: span 8;
}

@media (prefers-reduced-motion: no-preference) {
  .skeleton {
    background: linear-gradient(100deg, var(--surface-strong) 28%, color-mix(in srgb, var(--surface-strong) 70%, var(--text)) 42%, var(--surface-strong) 58%);
    background-size: 240% 100%;
    animation: skeleton-shift 1.8s ease-in-out infinite;
  }

  .hero-copy,
  .hero-visual {
    animation: enter 760ms var(--ease) both;
  }

  .hero-visual {
    animation-delay: 90ms;
  }
}

@keyframes skeleton-shift {
  to {
    background-position-x: -200%;
  }
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
}

.empty-state {
  display: grid;
  grid-template-columns: minmax(220px, 0.65fr) 1fr;
  align-items: center;
  gap: 36px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.empty-state[hidden] {
  display: none;
}

.empty-state img {
  border-radius: var(--radius-field);
}

.empty-state h3 {
  font-family: var(--serif);
  font-size: 30px;
}

.empty-state p {
  margin: 10px 0 4px;
  color: var(--muted);
}

.access-note {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.8fr);
  gap: clamp(56px, 10vw, 150px);
  width: var(--page);
  margin: 0 auto 120px;
  padding: clamp(52px, 7vw, 88px);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.access-note dl {
  display: grid;
  gap: 26px;
  margin: 0;
}

.access-note dl div {
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.access-note dl div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.access-note dt {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 650;
}

.access-note dd {
  margin: 8px 0 0;
  color: var(--muted);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  width: var(--page);
  margin: 0 auto;
  padding: 30px 0 44px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 13px;
}

dialog {
  color: var(--text);
}

dialog::backdrop {
  background: rgba(5, 6, 7, 0.82);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.access-dialog,
.player-dialog {
  width: min(1040px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: 0 36px 120px rgba(0, 0, 0, 0.48);
}

.access-dialog[open],
.player-dialog[open] {
  animation: dialog-enter 220ms var(--ease);
}

@keyframes dialog-enter {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
}

.dialog-close {
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface-strong);
  color: var(--muted);
  cursor: pointer;
}

.access-dialog > .dialog-close {
  position: sticky;
  top: 14px;
  z-index: 3;
  float: right;
  margin: 14px 14px -54px 0;
}

.dialog-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.8fr);
  min-height: 580px;
}

.dialog-poster {
  min-height: 580px;
  overflow: hidden;
  border-radius: var(--radius-card) 0 0 var(--radius-card);
  background: var(--surface-strong);
}

.dialog-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dialog-content {
  align-self: center;
  padding: 72px 54px;
}

.dialog-kicker {
  margin: 0 0 14px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
}

.dialog-content h2 {
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1.08;
}

.dialog-content > p:not(.dialog-kicker) {
  margin: 18px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.access-tabs {
  gap: 4px;
  margin-top: 34px;
  padding: 4px;
  border-radius: var(--radius-control);
  background: var(--surface-strong);
}

.access-tabs button {
  flex: 1;
  min-height: 40px;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.access-tabs button[aria-selected="true"] {
  background: var(--bg);
  color: var(--text);
}

.access-form {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.access-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.form-help,
.form-error {
  margin: -4px 0 0;
  font-size: 13px;
  line-height: 1.5;
}

.form-help {
  color: var(--faint);
}

.form-error {
  min-height: 20px;
  color: var(--accent);
}

.player-dialog {
  width: min(1280px, calc(100vw - 28px));
  background: #0c0d0e;
}

.player-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 22px;
  color: #ece8df;
}

.player-bar p {
  margin: 0 0 3px;
  color: #8d8981;
  font-size: 12px;
}

.player-bar h2 {
  font-family: var(--serif);
  font-size: 21px;
}

.player-bar .dialog-close {
  background: #181a1b;
  color: #aaa69d;
}

.player-shell {
  background: #060708;
}

.player-shell video {
  display: block;
  width: 100%;
  max-height: calc(100dvh - 180px);
  aspect-ratio: 16 / 9;
  background: #060708;
}

.player-note {
  margin: 0;
  padding: 14px 22px 18px;
  color: #8d8981;
  font-size: 12px;
}

@media (max-width: 980px) {
  .site-header {
    grid-template-columns: 1fr auto;
  }

  .primary-nav {
    display: none;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 44px;
    min-height: auto;
    padding: 68px 0 92px;
  }

  .hero-copy {
    max-width: 720px;
  }

  .hero-visual {
    width: min(900px, 100%);
    justify-self: end;
  }

  .access-note {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767px) {
  :root {
    --page: calc(100vw - 32px);
    --radius-card: 16px;
  }

  .site-header {
    min-height: 64px;
    padding: 0 16px;
  }

  .brand img {
    width: 36px;
    height: 36px;
  }

  .brand-copy b {
    font-size: 14px;
  }

  .brand-copy small,
  .header-actions .text-button {
    display: none;
  }

  .header-actions {
    gap: 10px;
  }

  .header-actions .session-button:not([hidden]) {
    display: block;
    font-size: 13px;
  }

  .theme-button {
    min-width: 50px;
    padding: 7px 12px;
  }

  .hero {
    width: 100%;
    gap: 38px;
    padding: 52px 16px 74px;
  }

  h1 {
    max-width: 8em;
    font-size: clamp(44px, 14vw, 64px);
  }

  .hero-intro {
    font-size: 16px;
  }

  .hero-actions {
    align-items: stretch;
  }

  .button {
    flex: 1;
    padding: 0 17px;
  }

  .hero-visual img {
    aspect-ratio: 4 / 3;
  }

  .hero-visual figcaption {
    right: 16px;
    bottom: 15px;
    left: 16px;
  }

  .library {
    padding: 78px 0 92px;
  }

  .section-heading h2,
  .access-note h2 {
    font-size: 40px;
  }

  .catalog-tools {
    align-items: stretch;
    flex-direction: column;
    margin-top: 34px;
  }

  .filter-row {
    flex-wrap: nowrap;
    width: calc(100vw - 16px);
    margin-right: -16px;
    padding-right: 16px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .filter-row::-webkit-scrollbar {
    display: none;
  }

  .filter-button {
    flex: 0 0 auto;
  }

  .search-field {
    width: 100%;
  }

  .video-grid,
  .skeleton-grid {
    grid-template-columns: 1fr;
    gap: 34px;
  }

  .video-card,
  .video-card:nth-child(n),
  .skeleton,
  .skeleton-wide,
  .skeleton-narrow,
  .skeleton-small,
  .skeleton-long {
    grid-column: 1;
    width: 100%;
    margin: 0;
    padding-top: 0;
  }

  .video-info h3 {
    font-size: 24px;
  }

  .empty-state {
    grid-template-columns: 1fr;
    gap: 22px;
    padding: 16px;
  }

  .access-note {
    gap: 46px;
    margin-bottom: 78px;
    padding: 40px 24px;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    padding-bottom: 32px;
  }

  .dialog-layout {
    grid-template-columns: 1fr;
  }

  .dialog-poster {
    min-height: 220px;
    max-height: 34dvh;
    border-radius: var(--radius-card) var(--radius-card) 0 0;
  }

  .dialog-content {
    padding: 36px 22px 28px;
  }

  .access-dialog > .dialog-close {
    top: 10px;
    margin: 10px 10px -50px 0;
  }

  .player-bar {
    align-items: flex-start;
  }

  .player-bar .dialog-close {
    min-width: max-content;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .site-header,
  dialog::backdrop {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}
