/* Color Scheme Variables */
:root {
    /* Transition timing */
    --color-transition: color 0.5s ease, background-color 0.5s ease;
    --fade-transition: opacity 0.3s ease-in-out;
    --transform-transition: transform 0.3s ease-in-out;

    /* Fixed colors for UI elements */
    --rgba-location-overlay: rgba(255, 255, 255, 0.85); /* Location overlay background */
    --color-95a5a6: #95a5a6; /* History choice arrow */
    --color-666: #666; /* History choice text and history position text */
    --color-e9ecef: #e9ecef; /* Back to story button hover, locked achievement card background, and volume slider line */
    --color-6c757d: #6c757d; /* Disabled button text & locked achievement card text */
    --color-495057: #495057; /* Locked achievement title */
    --color-f8f9fa: #f8f9fa; /* Back to story button, saved game hover, and toast header */
    --color-000: #000; /* Image container background & location overlay text */
    --color-80bdff: #80bdff; /* Choice focus border */
    --color-ddd: #ddd; /* .choice:focus:not(:focus-visible) */
    --color-343a40: #343a40; /* Dark text on buttons */
    --color-23272b: #23272b; /* Dark text on buttons hover */
    --color-danger: #dc3545; /* Discard "danger" button */

    /* Transparent neutral colors for drop shadows and gradients */
    --rgba-000-015: rgba(0, 0, 0, 0.15);
    --rgba-000-03: rgba(0, 0, 0, 0.3);
    --rgba-000-005: rgba(0, 0, 0, 0.05);
    --rgba-000-008: rgba(0, 0, 0, 0.08);
    --rgba-000-05: rgba(0, 0, 0, 0.5);
    --rgba-007bff-025: rgba(0, 123, 255, 0.25); /* choice focus shadow */
}

/* Home Page Styles */
.home-content {
    position: relative;
    background: var(--color-light);
    z-index: 0;
}

#intro, #faq {
    position: relative;
}

.corner-decoration {
    position: fixed;
    width: 20vw;
    height: 20vw;
    opacity: 0.5;
    pointer-events: none;
    z-index: 0;
}

/* Story content styles */
.story-content {
    position: relative;
    overflow: visible;
    margin-bottom: 2rem;
    opacity: 1;
    transition: var(--color-transition), var(--fade-transition);
    visibility: inherit;
}

.story-content > * {
    position: relative;
    z-index: 2;
}

.story-content .corner-decoration {
    z-index: 1;
    opacity: 1;  /* full opacity */
}

/* Remove the story-description corner decoration specific styles */
.story-description {
    position: relative;
    z-index: 2;
}

/* Add specific rules for intro text content */
#intro {
    position: relative;
}

#intro p {
    position: relative;
    z-index: 2;
}

/* Additional specificity for text elements if needed */
#faq h2, #faq h5, #faq p {
    position: relative;
    z-index: 2;
}

/* Apply transitions to elements that will change color */
body {
    transition: var(--color-transition);
    font-family: var(--font-body);
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--body-bg);
    padding-top: 70px; /* Account for fixed navbar */
    min-height: 100vh;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
}

