        /* --- Paste your entire CSS here --- */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Dark Mode (Default) */
body.dark-mode {
  background-color: #0f172a;
  color: #e2e8f0;
}

body.dark-mode .card {
  background-color: #1e293b;
}

body.dark-mode select,
body.dark-mode button { /* Added button */
  background-color: #1e293b;
  color: white;
  border: 1px solid #4b5563; /* Consistent border */
}
body.dark-mode button:hover { /* Added button hover */
  background-color: #334155;
}

/* Dark mode: Warm light glow on hover */
@media (prefers-color-scheme: dark) {
  .card:hover {
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2), 0 6px 20px rgba(255, 255, 255, 0.19);
  }
}

/* Light Mode */
body.light-mode {
  background-color: #f8fafc;
  color: #1e293b;
}

body.light-mode .card {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
}

body.light-mode select,
body.light-mode button { /* Added button */
  background-color: #ffffff;
  color: #1e293b;
  border: 1px solid #d1d5db; /* Consistent border */
}
body.light-mode button:hover { /* Added button hover */
  background-color: #e2e8f0;
}

body.light-mode .function-grid p {
  color: #334155;
}

/* Light mode: Warm light glow on hover */
@media (prefers-color-scheme: light) {
  .card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), 0 6px 20px rgba(0, 0, 0, 0.19);
  }
}

.select-none {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}
.function-card {
  transition: all 0.3s ease;
  border-left: 4px solid transparent;
  display: flex;
  flex-direction: column;
  height: auto;
  padding: 1rem;
  position: relative;
  overflow: hidden;
  border-radius: 0.5rem; /* Added for consistency with .card */
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); /* Added for consistency */
}

.function-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.card-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 0.75rem;
  margin-bottom: 1rem !important;
}

body.light-mode .card-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.function-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0;
  letter-spacing: -0.01em;
}

.position-badge {
  font-size: 0.75rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-weight: 600;
  display: inline-block;
  white-space: nowrap;
}

.card-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.description-section {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #e2e8f0;
}

body.light-mode .section-title {
  color: #1e293b;
}

.function-description {
  font-size: 0.9rem;
  line-height: 1.7;
  margin-bottom: 1.25rem;
  flex: 1;
  color: rgba(226, 232, 240, 0.9);
}

body.light-mode .function-description {
  color: rgba(30, 41, 59, 0.9);
}

