/* ============================================================
   拼图中国 · 设计系统
   设计语言参考：geoshape.planetgis.cn / geoquiz.planetgis.cn
   - 深色 slate 底 + 青/紫渐变强调色
   - 双语渐变英雄标题、emoji 卡片 + 箭头 CTA、大数字统计
   - 玻璃拟态浮层、入场动画、统一圆角与阴影
   注意：保留所有 JS 依赖的 class / id 不变。
   ============================================================ */

:root {
  --bg: #0b1120;
  --bg-soft: #162033;
  --panel: #131c2e;
  --panel-2: #18233a;
  --line: #2a3853;
  --text: #eaf1ff;
  --muted: #94a6c8;
  --accent: #38bdf8;
  --accent-2: #a78bfa;
  --accent-soft: rgba(56, 189, 248, 0.14);
  --good: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.3);
  --glass: rgba(18, 28, 46, 0.72);
  --grad: linear-gradient(120deg, #38bdf8, #a78bfa);
  --grad-cta: linear-gradient(120deg, #38bdf8, #7dd3fc);
}

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

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(56, 189, 248, 0.10), transparent 55%),
    radial-gradient(90% 60% at 100% 0%, rgba(167, 139, 250, 0.08), transparent 50%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 760px;
  margin: 0 auto;
  position: relative;
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  background: linear-gradient(180deg, rgba(22, 32, 51, 0.96), rgba(11, 17, 32, 0.92));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo {
  font-size: 24px;
  filter: drop-shadow(0 2px 6px rgba(56, 189, 248, 0.4));
}
.brand-text { min-width: 0; }
.brand-text h1 {
  font-size: 16px;
  margin: 0;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 800;
  letter-spacing: 0.5px;
}
.subtitle { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.topbar-actions { display: flex; gap: 8px; }

.btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 11px;
  padding: 8px 13px;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s, box-shadow 0.15s;
}
.btn:active { transform: scale(0.96); }
.btn.ghost:hover { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(56,189,248,0.25); }
.btn.primary {
  background: var(--grad);
  border: none;
  color: #06121f;
  font-weight: 800;
  box-shadow: 0 6px 18px rgba(56, 189, 248, 0.35);
}
.btn.primary:hover { box-shadow: 0 8px 24px rgba(56, 189, 248, 0.5); }
.btn.block { width: 100%; }

/* ---------- Stage ---------- */
.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.map-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(56, 189, 248, 0.10), transparent 60%),
    var(--bg);
  overflow: hidden;
}
#map {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* 游戏内顶部进度条 */
.game-progress {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: rgba(148, 163, 184, 0.14);
  z-index: 4;
  overflow: hidden;
}
.game-progress span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--grad);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
  transition: width 0.35s cubic-bezier(.22, .61, .36, 1);
}

/* SVG layer styles */
#ghostLayer path {
  fill: rgba(148, 164, 196, 0.10);
  stroke: rgba(148, 164, 196, 0.55);
  stroke-width: 1.2;
  stroke-dasharray: 4 3;
  transition: fill 0.2s, stroke 0.2s;
}
#ghostLayer path.snap-target {
  fill: rgba(52, 211, 153, 0.30);
  stroke: var(--good);
  stroke-width: 2.2;
}
#ghostLayer path.filled { opacity: 0; }
.ghost-label {
  fill: var(--muted);
  font-size: 15px;
  font-weight: 600;
  text-anchor: middle;
  pointer-events: none;
  paint-order: stroke;
  stroke: rgba(11, 17, 32, 0.85);
  stroke-width: 3px;
}
#pieceLayer path.piece {
  stroke: rgba(8, 17, 31, 0.55);
  stroke-width: 1;
  cursor: grab;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.35));
  transition: filter 0.15s;
}
#pieceLayer path.dragging {
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.55));
}
#pieceLayer path.placed { cursor: default; }
.piece-pop { animation: pop 0.35s ease; transform-box: fill-box; transform-origin: center; }
@keyframes pop {
  0% { transform: scale(0.6); }
  60% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
#bgLayer .nine-dash {
  fill: none;
  stroke: var(--muted);
  stroke-width: 2.4;
  stroke-dasharray: 2 5;
  stroke-linecap: round;
  opacity: 0.8;
}
#bgLayer .bg-frame { fill: rgba(11, 17, 32, 0.55); stroke: var(--line); stroke-width: 1.5; }
#bgLayer .bg-label { fill: var(--muted); font-size: 13px; text-anchor: middle; }

