/* 跳吧小球 — 拼贴画 UI（剪贴手账风）
 * 不透明纸卡 + 垫纸叠层 + 和纸胶带 + 白边贴纸 + 剪刀虚线，
 * 保留浅蓝主色 / 粉色主按钮 / 果冻按压动效；全部纯 CSS 零位图。
 * 每屏只留一个签名元素：菜单 = 贴纸标题，面板 = 垫纸叠层 + 胶带。 */

/* 首页标题专用字体：呆萌手写体 2.2 子集，只内置「跳吧，小球！」的 6 个字符。 */
@font-face {
  font-family: "Jump Ball Title";
  src: url("assets/fonts/daimeng-handwriting-title.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  unicode-range: U+5427, U+5C0F, U+7403, U+8DF3, U+FF01, U+FF0C;
}

:root {
  /* 色板（浅蓝主色 + 蓝灰中性色，与游戏世界同源） */
  --ink: #3c4c5a;            /* 深海蓝灰：标题、正文 */
  --ink-soft: #5c6f7d;       /* 次级文字 */
  --muted: #92a3b0;          /* 弱化文字 */
  --line: rgba(78, 108, 132, 0.13);
  --line-strong: rgba(78, 108, 132, 0.26);
  --candy: #7ec8ee;          /* 浅蓝 */
  --candy-deep: #3598d4;     /* 深晴蓝（主行动色） */
  --candy-soft: #d4ecf9;     /* 浅蓝晕染 */
  --sky: #58a8dc;            /* 信息蓝（辅助状态） */
  --butter: #ffb72e;         /* 星星金 */
  --gold-ink: #b57d12;       /* 金色文字（对比度安全） */
  --danger: #ef476f;         /* 与 3D 危险区同色 */
  --rage: #ff5a3c;           /* 与 3D 暴走同色 */
  --rare: #d49b35;
  --epic: #9775fa;
  /* 拼贴画材质 */
  --paper-a: #f2f7fb;        /* 垫纸（浅） */
  --paper-b: #e6eef6;        /* 垫纸（深） */
  --cut: rgba(78, 108, 132, 0.28);      /* 剪刀虚线 */
  --tape: rgba(126, 200, 238, 0.5);     /* 和纸胶带（浅蓝） */
  --tape-gold: rgba(255, 199, 79, 0.5); /* 胶带（金） */
  --tape-gray: rgba(148, 163, 176, 0.45); /* 胶带（灰蓝） */
  --sh-cut: 3px 4px 0 rgba(60, 76, 92, 0.2);   /* 剪纸硬投影 */
  --sh-panel: 0 18px 44px rgba(96, 158, 205, 0.22);
  /* 几何与动效 */
  --r-md: 16px;
  --r-lg: 14px;
  --r-pill: 999px;
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  /* 字体 */
  --display: "Avenir Next", "SF Pro Display", "PingFang SC", sans-serif;
  --title-display: "Yuanti SC", "Hiragino Sans GB", "PingFang SC", sans-serif;
  --title-logo: "Jump Ball Title", "Yuanti SC", "Hiragino Sans GB", "PingFang SC", sans-serif;
  --body: "PingFang SC", "SF Pro Text", "Microsoft YaHei", sans-serif;
  /* 小红书宿主按钮与系统安全区分别避让；普通浏览器可覆写为 0px。 */
  --safe-top: env(safe-area-inset-top, 0px);
  --host-controls-height: 48px;
}

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

html,
body {
  height: 100%;
  overflow: hidden;
  font-family: var(--body);
  user-select: none;
  -webkit-user-select: none;
}

body {
  position: fixed;
  inset: 0;
  color: var(--ink);
  background: #edf6fc;
}

/* 所有覆盖页共用一张常驻轻模糊层：应用启动时即进入合成树，
 * 切页时只改透明度，不为每个面板临时创建全屏模糊纹理。 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(180deg, rgba(246, 249, 253, 0.58), rgba(235, 246, 252, 0.68));
  backdrop-filter: blur(5px) saturate(1.05);
  -webkit-backdrop-filter: blur(5px) saturate(1.05);
  transform: translateZ(0);
  will-change: opacity, backdrop-filter;
}

body[data-screen="pause"]::after,
body[data-screen="over"]::after,
body[data-screen="shop"]::after,
body[data-screen="settings"]::after,
body[data-screen="webgl-error"]::after { opacity: 1; }

/* ---------- 空间背景 ---------- */
.bg-layer {
  position: fixed;
  inset: 0;
  transition: opacity 0.8s ease;
}

#bg-a {
  background: linear-gradient(180deg, #ffe3f1 0%, #c2e9fb 100%);
  opacity: 1;
}

#bg-b { opacity: 0; }

#bg-dots {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, 0.5) 1.5px, transparent 1.6px);
  background-size: 26px 26px;
  box-shadow: inset 0 0 22vmax rgba(60, 118, 152, 0.10);
}

.blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(46px);
  pointer-events: none;
  opacity: 0.5;
  animation: float 11s ease-in-out infinite alternate;
}

.b1 { width: 34vmax; height: 34vmax; left: -12vmax; top: -8vmax; background: #ffffff; }
.b2 { width: 26vmax; height: 26vmax; right: -10vmax; top: 22vh; background: #d6ecfa; animation-delay: -3s; animation-duration: 13s; }
.b3 { width: 30vmax; height: 30vmax; left: -8vmax; bottom: -12vmax; background: #d8f0ff; animation-delay: -6s; }
.b4 { width: 18vmax; height: 18vmax; right: 6vw; bottom: 8vh; background: #ffffff; animation-delay: -8s; animation-duration: 9s; }

@keyframes float {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(4vw, 3vh, 0) scale(1.12); }
}

/* ---------- 游戏画布 ---------- */
#stage { position: fixed; inset: 0; }

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* ---------- 通用屏幕 ---------- */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 10;
}

.screen.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* 覆盖页本身只承载内容，背景质感由全局共享层提供。 */
.overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  will-change: opacity;
}

.overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* ---------- 纸卡面板：不透明点阵纸 + 两张旋转垫纸（垫纸靠负 z-index 压在面板背景后） ---------- */
.panel {
  position: relative;
  width: min(370px, calc(100vw - 32px));
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: var(--ink);
  text-align: left;
  background:
    radial-gradient(rgba(126, 200, 238, 0.16) 1.2px, transparent 1.3px),
    linear-gradient(180deg, #ffffff, #f7fbfe);
  background-size: 18px 18px, 100% 100%;
  border-radius: var(--r-lg);
  box-shadow: var(--sh-panel);
}

/* 垫纸 A：右倾，露出右下纸边 */
.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--paper-b);
  border-radius: var(--r-lg);
  box-shadow: 0 6px 18px rgba(96, 158, 205, 0.14);
  transform: rotate(1.7deg);
}

/* 垫纸 B：左倾，露出左上纸边 */
.panel::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background: var(--paper-a);
  border-radius: var(--r-lg);
  transform: rotate(-1.1deg) translate(2px, 3px);
}

/* 覆盖页必须点击后立即完整出现，不再使用位移 / 缩放入场。 */
.screen.active .panel { animation: none; }

.panel h2 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 13px;
  margin-bottom: 2px;
  border-bottom: 2px dashed var(--cut);
  font-family: var(--title-display);
  font-size: 23px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

/* 和纸胶带：贴在面板顶边中央（h2 无定位，伪元素相对 .panel 解析） */
.panel h2::before {
  content: "";
  position: absolute;
  top: -14px;
  left: 50%;
  width: 104px;
  height: 26px;
  margin-left: -52px;
  background: var(--tape);
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35), 0 1px 2px rgba(60, 76, 92, 0.08);
  opacity: 0.85;
  transform: rotate(-2.5deg);
}

#screen-over .panel h2::before { background: var(--tape-gold); }
#screen-settings .panel h2::before { background: var(--tape-gray); }

.panel h2 small {
  color: var(--muted);
  font-family: var(--display);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.22em;
}

/* ---------- 控件：白边贴纸按钮（按下像小球落地一样压扁） ---------- */
.btn {
  position: relative;
  min-height: 46px;
  padding: 11px 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: var(--r-pill);
  color: var(--ink-soft);
  background: #e8f1f8;
  box-shadow: 0 0 0 4px #fff, var(--sh-cut);
  font-family: var(--body);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transform: rotate(-0.5deg);
  transition: color 0.16s ease, background 0.16s ease,
    box-shadow 0.16s ease, transform 0.18s var(--spring);
}

