/* ============================================================
   CODE 四联屏动态个人名片 · CodePen 原型
   ------------------------------------------------------------
   结构：panel-wrapper(.panel)
           ├── .panel-shape     完整的平行四边形外观（斜切矩形，无缺口）
           └── .panel-clip      角色：向左突出左边框，右侧被右边界遮挡
                ├── .panel-bg
                ├── .panel-content
                │     ├── .logo
                │     ├── .character
                │     └── .text
   ============================================================ */

:root {
  /* ============================================================
     CORE VISUAL PARAMS —— 主要视觉参数，集中在这里调整
     ============================================================ */

  /* 平行四边形（完整斜切矩形） */
  --panel-angle: 11deg;                       /* 参考倾斜角 */
  --panel-skew: -10.2deg;                     /* 面板与信息卡共用的实际斜率 */
  --panel-counter-skew: 10.2deg;              /* 内容反向校正，保持文字水平 */
  --panel-slant: clamp(0px, 18vh, 200px);     /* 顶边相对底边的水平错位（核心几何参数） */
  --character-overflow: clamp(48px, 8vw, 120px); /* 角色向左突出面板左边框的距离 */

  /* 面板宽度分配（flex-grow） */
  --active-flex: 7;          /* Active 面板约占 67%，为其它角色保留姓名展示空间 */
  --inactive-flex: 1.35;     /* 非 Active 面板更宽，减少立绘两侧被斜边吞没 */
  --hover-flex: 2.4;         /* Hover 面板（克制放大 ≈ 48%，不把其它面板挤得太小） */
  --hover-other-flex: 0.85;  /* Hover 时的其它面板（保持 ≈ 17%，角色仍然可辨） */

  /* Logo */
  --logo-default-opacity: 0.55;
  --hover-logo-scale: 1.08;
  --active-logo-scale: 1.16;

  /* 角色 */
  --character-base-height: 84%; /* 角色基础显示高度（占面板高度，底边贴底） */
  --hover-character-scale: 1.10;
  --active-character-scale: 1.18; /* 与 84% 基础高度相乘 ≈ 99%，角色完整可见不裁头顶 */

  /* 鼠标视差（px） */
  --parallax-bg: 2px;
  --parallax-logo: 5px;
  --parallax-character: 10px;

  /* 动画 */
  --transition-duration: 0.6s;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  /* 字体 */
  --font-display: "Rajdhani", "Noto Sans SC", "PingFang SC", sans-serif;
  --font-body: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

html,
body {
  height: 100%;
}

.asset-loader {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-content: center;
  gap: 14px;
  background: #07070d;
  color: rgba(238, 241, 255, 0.72);
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.32em;
  transition: opacity 0.32s ease, visibility 0.32s ease;
}

.asset-loader__line {
  width: 180px;
  height: 2px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.1);
}

.asset-loader__line::after {
  content: "";
  display: block;
  width: 45%;
  height: 100%;
  background: linear-gradient(90deg, transparent, #97cbef, transparent);
  animation: asset-loading 1s ease-in-out infinite;
}

@keyframes asset-loading {
  from { transform: translateX(-110%); }
  to { transform: translateX(330%); }
}

html.assets-ready .asset-loader {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

body.is-loading .stage {
  opacity: 0;
  pointer-events: none;
}

body {
  overflow: hidden;                 /* 默认状态无滚动条 */
  background: #07070d;
  color: #eef1ff;
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

/* ============================ 舞台 ============================ */

.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 0%, #141426 0%, #0a0a14 45%, #06060c 100%);
  opacity: 1;
  transition: opacity 0.3s ease;
}

/* 四面板：每个面板都是完整的斜切矩形，相邻无缝拼合，占满整个视口 */
.panels {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
}

/* ============================ 单个面板 ============================ */

.panel {
  position: relative;
  isolation: isolate;
  flex: 1 1 0%;
  min-width: 0;
  height: 100%;
  cursor: pointer;
  outline: none;
  transition: flex-grow var(--transition-duration) var(--ease);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.panel:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -2px;
  z-index: 5;
}

/* 激活时不能让整个面板建立更高的堆叠上下文，否则斜切背景会盖住面板 2。 */
.panel.panel--active:focus-visible {
  z-index: auto;
}

/* ---- 完整的平行四边形外观层 ----
   用 skewX 倾斜生成斜切矩形（比 clip-path 更可靠，
   避免 Chromium 中 filter 与 clip-path 组合导致填充不裁剪）；
   形状元素向右延伸 --panel-slant，相邻斜边相互重叠覆盖。 */
.panel-shape {
  position: absolute;
  left: 0;
  top: 0;
  width: calc(100% + var(--panel-slant));
  height: 100%;
  transform: skewX(var(--panel-skew));
  transform-origin: top left;
  background: linear-gradient(180deg, #17172a 0%, #0d0d1a 60%, #0a0a15 100%);
  /* 边缘高光 + 角色主题色光晕（跟随平行四边形轮廓） */
  box-shadow:
    1px 0 0 rgba(255, 255, 255, 0.16),
    0 0 22px rgba(var(--accent-rgb), 0.26);
  /* transition: box-shadow var(--transition-duration) var(--ease); */
  pointer-events: none;
}

.panel-shape::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(100deg,
      rgba(var(--accent-rgb), 0.30) 0%,
      transparent 58%),
    radial-gradient(130% 90% at 78% 108%,
      rgba(var(--accent-rgb), 0.26),
      transparent 62%);
  opacity: 0.8;
  /* transition: opacity 0.4s ease; */
}

.panel-shape::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.05),
    transparent 24%,
    transparent 82%,
    rgba(0, 0, 0, 0.4)
  );
}

/* ---- 面板背景图（Active 时铺满斜切矩形）---- */
.panel-bgimg {
  position: absolute;
  left: 0; 
  top: 0;
  width: calc(100% + var(--panel-slant));
  height: 100%;
  transform: skewX(var(--panel-skew));
  transform-origin: top left;
  overflow: hidden;
  z-index: 1;
  opacity: 0;
  /* 横屏出现动效：面板 1/2 从左向右展开、面板 3/4 从右向左展开。
     clip-path 只裁剪显示区域，不移动/缩放图层，因此不会露出背景边缘；
     同时延迟到面板 flex 展开完成（0.6s）后再播放，避免背景随宽度缩放。 */
  clip-path: var(--bg-clip-start, inset(0 0 0 0));
  transition: opacity 0s, clip-path 0.7s var(--ease);
  /* 收起：opacity 立即隐藏（避免面板缩回期间背景缩放露边）；
     clip-path 延迟到 flex 缩回完成后再收回（此时已不可见） */
  transition-delay: 0s, 0.6s;
  pointer-events: none;
}

/* 面板 1/2：从左向右展开；面板 3/4：从右向左展开 */
.panel:nth-child(-n + 2) .panel-bgimg {
  --bg-clip-start: inset(0 100% 0 0);
}

.panel:nth-child(n + 3) .panel-bgimg {
  --bg-clip-start: inset(0 0 0 100%);
}

.panel--active .panel-bgimg {
  clip-path: inset(0 0 0 0);
  /* 出现：等面板 flex 展开完成后再淡入+展开，全程无缩放 */
  transition: opacity 0.55s var(--ease), clip-path 0.7s var(--ease);
  transition-delay: 0.6s, 0.6s;
}

.panel-bgmedia {
  position: absolute;
  top: 0;
  left: calc(-1 * var(--panel-slant));
  width: calc(100% + var(--panel-slant));
  height: 100%;

  /* 背景移动通过 background-position 完成（配合 background-size 放大提供富余），
     层本身不移动，因此不会在容器边缘露出深色空白。 */
  background-size: var(--bg-size, cover);
  background-position: var(--bg-pos, var(--bg-position, center));
  transform: skewX(var(--panel-counter-skew));
  transform-origin: center center;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 0.7s var(--ease);
}

