/* ZT-000 移动端优先。所有尺寸按 4px 基准，字号按 14/16/18/22/26/34/44。
   暖黑纸感基调 + 思源宋体子集自托管，借鉴 chellyzhe.com 的阅读排版。 */

@font-face {
  font-family: "ZT Serif";
  src: url("../assets/fonts/zt-serif-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "ZT Serif";
  src: url("../assets/fonts/zt-serif-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --ink: #171614;
  --ink-2: #262119;
  --ink-3: #211f1c;
  --paper: #e8e6e1;
  --paper-dim: rgba(232, 230, 225, 0.55);
  --paper-faint: rgba(232, 230, 225, 0.26);
  --vermilion: #c9674a;
  --gold: #b99a5b;
  --gold-faint: rgba(185, 154, 91, 0.32);

  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s6: 24px;
  --s8: 32px;
  --s12: 48px;
  --s16: 64px;

  --f1: 14px;
  --f2: 16px;
  --f3: 18px;
  --f4: 22px;
  --f5: 26px;
  --f6: 34px;
  --f7: 44px;

  --font-serif: "ZT Serif", "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", serif;
  --font-sans: var(--font-serif);
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Courier New", monospace;

  --hex: polygon(50% 0%, 93.3% 25%, 93.3% 75%, 50% 100%, 6.7% 75%, 6.7% 25%);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);

  --app-h: 100vh;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-serif);
  font-size: var(--f3);
  line-height: 1.9;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  touch-action: manipulation;
}

img {
  display: block;
  max-width: 100%;
  -webkit-user-drag: none;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.serif {
  font-family: var(--font-serif);
}

/* 全局底噪，一层极轻的暗角，避免纯黑死板 */
#app {
  position: fixed;
  inset: 0;
  height: var(--app-h);
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(48, 39, 30, 0.5) 0%, transparent 62%),
    var(--ink);
}

/* ---------- 关卡容器 ---------- */

.stage {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: calc(var(--safe-t) + 56px) var(--s6) calc(var(--safe-b) + 72px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(24px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease), visibility 0.5s;
  overflow: hidden;
}

.stage.is-active {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.stage.is-past {
  opacity: 0;
  transform: translateY(-24px);
}

.stage__scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-bottom: var(--s6);
}

.stage__title {
  font-family: var(--font-mono);
  font-size: var(--f1);
  letter-spacing: 0.22em;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: var(--s2);
}

.stage__q {
  font-family: var(--font-serif);
  font-size: var(--f5);
  line-height: 1.45;
  margin-bottom: var(--s8);
}

.stage__foot {
  font-size: var(--f1);
  color: var(--paper-faint);
  line-height: 1.8;
  margin-top: var(--s6);
}

/* ---------- HUD ---------- */

.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--safe-t) + var(--s4)) var(--s6) var(--s3);
  font-family: var(--font-mono);
  font-size: var(--f1);
  letter-spacing: 0.16em;
  color: var(--paper-faint);
  pointer-events: none;
}

.hud__id {
  color: var(--gold-faint);
}

/* 进度条要有轨道，否则孤零零一小段像渲染残留 */
.hud::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: rgba(232, 230, 225, 0.07);
}

.hud__bar {
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: 1;
  height: 1px;
  background: var(--gold);
  width: 0;
  transition: width 0.6s var(--ease);
  opacity: 0.55;
}

/* ---------- 底部动作区 ---------- */

.foot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s2);
  padding: var(--s3) var(--s6) calc(var(--safe-b) + var(--s4));
  pointer-events: none;
}

.foot__next {
  pointer-events: auto;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s1);
  font-family: var(--font-mono);
  font-size: var(--f1);
  letter-spacing: 0.2em;
  color: var(--paper-dim);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
  padding: var(--s3) var(--s6);
  min-height: 44px;
}

.foot__next.is-on {
  opacity: 1;
  transform: none;
}

/* 没解锁时不能挡住下面的内容，否则底部的可点元素会被吃掉 */
.foot__next:not(.is-on) {
  pointer-events: none;
}

