/* Game Scoreboard */
.game-scoreboard {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.player-score {
  display: flex;
  align-items: center;
  gap: 6px;
}
.player-name {
  font-size: 14px;
  font-weight: 600;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}
.score-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
}

.turn-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-secondary);
  transition: all 0.3s;
}
.turn-indicator.your-turn {
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

/* Game Container */
#game-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  padding: 8px;
  padding-bottom: calc(8px + var(--safe-bottom));
}

#game-container canvas {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius-sm);
}

/* Board game common styles */
.board-grid {
  display: grid;
  gap: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.board-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.board-cell:hover {
  filter: brightness(1.1);
}
.board-cell.valid-move {
  cursor: pointer;
}
.board-cell.valid-move::after {
  content: '';
  width: 30%;
  height: 30%;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
}

/* Four in a Row specific */
.connect4-board {
  background: #2055a8;
  padding: 8px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.connect4-cell {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #1a4380;
  margin: 3px;
  transition: all 0.3s ease;
}
.connect4-cell.p1 {
  background: #ff3b30;
  box-shadow: inset 0 -3px 6px rgba(0,0,0,0.2);
}
.connect4-cell.p2 {
  background: #ffcc00;
  box-shadow: inset 0 -3px 6px rgba(0,0,0,0.2);
}
.connect4-cell.winning {
  animation: winPulse 0.6s ease-in-out infinite alternate;
}
.connect4-column {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.connect4-column:hover .connect4-cell:not(.p1):not(.p2):first-child {
  background: rgba(255,255,255,0.2);
}

/* Timer bar */
.timer-bar {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  margin: 8px 0;
  overflow: hidden;
}
.timer-bar .timer-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 1s linear;
}
.timer-bar .timer-fill.warning {
  background: var(--orange);
}
.timer-bar .timer-fill.danger {
  background: var(--red);
}

/* Game info strip (below header, above game) */
.game-info-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

@keyframes winPulse {
  from { transform: scale(1); }
  to { transform: scale(1.1); }
}

@keyframes dropIn {
  0% { transform: translateY(-300px); }
  60% { transform: translateY(10px); }
  80% { transform: translateY(-5px); }
  100% { transform: translateY(0); }
}

.connect4-cell.dropping {
  animation: dropIn 0.4s ease-out;
}

/* Chess / Checkers board */
.chess-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.chess-cell {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.chess-cell.light { background: #f0d9b5; }
.chess-cell.dark { background: #b58863; }
.chess-cell.selected { background: #829769 !important; }
.chess-cell.valid-move::after {
  content: '';
  width: 28%;
  height: 28%;
  border-radius: 50%;
  background: rgba(0,0,0,0.2);
  position: absolute;
}
.chess-cell.capture-move::after {
  content: '';
  width: 90%;
  height: 90%;
  border-radius: 50%;
  border: 3px solid rgba(0,0,0,0.2);
  position: absolute;
  background: none;
}
.chess-cell.last-move { background: rgba(255,255,0,0.3) !important; }

/* Mancala */
.mancala-board {
  display: flex;
  align-items: stretch;
  background: #8B4513;
  border-radius: 100px;
  padding: 12px;
  box-shadow: var(--shadow-lg);
  gap: 8px;
  max-width: 95vw;
}
.mancala-store {
  width: 60px;
  min-height: 120px;
  background: #6B3410;
  border-radius: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  color: white;
}
.mancala-pits {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}
.mancala-pit {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #6B3410;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: white;
  cursor: pointer;
  transition: all 0.15s;
}
.mancala-pit:hover {
  background: #7B4420;
}
.mancala-pit.disabled {
  opacity: 0.5;
  cursor: default;
}

/* Sea Battle grid */
.sea-battle-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}
.sea-battle-grid {
  display: grid;
  grid-template-columns: repeat(10, 32px);
  gap: 1px;
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.sea-cell {
  width: 32px;
  height: 32px;
  background: #1a3a5c;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s;
}
.sea-cell:hover { background: #1e4570; }
.sea-cell.ship { background: #546e7a; }
.sea-cell.hit { background: var(--red); color: white; }
.sea-cell.miss { background: #37474f; }
.sea-cell.sunk { background: #b71c1c; color: white; }
.sea-battle-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
}

/* Word games */
.word-grid {
  display: grid;
  gap: 2px;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.word-cell {
  width: 56px;
  height: 56px;
  background: rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  border-radius: 8px;
  box-shadow: var(--shadow);
  user-select: none;
  -webkit-user-select: none;
  transition: all 0.15s;
}
.word-cell.selected {
  background: var(--accent);
  color: white;
  transform: scale(1.05);
}
.word-cell.path {
  background: rgba(124,77,255,0.3);
}

.word-input-area {
  display: flex;
  gap: 8px;
  padding: 12px;
  width: 100%;
  max-width: 400px;
}
.word-input-area input {
  flex: 1;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-sm);
  font-size: 18px;
  text-align: center;
  text-transform: uppercase;
  outline: none;
  background: rgba(255,255,255,0.06);
  color: var(--text);
}
.word-input-area input:focus {
  border-color: var(--accent);
}

.found-words {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  max-height: 120px;
  overflow-y: auto;
}
.found-word {
  padding: 4px 10px;
  background: var(--green);
  color: white;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.found-word.duplicate {
  background: var(--text-secondary);
}

/* Cards (Crazy 8) */
.card-hand {
  display: flex;
  gap: -20px;
  justify-content: center;
  padding: 12px;
  flex-wrap: wrap;
}
.playing-card {
  width: 60px;
  height: 84px;
  background: #2a2045;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s;
  margin-left: -15px;
  color: var(--text);
}
.playing-card:first-child {
  margin-left: 0;
}
.playing-card:hover {
  transform: translateY(-8px);
}
.playing-card.red { color: var(--red); }
.playing-card.black { color: var(--text); }
.playing-card.card-back {
  background: linear-gradient(135deg, #5e35b1, #311b92);
  color: transparent;
}

/* Filler hex grid */
.filler-grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.filler-row {
  display: flex;
  gap: 3px;
}
.filler-cell {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}
.filler-cell.owned-0 { outline: 2px solid white; outline-offset: -2px; }
.filler-cell.owned-1 { outline: 2px solid var(--accent); outline-offset: -2px; }
.filler-colors {
  display: flex;
  gap: 8px;
  padding: 12px;
}
.filler-color-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
}
.filler-color-btn:hover {
  transform: scale(1.1);
}
.filler-color-btn.disabled {
  opacity: 0.3;
  cursor: default;
}

/* Dots and Boxes */
.dots-board {
  display: grid;
  gap: 0;
}
.dot-point {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #bbb;
}
.dot-h-line, .dot-v-line {
  cursor: pointer;
  transition: background 0.15s;
}
.dot-h-line {
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
}
.dot-v-line {
  width: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
}
.dot-h-line:hover, .dot-v-line:hover {
  background: rgba(124,77,255,0.5);
}
.dot-h-line.placed, .dot-v-line.placed {
  cursor: default;
}
.dot-h-line.p0, .dot-v-line.p0 { background: var(--red); }
.dot-h-line.p1, .dot-v-line.p1 { background: var(--accent); }
.dot-box {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
}
.dot-box.owner-0 { background: rgba(255,82,82,0.2); color: var(--red); }
.dot-box.owner-1 { background: rgba(124,77,255,0.2); color: var(--accent); }

/* Pool / Canvas game overlays */
.pool-controls {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  align-items: center;
}
.power-bar {
  width: 200px;
  height: 12px;
  background: #333;
  border-radius: 6px;
  overflow: hidden;
}
.power-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--orange), var(--red));
  border-radius: 6px;
  transition: width 0.05s;
}

/* Tanks controls */
.tanks-controls {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  align-items: center;
  background: rgba(0,0,0,0.7);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 14px;
}
.tanks-controls input[type="range"] {
  width: 100px;
}

/* 20 Questions */
.twenty-q-chat {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.twenty-q-msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
}
.twenty-q-msg.question {
  background: var(--accent);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.twenty-q-msg.answer {
  background: rgba(255,255,255,0.08);
  color: var(--text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.twenty-q-input {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.twenty-q-input input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 20px;
  font-size: 14px;
  outline: none;
  background: rgba(255,255,255,0.06);
  color: var(--text);
}
