.bestiary-hero {
    min-height: 380px;
    background:
        linear-gradient(rgba(10, 20, 15, 0.8), rgba(10, 20, 15, 0.95)),
        url('https://images.unsplash.com/photo-1448375240586-882707db888b?q=80&w=1470&auto=format&fit=crop')
        center/cover no-repeat scroll;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 3px solid var(--accent-gold);
    position: relative;
}

.bestiary-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(0, 200, 100, 0.03) 1px, transparent 1px);
    background-size: 28px 28px;
    pointer-events: none;
}

.bestiary-hero-overlay {
    position: relative;
    z-index: 1;
    width: 100%;
}

.bestiary-hero-content {
    text-align: center;
    padding: 3rem 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.bestiary-hero-content h1 {
    font-family: 'Cinzel', serif;
    font-size: 3.2rem;
    color: var(--accent-gold);
    margin-bottom: 1rem;
    text-shadow: 0 2px 20px rgba(251, 191, 36, 0.3);
}

.bestiary-hero-content p {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* Search bar — reused pattern from lore/locations */
.search-container {
    display: flex;
    max-width: 500px;
    margin: 0 auto;
    border-radius: 50px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4);
}

#bestiarySearch {
    flex: 1;
    padding: 1rem 2rem;
    border: none;
    background: rgba(255, 255, 255, 0.95);
    font-size: 1rem;
    color: var(--primary-dark);
    outline: none;
}

#bestiarySearchBtn {
    padding: 1rem 1.5rem;
    background: var(--accent-purple);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    transition: background 0.3s;
}

#bestiarySearchBtn:hover {
    background: var(--accent-gold);
}

/* =============================================
   MAIN CONTAINER
============================================= */
.bestiary-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2.5rem 2rem;
}