.foot__arrow {
  animation: float 1.9s ease-in-out infinite;
  font-size: var(--f2);
}

@keyframes float {
  0%, 100% { transform: translateY(0); opacity: 0.5; }
  50% { transform: translateY(-5px); opacity: 1; }
}

.foot__skip {
  pointer-events: auto;
  font-size: var(--f1);
  color: rgba(232, 230, 225, 0.18);
  padding: var(--s2) var(--s4);
  min-height: 32px;
}

/* ---------- 返回上一步 ---------- */

.back {
  position: absolute;
  left: var(--s4);
  bottom: calc(var(--safe-b) + var(--s16) + var(--s4));
  z-index: 45;
  min-width: 44px;
  height: 44px;
  padding: 0 var(--s3);
  display: none;
  place-items: center;
  font-family: var(--font-mono);
  font-size: var(--f1);
  letter-spacing: 0.1em;
  color: var(--paper-faint);
  transition: color 0.3s;
}

.back.is-on {
  display: grid;
}

.back:active {
  color: var(--gold);
}

/* ---------- 菜单按钮 ---------- */

.gear {
  position: absolute;
  right: var(--s4);
  bottom: calc(var(--safe-b) + var(--s16) + var(--s4));
  z-index: 45;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: var(--paper-faint);
  transition: color 0.3s, transform 0.4s var(--ease);
}

.gear:active {
  transform: scale(0.92);
  color: var(--gold);
}

.gear svg {
  width: 20px;
  height: 20px;
}

/* ---------- 六边形 ---------- */

.hex {
  position: relative;
  display: grid;
  place-items: center;
  clip-path: var(--hex);
  background: var(--ink-2);
  transition: transform 0.3s var(--ease);
}

.hex--line::before {
  content: "";
  position: absolute;
  inset: 0;
  clip-path: var(--hex);
  background: var(--gold-faint);
  z-index: -1;
  transform: scale(1.035);
}

/* ---------- 通用按钮 ---------- */

.btn {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: var(--s3) var(--s4);
  border: 1px solid var(--gold-faint);
  background: rgba(38, 33, 25, 0.4);
  color: var(--paper);
  font-size: var(--f3);
  text-align: left;
  transition: border-color 0.25s, background 0.25s, transform 0.2s var(--ease);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}

.btn:active {
  transform: scale(0.985);
  border-color: var(--gold);
  background: rgba(185, 154, 91, 0.1);
}

.btn.is-picked {
  border-color: var(--vermilion);
  background: rgba(201, 103, 74, 0.12);
}

.btn--ghost {
  border-color: var(--paper-faint);
  background: none;
  text-align: center;
}

.btn--solid {
  border-color: var(--vermilion);
  background: rgba(201, 103, 74, 0.16);
  text-align: center;
}

/* ---------- 第 0 关 预告 ---------- */

.teaser {
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-top: calc(var(--safe-t) + var(--s16));
}

.teaser__label {
  font-family: var(--font-mono);
  font-size: var(--f1);
  letter-spacing: 0.32em;
  color: var(--gold);
  margin-bottom: var(--s4);
}

/* stack 承载冲击波，波纹在框外扩散，不能被框的 clip-path 裁掉 */
/* 竖长六边形，装得下全身照 */
.teaser__stack {
  position: relative;
  width: min(78vw, 330px);
  aspect-ratio: 3 / 4;
  margin-bottom: var(--s8);
}

.teaser__frame {
  position: absolute;
  inset: 0;
  clip-path: var(--hex);
  overflow: hidden;
  background: #000;
  touch-action: none;
}

.teaser__frame.is-pop {
  animation: pop 0.9s var(--ease-pop);
}

@keyframes pop {
  0% { transform: scale(0.62) rotate(-4deg); }
  46% { transform: scale(1.18) rotate(2.5deg); }
  70% { transform: scale(0.95) rotate(-1deg); }
  100% { transform: scale(1) rotate(0); }
}

