/* Resetting and applying new styles based on the target design */
/* Import Google Fonts - Assuming 'Poppins' is used based on visual inspection */
/* Poppins font is loaded via /css/fonts.css in the HTML head */

/* Floating Animation */
@keyframes floatAnimation {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px); /* Adjust vertical distance */
  }
}

/* General Page Styles */
.character-detail-page {
  font-family: 'Poppins', sans-serif;
  --character-theme-color: #4A90E2; /* Default blue, will be overridden by inline style */
  --text-primary: #333333;
  --text-secondary: #555555;
  --background-light: #F8F9FA;
  --background-white: #FFFFFF;
  --border-light: #E0E0E0;
  --accent-color: #FFC107; /* Example accent */
  --border-radius-medium: 8px;
  --border-radius-large: 12px;
  --shadow-soft: 0 4px 15px rgba(0, 0, 0, 0.08);
}

/* Hero Section */
.character-hero {
  background-color: var(--character-theme-color);
  position: relative;
  overflow: visible; /* Allow image overflow */
  padding-top: 2rem; /* Add some padding */
  z-index: 1; /* Establish stacking context */
}

/* Scribble pattern overlay ::before rule - will be set via JavaScript for WebP/PNG fallback */  
.character-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url('/images/patterns/scribble-bg-storypie-transparent-white.png'); /* White scribble PNG fallback */
  background-repeat: repeat;
  background-position: center center;
  background-size: 20%; /* Desktop size */
  opacity: 0.2; /* More transparent overlay */
  z-index: 1; /* Changed from -1 to 1 so it's above the background color but below content */
  pointer-events: none; /* Allow clicks to pass through */
}

/* WebP version will be applied via JavaScript if supported */
.character-hero.webp-supported::before {
  background-image: url('/images/patterns/scribble-bg-storypie-transparent-white.webp');
}

/* Mobile: Make pattern 300% larger (20% * 4 = 80%) */
@media (max-width: 767px) {
  .character-hero::before {
    background-size: 80%; /* 300% larger than desktop (20% * 4 = 80%) */
  }
}

/* REMOVED blurred circle ::after rule */
/* .character-hero::after { ... } */

/* Ensure direct children are above the pattern */
.character-hero > .hero-content-container,
.character-hero > .hero-wave {
   position: relative;
   z-index: 2; /* Increased from 1 to ensure content is above the pattern overlay */
}

.hero-content-container {
  position: relative; /* Above background gradient */
  z-index: 2;
  max-width: 1100px; /* Adjust as needed */
  margin: 0 auto;
  padding: 2rem 1rem; /* Default padding */
  display: flex;
  flex-direction: column; /* Mobile first */
  align-items: center;
  min-height: 250px; /* REDUCED Ensure space for image */
}

.hero-image-container {
  width: 80%; /* Mobile size */
  max-width: 300px; /* Limit mobile size */
  margin-bottom: -40px; /* Overlap wave on mobile */
  position: relative;
  z-index: 1040; /* INCREASED z-index (Higher than typical headers) */
  
  /* CLS Fix */
  aspect-ratio: 1 / 1;
  background-color: rgba(255, 255, 255, 0.01); /* 99% transparent placeholder */
  border-radius: 12px;
  margin-left: auto; 
  margin-right: auto;
}

.character-detail-image {
  display: block;
  width: 100% !important; /* Fill container */
  height: 100%; /* Fill container */
  object-fit: contain;
  animation: floatAnimation 4s ease-in-out infinite; /* Keep animation */
}

.hero-info-container {
  text-align: center; /* Mobile first alignment */
  width: 100%;
}

.character-detail-name {
  font-size: 2.5rem; /* Mobile size */
  font-weight: 700;
  margin-bottom: 1rem;
  color: white !important; /* Ensure white color, using !important as a stronger measure if needed */
}

.character-detail-description {
  font-size: 1rem; /* Mobile size */
  line-height: 1.6;
  margin-bottom: 1.5rem;
  max-width: 500px; /* Limit width */
  margin-left: auto;
  margin-right: auto;
  color: white !important; /* Ensure white color, using !important as a stronger measure */
}

