@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap");

:root {
  --primary-bg: #1a1a2e;
  --display-bg: rgb(15, 18, 24);
  --secondary-bg: #16213e;
  --accent-color: #e94560;
  --accent-hover-color: #c23650;
  --text-color: #e0e0e0;
  --light-text-color: #a0a0a0;
  --border-color: #333;
  --row-alt-bg: rgba(255, 255, 255, 0.03);
}

html,
body {
  font-family: "Inter", sans-serif;
  background-color: var(--primary-bg);
  color: var(--text-color);
  margin: 0;
  padding: 0;
  touch-action: none;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

.display,
.display body {
  background-color: var(--display-bg);
}

.hud {
  font-size: 1.3em;
  position: fixed;
  bottom: 0;
  width: 100%;
  z-index: 999;
  /* Keeps the text readable on light player colors */
  background-color: rgba(0, 0, 0, 0.5);
}

.text-center {
  text-align: center;
}

.btn {
  background-color: var(--accent-color);
  border: none;
  color: var(--text-color);
  padding: 0.8em 1.5em;
  display: inline-block;
  font-size: 2.5em;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.btn:hover {
  background-color: var(--accent-hover-color);
}

#game-msg {
  position: fixed;
  top: 20vh;
  width: 100vw;
  font-size: 2.5em;
  text-align: center;
  color: var(--light-text-color);
}

#score,
#timer {
  display: inline-block;
  padding: 1.3em;
}

#main,
#clong-canvas {
  z-index: 1;
  position: relative;
  height: 100vh;
  width: 100vw;
  display: block;
}

#start-button {
  position: absolute;
  z-index: 999;
  width: fit-content;
  height: fit-content;
  margin: auto;
  top: 50px;
  right: 0;
  bottom: 0;
  left: 0;
}

#reconnecting-msg {
  height: 100vh;
  width: 100vw;
}

#spinner {
  position: fixed;
  z-index: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.loader {
  border: 8px solid var(--secondary-bg);
  border-top: 8px solid var(--accent-color);
  border-radius: 50%;
  width: 60px;
  height: 60px;
  animation: spin 2s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

#scoreboard {
  box-sizing: border-box;
  width: min(800px, 100% - 2em);
  margin: 2em auto;
  padding: 1.5em;
  font-size: 1.5em;
  background-color: var(--secondary-bg);
  border-radius: 8px;
}

#scoreboard table {
  width: 100%;
  border-collapse: collapse;
}

/* rem keeps header and cells aligned despite their different font sizes */
#scoreboard th,
#scoreboard td {
  padding: 0.6em 1.2rem;
  text-align: left;
}

#scoreboard th {
  font-size: 0.7em;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--light-text-color);
  border-bottom: 2px solid var(--accent-color);
}

#scoreboard tbody tr {
  border-bottom: 1px solid var(--border-color);
}

#scoreboard tbody tr:last-child {
  border-bottom: none;
}

#scoreboard tbody tr:nth-child(even) {
  background-color: var(--row-alt-bg);
}

#scoreboard .rank {
  width: 1%;
}

#scoreboard td.rank {
  font-weight: bold;
  color: var(--accent-color);
}

#scoreboard .score {
  text-align: right;
  font-weight: bold;
  font-variant-numeric: tabular-nums;
}

#scoreboard .dot {
  display: inline-block;
  width: 0.6em;
  height: 0.6em;
  margin-right: 0.6em;
  border-radius: 50%;
}

#scoreboard td.msg {
  text-align: center;
  color: var(--light-text-color);
}

@media (max-width: 600px) {
  #scoreboard {
    margin: 1em auto;
    padding: 0.8em;
    font-size: 1.1em;
  }

  #scoreboard th,
  #scoreboard td {
    padding-inline: 0.5rem;
  }
}
