body {
  font-family: Arial, sans-serif;
  text-align: center;
  background: #f0f8ff;
  padding: 20px;
}

h1, h2, h3 {
  color: #2a2a2a;
}

/* Game Container */
.game-container {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  margin-top: 30px;
  gap: 20px;
}

/* Symbols and Dropzones - FIXED VERSION */
.symbols, .dropzones {
  width: 45%;
  min-height: 400px;
  padding: 15px;
  border: 2px dashed #ccc;
  border-radius: 10px;
  background: #ffffff;
  display: flex;
  flex-direction: column; /* This ensures vertical stacking */
  align-items: center; /* Center items horizontally */
  gap: 12px; /* Space between items */
}

/* Draggable Elements - FIXED VERSION */
.draggable {
  background: #3498db;
  color: white;
  padding: 15px 20px;
  border-radius: 5px;
  font-size: 18px;
  cursor: grab;
  user-select: none;
  width: 120px; /* Fixed width */
  text-align: center;
  margin: 0; /* No margins */
  display: block; /* Ensure block display */
  flex: none; /* Prevent flex growing/shrinking */
}

/* Dropzone Elements - FIXED VERSION */
.dropzone {
  background: #2ecc71;
  padding: 15px 20px;
  min-height: 50px;
  border-radius: 5px;
  font-size: 18px;
  user-select: none;
  transition: background 0.3s ease;
  width: 200px; /* Fixed width */
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  word-wrap: break-word;
  margin: 0; /* No margins */
  flex: none; /* Prevent flex growing/shrinking */
}

.dropzone.hover {
  background: #27ae60;
}

.dropzone.locked {
  opacity: 0.7;
  pointer-events: none;
}

.correct-match {
  animation: bounce 0.5s ease;
}

@keyframes bounce {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

#score, #timer {
  margin-top: 20px;
  font-size: 20px;
}

#progress-container {
  width: 80%;
  background: #ddd;
  height: 20px;
  margin: 20px auto;
  border-radius: 10px;
  overflow: hidden;
}

#progress-bar {
  width: 100%;
  height: 100%;
  background: #3498db;
  transition: width 1s linear;
}

/* Summary Modal Styling */
.modal {
  display: none;
  position: fixed;
  z-index: 999;
  left: 0; top: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.6);
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: #fff;
  padding: 30px;
  border-radius: 10px;
  text-align: center;
  max-width: 500px;
  width: 90%;
}

.modal-content h2 {
  margin-bottom: 20px;
}

#summaryResults {
  text-align: left;
  margin-bottom: 20px;
}

#summaryResults div {
  margin: 5px 0;
  font-size: 16px;
}

#playAgainBtn {
  background: #3498db;
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

/* History Table */
#pmg-history table, .pmg-full-history table, .pmg-leaderboard table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
}

#pmg-history table th, #pmg-history table td,
.pmg-full-history table th, .pmg-full-history table td,
.pmg-leaderboard table th, .pmg-leaderboard table td {
  border: 1px solid #ddd;
  padding: 8px;
  text-align: center;
}

#pmg-history table th,
.pmg-full-history table th,
.pmg-leaderboard table th {
  background-color: #3498db;
  color: white;
}

.pmg-full-history {
  max-width: 800px;
  margin: 30px auto;
  background: #f9f9f9;
  padding: 25px;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.pmg-history-entry {
  border-bottom: 1px solid #ccc;
  margin-bottom: 20px;
  padding-bottom: 15px;
  text-align: left;
}

.pmg-history-entry h3 {
  margin-bottom: 10px;
  font-size: 18px;
}

.pmg-history-entry ul {
  list-style: none;
  padding-left: 20px;
}

.pmg-history-entry ul li {
  padding: 4px 0;
  font-size: 16px;
}

/* Leaderboard */
.pmg-leaderboard {
  max-width: 800px;
  margin: 30px auto;
  background: #fdfdfd;
  padding: 25px;
  border-radius: 10px;
  box-shadow: 0 0 8px rgba(0,0,0,0.1);
}

.pmg-leaderboard table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.pmg-leaderboard th, .pmg-leaderboard td {
  padding: 10px;
  border-bottom: 1px solid #ddd;
}

.pmg-leaderboard th {
  background-color: #3498db;
  color: white;
}

.pmg-leaderboard tr:nth-child(even) {
  background-color: #f2f2f2;
}

@keyframes snapBack {
  0% { transform: scale(1.1); opacity: 0.7; }
  100% { transform: scale(1); opacity: 1; }
}

.snap-back {
  animation: snapBack 0.3s ease;
}

.pmg-pagination {
  margin-top: 20px;
  text-align: center;
}

.pmg-pagination a {
  display: inline-block;
  padding: 6px 12px;
  margin: 0 5px;
  border: 1px solid #3498db;
  color: #3498db;
  text-decoration: none;
  border-radius: 4px;
}

.pmg-pagination a.active,
.pmg-pagination a:hover {
  background-color: #3498db;
  color: white;
}

/* Element category colors */
.draggable.alkali-metal { 
  background: #FF6B6B;
  color: white;
}
.draggable.alkaline-earth { 
  background: #FFA502;
  color: white;
}
.draggable.transition-metal { 
  background: #1E90FF;
  color: white;
}
.draggable.post-transition { 
  background: #20B2AA;
  color: white;
}
.draggable.metalloid { 
  background: #32CD32;
  color: white;
}
.draggable.nonmetal { 
  background: #9370DB;
  color: white;
}
.draggable.halogen { 
  background: #FFD700;
  color: #333;
}
.draggable.noble-gas { 
  background: #FF1493;
  color: white;
}
.draggable.lanthanide { 
  background: #9932CC;
  color: white;
}
.draggable.actinide { 
  background: #FF4500;
  color: white;
}
.draggable.unknown { 
  background: #778899;
  color: white;
}

/* Hover effects */
.draggable:hover {
  filter: brightness(110%);
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  transition: all 0.2s ease;
}

/* Text styling */
.draggable {
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
  font-weight: bold;
}

/* Instructions styling */
.pmg-instructions {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 12px;
  margin: 15px auto;
  max-width: 500px;
  border-left: 4px solid #3498db;
}

.pmg-instructions p {
  margin: 0 0 8px 0;
  font-size: 15px;
  color: #555;
}

.instruction-demo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.demo-symbol {
  background: #3498db;
  color: white;
  padding: 6px 12px;
  border-radius: 4px;
  font-weight: bold;
}

.demo-arrow {
  color: #7f8c8d;
  font-size: 18px;
}

.demo-name {
  background: #2ecc71;
  color: white;
  padding: 6px 12px;
  border-radius: 4px;
}

/* Animation for first-time users */
@keyframes pulseDemo {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

body.first-visit .instruction-demo {
  animation: pulseDemo 2s ease-in-out 3;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .game-container {
    flex-direction: column;
    align-items: center;
    gap: 15px;
  }
  
  .symbols, .dropzones {
    width: 95%;
    min-height: 250px;
  }
  
  .draggable, .dropzone {
    width: 90%;
    max-width: 200px;
  }
}