/*Dark mode*/
:root {
  --background-color: #f0f0f0; 
  --text-color: gray; 
  --primary-color: black; 
}

[data-theme="dark"] {
  --background-color: #121212; 
  --text-color: black; 
  --primary-color: white; 
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
  font-family: Arial, sans-serif;
  min-height: 100vh; /* Ensure body takes at least the full viewport height */
  overflow-y: auto; /* Make body scrollable if content exceeds viewport height */
  background-color: var(--background-color);
  color: var(--text-color);
  transition: background-color 0.3s, color 0.3s; 
}

.forkme {
  position: fixed; 
  top: 0; 
  right: 0;
}

.keypad {
  position: relative;
  display: grid;
  grid-template-rows: repeat(4, 60px); /* 4 rows */
  grid-template-columns: repeat(3, 60px); /* 3 columns */
  gap: 10px;
  margin: 20px 0; /* Add margin for spacing */
  padding: 10px; /* Allows large circles to go beyond keypad dimensions */
}

.row {
  display: contents;
}

.key {
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 50%;
  font-size: 14px; /* Match canvas font size */
  font-family: Arial, sans-serif; /* Match canvas font family */
  color: #000; /* Match canvas fillStyle */
  text-align: center; /* Match canvas textAlign */
  line-height: 1; /* Ensure text is vertically centered */
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent; /* Remove blue tap hightlight in mobile Chrome */
}

.key:hover {
  background-color: #e0e0e0;
}

/* Hide empty keys (spacing) */
.key:empty {
  visibility: hidden;
}

#numberDisplay {
  width: 200px;
  padding: 10px;
  font-size: 16px;
  text-align: center;
  border: 1px solid #ccc;
  border-radius: 5px;
  margin-bottom: 10px; /* Space between textbox and clear button */
}

/* Remove spin buttons on desktop browsers */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  appearance: textfield; /* For Firefox */
}

#clearButton {
  width: 220px;
  padding: 10px;
  font-size: 16px;
  text-align: center;
  border: 1px solid #ccc;
  border-radius: 5px;
  background-color: #fff;
  cursor: pointer;
  margin-bottom: 20px; /* Space below the clear button */
}

#clearButton:hover {
  background-color: #e0e0e0;
}

#patternCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none; /* Ensure clicks pass through to the keys */
}

#theme-toggle {
  background-color: var(--primary-color);
  color: var(--text-color);
  border: none;
  padding: 10px 20px;
  cursor: pointer;
}