/* =============================================
   FILTER CONTROLS
   Two rows — type on top, danger below.
   Danger tags use colour coding to signal risk level.
============================================= */
.bestiary-filter-controls {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 2.5rem;
    border: 1px solid rgba(251, 191, 36, 0.25);
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.filter-group h3 {
    color: var(--accent-gold);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.6rem;
}

.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Type filter tags — same as lore page */
.filter-tag {
    padding: 0.45rem 1rem;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: var(--text-light);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.filter-tag:hover {
    border-color: var(--accent-purple);
    background: rgba(139, 92, 246, 0.1);
}

.filter-tag.active {
    background: var(--accent-purple);
    border-color: var(--accent-purple);
    color: white;
}

/*
  Danger tags get colour coded per level.
  The colour is set via inline style in JS,
  these are the base/inactive styles.
*/
.danger-tag {
    padding: 0.45rem 1rem;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.85rem;
    font-weight: 500;
}

.danger-tag:hover {
    color: var(--text-light);
    border-color: rgba(255,255,255,0.3);
}

.danger-tag.active {
    color: white;
    font-weight: bold;
}

/* =============================================
   BESTIARY GRID
============================================= */
.bestiary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

/* =============================================
   BESTIARY CARD
============================================= */
.bestiary-card {
    background: linear-gradient(160deg, #1a2a1e 0%, #0f172a 100%);
    border-radius: var(--border-radius);
    border: 1px solid rgba(251, 191, 36, 0.12);
    border-top: 3px solid var(--type-color, var(--accent-gold));
    overflow: hidden;
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px);
    animation: bestCardIn 0.5s forwards;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    position: relative;
}

.bestiary-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 220px;
    background: radial-gradient(ellipse at top, rgba(0, 180, 80, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.bestiary-card:hover {
    transform: translateY(-7px);
    border-color: var(--type-color, var(--accent-gold));
    box-shadow:
        0 16px 35px rgba(0, 0, 0, 0.5),
        0 0 18px rgba(0, 180, 80, 0.08);
}

.bestiary-card.hidden-card {
    display: none !important;
}

@keyframes bestCardIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =============================================
   CARD IMAGE
============================================= */
.bestiary-card-image {
    height: 220px;
    background-size: cover;
    background-position: center;
    position: relative;
    z-index: 1;
}

.bestiary-card-image::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(transparent, #0f172a);
}


.bestiary-type-badge {
    position: absolute;
    top: 0.8rem;
    left: 0.8rem;
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    z-index: 2;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid var(--type-color, var(--accent-gold));
    color: var(--type-color, var(--accent-gold));
}

.bestiary-danger-badge {
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    z-index: 2;
    background: rgba(15, 23, 42, 0.85);
}

/* =============================================
   CARD BODY
============================================= */
.bestiary-card-body {
    padding: 1.2rem 1.4rem 1.5rem;
    position: relative;
    z-index: 1;
}

.bestiary-card-name {
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    color: var(--accent-gold);
    margin-bottom: 0.5rem;
    text-shadow:
        0 0 14px rgba(251, 191, 36, 0.4),
        0 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.03em;
}

.bestiary-card-region {
    font-size: 0.82rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.8rem;
}

.bestiary-card-region i {
    color: var(--accent-gold);
}

.bestiary-card-desc {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.65;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 1rem;
    font-style: italic;
}

.bestiary-card-footer {
    display: flex;
    justify-content: flex-end;
    padding-top: 0.8rem;
    border-top: 1px solid rgba(251, 191, 36, 0.08);
}

.bestiary-view-btn {
    background: transparent;
    border: 1.5px solid var(--accent-purple);
    color: var(--accent-purple);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.bestiary-view-btn:hover {
    background: var(--accent-purple);
    color: white;
}

/* No results */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.no-results i {
    color: var(--accent-purple);
    margin-bottom: 1rem;
    display: block;
}

/* Show more button */
.show-more-btn {
    display: block;
    margin: 2rem auto 0;
    padding: 0.8rem 2.5rem;
    background: transparent;
    border: 2px solid var(--accent-purple);
    color: var(--accent-purple);
    border-radius: 30px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.show-more-btn:hover {
    background: var(--accent-purple);
    color: white;
}

/* =============================================
   MODAL
============================================= */
.bestiary-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    z-index: 1001;
    overflow-y: auto;
    padding: 2rem 1rem;
}

.bestiary-modal-content {
    background: linear-gradient(160deg, #1a2a1e 0%, #111827 100%);
    max-width: 760px;
    margin: 0 auto;
    border-radius: var(--border-radius);
    border: 1px solid rgba(251, 191, 36, 0.2);
    overflow: hidden;
    animation: modalSlideIn 0.3s ease;
    position: relative;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
}

@keyframes modalSlideIn {
    from { transform: translateY(-30px); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}

/* Image top — full width banner */
.bestiary-modal-image {
    width: 100%;
    height: 300px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.bestiary-modal-image::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: linear-gradient(transparent, #111827);
}

/* Name + badges overlaid on the image bottom */
.bestiary-modal-image-info {
    position: absolute;
    bottom: 1.2rem;
    left: 1.5rem;
    right: 1.5rem;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.bestiary-modal-name {
    font-family: 'Cinzel', serif;
    font-size: 2rem;
    color: var(--accent-gold);
    text-shadow:
        0 0 20px rgba(251, 191, 36, 0.5),
        0 2px 6px rgba(0, 0, 0, 0.8);
    letter-spacing: 0.04em;
    line-height: 1.2;
}

.bestiary-modal-badges {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.4rem;
}

/* Details below the image */
.bestiary-modal-details {
    padding: 1.8rem 2rem 2rem;
}

.bestiary-modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.2rem;
    border-bottom: 1px solid rgba(251, 191, 36, 0.1);
}

.bestiary-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.bestiary-meta-item i {
    color: var(--accent-gold);
}

.bestiary-modal-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.bestiary-modal-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.bestiary-modal-section h3 {
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.7rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.bestiary-modal-section p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.85;
}

/* Close button */
.close-bestiary-modal {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(251, 191, 36, 0.4);
    color: var(--text-light);
    font-size: 1.4rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 1100;
    line-height: 1;
}

.close-bestiary-modal:hover {
    background: var(--accent-gold);
    color: var(--primary-dark);
}

/* =============================================
   RESPONSIVE
============================================= */
@media (max-width: 768px) {
    .bestiary-hero-content h1 { font-size: 2.2rem; }
    .bestiary-hero { min-height: auto; padding: 3rem 1rem; }
    .bestiary-grid { grid-template-columns: 1fr; }
    .bestiary-modal { padding: 0; }
    .bestiary-modal-content { border-radius: 0; min-height: 100dvh; }
    .bestiary-modal-image { height: 220px; }
    .bestiary-modal-name { font-size: 1.5rem; }
    .bestiary-modal-image-info { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .bestiary-modal-badges { flex-direction: row; }
    .bestiary-filter-controls { padding: 1rem; }
}

@media (max-width: 480px) {
    .bestiary-grid { grid-template-columns: 1fr; }
    .bestiary-card-footer { justify-content: stretch; }
    .bestiary-view-btn { width: 100%; justify-content: center; }
}