.btn:hover {
  color: var(--ink);
  background: #f2f8fd;
  transform: rotate(0deg) translateY(-1px);
}

/* 果冻挤压：横向微胀、纵向压扁，松手由 --spring 过冲回位 */
.btn:active { transform: translateY(2px) scale(1.035, 0.9); box-shadow: 0 0 0 4px #fff, 1px 2px 0 rgba(60, 76, 92, 0.14); }

.btn-primary {
  min-height: 54px;
  color: #fff;
  background: linear-gradient(165deg, #ff8ab6 0%, #f0509a 58%, #e8438c 100%);
  box-shadow: 0 0 0 4px #fff, 4px 6px 0 rgba(214, 80, 140, 0.28);
  font-family: var(--title-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-shadow: 0 1px 2px rgba(170, 30, 90, 0.22);
  transform: rotate(-0.6deg);
  transition: filter 0.16s ease, box-shadow 0.16s ease, transform 0.18s var(--spring);
}

.btn-primary:hover {
  color: #fff;
  background: linear-gradient(165deg, #ff8ab6 0%, #f0509a 58%, #e8438c 100%);
  filter: brightness(1.06);
  transform: rotate(0deg) translateY(-1px);
}

.btn-primary:active { box-shadow: 0 0 0 4px #fff, 1px 2px 0 rgba(214, 80, 140, 0.28); }

/* 主按钮箭头：朴素字形跟在文字后，不做徽章 */
.btn-primary b { font-family: var(--display); font-weight: 700; }

.btn:focus-visible,
.icon-btn:focus-visible,
.skin-btn:focus-visible,
.theme-dot:focus-visible,
.skin-item:focus-visible,
input:focus-visible {
  outline: 2.5px solid var(--candy-deep);
  outline-offset: 3px;
}

/* ---------- HUD：白纸小标签 + 迷你胶带 ---------- */
#screen-hud {
  justify-content: flex-start;
  pointer-events: none;
}

.hud-top {
  width: 100%;
  padding: calc(var(--safe-top) + var(--host-controls-height) + 16px) 18px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-top .icon-btn { margin-left: auto; }

.hud-chip,
.menu-chip {
  position: relative;
  min-height: 38px;
  padding: 7px 15px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  background: #fff;
  border-radius: var(--r-pill);
  box-shadow: var(--sh-cut);
  font-family: var(--display);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

/* 标签顶上的迷你胶带 */
.hud-chip::before,
.menu-chip::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  width: 24px;
  height: 10px;
  margin-left: -12px;
  background: var(--tape);
  border-radius: 2px;
  opacity: 0.8;
  transform: rotate(-4deg);
}

.hud-top .hud-chip:nth-child(1) { transform: rotate(-1deg); }
.hud-top .hud-chip:nth-child(2) { transform: rotate(0.8deg); }

.hud-chip small { color: var(--muted); font-size: 9px; letter-spacing: 0.08em; }

.hud-label {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.icon-star { width: 15px; height: 15px; fill: var(--butter); filter: drop-shadow(0 1px 2px rgba(200, 140, 30, 0.4)); }
.icon-inline { width: 13px; height: 13px; vertical-align: -2px; }
.icon-new { width: 15px; height: 15px; vertical-align: -3px; }

.icon-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  color: var(--ink-soft);
  background: #fff;
  border: 0;
  border-radius: 13px;
  box-shadow: var(--sh-cut);
  cursor: pointer;
  transform: rotate(0.8deg);
  transition: background 0.16s ease, transform 0.18s var(--spring);
}

.icon-btn:hover { background: #fff; transform: rotate(0deg) translateY(-1px); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn svg { width: 15px; height: 15px; fill: currentColor; }

.combo-wrap {
  position: absolute;
  top: calc(var(--safe-top) + var(--host-controls-height) + 68px);
  left: 18px;
  display: flex;
  align-items: center;
  gap: 9px;
  pointer-events: none;
}

#combo-label {
  min-width: 37px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.combo-bar {
  position: relative;
  width: 132px;
  height: 8px;
  overflow: hidden;
  background: #fff;
  border-radius: var(--r-pill);
  box-shadow: 0 0 0 3px #fff, 2px 3px 0 rgba(60, 76, 92, 0.12);
}

#combo-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #9ad6f5, var(--candy-deep));
  border-radius: var(--r-pill);
  transition: width 0.14s linear;
}

/* 顶部一道柔光，让进度条也有糖果光泽 */
.combo-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), transparent 60%);
}

.combo-wrap.raging #combo-label { color: var(--rage); }
.combo-wrap.raging #combo-fill {
  background: linear-gradient(90deg, var(--rage), #ff9a3c);
  box-shadow: 0 0 14px rgba(255, 90, 60, 0.5);
  animation: charge 0.35s ease-in-out infinite alternate;
}

.combo-wrap.guarded #combo-label { color: var(--sky); }
.combo-wrap.guarded .combo-bar { box-shadow: 0 0 0 3px rgba(88, 168, 220, 0.4), 2px 3px 0 rgba(60, 76, 92, 0.12); }

@keyframes charge { to { filter: brightness(1.4); } }

/* ---------- 开始页 ---------- */
.panel-screen { text-align: left; }

#screen-menu.active {
  align-items: flex-start;
  padding-left: clamp(28px, 9vw, 150px);
  background: linear-gradient(90deg, rgba(248, 251, 254, 0.94) 0%, rgba(246, 250, 253, 0.78) 34%, rgba(244, 250, 253, 0.48) 52%, transparent 72%);
}

#screen-menu { gap: 0; }

#screen-menu.active > * { animation: menuIn 0.42s var(--spring) backwards; }
#screen-menu.active > *:nth-child(2) { animation-delay: 0.05s; }
#screen-menu.active > *:nth-child(3) { animation-delay: 0.1s; }
#screen-menu.active > *:nth-child(4) { animation-delay: 0.15s; }
#screen-menu.active > *:nth-child(5) { animation-delay: 0.2s; }
#screen-menu.active > *:nth-child(6) { animation-delay: 0.25s; }
#screen-menu.active > *:nth-child(7) { animation-delay: 0.3s; }

@keyframes menuIn {
  from { opacity: 0; transform: translateX(-14px); }
}

/* 贴纸标题：厚白描边字 + 剪纸硬投影 + 微倾斜，「小球」保持浅蓝渐变填充 */
.title {
  position: relative;
  width: min(430px, calc(100vw - 48px));
  display: flex;
  align-items: baseline;
  gap: 0;
  margin-bottom: 26px;
  color: var(--ink);
  font-family: var(--title-logo);
  font-size: clamp(44px, 6.3vw, 68px);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: 0.01em;
  -webkit-text-stroke: 6px #fff;
  paint-order: stroke fill;
  filter: drop-shadow(4px 6px 0 rgba(60, 76, 92, 0.16));
  transform: rotate(-1.2deg);
  transform-origin: bottom left;
}

.screen.active .title { animation: jellyIn 0.7s var(--spring) backwards; }

/* 手写体的全角逗号在字面内偏右：单独收窄标点字面，使它视觉上紧跟「吧」。 */
.title-comma {
  display: inline-block;
  width: 0.48em;
  margin-left: -0.14em;
  margin-right: 0.08em;
}

/* 挤压入场全程保持 -1.2deg 倾斜（动画会覆盖 transform，角度需写进关键帧） */
@keyframes jellyIn {
  0% { opacity: 0; transform: scale(0.55, 1.45) rotate(-1.2deg); }
  55% { opacity: 1; transform: scale(1.08, 0.94) rotate(-1.2deg); }
  78% { transform: scale(0.97, 1.03) rotate(-1.2deg); }
  100% { transform: scale(1, 1) rotate(-1.2deg); }
}

.title em {
  display: inline-block;
  font-style: normal;
  font-weight: 400;
  background: linear-gradient(180deg, #9ad6f5 0%, var(--candy-deep) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  /* 渐变填充字若继承 6px 粗白描边，小屏上笔画间隙被白色填满、「小球」糊成白色；
     改用细描边，让渐变清晰透出来 */
  -webkit-text-stroke: 2.5px #fff;
  text-shadow: none;
  transform: translateY(0.03em);
}

/* 全角感叹号收窄字面后贴近「球」，再做一次间歇的落地回弹。 */
.title-bang {
  display: inline-block;
  width: 0.5em;
  margin-left: -0.24em;
  transform-origin: 50% 88%;
  animation: titleBangBounce 1.9s var(--spring) infinite;
}

@keyframes titleBangBounce {
  0%, 68%, 100% { transform: translateY(0) rotate(0deg) scale(1); }
  75% { transform: translateY(-0.14em) rotate(7deg) scale(1.08, 0.94); }
  82% { transform: translateY(0.04em) rotate(-4deg) scale(0.96, 1.08); }
  89% { transform: translateY(-0.03em) rotate(2deg) scale(1.02, 0.98); }
}

.menu-stats {
  width: min(430px, calc(100vw - 48px));
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.menu-chip {
  min-height: 34px;
  padding: 6px 13px;
  color: var(--ink-soft);
  font-size: 12px;
  font-family: var(--body);
  font-weight: 500;
  letter-spacing: 0.04em;
}

.menu-stats .menu-chip:nth-child(1) { transform: rotate(-0.8deg); }
.menu-stats .menu-chip:nth-child(2) { transform: rotate(0.9deg); }

.menu-chip.gold { color: var(--gold-ink); font-weight: 600; }

#screen-menu > .btn-primary,
#screen-menu > .menu-row,
#screen-menu > .menu-themes { width: min(430px, calc(100vw - 48px)); }

.menu-row { display: flex; gap: 8px; margin-top: 10px; }
.menu-row .btn { flex: 1; }
.menu-row .btn:nth-child(1) { transform: rotate(-0.6deg); }
.menu-row .btn:nth-child(2) { transform: rotate(0.6deg); }
.menu-row .btn:hover { transform: rotate(0deg) translateY(-1px); }

.menu-themes {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 2px dashed var(--cut);
}

.theme-dot {
  width: 34px;
  height: 34px;
  margin-right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.92);
  border: 0;
  border-radius: 50%;
  box-shadow: var(--sh-cut);
  transition: transform 0.18s var(--spring), box-shadow 0.16s ease;
}

.theme-dot:nth-child(odd) { transform: rotate(-2deg); }
.theme-dot:nth-child(even) { transform: rotate(2deg); }
.theme-dot:hover { transform: rotate(0deg) translateY(-2px); box-shadow: 0 7px 16px rgba(96, 158, 205, 0.2); }
.theme-dot svg { width: 16px; height: 16px; filter: saturate(0.9); }
.theme-dot.locked { opacity: 0.38; filter: grayscale(1); }

/* ---------- 结算 ---------- */
.over-stats {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 6px;
  border-top: 2px dashed var(--cut);
}

.over-row {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  border-bottom: 2px dashed var(--cut);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.over-row:last-child { border-bottom: 0; }

.over-row b {
  color: var(--ink);
  font-family: var(--display);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.over-row b#over-layers {
  font-size: 32px;
  font-weight: 800;
  background: linear-gradient(120deg, var(--candy-deep), var(--candy));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.new-record {
  display: none;
  align-self: flex-start;
  align-items: center;
  gap: 5px;
  padding: 6px 13px;
  color: #fff;
  background: linear-gradient(135deg, #ffc94f, #f5a012);
  border-radius: var(--r-pill);
  box-shadow: 0 0 0 3px #fff, 3px 4px 0 rgba(160, 100, 0, 0.25);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-shadow: 0 1px 1px rgba(160, 100, 0, 0.25);
  transform: rotate(-1deg);
  animation: recordPop 0.4s var(--spring) backwards;
}

@keyframes recordPop {
  from { opacity: 0; transform: scale(0.5) rotate(-1deg); }
}

/* ---------- 结算页内复活 ---------- */
.over-revive {
  margin: 2px 0 4px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  background: linear-gradient(135deg, rgba(255, 246, 214, 0.72), rgba(255, 255, 255, 0.38));
  border: 2px dashed rgba(214, 155, 53, 0.45);
  border-radius: 12px;
}

.over-revive[hidden] { display: none; }

.over-revive-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.over-revive-head b {
  color: var(--ink);
  font-size: 13px;
  letter-spacing: 0.03em;
}

.over-revive-head span {
  color: var(--gold-ink);
  font-size: 10px;
  letter-spacing: 0.03em;
}

.revive-meta {
  padding: 11px 13px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 11px;
}

.revive-meta b { color: var(--gold-ink); font-size: 14px; }
.revive-btn { margin-top: 2px; }
.revive-btn:disabled,
.revive-btn.poor {
  color: var(--muted);
  background: #eef3f6;
  box-shadow: 0 0 0 4px #fff, 2px 3px 0 rgba(60, 76, 92, 0.08);
  text-shadow: none;
  cursor: default;
  filter: none;
}

/* ---------- 球体外观 ---------- */
/* 商店面板内部滚动，溢出的垫纸/胶带会被裁掉——改用展台胶带当签名元素 */
.shop-panel {
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--candy-soft) transparent;
}

.shop-panel::before,
.shop-panel::after { display: none; }
.shop-panel h2::before { display: none; }

.shop-panel::-webkit-scrollbar { width: 8px; }
.shop-panel::-webkit-scrollbar-thumb { background: var(--candy-soft); border-radius: var(--r-pill); }
.shop-panel::-webkit-scrollbar-track { background: transparent; }

/* 星星余额是辅助信息，用紧凑胶囊即可，不占满整行。 */
.shop-panel > .menu-chip {
  min-height: 30px;
  padding: 5px 12px;
  align-self: flex-end;
  font-size: 14px;
}

.shop-panel > .menu-chip::before { display: none; }

/* 贴上去的照片：白厚边 + 顶部胶带 */
.skin-stage-wrap {
  position: relative;
  isolation: isolate;
  flex: none;  /* 商店面板是纵向 flex，矮屏下禁止被压缩成一条线，宁可让面板滚动 */
  height: 148px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(199, 222, 238, 0.36));
  border: 5px solid #fff;
  border-radius: 10px;
  box-shadow: var(--sh-cut);
}

.skin-stage-wrap::before {
  content: "";
  position: absolute;
  top: -9px;
  left: 50%;
  z-index: 3;
  width: 72px;
  height: 22px;
  margin-left: -36px;
  background: var(--tape);
  border-radius: 3px;
  opacity: 0.85;
  transform: rotate(2deg);
}

/* 展台底部一团柔光，像给角色打了盏展示灯 */
.skin-stage-wrap::after {
  content: "";
  position: absolute;
  left: 15%;
  right: 15%;
  bottom: -18%;
  height: 62%;
  z-index: 0;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.85), transparent);
  pointer-events: none;
}

.skin-stage-wrap.rarity-rare {
  background: linear-gradient(180deg, rgba(255, 248, 224, 0.7), rgba(212, 155, 53, 0.16));
}

.skin-stage-wrap.rarity-epic {
  background: linear-gradient(180deg, rgba(241, 235, 255, 0.7), rgba(151, 117, 250, 0.18));
}

#skin-stage {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
}

