@font-face {
  font-family: "Source Han Sans SC";
  src: url("../fonts/SourceHanSansSC-VF.woff2") format("woff2");
  font-style: normal;
  font-weight: 250 900;
  font-display: swap;
}

:root {
  --portal-header-h: 64px;
  --portal-red: #d42020;
  --portal-line: rgb(255 255 255 / 12%);
  --portal-page-x: clamp(20px, 5vw, 56px);
}

html {
  scroll-padding-top: calc(var(--portal-header-h) + 16px);
}

body.portal-page {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  background: #000;
  color: #fff;
  font-family: "Source Han Sans SC", sans-serif;
}

.portal-view[hidden] {
  display: none !important;
}

.portal-view {
  min-height: 100vh;
}

.portal-page[data-active-portal="game"] .game-page,
.portal-page[data-active-portal="music"] .music-page {
  padding-top: var(--portal-header-h);
}

.dalisi-view,
.game-page,
.music-page {
  color-scheme: dark;
}

.global-header {
  box-sizing: border-box;
  position: fixed;
  z-index: 9500;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--portal-header-h);
  padding: 0 var(--portal-page-x) 0 10px;
  color: #fff;
  mix-blend-mode: difference;
  transition:
    background-color 240ms ease,
    border-color 240ms ease;
}

.global-header.is-scrolled,
.portal-page[data-active-portal="game"] .global-header,
.portal-page[data-active-portal="music"] .global-header {
  border-bottom: 1px solid var(--portal-line);
  background: rgb(0 0 0 / 92%);
  backdrop-filter: blur(10px);
  mix-blend-mode: normal;
}

.global-logo {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: #fff;
  line-height: 1.6;
  text-decoration: none;
}