/* ---------- HUD ---------- */
.hud {
  position: absolute;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-sm);
  z-index: 3;
  pointer-events: none;
}
.hud-timer { top: 14px; right: 12px; }
.hud-progress { bottom: 14px; right: 12px; }
.hud-mode {
  top: 14px; left: 12px;
  color: var(--accent);
  border-color: rgba(56, 189, 248, 0.4);
  background: rgba(56, 189, 248, 0.12);
}

.zoom-controls {
  position: absolute;
  bottom: 14px;
  left: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 3;
}
.zoom-controls button {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, transform 0.08s, background 0.15s;
}
.zoom-controls button:hover { border-color: var(--accent); }
.zoom-controls button:active { transform: scale(0.92); }

/* 游戏内「显示名称」控件（练习模式）：默认隐藏，JS 仅在练习模式显示 */
.name-toggle {
  position: absolute;
  top: 52px;
  left: 12px;
  z-index: 3;
  display: none;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.name-toggle.active {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(56, 189, 248, 0.18);
}

.toast {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: rgba(6, 12, 22, 0.92);
  border: 1px solid var(--good);
  color: var(--text);
  padding: 14px 24px;
  border-radius: 14px;
  font-size: 20px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 6;
  box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* ---------- Tray ---------- */
.tray {
  background: linear-gradient(180deg, var(--panel), var(--bg-soft));
  border-top: 1px solid var(--line);
  padding: 10px 12px 14px;
  flex: 0 0 auto;
}
.tray-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 9px;
}
.tray-head span:first-child { color: var(--text); font-weight: 700; font-size: 14px; }
.tray-svg {
  width: 100%;
  height: 100px;
  display: block;
  touch-action: none;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.25);
}
.tray-piece { cursor: grab; transition: opacity 0.15s; }
.tray-piece:active { opacity: 0.8; }
.tray-piece.hidden { opacity: 0; }
.tray-piece.used { opacity: 0; pointer-events: none; }
.tray-thumb path {
  stroke: rgba(8, 17, 31, 0.55);
  stroke-width: 1.4;
  vector-effect: non-scaling-stroke;
}
.tray-label {
  fill: var(--text);
  font-size: 15px;
  font-weight: 600;
  text-anchor: middle;
  pointer-events: none;
  paint-order: stroke;
  stroke: rgba(11, 17, 32, 0.85);
  stroke-width: 3px;
}
.tray-content.hide-labels .tray-label { display: none; }

