@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
}

html, body {
  height: 100%; /* Fix body height */
  overflow: hidden; /* Prevent global scroll */
  background: linear-gradient(135deg, #1e293b, #0f172a);
  color: #f1f5f9;
  line-height: 1.6;
}

/* Global Back Button */
/* Global Back Button intentionally removed */

/* ================= SCREENS ================= */

.screen {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow-y: auto; /* Enable internal scroll */
  -webkit-overflow-scrolling: touch; /* Smooth iOS scroll */
}

.screen.active {
  display: block;
}

#gameScreen.active {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden; /* Game screen manages its own scroll (panels) */
}

@media (max-width: 900px) {
  #gameScreen.active {
    height: 100dvh; /* Use dynamic viewport height for mobile */
    min-height: 0;
    overflow: hidden; /* Lock body scroll */
  }
}

/* Ensure range inputs work on mobile */
input[type="range"] {
  touch-action: pan-x;
}





/* ================= LOBBY ================= */

.main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.main h1 {
  font-size: 3rem;
  margin-bottom: 30px;
  color: #0ea5e9;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.box {
  background: rgba(255, 255, 255, 0.1);
  padding: 30px;
  border-radius: 20px;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.input-layout {
  display: flex;
  gap: 15px;
  align-items: center;
}

input, select, button {
  padding: 12px 16px;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  transition: all 0.3s ease;
}

input, select {
  background: rgba(255, 255, 255, 0.15);
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

input::placeholder {
  color: #cbd5e1;
}

select {
  cursor: pointer;
}

button {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  color: white;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(14, 165, 233, 0.4);
}

#avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  align-self: center;
  border: 3px solid rgba(255, 255, 255, 0.2);
}

/* ================= SETTINGS ================= */

.settings-container {
  display: flex;
  gap: 30px;
  max-width: 1200px;
  margin: 80px auto;
  padding: 20px;
  justify-content: center;
  align-items: flex-start;
}

.settings-box {
  flex: 1;
  max-width: 500px;
  padding: 30px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-box h2 {
  text-align: center;
  color: #0ea5e9;
  font-size: 1.8rem;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.setting-row label {
  font-weight: 500;
  flex: 1;
}

.setting-row select {
  flex: 1;
}

.room-code-row {
  display: flex;
  justify-content: center;   
  align-items: center;       
  gap: 10px;
  margin-bottom: 20px;
  width: 100%;
  height: 50px;              
  font-size: 12px;
}

.room-code-row p {
  display: flex;
  justify-content: center;   
  align-items: center;       
  margin: 0;
  height: 100%;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
}

.room-code-row button {
  padding: 4px 6px;
  background: #0ea5e9;
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.3s ease;
}

.room-code-row button:hover {
  background: #0284c7;
}


.room-info {
  flex: 0 0 300px;
  padding: 30px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.room-info h3 {
  text-align: center;
  color: #0ea5e9;
  font-size: 1.5rem;
  margin-bottom: 20px;
}

.room-info p {
  margin-bottom: 15px;
  font-weight: 500;
}

.players-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.player {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

.player img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.player span {
  font-weight: 500;
}

.drawing-icon {
  margin-left: auto;
  font-size: 1.2rem;
}

/* ================= GAME ================= */

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-wrap: wrap;
  gap: 10px;
}

#wordDisplay {
  text-align: center;
  font-size: 2.2rem;
  margin: 20px 0;
  letter-spacing: 10px;
  font-weight: 600;
  color: #fbbf24;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* ===== FLEX LAYOUT ===== */

.game-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  gap: 15px;
  padding: 15px;
  box-sizing: border-box;
}

/* Desktop: canvas-section takes center, players-panel and chat-panel on sides */
.canvas-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  order: 2;
}

/* Players Panel */
.players-panel {
  flex: 0 0 18%;
  background: rgba(255, 255, 255, 0.08);
  padding: 15px;
  border-radius: 15px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  order: 1;
}

.players-panel h3 {
  margin-bottom: 15px;
  color: #0ea5e9;
}

.players-panel ul {
  list-style: none;
}

.players-panel li {
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Canvas Panel */
.canvas-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}


.drawer-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  width: 100%;
  max-width: 300px;
}

.drawer-info img {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.drawer-details {
  display: flex;
  flex-direction: column;
}

.drawer-name {
  font-weight: 600;
  color: #fbbf24;
}

.drawer-status {
  font-size: 0.9rem;
  color: #cbd5e1;
}

#board {
  max-width: 100%;
  max-height: 100%;
  background: white;
  border-radius: 15px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  touch-action: none;
  display: block;
  margin: 0 auto;
}

/* ================= TOOLBAR ================= */

.toolbar {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px;
  justify-content: center;
  align-items: center;
  background: rgba(255,255,255,0.08);
  border-radius: 12px;
  backdrop-filter: blur(10px);
}

.toolbar input[type="range"] {
  width: 120px;
  cursor: pointer;
}

.toolbar input[type="color"] {
  width: 45px;
  height: 40px;
  border: none;
  border-radius: 8px;
  padding: 2px;
  cursor: pointer;
  background: white;
}

.toolbar button {
  padding: 8px 14px;
  font-size: 0.9rem;
  border-radius: 8px;
  background: linear-gradient(135deg,#0ea5e9,#0284c7);
  border: none;
  color: white;
  font-weight: 500;
  cursor: pointer;
  transition: 0.2s;
}

.toolbar button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(14,165,233,0.4);
}

#eraserBtn.active {
  background: linear-gradient(135deg,#ef4444,#dc2626);
}

/* Chat Panel — desktop: right column */
.chat-panel {
  flex: 0 0 20%;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 15px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  order: 3;
}

.chat-messages {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
}

.chat-messages p {
  margin-bottom: 10px;
}

/* Chat Input Bar — inside chat-panel on desktop, full-width on mobile */
.chat-input-bar {
  display: flex;
  padding: 10px;
  gap: 8px;
  border-top: 1px solid rgba(255,255,255,0.1);
  align-items: center;
}

.chat-input-bar input {
  flex: 1;
  background: rgba(255, 255, 255, 0.15);
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
}

.chat-input-bar button {
  padding: 10px 16px;
  background: #0ea5e9;
  flex-shrink: 0;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  color: white;
  cursor: pointer;
}


/* Bottom section — hidden on desktop, players+chat panels live at top level */
.bottom-section {
  display: contents;
}

/* ================= GUESSED PLAYER GREEN BG ================= */

.player-guessed-bg {
  background: rgba(34, 197, 94, 0.2) !important;
  border: 1px solid rgba(34, 197, 94, 0.4);
  border-radius: 10px;
}

/* ================= MOBILE (≤768px) ================= */

@media (max-width: 768px) {
  .main h1 {
    font-size: 2rem;
  }

  .box {
    padding: 15px;
    max-width: 100%;
  }

  .input-layout {
    flex-direction: column;
    gap: 10px;
  }

  .settings-container {
    flex-direction: column;
    align-items: center;
    margin: 50px auto;
    gap: 12px;
  }

  .settings-box {
    max-width: 100%;
    padding: 12px;
  }

  .room-info {
    max-width: 100%;
    flex: none;
    padding: 12px;
  }

  .room-info h3 {
    font-size: 1.1rem;
    margin-bottom: 10px;
  }

  .setting-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .setting-row label {
    font-size: 0.8rem;
  }

  .setting-row select, .setting-row input {
    font-size: 0.8rem;
    padding: 6px 8px;
  }

  /* TOP BAR — compact */
  .top-bar {
    padding: 6px 10px;
    font-size: 0.75rem;
    gap: 6px;
  }

  #wordDisplay {
    font-size: 1.1rem;
    margin: 4px 0;
    letter-spacing: 4px;
  }

  /* GAME LAYOUT — vertical stack with bottom padding for fixed input */
  .game-layout {
    flex-direction: column;
    gap: 4px;
    padding: 4px;
    padding-bottom: calc(60px + env(safe-area-inset-bottom)); /* space for fixed chat input bar */
    flex: 1;
  }

  /* Section 1: Canvas + toolbar (on top) */
  .canvas-section {
    flex: 0 0 auto;
    order: 1;
  }

  .canvas-panel {
    gap: 4px;
  }

  #board {
    max-height: 42vh;
    border-radius: 8px;
  }

  /* Section 2: Players + Chat side by side — FILL available height */
  .bottom-section {
    display: flex;
    flex-direction: row;
    gap: 4px;
    flex: 1;
    min-height: 0;
    order: 2;
  }

  /* PLAYERS PANEL — fill height */
  .players-panel {
    flex: 1;
    order: 1;
    padding: 6px;
    overflow-y: auto;
    border-radius: 8px;
  }

  .players-panel h3 {
    font-size: 0.7rem;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .players-list {
    gap: 3px;
  }

  .player {
    padding: 4px 6px;
    gap: 5px;
    border-radius: 6px;
  }

  .player img {
    width: 22px;
    height: 22px;
    border-width: 1px;
  }

  .player span {
    font-size: 0.65rem;
    font-weight: 500;
  }

  .player span small {
    font-size: 0.55rem;
  }

  .player-rank {
    font-size: 0.6rem !important;
    min-width: 16px !important;
  }

  .player-guessed {
    font-size: 0.7rem !important;
  }

  .drawing-icon {
    font-size: 0.7rem !important;
  }

  /* CHAT PANEL — fill height, hide input (it's fixed at bottom) */
  .chat-panel {
    flex: 1;
    order: 2;
    border-radius: 8px;
  }

  .chat-messages {
    padding: 6px;
    font-size: 0.7rem;
  }

  .chat-messages p {
    margin-bottom: 4px;
    line-height: 1.3;
    word-wrap: break-word;
  }

  /* System & special messages — small font on mobile */
  .chat-messages .system-msg,
  .chat-messages .close-guess-msg,
  .chat-messages .guessed-msg {
    font-size: 0.65rem;
  }

  /* CHAT INPUT BAR — fixed at viewport bottom */
  .chat-input-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 6px 8px;
    padding-bottom: max(6px, env(safe-area-inset-bottom)); /* Handle notch/home indicator */
    gap: 6px;
    background: rgba(15, 23, 42, 0.97);
    border-top: 1px solid rgba(255,255,255,0.15);
    border-radius: 0;
    z-index: 100;
  }

  .chat-input-bar input {
    padding: 8px 10px;
    font-size: 16px; /* Prevents zoom on iOS focus */
    border-radius: 6px;
  }


  .chat-input-bar button {
    padding: 8px 12px;
    font-size: 0.75rem;
    border-radius: 6px;
  }

  /* BACK BUTTON */
  #backButton {
    top: 6px;
    left: 6px;
    padding: 5px 8px;
    font-size: 0.75rem;
  }

  .screen:not(#lobbyScreen) .top-bar {
    padding-left: 50px;
  }

  /* TOOLBAR — compact */
  .toolbar {
    gap: 4px;
    padding: 5px;
    border-radius: 8px;
  }

  .toolbar input[type="range"] {
    width: 60px;
    height: 16px;
  }

  .toolbar input[type="color"] {
    width: 26px;
    height: 24px;
    border-radius: 4px;
  }

  .toolbar button {
    padding: 3px 6px;
    font-size: 0.6rem;
    border-radius: 5px;
  }

  .shape-btn {
    padding: 2px 5px !important;
    font-size: 0.75rem !important;
    border-radius: 4px !important;
  }

  /* Scrollbar Styling */
  .chat-messages::-webkit-scrollbar,
  .players-panel::-webkit-scrollbar {
    width: 3px;
  }

  .chat-messages::-webkit-scrollbar-thumb,
  .players-panel::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
  }
}