.teaser__wave {
  position: absolute;
  inset: 0;
  background: var(--gold);
  clip-path: polygon(
    50% 0%, 93.3% 25%, 93.3% 75%, 50% 100%, 6.7% 75%, 6.7% 25%,
    7.4% 25.4%, 7.4% 74.6%, 50% 99.2%, 92.6% 74.6%, 92.6% 25.4%, 50% 0.8%
  );
  opacity: 0;
  pointer-events: none;
}

.teaser__wave.is-go {
  animation: wave 1.1s ease-out forwards;
}

@keyframes wave {
  0% { transform: scale(1); opacity: 0.9; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* 未显影时边框呼吸，比文字更能把手指引过来。
   inset box-shadow 会被 clip-path 裁掉，这里用外六边形套内六边形挖洞画环。 */
.teaser__frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--gold);
  clip-path: polygon(
    50% 0%, 93.3% 25%, 93.3% 75%, 50% 100%, 6.7% 75%, 6.7% 25%,
    7.2% 25.3%, 7.2% 74.7%, 50% 99.4%, 92.8% 74.7%, 92.8% 25.3%, 50% 0.6%
  );
  pointer-events: none;
  z-index: 3;
  animation: edge 2.4s ease-in-out infinite;
}

.teaser__frame.is-done::after {
  animation: none;
  opacity: 0.4;
}

@keyframes edge {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.9; }
}

.teaser__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(20px) brightness(0.45) contrast(1.25) grayscale(1);
  transform: scale(1.14);
  transition: filter 0.16s linear, transform 0.16s linear;
}

/* canvas 是替换元素，不给 width/height 就只按属性尺寸显示，必须显式撑满 */
.teaser__noise {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  opacity: 0.6;
  transition: opacity 0.2s linear;
  mix-blend-mode: screen;
}

.teaser__ring {
  position: absolute;
  inset: 0;
  z-index: 4;
  clip-path: var(--hex);
  background: linear-gradient(to top, rgba(185, 154, 91, 0.22) 0%, transparent 0%);
  pointer-events: none;
}

.teaser__hint {
  font-family: var(--font-mono);
  font-size: var(--f3);
  letter-spacing: 0.2em;
  color: var(--paper);
  animation: breathe 2.4s ease-in-out infinite;
}

.teaser__hint small {
  display: block;
  font-size: var(--f1);
  letter-spacing: 0.1em;
  color: var(--paper-dim);
  margin-top: var(--s1);
  animation: none;
}

@keyframes breathe {
  0%, 100% { opacity: 0.68; }
  50% { opacity: 1; }
}

.teaser__data {
  list-style: none;
  font-family: var(--font-mono);
  font-size: var(--f2);
  line-height: 2.1;
  letter-spacing: 0.1em;
  color: var(--paper-dim);
  text-align: left;
}

.teaser__data li {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}

.teaser__data li.is-on {
  opacity: 1;
  transform: none;
}

.teaser__line {
  font-family: var(--font-serif);
  font-size: var(--f4);
  color: var(--paper);
  margin-top: var(--s8);
  opacity: 0;
  transition: opacity 0.9s var(--ease) 0.3s;
}

.teaser__line.is-on {
  opacity: 1;
}

/* ---------- 第 2 关 技能 ---------- */

.skills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s4) var(--s3);
  margin-top: var(--s4);
}

.skill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s2);
}

.skill__hex {
  width: 100%;
  aspect-ratio: 1 / 1.1;
  clip-path: var(--hex);
  background: var(--ink-2);
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--gold-faint);
  transition: transform 0.3s var(--ease);
}

.skill__hex img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) brightness(0.56) contrast(1.05);
  transition: filter 0.5s var(--ease);
}

.skill.is-seen .skill__hex img {
  filter: grayscale(0.1) brightness(0.95);
}

/* 槽位标签压在照片上会看不清，垫一层从下往上的暗底 */
.skill__slot {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12% 0 9%;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--gold);
  z-index: 2;
  background: linear-gradient(to top, rgba(23, 22, 20, 0.9) 0%, rgba(23, 22, 20, 0.6) 55%, transparent 100%);
}

