body {
  display: flex;
  flex-direction: column; 
  min-height: 100vh;
  justify-content: space-between; 
  align-items: center;
  padding: 2rem;
  background-color: #292929;
  color: #dfdfdf;
  font-family: "Courier New", monospace;
}

.top-right-button {
  position: absolute;
  top: 1rem;
  right: 1rem;
  padding: 0.5rem 1rem;
  background-color: #7b7b7b;
  color: #ffdf00;
  border: none;
  border-top: 4px solid #b1b1b1;
  border-left: 4px solid #b1b1b1;
  border-bottom: 4px solid #3a3a3a;
  border-right: 4px solid #3a3a3a;
  font-family: "Courier New", monospace;
  cursor: pointer;
}


.main-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 600px;
}

.title {
  color: #dfdfdf;
}

.player-section {
  margin-bottom: 1rem;
  background-color: #7b7b7b;
  padding: 1rem;
  border-top: 6px solid #cfcfcf;
  border-left: 6px solid #cfcfcf;
  border-bottom: 6px solid #3a3a3a;
  border-right: 6px solid #3a3a3a;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.player-form {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  width: 100%;
  align-items: center;
}

.player-form label {
  font-weight: bold;
  font-size: 1.1rem;
  color: #fff;
}

.player-form input {
  padding: 0.5rem;
  font-size: 1rem;
  width: 80%;
  border: none;
  outline: none;
  border-top: 4px solid #b1b1b1;
  border-left: 4px solid #b1b1b1;
  border-bottom: 4px solid #3a3a3a;
  border-right: 4px solid #3a3a3a;
  background-color: #e0e0e0;
  color: #000;
}

.player-form button {
  padding: 0.5rem 1rem;
  font-size: 1.1rem;
  background-color: #7b7b7b;
  color: #ffdf00;
  cursor: pointer;
  border-top: 4px solid #b1b1b1;
  border-left: 4px solid #b1b1b1;
  border-bottom: 4px solid #3a3a3a;
  border-right: 4px solid #3a3a3a;
  font-family: "Courier New", monospace;
}

.player-form button:hover {
  background-color: #9a9a9a;
}

#difficulty {
  margin: 1rem 0;
  padding: 0.5rem 1rem;
  background-color: #e0e0e0;
  color: #000;
  font-weight: bold;
  font-size: 1rem;
  font-family: "Courier New", monospace;
  border-top: 4px solid #b1b1b1;
  border-left: 4px solid #b1b1b1;
  border-bottom: 4px solid #3a3a3a;
  border-right: 4px solid #3a3a3a;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

#difficulty:hover {
  background-color: #cfcfcf;
}

#difficulty option {
  background-color: #e0e0e0;
  color: #000;
  font-family: "Courier New", monospace;
}


.game-panel {
  background-color: #7b7b7b;
  padding: 12px;
  border-top: 6px solid #cfcfcf;
  border-left: 6px solid #cfcfcf;
  border-bottom: 6px solid #3a3a3a;
  border-right: 6px solid #3a3a3a;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.game-info {
  display: flex;
  align-items: center;
  justify-content: space-around;
  width: 100%;
  padding: 10px;
  background-color: #7b7b7b;
  border-top: 4px solid #b1b1b1;
  border-left: 4px solid #b1b1b1;
  border-bottom: 4px solid #3a3a3a;
  border-right: 4px solid #3a3a3a;
  margin-bottom: 1rem;
  box-sizing: border-box;
}

#mines-left, .timer {
  background-color: black;
  padding: 5px 10px;
  font-family: "Courier New", monospace;
  color: red;
  font-size: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  box-shadow: inset -2px -2px 2px #ff0000, inset 2px 2px 2px #330000;
}

.led-display {
  letter-spacing: 2px;
}

.face-button {
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  border: 2px solid #888;
  border-top: 2px solid #cfcfcf;
  border-left: 2px solid #cfcfcf;
  border-bottom: 2px solid #3a3a3a;
  border-right: 2px solid #3a3a3a;
  background-color: #e0e0e0;
  cursor: pointer;
  transition: transform 0.1s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.face-button:hover {
  transform: scale(1.05);
}

#restart-button {
  font-size: 1.5rem;
  padding: 0.2rem 0.2rem;
  background-color: #7b7b7b;
  cursor: pointer;
  transition: transform 0.1s ease;
  border-top: 4px solid #b1b1b1;
  border-left: 4px solid #b1b1b1;
  border-bottom: 4px solid #3a3a3a;
  border-right: 4px solid #3a3a3a;
}

.board {
  display: flex;
  flex-wrap: wrap;
  box-sizing: content-box;
  background-color: #7b7b7b;
  border-top: 4px solid #3a3a3a;
  border-left: 4px solid #3a3a3a;
  border-bottom: 4px solid #b1b1b1;
  border-right: 4px solid #b1b1b1;
}

.cell {
  flex: 0 0 auto;
  width: var(--cell-size, 40px);
  height: var(--cell-size, 40px);
  background-color: #7b7b7b;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  font-size: 1.2rem;
  box-sizing: border-box;
  cursor: pointer;
  user-select: none;
  border-top: 4px solid #b1b1b1;
  border-left: 4px solid #b1b1b1;
  border-bottom: 4px solid #3a3a3a;
  border-right: 4px solid #3a3a3a;
}

.cell-closed {
  background-color: #7b7b7b;
  color: transparent;
}

.cell-opened {
  background-color: #c0c0c0;
  color: black;
  border: 1px solid #7b7b7b;
}

.cell-flagged {
  background-color: #ffdf00;
  color: black;
  border: 1px solid #7b7b7b;
}

.hidden {
  display: none;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(20, 20, 20, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  font-family: "Courier New", Courier, monospace;
}

.modal-content {
  background-color: #7b7b7b;
  padding: 2rem 3rem;
  text-align: center;
  border-top: 4px solid #b1b1b1;
  border-left: 4px solid #b1b1b1;
  border-bottom: 4px solid #3a3a3a;
  border-right: 4px solid #3a3a3a;
  color: #dfdfdf;
}

#modal-message {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  color: #ffdf00;
}

#modal-close {
  background-color: #7b7b7b;
  border: none;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  border-top: 3px solid #cfcfcf;
  border-left: 3px solid #cfcfcf;
  border-bottom: 3px solid #3a3a3a;
  border-right: 3px solid #3a3a3a;
  cursor: pointer;
  color: #000;
  font-weight: bold;
  transition: transform 0.1s ease;
}

#modal-close:hover,
#restart-button:hover {
  background-color: #9a9a9a;
}

.hidden {
  display: none;
}

.footer {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.9rem;
  color: #dfdfdf;
  padding: 1rem 0;
  border-top: 1px solid #555;
}

.footer a {
  color: #ffdf00;
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

body.light-theme {
  background-color: #f0f0f0;
}

body.light-theme .title, body.light-theme .footer  {
  color: #000;
}

body.dark-theme{
  background-color: #292929;
}

body.dark-theme .title, body.dark-theme .footer {
  color: #dfdfdf;
}


@media (max-width: 600px) {
  body {
    justify-content: center; 
  }

  .main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center; 
    align-items: center;
    padding-top: 2rem;
    padding-bottom: 2rem;
  }

  .footer {
    margin-top: 2rem;
  }
}