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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #1a1a2e;
  color: #eee;
  min-height: 100vh;
}

/* ── Lobby ── */

.lobby-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: 16px;
}

.lobby-container h1 {
  font-size: 3rem;
  color: #e2b96f;
}

.subtitle {
  color: #999;
  margin-bottom: 16px;
}

form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 300px;
}

input[type="text"] {
  padding: 12px 16px;
  border: 2px solid #333;
  border-radius: 8px;
  background: #16213e;
  color: #eee;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

input[type="text"]:focus,
select:focus {
  border-color: #e2b96f;
}

select {
  padding: 12px 16px;
  border: 2px solid #333;
  border-radius: 8px;
  background: #16213e;
  color: #eee;
  font-size: 1rem;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
  appearance: auto;
}

button {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  background: #e2b96f;
  color: #1a1a2e;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
}

button:hover {
  background: #c9a050;
}

.error {
  color: #ff6b6b;
  font-size: 0.9rem;
}

.hidden {
  display: none !important;
}

/* ── Game Page ── */

#game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  gap: 12px;
}

#game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: var(--board-size, 480px);
  gap: 12px;
  min-height: 40px;
}

.player-info {
  background: #16213e;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: bold;
  font-size: 0.9rem;
  white-space: nowrap;
}

#status-bar {
  background: #0f3460;
  padding: 8px 16px;
  border-radius: 8px;
  text-align: center;
  flex: 1;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  overflow: hidden;
  min-height: 36px;
}

#game-mode-label {
  background: #e2b96f;
  color: #1a1a2e;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: bold;
  text-transform: uppercase;
}

#phaser-container {
  border: 3px solid #333;
  border-radius: 4px;
  line-height: 0;
}

#phaser-container canvas {
  display: block;
}

/* ── Share Link ── */

#share-link {
  text-align: center;
  margin-top: 8px;
}

#share-link p {
  color: #999;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.link-box {
  display: flex;
  gap: 8px;
}

.link-box input {
  flex: 1;
  padding: 8px 12px;
  border: 2px solid #333;
  border-radius: 8px;
  background: #16213e;
  color: #e2b96f;
  font-size: 0.85rem;
  min-width: 300px;
}

.link-box button {
  padding: 8px 16px;
  font-size: 0.85rem;
}

/* ── Bottom Panels (Moves + Chat) ── */

#bottom-panels {
  display: flex;
  width: var(--board-size, 480px);
  gap: 12px;
  margin-top: 12px;
}

#move-history {
  flex: 1;
  min-width: 0;
}

#move-history h3,
#chat-panel h3 {
  color: #999;
  font-size: 0.85rem;
  margin-bottom: 6px;
}

#move-list {
  background: #16213e;
  border-radius: 8px;
  padding: 8px 12px;
  max-height: 150px;
  overflow-y: auto;
  font-family: monospace;
  font-size: 0.85rem;
}

.move-row {
  padding: 2px 0;
}

.move-num {
  color: #666;
  margin-right: 4px;
}

/* ── Chat ── */

#chat-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

#chat-messages {
  background: #16213e;
  border-radius: 8px;
  padding: 8px 12px;
  max-height: 120px;
  min-height: 80px;
  overflow-y: auto;
  font-size: 0.85rem;
  flex: 1;
}

.chat-msg {
  padding: 2px 0;
  word-break: break-word;
}

.chat-msg .chat-name {
  font-weight: bold;
  margin-right: 4px;
}

.chat-name.white {
  color: #f0d9b5;
}

.chat-name.black {
  color: #b58863;
}

#chat-form {
  display: flex;
  flex-direction: row;
  gap: 6px;
  margin-top: 6px;
  width: auto;
}

#chat-form input {
  flex: 1;
  padding: 6px 10px;
  border: 2px solid #333;
  border-radius: 6px;
  background: #16213e;
  color: #eee;
  font-size: 0.85rem;
  outline: none;
  min-width: 0;
}

#chat-form input:focus {
  border-color: #e2b96f;
}

#chat-form button {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: 6px;
}

/* ── Overlays ── */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.overlay-content {
  background: #16213e;
  padding: 32px;
  border-radius: 16px;
  text-align: center;
  min-width: 300px;
}

.overlay-content h2 {
  color: #e2b96f;
  margin-bottom: 16px;
}

.overlay-content p {
  color: #999;
  margin-bottom: 20px;
}

/* ── Scrollbar ── */

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 3px;
}
