* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #000;
  color: #fff;
  overflow: hidden;
}

/* 登录屏幕 */
#login-screen {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
}

.login-panel {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  padding: 40px 50px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  text-align: center;
  min-width: 400px;
  animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#title-text {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 10px;
  text-shadow: 0 2px 10px rgba(0, 255, 255, 0.5);
}

#subtitle-text {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 30px;
}

.form-group {
  margin-bottom: 25px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 14px;
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.9);
}

.form-group select,
.form-group input {
  width: 100%;
  padding: 12px 15px;
  font-size: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  outline: none;
  transition: all 0.3s ease;
}

.form-group select {
  background-color: #fff;
  color: #333;
}

.form-group select option {
  background-color: #fff;
  color: #333;
  padding: 10px;
}

.form-group select:focus,
.form-group input:focus {
  border-color: #00d4ff;
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

.form-group input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

#login-btn {
  width: 100%;
  padding: 15px;
  font-size: 18px;
  font-weight: 600;
  background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 212, 255, 0.4);
}

#login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 212, 255, 0.6);
}

#login-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(0, 212, 255, 0.4);
}

.error-text {
  margin-top: 15px;
  color: #ff4444;
  font-size: 14px;
  min-height: 20px;
}

/* 游戏区域：强制竖屏自适应锁，电脑端也按 480px 手机屏呈现 */
#game-container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  height: 100vh;
  overflow: hidden;
  background: #0f172a;
  position: relative;
  touch-action: none;
  border-left: 2px solid #333;
  border-right: 2px solid #333;
}

/* Matter.js 注入的 canvas 不得溢出竖屏笼子 */
#game-container canvas {
  display: block;
  max-width: 100%;
}

#player-info {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(8px);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  color: #00d4ff;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  max-width: 40vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#game-info {
  position: absolute;
  top: 15px;
  left: 15px;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(6, 182, 212, 0.4);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 16px;
  color: #06b6d4;
  box-shadow: 0 4px 20px rgba(6, 182, 212, 0.3);
  z-index: 1000;
  text-shadow: 0 0 10px rgba(6, 182, 212, 0.8);
  font-family: 'Courier New', monospace;
  min-width: 200px;
}

#game-info div {
  margin: 5px 0;
}

/* 警告提示层 */
#alert-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 30px 50px;
  border-radius: 15px;
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  z-index: 2000;
  text-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
  pointer-events: none;
  white-space: nowrap;
}

.wind-alert {
  background: rgba(255, 193, 7, 0.95);
  color: #000;
  animation: windFlash 0.6s ease-in-out infinite;
  border: 3px solid #ffc107;
  box-shadow: 0 0 30px rgba(255, 193, 7, 0.8);
}

.quake-alert {
  background: rgba(220, 38, 38, 0.98);
  color: #fff;
  animation: quakeFlash 0.15s ease-in-out infinite;
  border: 4px solid #dc2626;
  box-shadow: 0 0 40px rgba(220, 38, 38, 0.9);
}

@keyframes windFlash {
  0%, 100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.6; transform: translate(-50%, -50%) scale(1.02); }
}

@keyframes quakeFlash {
  0%, 100% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
  25% { opacity: 0.85; transform: translate(-50%, -50%) scale(1.05) rotate(-1deg); }
  50% { opacity: 0.95; transform: translate(-50%, -50%) scale(0.98) rotate(1deg); }
  75% { opacity: 0.8; transform: translate(-50%, -50%) scale(1.03) rotate(-0.5deg); }
}

/* 风向指示器动画 */
@keyframes windBlowRight {
  0% { transform: translateX(-10%); opacity: 0.5; }
  50% { opacity: 1; }
  100% { transform: translateX(10%); opacity: 0.5; }
}

@keyframes windBlowLeft {
  0% { transform: translateX(10%); opacity: 0.5; }
  50% { opacity: 1; }
  100% { transform: translateX(-10%); opacity: 0.5; }
}

/* 风向特效层样式 */
.wind-right {
  animation: windSweepRight 1.2s ease-in-out infinite;
}

.wind-left {
  animation: windSweepLeft 1.2s ease-in-out infinite;
}

@keyframes windSweepRight {
  0% { transform: translateX(-20%); opacity: 0.3; }
  50% { opacity: 0.7; }
  100% { transform: translateX(20%); opacity: 0.3; }
}

