/* ============================================================
   站点门户 · Kinetic Gallery（瓷白展廊 · 弹珠站点名称场）
   - 背景：瓷白 + 极低透明度光晕 + 点阵网格
   - 色彩预算全部留给弹珠名称，页面其余部分保持近单色纪律
   ============================================================ */

:root {
  --bg: #f6f7fb;
  --ink: #0f172a;
  --ink-muted: #475569;
  --line: #e2e8f0;
  --surface: rgba(255, 255, 255, 0.92);
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --success: #10b981;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono";
  --field-top: 96px;
  --field-bottom: 42px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
}

body {
  font-family: var(--font-ui);
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(640px 420px at 12% -8%, rgba(99, 102, 241, 0.07), transparent 60%),
    radial-gradient(560px 400px at 96% 18%, rgba(16, 185, 129, 0.07), transparent 60%),
    radial-gradient(620px 460px at 50% 112%, rgba(244, 63, 94, 0.05), transparent 60%),
    radial-gradient(rgba(15, 23, 42, 0.05) 1px, transparent 1.2px);
  background-size: auto, auto, auto, 24px 24px;
  overflow: hidden;
}

/* ---------- 页眉 ---------- */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.75rem 2rem 0;
  animation: rise 0.6s ease both;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-portal-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
  flex-shrink: 0;
}

.brand-portal-link:hover {
  transform: scale(1.08);
}

.brand-portal-logo {
  height: 28px;
  width: 112px;
  aspect-ratio: 4 / 1;
  border-radius: 6px;
  object-fit: contain;
  display: block;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.brand-eyebrow {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.brand-name {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.game-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.42rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.08);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.game-trigger-btn:hover {
  background: #fff;
  border-color: rgba(79, 70, 229, 0.4);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.16);
}

.game-trigger-btn:active {
  transform: scale(0.97);
}

.game-trigger-icon {
  font-size: 0.95rem;
  line-height: 1;
}

/* ---------- 弹珠场（全屏自由区） ---------- */

#field {
  position: fixed;
  inset: var(--field-top) 0 var(--field-bottom) 0;
  overflow: hidden;
  touch-action: manipulation; /* 双击缩放会让 dblclick 失效 */
}

/* 名称弹珠：颜色 / 字号由 JS 内联驱动，碰壁时平滑过渡 */
.marble {
  position: absolute;
  top: 0;
  left: 0;
  appearance: none;
  border: 0;
  background: transparent;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  white-space: nowrap;
  padding: 0.12em 0.3em;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  will-change: transform;
  transition: color 0.35s ease, font-size 0.35s ease, filter 0.25s ease;
  animation: marble-in 0.5s ease both;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.65);
}

.marble:hover,
.marble:focus-visible {
  filter: drop-shadow(0 8px 16px rgba(15, 23, 42, 0.16));
}

.marble:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
  border-radius: 8px;
}

/* 中文站名弹珠：同款衬线粗体但不倾斜（中文斜体观感差） */
.marble--cn {
  font-style: normal;
  letter-spacing: 0.04em;
}

/* ---------- 碰撞炸毁粒子（WAAPI 驱动，结束即移除） ---------- */

.shard {
  position: absolute;
  z-index: 5;
  border-radius: 1px;
  pointer-events: none;
  will-change: transform, opacity;
}

.shockwave {
  position: absolute;
  z-index: 5;
  width: 120px;
  height: 120px;
  border: 2px solid;
  border-radius: 50%;
  pointer-events: none;
  will-change: transform, opacity;
}

/* 受击小号冲击波（角色撞飞弹珠瞬间） */
.shockwave--mini {
  width: 64px;
  height: 64px;
  border-width: 1.5px;
}

/* 击飞态弹珠：高速漂移 + 超速自转的动感 */
.marble--knocked {
  filter: blur(0.6px) drop-shadow(0 10px 18px rgba(15, 23, 42, 0.28));
}

/* ---------- 跑步角色（装饰性实体，不拦截鼠标） ---------- */