/* Story Type Pills in Hero */
.hero-story-types {
  display: flex;
  flex-wrap: wrap;
  justify-content: center; /* Center on mobile */
  gap: 0.75rem; /* Space between pills */
  margin-bottom: 1rem;
}

.hero-story-types .story-type-badge {
  padding: 0.25rem 0.75rem; /* REDUCED padding */
  border-radius: 9999px; /* Full pill shape */
  background-color: rgba(255, 255, 255, 0.2); /* White with transparency */
  backdrop-filter: blur(4px); /* Blur effect */
  -webkit-backdrop-filter: blur(4px); /* Safari support */
  color: white;
  font-size: 0.75rem; /* REDUCED font size */
  font-weight: 500;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  /* Resetting styles from potential global badge styles */
  display: inline-block;
  text-align: center;
  line-height: 1.4;
}

/* Wave Divider */
.wave-divider {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  overflow: hidden;
  line-height: 0; /* Prevent extra space */
  z-index: 2;
}

.wave-divider svg {
  position: relative;
  display: block;
  width: calc(100% + 1.3px); /* Slightly wider for edge cases */
  height: 24px; /* REDUCED height */
  fill: var(--background-white); /* Match page background */
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
  .hero-content-container {
    flex-direction: row;
    align-items: center;
    padding: 0 2rem; /* Adjust horizontal padding */
    min-height: 350px; /* REDUCED Taller hero */
  }

  .hero-image-container {
    position: absolute;
    bottom: 0; /* MOVED UP 150px from -150px */
    left: 5%;
    width: auto;
    height: auto;
    margin-top: 0;
    margin-bottom: 0;
    z-index: 3;
    /* Reset aspects for desktop if needed, though auto/auto should handle it */
    aspect-ratio: auto;
    background-color: transparent;
  }

  .character-detail-image {
    width: auto !important; /* Reset to auto or specific desktop width */
    max-width: 400px; /* Restrict max width on desktop */
    margin-left: 0; /* Reset mobile centering */
    margin-right: 0; /* Reset mobile centering */
     /* Ensure height is NOT present */
  }

  .hero-info-container {
    margin-left: auto; /* Push text to the right */
    width: 50%; /* Take half the width */
    text-align: right; /* Align text right */
    padding-top: 2rem; /* REDUCED Add padding for spacing */
    padding-bottom: 2rem; /* REDUCED Add padding for spacing */
  }

  .character-detail-name {
    font-size: 3.75rem; /* 6xl equivalent */
    margin-bottom: 1rem;
  }

  .character-detail-description {
    font-size: 1.25rem; /* xl equivalent */
    margin-bottom: 1.5rem;
    max-width: 448px; /* md equivalent */
    margin-left: auto; /* Keep right aligned */
    margin-right: 0;
  }

  .hero-story-types {
    justify-content: flex-end; /* Align pills right */
    margin-bottom: 1rem;
  }

  .wave-divider svg {
    height: 48px; /* REDUCED Taller wave for desktop */
  }
}


/* Fun Facts Section - Adjustments if needed */
.fun-facts-section {
  background-color: var(--background-light);
  padding: 80px 0 60px; /* Adjusted padding */
  margin-top: 0; /* Remove top margin now wave connects */
}

.section-title {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text-primary); /* Use primary text color */
  margin-bottom: 40px;
  text-align: center;
}

.fun-facts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 25px;
  max-width: 1100px;
  margin: 0 auto;
}

.fun-fact {
  display: flex;
  align-items: flex-start;
  background-color: var(--background-white);
  border-radius: var(--border-radius-medium);
  padding: 20px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-light);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fun-fact:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.fun-fact-icon {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 45px;
  height: 45px;
  /* Using theme color for icon background */
  background-color: color-mix(in srgb, var(--character-theme-color) 15%, #ffffff);
  color: var(--character-theme-color);
  border-radius: 50%;
  margin-right: 15px;
  font-size: 1.5rem;
}

.fun-fact-icon i {
   line-height: 1;
}

.fun-fact p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* More Characters Section - Adjustments */
.more-characters-section {
  padding: 60px 0 80px;
  background-color: #ffffff;
}

.more-characters-section .section-title {
  color: var(--text-primary);
  margin-bottom: 50px;
}

.characters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 30px;
}