@keyframes windSweepLeft {
  0% { transform: translateX(20%); opacity: 0.3; }
  50% { opacity: 0.7; }
  100% { transform: translateX(-20%); opacity: 0.3; }
}

/* 风向轨迹穿梭动画 */
@keyframes blowRight {
  0% { transform: translateX(-50vw); }
  100% { transform: translateX(150vw); }
}

@keyframes blowLeft {
  0% { transform: translateX(150vw); }
  100% { transform: translateX(-50vw); }
}

.wind-blow-right {
  animation: blowRight 0.8s linear infinite;
  opacity: 0.6;
  font-style: italic;
}

.wind-blow-left {
  animation: blowLeft 0.8s linear infinite;
  opacity: 0.6;
  font-style: italic;
}

/* 风力特效层 */
#wind-effect {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 9999;
  display: none;
}

.wind-line {
  position: absolute;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
  height: 4px;
  border-radius: 50%;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

@keyframes anim-wind-right {
  0% { left: -200px; opacity: 0; }
  10% { opacity: 0.9; }
  90% { opacity: 0.9; }
  100% { left: 100%; opacity: 0; }
}

@keyframes anim-wind-left {
  0% { right: -200px; left: auto; opacity: 0; }
  10% { opacity: 0.9; }
  90% { opacity: 0.9; }
  100% { right: 100%; opacity: 0; }
}

/* 纯 CSS 风效覆盖层 */
#wind-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  background-image: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 40px,
    rgba(255, 255, 255, 0.15) 40px,
    rgba(255, 255, 255, 0.15) 42px
  );
  background-size: 200% 100%;
}

.wind-anim-right {
  animation: windSlideRight 0.4s linear infinite;
}

.wind-anim-left {
  animation: windSlideLeft 0.4s linear infinite;
}

@keyframes windSlideRight {
  from { background-position: -100% 0; }
  to { background-position: 0 0; }
}

@keyframes windSlideLeft {
  from { background-position: 0 0; }
  to { background-position: -100% 0; }
}

/* 排行榜弹窗 */
#leaderboard-modal {
  position: fixed !important;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.9) !important;
  backdrop-filter: blur(10px);
  z-index: 999999 !important;
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: rgba(15, 23, 42, 0.95);
  border: 2px solid rgba(6, 182, 212, 0.6);
  border-radius: 20px;
  padding: 30px 40px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 40px rgba(6, 182, 212, 0.4);
}

.modal-content h2 {
  color: #06b6d4;
  text-align: center;
  margin-bottom: 20px;
  font-size: 28px;
  text-shadow: 0 0 10px rgba(6, 182, 212, 0.8);
}

#leaderboard-list {
  list-style: none;
  padding: 0;
  margin: 20px 0;
  min-height: 100px;
  color: #fff;
}

#leaderboard-list li {
  padding: 12px 20px;
  margin: 8px 0;
  background: rgba(6, 182, 212, 0.1);
  border-left: 4px solid #06b6d4;
  border-radius: 8px;
  font-size: 18px;
  color: #fff;
  transition: all 0.3s ease;
}

#leaderboard-list li:hover {
  background: rgba(6, 182, 212, 0.2);
  transform: translateX(5px);
}

#restart-btn {
  width: 100%;
  padding: 15px;
  margin-top: 20px;
  font-size: 18px;
  font-weight: 600;
  background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 212, 255, 0.4);
}

#restart-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 212, 255, 0.6);
}

.leaderboard-section {
  margin: 20px 0;
}

.leaderboard-section h3 {
  color: #00d4ff;
  font-size: 20px;
  margin-bottom: 10px;
  border-bottom: 2px solid rgba(6, 182, 212, 0.4);
  padding-bottom: 8px;
}

.leaderboard-section ol {
  list-style: none;
  padding: 0;
  margin: 0;
}

.leaderboard-section ol li {
  background: rgba(255, 255, 255, 0.05);
  margin: 8px 0;
  padding: 12px 15px;
  border-radius: 8px;
  color: #e2e8f0;
  font-size: 16px;
  border-left: 3px solid #06b6d4;
}

#restart-btn {
  width: 100%;
  padding: 15px;
  margin-top: 20px;
  font-size: 18px;
  font-weight: 600;
  background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 212, 255, 0.4);
}

#restart-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 212, 255, 0.6);
}

#restart-btn:active {
  transform: translateY(0);
}
