/* Global styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
    touch-action: manipulation; /* Prevent default touch actions on mobile devices */
    -webkit-tap-highlight-color: transparent; /* Disable tap highlight color on mobile devices */
}

body {
    background-color: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    background-color: #000;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

/* Fonts */
.tiny5-regular {
    font-family: "Tiny5", sans-serif;
    font-weight: 400;
    font-style: normal;
    text-shadow: 2px 2px 0 rgba(0, 0, 0, 1), -2px -2px 0 rgba(0, 0, 0, 1), -2px 2px 0 rgba(0, 0, 0, 1), 2px -2px 0 rgba(0, 0, 0, 1);
}

/* Lists */
ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}
li {
    margin: 5px 0;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    color: white;
    font-size: 1rem;
    text-align: left;
}

/* Screen styles */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background-size: cover;
    background-position: center;
}

.screen.active {
    display: flex;
}

/* Title screen */
#title-screen {
    background-color: #000;
    background-image: url('../img/backgrounds/title-bg.png');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: top center;
    color: white;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* World select screen */
#world-select-screen {
    background-image: linear-gradient(rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.95)), url('../img/backgrounds/bg-blue.jpg');
    color: white;
}

.screen-title {
    font-size: 2rem;
    margin-bottom: 2rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.worlds-container {
    display: flex;
    flex-direction: row;
    gap: 15px;
    max-width: 90%;
    margin-bottom: 20px;
    overflow-x: auto;
    padding: 10px 15px;
    scroll-behavior: smooth;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Hide scrollbar for Chrome, Safari and Opera */
.worlds-container::-webkit-scrollbar {
    display: none;
}

/* Hide scrollbar for IE, Edge and Firefox */
.worlds-container {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

.world-item {
    position: relative;
    width: 250px;
    height: 160px;
    border: 3px solid #4a6fa5;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease;
    flex-shrink: 0; /* Prevent items from shrinking */
}

.world-item:hover {
    transform: scale(1.05);
    border-color: #fff;
}

.world-item.locked {
    opacity: 0.6;
    cursor: not-allowed;
}

.world-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.world-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px;
    text-align: center;
    font-size: 0.8rem;
}

.world-lock {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

.world-lock i {
    font-size: 2rem;
    color: #fff;
}

.world-description {
    max-width: 80%;
    margin: 0 auto 20px auto;
    background-color: rgba(0, 0, 0, 0.6);
    padding: 15px;
    border-radius: 8px;
    color: #f1f1f1;
    font-size: 1rem;
    line-height: 1.4;
    text-align: center;
    border: 1px solid rgba(52, 152, 219, 0.5);
}

#world-desc-text {
    margin: 0;
}

/* Level select screen */
#level-select-screen {
    background-image: linear-gradient(rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.95)), url('../img/backgrounds/bg-red.jpg');
    color: white;
}

.levels-container {
    display: flex;
    flex-direction: row;
    gap: 15px;
    max-width: 90%;
    margin-bottom: 20px;
    overflow-x: auto;
    padding: 10px 15px;
    scroll-behavior: smooth;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Hide scrollbar for Chrome, Safari and Opera */
.levels-container::-webkit-scrollbar {
    display: none;
}

/* Hide scrollbar for IE, Edge and Firefox */
.levels-container {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

.level-item {
    position: relative;
    width: 120px;
    height: 120px;
    border: 3px solid #4a6fa5;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.5);
    flex-shrink: 0; /* Prevent items from shrinking */
}

.level-item:hover {
    transform: scale(1.05);
    border-color: #fff;
}

.level-item.locked {
    opacity: 0.6;
    cursor: not-allowed;
}

.level-number {
    font-size: 2.5rem;
    color: white;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.9);
}

.level-lock {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Game screen */
#game-screen {
    background-color: #000;
}

#game-screen.active {
    display: flex;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

#game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
}

/* Game timer */
.game-timer {
    font-size: 1.8rem;
    font-weight: bold;
    color: white;
    background-color: rgba(0, 0, 0, 0.6);
    padding: 5px 15px;
    border-radius: 5px;
    z-index: 10;
    font-family: 'Courier New', monospace;
    display: inline-block;
}

.timer-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Lives container styling */
.lives-container,
.money-container,
.echo-container,
.keys-container {
    background-color: rgba(0, 0, 0, 0.5);
    padding: 5px 10px;
    border-radius: 5px;
    margin-left: 10px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}
.lives-container {
    background: url('../img/ui/lives.png') no-repeat center center;
    background-size: cover;
    min-height: calc(134px / 2.5);
    min-width: calc(259px / 2.5);
}
.money-container {
    background: url('../img/ui/money.png') no-repeat center center;
    background-size: cover;
    min-height: calc(134px / 2.5);
    min-width: calc(298px / 2.5);
}
.keys-container {
    background: url('../img/ui/keys.png') no-repeat center center;
    background-size: cover;
    min-height: calc(134px / 2.5);
    min-width: calc(259px / 2.5);
}

