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

body {
  background: #0d1117;
  color: #e6edf3;
  font-family: 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  gap: 16px;
}

header {
  text-align: center;
}

header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: #58a6ff;
  letter-spacing: 0.04em;
}

header p {
  font-size: 0.85rem;
  color: #8b949e;
  margin-top: 4px;
}

/* ---- Scoreboard ---- */
#scoreboard {
  display: flex;
  align-items: center;
  gap: 32px;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 12px 32px;
}

.team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.team-name {
  font-size: 0.8rem;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.team-score {
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1;
}

.team-0 .team-score { color: #3fb950; }
.team-1 .team-score { color: #f78166; }

.separator {
  font-size: 1.6rem;
  color: #30363d;
  font-weight: 300;
}

/* ---- Game canvas ---- */
#canvas-wrap {
  position: relative;
  border: 2px solid #30363d;
  border-radius: 8px;
  overflow: hidden;
  background: #1c6e2e;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
  display: inline-block;
}

#game-canvas {
  display: block;
}

#status-overlay {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.4);
  pointer-events: none;
}

/* ---- Canvas action buttons ---- */
#canvas-btns {
  position: absolute;
  bottom: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  z-index: 10;
}

.canvas-btn {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  background: rgba(0,0,0,0.45);
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s, border-color 0.15s;
}

.canvas-btn:hover {
  background: rgba(0,0,0,0.7);
  border-color: rgba(255,255,255,0.45);
  color: #fff;
}

#admin-btn.admin-btn-paused {
  border-color: #f78166;
  color: #f78166;
}

/* ---- Fullscreen HUD (score shown inside canvas when fullscreen) ---- */
#fullscreen-hud {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 20px;
  background: rgba(0,0,0,0.55);
  border-radius: 12px;
  padding: 8px 24px;
  z-index: 20;
  pointer-events: none;
}

.hud-team {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hud-label {
  font-size: 1.1rem;
  font-weight: 700;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.1em;
}

.hud-score {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1;
}

.hud-sep {
  font-size: 1.6rem;
  color: rgba(255,255,255,0.4);
}

.hud-a .hud-score { color: #3fb950; }
.hud-b .hud-score { color: #f78166; }

/* ---- Fullscreen CSS ---- */
#canvas-wrap:fullscreen,
#canvas-wrap:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  border: none;
  border-radius: 0;
  background: #0d1117;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#canvas-wrap:fullscreen #game-canvas,
#canvas-wrap:-webkit-full-screen #game-canvas {
  /* JS handles transform: scale() */
}

/* ---- Stats bar ---- */
#stats-bar {
  display: flex;
  gap: 24px;
  font-size: 0.8rem;
  color: #8b949e;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 8px 20px;
}

#stats-bar span b {
  color: #e6edf3;
}

/* ---- Charts ---- */
#charts {
  display: flex;
  gap: 16px;
  width: 100%;
  max-width: 840px;
}

.chart-card {
  flex: 1;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 12px 16px;
}

.chart-card h3 {
  font-size: 0.8rem;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.chart-card canvas {
  width: 100% !important;
  height: 140px !important;
}

/* ---- Connection badge ---- */
#conn-badge {
  position: fixed;
  bottom: 12px;
  right: 14px;
  font-size: 0.72rem;
  padding: 3px 10px;
  border-radius: 20px;
  background: #161b22;
  border: 1px solid #30363d;
  color: #8b949e;
}

#conn-badge.connected    { border-color: #3fb950; color: #3fb950; }
#conn-badge.disconnected { border-color: #f78166; color: #f78166; }

/* ---- Admin modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-box {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 12px;
  padding: 24px;
  width: 340px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #e6edf3;
}

.modal-close-btn {
  background: none;
  border: none;
  color: #8b949e;
  font-size: 1rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

.modal-close-btn:hover { background: #21262d; color: #e6edf3; }

#pause-status-row {
  font-size: 0.85rem;
  color: #8b949e;
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-field label {
  font-size: 0.8rem;
  color: #8b949e;
}

.modal-field input {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  color: #e6edf3;
  padding: 8px 10px;
  font-size: 0.9rem;
  outline: none;
}

.modal-field input:focus {
  border-color: #58a6ff;
}

.modal-error {
  font-size: 0.82rem;
  color: #f78166;
  background: rgba(247,129,102,0.1);
  border: 1px solid rgba(247,129,102,0.3);
  border-radius: 6px;
  padding: 6px 10px;
}

.modal-actions {
  display: flex;
  gap: 10px;
}

.btn {
  flex: 1;
  padding: 9px 12px;
  border: none;
  border-radius: 7px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn:hover { opacity: 0.85; }

.btn-warn {
  background: #f78166;
  color: #fff;
}

.btn-ok {
  background: #3fb950;
  color: #fff;
}
