/* Outfit 字体（SIL Open Font License）放在自己服务器上：不依赖 Google Fonts（国内经常很慢或打不开，
   会导致页面先用系统字体显示再突然换字体，看起来像"闪一下"）。
   font-display: optional —— 字体没能在极短时间内就绪时，本次直接用系统字体，不中途替换。 */
@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 400 800;
  font-display: optional;
  src: url("fonts/outfit-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* 小游戏合集 · 公共样式
   所有页面共用：配色、背景光晕、按钮、图标按钮 */

:root {
  --bg: #07070d;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f1f2f8;
  --text-dim: #9a9cb5;
  --text-faint: #5f6283;
  --accent: #7c5cff;
  --accent-2: #22d3ee;
  --accent-3: #f472b6;
  --btn-a: #7c5cff;
  --btn-b: #22d3ee;
  --radius: 22px;
  --font: "Outfit", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
/* 手机上不缩放页面：manipulation 关掉"双击放大"（单击照常、没有 300ms 延迟）；
   iOS Safari 会忽略 viewport 里的 user-scalable=no，双指缩放另由 arcade-ui.js 拦截 */
html {
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

/* ---------- 背景：流动光晕 + 网格 ---------- */
.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
/* 光斑用径向渐变画出柔边，不用 filter: blur（大面积模糊在手机上很耗性能） */
.aurora span {
  position: absolute;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--c) 0%, color-mix(in srgb, var(--c) 45%, transparent) 45%, transparent 100%);
  opacity: 0.3;
  will-change: transform;
  animation: drift 24s ease-in-out infinite alternate;
}
.aurora span:nth-child(1) { --c: var(--accent); top: -25vmax; left: -15vmax; }
.aurora span:nth-child(2) { --c: var(--accent-2); bottom: -30vmax; right: -20vmax; opacity: 0.18; animation-delay: -8s; }
.aurora span:nth-child(3) { --c: var(--accent-3); top: 35%; left: 45%; width: 38vmax; height: 38vmax; opacity: 0.12; animation-delay: -16s; }
.aurora::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 20%, transparent 70%);
  mask-image: radial-gradient(ellipse at 50% 40%, #000 20%, transparent 70%);
}
@keyframes drift { to { transform: translate(8vmax, 6vmax) scale(1.15); } }

/* ---------- 按钮 ---------- */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.3s ease, background 0.3s ease;
}
.btn:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.12); }
.btn:active { transform: scale(0.96); }
.btn svg { width: 16px; height: 16px; }
.btn.primary {
  border: 0;
  color: #050a0c;
  background: linear-gradient(135deg, var(--btn-a), var(--btn-b));
  box-shadow: 0 10px 30px -8px color-mix(in srgb, var(--btn-b) 70%, transparent),
              inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.btn.primary:hover {
  box-shadow: 0 14px 40px -6px color-mix(in srgb, var(--btn-b) 85%, transparent),
              inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.icon-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 42px;
  height: 42px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(34, 32, 54, .8), rgba(20, 19, 34, .8));
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.25s, border-color 0.25s, transform 0.2s, opacity 0.25s;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn:disabled { opacity: 0.35; pointer-events: none; }
.icon-btn svg { width: 18px; height: 18px; }

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 7px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  background: var(--surface);
  color: var(--text-dim);
  font: inherit;
  font-size: 12px;
}

svg.i {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.btn.sm { padding: 7px 14px; font-size: 13px; }
.btn:disabled { opacity: .5; pointer-events: none; }

/* ================= 弹出面板：排行榜 / 战绩 / 改名 ================= */
.sheet-root {
  position: fixed;
  inset: 0;
  z-index: 100;
  visibility: hidden;
  pointer-events: none;
}
.sheet-root.open { visibility: visible; pointer-events: auto; }
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 3, 8, .74);
  opacity: 0;
  transition: opacity .35s;
}
.sheet-root.open .sheet-backdrop { opacity: 1; }

.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  max-height: 86vh;
  max-height: 86dvh;
  padding: 8px 20px max(16px, env(safe-area-inset-bottom));
  border: 1px solid var(--border-strong);
  border-bottom: 0;
  border-radius: 26px 26px 0 0;
  background: linear-gradient(180deg, rgba(26, 24, 44, .96), rgba(12, 12, 22, .98));
  box-shadow: 0 -30px 80px -20px rgba(124, 92, 255, .35);
  outline: none;
  transform: translateY(100%);
  transition: transform .45s cubic-bezier(.2, .9, .25, 1);
  -webkit-user-select: text;
  user-select: text;
}
.sheet-root.open .sheet { transform: none; }
.sheet-grip { width: 38px; height: 4px; margin: 0 auto 10px; border-radius: 4px; background: var(--border-strong); }