.character-thumbnail {
  display: block;
  text-decoration: none;
  color: var(--text-primary);
  background-color: var(--background-white);
  border-radius: var(--border-radius-large);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  text-align: center;
}

.character-thumbnail:hover {
  transform: translateY(-8px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
}

.thumbnail-image-container {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background-color: var(--background-light);
  margin-bottom: 0;
  overflow: hidden;
}

.thumbnail-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.character-thumbnail:hover .thumbnail-image {
  transform: scale(1.08);
}

.thumbnail-info {
    padding: 15px;
}

.thumbnail-name {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--text-primary);
}

.thumbnail-type {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: block;
}

/* Back Link */
.back-link-container {
  background-color: var(--background-light);
  padding: 20px 0;
  border-top: 1px solid var(--border-light);
}

.back-to-characters {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.back-to-characters i {
  /* Style the icon if needed */
  width: 20px;
  height: 20px;
  line-height: 1;
  transition: transform 0.2s ease;
}

.back-to-characters:hover {
  color: var(--character-theme-color);
}

.back-to-characters:hover i {
  transform: translateX(-3px);
}


/* Remove styles that are no longer used or conflicting */
.character-presentation,
.character-image-column,
.character-info-column,
.character-image-wrapper,
.character-image-bg,
.character-info, /* Might need specific overrides if other rules interfere */
.character-attributes,
.character-traits,
.character-story-types:not(.hero-story-types), /* Keep hero styles */
.attribute-title,
.traits-container,
.story-types-container:not(.hero-story-types),
.trait-badge,
.story-type-badge:not(.hero-story-types .story-type-badge),
.character-actions,
.primary-action-btn {
  /* Resetting potentially conflicting properties */
  display: initial;
  flex: initial;
  position: initial;
  margin: initial;
  padding: initial;
  background: initial;
  color: initial;
  box-shadow: initial;
  border: initial;
  border-radius: initial;
  text-align: initial;
  max-width: initial;
  /* Add any other properties that might conflict */
}

/* Specific overrides if needed after reset */
.character-info { /* Example: ensure no extra padding if parent adds it */
  padding: 0;
}

/* Final Responsive pass */
@media (max-width: 767px) {
  /* Mobile adjustments were handled mobile-first, check specifics */
  .section-title { font-size: 1.8rem; }
  .fun-facts-grid { grid-template-columns: 1fr; gap: 15px; }
  .fun-fact { padding: 15px; }
  .fun-fact-icon { width: 40px; height: 40px; font-size: 1.3rem;}
  .fun-fact p { font-size: 0.95rem;}
  .characters-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 20px;}
  .thumbnail-name { font-size: 1rem; }
  .thumbnail-type { font-size: 0.8rem; }
}

@media (max-width: 575px) {
  .character-detail-name { font-size: 2rem; } /* Adjust mobile title size */
  .character-detail-description { font-size: 0.95rem; }
  .character-detail-image { width: 80%; } /* Smaller image on smallest screens */
  .hero-story-types .story-type-badge { font-size: 0.75rem; padding: 0.25rem 0.8rem;}
  .characters-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 15px;}
}

/* Remove old responsive rules if they conflict */
/* @media (max-width: 991px) { ... } */ /* Commented out as structure changed */


/* Resetting and applying new styles based on the target design */
/* Import Google Fonts - Assuming 'Poppins' is used based on visual inspection */
/* Poppins font is loaded via /css/fonts.css in the HTML head */

/* General Page Styles */
.character-detail-page {
  font-family: 'Poppins', sans-serif;
  --character-theme-color: <%= character.color || '#4A90E2' %>; /* Default blue if not set */
  --text-primary: #333333;
  --text-secondary: #555555;
  --background-light: #F8F9FA;
  --background-white: #FFFFFF;
  --border-light: #E0E0E0;
  --accent-color: #FFC107; /* Example accent */
  --border-radius-medium: 8px;
  --border-radius-large: 12px;
  --shadow-soft: 0 4px 15px rgba(0, 0, 0, 0.08);
}

