* {
  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: 500px;
  width: 100%;
}

.game-title {
  text-align: center;
  font-size: 32px;
  margin-bottom: 15px;
  color: #e94560;
  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: 15px;
  color: #e74c3c !important;
}

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

.game-panel {
  position: relative;
  background: #000;
  border: 3px solid #e94560;
  border-radius: 5px;
}

#game-canvas {
  display: block;
}

/* 右侧信息面板 */
.side-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 120px;
}

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

.info-label {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  margin-bottom: 5px;
}

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

/* 下一个方块 */
.next-piece {
  background: rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}

#next-canvas {
  margin-top: 8px;
  background: #111;
  border-radius: 5px;
}

/* 遮罩界面 */
.overlay-screen {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10;
  border-radius: 5px;
}

.overlay-screen h2 {
  font-size: 28px;
  color: #e94560;
  margin-bottom: 15px;
}

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

.start-btn {
  background: linear-gradient(135deg, #e94560 0%, #c0392b 100%);
  color: white;
  border: none;
  padding: 14px 32px;
  font-size: 16px;
  font-weight: bold;
  border-radius: 25px;
  cursor: pointer;
  margin-top: 15px;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 15px rgba(233, 69, 96, 0.4);
}

.start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(233, 69, 96, 0.5);
}

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

/* 排行榜 */
.ranking-section {
  margin-top: 25px;
  background: rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 20px;
}

.ranking-section h3 {
  font-size: 18px;
  color: #f39c12;
  margin-bottom: 15px;
  text-align: center;
}

#ranking-content {
  min-height: 80px;
}

#ranking-loading {
  text-align: center;
  color: rgba(255,255,255,0.6);
  padding: 20px;
}

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

.ranking-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
}

.ranking-item .rank {
  width: 30px;
  font-weight: bold;
  color: #f39c12;
}

.ranking-item .player {
  flex: 1;
  color: rgba(255,255,255,0.9);
}

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

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

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

/* 响应式 */
@media (max-width: 500px) {
  .game-container {
    flex-direction: column;
    align-items: center;
  }
  
  .side-panel {
    flex-direction: row;
    flex-wrap: wrap;
    width: 100%;
    justify-content: center;
  }
  
  .info-card {
    flex: 1;
    min-width: 70px;
  }
  
  .next-piece {
    width: 100%;
  }
  
  .home-btn {
    width: 100%;
  }
}

/* 返回主页按钮 */
.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);
}

/* 虚拟方向键按钮 */
.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(233, 69, 96, 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(233, 69, 96, 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: 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;
  }
}