body {
  font-family: 'Roboto', sans-serif;
  background-color: #F7F7F7;
  color: #333;
  margin: 0;
  padding: 0;
  line-height: 1.6;
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.navbar-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.navbar .logo {
  font-size: 2rem;
  font-weight: bold;
  color: #ff0000;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #333;
}

.nav-links {
  display: flex;
  gap: 2.5rem;
}

.nav-links a {
  color: #333;
  text-decoration: none;
  font-size: 1rem;
  transition: color 0.3s, transform 0.3s;
}

.nav-links a:hover {
  color: #ff0000;
  transform: scale(1.1);
}

/* Container Styles */
.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 20px auto;
  max-width: 1000px;
  background-color: #fff;
  padding: 20px;
  border-radius: 15px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.game-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: #ffffff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
  width: 500px;  /* Set a fixed width for the game panel */
  max-width: 100%;  /* Ensure the game panel is responsive */
}

/* Game Title Styles */
.game-title {
  text-align: center;
  color: red;
  font-size: 2.5rem;
  margin-top: 20px;
}

/* Instructions Tab Container */
.tab-container {
  width: 100%;
  margin-bottom: 20px;
}

.tabs {
  display: flex;
  justify-content: space-between;
  background-color: #333333;
  border-bottom: 2px solid #b30000;
}

.tabs button {
  background-color: inherit;
  color: white;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 14px 20px;
  transition: background-color 0.3s ease;
  font-size: 16px;
  flex-grow: 1;
  text-align: center;
}

.tabs button:hover {
  background-color: #b30000;
}

.tabs button.active {
  background-color: #b30000;
  font-weight: bold;
}

.tabcontent {
  display: none;
  padding: 20px;
  animation: fadeEffect 0.5s;
  background-color: #ffffff;
  color: #333333;
}

.tabcontent h2 {
  margin-top: 0;
}

/* Fade in animation */
@keyframes fadeEffect {
  from {opacity: 0;}
  to {opacity: 1;}
}

/* Button Styles */
.button {
  padding: 12px 25px;
  margin: 10px 0;
  cursor: pointer;
  background-color: #FF0000;
  color: #FFFFFF;
  font-size: 18px;
  border: none;
  border-radius: 8px;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
  transition: background-color 0.3s, transform 0.2s;
  width: auto; /* Ensures the button does not expand to full width */
}

.button:hover {
  background-color: #CC0000;
}

/* Number Display Container */
#number-display-container {
  margin: 10px 0;
  min-height: 60px;
}

/* Number Card */
.number-card {
  font-size: 28px;
  border: 1px solid #333333;
  background-color: #eeeeee;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 60px;
  height: 60px;
  cursor: grab;
  box-sizing: border-box;
  transition: transform 0.2s;
  border-radius: 8px;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Grid Container */
.grid-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 20px;
  margin-bottom: 5px;
}

/* Plus Sign */
.plus-sign {
  font-size: 32px;
  margin-right: 38px;
  margin-top: 145px;
}

/* Line */
.line {
  width: 285px;
  height: 2px;
  background-color: #333333;
  margin: 5px 0;
}

/* Grid */
#grid {
  display: grid;
  grid-template-columns: repeat(3, 60px);
  grid-template-rows: repeat(3, 60px);
  gap: 10px;
}

.cell {
  width: 60px;
  height: 60px;
  border: 1px solid #333333;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 28px;
  box-sizing: border-box;
  transition: background-color 0.2s;
  border-radius: 8px;
}

.cell.drag-over {
  background-color: #ddd;
  border: 2px dashed #333333;
}

.cell.occupied {
  background-color: #eeeeee;
}

/* Sum Section */
.sum-section {
  display: flex;
  flex-direction: column;
  margin: 5px 19px;
}

/* Sum and Exchange Rows */
.sum-row, .exchange-row {
  display: flex;
  margin-bottom: 5px;
}

.sum-cell, .exchange-cell {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 60px;
  height: 60px;
  border: 1px solid #333333;
  margin-right: 10px;
  background-color: #e4e4e4;
  border-radius: 8px;
  box-sizing: border-box;
}

.sum-cell input, .exchange-cell input {
  width: 100%;
  height: 100%;
  text-align: center;
  border: none;
  font-size: 28px;
  background-color: #eeeeee;
  color: #000000;
  border-radius: 8px;
  box-sizing: border-box;
}

.result {
  margin-top: 10px;
  font-size: 24px;
  text-align: center;
  height: 50px;
}

.celebrate {
  color: #FF0000;
  font-size: 28px;
  font-weight: bold;
  animation: celebration 1s ease-in-out infinite alternate;
}

@keyframes celebration {
  0% { transform: scale(1); }
  100% { transform: scale(1.1); }
}

.dragging {
  opacity: 0.8;
  transform: rotate(-5deg) scale(1.2);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  position: absolute;
  pointer-events: none;
}

/* Footer Styles */
.footer {
  text-align: center;
  padding: 2rem 2rem;
  background-color: #f8f8f8;
  border-top: 1px solid #e0e0e0;
}

.footer p {
  margin: 0;
  color: #333;
  font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .navbar-content {
      flex-direction: column;
  }

  .button {
      width: auto; /* Ensures the button does not expand to full width on mobile */
      text-align: center;
  }

  .game-panel {
      width: 100%; /* Allows the game panel to be responsive on mobile */
      padding: 15px;
  }

  .game-title {
    font-size: 2rem;
  }
}