.skill__dot {
  position: absolute;
  top: 22%;
  right: 20%;
  width: 5px;
  height: 5px;
  background: var(--vermilion);
  border-radius: 50%;
  z-index: 2;
  box-shadow: 0 0 6px rgba(201, 103, 74, 0.9);
  transition: opacity 0.4s;
}

.skill.is-seen .skill__dot {
  opacity: 0;
}

.skill__name {
  font-size: var(--f2);
  color: var(--paper-dim);
  transition: color 0.4s;
}

.skill.is-seen .skill__name {
  color: var(--paper);
}

.skill:active .skill__hex {
  transform: scale(0.95);
}

/* ---------- 第 3 关 属性雷达 ---------- */

.radar {
  position: relative;
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
  aspect-ratio: 1;
}

.radar canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.radar__bg {
  position: absolute;
  inset: 22%;
  clip-path: var(--hex);
  overflow: hidden;
  opacity: 0.09;
  z-index: -1;
}

.radar__bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1);
}

.slider {
  margin-top: var(--s6);
}

.slider__top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--s3);
}

.slider__label {
  font-size: var(--f2);
  color: var(--paper-dim);
}

.slider__val {
  font-family: var(--font-mono);
  font-size: var(--f6);
  color: var(--vermilion);
  line-height: 1;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 44px;
  background: none;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 1px;
  background: var(--gold-faint);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -11px;
  background: var(--vermilion);
  clip-path: var(--hex);
}

input[type="range"]::-moz-range-track {
  height: 1px;
  background: var(--gold-faint);
}

input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border: none;
  background: var(--vermilion);
  clip-path: var(--hex);
}

.stat-list {
  list-style: none;
  margin-top: var(--s4);
  font-size: var(--f1);
  color: var(--paper-faint);
  line-height: 2;
}

.stat-list b {
  font-family: var(--font-mono);
  color: var(--paper-dim);
  font-weight: 400;
  margin-right: var(--s2);
}

/* ---------- 第 4 关 皮肤 ---------- */

.skins {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: var(--s4);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  margin: 0 calc(var(--s6) * -1);
  padding: 0 var(--s6);
  scrollbar-width: none;
}

.skins::-webkit-scrollbar {
  display: none;
}

.skin {
  flex: 0 0 84%;
  scroll-snap-align: center;
  display: flex;
  flex-direction: column;
  min-height: 0;
  opacity: 0.34;
  transition: opacity 0.4s var(--ease);
}

.skin.is-cur {
  opacity: 1;
}

.skin__img {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: var(--ink-2);
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px));
}

.skin__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.skin__tier {
  position: absolute;
  top: var(--s3);
  left: var(--s3);
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  padding: 3px var(--s2);
  background: rgba(23, 22, 20, 0.72);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  backdrop-filter: blur(4px);
}

.skin__tier i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}

.skin__meta {
  padding-top: var(--s3);
}

.skin__name {
  font-family: var(--font-serif);
  font-size: var(--f4);
  margin-bottom: var(--s1);
}

.skin__note {
  font-size: var(--f1);
  color: var(--paper-faint);
  line-height: 1.8;
  white-space: pre-line;
}

.skins-dots {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin-top: var(--s4);
}

.skins-dots i {
  width: 4px;
  height: 4px;
  background: var(--paper-faint);
  border-radius: 50%;
  transition: background 0.3s, transform 0.3s;
}

.skins-dots i.is-on {
  background: var(--gold);
  transform: scale(1.5);
}

/* 皮肤尾卡：英雄背景故事，仿短剧封面 */

.drama {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--s6);
  background: linear-gradient(160deg, #262119 0%, #171614 52%, #2e1a13 100%);
  box-shadow: inset 0 0 0 1px var(--gold-faint);
}

.drama__badge {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--vermilion);
  color: #f4f1ec;
  font-size: 12px;
  letter-spacing: 0.22em;
  padding: 4px 10px 4px 14px;
  clip-path: polygon(10px 0, 100% 0, 100% 100%, 0 100%);
}