.runner {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3; /* 置于弹珠与碎片之下，重叠瞬间文字始终可读 */
  height: clamp(56px, 9vh, 84px);
  width: auto;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  will-change: transform;
  filter: drop-shadow(0 6px 10px rgba(15, 23, 42, 0.18));
  transition: opacity 0.3s ease, filter 0.3s ease;
}

/* 休整态（双击触发）：轻微降饱和降不透明度示意原地休息 */
.runner--frozen {
  opacity: 0.72;
  filter: grayscale(0.45) drop-shadow(0 4px 8px rgba(15, 23, 42, 0.14));
}

/* 减少动态偏好：静态流式陈列，点击查看详情功能保留 */
#field.field--static {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: center;
  justify-content: center;
  gap: clamp(1.25rem, 4vw, 3rem) clamp(1.5rem, 5vw, 4rem);
  padding: 0 1.5rem;
}

#field.field--static .marble {
  position: static;
  will-change: auto;
}

.field-status {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--ink-muted);
}

.field-status[hidden] {
  display: none;
}

/* ---------- 底部品牌版权 ---------- */

.site-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0.65rem;
  z-index: 10;
  text-align: center;
  pointer-events: auto;
}

.site-footer-inner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0 1rem;
  font-size: 0.75rem;
  color: var(--ink-muted);
}

.site-footer-inner a {
  color: var(--ink-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.site-footer-inner a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.site-footer .footer-sep {
  opacity: 0.4;
}

/* ---------- 站点详情弹窗 ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(246, 247, 251, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
}

.modal-card {
  position: relative;
  width: min(560px, 100%);
  max-height: calc(100dvh - 2.5rem);
  overflow-y: auto;
  background: var(--surface);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 2.25rem 2.25rem 2rem;
  box-shadow:
    0 24px 60px -12px rgba(15, 23, 42, 0.2),
    0 4px 16px rgba(15, 23, 42, 0.06);
  animation: modal-in 0.3s ease both;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--ink-muted);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.modal-close:hover {
  background: #f1f5f9;
  color: var(--ink);
}

.modal-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.modal-eyebrow {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 0.75rem;
  padding-right: 2.5rem;
}

.modal-name {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: clamp(1.6rem, 4.5vw, 2.25rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin-bottom: 0.375rem;
  overflow-wrap: anywhere;
}

.modal-cnname {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.0625rem;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  margin-bottom: 1rem;
}

.modal-cnname[hidden] {
  display: none;
}

.modal-desc {
  font-size: 0.9375rem;
  line-height: 1.8;
  color: var(--ink-muted);
  margin-bottom: 1.5rem;
}

.modal-meta {
  margin-bottom: 1.75rem;
}

.modal-host {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 100%;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--ink-muted);
  background: #f1f5f9;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
}

.modal-host svg {
  flex: none;
}

.modal-host span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-visit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.8rem 1.25rem;
  background: var(--accent);
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 8px 20px -6px rgba(79, 70, 229, 0.45);
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.modal-visit:hover {
  background: var(--accent-hover);
  box-shadow: 0 10px 24px -6px rgba(79, 70, 229, 0.55);
}

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

/* ---------- noscript 兜底 ---------- */

.noscript-note {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  text-align: center;
  font-size: 0.95rem;
  color: var(--ink-muted);
  background: var(--bg);
}

/* ---------- 动画 ---------- */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes marble-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- 响应式：手机 / 平板 / 桌面 ---------- */

@media (max-width: 767px) {
  :root {
    --field-top: 76px;
    --field-bottom: 38px;
  }

  .site-header {
    padding: 1.25rem 1.25rem 0;
  }

  .brand-name {
    font-size: 1.125rem;
  }

  .header-actions {
    gap: 0.4rem;
  }

  .game-trigger-btn {
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
  }

  .game-hud {
    top: 0.75rem;
    width: calc(100vw - 1.25rem);
  }

  .game-hud-inner {
    padding: 0.5rem 0.75rem;
    gap: 0.5rem;
  }

  .game-hud-val {
    font-size: 1.1rem;
  }

  .game-hud-target-name {
    font-size: 1.05rem;
  }

  .game-dock {
    bottom: 1.75rem;
    padding: 0.35rem;
    gap: 0.5rem;
  }

  .game-btn {
    padding: 0.55rem 0.95rem;
    font-size: 0.8125rem;
  }

  .modal-card {
    padding: 1.75rem 1.5rem 1.5rem;
    border-radius: 16px;
  }

  .site-footer {
    bottom: max(0.35rem, env(safe-area-inset-bottom, 0px));
    padding: 0 0.5rem;
  }

  .site-footer-inner {
    font-size: 0.6875rem;
    gap: 0.15rem 0.35rem;
    line-height: 1.35;
    padding: 0 0.25rem;
  }
}

@media (max-height: 560px) {
  :root {
    --field-top: 64px;
    --field-bottom: 34px;
  }

  .game-dock {
    bottom: 0.75rem;
  }
}

/* ---------- 游戏模式：HUD 悬浮岛、底部操作坞与动效 ---------- */

.game-hud {
  position: fixed;
  top: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  width: min(580px, calc(100vw - 2rem));
  pointer-events: none;
  animation: hud-in 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.game-hud[hidden] {
  display: none;
}

.game-hud-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.75rem 1.25rem;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 20px;
  box-shadow: 0 16px 36px -8px rgba(15, 23, 42, 0.14), 0 2px 6px rgba(15, 23, 42, 0.04);
  pointer-events: auto;
}

.game-hud-time,
.game-hud-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 60px;
  flex-shrink: 0;
}

.game-hud-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 2px;
}