/* Hero Section */
.character-hero {
  position: relative;
  overflow: hidden; /* Prevent overflow issues */
}

.character-hero .container {
  position: relative;
  z-index: 2;
}



.character-hero::after {
  content: '';
  position: absolute;
  bottom: -80px;
  right: -80px;
  width: 250px;
  height: 250px;
  background: color-mix(in srgb, var(--character-theme-color) 15%, transparent);
  border-radius: 50%;
  opacity: 0.6;
  filter: blur(60px);
}

.character-presentation {
  display: flex;
  align-items: center;
  gap: 40px; /* Adjust gap as needed */
}

.character-image-column {
  flex: 0 0 40%; /* Adjust width */
  display: flex;
  justify-content: center;
  align-items: center;
}


.character-image-wrapper {
  position: relative;
  width: 100%;
  max-width: 350px; /* Adjust size */
}

.character-image-bg {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  padding-bottom: 100%; /* Makes it a square */
  background-color: color-mix(in srgb, var(--character-theme-color) 80%, #ffffff);
  border-radius: 45% 55% 60% 40% / 40% 50% 50% 60%; /* Organic shape */
  transform: translate(-50%, -50%) rotate(15deg);
  opacity: 0.8;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.character-detail-image {
  position: relative; /* Bring image to front */
  display: block;
  width: 90%; /* Adjust based on bg shape */
  max-width: 300px; /* Limit image size */
  margin: 0 auto; /* Center within wrapper */
  object-fit: contain;
  animation: floatAnimation 4s ease-in-out infinite;
  z-index: 1;
}

.character-info-column {
  flex: 1;
}

.character-info {
 /* Reset padding if needed */
}

.character-detail-name {
  font-size: 2.8rem; /* Larger name */
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.2;
}

.character-type-badge {
  display: inline-block;
  background-color: var(--character-theme-color);
  color: var(--background-white);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 6px 18px;
  border-radius: 20px;
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.character-detail-description {
  font-size: 1.1rem;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 30px;
  max-width: 600px; /* Limit width */
}

/* Traits & Story Types */
.character-attributes {
  display: flex;
  gap: 30px; /* Space between Traits and Perfect For */
  margin-bottom: 30px;
}

.character-traits,
.character-story-types {
  flex: 1;
}

.attribute-title { /* New class for titles with icons */
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 15px;
}

.attribute-title i { /* Style for potential icon font */
  color: var(--character-theme-color);
  font-size: 1.3em;
}

.traits-container,
.story-types-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.trait-badge {
  display: inline-flex; /* Align icon and text if needed */
  align-items: center;
  background-color: color-mix(in srgb, var(--character-theme-color) 15%, #F8F9FA);
  color: color-mix(in srgb, var(--character-theme-color) 80%, #333333);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid color-mix(in srgb, var(--character-theme-color) 30%, #E0E0E0);
}

.story-type-badge {
  display: inline-flex;
  align-items: center;
  background-color: #E9ECEF; /* Neutral background */
  color: #495057; /* Darker neutral text */
  font-size: 0.85rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
}


/* Character Actions */
.character-actions {
  margin-top: 35px;
}

.primary-action-btn {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent-color), color-mix(in srgb, var(--accent-color) 80%, #000000));
  color: var(--text-primary);
  font-weight: 600;
  font-size: 1.05rem;
  padding: 12px 28px;
  border-radius: 50px;
  text-decoration: none;
  border: none;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease, box-shadow 0.3s ease;
}

.primary-action-btn:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  color: var(--text-primary); /* Ensure color stays */
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent-color) 95%, #ffffff), color-mix(in srgb, var(--accent-color) 75%, #000000)); /* Slightly lighter on hover */
}


/* Fun Facts Section */
.fun-facts-section {
  background-color: var(--background-light);
  padding: 60px 0;
}

.section-title {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--character-theme-color);
  margin-bottom: 40px;
  text-align: center;
}

.fun-facts-grid { /* Changed from list to grid */
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 25px;
  max-width: 1100px;
  margin: 0 auto;
}

.fun-fact {
  display: flex;
  align-items: flex-start; /* Align icon top */
  background-color: var(--background-white);
  border-radius: var(--border-radius-medium);
  padding: 20px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-light);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fun-fact:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.fun-fact-icon {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 45px;
  height: 45px;
  background-color: color-mix(in srgb, var(--character-theme-color) 20%, #ffffff);
  color: var(--character-theme-color);
  border-radius: 50%;
  margin-right: 15px;
  font-size: 1.5rem; /* Adjust icon size */
}

.fun-fact-icon i { /* Style for icon font */
   line-height: 1;
}

.fun-fact p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* More Characters Section */
.more-characters-section {
  padding: 60px 0 80px;
  background-color: #ffffff; /* White background */
}

.more-characters-section .section-title {
  color: var(--text-primary); /* Darker title */
  margin-bottom: 50px;
}

.characters-grid { /* Use a consistent naming scheme */
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); /* Adjust minmax for desired size */
  gap: 30px;
}

.character-thumbnail {
  display: block;
  text-decoration: none;
  color: var(--text-primary);
  background-color: var(--background-white);
  border-radius: var(--border-radius-large);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  text-align: center;
}

.character-thumbnail:hover {
  transform: translateY(-8px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
}

.thumbnail-image-container {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1; /* Square aspect ratio */
  background-color: var(--background-light); /* Light background for image */
  margin-bottom: 0; /* Remove margin */
  overflow: hidden; /* Ensure image doesn't overflow */
}

.thumbnail-image {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Cover the container */
  transition: transform 0.4s ease;
}

.character-thumbnail:hover .thumbnail-image {
  transform: scale(1.08);
}

.thumbnail-info {
    padding: 15px;
}

.thumbnail-name {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--text-primary);
}

.thumbnail-type {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: block; /* Ensure it takes its own line */
}

/* Back Link */
.back-link-container {
  background-color: var(--background-light);
  padding: 20px 0;
  border-top: 1px solid var(--border-light);
}

.back-to-characters {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.back-to-characters svg {
  width: 20px;
  height: 20px;
  transition: transform 0.2s ease;
}

.back-to-characters:hover {
  color: var(--character-theme-color);
}

.back-to-characters:hover svg {
  transform: translateX(-3px);
}

/* Responsive Adjustments */
@media (max-width: 991px) { /* Medium devices (tablets, less than 992px) */
  .character-presentation {
    flex-direction: column;
    text-align: center;
  }
  .character-image-column {
    flex-basis: auto; /* Reset flex basis */
    margin-bottom: 30px;
  }
  .character-info-column {
     text-align: center;
  }
   .character-detail-name {
       font-size: 2.4rem;
   }
   .character-detail-description {
       max-width: 100%; /* Allow full width */
       margin-left: auto;
       margin-right: auto;
   }
   .character-attributes {
       flex-direction: column;
       gap: 20px;
       align-items: center;
   }
   .character-actions {
       text-align: center;
   }
}

@media (max-width: 767px) { /* Small devices (landscape phones, less than 768px) */
  .character-hero { padding: 40px 0; }
  .character-detail-name { font-size: 2rem; }
  .character-detail-description { font-size: 1rem; }
  .attribute-title { font-size: 1rem; }
  .trait-badge, .story-type-badge { font-size: 0.8rem; padding: 5px 10px;}
  .primary-action-btn { font-size: 1rem; padding: 10px 24px;}
  .section-title { font-size: 1.8rem; margin-bottom: 30px;}
  .fun-facts-grid { grid-template-columns: 1fr; gap: 15px; } /* Single column */
  .fun-fact { padding: 15px; }
  .fun-fact-icon { width: 40px; height: 40px; font-size: 1.3rem;}
  .fun-fact p { font-size: 0.95rem;}
  .characters-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 20px;}
  .thumbnail-name { font-size: 1rem; }
  .thumbnail-type { font-size: 0.8rem; }
}

@media (max-width: 575px) { /* Extra small devices (portrait phones, less than 576px) */
   .character-image-wrapper { max-width: 280px; }
   .character-detail-image { max-width: 240px; }
   .character-detail-name { font-size: 1.8rem; }
   .character-type-badge { font-size: 0.8rem; padding: 5px 15px; }
   .characters-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 15px;}

}

/* Tab Navigation Styles */
.character-tabs-container {
  /* Keep container styling */
  margin-top: -20px; /* MOVED DOWN 20px */
  position: relative;
  z-index: 5;
  padding: 0.5rem 0; /* REMOVED horizontal padding */
  margin-bottom: 2rem;
}

/* NEW Tab Bar Styles */
.character-tabs {
  display: flex;
  overflow-x: auto; /* Enable horizontal scrolling */
  padding: 0.25rem 0; /* py-1 equivalent */
  scrollbar-width: none; /* Hide scrollbar for Firefox */
  -ms-overflow-style: none;  /* Hide scrollbar for IE/Edge */
}

.character-tabs::-webkit-scrollbar {
  display: none; /* Hide scrollbar for Chrome/Safari/Opera */
}

.character-tab-button {
  padding: 0.75rem 1.25rem; /* px-5 py-3 equivalent */
  font-weight: 500; /* font-medium */
  font-size: 1rem; /* text-base */
  white-space: nowrap;
  transition: all 0.2s ease-in-out;
  border-radius: 9999px; /* rounded-full */
  margin-right: 0.5rem; /* mr-2 */
  color: #6b7280; /* text-gray-500 */
  background-color: transparent;
  border: none;
  cursor: pointer;
}

.character-tab-button:last-child {
  margin-right: 0;
}

.character-tab-button span {
  display: flex;
  align-items: center;
  gap: 0.5rem; /* gap-2 */
}

.character-tab-button span i {
  font-size: 0.875rem; /* h-4 w-4 equivalent might need adjustment */
  line-height: 1;
}

.character-tab-button:hover {
  background-color: #f9fafb; /* hover:bg-gray-50 */
}

.character-tab-button.active {
  background-color: #f3f4f6; /* bg-gray-100 */
  color: #111827; /* text-navy-900 - adjusted to a standard dark gray */
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1); /* shadow-sm */
}

