:root {
    --bs-body-bg: #1a1a1a;
    --bs-body-color: #f0f0f0;
    --bs-border-color: #444;
    --bs-btn-color: #adb5bd;
    --bs-btn-border-color: #555;
    --bs-btn-hover-bg: #343a40;
    --bs-btn-hover-border-color: #888;
    --bs-btn-active-bg: #495057;
    --bs-btn-active-border-color: #adb5bd;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.navbar {
    border-bottom: 1px solid var(--bs-border-color);
}

.nav-link.active {
    color: #0d6efd !important;
    font-weight: bold;
}

.content-section {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.card {
    background-color: #2c2c2c;
    border: 1px solid var(--bs-border-color);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    height: 100%;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 123, 255, 0.2);
    border-color: #0d6efd;
}

.card-img-top {
    width: 100%;
    height: 300px;
    object-fit: contain;
    object-position: center;
    background-color: #333;
}

.card-title {
    color: #0d6efd; /* Default color */
}

.card-subtitle {
    font-style: italic;
}

.rarity-Common { color: #e6efff; }
.rarity-Rare { color: #8af5ff; }
.rarity-Epic { color: #c478ff; }
.rarity-Legendary { color: #ff6969; }
.rarity-Unique { color: #ffb400; }
.rarity-Character { color: #4effe9; }
.rarity-Identity { color: #a3d0ff; }

.traveler-name-group {
    display: flex;
    align-items: center;
    gap: 10px;
}
.traveler-icon {
    width: 30px;
    height: 30px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

/* Special Traveler Colors */
.traveler-color-yubar { color: #ff69b4 !important; }
.traveler-color-yubar.traveler-icon { filter: invert(58%) sepia(51%) saturate(5427%) hue-rotate(301deg) brightness(100%) contrast(102%); }
.traveler-color-vesper { color: #ffd700 !important; }
.traveler-color-vesper.traveler-icon { filter: invert(85%) sepia(53%) saturate(1215%) hue-rotate(320deg) brightness(102%) contrast(102%); }
.traveler-color-lacerta { color: #dc3545 !important; }
.traveler-color-lacerta.traveler-icon { filter: invert(34%) sepia(45%) saturate(3011%) hue-rotate(328deg) brightness(91%) contrast(93%); }
.traveler-color-mist { color: #0d6efd !important; }
.traveler-color-mist.traveler-icon { filter: invert(42%) sepia(87%) saturate(2331%) hue-rotate(206deg) brightness(97%) contrast(93%); }
.traveler-color-shell { color: #9932CC !important; }
.traveler-color-shell.traveler-icon { filter: invert(27%) sepia(99%) saturate(1637%) hue-rotate(259deg) brightness(87%) contrast(94%); }
.traveler-color-nachia { color: #28a745 !important; }
.traveler-color-nachia.traveler-icon { filter: invert(48%) sepia(59%) saturate(542%) hue-rotate(85deg) brightness(96%) contrast(90%); }
.traveler-color-bismuth { color: #A0522D !important; }
.traveler-color-bismuth.traveler-icon { filter: invert(36%) sepia(23%) saturate(1467%) hue-rotate(328deg) brightness(93%) contrast(89%); }
.traveler-color-aurena { color: #f8f9fa !important; }
.traveler-color-aurena.traveler-icon { filter: brightness(0) invert(1); }

/* --- STAR PAGE STYLES --- */
#destruction-pane p.lead { color: #dc3545; }
#life-pane p.lead { color: #28a745; }
#imagination-pane p.lead { color: #0dcaf0; }
#flexible-pane p.lead { color: #ffc107; }

.star-icon-container { width: 60px; height: 60px; background-color: #111; border: 1px solid #555; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.star-icon { width: 45px; height: 45px; }

.star-title-destruction { color: #dc3545; }
.star-title-life { color: #28a745; }
.star-title-imagination { color: #0dcaf0; }
.star-title-flexible { color: #ffc107; }

.star-destruction { filter: invert(85%) sepia(53%) saturate(1215%) hue-rotate(320deg) brightness(102%) contrast(102%); }
.star-life { filter: invert(48%) sepia(59%) saturate(542%) hue-rotate(85deg) brightness(96%) contrast(90%); }
.star-imagination { filter: invert(72%) sepia(41%) saturate(1212%) hue-rotate(130deg) brightness(99%) contrast(95%); }
.star-flexible { filter: invert(34%) sepia(45%) saturate(3011%) hue-rotate(328deg) brightness(91%) contrast(93%); }

/* --- FILTER STYLES --- */
#memory-filters .btn-group, #essence-filters .btn-group, #star-filters .btn-group { margin-right: 1rem; margin-bottom: 1rem; }
.btn-check:checked+.btn-outline-light { color: #1a1a1a; }
.btn-check:checked+.btn-outline-light.rarity-Common { background-color: #e6efff; border-color: #e6efff; }
.btn-check:checked+.btn-outline-light.rarity-Rare { background-color: #8af5ff; border-color: #8af5ff; }
.btn-check:checked+.btn-outline-light.rarity-Epic { background-color: #c478ff; border-color: #c478ff; }
.btn-check:checked+.btn-outline-light.rarity-Legendary { background-color: #ff6969; border-color: #ff6969; }
.btn-check:checked+.btn-outline-light.rarity-Unique { background-color: #ffb400; border-color: #ffb400; }
.btn-check:checked+.btn-outline-light.filter-traveler { background-color: #6c757d; border-color: #6c757d; color: #fff; }

/* --- BUILD CREATOR STYLES --- */
.traveler-selection-card {
    background-color: transparent;
    border: none;
    cursor: pointer;
    align-items: center;
}
.traveler-selection-card:hover {
    transform: none;
    box-shadow: none;
    border: none;
}

.traveler-selection-card picture {
    display: block;
}
.traveler-selection-card .traveler-image-preview {
    width: 150px;
    height: 150px;
    object-fit: cover;
    object-position: top;
    border-radius: 50%;
    border: 3px solid #444;
    transition: border-color 0.2s ease-in-out;
    margin: 0 auto;
}
.traveler-selection-card:hover .traveler-image-preview {
    border-color: #0d6efd;
}
.traveler-selection-card .card-body {
    padding-top: 1rem;
    display: flex;
    justify-content: center;
}
.traveler-selection-card .traveler-name-group {
    justify-content: center;
}

.memory-slot { border: 2px dashed #444; min-height: 100px; display: flex; align-items: center; justify-content: center; flex-direction: column; cursor: pointer; transition: background-color 0.2s, border-color 0.2s; background-color: rgba(255, 255, 255, 0.05); border-radius: .375rem; }
.memory-slot:hover { background-color: rgba(13, 110, 253, 0.1); border-color: #0d6efd; }
.memory-slot img { max-width: 80px; max-height: 80px; margin-bottom: 5px; }

.essence-slot {
    border: 2px dashed #444;
    min-height: 80px;
    width: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: .375rem;
}
.essence-slot:hover { background-color: rgba(13, 110, 253, 0.1); border-color: #0d6efd; }
.essence-slot img { max-width: 50px; max-height: 50px; }

#summary-traveler img { max-width: 150px; border-radius: 50%; border: 3px solid #0d6efd; }
#summary-memories .card { background-color: #343a40; }

.constellation-category {
    border: 1px solid #444;
    border-radius: 8px;
    padding: 1rem;
    background-color: rgba(0,0,0,0.2);
}
.constellation-slot {
    width: 70px;
    height: 70px;
    background-color: #111;
    border: 2px dashed #555;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}
.constellation-slot:hover { border-color: #0d6efd; }
.constellation-slot img { width: 50px; height: 50px; }

.constellation-slot.destruction { border-style: solid; border-color: #dc3545; }
.constellation-slot.life { border-style: solid; border-color: #28a745; }
.constellation-slot.imagination { border-style: solid; border-color: #0dcaf0; }
.constellation-slot.flexible { border-style: solid; border-color: #ffc107; }

.youtube-video-container {
    position: relative;
    overflow: hidden;
    width: 100%;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
}
.youtube-video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    width: 100%;
    height: 100%;
}

/* --- MODAL STYLES --- */
#selectionModal .modal-content { background-color: #2c2c2c; border: 1px solid #555; }
#selectionModal .card { cursor: pointer; }
#modal-search-bar {
    background-color: var(--bs-dark-bg-subtle);
    border-color: var(--bs-dark-border-subtle);
    color: var(--bs-body-color);
}
#modal-search-bar:focus {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, .25);
    border-color: #0d6efd;
}

/* Helper Text Styles */
.text-yellow, .text-warning { color: #ffc107 !important; }

/* TRAVELER STATS STYLES */
.traveler-stats { border-top: 1px solid var(--bs-border-color); padding-top: 1rem; }
.stats-title { font-size: 1rem; font-weight: bold; color: #adb5bd; text-transform: uppercase; letter-spacing: 1px; }
.stat-item { margin-bottom: 0.5rem; font-size: 0.9rem; }
.stat-icon { width: 24px; height: 24px; margin-right: 10px; }
.stat-name { color: #f0f0f0; }
.stat-value { color: #f0f0f0; font-weight: bold; }

/* --- BUILDS PAGE STYLES --- */
.build-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.build-card-link:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 123, 255, 0.2);
    border-color: #0d6efd;
}

.build-card-traveler-img {
    height: 100px;
    width: 100px;
    object-fit: cover;
    border-radius: 50%;
}

.build-card-icons-container {
    display: flex;
    gap: 5px;
}

.build-card-icon {
    width: 25px;
    height: 25px;
    background-color: rgba(0,0,0,0.3);
    border-radius: 4px;
}

/* --- BUILD CREATOR: IDENTITY MEMORY SLOT --- */
#identity-memory-container {
    animation: fadeIn 0.5s ease-in-out;
}

.identity-memory-slot {
    border: 2px solid #ffb400; /* Gold border for distinction */
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background-color: rgba(255, 180, 0, 0.1);
    border-radius: .375rem;
    position: relative;
    padding: 1rem;
}

.identity-memory-slot:not(.locked) {
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}

.identity-memory-slot:not(.locked):hover {
    background-color: rgba(255, 180, 0, 0.2);
    border-color: #ffc107;
}

.identity-memory-slot.locked {
    opacity: 0.7;
    cursor: not-allowed;
}

.identity-memory-slot img {
    max-width: 80px;
    max-height: 80px;
    margin-bottom: 5px;
}

.identity-swap-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1.5rem;
    color: #ffc107;
    opacity: 0.6;
}

.identity-memory-slot:hover .identity-swap-icon {
    opacity: 1;
}

/* --- BUILDS PAGE: IDENTITY MEMORY ICON --- */
.identity-memory-icon {
    border: 2px solid #ffb400;
}

/* --- BUILDS PAGE: ESSENCE ICON --- */
.build-card-icons-container {
    display: flex;
    flex-direction: column; /* Lays out the icon rows vertically */
    gap: 5px;
    min-height: 85px; /* Ensures consistent card height */
}

.build-card-icon-row {
    display: flex;
    gap: 5px;
    height: 25px; /* Set a fixed height for each row */
}

.build-card-icon {
    width: 25px;
    height: 25px;
    background-color: rgba(0,0,0,0.3);
    border-radius: 4px;
}

/* --- BUILD CREATOR: REMOVE BUTTON --- */
.memory-slot, .essence-slot, .constellation-slot {
    position: relative;
}

.remove-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    opacity: 0;
    transition: opacity 0.15s ease-in-out;
    /* Make the button smaller and rounder */
    padding: 0.1rem 0.3rem;
    font-size: 0.8rem;
    border-radius: 50%;
    z-index: 10; /* Ensure it's clickable above other content */
}

.memory-slot:hover .remove-btn,
.essence-slot:hover .remove-btn,
.constellation-slot:hover .remove-btn {
    opacity: 1;
}

/* --- BUILD CREATOR: DEJA VU SLOT --- */
.dejavu-slot {
    border: 2px dashed #0dcaf0; /* Using info color for distinction */
    min-height: 100px;
    width: 100%;
    max-width: 250px; /* Limit width */
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    background-color: rgba(13, 202, 240, 0.05);
    border-radius: .375rem;
    position: relative; /* For the remove button */
}

.dejavu-slot:hover {
    background-color: rgba(13, 202, 240, 0.1);
    border-color: #0dcaf0;
}

.dejavu-slot img {
    max-width: 80px;
    max-height: 80px;
    margin-bottom: 5px;
}

/* --- BUILDS PAGE: DEJA VU ICON --- */
.build-card-dejavu-icon {
    border: 2px solid #0dcaf0; /* Info color border */
    padding: 1px;
}

/* --- FOOTER --- */
.site-footer {
    border-top: 1px solid var(--bs-border-color);
    padding: 2rem 0;
    margin-top: 0; /* Margin is now handled by the <hr> tag */
    font-size: 0.75rem; /* Made font smaller */
    color: #6c757d; 
    text-align: center;
}

.site-footer p {
    margin-bottom: 0; /* Reduced space between lines */
}