/* Title styles - Main decorative titles */
h1, .chapter-title, .history-title, .achievements-title {
    font-family: var(--font-title);
    color: var(--title-color) !important;
    line-height: 1.2;
    font-weight: normal;
    transition: var(--color-transition);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
.achievements-title {
    color: var(--color-primary-accent) !important;
}

/* Secondary headings */
h2, h3, h4, h5, h6,
.h2, .h3, .h4, .h5, .h6 {
    font-family: var(--font-body);
    color: var(--title-color);
    line-height: 1.4;
    font-weight: bold;
    transition: var(--color-transition);
}

/* Adjust specific title sizes */
.chapter-title {
    font-size: 4rem;
    text-align: center;
    margin: 2rem 0;
    transition: var(--color-transition);
}

.history-title {
    font-size: 3.5rem;
    text-align: center;
    margin: 0 0 2rem 0;
    border-bottom: 1px solid var(--interface-border);
    padding-bottom: 1rem;
    transition: var(--color-transition);
}

.achievements-title {
    font-size: 3.5rem;
    margin: 0;
    transition: var(--color-transition);
}

h1 { font-size: 3.5rem; transition: var(--color-transition); }
h2 { font-size: 2.5rem; transition: var(--color-transition); }
h3 { font-size: 2rem; transition: var(--color-transition); }
h4 { font-size: 1.75rem; transition: var(--color-transition); }
h5 { font-size: 1.5rem; transition: var(--color-transition); }
h6 { font-size: 1.25rem; transition: var(--color-transition); }

/* Achievement card title adjustment */
.achievement-title {
    font-family: var(--font-body);
    font-size: 1.25rem;
    font-weight: bold;
    margin: 0 0 0.5rem 0;
    color: var(--color-primary-accent);    
    line-height: 1.6;
    transition: var(--color-transition);
}

.achievement-toast-achievement-title {
    font-family: var(--font-body);
    font-size: 1.25rem;
    font-weight: bold;
    margin: 0 0 0.25rem 0;
    color: var(--color-primary-accent);
    line-height: 1.6;
    transition: var(--color-transition);
}

/* Story container styles */
#story-container {
    background-color: var(--container-bg);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-top: 1rem;
    position: relative;
    opacity: 1;
    transition: var(--color-transition), var(--fade-transition);
    visibility: visible;
}

#story-container.fade-transition {
    opacity: 0;
}

/* Story transition styles */
/* Remove old transition styles */

/* Portrait styles */
#portrait-container {
    float: right;
    margin: 0 0 1rem 2rem;
    max-width: 300px;
    width: 30%;
    display: none; /* Hidden by default */
    cursor: pointer; /* Make it clear the portrait is clickable */
    position: relative; /* Add relative positioning */
    z-index: 3; /* Ensure it's above story-output */
}

#portrait-container.visible {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease-in, visibility 0s linear;
}

#portrait-image {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: block;
}

/* Story image styles */
.story-image-container {
    margin: -2rem -2rem 2rem -2rem;
    max-height: calc((100vh - 70px) / 3);
    overflow: hidden;
    position: relative;
    background-color: var(--color-000);
}

.story-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    display: block;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.story-image.fade-transition {
    opacity: 0;
}

.location-overlay {
    position: absolute;
    bottom: 0;
    right: 0;
    transform: translateY(100%);
    padding: 5px 10px;
    background: var(--rgba-location-overlay);
    color: var(--color-000);
    text-align: center;
    font-size: 1.25rem;
    font-family: var(--font-body);
    font-style: italic;
    border-top-left-radius: 8px;
    transition: transform 0.3s ease, opacity 0.3s ease;
    width: auto;
    display: inline-block;
    white-space: nowrap;
    opacity: 1;
}

.location-overlay.fade-transition {
    opacity: 0;
}

.location-overlay:not(:empty) {
    transform: translateY(0);
}

/* Story output styles */
#story-output {
    margin-bottom: 20px;
    font-size: 18px;
    transition: var(--fade-transition);
    position: relative; /* Add relative positioning */
    z-index: 2; /* Lower z-index than portrait-container */
}

#story-output p {
    color: var(--text-color);
    margin-bottom: 15px;
    transition: var(--color-transition), var(--fade-transition);
    opacity: 1;
}

/* Choice styles */
#choices-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    clear: both; /* Ensure it clears the floated portrait */
    width: 100%; /* Full width */
    transition: var(--fade-transition);
}

.choice {
    background-color: var(--choice-bg);
    border: 1px solid var(--choice-border);
    border-radius: 4px;
    padding: 12px 15px;
    cursor: pointer;
    width: 100%;
    text-align: left;
    font-family: inherit;
    font-size: inherit;
    color: var(--text-color);
    display: block;
    opacity: 1;
    transition: var(--color-transition), var(--fade-transition), box-shadow 0.2s ease;
}