#lives-label {
    color: #000;
    margin-right: 5px;
    font-size: 18px;
}

#lives-count {
    color: #000;
    font-weight: bold;
    font-size: 20px;
}

#money-display-hud {
    color: #000;
    font-weight: bold;
    font-size: 20px;
}

#echo-count {
    color: #000;
    font-weight: bold;
    font-size: 20px;
}

#key-count {
    color: #000;
    font-weight: bold;
    font-size: 20px;
}

.money-icon {
    color: #000;
    font-weight: bold;
    margin-right: 5px;
}

.echo-icon {
    color: #3498db;
    font-weight: bold;
    margin-right: 5px;
}

.key-icon {
    color: #2ecc71;
    font-weight: bold;
    margin-right: 5px;
}

.hud-top {
    position: absolute;
    top: 15px;
    right: 30px;
    display: flex;
    align-items: center;
}

/* Game Legend */
.game-legend {
    position: absolute;
    right: 15px;
    bottom: 130px;
    background-color: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    padding: 10px;
    color: white;
    font-size: 0.8rem;
    z-index: 20;
    max-width: 200px;
    backdrop-filter: blur(2px);
}

.legend-title {
    font-weight: bold;
    margin-bottom: 5px;
    text-align: center;
    font-size: 0.9rem;
}

.legend-items {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-image {
    width: 32px;
    height: 32px;
    margin-right: 10px;
    border-radius: 4px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.toggle-legend {
    position: absolute;
    right: 15px;
    bottom: 116px;
    background-color: rgba(52, 152, 219, 0.7);
    color: white;
    border: none;
    border-radius: 5px;
    padding: 5px 10px;
    font-size: 0.8rem;
    cursor: pointer;
    z-index: 30;
}

.toggle-legend:hover {
    background-color: rgba(52, 152, 219, 1);
}

/* Settings screen */
#settings-screen {
    background-image: linear-gradient(rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.95)), url('../img/backgrounds/bg-green.jpg');
    color: white;
}

.settings-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
    width: 300px;
}

.setting {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 5px;
}

/* Settings screen difficulty selector */
#difficulty-select {
    background-color: #34495e;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 1rem;
}

#difficulty-select option {
    background-color: #2c3e50;
}

/* Button styles */
.button-container {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.home-button-container {
    position: absolute;
    bottom: 7%;
    left: 5%;
    display: flex;
    flex-direction: row;
    align-items: center;
}

.game-button {
    padding: 12px 15px;
    background-color: #666;
    color: white;
    border: none;
    border-radius: 0;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.game-button:hover {
    transform: scale(1.05);
}

.back-button {
    position: absolute;
    top: 20px;
    left: 20px;
    padding: 10px 20px 8px;
    background-color: rgba(0,0,0,0.8);
    color: #e74c3c;
    border: 2px solid #e74c3c;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
    z-index: 15;
}

.back-button:hover {
    border-color: #c0392b;
}

/* .reset-button {
    background-color: #e74c3c;
    margin-top: 20px;
    font-size: 0.9rem;
}

.reset-button:hover {
    background-color: #c0392b;
} */

.button-start {
    background: url('../img/ui/buttons/button-start.png') no-repeat center center;
    background-size: cover;
    width: 150px;
    height: 65px;
}
.button-start:hover {
    transform: scale(1.05);
}

.button-settings {
    background: url('../img/ui/buttons/button-start.png') no-repeat center center;
    background-size: cover;
    width: 150px;
    height: 65px;
    font-size: 1.4rem;
}
.button-settings:hover {
    transform: scale(1.05);
}

/* Modal styles */
.hidden {
    display: none !important;
}

#modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal {
    background-color: #2c3e50;
    width: 80%;
    max-width: 500px;
    border-radius: 10px;
    padding: 20px;
    color: white;
    text-align: center;
}

.modal h2 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: #f1c40f;
}

.stats {
    margin: 20px 0;
    font-size: 1.2rem;
}

.stats p {
    margin: 10px 0;
}

.key-container {
    margin: 15px 0;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
}

/* Game controls */
.game-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
    padding: 20px;
}

.direction-pad {
    position: absolute;
    bottom: 25px;
    left: 25px;
    display: grid;
    grid-template-columns: repeat(3, 40px);
    grid-template-rows: repeat(3, 40px);
    gap: 12px;
}

#move-up {
    grid-column: 2;
    grid-row: 1;
    background-image: url('../img/ui/directions/up.png');
}