/* ---------- Modals (shared) ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 9, 18, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 70;
}
.modal-backdrop.hidden { display: none; }
.modal {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(180deg, var(--panel), var(--bg-soft));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  animation: rise 0.28s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal h2 { margin: 0 0 6px; font-size: 21px; text-align: center; font-weight: 800; }
.modal-sub { margin: 0 0 16px; text-align: center; color: var(--muted); font-size: 13px; }
.card-emoji { font-size: 42px; text-align: center; margin-bottom: 4px; }

/* ---------- 首页：模式分段控件 ---------- */
.mode-seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
}
.mode-seg-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel-2), rgba(19, 28, 46, 0.7));
  color: var(--muted);
  border-radius: 16px;
  padding: 16px 16px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  transition: background 0.18s, color 0.18s, border-color 0.18s, box-shadow 0.18s, transform 0.08s;
}
.mode-seg-btn .ms-emoji { font-size: 22px; }
.mode-seg-btn .ms-text { font-size: 16px; }
.mode-seg-btn::after {
  content: '→';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  opacity: 0;
  transition: opacity 0.15s, transform 0.15s;
}
.mode-seg-btn:hover { border-color: rgba(56, 189, 248, 0.55); }
.mode-seg-btn:hover::after { opacity: 0.6; transform: translateY(-50%) translateX(3px); }
.mode-seg-btn.active {
  background: var(--grad);
  color: #06121f;
  border-color: transparent;
  box-shadow: 0 8px 22px rgba(56, 189, 248, 0.38), 0 0 0 1px rgba(125, 211, 252, 0.5) inset;
}
.mode-seg-btn.active::after { opacity: 0.9; color: #06121f; }
.mode-seg-btn:active { transform: scale(0.98); }
.home-mode-desc {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  padding: 9px 12px;
  background: rgba(56, 189, 248, 0.05);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0 18px;
}
.card-item {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px;
}
.card-item .k { font-size: 12px; color: var(--muted); }
.card-item .v { font-size: 14px; font-weight: 600; margin-top: 3px; }
.card-item.full { grid-column: 1 / -1; }

.result-stats {
  display: flex;
  justify-content: space-around;
  gap: 10px;
  margin: 16px 0;
  text-align: center;
}
.result-stats .stat .num { font-size: 26px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.result-stats .stat .lab { font-size: 12px; color: var(--muted); margin-top: 2px; }
.result-best { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.result-best b { color: var(--good); }
.result-grade { text-align: center; margin: 6px 0 2px; }
.grade-badge {
  display: inline-block; padding: 6px 16px; border-radius: 999px;
  font-size: 16px; font-weight: 700; letter-spacing: 1px;
}
.grade-badge.g-s { background: linear-gradient(135deg,#f59e0b,#ef4444); color:#fff; box-shadow: 0 6px 18px rgba(239,68,68,0.4); }
.grade-badge.g-a { background: rgba(52,211,153,0.18); color:#4ade80; border:1px solid rgba(52,211,153,0.4); }
.grade-badge.g-b { background: rgba(56,189,248,0.16); color:#7dd3fc; border:1px solid rgba(56,189,248,0.4); }
.grade-badge.g-c { background: rgba(251,191,36,0.16); color:#fbbf24; border:1px solid rgba(251,191,36,0.4); }
.grade-badge.g-d { background: rgba(148,163,184,0.16); color:#cbd5e1; border:1px solid rgba(148,163,184,0.4); }

.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; }
#setReshuffle.hidden { display: none; }
/* 分享弹窗：下载为主操作，居中全宽；关闭为次级，垂直堆叠 */
#shareModal .modal-actions { flex-direction: column; align-items: stretch; gap: 10px; }
#shareModal .modal-actions .btn { width: 100%; text-align: center; font-size: 14px; padding: 11px 12px; }

.help-list { margin: 0 0 16px; padding-left: 18px; line-height: 1.8; font-size: 14px; color: var(--text); }
.help-list li { margin-bottom: 4px; }

/* ---------- 设置弹窗 ---------- */
.set-block { text-align: left; margin-bottom: 16px; }
.set-title {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 9px;
  letter-spacing: 1px;
}
.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 15px;
  margin-bottom: 9px;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.08s;
}
.set-row:active { transform: scale(0.99); }
.set-row:hover { border-color: rgba(56,189,248,0.5); }
.set-toggle {
  position: relative;
  width: 44px;
  height: 25px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  flex: none;
  transition: background 0.15s, border-color 0.15s;
}
.set-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.18s cubic-bezier(.22,.61,.36,1), background 0.15s;
}
.set-toggle.on {
  background: rgba(56, 189, 248, 0.35);
  border-color: var(--accent);
}
.set-toggle.on::after {
  transform: translateX(19px);
  background: var(--accent);
}

/* Desktop niceties */
@media (min-width: 760px) {
  .tray-svg { height: 116px; }
  .brand-text h1 { font-size: 18px; }
}

/* ---- 音效开关按钮（静音态）---- */
.btn.muted { opacity: 0.6; }

/* ---- 知识卡：不再弹出勾选 ---- */
.card-suppress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 2px 14px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.card-suppress input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

/* ---- 帮助里：知识卡弹窗开关 ---- */
#helpToggleCards.on { border-color: var(--good); color: var(--good); }
#helpToggleCards { margin-bottom: 4px; }

/* ---------- 主页 / 封面 ---------- */
.home-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 26px 20px 36px;
  background:
    radial-gradient(120% 90% at 50% -10%, rgba(56, 189, 248, 0.16), transparent 55%),
    radial-gradient(90% 60% at 100% 0%, rgba(167, 139, 250, 0.12), transparent 50%),
    linear-gradient(180deg, #0e1626 0%, #0b1120 72%);
}
/* 漂浮光斑 */
.home-screen::before {
  content: '';
  position: fixed;
  top: -18%;
  left: -12%;
  width: 72vmax;
  height: 72vmax;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.12), transparent 60%);
  filter: blur(10px);
  pointer-events: none;
  z-index: 0;
  animation: homeFloat 20s ease-in-out infinite alternate;
}
/* 极淡网格（顶部渐隐） */
.home-screen::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.045) 1px, transparent 1px);
  background-size: 30px 30px;
  -webkit-mask-image: radial-gradient(125% 85% at 50% 0%, #000 25%, transparent 78%);
  mask-image: radial-gradient(125% 85% at 50% 0%, #000 25%, transparent 78%);
  pointer-events: none;
  z-index: 0;
}
.home-screen.hidden { display: none; }
.home-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  margin: auto;
  text-align: center;
}
@keyframes homeFloat {
  from { transform: translate(0, 0); }
  to { transform: translate(9%, 11%); }
}
.home-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0.9;
  pointer-events: none;
  filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.22));
  animation: homeMapBreath 7s ease-in-out infinite;
}
.home-hero {
  position: relative;
  width: 100%;
  max-width: 384px;
  margin: 0 auto 14px;
  aspect-ratio: 1000 / 785;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(56, 189, 248, 0.28);
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(56, 189, 248, 0.14), transparent 70%),
    var(--panel);
  box-shadow: var(--shadow), 0 0 0 1px rgba(56, 189, 248, 0.10), 0 0 60px rgba(56, 189, 248, 0.16);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
