* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #0d1117;
  color: #f5f5f5;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.card {
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.player-label {
  font-size: 14px;
  letter-spacing: 4px;
  color: #8b949e;
  margin-bottom: 8px;
}

.player-title {
  font-size: 32px;
  font-weight: 800;
  margin: 0 0 28px;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 16px;
  margin-bottom: 32px;
  min-height: 24px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #6e7681;
  flex-shrink: 0;
  transition: background 0.2s;
}

.dot.connecting { background: #d29922; animation: pulse 1s infinite; }
.dot.connected { background: #3fb950; }
.dot.disconnected { background: #f85149; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

button#readyBtn {
  width: 100%;
  padding: 22px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 2px;
  border: none;
  border-radius: 16px;
  background: #238636;
  color: white;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

button#readyBtn:active { transform: scale(0.97); }
button#readyBtn:disabled { background: #30363d; color: #6e7681; cursor: not-allowed; }
button#readyBtn.is-ready { background: #1f6feb; }

.session-info {
  margin-top: 24px;
  font-size: 12px;
  color: #6e7681;
}

.hidden { display: none !important; }

.result-title {
  font-size: 28px;
  font-weight: 800;
  margin: 0 0 8px;
}
.result-title.win { color: #3fb950; }
.result-title.lose { color: #f85149; }
.result-title.draw { color: #d29922; }

.result-score {
  font-size: 40px;
  font-weight: 800;
  margin-bottom: 28px;
  color: #f5f5f5;
}

button#rematchBtn {
  width: 100%;
  padding: 22px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 1px;
  border: none;
  border-radius: 16px;
  background: #1f6feb;
  color: white;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
button#rematchBtn:active { transform: scale(0.97); }
button#rematchBtn.is-waiting { background: #30363d; color: #8b949e; cursor: default; }
button#rematchBtn.is-waiting:active { transform: none; }

.rematch-status {
  margin-top: 14px;
  font-size: 13px;
  color: #8b949e;
  min-height: 18px;
}

button.secondary {
  width: 100%;
  padding: 14px;
  margin-top: 14px;
  font-size: 14px;
  font-weight: 700;
  border: 1px solid #30363d;
  border-radius: 12px;
  background: transparent;
  color: #8b949e;
  cursor: pointer;
}
button.secondary:active { transform: scale(0.97); }

/* Landscape phone: keep the card from being oddly tall/narrow */
@media (orientation: landscape) and (max-height: 500px) {
  .card { max-width: 520px; }
  .player-title { font-size: 26px; margin-bottom: 16px; }
  .status-row { margin-bottom: 20px; }
  button#readyBtn { padding: 16px; font-size: 18px; }
}
