:root {
  --wood: #6d4c41;
  --wood-dark: #4e342e;
  --board-light: #e9f5e1;
  --board-dark: #c8e6be;
  --bg: #f4f8f1;
  --text: #1b2314;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, Roboto, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
}

.sign {
  background: var(--wood);
  color: #fff3e0;
  border: 3px solid var(--wood-dark);
  border-radius: 10px;
  padding: 12px 16px;
  text-align: center;
  font-weight: bold;
  font-size: 18px;
  margin-bottom: 16px;
}

.panel { display: flex; flex-direction: column; gap: 8px; }
.hidden { display: none !important; }

label { font-size: 13px; font-weight: 600; margin-top: 8px; }

input {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #bbb;
  font-size: 16px;
}

button {
  padding: 12px 16px;
  border-radius: 10px;
  border: none;
  background: #2e7d32;
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
}

button:disabled { background: #a5a5a5; cursor: not-allowed; }

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }

.chip {
  padding: 8px 14px;
  border-radius: 999px;
  border: 2px solid #ccc;
  background: white;
  font-size: 22px;
  cursor: pointer;
}

.chip.selected { border-color: #2e7d32; background: #e9f5e1; }

.error { color: #c62828; font-size: 13px; min-height: 18px; }

.top-row {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  margin-bottom: 8px;
}

#board {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  grid-template-rows: repeat(10, 1fr);
  border: 3px solid var(--wood-dark);
  border-radius: 8px;
  overflow: hidden;
}

.cell {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  font-size: 9px;
  padding: 2px;
  color: rgba(27, 35, 20, 0.55);
  position: relative;
}

.cell.light { background: var(--board-light); }
.cell.dark { background: var(--board-dark); }

.cell .badge {
  position: absolute;
  right: 2px;
  bottom: 2px;
  font-size: 11px;
}

.token {
  position: absolute;
  width: 8%;
  height: 8%;
  border-radius: 50%;
  border: 2px solid white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  transition: left 0.3s ease, top 0.3s ease;
  transform: translate(-50%, -50%);
}

.message {
  min-height: 20px;
  color: #2e7d32;
  font-weight: 600;
  text-align: center;
}

.players-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 12px;
}

.player-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 10px;
  background: white;
  border: 1px solid #ddd;
  font-size: 13px;
}

.player-chip.turn { background: #fff3cd; border-color: #ffca28; }

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

.overlay-card {
  background: white;
  padding: 24px;
  border-radius: 12px;
  text-align: center;
}

#lobbyList { list-style: none; padding: 0; }
#lobbyList li { padding: 4px 0; }
