/* style.css */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  overflow: hidden;
  height: 100%;
}

body {
  background: url('/static/images/background.jpg') no-repeat center center fixed;
  background-size: cover;
  font-family: 'Quicksand', 'Assistant', Arial, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 20px;
}

h1 {
  margin-bottom: 10px;
  color: #4a4a4a;
  font-size: 24px;
}

#game-container {
  position: relative;
  width: 400px;
  height: 460px; /* canvas (400px) + score (60px) */
  border: 2px solid #4a4a4a;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.snake-card {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 8px 32px rgba(60, 60, 60, 0.15);
  max-width: 700px;
  margin: 3rem auto;
  padding: 2rem 2.5rem 2.5rem 2.5rem;
  text-align: center;
}

#gameCanvas {
  width: 90vw;
  max-width: 400px;
  height: 90vw;
  max-height: 400px;
  background: #a3d977;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(60, 60, 60, 0.10);
  border: 2px solid #202073;
  margin-bottom: 1.5rem;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

#score, #gameOver {
  margin-top: 1rem;
  font-size: 1.5rem;
  font-weight: 600;
  color: #202073;
}

#gameOver {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  text-align: center;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.9);
  padding: 20px;
  border: 2px solid #333;
  border-radius: 8px;
  font-size: 2rem;
  color: #f44336;
  margin-top: 1rem;
  opacity: 0;
  transition: opacity 0.5s;
}

#gameOver.show {
  opacity: 1;
}

#gameOver p {
  font-size: 24px;
  color: #c0392b;
  margin-bottom: 10px;
}

#restartBtn {
  display: block;
  margin: 0.8rem auto 0 auto;   /* reduced top margin */
  padding: 0.8rem 2rem;    /* larger padding for bigger button */
  font-size: 1.1rem;
  font-family: 'Assistant', sans-serif;
  background: #4c6ef5;
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
}

#restartBtn:hover {
  background: #3b5bdb;
}

.hidden {
  display: none;
}

.snake-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 1.5rem;
}

.back-btn {
  display: block;
  width: fit-content;
  margin: 2rem auto 0 auto;
  padding: 0.5rem 1.5rem;
  background: #202073;
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  font-size: 1rem;
  font-family: 'Assistant', sans-serif;
  text-align: center;
  transition: background 0.2s;
}

.back-btn:hover {
  background: #4c6ef5;
}

.back-btn.top-left {
  position: absolute;
  top: 32px;
  left: 32px;
  margin: 0;
  z-index: 10;
}

.game-leaderboard-container {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  /* margin-top: 24px; Add this line */

}

.game-area {
  flex: 1;
  margin-right: 20px;
}

.leaderboard {
  width: 200px;
  background: #f1f1f1;
  padding: 10px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(60, 60, 60, 0.08);
  margin-top: 40px; /* Add this line */
  margin-left: 40px; /* Add or adjust this line */
}

.leaderboard h3 {
  text-align: center;
  margin-bottom: 10px;
  color: #202073;
}

.leaderboard ol {
  list-style: none;
  padding: 0;
  margin: 0;
}

.leaderboard li {
  padding: 6px 4px;
  border-bottom: 1px solid #ccc;
  font-size: 0.9rem;
  display: flex;
  justify-content: space-between;
}

.leaderboard li:last-child {
  border-bottom: none;
}

/* Reuse for hiding elements */
.hidden {
  display: none;
}

/* ─── START OF MODAL STYLES (append to bottom) ─── */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: #ffffff;
  padding: 20px 24px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  text-align: center;
  width: 300px;
}

.modal-content h3 {
  margin-top: 0;
  color: #202073;
}

.modal-content p {
  font-size: 0.95rem;
  margin: 12px 0 8px;
}

.modal-content input[type="text"] {
  width: 100%;
  padding: 8px 10px;
  font-size: 1rem;
  margin-bottom: 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.modal-buttons {
  display: flex;
  justify-content: space-between;
}

.modal-buttons button {
  padding: 8px 14px;
  font-size: 0.95rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

#submitNameBtn {
  background-color: #4CAF50;
  color: white;
}

#skipNameBtn {
  background-color: #f44336;
  color: white;
}

/* ─── END OF MODAL STYLES ─── */

.top-right-icon {
  position: fixed;
  bottom: 24px;   /* Move to bottom */
  right: 15px;
  top: auto;      /* Remove top positioning */
  width: 90px;      /* Increased size */
  height: 90px;     /* Increased size */
  z-index: 100;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(60,60,60,0.10);
  padding: 4px;
}