/* 背景图由 JS 后台加载完成后淡入（不阻塞首屏显示） */
.panel--bg-ready .panel-bgmedia {
  opacity: 1;
}

/* 背景图上的深色遮罩，保证角色与文字可读 */
.panel-bgimg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(8, 8, 18, 0.25) 0%,
    rgba(8, 8, 18, 0.45) 45%,
    rgba(8, 8, 18, 0.82) 100%
  );
}

/* 面板 3 背景不加深色遮罩（保持竹林原色调） */
.panel:nth-child(3) .panel-bgimg::after {
  opacity: 0;
}

.panel--active .panel-bgimg {
  opacity: 1;
}

/* ---- 内容裁切层 ----
   左边界允许角色向左突出（越过面板左边框）；
   右边界严格沿相邻面板之间的可见斜边裁切，使角色被面板右边框“遮挡”。 */
.panel-clip {
  position: absolute;
  left: 0; 
  top: 0;
  width: calc(100% + var(--panel-slant));
  height: 100%;
  transform: skewX(var(--panel-skew));
  transform-origin: top left;
  overflow: hidden;
  z-index: 2;
}

/* 面板内部背景 / 光晕（视差 ±2px） */
.panel-bg, .panel-content {
  position: absolute;
  inset: 0;
  transform: skewX(var(--panel-counter-skew));
  transform-origin: top left;
}

.panel-bg {
  background: radial-gradient(120% 85% at 72% 100%, rgba(var(--accent-rgb), 0.2), transparent 62%);
  transform: skewX(var(--panel-counter-skew)) translate(
    calc(var(--mx, 0) * var(--parallax-bg)),
    calc(var(--my, 0) * var(--parallax-bg))
  );
  transition: transform 0.4s ease-out;
}

/* ============================ Logo ============================ */

.logo {
  position: absolute;
  top: 14%;
  left: calc(50% - (var(--panel-slant) / 2));
  transform: translate(-50%, -50%);
  z-index: 2;                 /* 背景 → 角色 → Logo → 文字（Logo 作为角色上方的图形标记） */
  pointer-events: none;
  transition:
    top var(--transition-duration) var(--ease),
    left var(--transition-duration) var(--ease);
}

.logo img {
  display: block;
  width: clamp(56px, 6.2vw, 92px);
  height: auto;
  opacity: var(--logo-default-opacity);
  filter: drop-shadow(0 0 12px rgba(var(--accent-rgb), 0.45));
  transform: translate3d(
      calc(var(--mx, 0) * var(--parallax-logo)),
      calc(var(--my, 0) * var(--parallax-logo)),
      0
    )
    scale(var(--logo-scale, 1));
  transform-origin: center;
  transition:
    transform 0.35s var(--ease),
    opacity 0.3s ease;
}

/* Hover：Logo 轻微放大 + 提亮 */
.panel:not(.panel--active):hover .logo img {
  --logo-scale: var(--hover-logo-scale);
  opacity: 0.8;
}

/* Active：Logo 移动到面板左上角（完整斜切矩形的左上角可见，不会被裁掉） */
.panel--active .logo {
  top: clamp(44px, 7vh, 72px);
  left: clamp(48px, 5vw, 92px);
  transition: none;
}

.panel--active .logo img {
  --logo-scale: var(--active-logo-scale);
  opacity: 0.95;
  transform: translate3d(0, 0, 0) scale(var(--active-logo-scale));
  transition: opacity 0.3s ease;
}

/* 283 标识已是带 Alpha 通道的 PNG，仅保留图标主体。 */
.logo--283 img {
  opacity: 0.9;
  filter:
    brightness(0)
    drop-shadow(0 8px 7px rgba(var(--accent-rgb), 0.78));
}

/* 主页上的 283 图形包含较多留白，需要单独放大以匹配其它图标的视觉重量。 */
.stage:not(.is-active) .logo--283 img {
  width: clamp(118px, 10vw, 180px);
}

.panel--active .logo--283 img {
  opacity: 0.95;
}

/* 初星学园标识：统一为纯黑主体，并保留面板强调色投影。 */
.logo--gakumas img {
  width: clamp(56px, 6.2vw, 92px);
  opacity: 0.88;
  filter: brightness(0) drop-shadow(0 8px 9px rgba(var(--accent-rgb), 0.72));
}

.panel--active .logo--gakumas img {
  width: clamp(56px, 6.2vw, 92px);
  opacity: 0.96;
}

.panel--active .logo.logo--gakumas {
  top: clamp(44px, 7vh, 72px);
}

.stage:not(.is-active) .logo--gakumas {
  top: 14%;
  left: calc(50% - (var(--panel-slant) / 2));
}

.stage:not(.is-active) .logo--gakumas img {
  width: clamp(118px, 10vw, 180px);
}

/* 铃仙面板使用用户提供的 Touhou Project 标识。 */
.logo--reisen img {
  width: clamp(148px, 12.5vw, 220px);
  opacity: 0.88;
  filter: drop-shadow(0 8px 8px rgba(var(--accent-rgb), 0.76));
}

.stage:not(.is-active) .logo--reisen {
  /* 以角色面板本体为基准居中，避免 Logo 被右侧斜边吞入。 */
  left: calc(50% - (var(--panel-slant) / 2));
}

.panel--active .logo--reisen img {
  width: clamp(150px, 12vw, 210px);
  opacity: 0.96;
}

.panel--active .logo.logo--reisen {
  top: clamp(112px, 15vh, 142px);
}

/* 猫屋敷美紅面板使用用户提供的黑色圆形标识。 */
.logo--miku img {
  width: clamp(56px, 6.2vw, 92px);
  opacity: 0.88;
  filter: drop-shadow(0 8px 8px rgba(var(--accent-rgb), 0.76));
}

.stage:not(.is-active) .logo--miku {
  top: 14%;
  left: calc(50% - (var(--panel-slant) / 2));
}

.stage:not(.is-active) .logo--miku img {
  width: clamp(118px, 10vw, 180px);
}

.panel--active .logo--miku img {
  opacity: 0.96;
}

.panel--active .logo.logo--miku {
  top: clamp(44px, 7vh, 72px);
}

/* ============================ 角色 ============================ */

.character {
  position: absolute;
  left: 0;
  top: 0;
  width: calc(100% + var(--panel-slant));
  height: 100%;
  transform: skewX(var(--panel-skew));
  transform-origin: top left;
  overflow: hidden; 
  z-index: 1;
  pointer-events: none;
}

.panel--active .character {
  overflow: visible;
}

.character-inner {
  position: absolute;
  inset: 0;
  transform: skewX(var(--panel-counter-skew));
  transform-origin: top left;
}

.character img {
  position: absolute;
  /* 向左突出 --character-overflow，越过面板左边框；右侧由 .panel-clip 沿右边界裁切 */
  left: calc(var(--char-x, 0px) - var(--character-overflow));
  bottom: var(--char-bottom, 0px); /* 每个角色可单独微调底部（负值=裁掉素材底部透明边） */
  height: var(--char-h, var(--character-base-height));
  width: auto;
  max-width: none;
  object-fit: contain;
  object-position: bottom center;
  transform-origin: bottom center; /* 缩放时以底部为锚点，“从页面底部生长出来” */
  transform: translate(
      calc(var(--mx, 0) * var(--parallax-character)),
      calc(var(--my, 0) * var(--parallax-character))
    )
    scale(var(--char-scale, 1))
    scaleX(var(--char-flip, 1))
    scaleX(var(--char-width-scale, 1));
  transition:
    transform var(--transition-duration) var(--ease),
    left var(--transition-duration) var(--ease),
    bottom var(--transition-duration) var(--ease);
  pointer-events: none;
}

/* 面板1原图自带白边，只保留很薄的柔光，避免叠加成粗重贴纸边。 */
.panel:nth-child(1) .character img {
  filter: none;
}