@media (min-width: 640px) {
  .sheet {
    left: 50%;
    right: auto;
    bottom: auto;
    top: 50%;
    width: 440px;
    max-height: min(680px, 86vh);
    padding: 20px 24px 18px;
    border-bottom: 1px solid var(--border-strong);
    border-radius: 26px;
    box-shadow: 0 40px 100px -20px rgba(0, 0, 0, .7), 0 0 80px -30px rgba(124, 92, 255, .5);
    transform: translate(-50%, -46%) scale(.96);
    opacity: 0;
    transition: transform .4s cubic-bezier(.2, .9, .25, 1), opacity .3s;
  }
  .sheet-root.open .sheet { transform: translate(-50%, -50%); opacity: 1; }
  .sheet-grip { display: none; }
}

.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.sheet-eyebrow { color: var(--text-faint); font-size: 11px; font-weight: 600; letter-spacing: .2em; }
.sheet-title { margin-top: 2px; font-size: 17px; font-weight: 700; }

.tabs {
  --idx: 1;
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 4px;
  margin-bottom: 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, .25);
}
.tabs[hidden] { display: none; }
.tabs button {
  position: relative;
  z-index: 1;
  height: 34px;
  border: 0;
  background: none;
  color: var(--text-dim);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: color .25s;
}
.tabs button[aria-selected="true"] { color: var(--text); }
.tab-ind {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc((100% - 8px) / 4);
  border-radius: 10px;
  background: rgba(255, 255, 255, .09);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
  transform: translateX(calc(var(--idx) * 100%));
  transition: transform .35s cubic-bezier(.3, .9, .3, 1);
}

.sheet-body {
  flex: 1;
  margin: 0 -14px -14px;
  padding: 0 14px 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  scrollbar-width: thin;
  transition: opacity .15s;
}
/* 数据加载中（还没到显示骨架的时间）：旧内容稍微变淡 */
.sheet-body.stale { opacity: .55; }
/* 已有内容之间切换时不重播入场动画，避免闪烁 */
.lb.still > *, .hist.still > * { animation: none; }
/* 弹层打开时锁住后面的页面 */
html.sheet-lock, html.sheet-lock body { overflow: hidden; overscroll-behavior: none; }
.sheet-root { overscroll-behavior: contain; }

.lb-head {
  display: flex;
  justify-content: space-between;
  padding: 2px 4px 10px;
  color: var(--text-faint);
  font-size: 12px;
}
.lb, .hist { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.lb-row {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, .03);
  animation: rowIn .45s cubic-bezier(.2, .8, .2, 1) both;
  animation-delay: calc(var(--i) * 30ms);
}
.lb-row.me {
  border-color: rgba(52, 211, 153, .4);
  background: linear-gradient(90deg, rgba(52, 211, 153, .14), rgba(34, 211, 238, .05));
}
.lb-rank {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.lb-rank.m1 { color: #3a2400; background: linear-gradient(135deg, #fde68a, #f59e0b); box-shadow: 0 0 16px rgba(251, 191, 36, .5); }
.lb-rank.m2 { color: #1e2430; background: linear-gradient(135deg, #f1f5f9, #94a3b8); }
.lb-rank.m3 { color: #2e1404; background: linear-gradient(135deg, #fdba74, #c2410c); }
.lb-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar.sm { width: 30px; height: 30px; }
.lb-name { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 14px; }
.lb-name em {
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(52, 211, 153, .18);
  color: #34d399;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
  vertical-align: 1px;
}
.lb-score { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.lb-gap { text-align: center; color: var(--text-faint); letter-spacing: .3em; }

.lb-row.skel span { height: 12px; border-radius: 6px; background: rgba(255, 255, 255, .06); animation: skel 1.2s ease-in-out infinite; }
.lb-row.skel span:first-child { width: 28px; height: 28px; border-radius: 50%; }
.lb-row.skel span:nth-child(2) { width: 50%; }
.lb-row.skel span:last-child { width: 40px; }
@keyframes skel { 50% { opacity: .4; } }
@keyframes rowIn { from { opacity: 0; transform: translateY(8px); } }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 18px; }
.stats div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .03);
}
.stats b { font-size: 19px; font-variant-numeric: tabular-nums; }
.stats span { color: var(--text-dim); font-size: 12px; }

.hist li {
  display: grid;
  grid-template-columns: 70px 1fr auto;
  align-items: baseline;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .03);
  animation: rowIn .45s cubic-bezier(.2, .8, .2, 1) both;
  animation-delay: calc(var(--i) * 30ms);
}
.hist-score { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hist-meta, .hist-time { color: var(--text-dim); font-size: 12px; }

.empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 36px 12px; text-align: center; }
.empty-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 8px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .04);
  color: var(--text-dim);
}
.empty-icon svg { width: 24px; height: 24px; }
.empty-title { font-size: 15px; font-weight: 700; }
.empty-text { max-width: 300px; color: var(--text-dim); font-size: 13px; line-height: 1.7; }
.empty .btn { margin-top: 12px; }

