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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 20px;
  color: white;
}

.game-wrapper {
  max-width: 600px;
  width: 100%;
}

.game-title {
  text-align: center;
  font-size: 32px;
  margin-bottom: 15px;
  color: #2ecc71;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

/* 用户信息栏 */
.user-info {
  text-align: center;
  padding: 12px;
  background: rgba(255,255,255,0.1);
  border-radius: 10px;
  margin-bottom: 20px;
  font-size: 14px;
}

.user-info a {
  color: #3498db;
  text-decoration: none;
}

.user-info a:hover {
  text-decoration: underline;
}

.user-info .divider {
  margin: 0 10px;
  color: rgba(255,255,255,0.3);
}

.logout-link {
  margin-left: 10px;
  color: #e74c3c !important;
}

/* 游戏容器 */
.game-container {
  display: flex;
  gap: 20px;
  justify-content: center;
  align-items: flex-start;
}

.game-panel {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

#game-canvas {
  display: block;
  background: #111;
  border: 3px solid #2ecc71;
}

/* 覆盖屏幕 */
.overlay-screen {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.overlay-screen h2 {
  font-size: 36px;
  margin-bottom: 20px;
  color: #2ecc71;
}

.overlay-screen p {
  font-size: 14px;
  color: rgba(255,255,255,0.7);
  margin-bottom: 8px;
  text-align: center;
}

.start-btn {
  margin-top: 20px;
  padding: 15px 40px;
  font-size: 18px;
  font-weight: bold;
  background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
  color: white;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 15px rgba(46, 204, 113, 0.4);
}

.start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(46, 204, 113, 0.5);
}

.start-btn:active {
  transform: translateY(0);
}

/* 右侧面板 */
.side-panel {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 140px;
}

.next-piece {
  background: rgba(0,0,0,0.3);
  border-radius: 8px;
  padding: 10px;
  text-align: center;
}

.info-label {
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 5px;
}

.info-value {
  font-size: 24px;
  font-weight: bold;
  color: #f1c40f;
}

.info-card {
  background: rgba(0,0,0,0.3);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}

/* 返回主页按钮 */
.home-btn {
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  color: white;
  text-decoration: none;
  text-align: center;
  padding: 12px;
  border-radius: 8px;
  font-weight: bold;
  transition: transform 0.15s, box-shadow 0.15s;
  display: block;
}

.home-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(52, 152, 219, 0.5);
}

/* 操作提示 */
.controls-hint {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: rgba(255,255,255,0.5);
}

.controls-hint p {
  margin-bottom: 5px;
}

/* 排行榜 */
.ranking-section {
  margin-top: 30px;
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
  padding: 15px;
}

.ranking-section h3 {
  text-align: center;
  margin-bottom: 15px;
  color: #f1c40f;
}

.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ranking-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(0,0,0,0.3);
  border-radius: 6px;
}

.ranking-item.current-player {
  background: rgba(46, 204, 113, 0.2);
  border: 1px solid rgba(46, 204, 113, 0.3);
}

.ranking-item .rank {
  font-size: 18px;
  width: 30px;
}

.ranking-item .player {
  flex: 1;
  margin-left: 10px;
  font-size: 14px;
}

.ranking-item .score {
  font-weight: bold;
  color: #f1c40f;
}

.ranking-empty {
  text-align: center;
  color: rgba(255,255,255,0.4);
  padding: 20px;
}

/* 虚拟方向键按钮 */
.virtual-controls {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
}

.vbtn {
  position: absolute;
  width: 60px;
  height: 60px;
  border: none;
  border-radius: 50%;
  background: rgba(46, 204, 113, 0.8);
  color: white;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.vbtn:active {
  transform: scale(0.9);
  background: rgba(46, 204, 113, 1);
}

.vbtn-up {
  bottom: 140px;
  left: -30px;
}

.vbtn-left {
  bottom: 70px;
  left: -100px;
}

.vbtn-down {
  bottom: 0;
  left: -30px;
}

.vbtn-right {
  bottom: 70px;
  left: 40px;
}

/* 响应式 */
@media (max-width: 600px) {
  .game-container {
    flex-direction: column;
    align-items: center;
  }
  
  .side-panel {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    gap: 10px;
  }
  
  .info-card {
    flex: 1;
    min-width: 80px;
  }
  
  .home-btn {
    width: 100%;
  }
  
  .game-title {
    font-size: 28px;
  }
  
  #game-canvas {
    width: 100%;
    max-width: 300px;
    height: auto;
  }
}

@media (max-width: 768px) {
  .virtual-controls {
    display: block;
  }
  
  .controls-hint {
    display: none;
  }
}

@media (max-width: 480px) {
  .vbtn {
    width: 50px;
    height: 50px;
    font-size: 20px;
  }
  
  .vbtn-up {
    bottom: 120px;
    left: -25px;
  }
  
  .vbtn-left {
    bottom: 60px;
    left: -85px;
  }
  
  .vbtn-down {
    bottom: 0;
    left: -25px;
  }
  
  .vbtn-right {
    bottom: 60px;
    left: 35px;
  }
}