/* 收拢主页可为宽幅半身素材单独校正水平构图，展开态仍使用 --char-x。 */
/* .stage:not(.is-active) .character img {
  left: calc(var(--home-char-x, var(--char-x, 0px)) - var(--character-overflow));
  bottom: var(--home-char-bottom, var(--char-bottom, 0px));
  --char-scale: var(--home-char-scale, 1);
} */

/* 铃仙主页立绘顶满自身斜切面板，但不再借助大型渐变 mask。 */
/* 原容器只有 92vh，顶部从 8vh 开始，overflow 会水平切断兔耳。 */
/* .stage:not(.is-active) .panel:nth-child(3) .character {
  left: calc(-1 * var(--panel-slant));
  width: calc(100% + 2 * var(--panel-slant));
  height: 100% !important;
  overflow: hidden;
  -webkit-clip-path: polygon(
    var(--panel-slant) 0,
    100% 0,
    calc(100% - var(--panel-slant)) 100%,
    0 100%
  );
  clip-path: polygon(
    var(--panel-slant) 0,
    100% 0,
    calc(100% - var(--panel-slant)) 100%,
    0 100%
  );
} */

/* 容器扩到页顶，但立绘仍保持原来的 92vh 尺寸与构图。 */
/* .stage:not(.is-active) .panel:nth-child(3) .character img {
  height: 92%;
  left: calc(
    var(--home-char-x, var(--char-x, 0px))
    - var(--character-overflow)
    + var(--panel-slant)
  );
}  */

.stage:not(.is-active) .character img {
  left: calc(var(--home-char-x, var(--char-x, 0px)) - var(--character-overflow));
  bottom: var(--home-char-bottom, var(--char-bottom, 0px));
  --char-scale: var(--home-char-scale, 1);
}

/* Hover：角色在面板矩形内水平居中（鼠标可用设备上生效；
   同时保留 :hover 与 .panel--hovered 两种触发方式，便于统一行为） */
@media (hover: hover) and (pointer: fine) {
  .stage:not(.is-active) .panel:not(.panel--active):hover .character img,
  .stage:not(.is-active) .panel:not(.panel--active).panel--hovered .character img {
    left: calc(50% - (var(--panel-slant) / 2));
    bottom: var(--hover-char-bottom, var(--home-char-bottom, var(--char-bottom, 0px)));
    transform: translate(
        calc(var(--mx, 0) * var(--parallax-character) - 50%),
        calc(var(--my, 0) * var(--parallax-character))
      )
      scale(var(--char-scale, 1))
      scaleX(var(--char-flip, 1))
      scaleX(var(--char-width-scale, 1));
  }
}

/* 展开其它面板时，使用各立绘自己的收窄态构图参数。 */
/* 容器向左扩展了一个斜边宽度；这里反向补偿，保持人物构图不横移。 */
.stage.is-active .panel:not(.panel--active) .character img {
  left: calc(
    var(--collapsed-char-x, var(--char-x, 0px))
     - var(--character-overflow)
  );
  bottom: var(--collapsed-char-bottom, var(--char-bottom, 0px));
  --char-scale: var(--collapsed-char-scale, 1);
}

/* 收窄面板把角色层扩展到两条斜边，再用同形平行四边形收口。 */
/* .stage.is-active .panel:not(.panel--active) .character {
  left: calc(-1 * var(--panel-slant));
  width: calc(100% + 2 * var(--panel-slant));
  overflow: hidden;
  -webkit-clip-path: polygon(
    var(--panel-slant) 0,
    100% 0,
    calc(100% - var(--panel-slant)) 100%,
    0 100%
  );
  clip-path: polygon(
    var(--panel-slant) 0,
    100% 0,
    calc(100% - var(--panel-slant)) 100%,
    0 100%
  );
  -webkit-mask-image: none;
  mask-image: none;
}

.stage.is-active .panel:not(.panel--active):hover .character {
  -webkit-mask-image: none;
  mask-image: none;
} */

@media (hover: hover) and (pointer: fine) {
  .stage:not(.is-active) .panel:nth-child(3):hover .character img,
  .stage:not(.is-active) .panel:nth-child(3).panel--hovered .character img {
    left: calc(50% - (var(--panel-slant) / 2));
    transform: translate(
        calc(var(--mx, 0) * var(--parallax-character) - 60%),
        calc(var(--my, 0) * var(--parallax-character))
      )
      scale(var(--char-scale, 1))
      scaleX(var(--char-flip, 1))
      scaleX(var(--char-width-scale, 1));
  }

  /* 展开任意面板后，所有收窄态立绘在悬停时统一轻微向右移动。 */
  .stage.is-active .panel:not(.panel--active):hover .character img,
  .stage.is-active .panel:not(.panel--active).panel--hovered .character img {
    left: calc(
      var(--collapsed-char-x, var(--char-x, 0px))
      - var(--character-overflow)
      + 8px
    );
  }
}

/* Hover：角色轻微放大 */
.stage:not(.is-active) .panel:not(.panel--active):hover .character img,
.stage:not(.is-active) .panel:not(.panel--active).panel--hovered .character img {
  --char-scale: var(--hover-char-scale, var(--hover-character-scale));
}

/* Active：角色进一步放大（底部锚定，向上“生长”） */
.panel--active .character img {
  left: calc(var(--active-char-x, var(--char-x, 0px)) - var(--character-overflow));
  bottom: var(--active-char-bottom, var(--char-bottom, 0px));
  --char-scale: var(--active-char-scale, var(--active-character-scale));
}

/* ============================ 文字 / 个人信息 ============================ */

.text {
  position: absolute;
  left: 50%;
  bottom: 11.5%; /* 抬高，避免被左下角 NOW PLAYING 浮层遮挡 */
  right: auto;
  transform: translateX(-50%);
  z-index: 3;                       /* 文字在最上层 */
  max-width: 78%;
  pointer-events: none;
  transition:
    left var(--transition-duration) var(--ease),
    right var(--transition-duration) var(--ease),
    transform var(--transition-duration) var(--ease);
}

.text::before {
  content: "";
  position: absolute;
  inset: -18px -22px -14px;
  background: linear-gradient(90deg, rgba(5, 5, 12, 0.72), transparent 90%);
  filter: blur(2px);
  z-index: -1;
  border-radius: 6px;
}

.role {
  font-family: var(--font-display);
  font-size: clamp(0.58rem, 0.95vw, 0.78rem);
  font-weight: 600;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.9;
  margin-bottom: 3px;
  white-space: nowrap;
}

.name {
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 2.9vw, 2.7rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.85);
}

.name-full {
  display: none;
}

.panel--active .name-home {
  display: none;
}

.panel--active .name-full {
  display: inline;
}

.name-home--expandable {
  display: inline-flex;
  align-items: baseline;
  white-space: nowrap;
}

.home-name-middle {
  display: inline-grid;
  width: 0.76em;
  margin-inline: 0.02em;
  vertical-align: baseline;
  transition: width 0.48s var(--ease);
}

.home-name-short,
.home-name-expanded {
  grid-area: 1 / 1;
  white-space: nowrap;
  transition:
    opacity 0.28s ease,
    transform 0.48s var(--ease);
}

.home-name-short {
  opacity: 1;
  transform: translateX(0);
}

.home-name-expanded {
  opacity: 0;
  transform: translateX(-0.28em);
}

@media (hover: hover) and (pointer: fine) {
  .stage:not(.is-active) .panel:nth-child(3):is(:hover, .panel--hovered) .home-name-middle {
    width: 4em;
  }

  .stage:not(.is-active) .panel:nth-child(3):is(:hover, .panel--hovered) .home-name-short {
    opacity: 0;
    transform: translateX(0.24em);
  }

  .stage:not(.is-active) .panel:nth-child(3):is(:hover, .panel--hovered) .home-name-expanded {
    opacity: 1;
    transform: translateX(0);
  }
}