.choice:hover {
    background-color: var(--choice-hover-bg);
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.choice:active {
    transform: translateY(0);
}

.choice:focus {
    outline: none;
    border-color: var(--color-80bdff);
    box-shadow: 0 0 0 0.2rem var(--rgba-007bff-025);
}

.choice:focus:not(:focus-visible) {
    outline: none;
    box-shadow: none;
    border-color: var(--color-ddd);
}

.choice:focus-visible {
    outline: none;
    border-color: var(--color-80bdff);
    box-shadow: 0 0 0 0.2rem var(--rgba-007bff-025);
}

/* Button states */
.btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.btn.active {
    background-color: var(--color-light);
    color: var(--color-343a40);
}

/* Story History Styles */
.history-choice {
    color: var(--color-666);
    font-weight: bold;
    margin: 10px 0;
    padding-left: 20px;
    position: relative;
}

.history-choice::before {
    content: ">";
    position: absolute;
    left: 0;
    color: var(--color-95a5a6);
}

.history-navigation {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--interface-border);
}

.history-nav-button {
    padding: 8px 16px;
    background-color: var(--color-343a40);
    color: var(--color-light);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    min-width: 100px;
}

.history-nav-button:hover:not(:disabled) {
    background-color: var(--color-23272b);
}

.history-nav-button:disabled {
    background-color: var(--color-6c757d);
    cursor: not-allowed;
    opacity: 0.65;
}

.history-position {
    display: flex;
    align-items: center;
    color: var(--color-666);
    font-size: 14px;
    min-width: 80px;
    justify-content: center;
}

.back-to-story {
    display: block;
    text-align: center;
    margin-top: 20px;
    padding: 10px;
    background-color: var(--color-f8f9fa);
    border-radius: 4px;
    cursor: pointer;
    color: var(--color-343a40);
    text-decoration: none;
    font-weight: bold;
    transition: all 0.2s ease;
}

.back-to-story:hover {
    background-color: var(--color-e9ecef);
    text-decoration: none;
    color: var(--color-23272b);
}

/* Loading state */
.loading {
    text-align: center;
    font-style: italic;
    color: var(--color-6c757d);
}

/* Load Game Modal Styles */
#loadGameModal .modal-dialog {
    max-height: 90vh;
    margin: 1rem auto;
}

#loadGameModal .modal-content {
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

#loadGameModal .modal-body {
    overflow-y: auto;
    max-height: calc(90vh - 120px); /* Account for header and padding */
    padding: 0;
}

#savedGamesList .list-group-item {
    padding: 1em;
    border: 1px solid var(--interface-border);
    margin-bottom: -1px;
    background-color: var(--interface-bg);
}

#savedGamesList .btn-link {
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: normal;
    color: inherit;
    width: 100%;
    text-align: left;
    padding: 1.25rem;
    background: transparent;
}

#savedGamesList .btn-link:hover {
    background-color: var(--color-f8f9fa);
    text-decoration: none;
}

#savedGamesList .btn-danger {
    border-radius: 0;
    height: 100%;
    padding: 0 1rem;
}

#savedGamesList .btn-danger:hover {
    background-color: var(--color-danger);
}

/* Toast Styles */
.toast {
    background-color: var(--interface-bg);
    border-radius: 4px;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.toast-header {
    background-color: var(--color-f8f9fa);
    border-bottom: 1px solid var(--interface-border);
    color: var(--interface-text-color);
}

.toast-body {
    color: var(--interface-text-color);
}

.toast .toast-title,
.toast .toast-text,
.toast p {
    color: var(--interface-text-color);
}

/* Toast container styles */
.position-fixed.bottom-0.right-0.p-3 {
    pointer-events: none; /* Make the container not block interactions */
}

.position-fixed.bottom-0.right-0.p-3 .toast {
    pointer-events: auto; /* Re-enable interactions only for visible toasts */
}

.toast:not(.show) {
    display: none !important; /* Ensure hidden toasts don't take up space */
}

.home-content {
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
    background-color: var(--color-light);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.home-content .story-description {
    font-size: 1.1rem;
    line-height: 1.6;
}

.home-content .features {
    padding: 1.5rem;
    border-radius: 8px;
}

.home-content .features li {
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.home-content #startGameButton {
    padding: 1rem 2rem;
    font-size: 1.25rem;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    background-color: var(--color-primary-accent);
    color: var(--color-light);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
    margin: 1rem 0;
}

.home-content #startGameButton.loading {
    background-size: 200% 100%;
    animation: loading 1.5s linear infinite;
    cursor: not-allowed;
    pointer-events: none;
    opacity: 0.8;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.home-content #startGameButton:hover:not(.loading) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.home-content #startGameButton:disabled {
    opacity: 0.8;
    cursor: not-allowed;
}

/* Remove custom continue button styles since we're using the choice class */

.achievements-content {
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
    background-color: var(--color-light);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.achievements-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--interface-border);
}