.attributes-section {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

body.light-mode .attributes-section {
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.attribute-tag {
  border-radius: 9999px;
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
  font-weight: 500;
  display: inline-block;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin-bottom: 0.5rem; /* Added spacing */
}

.positive-tag.attribute-tag {
  background-color: rgba(16, 185, 129, 0.15);
  color: rgb(52, 211, 153);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.negative-tag.attribute-tag {
  background-color: rgba(239, 68, 68, 0.15);
  color: rgb(248, 113, 113);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

body.light-mode .positive-tag.attribute-tag {
  background-color: rgba(16, 185, 129, 0.1);
  color: rgb(5, 150, 105);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

body.light-mode .negative-tag.attribute-tag {
  background-color: rgba(239, 68, 68, 0.1);
  color: rgb(220, 38, 38);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.navigation-section {
  margin-top: auto;
  padding-top: 1rem;
}

/* Back to top button styling with increased specificity */
.function-card button.back-to-top {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  font-size: 0.8rem;
  background-color: #3b4a66;
  color: white;
  border-radius: 0.375rem;
  transition: all 0.3s ease;
  font-weight: 500;
  text-decoration: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  border: none;
  cursor: pointer;
}

.function-card button.back-to-top:hover {
  background-color: #4a5d81;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.position-0 { border-left-color: #2563eb; } /* Blue - Hero/Dominant */
.position-1 { border-left-color: #10b981; } /* Green - Parent/Auxiliary */
.position-2 { border-left-color: #f59e0b; } /* Amber - Child/Tertiary */
.position-3 { border-left-color: #ef4444; } /* Red - Aspiration/Inferior */
.position-4 { border-left-color: #8b5cf6; } /* Purple - Opposition/Shadow */
.position-5 { border-left-color: #6b7280; } /* Gray - Critical/Nemesis */
.position-6 { border-left-color: #ec4899; } /* Pink - Trickster */
.position-7 { border-left-color: #1f2937; } /* Dark Gray - High Negative Adrenaline */

.badge-0 { background-color: #1e40af; color: #dbeafe; }
.badge-1 { background-color: #065f46; color: #d1fae5; }
.badge-2 { background-color: #92400e; color: #fef3c7; }
.badge-3 { background-color: #b91c1c; color: #fee2e2; }
.badge-4 { background-color: #5b21b6; color: #ede9fe; }
.badge-5 { background-color: #374151; color: #f3f4f6; }
.badge-6 { background-color: #9d174d; color: #fce7f3; }
.badge-7 { background-color: #111827; color: #e5e7eb; }

.badge {
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-weight: 600;
  display: inline-block;
  margin: 2px; /* Added margin for spacing */
  transition: transform 0.2s ease; /* Added hover effect */
}
.badge:hover {
  transform: scale(1.05); /* Slightly enlarge on hover */
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

select { /* Kept for potential future use */
  padding: 0.5rem;
  border-radius: 0.25rem;
  transition: all 0.3s ease;
}

select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.card { /* General card style, applied to type description */
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  transition: all 0.3s ease;
}

.header {
  margin-bottom: 2rem;
  text-align: center;
}

h1 {
  font-size: 2.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

/* Theme-specific styles for Back to Top buttons */
body.light-mode .function-card button.back-to-top {
  background-color: #94aed7;
  color: #1e293b; /* Better contrast in light mode */
}

body.light-mode .function-card button.back-to-top:hover {
  background-color: #7a98c0; /* Darker hover for light mode */
}

body.dark-mode .function-card button.back-to-top {
  background-color: #4b95ff;
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 0 8px rgba(75, 149, 255, 0.2);
}

body.dark-mode .function-card button.back-to-top:hover {
  background-color: #5ea2ff;
  box-shadow: 0 0 12px rgba(94, 162, 255, 0.4);
}

.function-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); /* Responsive columns */
  gap: 1.5rem;
}

footer {
  margin-top: 3rem;
  text-align: center;
  color: #9ca3af;
  padding: 1rem 0;
}

body.light-mode footer {
  color: #6b7280;
}

.error-card {
  border-left: 4px solid #ef4444;
  background-color: rgba(239, 68, 68, 0.1);
}

/* General Button Styling (if needed beyond personality buttons) */
.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  background-color: #3b82f6;
  color: white;
  border-radius: 0.375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none; /* Ensure no default border */
}

.btn:hover {
  background-color: #2563eb;
}

.btn-secondary {
  background-color: #4b5563;
}

.btn-secondary:hover {
  background-color: #374151;
}

body.light-mode .btn {
  background-color: #3b82f6;
  color: white;
}

body.light-mode .btn:hover {
  background-color: #2563eb;
}

body.light-mode .btn-secondary {
  background-color: #6b7280;
  color: white;
}

body.light-mode .btn-secondary:hover {
  background-color: #4b5563;
}

/* Theme Toggle Specific styles */
#themeToggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #4a5568; /* Neutral background */
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  transition: background-color 0.3s ease;
}

#themeToggle:hover {
  background-color: #2d3748;
}

body.light-mode #themeToggle {
  background-color: #e2e8f0;
  color: #1a202c;
}

body.light-mode #themeToggle:hover {
  background-color: #cbd5e0;
}

.loading {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Highlight animation for function card when scrolled to */
@keyframes highlight-pulse {
  0% { box-shadow: 0 0 0 rgba(59, 130, 246, 0.4); } /* Start with slight glow */
  50% { box-shadow: 0 0 20px rgba(59, 130, 246, 0.8); } /* Stronger glow */
  100% { box-shadow: 0 0 0 rgba(59, 130, 246, 0.4); } /* End with slight glow */
}

.highlight-card {
  animation: highlight-pulse 1.5s ease-in-out; /* Faster animation */
}

/* Improved readability styles */
.function-card p {
  line-height: 1.7;
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

h4 {
  margin-top: 1rem;
  font-weight: 600;
  color: #a0aec0; /* Lighter in dark mode */
}

body.light-mode h4 {
  color: #4a5568; /* Darker in light mode */
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 20px; /* Adds padding to accommodate fixed elements */
}

/* Basic line clamping fallback */
.line-clamp-5 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  line-clamp: 5;
  max-height: calc(1.7 * 5em);
  text-overflow: ellipsis;
}

/* Personality Button Specific Styles */
#personality-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px; /* Space between rows */
  margin-bottom: 1.5rem; /* Space below buttons */
  align-items: center; /* Center rows horizontally */
}

#personality-buttons .row {
  display: flex;
  justify-content: center; /* Center buttons within row */
  flex-wrap: wrap; /* Allow wrapping on smaller screens */
  gap: 6px; /* Space between buttons */
  width: 100%;
  max-width: 800px; /* Limit max width of button rows */
}

#personality-buttons button {
  /* flex: 1; */ /* Removed flex: 1 to allow natural width */
  min-width: 60px; /* Minimum width for smaller buttons */
  padding: 8px 12px; /* Adjust padding */
  font-size: 0.85rem; /* Slightly smaller font */
  cursor: pointer;
  border-radius: 4px; /* Slightly rounded corners */
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.1s ease; /* Added color/border transitions */
  text-align: center;
}

#personality-buttons button:active {
  transform: scale(0.95); /* Click effect */
}

/* Style for the active/selected button: Use Alpine's :class binding */
/* We will bind the 'active' class in the HTML */
#personality-buttons button.active {
  /* Define the style for the active state */
  background-color: #3b82f6;
  color: white;
  font-weight: bold;
  border-color: #3b82f6; /* Match border */
}

body.light-mode #personality-buttons button.active {
  background-color: #3b82f6;
  color: white;
  border-color: #2563eb;
}

body.dark-mode #personality-buttons button.active {
  background-color: #4b95ff;
  color: #0f172a; /* Dark text for contrast */
  border-color: #4b95ff;
}