.drama__title {
  font-family: var(--font-serif);
  font-size: var(--f6);
  line-height: 1.6;
  color: var(--gold);
  text-shadow: 0 0 1px rgba(185, 154, 91, 0.55);
  margin-bottom: var(--s4);
}

.drama__meta {
  font-size: var(--f1);
  color: var(--paper-faint);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* ---------- 第 5 关 出装 ---------- */

.slots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s3);
  margin-bottom: var(--s8);
}

.slot {
  aspect-ratio: 1;
  clip-path: var(--hex);
  background: rgba(38, 33, 25, 0.5);
  box-shadow: inset 0 0 0 1px var(--paper-faint);
  display: grid;
  place-items: center;
  font-size: var(--f1);
  color: var(--paper-faint);
  text-align: center;
  padding: var(--s2);
  transition: box-shadow 0.3s, background 0.3s;
}

.slot.is-hot {
  box-shadow: inset 0 0 0 1px var(--gold);
  background: rgba(185, 154, 91, 0.14);
}

.slot.is-filled {
  color: var(--paper);
  background: rgba(38, 33, 25, 0.9);
  box-shadow: inset 0 0 0 1px var(--gold-faint);
}

.slot.is-me {
  color: var(--vermilion);
  box-shadow: inset 0 0 0 1px var(--vermilion);
  background: rgba(201, 103, 74, 0.14);
}

.tray {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
}

.item {
  flex: 0 0 calc(50% - var(--s2));
  padding: var(--s3);
  border: 1px solid var(--gold-faint);
  background: rgba(38, 33, 25, 0.45);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
  touch-action: none;
  transition: opacity 0.3s, transform 0.2s var(--ease);
}

/* 放进格子后就从列表里消失，不然下面会积一堆灰掉的残骸 */
.item.is-used {
  display: none;
}

.item.is-drag {
  position: fixed;
  z-index: 99;
  pointer-events: none;
  border-color: var(--gold);
  background: rgba(23, 22, 20, 0.95);
  transform: scale(1.04);
  width: 42vw;
}

.item--me {
  border-color: var(--vermilion);
  flex-basis: 100%;
}

.item__name {
  font-size: var(--f3);
  margin-bottom: 2px;
}

.item__attr {
  font-size: var(--f1);
  color: var(--paper-faint);
  line-height: 1.7;
  white-space: pre-line;
}

/* ---------- 第 6 关 终章 ---------- */

.vs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s6);
  margin-bottom: var(--s12);
}

.vs__side {
  text-align: center;
  flex: 1;
}

.vs__ava {
  width: 100%;
  max-width: 132px;
  aspect-ratio: 1;
  margin: 0 auto var(--s3);
  clip-path: var(--hex);
  overflow: hidden;
  background: var(--ink-2);
  box-shadow: inset 0 0 0 1px var(--gold-faint);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: var(--f6);
  color: var(--paper-faint);
}

.vs__ava img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vs__name {
  font-family: var(--font-mono);
  font-size: var(--f2);
  letter-spacing: 0.12em;
  color: var(--paper-dim);
}

.vs__x {
  font-family: var(--font-mono);
  font-size: var(--f2);
  color: var(--gold);
  letter-spacing: 0.2em;
}

.invite {
  border: 1px solid var(--gold-faint);
  background: rgba(38, 33, 25, 0.62);
  padding: var(--s6) var(--s4);
  text-align: center;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}

.invite__label {
  font-family: var(--font-mono);
  font-size: var(--f1);
  letter-spacing: 0.24em;
  color: var(--gold);
  margin-bottom: var(--s3);
}

.invite__body {
  font-family: var(--font-serif);
  font-size: var(--f4);
  margin-bottom: var(--s6);
}

.invite__acts {
  display: flex;
  gap: var(--s3);
}

.invite__acts .btn {
  flex: 1;
}

.invite__tip {
  font-size: var(--f1);
  color: var(--paper-faint);
  margin-top: var(--s4);
  line-height: 1.8;
}