/* 顶部高光描边 */
.home-hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.65), transparent);
  z-index: 3;
}
/* 底部渐变遮罩，保证文字可读（更柔和，不压字） */
.home-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  top: 42%;
  background: linear-gradient(180deg, transparent 0%, rgba(11, 17, 32, 0.5) 52%, rgba(11, 17, 32, 0.88) 100%);
  pointer-events: none;
  z-index: 2;
}
/* 中心呼吸光晕 */
.home-glow {
  position: absolute;
  top: 22%;
  left: 50%;
  width: 64%;
  height: 52%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(56, 189, 248, 0.28), transparent 70%);
  filter: blur(20px);
  pointer-events: none;
  z-index: 0;
  animation: homeHeroGlow 6.5s ease-in-out infinite;
}
/* 雷达扫描线 */
.home-scan {
  position: absolute;
  left: 0; right: 0;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(125, 211, 252, 0.85), transparent);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.6);
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  animation: homeScan 4.8s linear infinite;
}
.home-hero-text {
  position: relative;
  z-index: 3;
  width: 100%;
  height: 100%;
  padding: 18px 22px 22px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.6));
}
.home-mid {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.home-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.45);
  padding: 6px 15px;
  border-radius: 999px;
  background: rgba(11, 17, 32, 0.5);
  backdrop-filter: blur(4px);
  margin-bottom: 18px;
  letter-spacing: 0.5px;
}
.home-title {
  font-size: 52px;
  margin: 0 0 8px;
  letter-spacing: 10px;
  font-weight: 900;
  line-height: 1.08;
  background: linear-gradient(120deg, #7dd3fc, #c4b5fd 55%, #38bdf8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 16px rgba(56, 189, 248, 0.4));
}
.home-en {
  margin: 0 0 16px;
  font-size: 13px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: rgba(234, 241, 255, 0.82);
  font-weight: 600;
}
.home-sub {
  color: rgba(234, 241, 255, 0.82);
  font-size: 12px;
  line-height: 1.7;
  margin: 0;
  letter-spacing: 0.5px;
}
/* 小屏：压缩文字，避免卡片高度不足被裁切 */
@media (max-width: 400px) {
  .home-hero { max-width: 100%; }
  .home-hero-text { padding: 24px 18px 24px; }
  .home-badge { margin-bottom: 12px; padding: 5px 13px; }
  .home-title { font-size: 40px; letter-spacing: 6px; margin-bottom: 6px; }
  .home-en { margin-bottom: 12px; font-size: 12px; letter-spacing: 3px; }
  .home-sub { font-size: 11px; line-height: 1.65; }
}
@keyframes homeHeroGlow {
  0%, 100% { opacity: 0.45; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.85; transform: translate(-50%, -50%) scale(1.1); }
}
@keyframes homeScan {
  0% { top: 0%; opacity: 0; }
  12% { opacity: 1; }
  88% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}
@keyframes homeMapBreath {
  0%, 100% { opacity: 0.78; }
  50% { opacity: 1; }
}
.btn-home-start {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 300px;
  margin-top: 12px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 2px;
  padding: 17px 26px;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  color: #06121f;
  background: var(--grad-cta);
  box-shadow: 0 10px 28px rgba(56, 189, 248, 0.4);
  transition: transform 0.08s, box-shadow 0.15s;
}
.btn-home-start::before {
  content: '';
  position: absolute;
  top: 0;
  left: -60%;
  width: 55%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transform: skewX(-18deg);
  animation: ctaSweep 3.4s ease-in-out infinite;
  pointer-events: none;
}
.btn-home-start::after { content: '→'; font-size: 20px; }
.btn-home-start:active { transform: scale(0.97); }
.btn-home-start:hover { box-shadow: 0 12px 34px rgba(56, 189, 248, 0.55); }
.btn-home-start:disabled { opacity: 0.7; cursor: default; }
@keyframes ctaSweep { 0% { left: -60%; } 55%, 100% { left: 130%; } }
.home-stats {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}
.home-stats b { color: var(--text); }
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.stat-cell {
  position: relative;
  background: linear-gradient(180deg, var(--panel-2), var(--bg-soft));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 8px 14px;
  text-align: center;
  overflow: hidden;
  transition: border-color 0.15s, transform 0.08s, box-shadow 0.15s;
}
.stat-cell::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--grad);
  opacity: 0.65;
}
.stat-cell:hover {
  border-color: rgba(56, 189, 248, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(56, 189, 248, 0.18);
}
.stat-num {
  font-size: 23px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.stat-label {
  margin-top: 5px;
  font-size: 11px;
  color: var(--muted);
}
.home-cum {
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  line-height: 1.7;
}
.home-cum b { color: var(--accent); }
.home-recent {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  padding: 11px 12px;
  background: rgba(56, 189, 248, 0.06);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 12px;
}
.home-recent b { color: var(--text); }

/* ---------- 首页：省份选择面板（合集内） ---------- */
.home-provinces {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 16px;
  background: rgba(56, 189, 248, 0.05);
}
.home-provinces.hidden { display: none; }
.prov-search {
  width: 100%;
  box-sizing: border-box;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font-size: 13px;
  padding: 10px 13px;
  outline: none;
  margin-bottom: 12px;
}
.prov-search::placeholder { color: var(--muted); }
.prov-search:focus { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(56,189,248,0.25); }
.prov-groups {
  max-height: 320px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.prov-group { margin-bottom: 12px; }
.prov-group.hidden { display: none; }
.prov-group:last-child { margin-bottom: 0; }
.prov-group-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
}
.pg-count { font-size: 10px; color: var(--muted); font-weight: 400; }
.prov-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.province-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 4px;
  cursor: pointer;
  color: var(--text);
  transition: border-color 0.15s, transform 0.08s, background 0.15s;
}
.province-chip.hidden { display: none; }
.province-chip:active { transform: scale(0.97); }
.province-chip:hover { border-color: rgba(56,189,248,0.5); }
.province-chip.selected {
  border-color: var(--accent);
  background: rgba(56, 189, 248, 0.16);
  box-shadow: 0 0 0 1px var(--accent) inset;
}
.pc-name { font-size: 13px; font-weight: 700; white-space: nowrap; }
.pc-count { font-size: 10px; color: var(--muted); }

/* 已选提示条 */
.home-picked {
  margin-top: 22px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}
.home-picked b { color: var(--text); }

/* ---------- 开始弹层：地图 + 模式选择 ---------- */
.start-panel {
  max-width: 460px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
.start-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}
.start-head h2 {
  margin: 0;
  text-align: left;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 1px;
}
.start-close {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.start-close:hover {
  border-color: rgba(56, 189, 248, 0.5);
  color: var(--text);
  background: rgba(56, 189, 248, 0.08);
}
.start-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px 20px 4px;
}
.start-panel .home-section { margin-top: 18px; }
.start-panel .home-section:first-child { margin-top: 10px; }
.home-start-hint {
  margin: 12px 0 2px;
  font-size: 12px;
  letter-spacing: 0.5px;
  color: var(--muted);
}

/* 首页右上角：设置入口 */
.home-topbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 6px;
}
.home-set-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 12px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: border-color 0.15s, color 0.15s, background 0.15s, transform 0.08s;
}
.home-set-btn:hover {
  border-color: rgba(56, 189, 248, 0.5);
  color: var(--text);
  background: rgba(56, 189, 248, 0.08);
}
.home-set-btn:active { transform: scale(0.97); }
.start-panel .home-picked {
  margin: 14px 20px 2px;
  text-align: center;
}
.start-panel #startConfirm {
  width: calc(100% - 40px);
  margin: 14px 20px 20px;
  max-width: none;
  font-size: 16px;
  padding: 15px 22px;
  letter-spacing: 1px;
}