/* Mobile styles for achievements header */
@media (max-width: 991.98px) {
    .achievements-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .achievements-counter {
        margin-top: 0.5rem;
    }
}

.achievements-counter {
    font-size: 1.25rem;
    color: var(--color-666);
    font-family: var(--font-body);
}

.achievements-list {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.achievement-card {
    background: var(--color-light);
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    transition: all 0.2s ease;
    border: 1px solid var(--interface-border);
    position: relative;
    overflow: hidden;
}

.achievement-card.locked {
    background: var(--color-e9ecef);
    opacity: 0.9;
    filter: none;
}

.achievement-card.locked::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        45deg,
        var(--rgba-000-005),
        var(--rgba-000-005) 10px,
        var(--rgba-000-008) 10px,
        var(--rgba-000-008) 20px
    );
    pointer-events: none;
}

.achievement-card.locked .achievement-icon {
    color: var(--color-6c757d);
}

.achievement-card.locked .achievement-title {
    color: var(--color-495057);
}

.achievement-card.locked .achievement-description {
    color: var(--color-6c757d);
    font-style: italic;
}

.achievement-card:hover {
    transform: translateY(-2px);
}

.achievement-icon {
    font-size: 2rem;
    color: var(--color-primary-accent);
    flex-shrink: 0;
}

.achievement-content {
    flex-grow: 1;
}

.achievement-description {
    font-size: 1rem;
    color: var(--color-666);
    margin: 0;
}

/* Achievement notification toast */
.achievement-toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--interface-bg);
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--rgba-000-015);
    padding: 1rem;
    z-index: 9999;
    min-width: 300px;
    max-width: 400px;
    border-left: 4px solid var(--color-secondary-accent);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.achievement-toast-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.achievement-toast-title {
    font-weight: bold;
    color: var(--color-secondary-accent);
    margin: 0;
    display: flex;
    align-items: center;
}

.achievement-toast-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--color-666);
    cursor: pointer;
    padding: 0;
    margin-left: 0.5rem;
    line-height: 1;
}

.achievement-toast-body {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.achievement-toast-icon {
    font-size: 2rem;
    color: var(--color-primary-accent);
    flex-shrink: 0;
}

.achievement-toast-content {
    flex-grow: 1;
}

.achievement-toast-description {
    color: var(--interface-text-color);
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.4;
}

/* Navigation bar styles */
.navbar {
    background-color: var(--color-navbar);
    box-shadow: 0 2px 4px var(--rgba-000-015);
}

.navbar-brand {
    color: var(--color-light) !important;
    font-size: 1.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: none;
    display: flex;
    align-items: center;
}

.navbar-brand-text {
    display: block;
}

.navbar-brand-logo {
    display: none;
}

/* Mobile navigation styles */
@media (max-width: 991.98px) {
    .navbar-brand-text {
        display: none;
    }

    .navbar-brand-logo {
        display: block;
    }

    .btn-outline-light {
        padding: 0.375rem 0.5rem;
        font-size: 0.875rem;
    }

    .btn-outline-light i {
        font-size: 1rem;
    }

    /* Mobile navigation container */
    .d-flex.d-lg-none.align-items-center {
        display: flex !important;
        justify-content: space-between !important;
        width: 100%;
        margin-left: 1rem;
    }

    /* Left section - Main Menu */
    #mainMenuBtnMobile {
        order: 1;
        margin-right: auto;
    }

    /* Middle section - History */
    #storyHistoryMobile {
        order: 2;
    }

    /* Right section - Audio Controls */
    .nav-item.audio-controls {
        order: 3;
        margin-left: auto;
    }

    /* Make History and Main Menu buttons same width as audio controls */
    #mainMenuBtnMobile,
    #storyHistoryMobile {
        width: 38px;
    }

    /* Hide save game button on mobile */
    #saveGameMobile {
        display: none !important;
    }

    /* Hide other mobile buttons */
    #homeMobile,
    #newGameMobile,
    #loadGameMobile,
    #achievementsMobile {
        display: none !important;
    }

    /* Spacing for mobile buttons */
    .mx-1 {
        margin-left: 0.15rem !important;
        margin-right: 0.15rem !important;
    }
}

