:root {
    --bg-color: #0c0c0c;
    --card-bg: #1a1a1a;
    --accent-red: #ff3b3b;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --border-color: #333333;
    --nav-height: 50px;
    --header-height: 80px;
}

body.pink-theme {
    --card-bg: #1f0b15;
    --accent-red: #ff1493; /* Deep Pink */
    --accent-pink: #ff69b4;
    --text-secondary: #ffb6c1;
    --border-color: #4a102a;
    /* Ashley's World background */
    background: url("/ashley fundo.png") center / cover fixed no-repeat;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow: hidden; /* Main body shouldn't scroll, inner content will */
    height: 100vh;
    transition: background-color 0.3s;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.wiki-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to bottom, #151515, #0c0c0c);
    border-bottom: 1px solid var(--border-color);
    padding: 10px;
    transition: border-color 0.3s;
}

.main-logo {
    max-height: 100%;
    width: auto;
    object-fit: contain;
}

/* larger logo variant used only on the Home page */
.main-logo.large {
    max-height: 140px;
}

/* Slightly reduce the large header logo when inside Ashley's World (pink theme) so it's just a bit smaller */
body.pink-theme .main-logo.large {
    max-height: 120px;
}

.main-nav {
    display: flex;
    overflow-x: auto;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    scrollbar-width: none;
    flex-shrink: 0;
    transition: background-color 0.3s, border-color 0.3s;
}

.main-nav::-webkit-scrollbar {
    display: none;
}

.nav-btn, .sub-nav-btn {
    flex: 1;
    min-width: 100px;
    padding: 15px 10px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-btn.active, .sub-nav-btn.active {
    color: var(--accent-red);
    border-bottom-color: var(--accent-red);
    background: rgba(255, 59, 59, 0.05);
}

.exit-btn {
    flex: 0 0 auto;
    min-width: 80px;
    border-right: 1px solid var(--border-color);
    color: var(--accent-red);
}

#content-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 60px; /* Safe space */
}

/* Page Styles */
.page-container {
    max-width: 800px;
    margin: 0 auto;
    animation: fadeIn 0.3s ease-out;
}

/* Use the provided starry background for the main wiki pages (only when NOT in the pink sub-wiki) */
/* Apply the starry image to the whole body so it fills the viewport */
body:not(.pink-theme) {
    /* fixed: point to an existing starry background asset */
    background: url("/baixados (4).png") center / cover fixed no-repeat;
}

/* Keep a translucent overlay on page containers for readability (applies to main wiki and Ashley's World) */
body:not(.pink-theme) .page-container,
body.pink-theme .page-container {
    /* slightly darker overlay on main wiki; pink theme reuses the same readable card */
    background: linear-gradient(rgba(6,6,6,0.6), rgba(6,6,6,0.6));
    border: 1px solid rgba(255,255,255,0.03);
    padding: 20px;
    border-radius: 12px;
}

/* Slight text color tweak to ensure contrast over the background */
body:not(.pink-theme) .page-container h1,
body:not(.pink-theme) .page-container h2,
body:not(.pink-theme) .page-container p,
body:not(.pink-theme) .page-container li {
    color: #f0f0f0;
}

/* Special background for Kaylee and Blackwood Ghost detail pages */
body[data-page="character-kaylee"],
body[data-page="character-ghost"] {
    background: url("/Halloween Joyride 2 - 01.png") center / cover fixed no-repeat;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

h1 {
    font-size: 1.8rem;
    margin-bottom: 15px;
    border-bottom: 2px solid var(--accent-red);
    display: inline-block;
    padding-bottom: 5px;
}

.pink-title {
    border-bottom-color: var(--accent-pink);
    color: var(--accent-pink);
}

p {
    line-height: 1.6;
    margin-bottom: 15px;
    color: #e0e0e0;
}

/* Projects Grid */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.project-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
    text-align: center;
}

/* Ashley's World themed card (dark pink) */
.project-card.ashley-card {
    background: linear-gradient(180deg, #3a0f1c, #2b0811);
    border-color: #4a102a;
    box-shadow: 0 8px 24px rgba(74,16,42,0.18);
    color: #ffd9ea;
}
.project-card.ashley-card .project-info h3 {
    color: #ff9ac0;
}
.project-card.ashley-card p {
    color: rgba(255,154,192,0.85);
}
.project-card.ashley-card:hover {
    transform: translateY(-5px);
    border-color: #ff1493;
    box-shadow: 0 12px 36px rgba(255,20,147,0.12);
}

.project-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-red);
}

.project-logo {
    width: 100%;
    max-width: 180px;
    height: auto;
    margin-bottom: 15px;
}

