/* ===== AI Girl fumo ===== */

@property --fade-start {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

@property --fade-end {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

:root {
  /* 由 app.js 按当前角色写入 */
  --accent: #BF5320;
  --line: #BF532066;
  --faint: #BF53201F;
  --page: #FBEEE4;
  --glow: #BF53202E;
  --p1: #E0662A;
  --p2: #F4ECDD;

  /* 白天 */
  --ink: #1F1A2B;
  --muted: #4A3F5C;
  --body: #3A3150;
  --panel: rgba(255, 255, 255, .66);
  --panel-line: rgba(255, 255, 255, .92);
  --chip: rgba(255, 255, 255, .78);
  --card: #FFFFFF;
  --arch: rgba(255, 255, 255, .78);
  --on-accent: #FFFFFF;
  --btn: #1F1A2B;
  --on-btn: #FFFFFF;
  --polaroid: #FFFFFF;
  --petal: #F2A7BC;
  --night: 0;
  --scrollbar-track: #EDE4D8;
  --scrollbar-thumb: #7B6C82;

  --en: 'Cormorant Garamond', 'Times New Roman', serif;
  --zh: 'ZCOOL XiaoWei', 'Noto Serif SC', 'Songti SC', serif;
  --sans: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;

  color-scheme: light;
  accent-color: var(--accent);
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

:root[data-theme="night"] {
  --ink: #F1EEF8;
  --muted: #BDB6D3;
  --body: #DCD6EA;
  --panel: rgba(255, 255, 255, .055);
  --panel-line: rgba(255, 255, 255, .11);
  --chip: rgba(255, 255, 255, .08);
  --card: #1D1A2A;
  --arch: rgba(255, 255, 255, .07);
  --on-accent: #15121F;
  --btn: #F1EEF8;
  --on-btn: #15121F;
  --polaroid: #EDE7DA;
  --petal: #F7C6D3;
  --night: 1;
  --scrollbar-track: #171423;
  --scrollbar-thumb: #6E6689;

  color-scheme: dark;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

* { box-sizing: border-box; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  overflow-x: hidden;
  transition: background-color .32s ease, color .25s ease;
}

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

a { color: var(--accent); }
a:hover { color: var(--ink); }

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

:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

img { max-width: 100%; }

/* 仅对屏幕阅读器可见；获得焦点时（如跳过导航链接）自动显示 */
.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}

.skip-link:focus-visible {
  position: fixed;
  left: 16px;
  top: 16px;
  z-index: 100;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .35);
}

/* ===== 天空：星星 / 流星 / 月亮 / 樱花 ===== */

.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.night-only {
  position: absolute;
  inset: 0;
  opacity: var(--night);
  transition: opacity .9s ease;
}

.stars {
  position: absolute;
  inset: 0;
  background-repeat: repeat;
  opacity: .75;
}

.stars.s1 {
  background-size: 380px 340px;
  background-image:
    radial-gradient(1.4px 1.4px at 24px 36px, #fff, transparent),
    radial-gradient(1px 1px at 92px 140px, rgba(255,255,255,.85), transparent),
    radial-gradient(1.6px 1.6px at 170px 60px, #fff, transparent),
    radial-gradient(1px 1px at 240px 210px, rgba(255,255,255,.7), transparent),
    radial-gradient(1.2px 1.2px at 310px 110px, #fff, transparent),
    radial-gradient(1px 1px at 350px 290px, rgba(255,255,255,.8), transparent),
    radial-gradient(1.3px 1.3px at 60px 260px, rgba(255,240,220,.9), transparent),
    radial-gradient(1px 1px at 140px 320px, rgba(255,255,255,.6), transparent);
}

.stars.s2 {
  background-size: 560px 480px;
  background-image:
    radial-gradient(2px 2px at 80px 90px, rgba(220,230,255,.95), transparent),
    radial-gradient(1.2px 1.2px at 260px 30px, #fff, transparent),
    radial-gradient(1.8px 1.8px at 420px 200px, rgba(255,230,240,.9), transparent),
    radial-gradient(1px 1px at 500px 400px, #fff, transparent),
    radial-gradient(1.5px 1.5px at 200px 380px, rgba(255,255,255,.85), transparent),
    radial-gradient(1px 1px at 340px 300px, rgba(255,255,255,.7), transparent);
}

.shoot {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 150px;
  height: 1.5px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(255,255,255,.95), rgba(255,255,255,0));
  rotate: -28deg;
  opacity: 0;
}

.moon {
  position: absolute;
  top: 76px;
  right: 7vw;
  width: 86px;
  height: 86px;
  border-radius: 50%;
  box-shadow: inset -22px 10px 0 0 #F7EFD2;
  filter: drop-shadow(0 0 24px rgba(247, 239, 210, .42));
  rotate: -14deg;
}

.petals { position: absolute; inset: 0; transition: opacity .6s ease; }
.petals.off { opacity: 0; }

.petal {
  position: absolute;
  top: 0;
  opacity: 0;
}

.petal i {
  display: block;
  width: 100%;
  height: 100%;
}

.petal svg { display: block; width: 100%; height: 100%; fill: var(--petal); opacity: .88; }

@media (prefers-reduced-motion: no-preference) {
  .stars { animation: twinkleLayer 5s ease-in-out infinite alternate; }
  .stars.s2 { animation-delay: -2.5s; }
  .shoot { animation: shoot 9.2s linear infinite; animation-delay: var(--d); }
  .petal { opacity: 1; animation: fall linear infinite; will-change: transform; }
  .petal i { animation: sway ease-in-out infinite; }
}

@keyframes twinkleLayer {
  from { opacity: .45; }
  to { opacity: 1; }
}

@keyframes shoot {
  0%, 86% { opacity: 0; translate: 0 0; }
  88% { opacity: 1; }
  100% { opacity: 0; translate: -460px 0; }
}

@keyframes fall {
  from { transform: translateY(-6vh); }
  to { transform: translateY(108vh); }
}

@keyframes sway {
  0% { transform: translateX(0) rotate(0deg); }
  25% { transform: translateX(30px) rotate(90deg); }
  50% { transform: translateX(-14px) rotate(180deg); }
  75% { transform: translateX(26px) rotate(270deg); }
  100% { transform: translateX(0) rotate(360deg); }
}

/* ===== 顶部导航与 Hero ===== */

.wrap { position: relative; z-index: 1; }

.nav {
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px 24px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--en);
  font-weight: 600;
  font-size: 24px;
  letter-spacing: .03em;
}
.brand em { font-style: italic; color: var(--accent); }
.brand .spark { fill: var(--accent); transition: fill .5s; }

.nav-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-links a {
  display: inline-flex;
  align-items: center;
  min-block-size: 40px;
  padding: 0 14px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 14px;
  color: var(--muted);
  transition: color .2s, background-color .2s;
}
.nav-links a:hover {
  color: var(--ink);
  background: var(--chip);
}

.nav-tools { display: flex; gap: 8px; }

.icon-btn {
  position: relative;
  min-inline-size: 44px;
  min-block-size: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--chip);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color .25s, color .25s, transform .2s, border-color .25s;
  backdrop-filter: blur(6px);
}
.icon-btn:hover { transform: translateY(-2px); border-color: var(--accent); }
.icon-btn[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: transparent; }
#btn-theme[aria-pressed="true"] .i-sun,
#btn-theme[aria-pressed="false"] .i-moon { display: none; }
#btn-music .eq { position: absolute; bottom: 6px; display: none; }
#btn-music[aria-pressed="true"] svg { translate: 0 -3px; }
#btn-music[aria-pressed="true"] .eq { display: inline-flex; }

/* 音量跳动条 */
.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 8px; }
.eq i { display: block; width: 2px; height: 100%; border-radius: 1px; background: currentColor; transform-origin: bottom; transform: scaleY(.55); }
@media (prefers-reduced-motion: no-preference) {
  .eq i { animation: eq .9s ease-in-out infinite; }
  .eq i:nth-child(2) { animation-delay: -.3s; }
  .eq i:nth-child(3) { animation-delay: -.6s; }
  .eq i:nth-child(4) { animation-delay: -.15s; }
}
@keyframes eq { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }

.hero {
  position: relative;
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 24px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.kicker {
  margin: 0;
  font-family: var(--en);
  font-style: italic;
  font-size: 17px;
  letter-spacing: .08em;
  color: var(--accent);
  transition: color .35s;
}

.hero h1 {
  margin: 0;
  font-family: var(--en);
  font-weight: 600;
  font-size: clamp(38px, 5.2vw, 64px);
  line-height: 1.02;
  letter-spacing: .01em;
}
.hero h1 em { font-style: italic; color: var(--accent); transition: color .35s; }

.hero-zh {
  margin: 2px 0 0;
  font-family: var(--zh);
  font-size: clamp(16px, 1.8vw, 20px);
  letter-spacing: .26em;
}

.lead { margin: 5px 0 0; max-width: 680px; color: var(--muted); font-size: 13.5px; }

/* ===== 快速切换角色头像栏（带滚动边缘淡出提示） ===== */

.dock-wrap {
  max-width: 1280px;
  margin: 0 auto 14px;
  padding: 0 24px;
}

.dock-scroller {
  display: flex;
  align-items: center;
  justify-content: safe center;
  gap: 5px;
  padding: 6px 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-padding-inline: 2.5rem;
  border-radius: 999px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--panel-line), 0 12px 30px var(--glow);
  backdrop-filter: blur(8px);
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;

  --fade-size: 2.5rem;
  --fade-dir: right;
  --fade-start-pos: 0;
  --fade-end-pos: 100%;
  mask:
    linear-gradient(black, black) no-clip subtract,
    linear-gradient(to var(--fade-dir), black, transparent) var(--fade-start-pos) 0 / var(--fade-start) 100% no-repeat no-clip,
    linear-gradient(to var(--fade-dir), transparent, black) var(--fade-end-pos) 0 / var(--fade-end) 100% no-repeat no-clip;
  animation: reveal-fade-start linear both, hide-fade-end linear both;
  animation-timeline: scroll(self inline);
  animation-range: 0 var(--fade-size), calc(100% - var(--fade-size)) 100%;
  transition: --fade-start .2s, --fade-end .2s;
}

.dock-scroller.more-start { --fade-start: var(--fade-size); }
.dock-scroller.more-end { --fade-end: var(--fade-size); }

@keyframes reveal-fade-start {
  to { --fade-start: var(--fade-size); }
}

@keyframes hide-fade-end {
  from { --fade-end: var(--fade-size); }
}

.dock-item {
  --cc: var(--cd);
  flex: 0 0 auto;
  min-block-size: 38px;
  padding: 3px 9px 3px 4px;
  border-radius: 999px;
  border: 1.5px solid transparent;
  background: var(--chip);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 500;
  transition: transform .2s, border-color .2s, background-color .25s, color .25s, box-shadow .25s;
}
:root[data-theme="night"] .dock-item { --cc: var(--cn); }
.dock-item:hover {
  transform: translateY(-2px);
  border-color: var(--cc);
}
.dock-item[aria-current="true"] {
  background: var(--cc);
  color: var(--on-accent);
  border-color: transparent;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--cc) 38%, transparent);
}
.dock-item img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  background: #E9DCC6;
  border: 1.5px solid rgba(255, 255, 255, .75);
}