/* 合集入口卡片：更醒目 */
.home-level-card.collection {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.16), rgba(167, 139, 250, 0.16));
  border-color: rgba(56, 189, 248, 0.45);
}
.home-level-card.collection .hl-title { font-size: 15px; }
.home-links {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  justify-content: center;
}
.home-link {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 12px;
  padding: 9px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, transform 0.08s;
}
.home-link:active { border-color: var(--accent); color: var(--text); transform: scale(0.97); }

/* ---------- 完成撒花画布 ---------- */
.confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 60;
}

/* ---------- 放置高亮脉冲 ---------- */
.piece.glow {
  animation: glowPulse 1.2s ease-out;
}
@keyframes glowPulse {
  0% { stroke: #ffffff; stroke-width: 1; filter: drop-shadow(0 0 2px #fff); }
  25% { stroke: #ffffff; stroke-width: 3; filter: drop-shadow(0 0 12px var(--accent)); }
  100% { stroke: none; stroke-width: 0; filter: none; }
}

/* ---------- 地图上省名标签 ---------- */
.placed-name {
  font-size: 13px;
  fill: #eaf2ff;
  text-anchor: middle;
  paint-order: stroke;
  stroke: rgba(8, 15, 30, 0.85);
  stroke-width: 3px;
  stroke-linejoin: round;
  pointer-events: none;
  opacity: 0;
  animation: nameIn 0.25s ease-out forwards;
}
.placed-name.fade { animation: nameOut 0.5s ease-in forwards; }
@keyframes nameIn { to { opacity: 1; } }
@keyframes nameOut { to { opacity: 0; } }

/* ---------- 首页：关卡选择卡片 ---------- */
.home-section { margin-top: 24px; text-align: left; }
.home-section-title {
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: 1.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.home-section-title::before {
  content: '';
  width: 4px; height: 14px;
  border-radius: 2px;
  background: var(--grad);
}
.home-levels {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.home-level-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  background: linear-gradient(180deg, var(--panel-2), rgba(19, 28, 46, 0.7));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 12px 18px;
  cursor: pointer;
  color: var(--text);
  overflow: hidden;
  transition: border-color 0.16s, transform 0.1s, background 0.16s, box-shadow 0.16s;
}
.home-level-card::after {
  content: '→';
  position: absolute;
  right: 10px;
  bottom: 9px;
  font-size: 15px;
  opacity: 0.3;
  transition: opacity 0.15s, transform 0.15s;
}
.home-level-card:hover {
  border-color: rgba(56, 189, 248, 0.6);
  transform: translateY(-3px);
  box-shadow: var(--shadow-sm), 0 10px 28px rgba(56, 189, 248, 0.18);
}
.home-level-card:hover::after { opacity: 0.9; transform: translateX(3px); }
.home-level-card:active { transform: translateY(0) scale(0.98); }
.home-level-card.selected {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.18), rgba(167, 139, 250, 0.10));
  box-shadow: 0 0 0 1px var(--accent) inset, 0 10px 30px rgba(56, 189, 248, 0.28);
}
.hl-tag {
  align-self: flex-start;
  font-size: 11px;
  color: var(--accent);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 9px;
  margin-bottom: 5px;
  background: rgba(56, 189, 248, 0.06);
}
.hl-title { font-size: 14px; font-weight: 800; line-height: 1.25; }
.hl-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ---------- 结算历史成绩 ---------- */
.result-history { margin-top: 14px; }
.rh-title { font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.hist-row {
  display: grid; grid-template-columns: 34px 1fr auto auto auto; gap: 8px;
  align-items: center; font-size: 13px; padding: 6px 4px;
  border-top: 1px solid var(--line); color: var(--text);
}
.hist-row .h-i { color: var(--muted); }
.hist-row .h-t { color: var(--muted); font-size: 12px; }
.hist-empty { font-size: 13px; color: var(--muted); padding: 8px 4px; }

/* ---------- 分享成绩卡 ---------- */
.share-canvas { display: none; }
.share-img {
  width: 100%; max-width: 280px; border-radius: 12px; display: block;
  margin: 4px auto 18px; box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

/* ---------- 首页入场动画 ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); filter: blur(5px); }
  to { opacity: 1; transform: none; filter: blur(0); }
}
@keyframes heroIn {
  from { opacity: 0; transform: scale(0.92) translateY(14px); filter: blur(8px); }
  to { opacity: 1; transform: none; filter: blur(0); }
}
.home-inner > * { animation: fadeUp 0.6s both; }
.home-inner > *:nth-child(1) { animation: heroIn 0.7s both; }
.home-inner > *:nth-child(2) { animation-delay: 0.08s; }
.home-inner > *:nth-child(3) { animation-delay: 0.14s; }
.home-inner > *:nth-child(4) { animation-delay: 0.20s; }
.home-inner > *:nth-child(5) { animation-delay: 0.26s; }
.home-inner > *:nth-child(6) { animation-delay: 0.32s; }
.home-inner > *:nth-child(7) { animation-delay: 0.38s; }

/* 卡片网格子项错落入场 */
.home-levels .home-level-card,
.home-stats .stat-cell { animation: fadeUp 0.5s both; }