.game-hud-val {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.game-hud-val--alert {
  color: #ef4444;
  animation: pulse 1s infinite;
}

.game-hud-target-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  padding: 0 0.5rem;
}

.game-hud-target-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 4px;
}

.game-hud-badge {
  display: inline-block;
  padding: 1px 6px;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 4px;
  background: rgba(79, 70, 229, 0.1);
  color: var(--accent);
  letter-spacing: 0.05em;
}

.game-hud-hint {
  font-size: 0.7rem;
  color: var(--ink-muted);
}

.game-hud-target-name {
  font-size: clamp(1.05rem, 2.8vw, 1.4rem);
  font-weight: 800;
  color: var(--ink);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  letter-spacing: 0.02em;
  margin-bottom: 6px;
  transition: transform 0.2s ease;
}

.game-round-progress-track {
  width: 100%;
  max-width: 220px;
  height: 4px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.game-round-progress-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #10b981, #6366f1);
  border-radius: 999px;
  transform-origin: left center;
}

/* 浮动得分特效 */
.score-float-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}

.score-float {
  position: absolute;
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 1.5rem;
  pointer-events: none;
  user-select: none;
  z-index: 100;
  animation: floatScore 0.85s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  white-space: nowrap;
}

.score-float--pos {
  color: #10b981;
  text-shadow: 0 2px 10px rgba(16, 185, 129, 0.35);
}

.score-float--neg {
  color: #ef4444;
  text-shadow: 0 2px 10px rgba(239, 68, 68, 0.35);
}

/* 底部操作坞 */
.game-dock {
  position: fixed;
  bottom: 2.2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.45rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 999px;
  box-shadow: 0 12px 32px -6px rgba(15, 23, 42, 0.16);
  animation: dock-in 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.game-dock[hidden] {
  display: none;
}

.game-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  -webkit-user-select: none;
  white-space: nowrap;
}

.game-btn--absent {
  background: #fff;
  border-color: #cbd5e1;
  color: #dc2626;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.08);
}

.game-btn--absent:hover {
  background: #fef2f2;
  border-color: #fca5a5;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.18);
}

.game-btn--absent:active {
  transform: scale(0.97);
}

.game-btn--exit {
  background: transparent;
  border-color: transparent;
  color: var(--ink-muted);
}

.game-btn--exit:hover {
  background: #f1f5f9;
  color: var(--ink);
}

.game-btn--exit:active {
  transform: scale(0.97);
}