/* ================= SMALL PHONE (≤400px) ================= */

@media (max-width: 400px) {
  .main h1 {
    font-size: 1.5rem;
  }

  .box {
    padding: 10px;
  }

  .top-bar {
    flex-direction: row;
    padding: 4px 8px;
    font-size: 0.65rem;
    gap: 4px;
  }

  #wordDisplay {
    font-size: 0.95rem;
    letter-spacing: 2px;
    margin: 3px 0;
  }

  .game-layout {
    gap: 3px;
    padding: 3px;
    padding-bottom: 40px;
  }

  .players-panel {
    padding: 4px;
  }

  .players-panel h3 {
    font-size: 0.6rem;
    margin-bottom: 3px;
  }

  .player {
    padding: 3px 4px;
    gap: 4px;
  }

  .player img {
    width: 18px;
    height: 18px;
  }

  .player span {
    font-size: 0.58rem;
  }

  .player span small {
    font-size: 0.5rem;
  }

  .chat-messages {
    padding: 4px;
    font-size: 0.65rem;
  }

  .chat-messages p {
    margin-bottom: 3px;
  }

  .chat-messages .system-msg,
  .chat-messages .close-guess-msg,
  .chat-messages .guessed-msg {
    font-size: 0.58rem;
  }

  .chat-input-bar {
    padding: 4px 6px;
    gap: 4px;
  }

  .chat-input-bar input {
    padding: 6px 8px;
    font-size: 0.7rem;
  }

  .chat-input-bar button {
    padding: 6px 10px;
    font-size: 0.65rem;
  }

  .toolbar {
    gap: 3px;
    padding: 4px;
  }

  .toolbar button {
    font-size: 0.55rem;
    padding: 2px 4px;
  }

  .toolbar input[type="range"] {
    width: 50px;
  }

  .toolbar input[type="color"] {
    width: 22px;
    height: 20px;
  }

  #board {
    max-height: 38vh;
    border-radius: 6px;
  }

  .shape-btn {
    padding: 1px 4px !important;
    font-size: 0.65rem !important;
  }

  #backButton {
    padding: 3px 6px;
    font-size: 0.65rem;
  }
}



