body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: background-color 0.3s, color 0.3s;
}

.flex-container {
  display: flex;
}

.flex-item {
  /* You can set widths here or use flex: 1 for equal distribution */
  flex: 1; /* For equal width distribution */
  border: 1px solid black;
  padding: 20px;
}

.light-mode {
  background-color: #f0f0f0;
  color: #333;
}

.dark-mode {
  background-color: #121212;
  color: #f0f0f0;
}

.dark-mode .auto-active {
  border-color: #45a049;
}

.dark-mode .paused-active {
  border-color: #a04545;
}

.game-container {
  max-width: 500px;
  position: relative;

  margin: 0 auto;
}

#gameCanvas {
  width: 100%;
  border: 2px solid;
  height: auto;
  display: block;
  margin: 20px 0;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 20px;
  /*width: 100%;*/
  /*max-width: 500px;*/
}

.input-group {
  display: flex;
  gap: 10px;
}

input, button {
  padding: 8px 12px;
  background-color: var(--bg-color, #ccc);
  color: var(--text-color, #121212);
  border-radius: 4px;
  border: 1px solid var(--border-color, #ccc);
}


button {
  padding: 8px 16px;
  font-size: clamp(12px, 2vw, 16px);
  font-weight: bold;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #fff;
}

.dark-mode input:hover, .dark-mode button:hover {
  /*
  background-color: rgba(51, 51, 51, 0.75);
  color: #f0f0f0;
  */
  background-color: var(--bg-color-hover, #3a0303);
  color: var(--text-color-hover, #121212);

}

#qrInput {
  flex: 1;
}

#qrInputOK {
  flex: 1;
}

h1 {
  text-align: center;
  /*margin-bottom: 10px;*/
}

.score-display {
  margin: 10px 0;
  font-size: 1.2em;
  font-weight: bold;
}

.custom-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  padding: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  text-align: center;

  background-color: var(--bg-color, #121212);
  border-radius: 8px;
  border: 2px solid var(--border-color, #fff);
  min-width: 300px;
}

.dark-mode .custom-dialog {
  background: #333;
  color: #f0f0f0;
}


.dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.instructions {
  margin-top: 20px;
  text-align: center;
  padding: 10px;
  background-color: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}

.dark-mode .instructions {
  background-color: rgba(255, 255, 255, 0.1);
}

#togglePauseBtn {
  min-width: 100px;
}


.custom-dialog h3 {
  margin-top: 0;
  margin-bottom: 15px;
  color: var(--text-color, #fff);

}

.dialog-input {

  padding: 8px;
  margin-bottom: 15px;
  box-sizing: border-box;
  background-color: var(--bg-input-color, #121212);
  width: 100%;
  min-width: 400px;
}

.dialog-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.dialog-buttons button {
  padding: 8px 16px;
  cursor: pointer;
}

.scoreboard {
  /*background: rgba(0, 0, 0, 0.7);*/
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 15px;
  margin: 10px;
  /*    margin: 10px auto;*/
  min-width: 350px;
  max-width: 600px;
  text-align: center;
}

.scoreboard h2 {
  color: #fff;
  margin-bottom: 10px;
}

.score-header {
  font-weight: bold;
  border-bottom: 2px solid #333;
  margin-bottom: 8px;
}

.score-entry {
  /*display: flex;*/
  justify-content: space-between;
  padding: 5px 15px;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);

  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 5px;
  /*padding: 8px;*/
}

.score-entry:last-child {
  border-bottom: none;
}

/* Light mode styles */
.light-mode {
  --text-color: #121212;
  --bg-color: #ccc;
  --border-color: #000000;
  --bg-input-color: #ffffffa1;

  --text-color-hover: #2c2c2c;
  --bg-color-hover: rgba(110, 108, 108, 0.75);

}

/* Dark mode styles */
.dark-mode {
  --text-color: #f0f0f0;
  --bg-color: #333;
  --border-color: #a19d9d;
  --bg-input-color: #555555;

  --text-color-hover: #f0f0f0;
  --bg-color-hover: rgba(110, 108, 108, 0.75);
}


.scores-list-container {
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 16px;
  min-width: 300px;
}

.scores-list-title {
  /*font-size: clamp(16px, 3vw, 20px);*/
  font-weight: bold;
  margin-bottom: 12px;
  text-align: center;
  padding-top: 0;
  margin-top: 0;
}

.scores-list-loading,
.scores-list-empty {
  text-align: center;
}

.scores-list-empty {
  opacity: 0.6;
}

.scores-list-header {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 8px;
  font-weight: bold;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  margin-bottom: 8px;
  /*font-size: clamp(14px, 1.5vw, 14px);*/
}

.scores-list-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  /*font-size: clamp(12px, 1.2vw, 13px);*/
}