#move-left {
    grid-column: 1;
    grid-row: 2;
    background-image: url('../img/ui/directions/left.png');
}

#move-right {
    grid-column: 3;
    grid-row: 2;
    background-image: url('../img/ui/directions/right.png');
}

#move-down {
    grid-column: 2;
    grid-row: 3;
    background-image: url('../img/ui/directions/down.png');
}

.direction-button {
    width: 64px;
    height: 64px;
    border: none;
    cursor: pointer;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    background-color: transparent;
}

.direction-button:hover {
    background-color: rgba(255, 255, 255, 0.2);
}
 
.action-buttons {
    position: absolute;
    bottom: 25px;
    right: 25px;
    display: flex;
    flex-direction: row;
    gap: 10px;
}

.action-button {
    background-size: cover;
    border: none;
    cursor: pointer;
}
.action-button img {
    height: auto;
    width: auto;
    max-height: 32px;
}

#echo-button {
    width: 80px;
    height: 103px;
    background: url('../img/ui/buttons/button-action.png') no-repeat center center;
    background-size: cover;
    background-color: transparent;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    gap: 20px;
    padding: 10px 0;
}
#echo-button #echo-count {
    font-size: 1rem;
    color: #000;
    font-weight: bold;
}
#inventory-button {
    width: 77px;
    height: 76px;
    background: url('../img/ui/buttons/button-inventory.png') no-repeat center center;
    background-size: cover;
    background-color: transparent;
}

#toggle-legend {
    background-color: rgba(155, 89, 182, 0.7);
}

#toggle-legend:hover {
    background-color: rgba(155, 89, 182, 1);
}

/* Inventory styles */
#inventory-modal {
    max-height: 500px;
    overflow-y: auto;
}

.gadgets-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 20px 0;
}

.gadget-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.gadget-item:hover {
    background-color: rgba(0, 0, 0, 0.5);
}

.gadget-item.selected {
    border-color: #f1c40f;
    background-color: rgba(241, 196, 15, 0.2);
}

.gadget-icon {
    width: 50px;
    height: 50px;
    background-color: #3498db;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    font-weight: bold;
    color: white;
}

.gadget-info {
    text-align: left;
}

.gadget-info h3 {
    font-size: 1.2rem;
    margin-bottom: 5px;
}

.gadget-info p {
    font-size: 0.9rem;
    color: #bdc3c7;
}

/* Shop button and money display */
.page-header {
    position: absolute;
    top: 0;
    width: 100%;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 20px 20px;
    box-sizing: border-box;
    z-index: 10;
    /* background-color: rgba(0, 0, 0, 0.5); */
}

.player-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.shop-button {
    padding: 10px 20px;
    background-color: #f1c40f;
    color: #2c3e50;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
}

.shop-button:hover {
    background-color: #f39c12;
    transform: scale(1.05);
}

.player-money {
    background-color: rgba(0, 0, 0, 0.5);
    padding: 8px 15px;
    border-radius: 20px;
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 5px;
}

.money-icon-gold {
    color: #f1c40f;
    font-weight: bold;
}

/* Shop modal styles */
#shop-modal {
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.shop-money-display {
    background-color: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.shop-tabs {
    display: flex;
    border-bottom: 2px solid #3498db;
    margin-bottom: 15px;
}

.shop-tab {
    padding: 10px 20px;
    background-color: transparent;
    border: none;
    color: white;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

.shop-tab.active {
    background-color: #3498db;
    color: white;
}

.shop-tab:hover:not(.active) {
    background-color: rgba(52, 152, 219, 0.3);
}

.shop-tab-content {
    display: none;
}

.shop-tab-content.active {
    display: block;
}

.shop-items-container,
.upgrade-items-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 10px;
}

.shop-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.shop-item:hover {
    background-color: rgba(0, 0, 0, 0.5);
}

.shop-item.selected {
    border-color: #f1c40f;
    background-color: rgba(241, 196, 15, 0.2);
}

.shop-item-icon {
    width: 40px;
    height: 40px;
    background-color: #3498db;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
    font-weight: bold;
    color: white;
}

.shop-item-info {
    flex: 1;
}

.shop-item-name {
    font-size: 1rem;
    margin: 0 0 5px 0;
}

.shop-item-price {
    font-size: 0.9rem;
    color: #f1c40f;
}

.item-details-container {
    background-color: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 5px;
    margin-top: 10px;
}

.selected-item-details {
    margin-bottom: 15px;
}

#selected-item-name {
    margin: 0 0 10px 0;
    color: #f1c40f;
}

#selected-item-description {
    margin: 0 0 10px 0;
    color: #bdc3c7;
}

