* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  font-family: 'Segoe UI', sans-serif;
  background: #1e1e2f;
  color: #f0f0f0;
  text-align: center;
  -webkit-user-select: none; /* Prevents text selection */
  -ms-user-select: none;
  user-select: none;
  overscroll-behavior: none; /* Prevents scroll bounce on mobile */
}

h1 {
  margin: 20px 0 10px;
  font-size: 5rem;
}

.board-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2vw;
  overflow: auto;
}

#board {
  --cell-size: clamp(24px, 7vw, 50px);
  display: grid;
  grid-template-columns: repeat(var(--cols), var(--cell-size));
  gap: 8px;
  width: max-content;
  margin: 0 auto;

  -webkit-user-select: none;
  -ms-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

.cell {
  width: var(--cell-size);
  height: var(--cell-size);
  font-size: clamp(12px, 4vw, 20px);
  display: flex;
  align-items: center;
  justify-content: center;

  background-color: #2c2f4a;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  border: none;
  color: #f0f0f0;

  transition: background-color 0.15s ease, transform 0.15s ease;
}

.cell:hover {
  background-color: #464a6e;
  box-shadow: 0 0 8px 2px #7884ff88;
}

.cell.revealed {
  background-color: #3e4160;
  cursor: default;
  animation: revealAnim 0.2s ease forwards;
}

.cell.revealed:not(.mine):not(.flagged) {
  font-weight: bold;
  color: #fff;
}

.cell.flagged {
  color: #ffcf3f;
  animation: flagPop 0.2s ease forwards;
}

.cell.mine {
  color: #ff4f4f;
}

.cell.mine.exploded {
  animation: shake 0.4s ease;
  background-color: #b33;
  color: #fff;
  box-shadow: 0 0 10px 3px #ff4f4fcc;
  border-radius: 6px;
}

@keyframes revealAnim {
  0% {
    opacity: 0;
    transform: scale(0.6);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes flagPop {
  0% { transform: scale(0); }
  70% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

.controls {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;           /* so items wrap on smaller screens */
  justify-content: center;   /* center all children horizontally */
  align-items: center;       /* align vertically in a row */
  gap: 15px;                 /* space between items */
  padding: 20px 0;
  max-width: 600px;          /* optional max width so it doesn’t stretch too much */
  margin: 0 auto;            /* center container itself if needed */
}

select, button {
  padding: 6px 12px;
  margin: 0 5px;
  border-radius: 4px;
  border: none;
  font-size: 1rem;
  background: #3a3d5c;
  color: #f0f0f0;
  cursor: pointer;
  transition: background 0.2s ease;
  min-height: 44px;
  min-width: 44px;
}

select:focus, button:focus {
  outline: none;
  box-shadow: 0 0 0 2px #7884ff;
}

select:hover, button:hover {
  background: #50547a;
}

#popup {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: rgba(30, 30, 47, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  transition: opacity 0.3s ease;
}

#popup-content {
  background: #2c2f4a;
  padding: 30px 40px;
  border-radius: 10px;
  text-align: center;
  box-shadow: 0 0 20px #7884ffaa;
  animation: popupScale 0.3s ease forwards;
}

#popup-content h2 {
  margin-bottom: 20px;
  font-size: 2rem;
  color: #b2b8ffaa;
}

#popup-content button {
  padding: 10px 25px;
  font-size: 1.1rem;
  border: none;
  border-radius: 6px;
  background: #7884ff;
  color: #fff;
  cursor: pointer;
  transition: background 0.3s ease;
}

#popup-content button:hover {
  background: #596edb;
}

.hidden {
  display: none !important;
}

@keyframes popupScale {
  0% {
    transform: scale(0.6);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Popup bounce */
.win-animate #popup-message {
  animation: bounceIn 0.8s ease;
}

@keyframes bounceIn {
  0%   { transform: scale(0.5); opacity: 0; }
  60%  { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); }
}

/* Sparkle effect */
.sparkle {
  animation: sparkle 0.5s ease-out forwards;
  background-color: gold !important;
  box-shadow: 0 0 10px gold;
}
@keyframes sparkle {
  0% { transform: scale(0.9); opacity: 0.5; }
  100% { transform: scale(1.2); opacity: 1; }
}

/* Board pulse */
.board-win-pulse {
  animation: boardPulse 2s infinite alternate;
}
@keyframes boardPulse {
  0%   { box-shadow: 0 0 0px rgba(255, 255, 0, 0.3); }
  100% { box-shadow: 0 0 25px rgba(255, 255, 0, 0.6); }
}

/* Confetti */
.confetto {
  position: fixed;
  top: -20px;
  width: 10px;
  height: 10px;
  opacity: 0.9;
  z-index: 9999;
  border-radius: 50%;
  animation: fall 5s ease-out forwards;
}
@keyframes fall {
  to {
    transform: translateY(100vh) rotateZ(360deg);
    opacity: 0;
  }
}


#debug-menu {
  position: fixed;
  bottom: 10px;
  right: 10px;
  background: #222;
  color: white;
  padding: 10px;
  border-radius: 8px;
  z-index: 9999;
  box-shadow: 0 0 10px rgba(0,0,0,0.5);
  font-family: monospace;
}
#debug-menu button {
  display: block;
  margin: 5px 0;
  width: 100%;
}
.hidden {
  display: none;
}


#difficulty {
  padding: 10px 15px;
  font-size: 16px;
  border-radius: 6px;
  border: 1.5px solid #888;
  background-color: #333333;
  cursor: pointer;
  transition: border-color 0.3s ease;
  outline: none;
  width: 180px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

#difficulty:hover,
#difficulty:focus {
  border-color: #ffffff;
  box-shadow: 0 0 8px rgba(0,123,255,0.5);
  background-color: #666666;
}

#customInputs {
  display: flex;
  flex-direction: row;      /* side-by-side inputs */
  justify-content: center;  /* center them horizontally */
  gap: 15px;                /* space between inputs */
  margin-top: 10px;
  width: 100%;
}

@media (max-width: 500px) {
  #customInputs {
    flex-direction: column;
    align-items: center; /* center inputs when stacked */
  }
}



#customInputs input[type="number"] {
  background-color: #333333;
  flex: 1;
  padding: 10px 12px;
  font-size: 16px;
  border-radius: 6px;
  border: 1.5px solid #888;
  outline: none;
  transition: border-color 0.3s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  color: white;
  
}

#customInputs input[type="number"]:focus {
  border-color: #ffffff;
  box-shadow: 0 0 8px rgba(0,123,255,0.5);
  background-color: #5e5e5e;
}

#customInputs input::placeholder {
  color: #ffffff;
}

#leaderboard {
  position: absolute;
  top: 10px;
  left: 10px;
  background-color: rgba(0, 0, 0, 0.7); /* optional for visibility */
  color: white;                         /* optional for contrast */
  padding: 10px;
  border-radius: 5px;
  max-width: 200px;                     /* optional */
  font-family: monospace;              /* style suggestion */
}

.mine img {
  width: 20px;
  height: 20px;
  display: block;
  margin: auto;
}
/* Flex container for the logos */
.logo-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
}

/* Consistent logo styling */

#Brand-logo img,
#Website-logo img{
  height: 60px; /* or whatever looks good */
  width: auto;
  max-width: 100%;
}

/* Responsive tweak */
@media (max-width: 700px) {
  .logo-bar {
    padding: 5px 10px;
  }

  #Website-logo img,
  #Brand-logo img {
    height: 30px;
  }
}
