* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: Arial, Helvetica, sans-serif;
  background: linear-gradient(160deg, #e8f0ff 0%, #f0f4ff 50%, #e8f4ff 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#confetti {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  display: none;
  z-index: 200;
}

/* Screens */
.screen { display: none; flex-direction: column; align-items: center; text-align: center; padding: 28px 20px; max-width: 460px; width: 100%; }
.screen.active { display: flex; }

/* GAP Logo */
.gap-logo {
  font-size: 38px;
  font-weight: 900;
  letter-spacing: 10px;
  color: #0055a5;
  margin-bottom: 8px;
}
.gap-logo.small { font-size: 22px; letter-spacing: 7px; margin-bottom: 0; }

h1 { font-size: 30px; font-weight: 900; color: #111; margin-bottom: 6px; }
.sub { color: #777; font-size: 14px; margin-bottom: 28px; line-height: 1.5; }

/* Name entry */
.name-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  margin-bottom: 28px;
}
.player-input {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.player-emoji { font-size: 44px; }
.player-input input {
  width: 100%;
  padding: 11px 12px;
  border: 2px solid #dde4f0;
  border-radius: 12px;
  font-size: 15px;
  text-align: center;
  color: #111;
  background: white;
  transition: border-color 0.2s;
}
.player-input:first-child input:focus { border-color: #0055a5; outline: none; }
.player-input:last-child input:focus { border-color: #e67e22; outline: none; }
.vs-badge {
  font-size: 17px;
  font-weight: 900;
  color: #bbb;
  padding: 8px 6px;
}

/* Buttons */
.btn-primary {
  background: #0055a5;
  color: white;
  border: none;
  border-radius: 14px;
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn-primary:hover { background: #0044cc; }
.btn-primary:active { transform: scale(0.97); }
.btn-primary.big-btn { padding: 17px 44px; font-size: 18px; }

.btn-secondary {
  background: #eee;
  color: #555;
  border: none;
  border-radius: 14px;
  padding: 13px 28px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 12px;
  transition: background 0.15s;
}
.btn-secondary:hover { background: #ddd; }

.ghost-btn {
  background: none;
  border: none;
  color: #bbb;
  font-size: 13px;
  cursor: pointer;
  margin-top: 18px;
  padding: 6px 10px;
}
.ghost-btn:hover { color: #888; }

/* Game Header */
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 16px;
}
.round-badge {
  background: #0055a5;
  color: white;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 5px 14px;
  border-radius: 20px;
  text-transform: uppercase;
}

/* Scoreboard */
.scoreboard {
  display: flex;
  align-items: center;
  width: 100%;
  background: white;
  border-radius: 16px;
  padding: 14px 20px;
  margin-bottom: 14px;
  box-shadow: 0 2px 12px rgba(0,85,165,0.08);
  gap: 8px;
}
.score-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.score-emoji { font-size: 26px; }
.score-name { font-size: 12px; color: #888; font-weight: 600; max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-num { font-size: 36px; font-weight: 900; line-height: 1; }
.p1-col .score-num { color: #0055a5; }
.p2-col .score-num { color: #e67e22; }
.score-sep { font-size: 22px; color: #ccc; font-weight: 700; padding: 0 4px; }

/* Turn indicator */
.turn-bar {
  width: 100%;
  border-radius: 12px;
  padding: 10px 18px;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 18px;
  transition: background 0.3s, color 0.3s, border-color 0.3s;
  border: 2px solid transparent;
}
.turn-bar.p1 { background: #e8f0ff; border-color: #0055a5; color: #0055a5; }
.turn-bar.p2 { background: #fff4e8; border-color: #e67e22; color: #e67e22; }

/* Board */
.board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 340px;
  margin-bottom: 4px;
}
.cell {
  aspect-ratio: 1;
  background: white;
  border-radius: 16px;
  border: 3px solid #dde4f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 54px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  user-select: none;
}
.cell:hover:not(.taken) {
  border-color: #0055a5;
  background: #f0f4ff;
  transform: scale(1.04);
}
.cell.taken { cursor: default; }
.cell.p1 { border-color: #0055a5; background: #eef3ff; }
.cell.p2 { border-color: #e67e22; background: #fff6ee; }
.cell.winner {
  background: #d4f5e2;
  border-color: #27ae60;
  animation: winPop 0.45s cubic-bezier(0.34,1.56,0.64,1);
}
.piece { display: inline-block; animation: popIn 0.28s cubic-bezier(0.34,1.56,0.64,1); }

@keyframes popIn {
  from { transform: scale(0) rotate(-15deg); opacity: 0; }
  to   { transform: scale(1) rotate(0deg);  opacity: 1; }
}
@keyframes winPop {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* Overlay */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.48);
  z-index: 60;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.overlay.show { display: flex; }
.overlay-card {
  background: white;
  border-radius: 24px;
  padding: 36px 40px;
  text-align: center;
  max-width: 340px;
  width: 100%;
  animation: slideUp 0.3s ease;
}
@keyframes slideUp {
  from { transform: translateY(32px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.big-emoji { font-size: 72px; margin-bottom: 10px; }
.overlay-card h2 { font-size: 22px; color: #111; margin-bottom: 6px; }
.overlay-sub { color: #777; font-size: 14px; margin-bottom: 16px; }

/* Round pip dots */
.pip-row { display: flex; gap: 8px; justify-content: center; margin-bottom: 20px; }
.pip {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #ddd;
}
.pip.p1-win { background: #0055a5; }
.pip.p2-win { background: #e67e22; }
.pip.draw   { background: #999; }

/* Champion */
.trophy { font-size: 88px; margin-bottom: 4px; }
.champion-title { font-size: 30px; color: #111; margin-bottom: 4px; }
.champion-sub { font-size: 18px; color: #888; margin-bottom: 16px; }
.final-score { font-size: 52px; font-weight: 900; color: #0055a5; margin-bottom: 28px; }