/* REMOVE OLD/BROKEN Bootstrap Nav Styles */
.character-tabs .nav-item,
.character-tabs .nav-link,
.character-tabs .nav-link.active,
.nav-tabs .nav-link,
.nav-tabs {
  display: none !important; /* Hide any remnants */
}

/* Tab Content Area */
.character-tab-content-area {
  padding: 2rem 0 4rem; /* Add padding below tabs */
  background-color: var(--background-light); /* Match light background */
}

.tab-content {
  display: none; /* Hide inactive tabs */
}

.tab-content.active {
  display: block; /* Show active tab content */
}

.about-cards-grid {
  display: grid;
  grid-template-columns: 1fr; /* Single column initially */
  gap: 2rem;
}

/* Content Card Styling */
.content-card {
  background-color: var(--background-white);
  border-radius: var(--border-radius-large);
  padding: 1.5rem 2rem;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-light);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--character-theme-color);
  margin: 0 0 1rem 0;
}

.card-title i {
  font-size: 1.2em;
}

.content-card p {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1rem;
}

/* Story types within About card */
.card-story-types {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 1rem;
  margin-bottom: 1.5rem;
}

.story-type-badge-card {
  background-color: #E9ECEF;
  color: #495057;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 6px;
}

/* Action buttons within About card */
.card-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

