:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #1f2733;
  --text-2: #6b7686;
  --line: #e7ecf3;
  --accent: #3b82f6;
  --accent-dark: #2563eb;
  --accent-soft: #eaf1fe;
  --danger: #ef4444;
  --ok: #22c55e;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(31, 41, 55, 0.06);
  --shadow-lg: 0 10px 30px rgba(31, 41, 55, 0.12);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* ---------- 顶栏 ---------- */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.topbar-inner { display: flex; align-items: center; gap: 12px; height: 58px; }
.logo { font-size: 20px; font-weight: 800; color: var(--text); display: flex; align-items: center; gap: 8px; }
.logo .logo-ic { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, #60a5fa, #3b82f6); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 16px; }
.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a { color: var(--text-2); font-weight: 600; font-size: 14px; padding: 7px 12px; border-radius: 10px; }
.nav a:hover { background: var(--bg); text-decoration: none; }
.nav a.active { color: var(--accent); background: var(--accent-soft); }
.top-spacer { flex: 1; }

.user-area { display: flex; align-items: center; gap: 8px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; cursor: pointer; font-family: inherit;
  border-radius: 12px; padding: 9px 16px; font-size: 14px; font-weight: 600;
  background: var(--accent); color: #fff; transition: transform .05s, background .15s;
}
.btn:hover { background: var(--accent-dark); }
.btn:active { transform: scale(.97); }
.btn.ghost { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.plain { background: var(--bg); color: var(--text-2); }
.btn.plain:hover { background: var(--line); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.user-chip { display: flex; align-items: center; gap: 8px; background: var(--bg); border-radius: 999px; padding: 5px 14px 5px 6px; cursor: pointer; border: 1px solid var(--line); position: relative; }
.user-chip .avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--card); display: inline-flex; align-items: center; justify-content: center; font-size: 17px; box-shadow: var(--shadow); }
.user-chip .name { font-weight: 600; font-size: 14px; }
.user-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 150px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 6px; display: none; z-index: 60;
}
.user-menu.open { display: block; }
.user-menu a, .user-menu button {
  display: block; width: 100%; text-align: left; padding: 9px 12px; font-size: 14px;
  color: var(--text); background: none; border: none; cursor: pointer; border-radius: 8px; font-family: inherit;
}
.user-menu a:hover, .user-menu button:hover { background: var(--bg); text-decoration: none; }

/* ---------- 首页 ---------- */
.hero { padding: 34px 0 10px; text-align: center; }
.hero h1 { font-size: 30px; font-weight: 800; }
.hero p { color: var(--text-2); margin-top: 8px; font-size: 15px; }

