* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  min-height: 100vh; color: #333;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  cursor: default;
  display: flex; justify-content: center; align-items: center;
  overflow: hidden;
  margin: 0;
  padding: 0;
}
#gameWrap { user-select: none; -webkit-user-select: none; }

/* 登录注册 */
.auth-body { display: flex; justify-content: center; align-items: center; min-height: 100vh; }
.auth-box {
  background: #fff; border-radius: 20px; padding: 40px 32px;
  width: 360px; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  text-align: center;
}
.auth-box h1 { font-size: 28px; margin-bottom: 8px; color: #e67e22; }
.auth-sub { color: #999; font-size: 14px; margin-bottom: 24px; }
.auth-error {
  background: #fee; color: #c33; padding: 10px; border-radius: 8px;
  font-size: 13px; margin-bottom: 16px;
}
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form input {
  padding: 12px 16px; border: 1px solid #ddd; border-radius: 10px;
  font-size: 15px; outline: none; transition: border-color 0.2s;
}
.auth-form input:focus { border-color: #e67e22; }
.btn-primary {
  padding: 12px; border: none; border-radius: 10px;
  background: linear-gradient(135deg, #ff6b6b, #ee5a24);
  color: #fff; font-size: 16px; font-weight: 700; cursor: pointer;
  transition: transform 0.15s;
}
.btn-primary:hover { transform: scale(1.02); }
.auth-divider {
  display: flex; align-items: center; margin: 20px 0; color: #ccc; font-size: 13px;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: #eee;
}
.auth-divider span { padding: 0 12px; }
.btn-wechat {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px; border-radius: 10px; background: #07c160;
  color: #fff; text-decoration: none; font-size: 15px; font-weight: 600;
  transition: transform 0.15s;
}
.btn-wechat:hover { transform: scale(1.02); }
.auth-link { margin-top: 16px; font-size: 13px; color: #999; }
.auth-link a { color: #e67e22; text-decoration: none; }

/* 游戏首页 */
.game-page { display: flex; justify-content: center; align-items: flex-start; min-height: 100vh; padding: 20px; gap: 20px; }
.game-main { position: relative; }
#gameWrap {
  position: relative; width: 400px; height: 640px;
  background: linear-gradient(180deg, #fff8e7 0%, #ffefd5 50%, #ffe4c4 100%);
  border-radius: 16px; overflow: visible;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
canvas { display: block; width: 100%; height: 100%; }
#topBar {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; z-index: 10; pointer-events: none;
}
#scoreBox {
  background: rgba(255,255,255,0.95); border-radius: 20px;
  padding: 6px 16px; font-weight: 800; font-size: 18px; color: #e67e22;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  pointer-events: auto; cursor: pointer;
}
#timerBox {
  position: absolute; top: 52px; left: 16px; z-index: 10;
  background: rgba(255,255,255,0.95); border-radius: 16px;
  padding: 4px 12px; font-size: 13px; color: #e74c3c; font-weight: 700;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
#timerBox.warning { animation: timerPulse 0.8s infinite; }
@keyframes timerPulse { 0%,100%{transform:scale(1);} 50%{transform:scale(1.1);} }
#nextBox {
  background: rgba(255,255,255,0.95); border-radius: 20px;
  padding: 6px 14px; font-size: 14px; color: #666; font-weight: 600;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  display: flex; align-items: center; gap: 6px;
}
#nextFruit { width: 24px; height: 24px; border-radius: 50%; }
#loginEntry {
  position: absolute; top: 52px; right: 16px; z-index: 10;
  padding: 6px 14px; border-radius: 20px;
  background: linear-gradient(135deg, #ff6b6b, #ee5a24);
  color: #fff; font-size: 12px; font-weight: 700; text-decoration: none;
  box-shadow: 0 2px 10px rgba(238,90,36,0.4);
}
#userEntry {
  position: absolute; top: 52px; right: 16px; z-index: 10;
  display: flex; align-items: center; gap: 6px;
  padding: 4px 12px 4px 4px; border-radius: 20px;
  background: rgba(255,255,255,0.95); font-size: 12px; font-weight: 600; color: #333;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
#userEntry img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
#musicBtn {
  position: absolute; bottom: 16px; right: 16px; z-index: 15;
  width: 44px; height: 44px; border-radius: 50%; border: none;
  background: rgba(255,255,255,0.95); font-size: 20px; cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}
#tip {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
  font-size: 12px; color: #999; z-index: 5;
}
#gameOver {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.75); display: none; flex-direction: column;
  justify-content: center; align-items: center; z-index: 100; color: #fff;
}
#gameOver.show { display: flex; }
#gameOver h2 { font-size: 32px; margin-bottom: 8px; }
#gameOver .score-line { font-size: 18px; margin: 4px 0; }
#gameOver .best { color: #ffd700; font-weight: 700; }
#restartBtn {
  margin-top: 24px; padding: 14px 36px; border: none; border-radius: 30px;
  font-size: 17px; font-weight: 700; cursor: pointer;
  background: linear-gradient(135deg, #ff6b6b, #ee5a24); color: #fff;
}
#trialEnd {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.8); display: none; flex-direction: column;
  justify-content: center; align-items: center; z-index: 150; color: #fff;
}
#trialEnd.show { display: flex; }
#trialEnd h2 { font-size: 28px; margin-bottom: 12px; color: #ffd700; }
#trialEnd p { font-size: 15px; margin: 4px 0; opacity: 0.85; }
#trialAdBtn {
  margin-top: 24px; padding: 14px 36px; border: none; border-radius: 30px;
  font-size: 17px; font-weight: 700; cursor: pointer;
  background: linear-gradient(135deg, #ff6b6b, #ee5a24); color: #fff;
}