.sheet-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.sheet-foot[hidden] { display: none; }
.foot-note { color: var(--text-faint); font-size: 13px; }
.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #34d399, #7c5cff);
  color: #fff;
  font-weight: 700;
}
/* 像素头像：圆角方块 + 渐变底 + 顶部高光 */
.avatar.px {
  position: relative;
  border-radius: 30%;
  background:
    radial-gradient(120% 80% at 30% 0%, rgba(255, 255, 255, .28), transparent 55%),
    linear-gradient(150deg, var(--av1), var(--av2));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16), inset 0 -2px 0 rgba(0, 0, 0, .18);
  overflow: hidden;
}
.avatar.px svg { width: 84%; height: 84%; display: block; }
.foot-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.foot-name b { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 14px; }
.foot-name small { color: var(--text-faint); font-size: 12px; }

.sheet-heading { flex: 1; min-width: 0; }
.sheet-back[hidden] { display: none; }

.foot-me {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

/* ---------- 表单：登录 / 改名 ---------- */
.auth-form { display: flex; flex-direction: column; gap: 10px; padding: 2px 0 8px; }
.form-lead { margin-bottom: 4px; color: var(--text-dim); font-size: 14px; line-height: 1.7; }
.field {
  display: flex;
  align-items: center;
  height: 48px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: rgba(0, 0, 0, .3);
  transition: border-color .2s, box-shadow .2s;
}
.sheet[data-view="tabs"] .sheet-body { min-height: 220px; }
.field:focus-within, .field-input:focus {
  border-color: rgba(52, 211, 153, .55);
  background: rgba(0, 0, 0, .4);
  box-shadow: 0 10px 30px -12px rgba(52, 211, 153, .55);
}
.field input, .field-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 16px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  letter-spacing: .04em;
  outline: none;
}
.field-input {
  height: 48px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: rgba(0, 0, 0, .3);
  transition: border-color .2s, box-shadow .2s;
}
.field input::placeholder, .field-input::placeholder { color: var(--text-faint); letter-spacing: 0; }
.field-prefix {
  padding: 0 4px 0 16px;
  color: var(--text-dim);
  font-size: 15px;
  font-weight: 600;
}
.field-prefix + input { padding-left: 8px; }
.code-btn {
  flex: none;
  height: 36px;
  margin-right: 8px;
  padding: 0 14px;
  border-radius: 10px;
  border: 0;
  background: rgba(52, 211, 153, .14);
  color: #34d399;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background .2s, opacity .2s;
}
.code-btn:hover { background: rgba(52, 211, 153, .22); }
.code-btn:disabled { opacity: .45; cursor: default; }
.btn.block { width: 100%; height: 46px; }
.form-hint { color: var(--text-faint); font-size: 12px; line-height: 1.6; }
.form-hint.center { text-align: center; }
.dev-hint { color: #fbbf24; }
.form-err { color: #fb7185; font-size: 13px; }
.form-err:empty { display: none; }
.form-btns { display: flex; gap: 10px; justify-content: flex-end; }
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 6px 0;
  color: var(--text-faint);
  font-size: 12px;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- 账号 ---------- */
.acct { display: flex; flex-direction: column; gap: 16px; padding-bottom: 6px; }
.acct-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at 0% 0%, rgba(124, 92, 255, .18), transparent 60%),
    rgba(255, 255, 255, .03);
}
.avatar.lg { width: 52px; height: 52px; font-size: 20px; box-shadow: 0 8px 24px -6px rgba(124, 92, 255, .6); }
.acct-av { position: relative; flex: none; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 30%; }
.acct-av i {
  position: absolute;
  right: -5px;
  bottom: -5px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #17162a;
  background: #fff;
  color: #1c1631;
}
.acct-av i svg { width: 11px; height: 11px; }
.acct-who { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.acct-who b { max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 17px; }
.acct-badge {
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(52, 211, 153, .14);
  color: #34d399;
  font-size: 12px;
  font-weight: 600;
}
.acct-badge.guest { background: rgba(255, 255, 255, .08); color: var(--text-dim); }
.acct-callout {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(251, 191, 36, .25);
  background: linear-gradient(135deg, rgba(251, 191, 36, .09), rgba(251, 191, 36, .02));
}
.acct-callout > b { color: #fcd34d; font-size: 14px; }
.acct-callout > p { color: var(--text-dim); font-size: 13px; line-height: 1.6; }
.acct-callout .btn { margin-top: 6px; }
.acct-callout > small { color: var(--text-faint); font-size: 12px; line-height: 1.6; text-align: center; }

.acct-games { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.acct-games li {
  display: grid;
  grid-template-columns: 1fr auto 56px;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .03);
}
.acct-game { font-size: 14px; font-weight: 600; }
/* 成绩占位行：灰条垂直居中，行高与真实行一致 */
.acct-games .sk { display: inline-block; height: 12px; border-radius: 6px; background: rgba(255, 255, 255, .07); vertical-align: -1px; }
.acct-games.shimmer .sk { animation: skel 1.2s ease-in-out infinite; }
.acct-games.fresh li { animation: fadeIn .3s ease-out both; }
@keyframes fadeIn { from { opacity: .3; } }
.acct-best { color: var(--text-dim); font-size: 13px; }
.acct-best b { color: var(--text); font-size: 14px; font-variant-numeric: tabular-nums; }
.acct-best em { color: var(--text-faint); font-style: normal; }
.acct-rank { color: #34d399; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

.acct-list {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .03);
}
.acct-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 16px;
  border: 0;
  border-top: 1px solid var(--border);
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background .2s;
}
.acct-row:first-child { border-top: 0; }
.acct-row:hover { background: rgba(255, 255, 255, .04); }
.acct-row > svg { width: 18px; height: 18px; flex: none; color: var(--text-dim); }
.acct-row span { flex: 1; display: flex; flex-direction: column; }
.acct-row small { color: var(--text-faint); font-size: 12px; }
.acct-row.accent, .acct-row.accent > svg:first-child { color: #34d399; }
.acct-row.danger, .acct-row.danger > svg { color: #fb7185; }

/* ---------- 轻提示 ---------- */
.arcade-toast {
  position: fixed;
  left: 50%;
  top: calc(max(16px, env(safe-area-inset-top)) + 56px);
  z-index: 200;
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: rgba(20, 20, 34, .96);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 12px 40px -10px rgba(0, 0, 0, .6);
  transform: translate(-50%, -20px);
  opacity: 0;
  transition: transform .4s cubic-bezier(.2, .9, .3, 1.2), opacity .3s;
  pointer-events: none;
}
.arcade-toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ---------- 设置昵称 ---------- */
.name-form { display: flex; flex-direction: column; gap: 14px; padding: 2px 0 6px; }
.name-preview {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 22px 16px 18px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at 50% 0%, rgba(124, 92, 255, .22), transparent 65%),
    radial-gradient(circle at 50% 120%, rgba(52, 211, 153, .12), transparent 60%),
    rgba(255, 255, 255, .02);
  overflow: hidden;
}
.avatar.xl {
  width: 64px;
  height: 64px;
  margin-bottom: 6px;
  font-size: 26px;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .06), 0 14px 40px -10px rgba(124, 92, 255, .8);
}
.avatar.px.lg { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16), inset 0 -2px 0 rgba(0, 0, 0, .18), 0 8px 24px -6px var(--av2); }
.avatar.px.xl {
  width: 72px;
  height: 72px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2), inset 0 -3px 0 rgba(0, 0, 0, .18),
    0 0 0 4px rgba(255, 255, 255, .06), 0 14px 40px -8px var(--av2);
}
.avatar.pop { animation: avatarPop .4s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes avatarPop { 40% { transform: scale(1.14); } }
/* 头像选择 */
.name-av { display: grid; place-items: center; }
.name-av .avatar.xl { margin-bottom: 6px; }
.av-pick {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
}
.av-opt {
  position: relative;
  padding: 3px;
  border: 0;
  border-radius: 32%;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .15s;
}
.av-opt .avatar { width: 100%; height: auto; aspect-ratio: 1; opacity: .6; transition: opacity .2s, transform .2s; }
.av-opt:hover .avatar { opacity: .9; }
.av-opt:active { transform: scale(.92); }
.av-opt[aria-checked="true"] { box-shadow: 0 0 0 2px #fff, 0 0 18px -2px rgba(255, 255, 255, .5); }
.av-opt[aria-checked="true"] .avatar { opacity: 1; transform: scale(1.04); }
.av-opt.locked .avatar { opacity: .3; filter: grayscale(.85); }
.av-lock {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  pointer-events: none;
}
.av-lock svg { width: 40%; height: 40%; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .6)); }
.name-preview-text {
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 17px;
  font-weight: 700;
}
.name-preview small { color: var(--text-faint); font-size: 12px; }
.name-count { flex: none; padding-right: 16px; color: var(--text-faint); font-size: 13px; font-variant-numeric: tabular-nums; }
.name-count.full i { color: #fbbf24; font-style: normal; }
.name-count i { font-style: normal; }
.field.shake { animation: fieldShake .4s; }
@keyframes fieldShake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.name-suggest { display: flex; align-items: center; gap: 8px; }
.name-suggest > span { flex: none; color: var(--text-faint); font-size: 12px; }
.chips {
  display: flex;
  flex: 1;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  touch-action: pan-x;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .04);
  color: var(--text-dim);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color .2s, color .2s, background .2s;
  animation: rowIn .35s cubic-bezier(.2, .8, .2, 1) both;
}
.chip:nth-child(2) { animation-delay: 40ms; }
.chip:nth-child(3) { animation-delay: 80ms; }
.chip:hover { border-color: rgba(52, 211, 153, .45); background: rgba(52, 211, 153, .08); color: var(--text); }
.dice {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .04);
  color: var(--text-dim);
  cursor: pointer;
  transition: color .2s, border-color .2s;
}
.dice:hover { color: var(--text); border-color: var(--border-strong); }
.dice svg { width: 16px; height: 16px; }
.dice.roll svg { animation: diceRoll .5s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes diceRoll { from { transform: rotate(-200deg) scale(.6); } }

.btn-text {
  align-self: center;
  margin-top: -4px;
  padding: 6px 12px;
  border: 0;
  background: none;
  color: var(--text-faint);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: color .2s;
}
.btn-text:hover { color: var(--text-dim); }

/* 面板里的主按钮光晕收敛一些，避免被滚动区域裁出硬边 */
.sheet .btn.primary { box-shadow: 0 8px 22px -12px color-mix(in srgb, var(--btn-b) 80%, transparent), inset 0 1px 0 rgba(255, 255, 255, .45); }

/* =====================================================================
   游戏风格：弹出面板（排行榜 / 登录 / 账号）+ 立体按钮
   主题色：游戏页用该游戏的 --game-a / --game-b，首页用默认的紫青
   ===================================================================== */
.sheet, .panel {
  --ga: var(--game-a, #a78bfa);
  --gb: var(--game-b, #22d3ee);
}

/* ---- 立体按钮：底部有一道"厚度"，按下时整个按钮沉下去 ---- */
.panel .btn, .sheet .btn {
  height: 48px;
  padding: 0 20px;
  border-radius: 16px;
  font-weight: 700;
  letter-spacing: .02em;
  transition: transform .08s ease-out, box-shadow .08s ease-out, filter .15s;
}
.panel .btn:not(.primary), .sheet .btn:not(.primary):not(.btn-text) {
  border: 1px solid rgba(255, 255, 255, .1);
  background: linear-gradient(180deg, #2b2942, #1b1a2c);
  color: var(--text);
  box-shadow: 0 4px 0 #0a0912, 0 10px 18px -10px rgba(0, 0, 0, .8), inset 0 1px 0 rgba(255, 255, 255, .08);
}
.panel .btn.primary, .sheet .btn.primary {
  border: 0;
  color: #0b0a16;
  background: linear-gradient(180deg, color-mix(in srgb, var(--btn-a) 82%, #fff), var(--btn-b));
  box-shadow: 0 5px 0 color-mix(in srgb, var(--btn-b) 45%, #000), 0 14px 26px -10px color-mix(in srgb, var(--btn-b) 75%, transparent), inset 0 1px 0 rgba(255, 255, 255, .55);
}
.panel .btn:hover, .sheet .btn:hover { transform: translateY(-1px); filter: brightness(1.08); }
.panel .btn:active, .sheet .btn:active { transform: translateY(4px); transition-duration: .03s; }
.panel .btn:not(.primary):active, .sheet .btn:not(.primary):not(.btn-text):active {
  box-shadow: 0 0 0 #0a0912, 0 4px 10px -6px rgba(0, 0, 0, .8), inset 0 1px 0 rgba(255, 255, 255, .08);
}
.panel .btn.primary:active, .sheet .btn.primary:active {
  box-shadow: 0 1px 0 color-mix(in srgb, var(--btn-b) 45%, #000), 0 6px 14px -8px color-mix(in srgb, var(--btn-b) 75%, transparent), inset 0 1px 0 rgba(255, 255, 255, .55);
}

/* ---- 面板外观：渐变描边 + 顶部高光 ---- */
.sheet {
  border: 1.5px solid transparent;
  border-bottom: 0;
  background:
    linear-gradient(180deg, #1c1a31, #0e0e1a 60%) padding-box,
    linear-gradient(180deg, color-mix(in srgb, var(--ga) 70%, transparent), rgba(255, 255, 255, .06) 40%, rgba(255, 255, 255, .04)) border-box;
  box-shadow: 0 -24px 60px -24px color-mix(in srgb, var(--ga) 55%, transparent);
}
@media (min-width: 640px) {
  .sheet { border-bottom: 1.5px solid transparent; box-shadow: 0 40px 100px -20px rgba(0, 0, 0, .75), 0 0 70px -24px color-mix(in srgb, var(--ga) 60%, transparent); }
}
.sheet-eyebrow {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--ga) 35%, transparent);
  background: color-mix(in srgb, var(--ga) 12%, transparent);
  color: var(--ga);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .2em;
}
.sheet-eyebrow:empty { display: none; }
.sheet-title { margin-top: 0; font-size: 19px; font-weight: 800; letter-spacing: .01em; }
/* 标签和标题放在同一行，与左右按钮垂直居中；标题太长放不下时自动换行 */
.sheet-head { align-items: center; }
.sheet-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-height: 44px; }
.sheet-eyebrow { flex: none; }
.sheet-title { min-width: 0; line-height: 1.3; }

/* ---- 标签页：凹槽 + 立体滑块 ---- */
.tabs {
  border: 1px solid rgba(255, 255, 255, .06);
  background: #0a0a14;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .6);
}
.tabs button { font-weight: 700; }
.tabs button[aria-selected="true"] { color: #0b0a16; }
.tab-ind {
  background: linear-gradient(180deg, color-mix(in srgb, var(--ga) 80%, #fff), color-mix(in srgb, var(--ga) 70%, var(--gb)));
  box-shadow: 0 3px 0 color-mix(in srgb, var(--ga) 40%, #000), inset 0 1px 0 rgba(255, 255, 255, .5);
}

/* ---- 排行榜：前三名金银铜"奖牌币"，整行带对应色调 ---- */
.lb-row {
  border: 1px solid rgba(255, 255, 255, .05);
  background: linear-gradient(180deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, .02));
}
.lb-rank {
  border-radius: 9px;
  background: rgba(255, 255, 255, .05);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .35);
  color: var(--text-dim);
}
.lb-rank.m1, .lb-rank.m2, .lb-rank.m3 { border-radius: 50%; font-weight: 800; }
.lb-rank.m1 {
  color: #3d1d00;
  background: radial-gradient(circle at 35% 30%, #fff8d6, #fcd34d 40%, #d97706 100%);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .35), 0 2px 0 #92400e, 0 0 16px rgba(251, 191, 36, .5);
}
.lb-rank.m2 {
  color: #1f2937;
  background: radial-gradient(circle at 35% 30%, #ffffff, #cbd5e1 45%, #64748b 100%);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .4), 0 2px 0 #334155, 0 0 12px rgba(203, 213, 225, .3);
}
.lb-rank.m3 {
  color: #3b1406;
  background: radial-gradient(circle at 35% 30%, #ffe1c2, #fb923c 45%, #9a3412 100%);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .3), 0 2px 0 #7c2d12, 0 0 12px rgba(251, 146, 60, .35);
}
.lb-row:has(.m1) { border-color: rgba(251, 191, 36, .28); background: linear-gradient(90deg, rgba(251, 191, 36, .13), rgba(251, 191, 36, .02)); }
.lb-row:has(.m2) { border-color: rgba(203, 213, 225, .2); background: linear-gradient(90deg, rgba(203, 213, 225, .09), rgba(203, 213, 225, .015)); }
.lb-row:has(.m3) { border-color: rgba(251, 146, 60, .2); background: linear-gradient(90deg, rgba(251, 146, 60, .1), rgba(251, 146, 60, .015)); }
.lb-row:has(.m1) .lb-score { color: #fde68a; }
.lb-score { font-size: 16px; font-weight: 800; letter-spacing: .01em; }
.lb-row.me {
  border-color: color-mix(in srgb, var(--ga) 55%, transparent);
  background: linear-gradient(90deg, color-mix(in srgb, var(--ga) 20%, transparent), color-mix(in srgb, var(--ga) 4%, transparent));
  box-shadow: 0 0 18px -6px color-mix(in srgb, var(--ga) 60%, transparent);
}
.lb-name em { background: color-mix(in srgb, var(--ga) 20%, transparent); color: var(--ga); }

/* ---- 我的战绩：计分牌 ---- */
.stats div {
  border: 1px solid rgba(255, 255, 255, .06);
  background: #0a0a14;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, .6);
}
.stats b { order: 2; font-weight: 800; text-shadow: 0 0 14px color-mix(in srgb, var(--ga) 45%, transparent); }
.stats span { order: 1; font-size: 11px; letter-spacing: .06em; }
.sheet .btn.sm { height: 38px; padding: 0 14px; border-radius: 12px; font-size: 13px; }
.sheet .btn.sm.primary { box-shadow: 0 4px 0 color-mix(in srgb, var(--btn-b) 45%, #000), inset 0 1px 0 rgba(255, 255, 255, .55); }

/* 排行榜面板固定高度：切换 今日 / 本周 / 总榜 / 我的 时面板不再忽高忽低，内容多了在面板里滚动 */
.sheet[data-view="tabs"] { height: min(600px, 82vh); height: min(600px, 82dvh); }
@media (min-width: 640px) {
  .sheet[data-view="tabs"] { height: min(620px, 86vh); }
}
.sheet[data-view="tabs"] .sheet-body { min-height: 0; }
.sheet[data-view="tabs"] .sheet-body > .empty:only-child { min-height: 100%; justify-content: center; padding-top: 0; padding-bottom: 24px; }

/* ---------- 欢迎页：选择进入方式 ---------- */
.welcome { display: flex; flex-direction: column; gap: 10px; padding: 2px 0 8px; }
.opt-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, .08);
  background: linear-gradient(180deg, #24223a, #18172a);
  box-shadow: 0 4px 0 #0a0912, inset 0 1px 0 rgba(255, 255, 255, .06);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform .08s, box-shadow .08s, border-color .2s, opacity .2s;
}
.opt-card:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 0 0 #0a0912, inset 0 1px 0 rgba(255, 255, 255, .06); }
.opt-card.primary {
  border-color: color-mix(in srgb, var(--ga) 55%, transparent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--ga) 22%, #24223a), #18172a);
  box-shadow: 0 4px 0 color-mix(in srgb, var(--ga) 30%, #000), 0 12px 28px -14px color-mix(in srgb, var(--ga) 80%, transparent), inset 0 1px 0 rgba(255, 255, 255, .1);
}
.opt-card:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.opt-card.busy { opacity: .7; }
.opt-ic {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .06);
  color: var(--text-dim);
}
.opt-card.primary .opt-ic { background: color-mix(in srgb, var(--ga) 25%, transparent); color: var(--ga); }
.opt-ic svg { width: 22px; height: 22px; }
.opt-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.opt-txt b { font-size: 16px; font-weight: 700; }
.opt-txt small { color: var(--text-dim); font-size: 12px; line-height: 1.5; }
.opt-card > svg { flex: none; width: 18px; height: 18px; color: var(--text-faint); }
.opt-soon {
  flex: none;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .07);
  color: var(--text-faint);
  font-size: 11px;
  font-style: normal;
  font-weight: 600;
}
.welcome .form-hint { margin-top: 4px; }
.empty .btn.primary { margin-top: 14px; }
