* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100dvh; overflow: hidden; background: #111; color: #ccc; font-family: sans-serif; }

/* ---- LOBBY ---- */
#lobby {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100dvw;
  height: 100dvh;
  padding: 24px;
}
#lobby-box {
  background: #0d0d1a;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 40px 48px;
  text-align: center;
  min-width: 300px;
}
#lobby-title {
  font-size: 28px;
  letter-spacing: 2px;
  margin-bottom: 24px;
  color: #eee;
}
.lobby-name-row {
  margin-bottom: 4px;
}
#lobby-name {
  width: 100%;
  padding: 10px 12px;
  font-size: 16px;
  text-align: center;
  border: 2px solid #333;
  border-radius: 8px;
  background: #1a1a2e;
  color: #eee;
  outline: none;
}
#lobby-name:focus {
  border-color: #4FC3F7;
}
.lobby-divider {
  height: 1px;
  background: #333;
  margin: 16px 0;
}
.lobby-pc-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
}
.lobby-pc-label {
  font-size: 14px;
  color: #888;
}
.lobby-pc-options {
  display: flex;
  gap: 6px;
}
.lobby-pc-opt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 2px solid #333;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  color: #888;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.lobby-pc-opt:hover {
  border-color: #666;
}
.lobby-pc-opt.active {
  border-color: #4FC3F7;
  color: #4FC3F7;
  background: rgba(79, 195, 247, 0.1);
}
#lobby-create {
  display: block;
  width: 100%;
  padding: 14px 0;
  font-size: 18px;
  font-weight: bold;
  border: 2px solid #4FC3F7;
  border-radius: 8px;
  background: transparent;
  color: #4FC3F7;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
#lobby-create:hover {
  background: #4FC3F7;
  color: #111;
}
.lobby-or {
  margin: 18px 0;
  color: #555;
  font-size: 13px;
}
.lobby-join-row {
  display: flex;
  justify-content: center;
  gap: 8px;
}
#lobby-code {
  width: 130px;
  padding: 10px 8px;
  font-size: 18px;
  letter-spacing: 3px;
  text-align: center;
  text-transform: uppercase;
  border: 2px solid #333;
  border-radius: 8px;
  background: #1a1a2e;
  color: #eee;
  outline: none;
}
#lobby-code:focus {
  border-color: #4FC3F7;
}
#lobby-join {
  padding: 10px 16px;
  font-size: 15px;
  font-weight: bold;
  border: 2px solid #81C784;
  border-radius: 8px;
  background: transparent;
  color: #81C784;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
@media (max-width: 420px) {
  .lobby-join-row { flex-direction: column; }
  #lobby-code { width: 100%; letter-spacing: 2px; }
  #lobby-join { width: 100%; }
}
#lobby-join:hover {
  background: #81C784;
  color: #111;
}
.lobby-err {
  margin-top: 12px;
  color: #FF7043;
  font-size: 13px;
  min-height: 18px;
}
.lobby-label {
  font-size: 12px;
  color: #666;
  margin-bottom: 8px;
}
.lobby-code-display {
  font-size: 48px;
  font-weight: bold;
  letter-spacing: 8px;
  color: #4FC3F7;
  padding: 16px 0;
}
.lobby-hint {
  font-size: 13px;
  color: #555;
  margin-bottom: 12px;
}
.lobby-player-count {
  font-size: 24px;
  font-weight: bold;
  color: #81C784;
  margin-bottom: 8px;
}
.lobby-player-list {
  font-size: 14px;
  color: #aaa;
  margin-bottom: 12px;
  min-height: 0;
}
.lobby-player-list .lobby-player-item {
  padding: 3px 0;
}
.lobby-player-list .lobby-player-item .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #81C784;
  margin-right: 8px;
  vertical-align: middle;
}
.lobby-player-list .lobby-player-item .name {
  vertical-align: middle;
}
.lobby-player-list .lobby-player-item .status {
  font-size: 12px;
  color: #666;
  margin-left: 8px;
}
.lobby-loader {
  font-size: 14px;
  color: #888;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
.lobby-cancel {
  margin-top: 20px;
  padding: 8px 20px;
  font-size: 13px;
  border: 1px solid #555;
  border-radius: 6px;
  background: transparent;
  color: #888;
  cursor: pointer;
}
.lobby-cancel:hover {
  border-color: #888;
  color: #ccc;
}
#lobby-reconnecting {
  display: none;
}