/* Character Grid */
.character-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.character-card {
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: transform 0.2s;
    cursor: pointer;
}

.character-card:active {
    transform: scale(0.97);
}

.char-img {
    width: 100%;
    aspect-ratio: 1/1.2;
    object-fit: cover;
    background: #222;
}

.char-info {
    padding: 10px;
    text-align: center;
}

.char-name {
    font-weight: bold;
    font-size: 0.9rem;
}

/* Detail View (Infobox Style) */
.infobox {
    float: right;
    width: 250px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    margin-left: 20px;
    margin-bottom: 20px;
}

@media (max-width: 600px) {
    .infobox {
        float: none;
        width: 100%;
        margin-left: 0;
    }

    /* Mobile-only: increase tappable area and spacing for main navigation buttons */
    .main-nav {
        gap: 6px; /* small gap between buttons to avoid crowding */
    }
    .main-nav .nav-btn,
    .main-nav .sub-nav-btn {
        padding: 14px 12px; /* larger vertical padding for touch */
        min-width: 120px;   /* ensure buttons are comfortably sized */
        font-size: 0.95rem;
        border-radius: 8px;
    }
    /* Slightly reduce the hover transform on mobile (no heavy lift on touch) */
    .nav-btn:hover,
    .sub-nav-btn:hover {
        transform: none;
        box-shadow: none;
    }
}

.infobox-header {
    background: var(--accent-red);
    color: white;
    padding: 8px;
    text-align: center;
    font-weight: bold;
}

.infobox-img-container {
    position: relative;
    width: 100%;
    background: #222;
    aspect-ratio: 1/1.2;
    overflow: hidden;
}

.infobox-img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: opacity 0.3s ease;
}

.infobox-tabs {
    display: flex;
    background: #222;
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 8px 5px;
    font-size: 0.75rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    font-weight: bold;
}

.tab-btn.active {
    color: var(--accent-red);
    border-bottom-color: var(--accent-red);
    background: rgba(255, 255, 255, 0.05);
}

.arrow-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 30px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.5rem;
    z-index: 2;
    transition: background 0.2s;
}

.arrow-btn:hover {
    background: rgba(255, 59, 59, 0.7);
}

.arrow-btn.left { left: 0; border-radius: 0 4px 4px 0; }
.arrow-btn.right { right: 0; border-radius: 4px 0 0 4px; }

.infobox-data {
    padding: 10px;
    font-size: 0.85rem;
}

.data-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid #333;
}
.data-row span:last-child {
    margin-left: auto;
    text-align: right;
    max-width: 180px;
    word-break: break-word;
}

.data-label {
    font-weight: bold;
    color: var(--text-secondary);
}

/* List styles */
.discography-list {
    list-style: none;
}

