/* ============================================================
   挪了个箭 · 脑回路 v4.0
   ============================================================ */

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overscroll-behavior: none; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: linear-gradient(180deg, #e0f0fa 0%, #c5e0f0 100%);
  color: #2a3a4a;
  min-height: 100vh;
  overflow-x: hidden;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

:root {
  --primary: #3a8bd8;
  --primary2: #5ba5e8;
  --primary-dark: #2a6fb0;
  --gold: #ffc94a;
  --gold2: #ff9f1c;
  --pink: #ff6b8a;
  --green: #00b894;
  --orange: #ff8a4a;
  --shadow-card: 0 4px 16px rgba(58, 139, 216, 0.15);
  --shadow-btn: 0 2px 8px rgba(58, 139, 216, 0.25);
}

#app { min-height: 100vh; padding-bottom: 80px; position: relative; }

/* ==================== 加载页 (略过) ==================== */
/* 启动直接进主界面 */

/* ==================== 主界面 (home) ==================== */
.home-topbar {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; position: relative; z-index: 2;
}
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px;
  background: rgba(255,255,255,0.6); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; box-shadow: var(--shadow-btn);
}
.currency-pill {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 12px; border-radius: 20px;
  background: rgba(255,255,255,0.7); box-shadow: var(--shadow-btn);
  font-weight: 700; font-size: 14px;
}
.cur-icon { color: var(--gold2); }
.cur-add { color: var(--primary); margin-left: 2px; }