/* 主页短名保持单行，展开后恢复正式全名。 */
.stage:not(.is-active) .panel:nth-child(3) .name {
  /* 与其它三张姓名卡共用同一字号和行高；仅横向收窄以维持单行。 */
  font-size: clamp(1.45rem, 2.9vw, 2.7rem);
  line-height: 1.05;
  letter-spacing: 0.01em;
  white-space: nowrap;
  width: 125%;
  transform: scaleX(0.8);
  transform-origin: left center;
}

/* 只缩短铃仙主页姓名的字形，不缩短承载姓名的黑色信息框。 */
.stage:not(.is-active) .panel:nth-child(3) .text {
  width: 88%;
  max-width: 88%;
}

/* 详情（About / Links）：默认隐藏，Active 后淡入 */
.details {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 0.5s ease,
    transform 0.55s var(--ease),
    max-height 0.6s var(--ease);
}

.panel--active .details {
  max-height: 46vh;
  overflow-y: auto;
  opacity: 1;
  transform: none;
  transition-delay: 0.32s;
}

/* Active：个人信息移到右侧空白区，避免遮挡角色主体 */
.panel--active .text {
  left: auto;
  right: calc(9% + var(--panel-slant));
  width: min(39ch, 40%);
  max-width: 39ch;
  transform: skewX(var(--panel-skew));
  transform-origin: center;
  isolation: isolate;
  padding: clamp(18px, 2vw, 28px) clamp(26px, 2.8vw, 42px);
  border: 1px solid rgba(var(--accent-rgb), 0.38);
  background:
    linear-gradient(112deg,
      rgba(8, 12, 24, 0.92) 0%,
      rgba(12, 18, 34, 0.82) 62%,
      rgba(var(--accent-rgb), 0.16) 100%);
  backdrop-filter: blur(14px) saturate(1.12);
}

.text-inner {
  position: relative;
  z-index: 1;
}

.panel--active .text-inner {
  transform: skewX(var(--panel-counter-skew));
  transform-origin: center;
}

.panel--active .text::before {
  inset: 0;
  border-radius: 0;
  background:
    linear-gradient(90deg,
      rgba(var(--accent-rgb), 0.16),
      transparent 38%);
  filter: none;
  opacity: 1;
  z-index: 0;
}

.panel--active .text::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  z-index: 2;
  background: linear-gradient(90deg,
    rgba(var(--accent-rgb), 0.95),
    rgba(var(--accent-rgb), 0.08));
  box-shadow: 0 0 16px rgba(var(--accent-rgb), 0.7);
  pointer-events: none;
}

/* Active 状态下，收窄面板改用竖排姓名标签，避免文字被角色与斜边挤没。 */
.stage.is-active .panel:not(.panel--active) .text {
  left: 42%;
  right: auto;
  top: 27%;
  bottom: auto;
  width: auto;
  max-width: none;
  transform: translateX(-50%);
  writing-mode: vertical-rl;
  text-orientation: upright;
  padding: 11px 7px;
  border-left: 1px solid rgba(var(--accent-rgb), 0.78);
  background: linear-gradient(180deg,
    rgba(7, 9, 20, 0.2),
    rgba(7, 9, 20, 0.78));
  backdrop-filter: blur(5px);
  opacity: 0;
}

.stage.is-active .panel:not(.panel--active) .text::before {
  display: none;
}

.stage.is-active .panel:not(.panel--active) .role {
  display: none;
}

.stage.is-active .panel:not(.panel--active) .name {
  font-size: clamp(0.78rem, 1vw, 1rem);
  line-height: 1;
  letter-spacing: 0.14em;
  white-space: nowrap;
  text-shadow:
    0 2px 12px rgba(0, 0, 0, 0.95),
    0 0 12px rgba(var(--accent-rgb), 0.42);
}

/* 独立于 .panel-clip，避免窄面板的斜切裁剪吞掉姓名。 */
.collapsed-label {
  display: none;
  position: absolute;
  top: 27%;
  left: 20%;
  z-index: 8;
  pointer-events: none;
  writing-mode: vertical-rl;
  text-orientation: upright;
  color: #f3f5ff;
  font-family: var(--font-display);
  font-size: clamp(0.8rem, 1.05vw, 1.05rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.15em;
  white-space: nowrap;
  padding: 12px 8px;
  border-left: 1px solid rgba(var(--accent-rgb), 0.88);
  background: linear-gradient(180deg,
    rgba(7, 9, 20, 0.18),
    rgba(7, 9, 20, 0.82));
  box-shadow:
    -8px 0 24px rgba(var(--accent-rgb), 0.16),
    0 12px 28px rgba(0, 0, 0, 0.35);
  text-shadow:
    0 2px 12px rgba(0, 0, 0, 0.95),
    0 0 12px rgba(var(--accent-rgb), 0.48);
  backdrop-filter: blur(6px);
}

.stage.is-active .panel:not(.panel--active) .collapsed-label {
  display: flex;
}

.about {
  margin: 10px 0 14px;
  max-width: 46ch;
  font-size: clamp(0.78rem, 1.05vw, 1rem);
  line-height: 1.75;
  color: #c9cfe6;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.link {
  display: inline-block;
  padding: 7px 14px;
  border: 1px solid rgba(var(--accent-rgb), 0.55);
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.12);
  color: #eef1ff;
  font-family: var(--font-display);
  font-size: clamp(0.68rem, 0.95vw, 0.85rem);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-decoration: none;
  pointer-events: auto;
  transition:
    transform 0.25s var(--ease),
    background 0.25s ease,
    box-shadow 0.25s ease;
}

.link:hover {
  transform: translateY(-2px);
  background: rgba(var(--accent-rgb), 0.3);
  box-shadow: 0 6px 18px rgba(var(--accent-rgb), 0.35);
}

.copy-id-row {
  margin: 14px 6px 0;
  border: 1px solid rgba(var(--accent-rgb), 0.48);
  border-left: 2px solid rgba(var(--accent-rgb), 0.92);
  background: linear-gradient(90deg,
    rgba(var(--accent-rgb), 0.18),
    rgba(5, 8, 18, 0.42));
  box-shadow:
    inset 0 -1px 0 rgba(var(--accent-rgb), 0.2),
    0 8px 24px rgba(0, 0, 0, 0.16);
  transform: skewX(var(--panel-skew));
}

.copy-id-inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 10px 11px 10px 13px;
  transform: skewX(var(--panel-counter-skew));
}