.global-header__brand-group {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.global-header__studio-link {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  height: 100%;
  text-decoration: none;
  margin-right: 10px;
}

.global-header__studio-logo {
  display: block;
  width: auto;
  height: 32px;
  max-width: 96px;
  object-fit: contain;
  object-position: left center;
}

.global-logo__en {
  font-size: 0.58rem;
  font-weight: 500;
  letter-spacing: 0.42em;
}

.global-logo__cn {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.28em;
}

.global-nav {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  margin-left: auto;
}

.global-nav a {
  position: relative;
  padding: 10px 0;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.28em;
  opacity: 0.72;
  text-decoration: none;
  transition: opacity 200ms ease;
}

.global-nav a::after {
  position: absolute;
  right: 0.28em;
  bottom: 5px;
  left: 0;
  height: 1px;
  background: var(--portal-red);
  content: "";
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 200ms ease;
}

.global-nav a:hover,
.global-nav a:focus-visible,
.global-nav a[aria-current="page"] {
  opacity: 1;
}

.global-nav a:hover::after,
.global-nav a:focus-visible::after,
.global-nav a[aria-current="page"]::after {
  transform: scaleX(1);
  transform-origin: left;
}

.global-menu-toggle {
  box-sizing: border-box;
  display: none;
  flex-direction: column;
  gap: 7px;
  margin-left: auto;
  padding: 10px 8px;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
}

.global-menu-toggle span {
  display: block;
  width: 22px;
  height: 1px;
  background: currentColor;
  transition: transform 240ms ease;
}

.global-menu-toggle.is-open span:first-child {
  transform: translateY(4px) rotate(45deg);
}

.global-menu-toggle.is-open span:last-child {
  transform: translateY(-4px) rotate(-45deg);
}

.global-mobile-drawer {
  box-sizing: border-box;
  position: fixed;
  z-index: 9400;
  inset: var(--portal-header-h) 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgb(0 0 0 / 98%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease;
}

.global-mobile-drawer[hidden] {
  display: none;
}

.global-mobile-drawer.is-open {
  opacity: 1;
  pointer-events: auto;
}

.global-mobile-drawer nav {
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
  text-align: center;
}

.global-mobile-drawer a {
  color: #fff;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.34em;
  text-decoration: none;
}

.global-mobile-drawer a[aria-current="page"] {
  color: var(--portal-red);
}

.page-rail {
  box-sizing: border-box;
  position: fixed;
  z-index: 9300;
  top: calc(var(--portal-header-h) + 86px);
  left: 24px;
  display: flex;
  flex-direction: column;
  width: 184px;
  height: auto;
  max-height: calc(100vh - var(--portal-header-h) - 120px);
  padding: 12px;
  overflow-y: auto;
  border: 1px solid rgb(255 255 255 / 13%);
  border-radius: 18px;
  background: rgb(0 0 0 / 86%);
  box-shadow: 0 18px 50px rgb(0 0 0 / 34%);
  color: #fff;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-12px) scale(0.96);
  transform-origin: top left;
  pointer-events: none;
  backdrop-filter: blur(14px);
  transition:
    opacity 180ms ease,
    transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
    visibility 180ms ease;
}

.page-rail.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateX(0) scale(1);
  pointer-events: auto;
}

.page-rail__brand,
.page-rail__close,
.page-rail-backdrop {
  display: none !important;
}

.page-rail__nav {
  display: grid;
  margin: 0;
}

.page-rail__nav a {
  box-sizing: border-box;
  position: relative;
  min-width: 0;
  padding: 14px 14px;
  border-bottom: 1px solid rgb(255 255 255 / 8%);
  border-radius: 10px;
  color: rgb(255 255 255 / 62%);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-decoration: none;
  transition:
    color 180ms ease,
    background-color 180ms ease;
}

.page-rail__nav a:last-child {
  border-bottom-color: transparent;
}

.page-rail__nav a::before {
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 3px;
  width: 2px;
  border-radius: 999px;
  background: var(--portal-red);
  content: "";
  transform: scaleY(0);
  transition: transform 180ms ease;
}

.page-rail__nav a:hover,
.page-rail__nav a:focus-visible,
.page-rail__nav a.is-active,
.page-rail__nav a[aria-current="page"] {
  background: rgb(255 255 255 / 6%);
  color: #fff;
}

.page-rail__nav a:hover::before,
.page-rail__nav a:focus-visible::before,
.page-rail__nav a.is-active::before,
.page-rail__nav a[aria-current="page"]::before {
  transform: scaleY(1);
}

.page-rail-toggle {
  box-sizing: border-box;
  position: fixed;
  z-index: 9350;
  top: calc(var(--portal-header-h) + 24px);
  left: 24px;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 50%;
  background: rgb(0 0 0 / 88%);
  box-shadow: 0 10px 32px rgb(0 0 0 / 34%);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition:
    transform 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease;
}

.page-rail-toggle:hover,
.page-rail-toggle:focus-visible {
  transform: scale(1.06);
  border-color: rgb(255 255 255 / 34%);
  background: rgb(18 18 18 / 94%);
}

.page-rail-toggle__icon,
.page-rail-toggle__icon::before,
.page-rail-toggle__icon::after {
  display: block;
  width: 19px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  content: "";
  transition:
    transform 180ms ease,
    opacity 180ms ease;
}

.page-rail-toggle__icon {
  position: relative;
}

.page-rail-toggle__icon::before {
  position: absolute;
  top: -6px;
  left: 0;
}

.page-rail-toggle__icon::after {
  position: absolute;
  top: 6px;
  left: 0;
}

.page-rail-toggle[aria-expanded="true"] .page-rail-toggle__icon {
  background: transparent;
}

.page-rail-toggle[aria-expanded="true"] .page-rail-toggle__icon::before {
  top: 0;
  transform: rotate(45deg);
}

.page-rail-toggle[aria-expanded="true"] .page-rail-toggle__icon::after {
  top: 0;
  transform: rotate(-45deg);
}

@media (max-width: 900px) {
  .global-nav {
    display: none;
  }

  .global-menu-toggle {
    display: flex;
  }

  .page-rail-toggle {
    top: calc(var(--portal-header-h) + 16px);
    left: 16px;
    width: 48px;
    height: 48px;
  }

  .page-rail {
    top: calc(var(--portal-header-h) + 76px);
    left: 16px;
    width: min(210px, calc(100vw - 32px));
    max-height: calc(100vh - var(--portal-header-h) - 96px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .global-header,
  .global-mobile-drawer,
  .global-menu-toggle span,
  .page-rail,
  .page-rail-toggle,
  .page-rail-toggle__icon,
  .page-rail-toggle__icon::before,
  .page-rail-toggle__icon::after {
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .global-header,
  .global-mobile-drawer,
  .page-rail,
  .page-rail-toggle,
  .page-rail-backdrop {
    display: none !important;
  }

  .portal-view[hidden] {
    display: none !important;
  }
}

@media (max-width: 720px) {
  .global-header__studio-logo {
    height: 32px;
    max-width: 96px;
  }
}