.home-progress {
  margin: 0 16px 16px; padding: 12px 16px;
  background: rgba(255,255,255,0.6); border-radius: 16px;
  display: flex; align-items: center; gap: 8px;
  box-shadow: var(--shadow-card);
}
.hp-title { font-size: 14px; font-weight: 700; color: var(--primary-dark); white-space: nowrap; }
.hp-bar { flex: 1; height: 14px; background: linear-gradient(90deg, #f0f6fb, #e0eef9); border-radius: 7px; overflow: hidden; }
.hp-fill { height: 100%; background: linear-gradient(90deg, var(--primary2), var(--primary)); border-radius: 7px; transition: width 0.5s; }
.hp-count { font-size: 13px; color: #6a8aa8; }

.home-logo-wrap {
  display: flex; justify-content: center; align-items: center;
  margin: 24px 0 20px; padding: 0 16px;
}
.home-logo-svg { width: 100%; max-width: 460px; height: auto; }

.home-ctas { padding: 0 16px; display: flex; flex-direction: column; gap: 14px; }
.home-cta-card {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 22px; border-radius: 22px;
  font-size: 18px; font-weight: 800; color: white;
  box-shadow: var(--shadow-card);
  position: relative; overflow: hidden;
  transition: transform 0.15s;
}
.home-cta-card:active { transform: scale(0.97); }
.cta-candy { background: linear-gradient(135deg, #b48cf2, #8a5cf2); }
.cta-level { background: linear-gradient(135deg, #ffa56b, #ff7a3d); }
.cta-rank { background: linear-gradient(135deg, #5ba5e8, #3a8bd8); }
.cta-icon { font-size: 28px; }
.cta-text { flex: 1; }
.cta-arrow { font-size: 28px; opacity: 0.7; }

.home-side-grid {
  margin: 24px 16px 0; display: grid;
  grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.side-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 4px;
}
.side-icon {
  width: 52px; height: 52px; border-radius: 16px;
  background: white; box-shadow: var(--shadow-btn);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
}
.side-label { font-size: 12px; color: #5a7a9a; }

.home-bottom-tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; justify-content: space-around; align-items: center;
  padding: 10px 0 18px; background: linear-gradient(180deg, transparent, #d0e5f5 30%);
  z-index: 10;
}
.tab-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 12px; min-width: 64px;
}
.tab-icon {
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,0.5); display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.tab-btn.active .tab-icon { background: white; box-shadow: var(--shadow-btn); }
.tab-label { font-size: 11px; color: #5a7a9a; }
.tab-btn.active .tab-label { color: var(--primary-dark); font-weight: 700; }

/* ==================== 脑回路游戏 (brain) ==================== */
#app:has(.game-topbar) { padding-bottom: 90px; }
#app:has(.game-topbar) .home-bottom-tabbar { display: none; }

.game-topbar {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; position: relative; z-index: 2;
}
.game-title { flex: 1; text-align: center; font-size: 16px; font-weight: 700; color: var(--primary-dark); }
.game-progress {
  padding: 6px 14px; border-radius: 16px;
  background: white; box-shadow: var(--shadow-btn);
  font-size: 14px; font-weight: 700; color: var(--primary);
}

.brain-wrap {
  margin: 0 auto; max-width: 600px; padding: 8px 16px;
  display: flex; justify-content: center;
}
.brain-svg {
  width: 100%; height: auto; max-height: 70vh;
  background: transparent;
  touch-action: manipulation;
}
.brain-path { cursor: pointer; transition: opacity 0.2s; }
.brain-path .path-line { pointer-events: stroke; }
.brain-path .path-dot { pointer-events: fill; }
.brain-path:hover polyline { stroke: var(--primary); stroke-width: 5; }
.brain-path.active polyline { stroke: var(--primary); stroke-width: 6; }
.brain-path.hinted polyline { stroke: var(--orange); stroke-width: 5; }

.game-bottombar {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; justify-content: space-around; align-items: center;
  padding: 12px 0 24px;
  background: rgba(255,255,255,0.95); backdrop-filter: blur(8px);
  box-shadow: 0 -2px 12px rgba(0,0,0,0.05);
  z-index: 10;
}
.tool-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 16px; min-width: 70px; position: relative;
}
.tool-icon {
  width: 48px; height: 48px; border-radius: 50%;
  background: linear-gradient(135deg, #6ab8f5, #3a8bd8);
  color: white; display: flex; align-items: center; justify-content: center;
  font-size: 22px; box-shadow: var(--shadow-btn);
}
.tool-label { font-size: 12px; color: #5a7a9a; }
.tool-count {
  position: absolute; top: 0; right: 8px;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 11px; background: #ff4757; color: white;
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ==================== 弹窗 ==================== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  display: none; align-items: center; justify-content: center;
  z-index: 100; padding: 16px;
}
.modal-backdrop.show { display: flex; }
.modal-card {
  background: white; border-radius: 20px; padding: 28px 24px;
  max-width: 360px; width: 100%; box-shadow: 0 12px 40px rgba(0,0,0,0.2);
  text-align: center;
}
.modal-title { font-size: 24px; font-weight: 800; color: var(--primary-dark); margin-bottom: 8px; }
.modal-desc { font-size: 14px; color: #5a7a9a; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 12px; justify-content: center; }
.btn-primary, .btn-secondary {
  flex: 1; padding: 12px 16px; border-radius: 14px;
  font-size: 15px; font-weight: 700; color: white;
}
.btn-primary { background: linear-gradient(135deg, var(--primary2), var(--primary)); }
.btn-secondary { background: linear-gradient(135deg, #d0e5f5, #b0d0e8); color: var(--primary-dark); }

/* ==================== Toast ==================== */
#toast {
  position: fixed; bottom: 110px; left: 50%; transform: translateX(-50%) translateY(20px);
  padding: 10px 20px; border-radius: 22px;
  background: rgba(0,0,0,0.78); color: white; font-size: 14px; font-weight: 600;
  opacity: 0; pointer-events: none; z-index: 200;
  transition: opacity 0.2s, transform 0.2s;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ==================== 移动端适配 ==================== */
@media (max-width: 480px) {
  .home-logo-svg { max-width: 92vw; }
  .home-cta-card { padding: 16px 18px; font-size: 16px; }
  .home-side-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .side-icon { width: 46px; height: 46px; font-size: 24px; }
  .brain-wrap { padding: 4px 8px; }
  .game-bottombar { padding: 8px 0 16px; }
  .tool-btn { min-width: 60px; padding: 4px 8px; }
  .tool-icon { width: 42px; height: 42px; font-size: 18px; }
  .home-topbar { padding: 8px 12px; }
  .icon-btn { width: 36px; height: 36px; font-size: 18px; }
  .currency-pill { padding: 4px 10px; font-size: 13px; }
}
@media (max-width: 360px) {
  .side-icon { width: 40px; height: 40px; font-size: 20px; }
  .home-cta-card { font-size: 15px; padding: 14px 16px; }
  .home-cta-card .cta-icon { font-size: 24px; }
}
