* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
  background: #1a1a2e;
  color: #eee;
  overflow: hidden;
  height: 100vh;
}

.screen {
  display: none;
  width: 100vw;
  height: 100vh;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.screen.active { display: flex; }

/* 登录 - 双栏布局 */
#login-screen .login-layout {
  display: flex;
  gap: 20px;
  max-width: 900px;
  width: 95%;
  align-items: stretch;
}

#login-screen .panel {
  background: #16213e;
  padding: 40px;
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

#login-screen .login-panel {
  flex: 1;
  max-width: 440px;
}

#login-screen h1 {
  font-size: 2.4em;
  color: #4ecdc4;
  margin-bottom: 8px;
}

.subtitle { color: #aaa; margin-bottom: 24px; }

/* 房间列表面板 */
.room-list-panel {
  flex: 1;
  max-width: 400px;
  text-align: left !important;
  display: flex;
  flex-direction: column;
}

.room-list-panel h3 {
  color: #4ecdc4;
  margin-bottom: 12px;
  font-size: 18px;
  text-align: center;
}

.room-list {
  flex: 1;
  overflow-y: auto;
  max-height: 400px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.room-card {
  background: #0f3460;
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 12px 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.room-card:hover {
  border-color: #4ecdc4;
  background: #1a4a7a;
}

.room-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.room-card-id {
  font-size: 16px;
  font-weight: bold;
  color: #f7dc6f;
  letter-spacing: 2px;
}

.room-card-count {
  font-size: 14px;
  color: #4ecdc4;
  font-weight: bold;
}

.room-card-host {
  font-size: 12px;
  color: #888;
}

.room-list-empty {
  text-align: center;
  color: #666;
  padding: 40px 0;
}

.room-list-hint {
  text-align: center;
  color: #555;
  font-size: 12px;
  margin-top: 8px;
}

input[type="text"] {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #0f3460;
  border-radius: 8px;
  background: #0f3460;
  color: #fff;
  font-size: 16px;
  margin-bottom: 16px;
  outline: none;
}

input[type="text"]:focus { border-color: #4ecdc4; }

button {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: #4ecdc4;
  color: #1a1a2e;
  font-weight: bold;
  width: 100%;
}

.btn-primary:hover { background: #3dbdb4; }

.btn-secondary {
  background: #0f3460;
  color: #fff;
}

.btn-secondary:hover { background: #1a4a7a; }

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
  background: #333;
  color: #fff;
  border-radius: 6px;
}

.hidden { display: none !important; }

.rules-preview {
  margin-top: 24px;
  text-align: left;
  background: #0f3460;
  padding: 16px;
  border-radius: 8px;
}

.rules-preview h3 { color: #4ecdc4; margin-bottom: 8px; }

.rules-preview ul { padding-left: 20px; }

.rules-preview li { margin: 6px 0; color: #ccc; }

.rules-preview strong { color: #4ecdc4; }

/* 大厅 */
#lobby-screen { padding: 40px; }

.lobby-header {
  width: 100%;
  max-width: 600px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.lobby-actions {
  display: flex;
  gap: 16px;
  align-items: center;
}

.join-box { display: flex; gap: 8px; }

.join-box input { width: 120px; margin: 0; }

/* 房间 */
#room-screen { padding: 40px; }

.room-header {
  width: 100%;
  max-width: 600px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.room-body { width: 100%; max-width: 600px; }

.player-list {
  background: #16213e;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  min-height: 200px;
}

.player-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 8px;
  background: #0f3460;
}

.player-color {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  margin-right: 12px;
}

.player-name { flex: 1; }

.player-status {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 4px;
}

.status-ready { background: #2ecc71; color: #000; }
.status-waiting { background: #f39c12; color: #000; }

.room-actions { display: flex; gap: 12px; }
.room-actions button { flex: 1; }

/* 游戏界面 */
#game-screen { padding: 0; }

.game-layout {
  display: flex;
  width: 100vw;
  height: 100vh;
}

.game-viewport {
  flex: 1;
  position: relative;
  background: #000;
  overflow: hidden;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.game-overlay {
  position: absolute;
  top: 0; left: 0; right: 0;
  pointer-events: none;
  padding: 16px;
}

.spectator-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 48px;
  color: #f7dc6f;
  text-shadow: 0 0 20px rgba(247,220,111,0.5);
  font-weight: bold;
  pointer-events: none;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.round-info {
  display: flex;
  gap: 20px;
  font-size: 18px;
  font-weight: bold;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

#round-display { color: #4ecdc4; }
#map-name { color: #f7dc6f; }
#timer-display { color: #e94560; }

.ranking {
  position: absolute;
  top: 16px; right: 16px;
  background: rgba(0,0,0,0.7);
  padding: 12px;
  border-radius: 8px;
  min-width: 180px;
}

.rank-item {
  display: flex;
  align-items: center;
  padding: 4px 0;
  font-size: 14px;
}

.rank-num { width: 24px; color: #f7dc6f; }

.rank-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: 8px;
}

/* 右侧面板 */
.game-panel {
  width: 420px;
  background: #16213e;
  display: flex;
  flex-direction: column;
  border-left: 2px solid #0f3460;
}

.panel-section {
  padding: 12px;
  border-bottom: 1px solid #0f3460;
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.panel-section h3 {
  color: #4ecdc4;
  font-size: 14px;
  margin-bottom: 8px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.code-block {
  flex: 1;
  width: 100%;
  background: #0a0a1a;
  color: #96ceb4;
  border: 1px solid #1a4a7a;
  border-radius: 6px;
  padding: 10px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 11px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.cmd-row {
  display: flex;
  gap: 8px;
}

.cmd-row input {
  flex: 1;
  margin: 0;
  font-size: 14px;
  padding: 8px 12px;
}

#game-state {
  font-size: 10px;
  color: #ccc;
}

#game-logs {
  flex: 1;
  overflow: auto;
  font-size: 12px;
  color: #aaa;
}

.log-entry {
  padding: 2px 0;
  border-bottom: 1px solid #1a1a2e;
}

/* 结果 */
#result-screen .panel {
  background: #16213e;
  padding: 40px;
  border-radius: 16px;
  text-align: center;
  max-width: 600px;
  width: 90%;
}

#winner-display { margin: 24px 0; }

.winner-card {
  display: inline-block;
  margin: 8px;
  padding: 20px;
  border-radius: 12px;
  background: #0f3460;
}

.winner-card.gold { border: 2px solid #f7dc6f; }
.winner-card.silver { border: 2px solid #bdc3c7; }
.winner-card.bronze { border: 2px solid #e67e22; }

.winner-rank {
  font-size: 32px;
  font-weight: bold;
}

.gold .winner-rank { color: #f7dc6f; }
.silver .winner-rank { color: #bdc3c7; }
.bronze .winner-rank { color: #e67e22; }

@media (max-width: 900px) {
  .login-layout { flex-direction: column; align-items: center; }
  .room-list-panel { max-width: 440px; width: 100%; }
  .room-list { max-height: 250px; }
  .game-layout { flex-direction: column; }
  .game-panel { width: 100%; height: 40vh; border-left: none; border-top: 2px solid #0f3460; }
}