.copy-id-label {
  color: rgb(var(--accent-rgb));
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.copy-id-value {
  overflow: hidden;
  color: #f2f5ff;
  font-family: var(--font-display);
  font-size: clamp(0.68rem, 0.82vw, 0.82rem);
  letter-spacing: 0.06em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-id-btn {
  min-width: 58px;
  padding: 7px 8px;
  border: 1px solid rgba(var(--accent-rgb), 0.58);
  background: rgba(var(--accent-rgb), 0.13);
  color: #eef3ff;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  pointer-events: auto;
  transition: background 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.copy-id-btn:not(:disabled):hover,
.copy-id-btn.is-copied {
  background: rgba(var(--accent-rgb), 0.3);
  box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.35);
}

.copy-id-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.profile-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 14px 6px 0;
  padding: 11px 15px;
  border: 1px solid rgba(var(--accent-rgb), 0.56);
  border-left: 2px solid rgba(var(--accent-rgb), 0.95);
  background: linear-gradient(90deg,
    rgba(var(--accent-rgb), 0.2),
    rgba(5, 8, 18, 0.48));
  color: #f4f7ff;
  font-family: var(--font-display);
  font-size: clamp(0.72rem, 1vw, 0.88rem);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-decoration: none;
  pointer-events: auto;
  transform: skewX(var(--panel-skew));
  transition: background 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.profile-action > span {
  transform: skewX(var(--panel-counter-skew));
}

.profile-action:hover {
  border-color: rgba(var(--accent-rgb), 0.92);
  background: linear-gradient(90deg,
    rgba(var(--accent-rgb), 0.38),
    rgba(5, 8, 18, 0.62));
  box-shadow: 0 0 18px rgba(var(--accent-rgb), 0.32);
}

/* ============================ 全局 UI ============================ */

.top-actions {
  position: fixed;
  top: clamp(16px, 3vh, 30px);
  right: clamp(18px, 3vw, 34px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.page-indicator {
  display: none;
}

.landscape-blocker {
  display: none;
}

@media (orientation: landscape) and (max-height: 600px) and (hover: none) and (pointer: coarse) {
  html,
  body {
    overflow: hidden !important;
  }

  .landscape-blocker {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
    background:
      radial-gradient(circle at 50% 42%, rgba(88, 136, 194, 0.16), transparent 38%),
      #080b13;
    color: #f4f7ff;
    text-align: center;
    pointer-events: auto;
  }

  .landscape-blocker strong {
    margin-top: 8px;
    font-family: var(--font-display);
    font-size: clamp(1rem, 4vw, 1.45rem);
    letter-spacing: 0.14em;
  }

  .landscape-blocker > span:last-child {
    color: rgba(226, 231, 246, 0.64);
    font-size: 0.76rem;
    letter-spacing: 0.08em;
  }

  .landscape-blocker__phone {
    position: relative;
    width: 38px;
    height: 62px;
    border: 2px solid rgba(255, 255, 255, 0.88);
    border-radius: 8px;
    box-shadow: 0 0 22px rgba(116, 194, 255, 0.24);
  }

  .landscape-blocker__phone::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 4px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
    transform: translateX(-50%);
  }
}

.bili-btn,
.social-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 50%;
  background: rgba(10, 10, 20, 0.55);
  color: #eef1ff;
  font-family: var(--font-display);
  font-size: clamp(0.7rem, 0.92vw, 0.86rem);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-decoration: none;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.bili-btn:hover,
.social-btn:hover {
  background: rgba(0, 160, 216, 0.72);
  border-color: rgba(255, 255, 255, 0.76);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.42), 0 0 18px rgba(0, 174, 236, 0.3);
}

.bili-logo {
  display: block;
  width: 22px;
  height: auto;
  object-fit: contain;
}

.social-logo {
  display: block;
  width: 22px;
  height: 22px;
  object-fit: contain;
  pointer-events: none;
}

.social-logo--x {
  width: 19px;
  height: 19px;
}

.social-logo--qq {
  width: 23px;
  height: 23px;
}

.social-btn--x:hover {
  background: rgba(45, 48, 58, 0.88);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.42), 0 0 18px rgba(255, 255, 255, 0.16);
}

.social-btn--qq:hover,
.social-btn--qq[aria-expanded="true"] {
  background: rgba(68, 153, 231, 0.76);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.42), 0 0 18px rgba(68, 153, 231, 0.32);
}

.social-btn--credits:hover,
.social-btn--credits[aria-expanded="true"] {
  background: rgba(190, 198, 220, 0.26);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.42), 0 0 18px rgba(255, 255, 255, 0.2);
}

.credits-logo {
  /* SVG 绘制：粗圆环 + 斜体小写 i（信息图标样式），由按钮 flex 居中保证视觉居中 */
  display: block;
  width: 18px;
  height: 18px;
  user-select: none;
}

.qq-modal {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: grid;
  place-items: center;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s ease, visibility 0s linear 0.28s;
}

.qq-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

.qq-modal__backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: rgba(3, 5, 12, 0.78);
  backdrop-filter: blur(12px) saturate(0.82);
  cursor: pointer;
}

.qq-modal__card {
  position: relative;
  width: min(360px, calc(100vw - 40px));
  max-height: calc(100svh - 40px);
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: linear-gradient(145deg, rgba(17, 21, 35, 0.98), rgba(7, 10, 20, 0.94));
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.64), 0 0 28px rgba(95, 198, 255, 0.16);
  transform: translateY(16px) scale(0.97);
  transition: transform 0.32s var(--ease);
}

.qq-modal.is-open .qq-modal__card {
  transform: none;
}

.qq-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0 0 2px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  background: rgba(5, 8, 18, 0.62);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.qq-modal__eyebrow {
  color: #73d9ff;
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.24em;
}

.qq-modal__title {
  margin: 5px 44px 14px 0;
  color: #f5f7ff;
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.08em;
}

.qq-modal__image {
  display: block;
  width: 100%;
  max-height: calc(100svh - 142px);
  object-fit: contain;
  background: #25252c;
}

.credits-modal {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: grid;
  place-items: center;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s ease, visibility 0s linear 0.28s;
}

.credits-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

.credits-modal__backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: rgba(3, 5, 12, 0.78);
  backdrop-filter: blur(12px) saturate(0.82);
  cursor: pointer;
}

.credits-modal__card {
  position: relative;
  width: min(500px, calc(100vw - 40px));
  max-height: calc(100svh - 40px);
  overflow-y: auto;
  padding: 26px 28px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: linear-gradient(145deg, rgba(17, 21, 35, 0.98), rgba(7, 10, 20, 0.94));
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.64), 0 0 28px rgba(200, 215, 255, 0.14);
  font-family: "Cinzel", "Noto Serif SC", "Songti SC", serif;
  transform: translateY(16px) scale(0.97);
  transition: transform 0.32s var(--ease);
}

.credits-modal.is-open .credits-modal__card {
  transform: none;
}

.credits-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0 0 2px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  background: rgba(5, 8, 18, 0.62);
  color: #fff;
  font-size: 1.55rem;
  line-height: 1;
  cursor: pointer;
}

.credits-modal__eyebrow {
  color: #a9c2ff;
  font-family: "Cinzel", "Noto Serif SC", serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.24em;
}

.credits-modal__title {
  margin: 6px 48px 18px 0;
  color: #f5f7ff;
  font-family: "Cinzel", "Noto Serif SC", serif;
  font-size: 1.45rem;
  letter-spacing: 0.08em;
}

.credits-list {
  display: grid;
  gap: 10px;
}

.credit-block {
  display: grid;
  gap: 2px;
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
}

.credit-line {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 7px 0;
}

.credit-line + .credit-line {
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

.credit-role {
  color: #9aa4c5;
  font-family: "Cinzel", "Noto Serif SC", serif;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.2em;
}

.credit-name {
  color: #eef1ff;
  font-size: 1.08rem;
  font-weight: 500;
  text-align: center;
  line-height: 1.4;
}

.credit-link {
  color: #8fd8ff;
  text-decoration: none;
  transition: color 0.2s ease;
}

.credit-link:hover {
  color: #ffffff;
  text-decoration: underline;
}

.home-btn {
  position: static;
  display: none;
  align-items: center;
  height: 40px;
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  background: rgba(10, 10, 20, 0.55);
  color: #eef1ff;
  font-family: var(--font-display);
  font-size: clamp(0.72rem, 1vw, 0.9rem);
  font-weight: 700;
  letter-spacing: 0.22em;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
  backdrop-filter: blur(6px);
  transition:
    opacity var(--transition-duration) var(--ease),
    transform var(--transition-duration) var(--ease),
    background 0.25s ease,
    box-shadow 0.25s ease,
    border-color 0.25s ease;
}

.stage.is-active .home-btn {
  display: inline-flex;
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.home-btn:hover {
  background: rgba(30, 30, 55, 0.8);
  border-color: rgba(255, 255, 255, 0.75);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.home-btn__mobile-label {
  display: none;
}

.now-playing {
  --np-accent-rgb: 151, 203, 239;
  position: fixed;
  left: clamp(18px, 3vw, 34px);
  bottom: clamp(16px, 3vh, 28px);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid rgba(var(--np-accent-rgb), 0.38);
  border-radius: 12px;
  background: rgba(8, 8, 16, 0.55);
  backdrop-filter: blur(8px);
  color: #c6cbe2;
  opacity: 0.85;
  pointer-events: auto; /* 允许操作播放/暂停与音量 */
  transition:
    opacity 0.4s ease,
    transform 0.4s var(--ease),
    border-color 0.35s ease,
    box-shadow 0.35s ease;
  box-shadow: 0 0 20px rgba(var(--np-accent-rgb), 0.12);
}

/* 未选择曲目时复用播放器外观显示 Tap the Character to Play，点击后切换为正常播放器。 */
.now-playing:not(.np-active) {
  opacity: 0.82;
  transform: none;
  pointer-events: auto;
  cursor: pointer;
}

.now-playing.np-prompt:hover,
.now-playing.np-prompt:focus-visible {
  opacity: 1;
  border-color: rgba(var(--np-accent-rgb), 0.72);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.34),
    0 0 20px rgba(var(--np-accent-rgb), 0.22);
  outline: none;
}

.now-playing.np-prompt .np-toggle,
.now-playing.np-prompt .np-volume {
  pointer-events: none;
}

.now-playing.np-prompt .np-volume {
  opacity: 0.28;
}

/* ---- 播放/暂停按钮 ---- */
.np-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #eef1ff;
  cursor: pointer;
  padding: 0;
  transition:
    background 0.25s ease,
    border-color 0.25s ease,
    transform 0.25s var(--ease),
    box-shadow 0.25s ease;
}

.np-toggle svg {
  width: 11px;
  height: 11px;
  fill: currentColor;
  display: block;
  margin-left: 1px;
}

.np-toggle:not(:disabled):hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.7);
  transform: scale(1.06);
  box-shadow: 0 0 14px rgba(var(--np-accent-rgb), 0.5);
}