.controls { display: flex; align-items: center; gap: 10px; margin: 22px 0 6px; flex-wrap: wrap; }
.cats { display: flex; gap: 8px; flex-wrap: wrap; }
.cat {
  border: 1.5px solid var(--line); background: var(--card); color: var(--text-2);
  padding: 8px 15px; border-radius: 999px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.cat:hover { border-color: var(--accent); color: var(--accent); }
.cat.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.search {
  margin-left: auto; display: flex; align-items: center; gap: 6px;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 999px; padding: 8px 16px;
}
.search input { border: none; outline: none; font-size: 14px; font-family: inherit; width: 170px; background: none; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; padding: 16px 0 60px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; cursor: pointer; transition: transform .12s, box-shadow .12s; position: relative;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.card .top { display: flex; align-items: center; gap: 12px; }
.card .g-icon { width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 28px; background: var(--accent-soft); }
.card h3 { font-size: 17px; margin-top: 12px; }
.card p { color: var(--text-2); font-size: 13.5px; margin-top: 5px; line-height: 1.5; min-height: 40px; }
.card .foot { display: flex; align-items: center; margin-top: 14px; gap: 8px; font-size: 12.5px; color: var(--text-2); }
.chip { border-radius: 999px; padding: 3px 10px; font-weight: 600; font-size: 12px; }
.chip.reaction { background: #fff1e6; color: #c2410c; }
.chip.relax { background: #e7f8ec; color: #15803d; }
.chip.challenge { background: var(--accent-soft); color: var(--accent-dark); }
.chip.puzzle { background: #f1e9ff; color: #6d28d9; }
.best { margin-left: auto; font-weight: 700; color: var(--text); }
.fav { position: absolute; top: 14px; right: 14px; font-size: 19px; cursor: pointer; user-select: none; opacity: .9; }
.fav:hover { transform: scale(1.15); }

.empty { text-align: center; color: var(--text-2); padding: 60px 0; }

/* ---------- 表单页 ---------- */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 58px); padding: 20px; }
.auth-card { background: var(--card); border-radius: 20px; box-shadow: var(--shadow-lg); padding: 34px; width: 100%; max-width: 380px; }
.auth-card h1 { font-size: 22px; margin-bottom: 6px; }
.auth-card .sub { color: var(--text-2); font-size: 13.5px; margin-bottom: 22px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text-2); }
.field input {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--line); border-radius: 12px;
  font-size: 15px; font-family: inherit; outline: none; background: var(--bg);
}
.field input:focus { border-color: var(--accent); background: #fff; }
.form-msg { font-size: 13px; margin-top: 4px; }
.form-msg.err { color: var(--danger); }
.form-msg.ok { color: var(--ok); }
.auth-card .btn { width: 100%; margin-top: 6px; }
.auth-foot { margin-top: 16px; text-align: center; font-size: 14px; color: var(--text-2); }

/* ---------- 页面通用 ---------- */
.page-title { font-size: 22px; font-weight: 800; margin: 26px 0 4px; }
.page-sub { color: var(--text-2); font-size: 14px; margin-bottom: 18px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.sec-title { font-size: 16px; font-weight: 700; margin: 24px 0 12px; }

/* 排行榜 */
.lb-table { width: 100%; border-collapse: collapse; }
.lb-table th, .lb-table td { padding: 10px 12px; text-align: left; font-size: 14px; border-bottom: 1px solid var(--line); }
.lb-table th { color: var(--text-2); font-weight: 600; font-size: 13px; }
.lb-table tr.me { background: var(--accent-soft); }
.rank-badge { display: inline-flex; width: 26px; height: 26px; border-radius: 50%; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; background: var(--bg); color: var(--text-2); }
.rank-badge.r1 { background: #fde68a; color: #92400e; }
.rank-badge.r2 { background: #e5e7eb; color: #374151; }
.rank-badge.r3 { background: #fed7aa; color: #9a3412; }

/* 成就 */
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; padding-bottom: 40px; }
.ach { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; gap: 12px; align-items: flex-start; }
.ach .a-ic { font-size: 26px; }
.ach h4 { font-size: 14.5px; }
.ach p { font-size: 12.5px; color: var(--text-2); margin-top: 4px; line-height: 1.5; }
.ach.locked { opacity: .55; filter: grayscale(.7); }
.ach .a-time { font-size: 11.5px; color: var(--ok); margin-top: 6px; font-weight: 600; }

/* 个人中心 */
.profile-head { display: flex; gap: 18px; align-items: center; }
.big-avatar { width: 72px; height: 72px; border-radius: 50%; background: var(--accent-soft); font-size: 38px; display: flex; align-items: center; justify-content: center; }
.stat-row { display: flex; gap: 24px; margin-top: 16px; flex-wrap: wrap; }
.stat { text-align: center; }
.stat b { display: block; font-size: 22px; }
.stat span { font-size: 12.5px; color: var(--text-2); }

/* toast */
#toast-root { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: #1f2733; color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg);
  animation: toast-in .18s ease-out;
}
.toast.success { background: #15803d; }
.toast.warn { background: #b45309; }

@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- 游戏页 ---------- */
.game-page { display: flex; flex-direction: column; height: 100vh; }
.game-top { background: var(--card); border-bottom: 1px solid var(--line); padding: 10px 16px; display: flex; align-items: center; gap: 12px; z-index: 60; }
.game-top .g-name { font-weight: 700; font-size: 16px; }
.game-top .g-ctrl { color: var(--text-2); font-size: 12.5px; }
.game-area-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 14px; overflow: hidden; }
#game-area { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; position: relative; }

#end-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .55); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center; z-index: 120; padding: 16px;
}
#end-overlay.show { display: flex; }
.end-card { background: var(--card); border-radius: 22px; padding: 30px 34px; width: 100%; max-width: 380px; text-align: center; box-shadow: var(--shadow-lg); animation: toast-in .18s ease-out; }
.end-card h2 { font-size: 24px; }
.end-score { font-size: 44px; font-weight: 800; color: var(--accent); margin: 12px 0 4px; }
.end-unit { color: var(--text-2); font-size: 14px; margin-bottom: 16px; }
.end-meta { display: flex; justify-content: center; gap: 26px; margin-bottom: 18px; }
.end-meta .m b { display: block; font-size: 17px; }
.end-meta .m span { font-size: 12.5px; color: var(--text-2); }
.end-ach { background: #fef9c3; border: 1px solid #fde047; color: #713f12; border-radius: 12px; padding: 10px 14px; margin-bottom: 16px; font-size: 13.5px; font-weight: 600; }
.end-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.end-btns .btn { min-width: 110px; }

#ach-pop-root { position: fixed; right: 18px; top: 70px; z-index: 150; display: flex; flex-direction: column; gap: 10px; }
.ach-pop { background: var(--card); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 12px 16px; display: flex; gap: 10px; align-items: center; border-left: 4px solid #f59e0b; animation: toast-in .2s ease-out; }
.ach-pop .a-ic { font-size: 22px; }
.ach-pop b { font-size: 14px; display: block; }
.ach-pop span { font-size: 12px; color: var(--text-2); }

@media (max-width: 640px) {
  .hero h1 { font-size: 24px; }
  .search { margin-left: 0; width: 100%; }
  .search input { width: 100%; }
  .end-score { font-size: 38px; }
}


/* 对战邀请卡片 */
#invite-root { position: fixed; left: 0; right: 0; bottom: 14px; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 300; padding: 0 14px; pointer-events: none; }
.invite-card { pointer-events: auto; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 8px 24px rgba(15,23,42,.18); padding: 10px 14px; display: flex; align-items: center; gap: 12px; width: min(420px, 100%); animation: slide-up .25s ease-out; }
@keyframes slide-up { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.invite-card .ic-msg { flex: 1; font-size: 13.5px; }
.invite-card .ic-btns { display: flex; gap: 8px; }


/* 好友列表 */
.friend-search { display: flex; gap: 8px; margin-bottom: 10px; }
.friend-search input { flex: 1; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); font-size: 14px; }
.fr-row { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--line); }
.fr-row:last-child { border-bottom: none; }
.fr-row .avatar { font-size: 22px; }
.fr-row .name { flex: 1; font-weight: 600; font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-row .fr-id { color: var(--text-2); font-weight: 400; font-size: 12px; }
.fr-row .fr-dot { width: 9px; height: 9px; border-radius: 50%; background: #cbd5e1; }
.fr-row .fr-dot.on { background: #22c55e; box-shadow: 0 0 6px rgba(34,197,94,.6); }
#fr-requests .fr-row { background: #fff7ed; border-radius: 10px; padding: 9px 10px; margin-bottom: 6px; border-bottom: none; }

/* ============================================================
   UI 升级（v2）— 覆盖上面的旧样式，增强视觉与交互
   ============================================================ */
:root {
  --grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 45%, #ec4899 100%);
  --grad-soft: linear-gradient(135deg, #eef2ff, #fdf2f8);
  --accent-2: #8b5cf6;
  --ring: rgba(99, 102, 241, .35);
}

body { background: #f4f6fb; }

/* ---------- 顶栏 ---------- */
.topbar { background: rgba(255,255,255,.82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid rgba(231,236,243,.8); }
.logo { gap: 9px; letter-spacing: -.2px; }
.logo .logo-ic { background: var(--grad); box-shadow: 0 4px 12px rgba(139,92,246,.35); }
.nav a { position: relative; }
.nav a.active::after { content: ""; position: absolute; left: 50%; bottom: 3px; width: 16px; height: 3px; border-radius: 99px; background: var(--grad); transform: translateX(-50%); }

/* ---------- 首页 Hero ---------- */
.hero { position: relative; overflow: hidden; border-radius: 24px; margin: 18px 0 4px; padding: 34px 20px 26px; text-align: center; background: linear-gradient(135deg, #4338ca 0%, #7c3aed 48%, #db2777 100%); box-shadow: 0 12px 32px rgba(109, 40, 217, .28); }
.hero h1 { font-size: 28px; font-weight: 900; color: #fff; letter-spacing: .5px; text-shadow: 0 2px 10px rgba(0,0,0,.18); }
.hero p { color: rgba(255,255,255,.85); margin-top: 8px; font-size: 14.5px; font-weight: 500; }
.hero-bg { position: absolute; inset: 0; pointer-events: none; }
.bub { position: absolute; font-size: 30px; opacity: .9; filter: drop-shadow(0 4px 8px rgba(0,0,0,.18)); animation: bub-float 5s ease-in-out infinite; }
.b1 { left: 8%; top: 22%; font-size: 26px; }
.b2 { right: 10%; top: 16%; font-size: 32px; animation-delay: .7s; }
.b3 { left: 14%; bottom: 18%; font-size: 34px; animation-delay: 1.3s; }
.b4 { right: 16%; bottom: 20%; font-size: 26px; animation-delay: 2s; }
.b5 { left: 46%; top: -6px; font-size: 24px; animation-delay: 2.6s; }
.b6 { right: 38%; bottom: -4px; font-size: 28px; animation-delay: 1.9s; }
@keyframes bub-float { 0%,100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-12px) rotate(8deg); } }
.hero-inner { position: relative; z-index: 1; }
.hero-stats { display: flex; justify-content: center; gap: 12px; margin-top: 18px; }
.hs { flex: 1; max-width: 118px; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22); border-radius: 16px; padding: 10px 6px 8px; backdrop-filter: blur(4px); }
.hs b { display: block; font-size: 21px; font-weight: 900; color: #fff; }
.hs span { font-size: 12px; color: rgba(255,255,255,.8); }

/* ---------- 分类 Tab ---------- */
.controls { margin: 20px 0 4px; }
.cats { gap: 8px; }
.cat { display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid var(--line); background: #fff; color: var(--text-2); padding: 8px 13px; border-radius: 999px; font-size: 13.5px; font-weight: 700; cursor: pointer; transition: transform .12s, box-shadow .15s, background .15s, color .15s, border-color .15s; }
.cat:hover { transform: translateY(-1px); border-color: var(--accent-2); color: var(--accent-2); box-shadow: 0 4px 12px rgba(139,92,246,.16); }
.cat:active { transform: scale(.94); }
.cat.active { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 6px 16px var(--ring); }
.cat-ic { font-size: 15px; }
.cat-n { font-size: 11px; font-weight: 800; background: rgba(31,41,55,.08); border-radius: 99px; padding: 1px 7px; }
.cat.active .cat-n { background: rgba(255,255,255,.24); }
.search { background: #fff; border: 1.5px solid var(--line); border-radius: 999px; padding: 9px 16px; transition: border-color .15s, box-shadow .15s; }
.search:focus-within { border-color: var(--accent-2); box-shadow: 0 0 0 4px rgba(139,92,246,.12); }
.search input { width: 150px; font-weight: 500; }

/* ---------- 游戏卡片 ---------- */
.grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; padding: 14px 0 40px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 16px 16px 14px; cursor: pointer; transition: transform .16s cubic-bezier(.2,.8,.3,1.2), box-shadow .16s, border-color .16s; position: relative; overflow: hidden; animation: card-in .38s cubic-bezier(.2,.8,.3,1.1) both; }
@keyframes card-in { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
.card:hover { transform: translateY(-4px); box-shadow: 0 14px 30px rgba(31,41,55,.13); border-color: rgba(139,92,246,.4); }
.card:active { transform: scale(.97); }
.card-top { display: flex; align-items: center; gap: 12px; }
.g-icon { width: 50px; height: 50px; border-radius: 15px; display: flex; align-items: center; justify-content: center; font-size: 26px; background: var(--grad-soft); box-shadow: inset 0 0 0 1px rgba(139,92,246,.12); transition: transform .18s; }
.card:nth-child(6n+1) .g-icon { background: linear-gradient(135deg,#eef2ff,#e0e7ff); }
.card:nth-child(6n+2) .g-icon { background: linear-gradient(135deg,#fdf2f8,#fce7f3); }
.card:nth-child(6n+3) .g-icon { background: linear-gradient(135deg,#ecfdf5,#d1fae5); }
.card:nth-child(6n+4) .g-icon { background: linear-gradient(135deg,#fffbeb,#fef3c7); }
.card:nth-child(6n+5) .g-icon { background: linear-gradient(135deg,#f0f9ff,#e0f2fe); }
.card:nth-child(6n+6) .g-icon { background: linear-gradient(135deg,#faf5ff,#f3e8ff); }
.card:hover .g-icon { transform: scale(1.12) rotate(-6deg); }
.card h3 { font-size: 16px; margin-top: 12px; font-weight: 800; letter-spacing: -.2px; }
.card p { color: var(--text-2); font-size: 12.5px; margin-top: 5px; line-height: 1.5; min-height: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .foot { margin-top: 12px; font-size: 12px; color: var(--text-2); }
.card .best b { color: var(--accent-2); }
.card .go { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 12px; padding: 8px 0; border-radius: 11px; background: var(--grad-soft); color: var(--accent-2); font-size: 13px; font-weight: 800; transition: background .15s, color .15s, transform .15s; }
.card .go-arr { transition: transform .15s; }
.card:hover .go { background: var(--grad); color: #fff; box-shadow: 0 6px 14px var(--ring); }
.card:hover .go-arr { transform: translateX(4px); }
.fav { top: 12px; right: 12px; font-size: 17px; opacity: .85; transition: transform .12s, opacity .12s; }
.fav:hover { transform: scale(1.2); opacity: 1; }

/* ---------- 骨架屏 ---------- */
.skeleton .card { animation: none; cursor: default; }
.sk-line { border-radius: 8px; background: linear-gradient(90deg,#eef1f6 25%,#e2e7ef 50%,#eef1f6 75%); background-size: 200% 100%; animation: sk-shimmer 1.3s infinite; }
.sk-ic { width: 50px; height: 50px; border-radius: 15px; }
.sk-t1 { height: 15px; width: 62%; margin-top: 14px; }
.sk-t2 { height: 12px; width: 92%; margin-top: 9px; }
.sk-t3 { height: 12px; width: 70%; margin-top: 7px; }
@keyframes sk-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------- 空状态 ---------- */
.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; color: var(--text-2); padding: 60px 0; }
.empty-ic { font-size: 46px; opacity: .7; }
.empty p { font-size: 14.5px; font-weight: 600; }
.empty .btn { margin-top: 4px; }

/* ---------- 页脚 ---------- */
.footer { border-top: 1px solid var(--line); background: #fff; padding: 18px 0 26px; margin-top: 8px; }
.footer-inner { display: flex; flex-direction: column; gap: 4px; align-items: center; color: var(--text-2); font-size: 12.5px; }
.footer-inner span:first-child { font-weight: 700; color: var(--text); }

/* ---------- 登录/注册 ---------- */
.auth-page { background: linear-gradient(180deg, #eef2ff 0%, #f4f6fb 46%); }
.auth-card { position: relative; border-radius: 22px; box-shadow: 0 18px 44px rgba(31,41,55,.14); overflow: hidden; border: 1px solid var(--line); }
.auth-card::before { content: ""; display: block; height: 5px; background: var(--grad); }
.auth-card h1 { font-size: 24px; font-weight: 900; }
.auth-card .sub { font-size: 13.5px; }
.auth-card .field input { transition: border-color .15s, box-shadow .15s; }
.auth-card .field input:focus { box-shadow: 0 0 0 4px rgba(139,92,246,.12); }
.auth-card .btn { background: var(--grad); box-shadow: 0 8px 18px var(--ring); }
.auth-card .btn:hover { filter: brightness(1.06); background: var(--grad); }

/* ---------- 游戏页 ---------- */
.game-page { background: #eef1f7; }
.game-top { background: rgba(255,255,255,.86); backdrop-filter: blur(14px); padding: 9px 14px; gap: 10px; }
.game-top .g-name { font-weight: 800; font-size: 16px; }
.game-top .g-ctrl { background: var(--bg); border-radius: 99px; padding: 3px 9px; font-size: 11.5px; }
#back-btn, #fav-btn { border-radius: 11px; font-size: 15px; }
#back-btn:hover, #fav-btn:hover { transform: translateX(-2px); background: var(--line); }
#fav-btn:hover { transform: scale(1.12); }

/* 游戏加载中 */
#game-loading { position: absolute; inset: 0; z-index: 90; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: #eef1f7; border-radius: 18px; color: var(--text-2); font-size: 13.5px; font-weight: 600; transition: opacity .25s; }
#game-loading.done { opacity: 0; pointer-events: none; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3.5px solid rgba(139,92,246,.18); border-top-color: #8b5cf6; animation: spin .7s linear infinite; }
.spinner-lg { width: 46px; height: 46px; border-width: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }
#game-loading .gl-err { color: var(--danger); font-size: 13.5px; max-width: 260px; text-align: center; line-height: 1.6; }

/* 结算面板 */
#end-overlay { background: rgba(15,23,42,.58); backdrop-filter: blur(6px); }
.end-card { border-radius: 26px; padding: 30px 28px; border: 1px solid rgba(255,255,255,.6); box-shadow: 0 24px 60px rgba(15,23,42,.35); animation: end-in .34s cubic-bezier(.2,.9,.3,1.2); }
@keyframes end-in { 0% { opacity: 0; transform: scale(.82) translateY(18px); } 60% { transform: scale(1.03) translateY(-2px); } 100% { opacity: 1; transform: scale(1) translateY(0); } }
.end-card h2 { font-size: 26px; }
.end-score { font-size: 50px; font-weight: 900; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.end-meta .m b { font-size: 18px; color: var(--text); }
.end-ach { background: linear-gradient(135deg,#fef9c3,#fef3c7); border: 1px solid #fde047; }
.end-btns .btn { border-radius: 14px; }
#again-btn { background: var(--grad); box-shadow: 0 8px 18px var(--ring); }
#again-btn:hover { filter: brightness(1.06); }

/* 成就弹窗 */
.ach-pop { border-radius: 16px; border-left: 4px solid #f59e0b; box-shadow: 0 14px 30px rgba(31,41,55,.16); animation: ach-in .4s cubic-bezier(.2,.9,.3,1.3); }
@keyframes ach-in { 0% { opacity: 0; transform: translateX(60px) scale(.8); } 100% { opacity: 1; transform: translateX(0) scale(1); } }

/* toast 加图标 */
.toast { border-radius: 14px; box-shadow: 0 10px 26px rgba(15,23,42,.18); }

/* ---------- 其他页面 ---------- */
.page-title { font-size: 23px; font-weight: 900; }
.panel { border-radius: 18px; box-shadow: 0 6px 18px rgba(31,41,55,.05); }
.lb-table tr { transition: background .12s; }
.lb-table tbody tr:hover { background: #f8fafc; }
.lb-table tr.me { background: linear-gradient(90deg,#eef2ff,#f5f3ff); }
.rank-badge.r1 { background: linear-gradient(135deg,#fde68a,#fcd34d); box-shadow: 0 2px 8px rgba(217,119,6,.3); }
.ach { transition: transform .12s, box-shadow .12s; }
.ach:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(31,41,55,.09); }
.ach.locked { opacity: .5; filter: grayscale(.75); }

/* ---------- 手机适配 ---------- */
@media (max-width: 640px) {
  .hero { margin: 12px 0 2px; padding: 28px 14px 22px; border-radius: 20px; }
  .hero h1 { font-size: 23px; }
  .hero p { font-size: 13px; }
  .hs b { font-size: 18px; }
  .hs span { font-size: 11px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 11px; padding: 12px 0 34px; }
  .card { padding: 13px 13px 11px; border-radius: 15px; }
  .card-top { gap: 9px; }
  .g-icon { width: 42px; height: 42px; font-size: 22px; border-radius: 13px; }
  .card h3 { font-size: 14.5px; margin-top: 10px; }
  .card p { font-size: 11.5px; -webkit-line-clamp: 2; }
  .card .foot { margin-top: 9px; font-size: 11px; gap: 5px; }
  .card .go { margin-top: 9px; padding: 7px 0; font-size: 12px; }
  .cats { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; margin-right: -16px; padding-right: 16px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .cats::-webkit-scrollbar { display: none; }
  .cat { flex-shrink: 0; padding: 8px 12px; }
  .controls { margin: 16px 0 2px; }
  .search { margin-left: 0; width: 100%; margin-top: 4px; }
  .search input { width: 100%; }
  .game-top .g-ctrl { display: none; }
  .end-card { padding: 26px 20px; }
  .end-score { font-size: 42px; }
}
/* ???????????????? */
.game-area-wrap { position: relative; }