/* ================= LANDSCAPE MOBILE ================= */

@media (max-height: 500px) and (orientation: landscape) {
  .game-layout {
    flex-direction: row;
    height: calc(100vh - 80px);
    padding: 8px;
    gap: 8px;
  }

  .canvas-section {
    flex: 0 0 60%;
    order: 1;
  }

  .bottom-section {
    display: flex;
    flex-direction: column;
    flex: 0 0 38%;
    gap: 6px;
    order: 2;
  }

  .players-panel {
    flex: 0 0 40%;
    max-height: none;
  }

  .chat-panel {
    flex: 1;
    max-height: none;
  }

  .chat-input-bar {
    order: 3;
    position: static;
  }

  #wordDisplay {
    font-size: 1.2rem;
    margin: 6px 0;
  }
}


/* ================= UTILITY CLASSES ================= */

.hidden {
  display: none !important;
}

.center {
  display: flex;
  justify-content: center;
  align-items: center;
}

.text-center {
  text-align: center;
}

/* ================= ANIMATIONS ================= */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.screen.active {
  animation: fadeIn 0.3s ease;
}

/* ================= BUTTON STATES ================= */

button:active {
  transform: scale(0.97);
}

/* Disabled button */
button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

/* ================= INPUT FOCUS ================= */

input:focus,
select:focus {
  outline: none;
  border: 1px solid #0ea5e9;
  box-shadow: 0 0 0 2px rgba(14,165,233,0.2);
}