/* 游戏弹窗通用样式 */
.game-modal-card {
  text-align: center;
  max-width: 440px;
}

.game-modal-icon {
  font-size: 2.75rem;
  margin-bottom: 0.5rem;
  line-height: 1;
}

.game-modal-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 0.75rem;
  letter-spacing: -0.01em;
}

.game-modal-desc {
  font-size: 0.925rem;
  line-height: 1.7;
  color: var(--ink-muted);
  margin-bottom: 1.75rem;
}

.game-modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.game-action-btn {
  flex: 1;
  padding: 0.75rem 1.25rem;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.game-action-btn--primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 20px -4px rgba(79, 70, 229, 0.45);
}

.game-action-btn--primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 10px 24px -4px rgba(79, 70, 229, 0.55);
  transform: translateY(-1px);
}

.game-action-btn--secondary {
  background: #fff;
  border-color: var(--line);
  color: var(--ink-muted);
}

.game-action-btn--secondary:hover {
  background: #f8fafc;
  color: var(--ink);
  border-color: #cbd5e1;
}

.game-action-btn:active {
  transform: scale(0.98);
}

/* 结算弹窗卡片与四宫格统计 */
.game-summary-card {
  max-width: 480px;
}

.game-summary-badge {
  display: inline-block;
  padding: 0.35rem 0.9rem;
  font-size: 0.8125rem;
  font-weight: 700;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.12), rgba(16, 185, 129, 0.12));
  color: var(--accent);
  margin-bottom: 0.75rem;
  letter-spacing: 0.04em;
}

.game-summary-score-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1.5rem;
}

.game-summary-score-num {
  font-family: var(--font-mono);
  font-size: 3.5rem;
  font-weight: 900;
  line-height: 1;
  color: var(--ink);
  background: linear-gradient(135deg, #4f46e5, #059669);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.game-summary-score-unit {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 4px;
}

.game-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-bottom: 1.75rem;
  text-align: left;
}

.game-summary-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.game-summary-item--wide {
  grid-column: 1 / -1;
}

.summary-label {
  font-size: 0.8125rem;
  color: var(--ink-muted);
  font-weight: 500;
}

.summary-value {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
}

.summary-value--positive {
  color: #059669;
}

.summary-value--negative {
  color: #dc2626;
}

.summary-value--muted {
  color: #64748b;
}