/* ---- GAME (original) ---- */
#game {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100dvw;
  height: 100dvh;
  padding: 24px;
}
#game-center {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  padding-bottom: 8px;
}
@media (orientation: portrait) {
  #game-center { flex-direction: column; }
}
#game-panel {
  flex: 0 0 auto;
  width: 160px;
  padding: 16px;
  border: 1px solid #333;
  border-radius: 8px;
  background: #0d0d1a;
  align-self: center;
  margin: 8px;
}
#canvas-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
canvas { display: block; cursor: pointer; }

/* ---- GAME OVER ---- */
#gameover-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  border-radius: 4px;
  z-index: 10;
}
#go-title {
  font-size: 36px;
  font-weight: bold;
  letter-spacing: 2px;
  margin-bottom: 8px;
}
#go-winner {
  font-size: 22px;
  font-weight: bold;
  margin-bottom: 16px;
}
#go-scores {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
  font-size: 14px;
}
.go-score-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.go-sr-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
}
.go-sr-name { min-width: 70px; }
.go-sr-score { font-weight: bold; }
.go-sr-status { color: #555; font-size: 12px; }
#go-restart {
  padding: 10px 28px;
  font-size: 16px;
  font-weight: bold;
  border: 2px solid #666;
  border-radius: 6px;
  background: transparent;
  color: #ccc;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
#go-restart:hover {
  border-color: #fff;
  color: #fff;
}
#go-lobby {
  padding: 8px 20px;
  font-size: 13px;
  border: 1px solid #555;
  border-radius: 6px;
  background: transparent;
  color: #888;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
#go-lobby:hover {
  border-color: #888;
  color: #ccc;
}

/* ---- DISCONNECT OVERLAY ---- */
#disc-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  border-radius: 4px;
  z-index: 20;
}
#disc-title {
  font-size: 22px;
  font-weight: bold;
  margin-bottom: 16px;
  color: #FF7043;
}
#disc-timer-wrap {
  font-size: 36px;
  font-weight: bold;
  margin-bottom: 8px;
  color: #eee;
}
#disc-timer {
  font-size: 48px;
}
#disc-label {
  font-size: 13px;
  color: #888;
  margin-bottom: 20px;
}
#disc-back {
  padding: 10px 28px;
  font-size: 16px;
  font-weight: bold;
  border: 2px solid #666;
  border-radius: 6px;
  background: transparent;
  color: #ccc;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
#disc-back:hover {
  border-color: #fff;
  color: #fff;
}

/* ---- GAME PANEL ---- */
#gp-turn {
  font-size: 20px;
  font-weight: bold;
  text-align: center;
  margin-bottom: 6px;
  letter-spacing: 1px;
}
#gp-room {
  font-size: 11px;
  color: #666;
  text-align: center;
  margin-bottom: 14px;
  letter-spacing: 0.5px;
}
#gp-players {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}
.gp-player {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 4px 6px;
  border-radius: 4px;
  transition: background 0.2s;
  white-space: nowrap;
}
.gp-player.active { background: rgba(255,255,255,0.06); }
.gp-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.gp-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gp-score { font-weight: bold; font-size: 14px; min-width: 48px; text-align: right; }
.gp-dead { color: #555; font-size: 11px; margin-left: auto; }
#gp-current {
  text-align: center;
  font-size: 12px;
  color: #666;
}