body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f4f4f4;
}

.header {
  text-align: center;
  background-color: #222;
  color: #fff;
  padding: 20px 0;
}

.main-container {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  padding: 20px;
  gap: 20px;
}

.card-library,
.deck-builder {
  flex: 1;
  margin: 10px;
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.1);
  overflow-y: auto;
  max-height: calc(100vh - 150px);
}

.filters {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  overflow-y: auto;
  max-height: calc(100vh - 250px);
}

.deck-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 15px;
  background-color: #f9f9f9;
  border-radius: 10px;
  border: 1px solid #ddd;
  padding: 10px;
  max-height: calc(100vh - 250px);
  overflow-y: auto;
}

.deck-size-counter {
  font-size: 18px;
  font-weight: bold;
  color: #333;
  margin-bottom: 10px;
  text-align: center;
}

.card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  padding: 10px;
  margin: 10px;
  width: 140px;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.card img {
  width: 100px;
  height: auto;
  margin-bottom: 10px;
  border-radius: 4px;
}

.card p {
  margin: 5px 0;
  font-size: 0.85rem;
  line-height: 1.2;
  color: #333;
}



.clear-btn {
  display: block;
  margin: 10px auto;
  padding: 10px 20px;
  background-color: #ff4d4d;
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.2s;
}

.clear-btn:hover {
  background-color: #cc0000;
  transform: scale(1.05);
}

#deck-chart {
  max-height: 200px;
  margin: 10px 0;
  padding: 10px;
  background-color: #f5f5f5;
  border-radius: 10px;
}

.deck-item {
  display: grid;
  grid-template-columns: 40px 60px auto 50px;
  align-items: center;
  gap: 15px; /* Increased gap for better spacing */
  padding: 15px;
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s, box-shadow 0.2s;
}

.deck-item:hover {
  transform: scale(1.02);
  box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.2);
}

.deck-card-cost {
  font-size: 18px;
  font-weight: bold;
  color: #555;
  text-align: center;
  grid-column: 1 / 2; /* Positioned in the first column */
}

.deck-card-image {
  width: 60px;
  height: auto;
  border-radius: 5px;
  border: 1px solid #ccc;
  grid-column: 2 / 3; /* Positioned in the second column */
}

.deck-card-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: left;
  gap: 10px; /* Increased gap for better spacing */
  grid-column: 3 / 4; /* Positioned in the third column */
}

.deck-card-name {
  font-size: 16px;
  font-weight: bold;
  color: #333;
  margin: 0;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.deck-card-count {
  font-size: 16px;
  font-weight: bold;
  color: white;
  text-align: center;
  background-color: #007BFF;
  border-radius: 5px;
  padding: 5px 10px;
  grid-column: 4 / 5; /* Positioned in the last column */
  box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.2);
}

/* Save Deck Information CSS */
.deck-save-controls {
  display: flex;
  gap: 10px;
  margin: 10px 0;
  justify-content: center;
}

.deck-name-input {
  flex: 1;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 16px;
}

.save-deck-btn {
  padding: 10px 20px;
  background-color: #007BFF;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
}

.save-deck-btn:hover {
  background-color: #0056b3;
}

.saved-decks {
  margin-top: 20px;
}

.saved-decks-list {
  list-style: none;
  padding: 0;
}

.saved-decks-list li {
  margin: 5px 0;
  padding: 10px;
  background-color: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.saved-decks-list li button {
  background-color: #ff4d4d;
  color: white;
  border: none;
  padding: 5px 10px;
  border-radius: 5px;
  cursor: pointer;
}

.saved-decks-list li button:hover {
  background-color: #cc0000;
}

.btn-blue {
  background-color: #007BFF; /* Blue background */
  color: white; /* White text */
  border: none; /* No border */
  padding: 10px 15px; /* Padding for size */
  font-size: 16px; /* Font size */
  border-radius: 5px; /* Rounded corners */
  cursor: pointer; /* Pointer cursor on hover */
  transition: background-color 0.3s ease; /* Smooth hover effect */
}

.btn-blue:hover {
  background-color: #0056b3; /* Darker blue on hover */
}

/* Card count hover for better distinction */
.deck-card-count:hover {
  background-color: #0056b3;
}

.deck-card-info > p {
  margin: 0;
  padding: 0;
  font-size: 14px;
  color: #666;
  line-height: 1.4;
}

/* Rules Button Style */
.menu {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

.menu-btn {
  padding: 10px 20px;
  color: white;
  background-color: #007BFF;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.2);
  transition: background-color 0.3s ease, transform 0.2s;
}

.menu-btn:hover {
  background-color: #0056b3;
  transform: scale(1.1);
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.8);
}

.modal-content {
  background-color: #fff;
  margin: 5% auto;
  padding: 20px;
  border-radius: 10px;
  width: 80%;
  max-width: 900px;
  text-align: center;
}

.modal-content img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  margin-bottom: 20px;
  border: 2px solid #ddd;
  border-radius: 10px;
}

.modal .close-button {
  position: absolute;
  top: 10px;
  right: 20px;
  color: white;
  font-size: 28px;
  font-weight: bold;
  background-color: rgba(0, 0, 0, 0.7);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal .close-button:hover {
  background-color: rgba(0, 0, 0, 0.9);
}

.rules-image {
  width: 100%;
  max-width: 800px;
  margin-bottom: 20px;
  border: 2px solid #ccc;
  border-radius: 10px;
}

/* Color Dot for Gem Cards */
.card .gem-color-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}

.card .gem-color-red {
  background-color: red;
}

.card .gem-color-blue {
  background-color: blue;
}

.card .gem-color-green {
  background-color: green;
}

.card .gem-color-purple {
  background-color: purple;
}

/* Card Image Click Pointer */
.card img {
  cursor: pointer;
}

/* Footer */
footer {
  text-align: center;
  padding: 10px;
  background-color: #222;
  color: #fff;
}

/* Adjusted Modal Rules for Larger Images */
.modal-content img.rules-image {
  max-height: 600px;
  margin-bottom: 20px;
}

/* Minor Adjustments for Scrollbar Visibility */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-thumb {
  background-color: #aaa;
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: #555;
}