/* ===== 详情舞台 ===== */

.stage-wrap { max-width: 1280px; margin: 0 auto; padding: 0 24px; scroll-margin-top: 16px; }

.stage {
  position: relative;
  overflow: clip;
  border-radius: 34px;
  padding: clamp(20px, 2.6vw, 32px);
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--panel-line), 0 30px 60px var(--glow);
  backdrop-filter: blur(10px);
  transition: box-shadow .4s ease, background-color .35s ease;
}

.stage-aura {
  position: absolute;
  inset: -20%;
  pointer-events: none;
  background:
    radial-gradient(circle at 52% 45%, color-mix(in srgb, var(--p1) 18%, transparent) 0%, transparent 52%),
    radial-gradient(circle at 22% 80%, color-mix(in srgb, var(--p2) 15%, transparent) 0%, transparent 48%);
  transition: opacity .6s ease;
}

.deco-watermark {
  position: absolute;
  right: -20px;
  top: -36px;
  font-family: var(--en);
  font-style: italic;
  font-weight: 600;
  font-size: clamp(110px, 15vw, 220px);
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1.5px var(--line);
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}

.deco-num {
  position: absolute;
  left: 24px;
  bottom: -36px;
  font-family: var(--en);
  font-weight: 600;
  font-size: clamp(130px, 15vw, 210px);
  line-height: 1;
  color: var(--faint);
  pointer-events: none;
  user-select: none;
}