/* ================= CANVAS CURSOR ================= */

#board {
  cursor: crosshair;
}

/* When eraser active (add class via JS) */
.eraser-active #board {
  cursor: not-allowed;
}

/* ================= ROOM PLAYER HIGHLIGHT ================= */

.player.current {
  background: rgba(14,165,233,0.2);
  border: 1px solid rgba(14,165,233,0.4);
}

/* Drawer highlight */
.player.drawing {
  background: rgba(251,191,36,0.2);
  border: 1px solid rgba(251,191,36,0.5);
}

/* ================= CHAT MESSAGE TYPES ================= */

.chat-messages .system {
  color: #38bdf8;
  font-style: italic;
}

.chat-messages .correct {
  color: #22c55e;
  font-weight: 600;
}

.chat-messages .wrong {
  color: #ef4444;
}

/* ================= FINAL SAFE FIXES ================= */

/* Prevent layout overflow */
body, html {
  overflow-x: hidden;
}

/* Smooth font rendering */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ================= OVERLAYS ================= */

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
}

.overlay.hidden {
  display: none;
}

.overlay-content {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 40px;
  text-align: center;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.overlay-content h2 {
  color: #0ea5e9;
  font-size: 1.8rem;
  margin-bottom: 20px;
}

/* Word Choice Buttons */
#wordChoices {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 15px;
}