#selected-item-price {
    font-size: 1.2rem;
    font-weight: bold;
    color: #2ecc71;
}

#purchase-button:disabled {
    background-color: #7f8c8d;
    cursor: not-allowed;
    transform: none;
}

.shop-level-stats {
    display: flex;
    gap: 5px;
    padding: 12px 0 15px;
    align-items: center;
    justify-content: space-between;
}

.shop-level-stats p {
    padding: 8px 12px;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
}

@media (max-width: 600px) {
    .shop-items-container,
    .upgrade-items-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 500px) {
    .game-title {
        font-size: 3rem;
    }
    
    .screen-title {
        font-size: 2rem;
    }
    
    .worlds-container,
    .levels-container {
        grid-template-columns: 1fr;
    }
    
    .direction-button {
        width: 35px;
        height: 35px;
    }
    
    .action-button {
        width: 80px;
        height: 35px;
        font-size: 0.8rem;
    }
}

/* Add to Home Screen Popup */
.add-to-home {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(52, 152, 219, 0.95);
    color: white;
    width: 90%;
    max-width: 400px;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    display: none;
    flex-direction: column;
    text-align: center;
    font-size: 0.9rem;
}

.add-to-home.show {
    display: flex;
}

.add-to-home h3 {
    margin: 0 0 10px 0;
    font-size: 1.2rem;
}

.add-to-home p {
    margin: 0 0 10px 0;
}

.add-to-home-icon {
    font-size: 1.5rem;
    margin: 5px;
}

.add-to-home-steps {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 10px 0;
}

.add-to-home-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
}

.add-to-home-button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
}

.dismiss-button {
    background-color: rgba(255, 255, 255, 0.3);
    color: white;
}

.install-button {
    background-color: #27ae60;
    color: white;
}

/* Add styles for the tap-to-start overlay */
.fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #2c3e50, #1a2530);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease-in-out;
}

.start-content {
    text-align: center;
    color: white;
    padding: 20px;
}

.start-icon {
    width: 120px;
    height: 120px;
    margin-bottom: 20px;
    border-radius: 20px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
}

.pulsing-button {
    background-color: #e74c3c;
    color: white;
    padding: 15px 30px;
    border-radius: 30px;
    font-size: 24px;
    margin: 30px auto;
    cursor: pointer;
    animation: pulse 1.5s infinite;
    width: max-content;
    font-weight: bold;
}

.audio-note {
    font-size: 14px;
    opacity: 0.8;
    margin-top: 10px;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7);
    }
    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(231, 76, 60, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0);
    }
}

#boss-defeat-animation-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 200; /* Higher than modal overlay */
    display: flex;
    justify-content: center;
    align-items: center;
}

#boss-defeat-video {
    max-width: 90%;
    max-height: 90vh;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
}

/* Animation Container (Generic Fullscreen Overlay) */
#animation-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85); /* Semi-transparent background */
    z-index: 200; /* Ensure it's above most other elements */
    display: none; /* Hidden by default */
    justify-content: center;
    align-items: center;
    overflow: hidden; /* Prevent scrollbars if content overflows */
}

#animation-container.active {
    display: flex; /* Show when active */
}

/* Dialog Panel Styling */
#dialog-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 180px;
    background-color: rgba(21, 21, 21, 0.9);
    padding: 20px 35px;
    display: flex;
    flex-direction: row;
    align-items: center;
    z-index: 50;
    border-top: 3px solid #3498db;
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease-in-out;
    /* Disable text selection */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

#dialog-panel.hidden {
    transform: translateY(100%);
}

.dialog-left-character {
    flex: 0 0 150px;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-end;
}

.dialog-left-character img {
    max-height: 100%;
    max-width: 250px;
    object-fit: contain;
    filter: drop-shadow(2px 4px 6px black);
}

.dialog-content {
    flex: 1;
    padding: 15px;
    color: white;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: calc(100% - 150px);
}

.dialog-speaker {
    font-weight: bold;
    color: #f1c40f;
    font-size: 1.2rem;
}

.dialog-text {
    font-size: 1rem;
    line-height: 1.4;
}

.dialog-next-indicator {
    position: absolute;
    bottom: 15px;
    right: 25px;
    color: white;
    font-size: 24px;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Make the dialog system responsive */
@media (max-width: 768px) {
    #dialog-panel {
        min-height: 120px;
    }
    
    .dialog-left-character {
        flex: 0 0 100px;
    }
    
    .dialog-left-character img {
        max-height: 150px;
        max-width: 80px;
    }
    
    .dialog-content {
        max-width: calc(100% - 100px);
    }
    
    .dialog-speaker {
        font-size: 1rem;
    }
    
    .dialog-text {
        font-size: 0.9rem;
    }
}