.deco-dots {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 420px;
  height: 300px;
  background-image: radial-gradient(var(--line) 1.3px, transparent 1.6px);
  background-size: 18px 18px;
  -webkit-mask-image: linear-gradient(315deg, #000 10%, transparent 70%);
  mask-image: linear-gradient(315deg, #000 10%, transparent 70%);
  pointer-events: none;
}

.twinkle { position: absolute; fill: var(--accent); pointer-events: none; opacity: .55; }
.twinkle.t1 { left: 44%; top: 36px; }
.twinkle.t2 { left: 62%; top: 112px; }
.twinkle.t3 { left: 36%; bottom: 110px; }

@media (prefers-reduced-motion: no-preference) {
  .twinkle { animation: tw 3.2s ease-in-out infinite; }
  .twinkle.t2 { animation-delay: .8s; }
  .twinkle.t3 { animation-delay: 1.6s; }
}

@keyframes tw {
  0%, 100% { opacity: .25; transform: scale(.7) rotate(0deg); }
  50% { opacity: 1; transform: scale(1) rotate(20deg); }
}

.stage-grid {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: clamp(22px, 3.2vw, 44px);
  align-items: stretch;
}

/* 信息列 */
.info { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 12px; padding-top: 2px; }

.no-line { display: flex; align-items: center; gap: 12px; font-size: 13px; letter-spacing: .22em; color: var(--muted); }
.no-line .rule { flex: 0 0 42px; height: 1px; background: var(--accent); }
.region-badge {
  margin-left: auto;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--chip);
  font-size: 12px;
  letter-spacing: .06em;
  color: var(--ink);
}

.name {
  margin: 0;
  font-family: var(--en), var(--zh);
  font-weight: 600;
  font-size: clamp(40px, 4.4vw, 60px);
  line-height: 1.02;
  color: var(--accent);
  transition: color .35s;
}
.full { font-size: 13px; letter-spacing: .2em; color: var(--muted); margin-top: 3px; }

.epithet { margin: 0; font-family: var(--zh); font-size: 21px; line-height: 1.35; }
.tagline { margin: 0; color: var(--body); font-size: 14.5px; line-height: 1.8; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags span { padding: 4px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--chip); font-size: 13px; }

.anchors { margin: 0; border-top: 1px dashed var(--line); }
.anchors div { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.anchors dt { color: var(--muted); }
.anchors dd { margin: 0; }

.palette { display: flex; align-items: center; gap: 14px; }
.palette .label { font-size: 13px; color: var(--muted); letter-spacing: .12em; }
.swatches { display: inline-flex; gap: 12px; }
.swatches span { width: 24px; height: 24px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(128, 120, 150, .35), 0 0 0 4px var(--chip); }

.song {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 16px 11px 12px;
  border-radius: 20px;
  background: var(--chip);
  border: 1px solid var(--line);
  transition: border-color .3s, box-shadow .3s;
}
.song.playing {
  border-color: var(--accent);
  box-shadow: 0 8px 24px var(--glow);
}
.play {
  flex: 0 0 auto;
  min-inline-size: 46px;
  min-block-size: 46px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: var(--on-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .2s, background-color .5s;
}
.play:hover { transform: scale(1.06); }
.play[aria-pressed="true"] .i-play,
.play[aria-pressed="false"] .i-pause { display: none; }
.song-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.4; }
.song-kicker { font-size: 12px; color: var(--muted); letter-spacing: .12em; }
.song-title { font-family: var(--zh); font-size: 19px; }
.song-meta { font-size: 12px; color: var(--muted); }
.song .eq.big { margin-left: auto; height: 18px; gap: 3px; color: var(--accent); visibility: hidden; }
.song .eq.big i { width: 3px; }
.song.playing .eq.big { visibility: visible; }

.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: auto; padding-top: 4px; }
.round {
  min-inline-size: 48px;
  min-block-size: 48px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .2s, background-color .25s, border-color .25s;
}
.round:hover { transform: translateY(-2px); }
.round.ghost { border: 1.5px solid var(--ink); background: transparent; color: var(--ink); }
.round.solid { border: none; background: var(--btn); color: var(--on-btn); }

.pill-btn {
  min-block-size: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--chip);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: transform .2s, border-color .2s, background-color .2s;
}
.pill-btn:hover { transform: translateY(-2px); border-color: var(--accent); }