/* 右侧排名栏 */
.sidebar {
  width: 280px; background: #fff; border-radius: 16px; padding: 20px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3); align-self: flex-start;
  position: sticky; top: 20px;
}
.sidebar h3 { font-size: 18px; margin-bottom: 16px; color: #e67e22; display: flex; align-items: center; gap: 8px; }
.user-card {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  background: linear-gradient(135deg, #fff8e7, #ffe4c4); border-radius: 12px; margin-bottom: 16px;
}
.user-card img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.user-card .info { flex: 1; }
.user-card .name { font-weight: 700; font-size: 15px; }
.user-card .score { font-size: 12px; color: #999; margin-top: 2px; }
.user-card .rank-badge {
  background: linear-gradient(135deg, #ffd700, #ff8c00); color: #fff;
  padding: 4px 10px; border-radius: 12px; font-size: 12px; font-weight: 700;
}
.rank-list { list-style: none; }
.rank-list li {
  display: flex; align-items: center; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}
.rank-list li:last-child { border-bottom: none; }
.rank-num {
  width: 24px; height: 24px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
  background: #f0f0f0; color: #999; flex-shrink: 0;
}
.rank-list li:nth-child(1) .rank-num { background: #ffd700; color: #fff; }
.rank-list li:nth-child(2) .rank-num { background: #c0c0c0; color: #fff; }
.rank-list li:nth-child(3) .rank-num { background: #cd7f32; color: #fff; }
.rank-list img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.rank-list .name { flex: 1; font-size: 14px; }
.rank-list .score { font-size: 13px; font-weight: 700; color: #e67e22; }
.logout-btn {
  display: block; width: 100%; margin-top: 16px; padding: 10px;
  border: 1px solid #ddd; border-radius: 10px; background: #fff;
  color: #999; font-size: 13px; cursor: pointer; text-align: center; text-decoration: none;
}
.logout-btn:hover { background: #f5f5f5; }

/* 响应式 */
@media (max-width: 768px) {
  .game-page { flex-direction: column; align-items: center; padding: 10px; }
  .sidebar { width: 100%; max-width: 400px; position: static; order: 2; }
  #gameWrap { order: 1; }
}
