body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: linear-gradient(135deg, #2c3e50, #4a5568);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(
      circle at 20% 30%,
      rgba(66, 153, 225, 0.15) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 70%,
      rgba(237, 100, 166, 0.15) 0%,
      transparent 50%
    );
  z-index: -1;
}

.page-header {
  width: 100%;
  text-align: center;
  margin-bottom: 0;
  opacity: 1;
  transition: opacity 2s ease-out;
}

.page-header h1 {
  font-size: 36px;
  font-weight: bold;
  color: white;
  margin: 5px 0;
  padding: 0;
  text-shadow: 0 2px 10px rgba(66, 153, 225, 0.5);
}

.page-header.fade-out {
  opacity: 0;
}

.container {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  gap: 20px;
  margin-top: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 200px;
}

.scores-sidebar {
  order: 1;
}

.buttons-sidebar {
  order: 3;
}

.title {
  font-size: 24px;
  font-weight: bold;
  color: white;
  text-align: center;
  text-shadow: 0 2px 10px rgba(66, 153, 225, 0.5);
}

.score-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.score-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 10px;
  padding: 24px 0;
  background: linear-gradient(
    135deg,
    rgba(30, 41, 59, 0.8),
    rgba(15, 23, 42, 0.9)
  );
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.3),
    inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.score-label {
  font-weight: bold;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 14px;
}

.score-value {
  font-size: 24px;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 0 10px rgba(66, 153, 225, 0.5);
}

.btn {
  background: #19a;
  color: white;
  border: none;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: bold;
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  width: 100%;
  margin-top: 10px;
}

.btn:hover {
  transform: translateY(-3px) scale(1.05);
}

.btn:disabled {
  background: #ccc;
  color: #666;
  box-shadow: none;
  cursor: not-allowed;
  transform: none !important;
}

.btn:disabled:hover,
.help-btn:disabled:hover {
  transform: none;
}

#new-game-btn {
  width: 50%;
}

#game-container {
  background-color: #1a202c;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
  order: 2;
}

#game {
  display: grid;
  border-radius: 4px;
  z-index: 1;
}

.piece {
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.3);
  /*transition: all 0.2s ease-out;*/
  z-index: 1;

  display: flex;
  justify-content: center;
  align-items: center;

  color: white;
  font-weight: 500;
  font-size: 1.7em;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.piece.connected {
  transform: scale(1.15) !important;
  box-shadow: 0 12px 20px rgba(0, 0, 0, 0.4) !important;
  border-color: rgba(255, 255, 255, 0.5) !important;
  opacity: 1 !important;
  z-index: 10;
}

.piece.red {
  background: linear-gradient(135deg, #ff5500, #ff0055);
  box-shadow:
    inset 0 0 15px rgba(255, 0, 0, 0.6),
    0 4px 8px rgba(0, 0, 0, 0.3);
  opacity: 0.9;
}

.piece.blue {
  background: linear-gradient(135deg, #00f0ff, #0070ff);
  box-shadow:
    inset 0 0 15px rgba(0, 150, 255, 0.7),
    0 4px 8px rgba(0, 0, 0, 0.3);
  opacity: 0.9;
}

.piece.yellow {
  background: linear-gradient(135deg, #ffee00, #ff8800);
  box-shadow:
    inset 0 0 15px rgba(255, 200, 0, 0.7),
    0 4px 8px rgba(0, 0, 0, 0.3);
  opacity: 0.9;
}

.piece.green {
  background: linear-gradient(135deg, #00ff99, #00cc66);
  box-shadow:
    inset 0 0 15px rgba(0, 220, 100, 0.7),
    0 4px 8px rgba(0, 0, 0, 0.3);
  opacity: 0.9;
}

.piece.purple {
  background: linear-gradient(135deg, #d442ff, #8a2be2);
  box-shadow:
    inset 0 0 15px rgba(160, 32, 240, 0.7),
    0 4px 8px rgba(0, 0, 0, 0.3);
  opacity: 0.9;
}

.piece.gray {
  background: linear-gradient(135deg, #777777, #cccccc);
  box-shadow:
    inset 0 0 15px rgba(160, 160, 160, 0.7),
    0 4px 8px rgba(0, 0, 0, 0.3);
  opacity: 0.9;
}

.game-over-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 100;
  border-radius: 8px;
  backdrop-filter: blur(5px);
}

.game-over-overlay.visible {
  display: flex;
}

.game-over-content {
  background: linear-gradient(
    135deg,
    rgba(30, 41, 59, 0.9),
    rgba(15, 23, 42, 0.95)
  );
  padding: 30px;
  border-radius: 10px;
  text-align: center;
  max-width: 80%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
}

.game-over-content h2 {
  margin-top: 0;
  color: #fff;
  font-size: 28px;
  text-shadow: 0 2px 10px rgba(66, 153, 225, 0.5);
}

.game-over-content p {
  font-size: 18px;
  margin: 20px 0;
  color: rgba(255, 255, 255, 0.9);
}

.game-over-content p span {
  font-weight: bold;
  color: #4fd1c5;
}

.new-game-btn {
  background: #19a;
  color: white;
  border: none;
  padding: 12px 24px;
  font-size: 20px;
  font-weight: bold;
  border-radius: 10px;
  cursor: pointer;
}

.modal {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
}

.modal-content {
  background: linear-gradient(
    135deg,
    rgba(30, 41, 59, 0.9),
    rgba(15, 23, 42, 0.95)
  );
  margin: 15% auto;
  padding: 30px;
  border-radius: 10px;
  max-width: 600px;
  width: 80%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  position: relative;
}

.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  position: absolute;
  top: 10px;
  right: 20px;
}

.close:hover {
  color: white;
}

.modal-content h2 {
  margin-top: 0;
  color: #fff;
  font-size: 24px;
}

/* Settings Dialog Styles */
.settings-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 20px;
}

.setting-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.setting-item label {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.9);
}

.slider {
  -webkit-appearance: none;
  width: 100%;
  height: 10px;
  border-radius: 5px;
  background: #2c3e50;
  outline: none;
  opacity: 0.7;
  -webkit-transition: 0.2s;
  transition: opacity 0.2s;
}

.slider:hover {
  opacity: 1;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #19a;
  cursor: pointer;
}

.slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #19a;
  cursor: pointer;
}

.checkbox-container {
  flex-direction: row;
  align-items: center;
}

input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-right: 10px;
  cursor: pointer;
}

#settings-save-btn {
  margin-top: 20px;
  align-self: center;
  width: auto;
}

@media (max-width: 768px) {
  .page-header h1 {
    font-size: 28px;
  }
  .container {
    flex-direction: column;
    align-items: center;
  }
  .sidebar {
    width: 100%;
    max-width: 450px;
    margin-top: 20px;
    margin-bottom: 0;
  }
  .scores-sidebar {
    order: 2;
  }
  .buttons-sidebar {
    order: 3;
  }
  #game-container {
    order: 1;
  }
  .score-container {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }
  .score-box {
    width: 25%;
    min-width: 100px;
  }
}