.loadbar {
  height: 1px;
  background: var(--paper-faint);
  margin: var(--s8) 0 var(--s3);
  overflow: hidden;
}

.loadbar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--gold);
  transition: width 0.3s linear;
}

.loadpct {
  font-family: var(--font-mono);
  font-size: var(--f1);
  color: var(--paper-faint);
  text-align: center;
  letter-spacing: 0.16em;
}

/* ---------- 信：刻意的排版断裂，全部宋体无装饰 ---------- */

.letter {
  padding: calc(var(--safe-t) + var(--s16)) var(--s6) calc(var(--safe-b) + var(--s16));
  background: var(--ink);
}

.letter__scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  max-width: 34em;
  margin: 0 auto;
  width: 100%;
}

.letter h1 {
  font-family: var(--font-serif);
  font-size: var(--f5);
  font-weight: 400;
  letter-spacing: 0.1em;
  margin-bottom: var(--s12);
  color: var(--paper);
}

.letter h2 {
  font-family: var(--font-serif);
  font-size: var(--f3);
  font-weight: 400;
  color: var(--gold);
  margin: var(--s12) 0 var(--s4);
  letter-spacing: 0.06em;
}

/* 中文窄屏不要 justify，标点会被拉出难看的空隙 */
.letter p {
  font-family: var(--font-serif);
  font-size: var(--f3);
  line-height: 2.05;
  color: rgba(232, 230, 225, 0.88);
  margin-bottom: var(--s4);
  text-align: left;
  user-select: text;
  -webkit-user-select: text;
}

/* 借 chellyzhe 的后记母题：署名前置一个居中的 ※ */
.letter__mark {
  text-align: center;
  color: var(--paper-faint);
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  margin: var(--s12) 0 var(--s6);
  user-select: none;
  -webkit-user-select: none;
}

.letter__proof {
  width: 100%;
  margin: var(--s6) 0 var(--s8);
  opacity: 0.9;
}

.letter__cap {
  font-family: var(--font-mono);
  font-size: var(--f1);
  color: var(--paper-faint);
  letter-spacing: 0.08em;
  margin-top: calc(var(--s6) * -1 + var(--s2));
  margin-bottom: var(--s8);
  text-align: center;
}

.letter__sign {
  font-family: var(--font-serif);
  font-size: var(--f3);
  color: var(--paper-dim);
  text-align: right;
  margin: var(--s12) 0 var(--s8);
}

.letter__wall {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s1);
  margin-bottom: var(--s8);
}

.letter__wall img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  opacity: 0;
  transform: scale(0.94);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.letter__wall img.is-on {
  opacity: 0.82;
  transform: none;
}

/* ---------- 弹层 ---------- */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--ease), visibility 0.3s;
}

.sheet.is-open {
  opacity: 1;
  visibility: visible;
}

.sheet__mask {
  position: absolute;
  inset: 0;
  background: rgba(10, 9, 8, 0.82);
  backdrop-filter: blur(3px);
}

.sheet__panel {
  position: relative;
  width: 100%;
  max-height: 84%;
  display: flex;
  flex-direction: column;
  background: var(--ink);
  border-top: 1px solid var(--gold-faint);
  padding: var(--s6) var(--s6) calc(var(--safe-b) + var(--s6));
  transform: translateY(100%);
  transition: transform 0.36s var(--ease);
}

.sheet.is-open .sheet__panel {
  transform: none;
}

.sheet__grab {
  width: 36px;
  height: 3px;
  background: var(--paper-faint);
  border-radius: 2px;
  margin: 0 auto var(--s6);
}

.sheet__body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.sheet__slot {
  font-family: var(--font-mono);
  font-size: var(--f1);
  letter-spacing: 0.2em;
  color: var(--gold);
  margin-bottom: var(--s2);
}

.sheet__name {
  font-family: var(--font-serif);
  font-size: var(--f6);
  line-height: 1.2;
  margin-bottom: var(--s6);
}

.sheet__photo {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  margin-bottom: var(--s6);
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}