.word-choice-btn {
  padding: 15px 25px;
  font-size: 1.2rem;
  font-weight: 600;
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: capitalize;
}

.word-choice-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(14, 165, 233, 0.5);
}

/* Scoreboard */
#finalScoreboard {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 15px;
  max-height: 300px;
  overflow-y: auto;
}

.score-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 15px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
}

.score-row img {
  width: 35px;
  height: 35px;
  border-radius: 50%;
}

.score-row .score-name {
  flex: 1;
  text-align: left;
  font-weight: 500;
}

.score-row .score-value {
  font-weight: 700;
  color: #fbbf24;
}

.score-row.winner {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(251, 191, 36, 0.05));
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.score-rank {
  font-weight: 700;
  color: #0ea5e9;
  min-width: 25px;
}

/* Close guess message */
.chat-messages .close-msg {
  color: #f59e0b;
  font-weight: 500;
}

#backToLobbyBtn {
  margin-top: 20px;
  padding: 12px 30px;
  font-size: 1rem;
}

/* Word pick timer in overlay */
.word-pick-timer {
  font-size: 1.3rem;
  color: #fbbf24;
  font-weight: 700;
  margin-bottom: 10px;
}

/* Word length badge — tiny number */
.word-length-badge {
  font-size: 0.65rem;
  color: #64748b;
  margin-left: 4px;
  font-weight: 500;
  vertical-align: super;
}

/* Timer pulse when low */
@keyframes timerPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}

.timer-low {
  color: #ef4444 !important;
  font-weight: 700;
  animation: timerPulse 0.6s ease-in-out infinite;
  display: inline-block;
}

.timer-box {
  transition: color 0.3s;
}

/* Toolbar hidden for non-drawers — completely hidden, not faded */
.toolbar.toolbar-hidden {
  display: none !important;
}

/* Chat guessed indicator */
.chat-messages .guessed-msg {
  color: #22c55e;
  font-weight: 600;
}

.chat-messages .system-msg {
  color: #38bdf8;
  font-style: italic;
  font-size: 0.9rem;
}

.chat-messages .close-guess-msg {
  color: #f59e0b;
  font-style: italic;
  font-size: 0.9rem;
}

/* Player guessed checkmark */
.player-guessed {
  color: #22c55e;
  margin-left: auto;
  font-size: 1.2rem;
}

/* Player rank in players panel */
.player-rank {
  font-weight: 700;
  color: #0ea5e9;
  min-width: 24px;
  font-size: 0.85rem;
}

/* Guessed player chat — slightly muted */
.chat-messages .guessed-chat-msg {
  color: #94a3b8;
  font-style: italic;
}

/* Turn separator in chat */
.chat-messages .turn-separator {
  text-align: center;
  color: #475569;
  font-size: 0.8rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  margin: 8px 0;
  padding-top: 8px;
}

/* ================= SHAPE TOOLS ================= */

.shape-tools {
  display: flex;
  gap: 4px;
  align-items: center;
}

.shape-btn {
  padding: 4px 8px;
  font-size: 1rem;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  cursor: pointer;
  color: #cbd5e1;
  transition: all 0.2s;
}

.shape-btn:hover {
  background: rgba(255,255,255,0.2);
}

.shape-btn.active {
  background: #0ea5e9;
  color: #fff;
  border-color: #0ea5e9;
  box-shadow: 0 0 8px rgba(14,165,233,0.4);
}

/* ================= CUSTOM WORDS ================= */

.custom-words-row {
  flex-direction: column;
  align-items: flex-start !important;
}

.custom-words-row textarea {
  width: 100%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  color: #f1f5f9;
  padding: 8px 12px;
  font-size: 0.85rem;
  resize: vertical;
  font-family: inherit;
  margin-top: 6px;
}

.custom-words-row textarea:focus {
  outline: none;
  border-color: #0ea5e9;
}

/* Drawing icon */
.drawing-icon {
  margin-left: auto;
  font-size: 1rem;
}

/* Close guess in chat */
.chat-messages .close-msg {
  color: #f59e0b;
  font-weight: 500;
}