.next-name { margin-left: auto; font-family: var(--en); font-style: italic; font-size: 19px; color: var(--muted); }

/* FUMO 列 */
.fumo { flex: 1 1 360px; max-width: 440px; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.fumo-cap { margin: 0; font-family: var(--en); font-style: italic; font-size: 17px; letter-spacing: .14em; color: var(--muted); }

.zoomable { cursor: zoom-in; }

.arch {
  position: relative;
  width: 100%;
  padding: 9px;
  border: 1.5px solid var(--line);
  border-radius: 96px 96px 34px 34px;
  background: var(--arch);
  box-shadow: 0 24px 48px var(--glow);
  touch-action: pan-y;
  cursor: grab;
  transition: transform .3s ease, border-color .3s ease;
}
.arch:hover { transform: translateY(-4px); border-color: var(--accent); }
.arch.dragging { cursor: grabbing; }
.arch-inner { display: block; border-radius: 88px 88px 26px 26px; overflow: hidden; background: #E3CCA8; aspect-ratio: 1 / 1; }
.bob { display: block; width: 100%; height: 100%; }
@media (prefers-reduced-motion: no-preference) {
  .bob { animation: bob 4.2s ease-in-out infinite; }
}
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.arch img { display: block; width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; transition: opacity .22s ease; }

.drag-hint {
  position: absolute;
  left: 50%;
  bottom: 20px;
  translate: -50% 0;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(21, 18, 31, .68);
  color: #F6F1EA;
  font-size: 12px;
  letter-spacing: .04em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.arch:hover .drag-hint,
.arch:focus-visible .drag-hint,
.arch.dragging .drag-hint { opacity: 1; }

.views-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.views {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  padding: 5px;
  border-radius: 999px;
  background: var(--chip);
  box-shadow: 0 0 0 1px var(--line);
}
.views button {
  min-inline-size: 58px;
  min-block-size: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color .25s, color .25s;
}
.views button[aria-selected="true"] { background: var(--accent); color: var(--on-accent); }

.spin-btn {
  min-block-size: 44px;
  padding: 0 15px;
  border-radius: 999px;
  border: 1.5px dashed var(--accent);
  background: var(--chip);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background-color .25s, color .25s, border-style .2s;
}
.spin-btn[aria-pressed="true"] {
  background: var(--accent);
  color: var(--on-accent);
  border-style: solid;
}

.view-note { margin: 0; font-size: 13px; color: var(--muted); text-align: center; }

/* 原画列 */
.original { flex: 0 1 268px; min-width: 210px; display: flex; gap: 12px; align-items: flex-start; align-self: center; }
.vertical { writing-mode: vertical-rl; font-family: var(--zh); font-size: 18px; letter-spacing: .55em; color: var(--accent); padding-top: 12px; transition: color .5s; }
.ref-card {
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px;
  border: none;
  border-radius: 22px;
  background: #FFFFFF;
  color: #4A3F5C;
  box-shadow: 0 0 0 1px var(--line), 0 0 0 6px var(--chip), 0 0 0 7px var(--line), 0 24px 44px var(--glow);
  transition: transform .3s ease;
}
.ref-card:hover { transform: translateY(-4px) rotate(-.4deg); }
.ref-card img { display: block; width: 100%; height: auto; aspect-ratio: 447 / 800; object-fit: contain; border-radius: 16px; background: #FFFFFF; transition: opacity .22s ease; }
.ref-foot { display: flex; justify-content: space-between; align-items: center; padding: 10px 6px 2px; font-size: 12px; letter-spacing: .12em; }

img.swapping { opacity: .2; }

/* ===== 下方区块（首屏外延迟渲染） ===== */

.section { max-width: 1280px; margin: 0 auto; padding: 88px 24px 0; display: flex; flex-direction: column; align-items: center; gap: 28px; scroll-margin-top: 16px; }
.section-head { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.section-head h2 { margin: 0; font-family: var(--zh); font-weight: 400; font-size: 38px; letter-spacing: .16em; }
.section-head .sub { margin: 4px 0 0; font-size: 14px; color: var(--muted); }

.section-deferred { content-visibility: auto; }
.roster-section { contain-intrinsic-size: auto none auto 960px; }
.group-section { contain-intrinsic-size: auto none auto 780px; }

/* 筛选与搜索栏 */
.roster-toolbar {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 18px;
}

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

.filter-btn {
  min-block-size: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--chip);
  color: var(--ink);
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background-color .25s, color .25s, border-color .25s, transform .2s;
}
.filter-btn span {
  font-size: 12px;
  opacity: .75;
}
.filter-btn:hover { transform: translateY(-1px); border-color: var(--accent); }
.filter-btn[aria-pressed="true"] {
  background: var(--accent);
  color: var(--on-accent);
  border-color: transparent;
}

.search-box {
  position: relative;
  flex: 0 1 290px;
  width: 100%;
}
.search-ico {
  position: absolute;
  left: 14px;
  top: 50%;
  translate: 0 -50%;
  color: var(--muted);
  pointer-events: none;
}
.search-box input {
  width: 100%;
  min-block-size: 44px;
  padding: 0 16px 0 40px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--chip);
  color: var(--ink);
  font-size: 14px;
  transition: border-color .2s, background-color .25s;
}
.search-box input::placeholder { color: var(--muted); opacity: .85; }
.search-box input:focus { border-color: var(--accent); }

.roster-empty {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
}
.link-btn {
  border: none;
  background: none;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
  padding: 4px 6px;
}

/* 角色卡 */
.roster { width: 100%; display: grid; grid-template-columns: repeat(auto-fill, minmax(154px, 1fr)); gap: 20px; }

.card {
  --cc: var(--cd);
  position: relative;
  padding: 0;
  text-align: left;
  border-radius: 24px;
  border: 2px solid transparent;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  box-shadow: 0 6px 18px rgba(20, 16, 30, .10);
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease, background-color .5s;
}
.card[hidden] { display: none; }
:root[data-theme="night"] .card { --cc: var(--cn); }
.card:hover { transform: translateY(-8px); box-shadow: 0 22px 40px rgba(20, 16, 30, .22); }
.card[aria-pressed="true"] { border-color: var(--cc); transform: translateY(-8px); box-shadow: 0 22px 40px color-mix(in srgb, var(--cc) 35%, transparent); }
.card .art { position: relative; display: block; border-radius: 22px 22px 0 0; overflow: hidden; background: #FFFFFF; }
.card .art img { display: block; width: 100%; height: auto; aspect-ratio: 447 / 800; object-fit: contain; transition: transform .4s ease; }
.card:hover .art img { transform: scale(1.03); }
.card .num { position: absolute; left: 10px; top: 8px; font-family: var(--en); font-weight: 600; font-size: 22px; line-height: 1; color: var(--cd); }
.card .label { position: relative; display: flex; flex-direction: column; padding: 12px 12px 14px; border-top: 4px solid var(--cc); }
.card .avatar {
  position: absolute;
  right: 10px;
  top: -40px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--card);
  box-shadow: 0 0 0 2px var(--cc), 0 6px 14px rgba(20, 16, 30, .25);
  background: #E9DCC6;
}
.card .t { font-family: var(--en), var(--zh); font-weight: 600; font-size: 20px; line-height: 1.2; padding-right: 56px; }
.card .e { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }

/* 合照 */
.polaroid {
  margin: 0;
  width: 100%;
  max-width: 1100px;
  padding: clamp(10px, 1.6vw, 20px) clamp(10px, 1.6vw, 20px) 0;
  border-radius: 10px;
  background: var(--polaroid);
  color: #1F1A2B;
  box-shadow: 0 30px 60px rgba(10, 8, 20, .25);
  rotate: -.5deg;
  transition: transform .35s ease;
}
.polaroid:hover { transform: scale(1.01); }
.polaroid .plain { display: block; width: 100%; padding: 0; border: none; background: none; }
.polaroid img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; border-radius: 4px; background: #E9DCC6; }
.polaroid figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; padding: 16px 4px 18px; }
.polaroid .hand { font-family: var(--zh); font-size: 22px; }
.polaroid .small { font-size: 13px; color: #4A3F5C; letter-spacing: .1em; }

.footer {
  max-width: 1280px;
  margin: 0 auto;
  padding: 96px 24px 52px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}
.footer kbd {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: var(--chip);
  font-family: inherit;
  font-size: 12px;
  color: var(--ink);
}

/* ===== 大图模态弹窗（支持顶层动画、点击遮罩关闭与滚轮隔离） ===== */

dialog.lightbox {
  width: fit-content;
  max-width: min(94vw, 980px);
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 18px 20px 20px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 26px;
  background: rgba(24, 20, 36, .94);
  color: #F6F3FC;
  box-shadow: 0 32px 90px rgba(0, 0, 0, .55);
  overflow: auto;
  overscroll-behavior: contain;

  opacity: 0;
  transition-property: opacity, transform, display, overlay;
  transition-duration: .26s;
  transition-timing-function: ease-out;
  transition-behavior: allow-discrete;
}

@media (prefers-reduced-motion: no-preference) {
  dialog.lightbox { transform: scale(.94); }
}

dialog.lightbox::backdrop {
  background-color: rgba(14, 11, 24, 0);
  backdrop-filter: blur(0px);
  overflow: hidden;
  overscroll-behavior: contain;
  transition-property: background-color, backdrop-filter, display, overlay;
  transition-duration: .26s;
  transition-timing-function: ease-out;
  transition-behavior: allow-discrete;
}

:is(dialog.lightbox[open]):where(:not([data-closing])) {
  opacity: 1;

  @starting-style {
    opacity: 0;
  }

  @media (prefers-reduced-motion: no-preference) {
    transform: scale(1);

    @starting-style {
      transform: scale(.94);
    }
  }

  &::backdrop {
    background-color: rgba(14, 11, 24, .82);
    backdrop-filter: blur(6px);

    @starting-style {
      background-color: rgba(14, 11, 24, 0);
      backdrop-filter: blur(0px);
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  dialog.lightbox,
  dialog.lightbox::backdrop {
    transition-duration: .1s;
  }
}

.lb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.lb-cap {
  margin: 0;
  font-family: var(--zh);
  font-size: 20px;
  letter-spacing: .08em;
}
.lb-close {
  --btn: #FFFFFF;
  --on-btn: #15121F;
  flex: 0 0 auto;
}

.lb-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.lb-figure {
  margin: 0;
  display: flex;
  justify-content: center;
}
.lb-figure img {
  display: block;
  max-width: min(76vw, 780px);
  max-height: 70dvh;
  width: auto;
  height: auto;
  border-radius: 16px;
  background: #FFFFFF;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .4);
}
.lb-nav {
  flex: 0 0 auto;
  --ink: #F6F3FC;
  border-color: rgba(255, 255, 255, .35);
}
.lb-nav[hidden] { display: none; }

.lb-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 14px;
}
.lb-tabs[hidden] { display: none; }
.lb-tabs button {
  min-inline-size: 56px;
  min-block-size: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .24);
  background: rgba(255, 255, 255, .08);
  color: #F6F3FC;
  font-size: 13px;
  cursor: pointer;
  transition: background-color .2s, color .2s, border-color .2s;
}
.lb-tabs button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--on-accent);
  border-color: transparent;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  translate: -50% 0;
  z-index: 20;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--btn);
  color: var(--on-btn);
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}
.toast.show { opacity: 1; }