/* Inline album link used in character pages */
.inline-album {
    cursor: pointer;
    color: var(--text-primary); /* stronger, very visible white */
    font-weight: 900; /* extra strong bold */
    text-decoration: none;
    transition: color 0.12s ease, transform 0.12s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Resident link used in Swinford 01 residents list */
.resident-link {
    color: #ffffff;
    font-weight: 700;
    text-decoration: none;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: color 0.12s ease, transform 0.12s ease;
}
.resident-link:hover,
.resident-link:focus {
    color: var(--accent-pink, #ff69b4);
    transform: translateY(-1px);
    outline: none;
}
.inline-album:hover {
    color: var(--accent-red); /* turn red on hover */
    transform: translateY(-1px);
}
.inline-album.active {
    color: var(--accent-red);
}

.album-item {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    cursor: pointer;
}

.album-art {
    width: 60px;
    height: 60px;
    border-radius: 4px;
    margin-right: 15px;
}

.links-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.link-item {
    background: var(--card-bg);
    padding: 15px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.link-item:hover {
    border-color: var(--accent-red);
}

/* Subtle red hover feedback for interactive elements: pointer + slight red tint / glow */
.nav-btn:hover,
.sub-nav-btn:hover,
.project-card:hover,
.character-card:hover,
.album-item:hover,
.link-item:hover,
.tab-btn:hover,
.inline-album:hover {
    cursor: pointer;
    color: var(--accent-red);
    /* faint red halo/outline for clear hover state without being heavy-handed */
    box-shadow: 0 0 0 4px rgba(255,59,59,0.04), 0 4px 12px rgba(0,0,0,0.5);
    border-color: rgba(255,59,59,0.15);
    transform: translateY(-2px);
    transition: transform 0.12s ease, box-shadow 0.12s ease, color 0.12s ease;
}

/* Keep arrow buttons' existing hover background but nudge color to match and preserve vertical centering */
.arrow-btn:hover {
    background: rgba(255, 59, 59, 0.15);
    color: white;
    /* preserve original centering transform so arrows don't shift up/down on hover */
    transform: translateY(-50%);
    transition: background 0.12s ease, transform 0.12s ease;
}

/* Improved tracklist styling */
.tracklist {
    list-style: none;
    counter-reset: track;
    padding-left: 0;
    margin-top: 8px;
}
.tracklist li {
    counter-increment: track;
    display: flex;
    align-items: center;
    padding: 8px 0;
    gap: 12px;
}
/* Default numeric counter for album tracklists */
.tracklist li::before {
    content: counter(track) ".";
    color: var(--accent-red);
    font-weight: 700;
    width: 28px;
    flex: 0 0 28px;
    text-align: right;
    margin-right: 8px;
}
/* Modifier: use a small red dot instead of numbers (for "Mentioned in" lists) */
.tracklist.mentioned-list {
    counter-reset: none;
    padding-left: 0;
}
.tracklist.mentioned-list li {
    counter-increment: none;
}
.tracklist.mentioned-list li::before {
    content: "";
    width: 10px;
    height: 10px;
    background: var(--accent-red);
    border-radius: 50%;
    display: inline-block;
    margin-right: 12px;
    flex: 0 0 18px; /* reserve a small consistent space */
    vertical-align: middle;
}
/* Track title stretches to fill remaining space */
.track-title { flex: 1; }
/* Hide duration so only numbers and song titles show */
.track-duration { display: none; }

/* Image modal styles */
#image-modal { display: block; pointer-events: none; }
body.show-image-modal #image-modal { pointer-events: auto; }
.image-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 10000;
}
.image-modal-card {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(86vmin, 720px);
    height: min(86vmin, 720px);
    background: rgba(10,10,10,0.95);
    border-radius: 12px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
    overflow: hidden;
}
.image-modal-inner {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
}
.image-modal-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.25s ease;
    will-change: transform;
    border-radius: 6px;
}
.image-modal-close {
    position: absolute;
    right: 12px;
    top: 12px;
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: none;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    z-index: 10002;
    font-size: 16px;
}
.image-modal-controls {
    padding: 8px;
    display: flex;
    justify-content: center;
    gap: 8px;
    border-top: 1px solid rgba(255,255,255,0.04);
}
.image-modal-controls button {
    background: linear-gradient(180deg, rgba(255,20,147,0.95), rgba(255,59,59,0.9));
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
}
@media (max-width: 600px) {
    .image-modal-card { width: 92vmin; height: 92vmin; border-radius: 10px; }
}

/* Ashley audio control button (bottom-left) */
.audio-btn {
    position: fixed;
    left: 14px;
    bottom: 14px;
    z-index: 9999;
    width: 52px;
    height: 52px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(180deg, rgba(255,20,147,0.95), rgba(255,59,59,0.9));
    color: white;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(0,0,0,0.5);
    cursor: pointer;
    transition: transform 0.12s ease, opacity 0.12s ease;
}
.audio-btn:hover { transform: translateY(-4px); }
.audio-btn.paused { opacity: 0.9; filter: brightness(0.95); background: linear-gradient(180deg, rgba(40,40,40,0.95), rgba(80,80,80,0.9)); color: var(--accent-pink, #ff69b4); border: 1px solid rgba(255,255,255,0.06); }
@media (max-width: 600px) {
    .audio-btn { width: 48px; height: 48px; left: 12px; bottom: 12px; font-size: 18px; }
}

/* Listen section + Spotify and YouTube buttons */
.listen-section h2 {
    color: #f5f5f5;
    font-size: 1rem;
    margin: 0 0 6px 0;
}
.button-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.spotify-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(180deg, #1ED760, #17b34f);
    color: #000;
    border: none;
    padding: 10px 14px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0,0,0,0.4);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.spotify-btn svg { display: block; flex: 0 0 auto; }
.spotify-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.45);
}

/* YouTube button styling (placed beside Spotify) */
.youtube-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(180deg, #FF0000, #CC0000);
    color: #fff;
    border: none;
    padding: 10px 14px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0,0,0,0.4);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.youtube-btn svg { display: block; flex: 0 0 auto; width: 18px; height: 18px; }
.youtube-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.45);
}

/* Apple Music button (black) placed beside YouTube */
.apple-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(180deg, #000000, #111111);
    color: #fff;
    border: none;
    padding: 10px 14px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0,0,0,0.45);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.apple-btn img { display: block; flex: 0 0 auto; width: 18px; height: 18px; border-radius: 2px; }
.apple-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.55);
}