.sheet__desc {
  font-size: var(--f3);
  line-height: 1.9;
  margin-bottom: var(--s4);
  white-space: pre-line;
}

.sheet__cd {
  font-family: var(--font-mono);
  font-size: var(--f2);
  color: var(--paper-dim);
  padding-top: var(--s3);
  border-top: 1px solid rgba(232, 230, 225, 0.1);
  white-space: pre-line;
}

.sheet__cd b {
  color: var(--gold);
  font-weight: 400;
  letter-spacing: 0.1em;
}

.sheet__note {
  margin-top: var(--s4);
  padding: var(--s3);
  border-left: 2px solid var(--vermilion);
  font-size: var(--f2);
  line-height: 1.8;
  color: rgba(232, 230, 225, 0.7);
  white-space: pre-line;
}

.sheet__pre {
  font-family: var(--font-mono);
  font-size: var(--f2);
  line-height: 2;
  white-space: pre-line;
  color: rgba(232, 230, 225, 0.8);
}

/* 菜单列表 */
.menu-list {
  list-style: none;
}

.menu-list li + li {
  border-top: 1px solid rgba(232, 230, 225, 0.08);
}

.menu-list button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 52px;
  padding: var(--s3) 0;
  font-size: var(--f3);
  text-align: left;
}

.menu-list button::after {
  content: "›";
  font-family: var(--font-mono);
  color: var(--paper-faint);
  font-size: var(--f4);
}

.menu-back {
  font-family: var(--font-mono);
  font-size: var(--f1);
  letter-spacing: 0.14em;
  color: var(--paper-faint);
  margin-bottom: var(--s4);
  min-height: 32px;
}

.wheel {
  width: 100%;
  aspect-ratio: 1;
  max-width: 220px;
  margin: 0 auto var(--s6);
  clip-path: var(--hex);
  background: var(--ink-2);
  box-shadow: inset 0 0 0 1px var(--gold-faint);
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-size: var(--f4);
  text-align: center;
  padding: var(--s6);
  transition: transform 0.5s var(--ease);
}

.wheel.is-spin {
  animation: spin 0.6s var(--ease);
}

@keyframes spin {
  0% { transform: rotate(0) scale(1); }
  50% { transform: rotate(180deg) scale(0.9); }
  100% { transform: rotate(360deg) scale(1); }
}

.checks {
  list-style: none;
  margin-bottom: var(--s6);
}

.checks li {
  padding: var(--s1) 0;
}

.checks button {
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-height: 44px;
  font-size: var(--f3);
}

.checks i {
  width: 18px;
  height: 18px;
  clip-path: var(--hex);
  background: rgba(232, 230, 225, 0.14);
  transition: background 0.25s;
}

.checks button.is-on i {
  background: var(--vermilion);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  min-height: 52px;
  font-size: var(--f3);
}

.setting-row input[type="range"] {
  flex: 1;
  max-width: 60%;
}

.switch {
  min-width: 72px;
  padding: var(--s2) var(--s3);
  border: 1px solid var(--gold-faint);
  font-family: var(--font-mono);
  font-size: var(--f1);
  text-align: center;
  letter-spacing: 0.1em;
}

.switch.is-on {
  border-color: var(--vermilion);
  color: var(--vermilion);
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-b) + 96px);
  transform: translate(-50%, 12px);
  z-index: 80;
  max-width: 84vw;
  padding: var(--s3) var(--s4);
  background: rgba(23, 22, 20, 0.94);
  border: 1px solid var(--gold-faint);
  font-size: var(--f2);
  line-height: 1.75;
  white-space: pre-line;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, transform 0.3s var(--ease), visibility 0.3s;
}

.toast.is-on {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

/* ---------- 亮度遮罩 ---------- */

#dim {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* 极窄屏收一收 */
@media (max-height: 700px) {
  :root {
    --f5: 21px;
    --f6: 28px;
    --f7: 34px;
  }
  .stage {
    padding-top: calc(var(--safe-t) + 48px);
  }
}