.btn-favorite,
.btn-create-story {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.6rem 1.2rem;
  border-radius: 50px;
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-favorite {
  background-color: #FF476B; /* Pink/Red color */
  color: white;
  box-shadow: 0 4px 10px rgba(255, 71, 107, 0.3);
}

.btn-favorite:hover {
  background-color: #e0395b;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(255, 71, 107, 0.4);
}

.btn-create-story {
  background-color: var(--character-theme-color);
  color: white;
  box-shadow: 0 4px 10px color-mix(in srgb, var(--character-theme-color) 50%, black 50%);
}

.btn-create-story:hover {
  background-color: color-mix(in srgb, var(--character-theme-color) 90%, black 10%);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px color-mix(in srgb, var(--character-theme-color) 40%, black 60%);
}

/* Fun Facts Card List */
.facts-list,
.traits-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.facts-list li,
.traits-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  padding: 0.6rem 0;
  border-bottom: 1px dashed var(--border-light);
}

.facts-list li:last-child,
.traits-list li:last-child {
  border-bottom: none;
}

.fact-icon,
.trait-icon {
  color: var(--character-theme-color);
  font-size: 1.1rem;
  flex-shrink: 0;
  width: 20px; /* Align icons */
  text-align: center;
}

/* Personality Traits Columns */
.traits-columns {
  display: grid;
  grid-template-columns: 1fr; /* Single column on mobile */
  gap: 0 1.5rem; /* Gap between columns, none vertically initially */
}