/* WebKit 滚动条回退（仅当不支持标准 scrollbar-color 时生效） */
@supports not (scrollbar-color: auto) {
  :root,
  .dock-scroller {
    scrollbar-width: auto;
  }
  ::-webkit-scrollbar {
    width: 10px;
    height: 8px;
  }
  ::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 999px;
  }
  ::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
  }
}

/* ===== 小屏适配 ===== */

@media (pointer: coarse) {
  .dock-item {
    min-block-size: 44px;
    padding: 4px 12px 4px 5px;
    font-size: 13px;
  }
}

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

@media (max-width: 720px) {
  .hero { padding: 18px 18px 14px; }
  .moon { width: 60px; height: 60px; top: 68px; right: 6vw; box-shadow: inset -15px 7px 0 0 #F7EFD2; }
  .dock-wrap { padding: 0 16px; }
  .dock-scroller { border-radius: 22px; }
  .stage-wrap { padding: 0 16px; }
  .stage { border-radius: 26px; padding: 20px 18px; }
  .original { flex-basis: 100%; justify-content: center; }
  .ref-card { max-width: 280px; }
  .roster { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .section { padding: 68px 16px 0; }
  .section-head h2 { font-size: 32px; }
  .search-box { flex-basis: 100%; }
  .next-name { margin-left: 0; }
  dialog.lightbox { padding: 14px; border-radius: 20px; }
  .lb-stage { gap: 6px; }
  .lb-nav { min-inline-size: 40px; min-block-size: 40px; }
  .lb-figure img { max-width: 72vw; max-height: 62dvh; }
}