.skin-stage-name {
  position: absolute;
  z-index: 2;
  left: 13px;
  bottom: 10px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

.skin-stage-badge {
  position: absolute;
  z-index: 2;
  top: 10px;
  right: 10px;
  padding: 3px 10px;
  color: #fff;
  background: linear-gradient(135deg, var(--candy), var(--candy-deep));
  border-radius: var(--r-pill);
  box-shadow: 0 0 0 2px #fff, 2px 3px 0 rgba(53, 152, 212, 0.3);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

#btn-skin-action .icon-inline { width: 11px; height: 11px; margin: 0 2px 0 4px; vertical-align: -1px; color: #ffd873; }
#btn-skin-action:disabled { opacity: 0.55; cursor: default; }
#btn-skin-action.poor { color: var(--muted); background: #eef3f6; box-shadow: 0 0 0 4px #fff, 2px 3px 0 rgba(60, 76, 92, 0.08); text-shadow: none; }

.shop-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin: 1px 0 6px;
}

/* 拍立得小卡：白边、下边框稍厚的比例 */
.skin-item {
  position: relative;
  min-width: 0;
  padding: 4px 4px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  background: #fff;
  border: 2px solid transparent;
  border-radius: 10px;
  box-shadow: var(--sh-cut);
  cursor: pointer;
  transition: transform 0.18s var(--spring), box-shadow 0.16s ease, border-color 0.16s ease;
}

.skin-item:hover { transform: translateY(-2px) rotate(-0.8deg); box-shadow: 0 8px 18px rgba(96, 158, 205, 0.2); }

.skin-item.rarity-rare { border-color: rgba(212, 155, 53, 0.55); border-style: dashed; }
.skin-item.rarity-epic { border-color: rgba(151, 117, 250, 0.55); border-style: dashed; }

/* 装备中：右上角一颗金豆标记 */
.skin-item.current::after {
  content: "";
  position: absolute;
  top: 7px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe9b0, var(--butter) 60%, #f5a012);
  box-shadow: 0 1px 4px rgba(245, 160, 18, 0.5);
}

.skin-item.selected {
  border-color: var(--candy-deep);
  border-style: dashed;
  box-shadow: var(--sh-cut);
}

.skin-thumb {
  width: min(52px, 100%);
  height: min(52px, 16vw);
  display: block;
  border-radius: 8px;
  pointer-events: none;
}

.skin-name {
  max-width: 100%;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.skin-price {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.skin-price .icon-inline { width: 9px; height: 9px; color: var(--butter); }

/* ---------- 设置 ---------- */
.set-row {
  min-height: 52px;
  padding: 7px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--ink-soft);
  border-bottom: 2px dashed var(--cut);
  font-size: 13px;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.set-row:last-of-type { border-bottom: 0; }

/* 胶囊开关：开启时轨道是浅蓝渐变 */
.set-row input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 46px;
  height: 27px;
  flex-shrink: 0;
  position: relative;
  background: rgba(60, 76, 92, 0.14);
  border: 0;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: background 0.2s ease;
}

.set-row input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 21px;
  height: 21px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(60, 76, 92, 0.3);
  transition: left 0.2s var(--spring);
}

.set-row input[type="checkbox"]:checked { background: linear-gradient(90deg, #9ad6f5, var(--candy-deep)); }
.set-row input[type="checkbox"]:checked::after { left: 22px; }

/* 胶囊滑杆：圆糖豆手柄 */
.set-row input[type="range"] {
  flex: 1;
  appearance: none;
  -webkit-appearance: none;
  height: 6px;
  background: rgba(60, 76, 92, 0.12);
  border-radius: var(--r-pill);
  cursor: pointer;
}

.set-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: radial-gradient(circle at 35% 30%, #fff, #eaf4fb 70%);
  border: 2px solid var(--candy-deep);
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(53, 152, 212, 0.35);
}

.set-row input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: radial-gradient(circle at 35% 30%, #fff, #eaf4fb 70%);
  border: 2px solid var(--candy-deep);
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(53, 152, 212, 0.35);
}

.sens-val {
  min-width: 34px;
  color: var(--candy-deep);
  text-align: right;
  font-family: var(--display);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

#webgl-error p { color: var(--muted); font-size: 13px; line-height: 1.7; }

@media (max-width: 680px) {
  #screen-menu.active {
    align-items: center;
    justify-content: flex-end;
    padding: 0 24px calc(env(safe-area-inset-bottom, 0px) + 30px);
    background: linear-gradient(180deg, transparent 4%, rgba(246, 250, 253, 0.3) 38%, rgba(243, 249, 253, 0.94) 72%);
  }

  .title,
  .menu-stats,
  #screen-menu > .btn-primary,
  #screen-menu > .menu-row,
  #screen-menu > .menu-themes { width: 100%; }

  .title {
    position: absolute;
    top: calc(env(safe-area-inset-top, 0px) + 70px);
    left: 24px;
    width: calc(100% - 48px);
    margin: 0;
    font-size: clamp(46px, 15vw, 68px);
  }

  .menu-themes { margin-top: 14px; }
}

@media (max-height: 690px) {
  #screen-menu.active { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 14px); }
  .menu-stats { margin-bottom: 9px; }
  .menu-themes { margin-top: 10px; padding-top: 9px; }
  .theme-dot { width: 26px; height: 26px; }
  .panel { padding: 24px; gap: 9px; }
  .shop-grid { gap: 5px; }
  .skin-item { padding: 3px 3px 5px; gap: 1px; }
  .skin-thumb { width: min(46px, 100%); height: min(46px, 15vw); }
  .skin-stage-wrap { height: 116px; }
}

@media (prefers-reduced-motion: reduce) {
  .blob,
  .screen.active .panel,
  #screen-menu.active > *,
  .screen.active .title,
  .title-bang,
  .new-record,
  .combo-wrap.raging #combo-fill { animation: none !important; }
  .bg-layer { transition: none; }
}