/* Desktop navigation styles */
@media (min-width: 992px) {
    .btn-group {
        display: inline-flex !important;
        gap: 4px !important;
    }

    .btn-group .btn {
        border-radius: 6px !important;
    }

    .nav-item.audio-controls {
        margin-left: 0.5rem;
    }
}

/* Navbar toggler wrapper styles */
.navbar-toggler-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
}

/* Audio controls styles */
.nav-item.audio-controls {
    position: relative;
}

/* Desktop audio controls specific styles */
@media (min-width: 992px) {
    .nav-item.audio-controls {
        margin-left: 0;
    }

    .d-lg-flex.align-items-center {
        gap: 0;
    }
}

.audio-controls .btn {
    padding: 0.375rem 0.75rem;
    line-height: 1.5;
}

.audio-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--interface-bg);
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 1rem;
    margin-top: 0.5rem;
    z-index: 1000;
    min-width: 200px;
}

.audio-dropdown.show {
    display: block;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mute-toggle {
    background: none;
    border: none;
    color: var(--color-666);
    cursor: pointer;
    padding: 0.25rem;
}

.volume-slider {
    flex-grow: 1;
}

/* Remove Bootstrap's default button group styling */
.btn-group > .btn:not(:first-child),
.btn-group > .btn-group:not(:first-child) > .btn {
    margin-left: 0 !important;
    border-top-left-radius: 6px !important;
    border-bottom-left-radius: 6px !important;
}

.btn-group > .btn:not(:last-child),
.btn-group > .btn-group:not(:last-child) > .btn {
    border-top-right-radius: 6px !important;
    border-bottom-right-radius: 6px !important;
}

.btn-group-vertical > .btn:not(:first-child),
.btn-group-vertical > .btn-group:not(:first-child) > .btn {
    margin-top: 0 !important;
    border-top-left-radius: 6px !important;
    border-top-right-radius: 6px !important;
}

.btn-group-vertical > .btn:not(:last-child),
.btn-group-vertical > .btn-group:not(:last-child) > .btn {
    border-bottom-right-radius: 6px !important;
    border-bottom-left-radius: 6px !important;
}

.btn-primary {
    background-color: var(--color-primary-accent) !important;
    border-color: var(--color-primary-accent) !important;
}

.btn-primary:hover {
    background-color: var(--color-secondary-accent) !important;
    border-color: var(--color-secondary-accent) !important;
}

/* Focus styles for buttons */
.btn-primary:focus, .btn-primary.focus {
    box-shadow: 0 0 0 0.2rem var(--rgba-secondary-accent) !important;
}

.btn-dark:focus, .btn-dark.focus {
    box-shadow: 0 0 0 0.2rem var(--rgba-primary-accent) !important;
}

/* Additional Bootstrap overrides for headings */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    color: var(--color-primary-accent);
}

/* Audio Controls Styles */
.audio-controls {
    position: relative;
    display: inline-block;
}

.audio-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--interface-bg);
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    display: none;
    z-index: 1000;
}

.audio-dropdown.show {
    display: block;
    animation: fadeIn 0.2s ease-out;
}

.audio-controls-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.volume-slider {
    flex-grow: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--color-e9ecef);
    border-radius: 3px;
    outline: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--color-secondary-accent);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--color-secondary-accent);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    background: var(--color-secondary-accent-darker);
}