/* Responsive Adjustments for Tabs/Cards */
@media (min-width: 768px) {
  .about-cards-grid {
    /* Two columns for About card + Fun facts/Traits side-by-side */
    grid-template-columns: 1fr 1fr; 
    align-items: start; /* Align cards to top */
  }

  .about-character-card {
    /* Potentially make about card span more if needed */
    /* grid-column: span 2;  Example if needed */
  }

  .traits-columns {
    grid-template-columns: 1fr 1fr; /* Two columns for traits list */
  }

  .traits-list li:nth-last-child(-n+2) {
     /* Remove bottom border on last two items when in two columns */
     /* This might need adjustment based on number of items */
      border-bottom: none;
  }

}

@media (min-width: 992px) {
  .about-cards-grid {
    /* Example: Three columns on larger screens */
    /* grid-template-columns: repeat(3, 1fr); */
  }
}

/* Remove conflicting/outdated responsive rules */
/* @media (max-width: 991px) { ... } */
@media (max-width: 767px) {
  /* Keep relevant mobile styles */
  .section-title { font-size: 1.8rem; } /* If still used */
  /* .fun-facts-grid { grid-template-columns: 1fr; gap: 15px; } <-- Removed */
  /* .fun-fact { padding: 15px; } <-- Removed */
  /* .fun-fact-icon { width: 40px; height: 40px; font-size: 1.3rem;} <-- Removed */
  /* .fun-fact p { font-size: 0.95rem;} <-- Removed */
  /* .characters-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 20px;} <-- Removed */
  /* .thumbnail-name { font-size: 1rem; } <-- Removed */
  /* .thumbnail-type { font-size: 0.8rem; } <-- Removed */

  .character-tabs .tab-item {
     font-size: 0.85rem;
     padding: 0.8rem 0.5rem;
     gap: 5px;
  }
  .content-card {
     padding: 1rem 1.25rem;
  }
  .card-title {
     font-size: 1.2rem;
  }
  .card-actions {
    flex-direction: column;
    gap: 0.75rem;
  }
  .btn-favorite,
  .btn-create-story {
     width: 100%;
     justify-content: center;
  }
}

/* @media (max-width: 575px) { ... } <-- Consolidate or remove if needed */

/* About Card Specifics */
.about-story-types {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
  margin-bottom: 1.5rem;
}

/* Use Theme color for pills in card */
.story-type-badge-yellow {
  padding: 0.3rem 0.8rem;
  border-radius: 9999px;
  background-color: var(--character-theme-color); /* CHANGED to theme color */
  color: white; /* CHANGED to white text */
  font-size: 0.8rem;
  font-weight: 600;
}

.about-card-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

.btn-favorite-outline {
  border: 2px solid var(--character-theme-color);
  color: var(--character-theme-color);
  background-color: transparent;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 50px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.btn-favorite-outline:hover {
  background-color: var(--character-theme-color);
  color: white;
}

.btn-create-story-solid {
  background-color: var(--accent-yellow);
  color: var(--text-primary);
  border: none;
  font-weight: 600;
  padding: 0.6rem 1.1rem; /* Slightly different padding */
  border-radius: 50px;
  transition: background-color 0.2s ease;
} 