/* 动效关键帧 */
@keyframes hud-in {
  from {
    opacity: 0;
    transform: translate(-50%, -18px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

@keyframes dock-in {
  from {
    opacity: 0;
    transform: translate(-50%, 20px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

@keyframes floatScore {
  0% {
    opacity: 0;
    transform: translate(-50%, 0) scale(0.6);
  }
  25% {
    opacity: 1;
    transform: translate(-50%, -16px) scale(1.18);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -52px) scale(1);
  }
}

.shake-anim {
  animation: shake 0.4s ease both !important;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

/* 游戏激活时的样式增强 */
body.game-active .site-header {
  opacity: 0.45;
  transition: opacity 0.3s ease;
}
body.game-active .site-header:hover {
  opacity: 1;
}
body.game-active .site-footer {
  opacity: 0.25;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

/* ---------- 减少动态偏好 ---------- */

@media (prefers-reduced-motion: reduce) {
  .site-header,
  .marble,
  .modal-card,
  .game-hud,
  .game-dock {
    animation: none;
  }

  .marble {
    transition: none;
  }
}

/* ============================================================
   墨玉藏馆 · Vault（「不想」单向分支 · 伪3D卡片流）
   - 深墨底 + 宣纸噪点 + 描金细线，拒绝紫蓝渐变网
   - 档案抽屉卡：馆藏编号 / 火漆印 / 竖排藏签 / 描金书脊厚度
   - 粒子为画布金粉墨尘，与卡片层解耦
   ============================================================ */

body.vault-mode {
  color: #e8e2d2;
  background-color: #0b0e13;
  background-image:
    radial-gradient(900px 480px at 50% -10%, rgba(198, 166, 100, 0.1), transparent 62%),
    radial-gradient(700px 500px at 92% 108%, rgba(200, 64, 42, 0.06), transparent 60%),
    radial-gradient(640px 520px at 6% 108%, rgba(64, 110, 140, 0.07), transparent 60%);
  overflow: hidden;
}

body.vault-mode .site-header {
  animation: none;
}

body.vault-mode .brand-eyebrow {
  color: #c6a664;
}

body.vault-mode .brand-name {
  color: #f0e9d6;
}

body.vault-mode .header-actions {
  display: none;
}

body.vault-mode .site-footer-inner,
body.vault-mode .site-footer-inner a {
  color: rgba(232, 226, 210, 0.52);
}

body.vault-mode .site-footer-inner a:hover {
  color: #c6a664;
}

body.vault-mode #field {
  display: block;
  overflow: hidden;
  touch-action: pan-y;
  cursor: default;
}

/* 光标语义：侧卡可点（手型），仅正中卡可拖（抓手） */
.vault-card {
  cursor: pointer;
}

.vault-card.is-active {
  cursor: grab;
}

.vault-card.is-active:active {
  cursor: grabbing;
}

#vault-dust {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.vault-stage {
  position: absolute;
  inset: clamp(12px, 3vh, 36px) 0 clamp(96px, 15vh, 132px) 0;
  z-index: 2;
  perspective: 1400px;
  perspective-origin: 50% 42%;
  overflow: hidden;
  touch-action: pan-y;
}

.vault-track {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}

.vault-card {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(330px, 78vw);
  height: min(430px, 100%);
  margin: 0;
  padding: 0;
  border: 1px solid rgba(198, 166, 100, 0.28);
  border-radius: 6px 14px 14px 6px;
  background:
    linear-gradient(105deg, rgba(255, 255, 255, 0.055) 0%, transparent 22%),
    linear-gradient(180deg, #171c26 0%, #10141d 58%, #0c0f16 100%);
  box-shadow:
    0 30px 60px -18px rgba(0, 0, 0, 0.72),
    0 2px 0 rgba(198, 166, 100, 0.12) inset,
    1px 0 0 rgba(255, 255, 255, 0.04) inset;
  transform-style: preserve-3d;
  will-change: transform, opacity, filter;
  text-align: left;
  color: #e8e2d2;
  overflow: visible;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

/* 书脊厚度：伪3D的立体来源 */
.vault-card::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: -9px;
  width: 9px;
  border-radius: 4px 0 0 4px;
  background: linear-gradient(180deg, #2a2f3c, #141821 60%, #0a0d12);
  border: 1px solid rgba(198, 166, 100, 0.22);
  border-right: 0;
  transform: rotateY(38deg) translateX(-2px);
  transform-origin: right center;
}

/* 顶部高光扫过：仅激活卡播放 */
.vault-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(112deg, transparent 30%, rgba(240, 233, 214, 0.09) 44%, transparent 58%);
  background-size: 260% 100%;
  background-position: 120% 0;
  pointer-events: none;
}

.vault-card.is-active::after {
  animation: vault-sheen 3.6s ease-in-out infinite;
}

@keyframes vault-sheen {
  0%, 55% { background-position: 120% 0; }
  85%, 100% { background-position: -40% 0; }
}

.vault-card-inner {
  position: absolute;
  inset: 0;
  display: flex;
  border-radius: inherit;
  overflow: hidden;
}

/* 左侧藏签竖条 */
.vault-rail {
  flex: none;
  width: 34px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 0 14px;
  border-right: 1px solid rgba(198, 166, 100, 0.2);
  background: linear-gradient(180deg, rgba(198, 166, 100, 0.1), rgba(198, 166, 100, 0.03));
  writing-mode: horizontal-tb;
}

.vault-no {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #c6a664;
}

.vault-rail i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex: none;
}

.vault-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 18px 18px 16px;
}

.vault-en {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(232, 226, 210, 0.55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vault-cn {
  margin: 8px 0 2px;
  font-family: "Songti SC", "SimSun", "Noto Serif SC", serif;
  font-size: clamp(1.4rem, 5vw, 1.75rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #f0e9d6;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.vault-rule {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
}

.vault-rule::before {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(198, 166, 100, 0.55), rgba(198, 166, 100, 0.06));
}

.vault-rule::after {
  content: "";
  width: 5px;
  height: 5px;
  transform: rotate(45deg);
  border: 1px solid rgba(198, 166, 100, 0.7);
  flex: none;
}

.vault-desc {
  font-size: 0.8125rem;
  line-height: 1.85;
  color: rgba(232, 226, 210, 0.72);
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: none;
}

.vault-foot {
  margin-top: auto;
  padding-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.vault-host {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.02em;
  color: rgba(232, 226, 210, 0.55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vault-go {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(198, 166, 100, 0.55);
  background: linear-gradient(180deg, rgba(198, 166, 100, 0.18), rgba(198, 166, 100, 0.07));
  color: #ecdfbe;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-decoration: none;
  transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.vault-go:hover {
  background: rgba(198, 166, 100, 0.28);
  box-shadow: 0 6px 18px rgba(198, 166, 100, 0.25);
  transform: translateY(-1px);
}

.vault-go:focus {
  outline: none;
}

.vault-go:focus-visible {
  outline: 2px solid rgba(198, 166, 100, 0.6);
  outline-offset: 2px;
}

.vault-card.is-active {
  border-color: rgba(198, 166, 100, 0.65);
}

/* 底部导航：圆钮 + 计数 + 圆点 */
.vault-nav {
  position: absolute;
  left: 0;
  right: 0;
  bottom: clamp(8px, 2.6vh, 22px);
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 0 1rem;
}

.vault-arrow {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(23, 28, 38, 0.85);
  border: 1px solid rgba(198, 166, 100, 0.4);
  color: #ecdfbe;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.vault-arrow:hover {
  background: rgba(198, 166, 100, 0.22);
  transform: translateY(-1px);
}

.vault-arrow:active {
  transform: scale(0.95);
}

.vault-arrow:focus {
  outline: none;
}

.vault-arrow:focus-visible {
  outline: 2px solid rgba(198, 166, 100, 0.6);
  outline-offset: 2px;
}

.vault-count {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.18em;
  color: rgba(232, 226, 210, 0.7);
  font-variant-numeric: tabular-nums;
  min-width: 76px;
  text-align: center;
}

.vault-count b {
  color: #ecdfbe;
  font-size: 1rem;
}

.vault-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: clamp(54px, 8vh, 72px);
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 1rem;
  flex-wrap: wrap;
  max-width: 100%;
}

.vault-dot {
  width: 22px;
  height: 4px;
  border: 0;
  border-radius: 999px;
  background: rgba(232, 226, 210, 0.18);
  cursor: pointer;
  padding: 0;
  transition: background-color 0.25s ease, width 0.25s ease;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.vault-dot:focus {
  outline: none;
}

.vault-dot.is-on {
  width: 34px;
  background: #c6a664;
}

.vault-empty {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  text-align: center;
  font-size: 0.95rem;
  letter-spacing: 0.2em;
  color: rgba(232, 226, 210, 0.6);
}

body.vault-mode .modal-card {
  background: rgba(23, 28, 38, 0.96);
  border-color: rgba(198, 166, 100, 0.35);
}

@media (max-width: 767px) {
  .vault-stage {
    inset: 8px 0 clamp(82px, 13vh, 100px) 0;
    perspective: 1050px;
  }

  .vault-card {
    width: min(300px, 82vw);
    height: min(390px, 100%);
  }

  .vault-desc {
    -webkit-line-clamp: 4;
  }

  .vault-dots {
    display: none;
  }

  .vault-nav {
    bottom: clamp(38px, 6vh, 52px);
    gap: 12px;
  }
}

@media (max-height: 600px) {
  .vault-stage {
    inset: 4px 0 74px 0;
  }

  .vault-card {
    height: min(320px, 100%);
  }

  .vault-cn {
    font-size: 1.25rem;
    margin: 4px 0 2px;
  }

  .vault-desc {
    -webkit-line-clamp: 3;
    font-size: 0.75rem;
    line-height: 1.6;
  }

  .vault-nav {
    bottom: 24px;
  }

  .vault-arrow {
    width: 36px;
    height: 36px;
  }
}

@media (min-width: 768px) and (max-width: 1024px) {
  .vault-stage {
    perspective: 1200px;
  }

  .vault-card {
    width: 310px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .vault-card.is-active::after {
    animation: none;
  }

  .vault-card,
  .vault-go,
  .vault-arrow {
    transition: none;
  }
}


/* ---------- YINUNU 通用模态弹窗（产品矩阵 & 隐私条款） ---------- */
.yinunu-products-modal[hidden] {
  display: none !important;
}

.yinunu-products-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.yinunu-products-modal * {
  box-sizing: border-box;
}

.yinunu-products-modal a {
  text-decoration: none;
}

.yinunu-products-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.yinunu-products-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  background: #181c2a !important;
  color: #f1f5f9 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: yinunuFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes yinunuFadeIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.yinunu-products-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  background: transparent !important;
}

.yinunu-products-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.yinunu-products-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  color: #f8fafc !important;
  letter-spacing: 0.02em;
  line-height: 1.4;
}

.yinunu-products-subtitle {
  margin: 0;
  font-size: 0.78rem;
  color: #94a3b8 !important;
  line-height: 1.4;
}

.yinunu-products-close {
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  font-size: 1.5rem;
  line-height: 1;
  color: #94a3b8 !important;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
}

.yinunu-products-close:hover {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.08) !important;
}

.yinunu-products-body {
  padding: 1.25rem 1.5rem 1.5rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: transparent !important;
  color: #f1f5f9 !important;
}

.yinunu-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}

.yinunu-product-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 8px;
  text-decoration: none !important;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.yinunu-product-item:hover {
  transform: translateY(-2px);
  border-color: #38bdf8 !important;
  background: rgba(56, 189, 248, 0.06) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.yinunu-product-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: #f1f5f9 !important;
  margin-bottom: 0.35rem;
  transition: color 0.15s ease;
}

.yinunu-product-url {
  font-size: 0.75rem;
  color: #94a3b8 !important;
  word-break: break-all;
  transition: color 0.15s ease;
}

.yinunu-product-item:hover .yinunu-product-name {
  color: #38bdf8 !important;
}

.yinunu-product-item:hover .yinunu-product-url {
  color: #cbd5e1 !important;
}

/* ---------- 隐私条款专属样式 ---------- */
.yinunu-privacy-body {
  font-size: 0.85rem;
  line-height: 1.75;
  color: #cbd5e1 !important;
}

.yinunu-privacy-lead {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.1) !important;
  color: #f1f5f9 !important;
}

.yinunu-privacy-body h4 {
  margin: 1.1rem 0 0.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #38bdf8 !important;
}

.yinunu-privacy-body p {
  margin: 0.4rem 0;
  color: #cbd5e1 !important;
}

.yinunu-privacy-body strong {
  color: #f8fafc !important;
  font-weight: 600;
}

.yinunu-privacy-bullet {
  padding-left: 0.8rem;
  position: relative;
}

.yinunu-privacy-bullet::before {
  content: "•";
  position: absolute;
  left: 0;
  color: #38bdf8 !important;
}

.yinunu-privacy-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0.85rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
  background: rgba(0, 0, 0, 0.18) !important;
}

.yinunu-privacy-agree-btn {
  background: #0284c7 !important;
  color: #ffffff !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  border-radius: 6px;
  padding: 0.5rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

.yinunu-privacy-agree-btn:hover {
  background: #0369a1 !important;
  opacity: 0.95;
  transform: translateY(-1px);
}

@media (max-width: 480px) {
  .yinunu-products-card { max-height: 90vh; }
  .yinunu-products-grid { grid-template-columns: 1fr; }
  .yinunu-privacy-footer { justify-content: stretch; }
  .yinunu-privacy-agree-btn { width: 100%; text-align: center; }
}