.volume-slider::-moz-range-thumb:hover {
    transform: scale(1.1);
    background: var(--color-secondary-accent-darker);
}

.mute-toggle {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--color-primary-accent);
    transition: color 0.2s ease;
}

.mute-toggle:hover {
    color: var(--color-secondary-accent-darker);
}

.mute-toggle i {
    font-size: 1.25rem;
}

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

/* Adjust navbar styles to accommodate audio controls */
.navbar-nav {
    align-items: center;
}

.nav-item.audio-controls {
    margin-left: 0.25rem;
}

/* Modal Styles */
.modal-content {
    background-color: var(--interface-bg);
}

.modal-header {
    border-bottom-color: var(--interface-border);
}

.modal-footer {
    border-top-color: var(--interface-border);
}

.modal-title,
.modal-body,
.modal-body p,
.modal-body .list-group-item,
.modal-body .btn-link {
    color: var(--interface-text-color);
}

/* Main Menu Modal Styles */
#mainMenuModal .modal-content {
    background-color: var(--interface-bg);
    border: 1px solid var(--interface-border);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

#mainMenuModal .modal-header {
    border-bottom: 1px solid var(--interface-border);
    padding: 1.5rem;
}

#mainMenuModal .modal-title {
    color: var(--color-primary-accent);
    font-size: 3rem;
    font-family: var(--font-title);
    text-transform: none;
    letter-spacing: 2px;
}

#mainMenuModal .modal-body {
    padding: 2rem;
    color: var(--interface-text-color);
}

#mainMenuModal .btn {
    font-size: 1.2rem;
    padding: .75rem;
    margin-bottom: .75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    background-color: var(--color-primary-accent) !important;
    border: 1px solid var(--color-primary-accent) !important;
    color: var(--color-light) !important;
    position: relative;
    width: 100%;
}

#mainMenuModal .btn:hover {
    background-color: var(--color-secondary-accent) !important;
    border-color: var(--color-secondary-accent) !important;
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

#mainMenuModal .btn:active {
    transform: translateY(0);
}

#mainMenuModal .close {
    color: var(--interface-text-color);
    text-shadow: none;
    opacity: 0.8;
    transition: all 0.3s ease;
}

#mainMenuModal .close:hover {
    opacity: 1;
}

/* Game Transition Overlay */
.game-transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: black;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 2s ease-in-out;
}

.game-transition-overlay.active {
    opacity: 1;
    pointer-events: auto;
    transition: opacity 1000ms ease-in-out;
}

/* Portrait Modal Styles */
#portraitModal .modal-dialog {
    max-width: 95vw;
    margin: 0.5rem auto;
    width: auto; /* Allow dialog to shrink to content */
    display: flex;
    align-items: center;
    min-height: calc(100% - 1rem); /* Account for margin */
}

#portraitModal .modal-content {
    background-color: transparent;
    border: none;
    width: auto; /* Allow content to shrink to image */
    margin: 0 auto; /* Center horizontally */
}

#portraitModal .modal-body {
    position: relative;
    padding: 0;
    width: auto; /* Allow body to shrink to image */
    display: flex;
    justify-content: center; /* Center image horizontally */
}

#portraitModal .portrait-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1;
    color: var(--color-light);
    text-shadow: 0 0 3px var(--rgba-000-05);
    opacity: 0.8;
    font-size: 2rem;
}

#portraitModal .portrait-modal-close:hover {
    opacity: 1;
}

#portraitModalImage {
    max-height: 90vh;
    max-width: 95vw;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 0 20px var(--rgba-000-03);
    display: block;
}

/* Roll Image Styles */
.roll-image {
    display: inline-block;
    vertical-align: middle;
    max-width: 75px;
    height: auto;
    margin: 0 2px;
    border-radius: 2px;
    transition: transform 0.2s ease;
}

.roll-image:hover {
    transform: scale(1.05);
}

/* Ensure proper spacing when multiple roll images are in the same paragraph */
#story-output p .roll-image + .roll-image {
    margin-left: 4px;
}

/* Ensure proper spacing when roll images are mixed with text */
#story-output p .roll-image {
    margin: 0 3px;
}
