@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap'); /* Example import */

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background: linear-gradient(135deg, #1a1a21, #16213e);
  background-image: url('tetris.png');
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  color: #f5f5f5;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem; 
  font-family: 'Press Start 2P', cursive;
}

/* Game Wrapper */
.game-wrapper {
  display: flex;
  gap: 2rem;
  padding: 2rem;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.5);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.7);
  flex-wrap: wrap;
  max-width: 1200px;
  width: 100%;
  backdrop-filter: blur(8px);
}

/* Sidebar Styles */
.sidebar {
  background: rgba(255, 255, 255, 0.06);
  padding: 1rem;
  border-radius: 16px;
  width: 140px;
  box-sizing: border-box;
  text-align: center;
  box-shadow: inset 0 0 12px rgba(255, 255, 255, 0.05);
}

.sidebar h2 {
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: #00e6e6;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 0.5rem;
}

#score {
  font-size: 1.5rem;
  color: #00ffc8;
  font-weight: bold;
  width: auto;
  height: auto;
}

.sidebar,
.side.left {
  width: 120px;
  padding: 0.5rem;
}

/* Game Area */
.game-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.game-title {
  font-size: 3rem;
  font-weight: bold;
  letter-spacing: 5px;
  background: linear-gradient(90deg, #00f2fe, #4facfe);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-align: center;
}

#grid {
  display: grid;
  grid-template-columns: repeat(10, 20px);
  grid-template-rows: repeat(20, 20px);
  gap: 1px;
  background-color: #0f0f0f;
  border: 3px solid #00f3fe;
  border-radius: 10px;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
}

.grid-cell {
  width: 20px;
  height: 20px;
  background-color: #1c1c1c;
  border-radius: 4px;
  transition: background-color 0.3s ease-in-out;
}

/* Game Buttons */
.button {
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 6px;
  background: linear-gradient(90deg, #00f2fe, #4facfe);
  color: #0a0a0a;
  font-weight: bold;
  cursor: pointer;
  transition: 0.3s ease;
  box-shadow: 0 5px 15px rgba(79, 195, 247, 0.2);
}

.button:hover {
  background: linear-gradient(90deg, #4facfe, #00f2fe);
  transform: scale(1.05);
}

#next-piece,
#next {
  width: 80px;
  height: 30px;
  border: 2px solid #4facfe;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 1px;
  background-color: #0f0f0f;
  border-radius: 8px;
  box-shadow: inset 0 0 10px rgba(0, 255, 255, 0.2);
}

#board {
  display: none;
}


/* Responsive Design */
@media (max-width: 768px) {
  .game-wrapper {
    flex-direction: column;
    align-items: center;
    padding: 1rem;
  }

  .sidebar {
    width: 90%;
  }

  .game-title {
    font-size: 2.2rem;
  }

  #grid {
    grid-template-columns: repeat(10, 25px);
    grid-template-rows: repeat(20, 25px);
  }

  .grid-cell {
    width: 25px;
    height: 25px;
  }

  button {
    padding: 8px 14px;
    font-size: 0.9rem;
  }

  #next-piece,
  #next {
    width: 100px;
    height: 100px;
  }
}

/* Controls Section */
.side-controls {
  position: fixed;
  top: 50%;
  right: 90px;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 999;
}


.side-controls button {
  padding: 12px 18px;
  font-size: 22px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(to right, #3f87a6, #ebf8e1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  background-color: #106e86;
  cursor: pointer;
  transition: all 0.2s ease;
}

.side-Controls button:hover {
  transform: scale(1.1);
  background: linear-gradient(to right, #3f87a6, #c4f0c2);
}

@media screen and (max-width: 600px) {
  .Controls button {
    font-size: 20px;
    padding: 10px 14px;
    flex: 1 1 45%;
  }

  .sidebar {
    width: 100%;
    text-align: center;
  }
}

/* General Button Styles */
.top-controls button,
.side-Controls button {
    padding: 0.8rem 1.5rem; /* Slightly more padding */
    border: none;
    border-radius: 8px; /* Consistent rounded corners */
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease-in-out; /* Smoother transitions */
    color: #fff; /* White text for better contrast */
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.4); /* Text shadow for pop */
    letter-spacing: 0.5px;
    background: linear-gradient(145deg, #00b4d8, #0077b6); /* More consistent blue gradient */
    box-shadow: 0 5px 15px rgba(0, 119, 182, 0.4);
}

.top-controls button:hover,
.side-Controls button:hover {
    transform: translateY(-2px) scale(1.02); /* Lift and slightly scale */
    box-shadow: 0 8px 20px rgba(0, 119, 182, 0.6); /* More prominent shadow on hover */
    background: linear-gradient(145deg, #0077b6, #00b4d8); /* Reverse gradient on hover */
}

.top-controls button:active,
.side-Controls button:active {
    transform: translateY(1px); /* Press effect */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); /* Flatter shadow when pressed */
}

/* Specific Mobile Controls (if you want different styles) */
.side-Controls button {
    background: linear-gradient(145deg, #6a0572, #8b0a90); /* Distinct color for mobile controls */
    box-shadow: 0 4px 12px rgba(139, 10, 144, 0.3);
}

.side-Controls button:hover {
    background: linear-gradient(145deg, #8b0a90, #6a0572);
    box-shadow: 0 6px 15px rgba(139, 10, 144, 0.5);
}

.game-over {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(20, 20, 20, 0.95);
  padding: 2rem;
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 0 30px rgba(255, 0, 0, 0.4);
  z-index: 999;
}

.game-over h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: #ff3366;
}

#restart-button {
  padding: 0.6rem 1.5rem;
  font-size: 1rem;
  background: linear-gradient(to right, #ff416c, #ff4b2b);
  border: none;
  border-radius: 10px;
  color: white;
  cursor: pointer;
  transition: 0.3s;
}

#restart-button:hover {
  transform: scale(1.05);
}

/* Sidebar Container */
.sidebar.left {
  background: rgba(255, 255, 255, 0.06);
  padding: 1rem;
  border-radius: 16px;
  width: 160px;
  text-align: center;
  box-shadow: inset 0 0 12px rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
}

/* Next Title */
.sidebar.left h2 {
  font-size: 1rem;
  color: #00e6e6;
  margin-bottom: 0.3rem;
  letter-spacing: 1px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  width: 100%;
  padding-bottom: 0.3rem;
}

/* Canvas Container for Glow Effect */
.next-piece-wrapper {
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid rgba(0, 255, 255, 0.3);
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 0 12px rgba(0, 255, 255, 0.2);
  backdrop-filter: blur(2px);
  display: inline-block;
}

/* Canvas Style */
#next-piece-canvas {
  display: block;
  background-color: #0f0f0f;
  border-radius: 8px;
}

.next-piece-wrapper:hover {
  box-shadow: 0 0 18px rgba(0, 255, 255, 0.4);
  transform: scale(1.03);
  transition: all 0.3s ease-in-out;
}

.mobile-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.mobile-controls .row {
  display: flex;
  gap: 0.5rem;
}

.mobile-controls button {
  padding: 10px 15px;
  font-size: 1.2rem;
  border: none;
  border-radius: 10px;
  background: #444;
  color: white;
  transition: 0.2s;
}

.mobile-controls button:active {
  background: #666;
}

@media (max-width: 768px) {
  canvas {
    width: 100%;
    height: auto;
  }

  .game-container {
    flex-direction: column;
    align-items: center;
  }
}

canvas#game-board {
  width: auto !important;
  height: auto !important;
}