* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: #f3f3f3;
  font-family: 'Times New Roman', Times, serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
  gap: 20px;
}

/* Site Title */
.site-title {
  font-size: 1.5em;
  margin: 10px auto;
}

/* Updated Rules Section Styling */
.rules-section {
  margin: 10px auto;
  width: 100%;
  max-width: 600px;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 5px;
  background: #f9f9f9;
  box-sizing: border-box;
}

/* Force the <details> element to take up full width */
.rules-section details {
  width: 100%;
  box-sizing: border-box;
}

/* Remove the default marker */
.rules-section summary::-webkit-details-marker {
  display: none;
}

/* Add custom triangle marker to the summary */
.rules-section summary::before {
  content: "\25B6";
  display: inline-block;
  margin-right: 8px;
  transition: transform 0.2s ease;
}

/* Rotate the triangle when the details are open */
.rules-section details[open] summary::before {
  transform: rotate(90deg);
}


/* Make the <summary> always full width even when collapsed */
.rules-section summary {
  display: block;
  width: 100%;
  min-width: 100%;
  padding: 10px;
  border-radius: 3px;
  cursor: pointer;
  font-weight: bold;
  box-sizing: border-box;
  margin: 0;
}

/* When the details element is open, add internal padding so content doesn’t touch the edges */
.rules-section details[open] {
  box-sizing: border-box;
}

/* Ensure the ordered list inside the details has appropriate indentation */
.rules-section details[open] ol {
  margin: 0;
  padding: 10px;
  padding-left: 30px;
  box-sizing: border-box;
}

/* Search Container */
#search-container {
  width: 100%;
  max-width: 600px;
  margin-bottom: 20px;
}

.search-wrapper {
  position: relative;
}

#search {
  width: 100%;
  padding: 10px 40px 10px 10px; /* extra right padding for the clear button */
  font-size: 1em;
}

#clear-search {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  font-size: 1.2em;
  color: #aaa;
  display: none; /* Hidden by default */
}

/* Card Container */
.card {
  background: #fff;
  border: 1px solid #ccc;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  width: 600px;
  max-width: 90%;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  border-radius: 8px;
}

/* Card Image Section */
.card-image {
  flex: 1 1 40%;
  overflow: hidden;
}

.card-image img {
  width: 100%;
  height: auto;
  display: block;
}

/* Card Content Section */
.card-content {
  flex: 1 1 60%;
  padding: 16px;
  display: flex;
  flex-direction: column;
}

/* Card Header: Title & Mana Cost */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.card-title {
  font-size: 1.5em;
  color: #222;
}

.card-mana-cost {
  font-size: 1.2em;
  color: #555;
}

/* Type Line */
.card-type-line {
  margin-bottom: 8px;
  font-style: italic;
  color: #666;
}

/* Rules Text */
.card-rules-text p {
  line-height: 1.4;
  margin-bottom: 12px;
  color: #333;
}

/* Flavor Text */
.card-flavor-text {
  font-size: 0.9em;
  color: #888;
  margin-bottom: 12px;
}

/* Stats (e.g., Power/Toughness) */
.card-stats {
  margin-top: auto;
  text-align: right;
  font-size: 1.2em;
  font-weight: bold;
  border-top: 1px solid #eee;
  padding-top: 8px;
}

/* Responsive: Stack image on top for smaller screens */
@media (max-width: 600px) {
  .card {
    flex-direction: column;
  }
  
  .card-image,
  .card-content {
    width: 100%;
  }
  
  .card-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .card-mana-cost {
    margin-top: 4px;
  }
}