.np-toggle:disabled {
  opacity: 0.4;
  cursor: default;
}

.np-toggle.np-playing {
  border-color: rgba(var(--np-accent-rgb), 0.85);
  color: rgb(var(--np-accent-rgb));
}

/* ---- 音量滑块 ---- */
.np-volume {
  -webkit-appearance: none;
  appearance: none;
  width: clamp(52px, 8vw, 88px);
  height: 4px;
  flex: 0 1 auto;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    rgb(var(--np-accent-rgb)) var(--vol, 70%),
    rgba(255, 255, 255, 0.18) var(--vol, 70%)
  );
  outline: none;
  cursor: pointer;
}

.np-volume-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 17px;
  width: 17px;
  height: 17px;
  color: rgba(238, 241, 255, 0.78);
}

.np-volume-icon svg {
  display: block;
  width: 17px;
  height: 17px;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.np-volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #eef1ff;
  border: none;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.55);
  transition: transform 0.2s ease;
}

.np-volume::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.np-volume::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #eef1ff;
  border: none;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.55);
}

.np-volume::-moz-range-track {
  height: 4px;
  border-radius: 4px;
  background: transparent;
}

.np-label {
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  color: #8d94b5;
}

.np-meta {
  margin-top: 1px;
  font-size: clamp(0.7rem, 0.95vw, 0.85rem);
  color: #eef1ff;
  white-space: nowrap;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.np-text.np-switching .np-meta {
  opacity: 0;
  transform: translateY(4px);
}

/* 播放中的均衡器动画 */
.np-eq {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 18px;
}

.np-eq span {
  width: 3px;
  height: 100%;
  border-radius: 2px;
  background: rgb(var(--np-accent-rgb));
  opacity: 0.35;
  transform-origin: bottom;
  transform: scaleY(0.3);
}

.now-playing.np-playing .np-eq span {
  opacity: 1;
  animation: eq 0.9s ease-in-out infinite alternate;
}

.now-playing.np-playing .np-eq span:nth-child(2) { animation-duration: 0.7s; }
.now-playing.np-playing .np-eq span:nth-child(3) { animation-duration: 1.1s; }
.now-playing.np-playing .np-eq span:nth-child(4) { animation-duration: 0.8s; }

@keyframes eq {
  from { transform: scaleY(0.22); }
  to { transform: scaleY(1); }
}

/* ============================ 环境特效 ============================ */

.fx-particles {
  position: absolute;
  inset: 0;
  z-index: 40;
  overflow: hidden;
  pointer-events: none;
}

.particle {
  position: absolute;
  bottom: -12px;
  width: var(--size, 4px);
  height: var(--size, 4px);
  border-radius: 50%;
  background: var(--accent, #7ee8c0);
  opacity: 0;
  animation: rise var(--dur, 12s) linear var(--delay, 0s) infinite;
}

.p0 { --accent: #97cbef; }
.p1 { --accent: #2ee6a8; }
.p2 { --accent: #b06bff; }
.p3 { --accent: #4d9fff; }

@keyframes rise {
  0% {
    transform: translate3d(0, 0, 0);
    opacity: 0;
  }
  10% {
    opacity: 0.65;
  }
  85% {
    opacity: 0.4;
  }
  100% {
    transform: translate3d(26px, -108vh, 0);
    opacity: 0;
  }
}

.fx-grain {
  position: absolute;
  inset: -60px;
  z-index: 60;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.1s steps(4) infinite;
}

@keyframes grain {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-18px, 12px); }
  50% { transform: translate(12px, -16px); }
  75% { transform: translate(-10px, -8px); }
  100% { transform: translate(14px, 10px); }
}

.fx-vignette {
  position: absolute;
  inset: 0;
  z-index: 55;
  pointer-events: none;
  background: radial-gradient(
    125% 105% at 50% 45%,
    transparent 55%,
    rgba(0, 0, 0, 0.55) 100%
  );
}

/* 右下角签名：竖排、低对比度，保持为装饰而不干扰操作。 */
.signature {
  position: fixed;
  right: clamp(20px, 3vw, 36px);
  bottom: clamp(20px, 3vh, 34px);
  z-index: 100;
  color: rgba(238, 241, 255, 0.64);
  font-family: "Cinzel", "Bodoni MT", "Times New Roman", serif;
  font-size: clamp(1.2rem, 1.65vw, 1.7rem);
  font-weight: 600;
  letter-spacing: 0.75em;
  line-height: 1;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
  writing-mode: vertical-rl;
  user-select: none;
  pointer-events: none;
}

.signature__roman {
  letter-spacing: 0.08em;
}

/* 鈴仙的展开介绍利用右侧横向空间，保持台词为单行。 */
@media (min-width: 1101px) and (min-height: 621px) {
  /* Center home labels in the visible area of each slanted panel. */
  .stage:not(.is-active) .panel .text {
    left: calc(50% - var(--panel-slant));
  }

  /* The first panel has no slanted neighbour on its left, so keep its label on-screen. */
  .stage:not(.is-active) .panel:nth-child(1) .text {
    left: calc(50% - var(--panel-slant) + 40px);
  }

  /* Use the available room on the right without letting the next slant cover the names. */
  .stage:not(.is-active) .panel:nth-child(2) .text {
    left: calc(50% - var(--panel-slant) + clamp(36px, 4vw, 72px));
  }

  .stage:not(.is-active) .panel:nth-child(3) .text {
    left: calc(50% - var(--panel-slant) + clamp(52px, 5vw, 92px));
  }

  /* Keep the first two names clear of the following panel at the lower slant. */
  .stage:not(.is-active) .panel:nth-child(1) .name,
  .stage:not(.is-active) .panel:nth-child(2) .name {
    font-size: clamp(1.35rem, 2.35vw, 2.3rem);
  }

  /* Keep Reisen's short home name on one line without squashing glyphs. */
  .stage:not(.is-active) .panel:nth-child(3) .text {
    width: 78%;
    max-width: 78%;
  }

  .stage:not(.is-active) .panel:nth-child(3) .name {
    width: auto;
    transform: none;
    font-size: clamp(1.3rem, 2.25vw, 2.35rem);
    letter-spacing: 0;
  }
  /* 宽屏下让凛世的短介绍保持单行，并为斜切信息卡补足横向空间。 */
  .panel:nth-child(1).panel--active .text {
    right: calc(6% + var(--panel-slant));
    width: min(52ch, 50%);
    max-width: 52ch;
  }

  .panel:nth-child(1).panel--active .about {
    max-width: none;
    white-space: nowrap;
    font-size: clamp(0.76rem, 1vw, 0.92rem);
    letter-spacing: -0.01em;
  }

  .panel:nth-child(1).panel--active .copy-id-row {
    width: min(300px, calc(100% - 12px));
    box-sizing: border-box;
  }

  .panel:nth-child(3).panel--active .text {
    right: calc(6% + var(--panel-slant));
    width: min(66ch, 62%);
    max-width: 66ch;
  }

  .panel:nth-child(3).panel--active .name {
    white-space: nowrap;
  }

  .panel:nth-child(3).panel--active .about {
    max-width: none;
    white-space: nowrap;
    font-size: clamp(0.76rem, 1vw, 0.92rem);
    letter-spacing: -0.01em;
  }

  .panel:nth-child(3).panel--active .profile-action {
    width: 160px;
    max-width: 100%;
    box-sizing: border-box;
  }
}

/* ============================ 响应式 ============================ */

@media (max-width: 820px) {
  :root {
    /* 移动端减小倾斜量 */
    --panel-slant: 44px;
    --character-overflow: clamp(30px, 10vw, 60px);
  }

  .logo img {
    width: clamp(40px, 7vw, 60px);
  }

  .name {
    font-size: clamp(1.1rem, 3.2vw, 1.7rem);
  }

  .text {
    max-width: 86%;
    bottom: 3.5%;
  }

  .about {
    font-size: 0.72rem;
  }

  .link {
    padding: 5px 10px;
    font-size: 0.66rem;
  }

  .home-btn,
  .now-playing {
    font-size: 0.72rem;
  }

  .signature {
    right: 16px;
    bottom: 16px;
    font-size: 1rem;
    letter-spacing: 0.55em;
  }

  .np-eq {
    height: 14px;
  }
}

/* 移动端（<=720px）：改为横向滑动四联屏，每个面板整屏显示 */
@media (max-width: 720px) and (orientation: portrait) {
  :root {
    /* 移动端减小角色放大倍数，避免头部被屏幕顶边裁掉 */
    --hover-character-scale: 1.04;
    --active-character-scale: 1.16;
  }

  .stage {
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .stage::-webkit-scrollbar {
    display: none;
  }

  .panels {
    width: 400vw;
  }

  .panel {
    flex: 0 0 100vw;
    scroll-snap-align: start;
  }

  /* 手机端将凛世背景向左取景，让人物主体落在画面中央。 */
  .panel[data-index="0"] .panel-bgmedia {
    background-position: 68% center;
  }

  .text {
    max-width: 74%;
    bottom: 13%; /* 抬高文字，避免被左下角 NOW PLAYING 浮层遮挡 */
  }

  .now-playing {
    padding: 6px 12px;
    gap: 8px;
  }

  .panel--active .text {
    left: 4%;
    right: 4%;
    bottom: 2.5%;
    width: auto;
    max-width: none;
    padding: 16px 22px;
  }

  .panel--active .text::before {
    background: linear-gradient(180deg, rgba(5, 5, 12, 0.4), rgba(5, 5, 12, 0.82));
  }

  .panel--active .details {
    max-height: 34vh;
  }

  .stage.is-active .panel:not(.panel--active) .text {
    left: 50%;
    right: auto;
    bottom: 13%;
    width: auto;
    max-width: 74%;
    transform: translateX(-50%);
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    padding: 0;
    border: 0;
    background: transparent;
    backdrop-filter: none;
    opacity: 1;
  }

  .stage.is-active .panel:not(.panel--active) .role {
    display: block;
  }

  .stage.is-active .panel:not(.panel--active) .name {
    font-size: clamp(1.1rem, 3.2vw, 1.7rem);
    letter-spacing: 0.05em;
    white-space: normal;
  }

  .collapsed-label,
  .stage.is-active .panel:not(.panel--active) .collapsed-label {
    display: none;
  }
}

@media (max-height: 560px) {
  .logo img {
    width: 48px;
  }

  .name {
    font-size: 1.2rem;
  }

  .about {
    margin: 6px 0 8px;
    line-height: 1.5;
  }
}

/* ============================ 纵向面板模式 ============================
   手机，以及无法舒适容纳四联屏的窄/矮桌面窗口，统一改为上下滑动。 */
@media (max-width: 1100px) and (orientation: portrait) {
  :root {
    --vertical-divider: clamp(30px, 5.5svh, 56px);
    --character-overflow: 0px;
  }

  html,
  body {
    overscroll-behavior-y: none;
  }

  .stage {
    overflow-x: hidden;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    scrollbar-width: none;
  }

  .stage::-webkit-scrollbar {
    display: none;
  }

  .panels {
    position: relative;
    width: 100%;
    height: auto;
    min-height: 400svh;
    display: flex;
    flex-direction: column;
  }

  .panel {
    flex: 0 0 100svh !important;
    width: 100%;
    min-width: 100%;
    height: 100svh;
    min-height: 480px;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    transition: none;
  }

  /* 纵排时取消横向平行四边形的 skew，改用斜向分隔带连接上下角色。 */
  .panel-shape,
  .panel-bgimg,
  .panel-clip,
  .character {
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    transform: none;
  }

  .panel-shape {
    box-shadow:
      inset 0 -1px 0 rgba(255, 255, 255, 0.16),
      0 0 28px rgba(var(--accent-rgb), 0.24);
  }

  /* 竖屏背景出现：纯淡入（无缩放、无裁剪、无延迟） */
  .panel-bgimg {
    clip-path: none;
    transform: none;
    transition: opacity 0.55s var(--ease);
    transition-delay: 0s;
  }

  .panel::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: var(--vertical-divider);
    z-index: 7;
    pointer-events: none;
    background: linear-gradient(90deg,
      rgba(var(--accent-rgb), 0.72),
      rgba(255, 255, 255, 0.28) 38%,
      rgba(7, 7, 15, 0.9));
    clip-path: polygon(0 82%, 100% 0, 100% 14%, 0 100%);
    filter: drop-shadow(0 -6px 14px rgba(var(--accent-rgb), 0.22));
  }

  .panel-bgmedia {
    left: 0;
    width: 100%;
    /* 竖屏下优先使用每个角色脸部所在位置，保证脸部不被 cover 裁掉 */
    background-size: var(--bg-size-v, cover);
    background-position: var(--vertical-bg-pos, var(--vertical-bg-position, var(--bg-position, center)));
    transform: translateX(var(--bg-shift-x-v, 0px))
      scale(var(--bg-scale-v, 1))
      rotate(var(--bg-rotate-v, 0deg));
    transform-origin: center center;
  }

  .panel-bg,
  .panel-content,
  .character-inner {
    transform: none;
  }

  .character,
  .panel--active .character {
    overflow: hidden !important;
  }

  /* 角色随面板经过视口中心产生轻微上下视差和聚焦放大。 */
  .stage .panel .character img {
    left: 50% !important;
    bottom: -5svh !important;
    height: 91svh !important;
    width: auto;
    --mobile-base-scale: 1;
    --mobile-focus-scale: 1;
    transform-origin: bottom center;
    transform:
      translate(
        calc(-50% + var(--mobile-char-x, 0px)),
        calc(var(--scroll-progress, 0) * -22px)
      )
      scale(var(--mobile-base-scale))
      scale(var(--mobile-focus-scale))
      scaleX(var(--char-flip, 1))
      scaleX(var(--char-width-scale, 1)) !important;
    transition:
      transform 0.5s var(--ease),
      filter 0.45s ease !important;
  }

  .stage .panel:nth-child(1) .character img {
    height: 90svh !important;
    bottom: -4svh !important;
    --mobile-char-x: -2vw;
  }

  .stage .panel:nth-child(2) .character img {
    height: 92svh !important;
    bottom: -6svh !important;
    --mobile-char-x: 1vw;
  }

  .stage .panel:nth-child(3) .character img {
    height: 96svh !important;
    bottom: -7svh !important;
    --mobile-char-x: -2vw;
    --mobile-base-scale: 1.03;
  }

  .stage .panel:nth-child(4) .character img {
    /* 保持猫耳位置，同时把腰线压到屏幕底部，统一为半身构图。 */
    height: 120svh !important;
    bottom: -84svh !important;
    --mobile-char-x: 10vw;
    --mobile-base-scale: 1.33;
  }

  .stage .panel.panel--scroll-focus .character img {
    --mobile-focus-scale: 1.035;
    filter:
      drop-shadow(0 0 2px rgba(255, 255, 255, 0.92))
      drop-shadow(0 0 12px rgba(255, 255, 255, 0.34));
  }

  .stage .panel:nth-child(1).panel--scroll-focus .character img {
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.28));
  }

  .stage .panel.panel--active .character img {
    --mobile-focus-scale: 1.055;
  }

  .logo,
  .stage:not(.is-active) .logo--gakumas,
  .stage:not(.is-active) .logo--reisen,
  .stage:not(.is-active) .logo--miku {
    top: max(68px, 10svh);
    left: 50%;
    transform: translate(-50%, -50%);
  }

  .logo img,
  .stage:not(.is-active) .logo--283 img,
  .stage:not(.is-active) .logo--gakumas img,
  .stage:not(.is-active) .logo--miku img {
    width: clamp(82px, 20vw, 136px);
  }

  .logo--reisen img {
    width: clamp(150px, 42vw, 230px);
  }

  .panel--scroll-focus .logo img {
    --logo-scale: 1.045;
    opacity: 0.96;
  }

  .panel--active .logo,
  .panel--active .logo.logo--gakumas,
  .panel--active .logo.logo--reisen,
  .panel--active .logo.logo--miku {
    top: max(68px, 10svh);
    left: 50%;
    transform: translate(-50%, -50%);
  }

  .panel--active .logo img,
  .panel--active .logo--gakumas img,
  .panel--active .logo--miku img {
    width: clamp(62px, 17vw, 94px);
  }

  .panel--active .logo--reisen img {
    width: clamp(132px, 38vw, 190px);
  }

  .text,
  .stage:not(.is-active) .panel:nth-child(3) .text {
    left: 50%;
    right: auto;
    top: auto;
    bottom: max(84px, 10svh);
    width: min(82%, 42rem);
    max-width: 82%;
    transform: translateX(-50%);
  }

  .role {
    font-size: clamp(0.62rem, 2.7vw, 0.82rem);
  }

  .name,
  .stage:not(.is-active) .panel:nth-child(3) .name {
    width: auto;
    font-size: clamp(1.65rem, 7vw, 2.8rem);
    line-height: 1.05;
    letter-spacing: 0.035em;
    white-space: nowrap;
    transform: none;
  }

  .panel--active .text {
    left: max(18px, env(safe-area-inset-left));
    right: max(18px, env(safe-area-inset-right));
    bottom: max(86px, calc(env(safe-area-inset-bottom) + 74px));
    width: auto;
    max-width: none;
    transform: none;
    padding: clamp(16px, 4vw, 24px) clamp(20px, 5vw, 30px);
  }

  .panel--active .text-inner {
    transform: none;
  }

  .panel--active .details {
    max-height: min(34svh, 280px);
  }

  /* 真机浏览器中 skew + 可滚动祖先可能留下透明楔形；竖屏改用完整多边形底板。 */
  .copy-id-row,
  .profile-action {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    border: 0;
    border-left: 0;
    background: rgba(var(--accent-rgb), 0.72);
    clip-path: polygon(4.5% 0, 100% 0, 95.5% 100%, 0 100%);
    transform: translateZ(0);
    box-shadow: none;
  }

  .copy-id-row::before,
  .profile-action::before {
    content: "";
    position: absolute;
    inset: 1px;
    z-index: 0;
    background: linear-gradient(90deg,
      rgba(var(--accent-rgb), 0.2),
      rgba(5, 8, 18, 0.74));
    clip-path: polygon(4.5% 0, 100% 0, 95.5% 100%, 0 100%);
    pointer-events: none;
  }

  .copy-id-inner,
  .profile-action > span {
    position: relative;
    z-index: 1;
    transform: none;
  }

  .copy-id-inner {
    padding-left: max(22px, 6vw);
    padding-right: max(22px, 6vw);
  }

  .profile-action {
    padding-left: max(24px, 6vw);
    padding-right: max(24px, 6vw);
  }

  .panel:nth-child(3).panel--active .about {
    white-space: nowrap;
    font-size: clamp(0.56rem, 2.2vw, 0.72rem);
    letter-spacing: -0.03em;
  }

  /* 展开一块面板后，其余面板仍保持完整纵向卡片，而不是压成窄条。 */
  .stage.is-active .panel:not(.panel--active) .text {
    left: 50%;
    right: auto;
    top: auto;
    bottom: max(84px, 10svh);
    width: min(82%, 42rem);
    max-width: 82%;
    transform: translateX(-50%);
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    padding: 0;
    border: 0;
    background: transparent;
    backdrop-filter: none;
    opacity: 1;
  }

  .stage.is-active .panel:not(.panel--active) .role {
    display: block;
  }

  .stage.is-active .panel:not(.panel--active) .name {
    font-size: clamp(1.65rem, 7vw, 2.8rem);
    line-height: 1.05;
    letter-spacing: 0.035em;
    white-space: nowrap;
  }

  .collapsed-label,
  .stage.is-active .panel:not(.panel--active) .collapsed-label {
    display: none;
  }

  .top-actions {
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    gap: 8px;
  }

  .home-btn__desktop-label {
    display: none;
  }

  .home-btn__mobile-label {
    display: none;
  }

  .home-btn {
    width: 40px;
    min-width: 40px;
    padding: 0;
    justify-content: center;
    letter-spacing: 0;
  }

  .page-indicator {
    position: fixed;
    left: max(14px, env(safe-area-inset-left));
    right: auto;
    top: 50%;
    bottom: auto;
    z-index: 112;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transform: translateY(-50%);
    pointer-events: none;
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.72));
  }

  .page-indicator::before,
  .page-indicator::after {
    content: "";
    display: block;
    width: 7px;
    height: 7px;
    border-top: 1.5px solid rgba(255, 255, 255, 0.72);
    border-left: 1.5px solid rgba(255, 255, 255, 0.72);
  }

  .page-indicator::before {
    margin-bottom: 3px;
    transform: rotate(45deg);
  }

  .page-indicator::after {
    margin-top: 3px;
    transform: rotate(225deg);
  }

  .page-indicator__dot {
    display: block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.42);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
    transform: scale(1);
    transition:
      background 0.28s ease,
      transform 0.35s var(--ease),
      box-shadow 0.28s ease;
  }

  .page-indicator__dot.is-current {
    background: #fff;
    transform: scale(1.16);
    box-shadow:
      0 0 0 1px rgba(0, 0, 0, 0.1),
      0 0 8px rgba(255, 255, 255, 0.42);
  }

  .now-playing {
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    width: auto;
    max-width: 540px;
    padding: 7px 10px;
    gap: 8px;
  }

  .np-meta {
    max-width: min(48vw, 300px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .np-volume {
    width: auto;
    min-width: 0;
    flex: 1 1 72px;
  }

  .np-text {
    min-width: 0;
    flex: 0 1 auto;
  }

  .np-volume-icon {
    margin-left: auto;
  }

  .signature {
    top: 50%;
    right: max(6px, env(safe-area-inset-right));
    bottom: auto;
    transform: translateY(-50%);
    font-size: clamp(0.84rem, 3vw, 1.15rem);
    letter-spacing: 0.45em;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
}

.panel-shape,
.panel-clip,
.panel-bgimg {
  contain: strict; 
}

.character {
  contain: layout size; 
}
