/* --- Multiplayer UI --- */

#mp-section { display: none; flex: 1; }
#mp-section:not(.hidden) {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Menu */
.mp-menu, .mp-lobby {
  text-align: center;
  max-width: 400px;
  width: 90vw;
  -webkit-user-select: text;
  user-select: text;
}

.mp-menu h2, .mp-lobby h2 {
  font-size: 1.5rem;
  color: #5a2d0c;
  margin-bottom: 20px;
}

.mp-menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}

.mp-difficulty-select {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.mp-difficulty-select label {
  font-size: 0.9rem;
  color: #7a5a3a;
  font-weight: 600;
}

.mp-diff-buttons {
  display: flex;
  gap: 8px;
}

.mp-primary-btn {
  background: #c0453a;
  color: #fff;
  border: 3px solid #a03028;
  padding: 12px 32px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  transition: background 0.15s, transform 0.1s;
  min-height: 48px;
}

.mp-primary-btn:hover { background: #d05548; }
.mp-primary-btn:active { transform: scale(0.96); }

.mp-divider {
  color: #b89878;
  font-size: 0.9rem;
  font-weight: 600;
}

.mp-join-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

#mp-join-input {
  padding: 10px 12px;
  border: 2px solid #c4944a;
  border-radius: 8px;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-align: center;
  text-transform: uppercase;
  width: 120px;
  background: #fff;
  color: #3a2010;
  font-family: inherit;
}

#mp-join-input:focus { outline: none; border-color: #c0453a; }

.mp-join-row .mp-primary-btn {
  padding: 10px 20px;
  font-size: 1rem;
}

.mp-back-btn {
  background: none;
  border: none;
  color: #7a5a3a;
  cursor: pointer;
  font-size: 0.9rem;
  margin-top: 16px;
  text-decoration: underline;
}

.mp-back-btn:hover { color: #5a2d0c; }

/* Lobby */
.mp-code-display {
  display: block;
  margin: 0 auto 20px;
  box-sizing: content-box;
  width: 5ch;
  padding: 14px 20px 14px 26px;     /* right padding less so letter-spacing doesn't push text left */
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: 0.3em;
  text-align: center;
  text-indent: 0;
  color: #c0453a;
  background: #fff;
  border: 3px solid #c4944a;
  border-radius: 12px;
  font-family: inherit;
  -webkit-user-select: all;
  user-select: all;
  -webkit-touch-callout: default;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.mp-code-display:focus {
  outline: none;
  border-color: #c0453a;
  box-shadow: 0 2px 12px rgba(192, 69, 58, 0.25);
}

.mp-waiting {
  color: #7a5a3a;
  margin-bottom: 20px;
  font-size: 1rem;
}

/* Game */
.mp-game {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100%;
}

.mp-header {
  flex-shrink: 0;
  text-align: center;
  margin-bottom: 8px;
  width: 100%;
}

.mp-turn {
  font-size: 1.1rem;
  font-weight: 700;
  color: #5a2d0c;
  margin-bottom: 4px;
}

.mp-scores {
  font-size: 0.9rem;
  color: #7a5a3a;
}

.mp-score {
  font-weight: 600;
}

.mp-score-active {
  color: #c0453a;
}

.mp-score-me {
  text-decoration: underline;
}

.mp-score-sep {
  margin: 0 8px;
  color: #b89878;
}

.mp-spectator-badge {
  display: inline-block;
  background: #7a5a3a;
  color: #f5ece0;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.mp-spectating .card {
  cursor: default;
}

.mp-grid {
  display: grid;
  width: fit-content;
  margin: 0 auto;
  align-content: center;
}

.mp-finished-buttons {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  align-items: center;
}

/* Toast */
.mp-toast {
  position: fixed;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: #5a2d0c;
  color: #f5ece0;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 300;
  animation: toast-fade 2s ease forwards;
}

@keyframes toast-fade {
  0% { opacity: 0; transform: translateX(-50%) translateY(10px); }
  15% { opacity: 1; transform: translateX(-50%) translateY(0); }
  85% { opacity: 1; }
  100% { opacity: 0; }
}

/* Responsive */
@media (max-width: 480px) {
  .mp-menu h2, .mp-lobby h2 { font-size: 1.2rem; }
  .mp-primary-btn { padding: 10px 24px; font-size: 1rem; }
  .mp-code-display { font-size: 2rem; padding: 12px 16px 12px 22px; }
  .mp-turn { font-size: 0.95rem; }
  .mp-scores { font-size: 0.8rem; }
  .mp-join-row { flex-direction: column; gap: 10px; width: 100%; }
  #mp-join-input { width: 100%; max-width: 220px; }
  .mp-join-row .mp-primary-btn { width: 100%; max-width: 220px; }
  .mp-menu-buttons { width: 100%; }
  .mp-finished-buttons { flex-direction: column; gap: 10px; width: 100%; max-width: 240px; }
  .mp-finished-buttons .mp-primary-btn { width: 100%; }
}
