/* Global Styles */
body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #f0f0f0;
    background-image: url('assets/images/snordeluxe-background.webp'); /* The URL of the image */
    background-size: cover; /* Cover the entire page */
    background-position: center; /* Center the background image */
    background-repeat: no-repeat; /* Do not repeat the image */
}

button {
    background-color: #FFA500;
    color: #fff;
    padding: 15px 30px;
    font-size: 18px;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s ease; /* Smooth transition for hover effect */
    position: relative; /* Required for the pseudo-elements */
    overflow: hidden; /* Keeps the shimmer effect within the button boundaries */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* Drop shadow for enhanced visibility */
}

button::after {
    content: '';
    position: absolute;
    top: 0;
    left: -150%; /* Start from the left */
    width: 100%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shimmer 2s infinite;
    transition: background-color 0.3s ease;
}

button:hover {
    background-color: #e69500; /* Darker shade for hover state */
}

@keyframes shimmer {
    to {
        left: 150%; /* Move the shimmer effect across the button */
    }
}

/* User Info */
.user-info {
    position: fixed;
    right: 20px;
    top: 20px;
    display: flex;
    flex-direction: column; /* Stacked items */
    align-items: flex-start;
    gap: 10px; /* Space between items */
    padding: 15px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 250px; /* Ensure it contains the leaderboard */
    max-height: 90vh; /* Prevent overflow */
    overflow-y: auto; /* Enable scrolling if necessary */
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .user-info {
        width: 180px;
    }
}

/* User Info Text */
.user-info span {
    font-weight: bold;
    color: #333;
}

.user-info button {
    padding: 5px 10px;
    font-size: 14px;
}

.user-info span#usernameDisplay {
    background: linear-gradient(45deg, #6a82fb, #fc5c7d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 18px;
    font-weight: bold;
    animation: pulse 2s infinite;
}

.user-info span#usernameDisplay:hover {
    transition: transform 0.3s;
    transform: rotate(-5deg);
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Stats */
.user-info .stats {
    display: flex;
    flex-direction: row;
    gap: 5px;
    width: 100%;
    justify-content: space-between;
    margin-bottom:10px;
    margin-top:10px;
}

.user-info .stats .stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-weight: bold;
    color: #333;
    padding: 5px;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    flex: 1;
    text-align: center;
    font-size: 14px;
}

.user-info .stats .stat-item .stat-label {
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    color: #666;
}

/* Responsive Adjustments for Stats */
@media (max-width: 768px) {
    .user-info .stats {
        flex-direction: row;
        font-size: 12px;
    }
    .stat-item {
        font-size: 12px;
    }
}

/* Buttons Row */
.user-info .buttons-row {
    display: flex;
    width: 100%;
    justify-content: space-between;
}

/* Shop Button */
.user-info #shopButton {
    background: linear-gradient(45deg, #6a82fb, #fc5c7d);
    border: none;
    border-radius: 5px;
    color: white;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
    width: calc(50% - 5px);
}

.user-info #shopButton:hover {
    background: linear-gradient(45deg, #fc5c7d, #6a82fb);
}

/* Boost Button */
.user-info #upgradeButton {
    background: linear-gradient(45deg, #28a745, #ff7f50); /* Green to Coral gradient */
    border: none;
    border-radius: 5px;
    color: white;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
    width: calc(50% - 5px);
}

.user-info #upgradeButton:hover {
    background: linear-gradient(45deg, #218838, #ff6347); /* Darker Green to Tomato gradient */
}

/* Leaderboard */
.leaderboard {
    width: 100%;
    max-width: 400px;
}

.leaderboard h3 {
    background: linear-gradient(45deg, #6a82fb, #fc5c7d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 18px;
    font-weight: bold;
}

.leaderboard ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.leaderboard li {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.9);
    transition: background-color 0.3s;
}

.leaderboard li:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.leaderboard li span {
    background: linear-gradient(45deg, #6a82fb, #fc5c7d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 14px;
    font-weight: bold;
}

.leaderboard li span.rank {
    font-weight: bold;
}

.leaderboard li span.username {
    flex-grow: 1;
    margin-left: 10px;
    text-align: left;
}

.leaderboard li span.score {
    font-weight: bold;
    animation: pulse 2s infinite;
}

/* Online Indicator */
.online-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #4CAF50; /* Green color */
    border-radius: 50%;
    margin-right: 6px;
    box-shadow: 0 0 3px rgba(76, 175, 80, 0.6);
    animation: pulse-green 2s infinite;
    vertical-align: middle;
}

@keyframes pulse-green {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

/* Chat Container */
#chat-container {
    position: fixed;
    top: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 15px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 300px;
    max-height: 30vh;
    overflow-y: auto;
    /* z-index: 2002; */
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    #chat-container {
        width: 180px;
        min-height: 100px;
        max-height: 200px; /* Limit the height for smaller screens */
        top: 10px; /* Adjust top position */
        left: 10px; /* Adjust left position */
        padding: 10px; /* Adjust padding */
    }
}

@media (max-width: 480px) {
    #chat-container {
        width: 120px;
        min-height: 80px;
        max-height: 180px; /* Further limit the height for very small screens */
        top: 10px;
        left: 10px;
        padding: 8px; /* Further adjust padding */
        font-size: 12px; /* Reduce font size for better fit */
    }
}

/* Further adjustments for extremely small screens */
@media (max-width: 320px) {
    #chat-container {
        width: 80px;
        min-height: 60px;
        max-height: 150px;
        top: 5px;
        left: 5px;
        padding: 5px;
        font-size: 10px; /* Reduce font size even more */
    }
}

/* Chat Messages */
#messages {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
    overflow-y: auto;
    flex-grow: 1;
}

#messages li {
    padding: 5px 10px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s;
}

#messages li:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Chat Form */
#chat-form {
    display: flex;
    width: 100%;
    box-sizing: border-box; /* Ensure padding and border are included in the element's width and height */
}

#chat-input {
    flex: 1;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 5px 0 0 5px;
    font-size: 16px; /* Prevent zoom on mobile */
    box-sizing: border-box; /* Ensure padding and border are included in the element's width and height */
}

#chat-form button {
    width: 60px; /* Set a fixed width for the button */
    padding: 5px;
    background: linear-gradient(45deg, #6a82fb, #fc5c7d);
    border: none;
    border-radius: 0 5px 5px 0;
    color: white;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
    box-sizing: border-box; /* Ensure padding and border are included in the element's width and height */
}

#chat-form button:hover {
    background: linear-gradient(45deg, #fc5c7d, #6a82fb);
}

/* Normal message styles */
.normal-message {
  background-color: #f1f1f1;
  color: #333;
  padding: 10px;
  margin: 5px 0;
  border-radius: 5px;
  border: 1px solid #ddd;
}

/* Battle message styles */
.battle-message {
  background-color: #ffdddd;
  color: #d9534f;
  padding: 10px;
  margin: 5px 0;
  border-radius: 5px;
  border: 1px solid #d9534f;
  font-weight: bold;
}

/* Store message styles */
.store-message {
  background-color: #dff0d8;
  color: #5cb85c;
  padding: 10px;
  margin: 5px 0;
  border-radius: 5px;
  border: 1px solid #5cb85c;
  font-weight: bold;
}

/* Training message styles */
.training-message {
  background-color: #d9edf7;
  color: #31708f;
  padding: 10px;
  margin: 5px 0;
  border-radius: 5px;
  border: 1px solid #31708f;
  font-weight: bold;
}

.announce-chiron {
    background-color: #ff5722; /* Darker orange background */
    color: #fff; /* White text */
    padding: 10px;
    margin: 10px 0;
    border-radius: 8px;
    font-weight: bold;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    position: relative; /* Ensure relative positioning for the pseudo-element */
}

@keyframes chiron {
    0% {
        transform: translateX(100%);
    }
    100% {
        transform: translateX(-100%);
    }
}

.announce-message {
    background-color: #ff9800; /* Orange background */
    color: #fff; /* White text */
    padding: 15px;
    margin: 10px 0;
    border-radius: 8px;
    border: 2px solid #ff5722; /* Darker orange border */
    font-weight: bold;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    animation: pulse 1.5s infinite; /* Add a pulsing animation */
}

.announce-message .username {
    font-weight: bold;
    margin-right: 5px;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .user-info {
        width: 180px;
        top: 20px;
        right: 10px;
    }

    #chat-container {
        width: 180px;
        bottom: 80px; /* Adjust bottom position to avoid overlap with user info */
        left: 10px;
    }

    #chat-input {
        width: calc(100% - 60px); /* Adjust width based on button's width */
    }
}


/* logout button */

#logoutButton {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background-color: #ccc; /* Light gray background */
    color: #333; /* Darker text for visibility */
    padding: 10px 20px; /* Smaller padding */
    font-size: 14px; /* Smaller font size */
    border: none; /* No border */
    cursor: pointer;
    transition: background-color 0.3s ease; /* Smooth transition for hover effect */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Subtle shadow for better visibility */
    z-index: 1000000;
}

#logoutButton:hover {
    background-color: #bbb; /* Slightly darker on hover */
}

/* Title Container */
.title-container {
    color: #fff; /* Darker text for better readability */
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5); /* Large drop shadow */
    font-size: 120px; /* Overall larger font size */
    display: flex;
    justify-content: center;
}

/* Logo Image */
#logo-image {
    width: 650px; /* Default width */
    height: auto; /* Maintain aspect ratio */
    margin-top: 290px; /* Default margin */
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    #logo-image {
        width: 50%; /* Adjust width to be 50% of the screen width */
    }
}

@media (max-width: 480px) {
    #logo-image {
        width: 80%; /* Adjust width to be 80% of the screen width */
    }
}

/* Upgrade Button */
.upgrade-button {
    background-color: #4CAF50; /* Green background */
    color: white; /* White text */
    padding: 10px 15px; /* Padding around text and icon */
    font-size: 16px; /* Text size */
    border: none; /* No border */
    cursor: pointer; /* Pointer cursor on hover */
    display: flex; /* Align icon with text */
    align-items: center; /* Vertical alignment */
    justify-content: center; /* Horizontal alignment */
    border-radius: 5px; /* Rounded corners */
    transition: background-color 0.3s; /* Smooth transition for hover effect */
    position: relative; /* Relative positioning for pseudo-elements */
}

.upgrade-button:hover {
    background-color: #367C2B; /* Darker green on hover */
}

.upgrade-icon {
    display: inline-block;
    margin-right: 5px; /* Space between icon and text */
    transform: translateY(-2px); /* Slightly raise the icon */
    transition: transform 0.3s; /* Smooth transition for icon movement */
}

.upgrade-button:hover .upgrade-icon {
    transform: translateY(-4px) scale(1.1); /* Move and scale icon on hover */
}

.upgrade-button::before {
    content: '';
    position: absolute;
    top: -10px; right: -10px;
    width: 20px; height: 20px;
    background-color: #ffc107; /* Gold color for premium feel */
    border-radius: 50%; /* Circle shape */
    box-shadow: 0 2px 4px rgba(0,0,0,0.2); /* Soft shadow for depth */
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
}

.modal p {
    margin: 15px 0;
}

/* Initially hidden, you can add a class to show the modal */
.modal.show {
    display: block;
}

.loading-content, .modal-content {
    text-align: center;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: opacity 0.3s ease; /* Fade in/out transitions */
}

.loading-spinner {
    border: 16px solid #00FFFF;
    border-top: 16px solid #000080;
    border-radius: 50%;
    width: 120px;
    height: 120px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Shop Page & Item Styles */
.snorlax-item {
    border: 1px solid #ccc;
    padding: 8px;
    text-align: center;
    background-color: #f9f9f9;
    transition: transform 0.2s ease; /* Smooth scaling on hover */
    max-width: 300px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.snorlax-item img {
    max-width: 200px;
    width: 100%;
    height: auto;
    object-fit: contain;
    margin-bottom: 10px;
}

.snorlax-item button {
    margin-top: 8px;
    background-color: #4CAF50;
    color: white;
    padding: 10px 24px;
    font-size: 16px;
}

#shopPage {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0072ff, #00c6ff);
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); /* Smaller items on mobile */
    z-index: 3003;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
}

#shopPage.visible {
    display: block !important;
}

.shop-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
    gap: 20px !important;
    width: 100%;
    margin: 20px auto;
}

/* Update responsive styles */
@media (max-width: 768px) {
    .shop-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
    }
}

.snorlax-item {
    width: 100%;
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#closeShopButton {
    position: fixed;
    top: 20px;
    left: 20px;
    background-color: #ff4545; /* Red color for attention */
    color: white;
    border: none;
    cursor: pointer;
    padding: 10px 15px;
    font-size: 16px;
    border-radius: 50%; /* Circular button */
    z-index: 3004;
}

#closeShopButton:hover {
    background-color: #ff2121; /* Darker shade on hover */
}

#shopButton {
    z-index: 100;
}
/* Responsive Adjustments */
@media (max-width: 768px) {
    #shopPage {
        padding: 20px; /* Reduced padding on mobile */
    }

    .snorlax-item {
        max-width: 100%; /* Allow full width on very small screens */
    }

    button {
        padding: 10px 20px; /* Smaller buttons on small screens */
        font-size: 16px;
    }
}

/* Stats & Rewards Modals */
.rewards-modal {
    background-color: #fff; /* Background for readability */
    color: #333; /* Text color for readability */
    padding: 20px;
    border-radius: 8px; /* Rounded corners */
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
}

/* Add this to hide elements specifically when loading is shown */
.loading-hide {
    display: none;
}

.rewards-modal {
    display: none;
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    padding: 20px;
    z-index: 200;
    text-align: center;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Daily Chest */
.daily-chest {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    font-size: 50px; /* Adjust size as needed */
    cursor: pointer;
    animation: glow 2s infinite alternate;
    z-index: 100; /* Ensure it's clickable above other elements */
    /* Use text-shadow for a closer glow effect */
    color: #FFD700; /* Adjust the color to match your icon if needed */
}

@keyframes glow {
    from {
        text-shadow: 0 0 5px #FFD700, 0 0 10px #FFD700, 0 0 15px #FFD700, 0 0 20px #FFA500;
    }
    to {
        text-shadow: 0 0 10px #FFD700, 0 0 20px #FFD700, 0 0 30px #FFD700, 0 0 40px #FFA500;
    }
}

.center-chest {
    display: block; /* Ensure the element is displayed */
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 1000; /* Ensure it's above other content */
}

@keyframes wobble {
    0%, 100% { transform: translate(-50%, -50%); }
    25% { transform: translate(-50%, -50%) translateX(-10px); }
    75% { transform: translate(-50%, -50%) translateX(10px); }
}

@keyframes grow {
    from { transform: translate(-50%, -50%) scale(1); }
    to { transform: translate(-50%, -50%) scale(10); }
}

@keyframes flash {
    from { opacity: 1; }
    to { opacity: 0; } /* Adjust to use opacity for the flash effect */
}
/* Full-screen modal styles */
.modal-overlay {
    display: none; /* Hide by default */
    position: fixed;
    z-index: 5000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    overflow: auto;
}

.modal-overlay.show {
    display: block; /* Show when the 'show' class is added */
}

.modal-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    max-width: 90%; /* Adjusted to be more responsive */
    margin: 50px auto;
    padding: 20px;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.modal-content img {
    max-width: 600px; /* Increased max-width for the image */
    height: auto;
    margin-right: 20px;
    flex-shrink: 0; /* Ensure image doesn't shrink */
}

.modal-content .snorlax-details {
    max-width: 400px; /* Set max-width for the details pane */
    flex-grow: 1; /* Allow details pane to grow */
    color: #333; /* Ensure text color is readable */
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 10px; /* Add space below the title */
}

.modal-content p,
.modal-content ul {
    color: #333; /* Ensure text color is readable */
    margin-bottom: 10px; /* Add space below paragraphs and lists */
}

.modal-content ul {
    padding-left: 20px; /* Add padding for list items */
}

.modal-content .stats-analysis {
    margin-bottom: 20px; /* Space below stats and analysis section */
}

.modal-content .attack {
    display: flex;
    align-items: center;
    background-color: #f9f9f9;
    padding: 10px;
    margin-bottom: 10px; /* Space between attack entries */
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.modal-content .attack span {
    flex: 1;
}

.modal-content .attack .train-button {
    margin-left: 10px; /* Space between attack info and train button */
}

.modal-content .buttons-row {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

.close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #ff4545;
    color: white;
    border: none;
    cursor: pointer;
    padding: 5px 10px;
    font-size: 16px;
    border-radius: 50%;
}

.close-button:hover {
    background-color: #ff2121;
}

.battle-button,
.evolve-button,
.train-button {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    font-size: 16px;
    border: none;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.battle-button {
    background: linear-gradient(45deg, #ff0000, #ff8c00);
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.battle-button:hover {
    background: linear-gradient(45deg, #e60000, #ff6600);
    transform: scale(1.05);
}

.evolve-button {
    background: linear-gradient(45deg, #4CAF50, #66BB6A);
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.evolve-button:hover {
    background: linear-gradient(45deg, #388E3C, #4CAF50);
    transform: scale(1.05);
}

.train-button {
    background-color: #4CAF50;
    color: white;
    padding: 5px 10px;
    font-size: 14px;
    margin-left: 10px;
    border-radius: 5px;
}

.train-button:hover {
    background-color: #367C2B;
    transform: scale(1.05);
}

.battle-button i,
.evolve-button i,
.train-button i {
    margin-right: 8px;
}

/* Responsive styles for mobile */
@media (max-width: 768px) {
    .modal-content {
        flex-direction: column;
        text-align: center;
    }

    .modal-content img {
        max-width: 80%;
        margin: 0 auto 20px;
    }

    .modal-content .snorlax-details {
        max-width: 100%;
    }
}

/* Ensure the logged_in_view container takes up the full width and height */
#logged_in_view {
    width: 100vw;
    height: 100vh;
    position: relative !important; /* Ensure it positions elements correctly */
    overflow: hidden; /* Prevent overflow issues */
}

/* Inventory Styles */
.inventory-container {
    width: 100%; /* Full width to utilize the entire screen */
    margin: 0px;
    display: none; /* Initially hidden */
    bottom: 20px;
    position: fixed;
    overflow-x: auto; /* Enable horizontal scrolling */
    padding-left: 20%; /* Significant negative space on the left */
    padding-right: 20%; /* Ensure content doesn't overflow */
    box-sizing: border-box; /* Ensure padding is included in the width */
    height: 38vh; /* Max height to be 1/3 of the screen */
    z-index: 0;
}

.inventory {
    display: flex; /* Use flexbox for horizontal layout */
    gap: 20px;
    min-width: max-content; /* Ensure the container width adjusts to its content */
    max-height: 100%; /* Ensure items fit within the container */
    z-index: 10;
    align-items: flex-start; /* Align items to the top */
}

.inventory-item {
    background-color: #fff;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
    position: relative; /* Required for positioning the evolve icon */
    max-height: 200px; /* Max height for inventory cards */
    max-width: 150px; /* Max width for inventory cards */
    flex-shrink: 0; /* Prevent items from shrinking */

}

.inventory-item img {
    max-width: 100%;
    height: auto;
    margin-bottom: 10px;
}

.inventory-item p {
    font-size: 14px;
    color: #333;
    margin: 0;
}

.inventory-item:hover {
    transform: translateY(-5px);
}

.evolve-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    cursor: pointer;
}

.evolve-icon:hover {
    transform: scale(1.1);
}
/* Battleground Styles */
.battleground-overlay {
    display: flex;
    flex-direction: row;  /* Align children in a row */
    align-items: center;  /* Align items vertically in the center */
    justify-content: space-evenly;  /* Space out children evenly */
    padding: 20px;
    box-sizing: border-box;
    position: relative; /* Ensure relative positioning for video overlay */
}

.battleground-overlay div {
    display: flex;
    flex-direction: column;  /* Stack image and health bar vertically */
    align-items: center;  /* Center align the items */
    position: relative; /* Ensure relative positioning for video overlay */
}

.battleground-overlay video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 2001;
}

progress {
    width: 200px;  /* Ensure this matches the width you set for the images */
    height: 20px;
    margin-top: 10px;  /* Space between image and health bar */
    border-radius: 5px;
    -webkit-appearance: none; /* Removes default styling */
    appearance: none;
    background-color: #ddd;
}

progress[value]::-webkit-progress-bar {
    background-color: #eee;
}

progress[value]::-webkit-progress-value {
    background-color: #76AD3B; /* Green progress bar */
    border-radius: 5px;
}

progress[value]::-moz-progress-bar { /* Firefox */
    background-color: #76AD3B;
}

.battleground-overlay button {
    background-color: #4CAF50;
    color: white;
    margin: 5px;
    border: none;
    cursor: pointer;
    padding: 10px 20px;
    font-size: 16px;
    transition: transform 0.3s ease, background-color 0.3s ease;
    border-radius: 5px;
}

.battleground-overlay button:not(:disabled):hover {
    transform: scale(1.1);
    background-color: #367C2B;
}

.battleground-overlay button:disabled {
    background-color: #ccc; /* Gray out button */
    cursor: not-allowed; /* Change cursor to indicate button is disabled */
    opacity: 0.5; /* Reduce opacity to indicate it's disabled */
}

@keyframes fadeOutUp {
    from {
        opacity: 1;
        transform: translateY(0px);
    }
    to {
        opacity: 0;
        transform: translateY(-300px);  /* Increased distance to make the movement more noticeable */
    }
}

@media (max-width: 768px) {
    .battleground-overlay button {
        padding: 8px 16px; /* Smaller buttons on smaller screens */
        font-size: 14px;
    }

    progress {
        width: 90%; /* Larger progress bars on smaller screens for better visibility */
    }

    /* Battle results overlay mobile responsive styles */
    .battle-results-overlay {
        padding: 15px 5px !important;
    }
    
    .battle-results-overlay h1 {
        font-size: 2em !important;
        margin-bottom: 15px !important;
    }
    
    .battle-results-overlay img {
        max-width: 150px !important;
        margin-bottom: 15px !important;
    }
    
    .battle-results-overlay p {
        font-size: 1em !important;
        margin: 6px 0 !important;
    }
}

/* Additional rules for very small screens */
@media (max-width: 480px) {
    .battle-results-overlay {
        padding: 10px 5px !important;
    }
    
    .battle-results-overlay h1 {
        font-size: 1.5em !important;
        margin-bottom: 10px !important;
    }
    
    .battle-results-overlay img {
        max-width: 120px !important;
        margin-bottom: 10px !important;
    }
    
    .battle-results-overlay button {
        padding: 12px 20px !important;
        font-size: 1em !important;
        min-width: 100px !important;
    }
}

/* Landscape orientation on small screens */
@media (max-height: 600px) and (orientation: landscape) {
    .battle-results-overlay {
        padding: 5px !important;
    }
    
    .battle-results-overlay h1 {
        font-size: 1.8em !important;
        margin-bottom: 8px !important;
    }
    
    .battle-results-overlay img {
        max-width: 100px !important;
        margin-bottom: 8px !important;
    }
    
    .battle-results-overlay div[style*="padding"] {
        padding: 15px !important;
    }
}

.modal-overlay, .rewards-modal, .modal {
    /* These existing styles may need to be adjusted if they conflict with the new battle UI elements */
    z-index: 3000; /* Ensure these overlays appear above the battleground but below modal dialogs if needed */
}

/* Ensure all text elements in overlays and modals have consistent font styling */
.modal-overlay p, .rewards-modal p, .battleground-overlay p {
    color: #333;
    font-size: 16px;
    line-height: 1.4;
}

.fade-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: black;
    z-index: 3000;
    opacity: 0;
    transition: opacity 1s;
}

.fade-overlay.fade-in {
    opacity: 1;
}

.fade-overlay.fade-out {
    opacity: 0;
}

/* Intro text for battle */
.battle-intro {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 3em;
    text-align: center;
    z-index: 3001;
    opacity: 1;
    animation: introAnimation 3s forwards;
}

@keyframes introAnimation {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}

/* CSS for character names */
.character-name {
    position: absolute;
    top: -30px; /* Adjust based on your design */
    font-size: 1.6em;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* Code Modal */
.codeModal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    width: 400px; /* Adjust width for better fit */
}

.codeModal input[type="text"] {
    padding: 10px;
    margin-bottom: 20px; /* Increased margin */
    width: 100%; /* Full width of modal */
    font-size: 18px; /* Adjust font size for better readability */
    box-sizing: border-box; /* Includes padding and border in the element's width */
    border: 1px solid #ccc; /* Consistent border */
    border-radius: 5px; /* Rounded corners */
    outline: none; /* Remove default outline */
    transition: border-color 0.3s ease; /* Smooth transition */
}

.codeModal input[type="text"]:focus {
    border-color: #4CAF50; /* Green border on focus */
}

.codeModal button {
    padding: 12px 25px;
    cursor: pointer;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px; /* Matching font size with input field */
    width: 100%; /* Full width for consistency */
    transition: background-color 0.3s ease; /* Smooth transition */
}

.codeModal button:hover {
    background-color: #45a049; /* Darker green on hover */
}

.codeModal h2 {
    margin-bottom: 20px; /* Space between heading and input field */
    font-size: 24px; /* Consistent font size */
    color: #333; /* Dark text color */
}

.codeModal p {
    font-size: 12px;
    color: grey;
    margin-top: 10px;
    margin-bottom: 10px;
    text-align: center; /* Centered text */
    width: 100%; /* Full width */
}

.back-button {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2002;
    padding: 10px 20px;
    font-size: 16px;
    background-color: #f44336;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.back-button:hover {
    background-color: #d32f2f;
}

@media (max-width: 768px) {
    #shopContent {
        width: 95%;
        padding: 10px;
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .snorlax-item {
        max-width: 100%;
    }

    .snorlax-item img {
        max-width: 150px;
    }
}

.announce-chiron {
    background-color: #ff5722; /* Darker orange background */
    color: #fff; /* White text */
    padding: 10px;
    margin: 10px 0;
    border-radius: 8px;
    font-weight: bold;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.announce-chiron span {
    display: inline-block;
    white-space: nowrap;
    animation: chiron 10s linear infinite;
}

@keyframes chiron {
    0% {
        transform: translateX(100%);
    }
    100% {
        transform: translateX(-100%);
    }
}

.announce-message {
    background-color: #ff9800; /* Orange background */
    color: #fff; /* White text */
    padding: 15px;
    margin: 10px 0;
    border-radius: 8px;
    border: 2px solid #ff5722; /* Darker orange border */
    font-weight: bold;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    animation: pulse 1.5s infinite; /* Add a pulsing animation */
}

.announce-message .username {
    font-weight: bold;
    margin-right: 5px;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Mobile Controls Styles - Full Screen Touch Interface */
.mobile-touch-surface {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: none;
    z-index: 1500; /* Below UI elements (buttons have z-index 2002) but above battleground (1000) */
    pointer-events: auto;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
    background: transparent; /* Completely invisible */
}

/* Mobile Tips Overlay */
.mobile-tips-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2600;
    animation: fadeIn 0.5s ease;
}

.tips-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 20px;
    max-width: 400px;
    margin: 20px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

.tips-content h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 24px;
    font-weight: bold;
}

.tip-item {
    display: flex;
    align-items: center;
    margin: 15px 0;
    padding: 10px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    text-align: left;
}

.tip-icon {
    font-size: 24px;
    margin-right: 15px;
    min-width: 40px;
    text-align: center;
}

.tip-text {
    color: #333;
    font-size: 16px;
    line-height: 1.4;
}

.tip-text strong {
    color: #000;
}

.tip-note {
    background: rgba(0, 150, 255, 0.1);
    border: 1px solid rgba(0, 150, 255, 0.3);
    border-radius: 8px;
    padding: 12px;
    margin: 15px 0;
    color: #0056b3;
    font-size: 14px;
    text-align: center;
    font-weight: 500;
}

/* Intro Tips Styles */
.tips-content.intro-tips {
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
}

.tip-section {
    margin: 20px 0;
    padding: 15px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 12px;
    border-left: 4px solid #4CAF50;
}

.tip-section h4 {
    margin: 0 0 15px 0;
    color: #2e7d32;
    font-size: 18px;
    font-weight: bold;
}

.tip-section .tip-item {
    margin: 10px 0;
    background: rgba(255, 255, 255, 0.7);
}

.tips-dismiss {
    background: linear-gradient(145deg, #4CAF50, #45a049);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.tips-dismiss:hover {
    background: linear-gradient(145deg, #45a049, #4CAF50);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* Responsive adjustments for tips */
@media (max-width: 768px) {
    .tips-content {
        margin: 15px;
        padding: 25px;
        max-width: 350px;
    }
    
    .tips-content.intro-tips {
        max-width: 400px;
        max-height: 80vh;
    }
    
    .tips-content h3 {
        font-size: 20px;
    }
    
    .tip-section h4 {
        font-size: 16px;
    }
    
    .tip-text {
        font-size: 14px;
    }
    
    .tip-icon {
        font-size: 20px;
        min-width: 35px;
        margin-right: 12px;
    }
    
    .tip-note {
        font-size: 13px;
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .tips-content {
        margin: 10px;
        padding: 20px;
        max-width: 300px;
    }
    
    .tips-content.intro-tips {
        max-width: 320px;
        max-height: 75vh;
    }
    
    .tips-content h3 {
        font-size: 18px;
        margin-bottom: 15px;
    }
    
    .tip-section {
        margin: 15px 0;
        padding: 12px;
    }
    
    .tip-section h4 {
        font-size: 15px;
        margin-bottom: 12px;
    }
    
    .tip-item {
        margin: 10px 0;
        padding: 8px;
    }
    
    .tip-text {
        font-size: 13px;
    }
    
    .tip-icon {
        font-size: 18px;
        min-width: 30px;
        margin-right: 10px;
    }
    
    .tips-dismiss {
        padding: 10px 25px;
        font-size: 14px;
    }
    
    .tip-note {
        font-size: 12px;
        padding: 8px;
    }
}

/* Legacy visible controls (kept for backwards compatibility) */
.mobile-controls-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: none;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-end;
    pointer-events: none;
    z-index: 2500;
    padding: 20px;
    box-sizing: border-box;
}

.movement-controls,
.action-controls {
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.movement-controls {
    align-self: flex-end;
    margin-bottom: 40px;
}

.action-controls {
    align-self: flex-end;
    margin-bottom: 40px;
    flex-direction: row;
    gap: 15px;
}

/* Enhanced Mobile Controls */
.movement-controls.enhanced {
    flex: 1;
    max-width: 45%;
    height: 80vh;
    align-items: stretch;
}

.action-controls.enhanced {
    flex: 1;
    max-width: 45%;
    height: 80vh;
    align-items: stretch;
    flex-direction: column;
}

.movement-area {
    flex: 1;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 3px solid rgba(255, 255, 255, 0.2);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
}

.movement-area:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100px;
    height: 100px;
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.3s ease;
}

.movement-area.active {
    background: rgba(0, 150, 255, 0.3);
    border-color: rgba(0, 150, 255, 0.5);
    box-shadow: 0 0 20px rgba(0, 150, 255, 0.3);
}

.movement-area.active:before {
    border-color: rgba(255, 255, 255, 0.6);
    width: 120px;
    height: 120px;
}

.movement-area.moving-left {
    background: rgba(255, 100, 100, 0.3);
    border-color: rgba(255, 100, 100, 0.5);
}

.movement-area.moving-right {
    background: rgba(100, 255, 100, 0.3);
    border-color: rgba(100, 255, 100, 0.5);
}

.movement-center-indicator {
    width: 40px;
    height: 40px;
    background: linear-gradient(145deg, #74b9ff, #0984e3);
    border-radius: 50%;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.movement-area.active .movement-center-indicator {
    transform: scale(1.2);
    box-shadow: 0 6px 20px rgba(116, 185, 255, 0.5);
}

.movement-instructions {
    color: white;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    opacity: 0.8;
}

.attack-area {
    flex: 1;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 3px solid rgba(255, 255, 255, 0.2);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
}

.attack-area.attacking {
    background: rgba(255, 100, 100, 0.4);
    border-color: rgba(255, 100, 100, 0.6);
    box-shadow: 0 0 25px rgba(255, 100, 100, 0.4);
    transform: scale(0.95);
}

.attack-instructions {
    text-align: center;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

.attack-hint {
    margin: 15px 0;
    font-size: 16px;
    font-weight: bold;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.attack-area.attack1-disabled .attack-hint:nth-child(1) {
    opacity: 0.4;
    background: rgba(255, 255, 255, 0.05);
}

.attack-area.attack2-disabled .attack-hint:nth-child(2) {
    opacity: 0.4;
    background: rgba(255, 255, 255, 0.05);
}

.mobile-instructions {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 2501;
}

.instruction-text {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: fadeInOut 3s ease-in-out infinite;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Legacy button styles for backwards compatibility */
.dpad {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.mobile-control-btn {
    border: none;
    border-radius: 50%;
    background: linear-gradient(145deg, #2d3436, #636e72);
    color: white;
    font-size: 24px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.3),
        inset 0 2px 4px rgba(255, 255, 255, 0.1);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    transition: all 0.15s ease;
    touch-action: manipulation;
    position: relative;
    overflow: hidden;
}

.mobile-control-btn:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-control-btn:hover:before,
.mobile-control-btn.pressed:before {
    opacity: 1;
}

.mobile-control-btn.pressed {
    transform: scale(0.9);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.4),
        inset 0 4px 8px rgba(0, 0, 0, 0.2);
    background: linear-gradient(145deg, #74b9ff, #0984e3);
}

.move-btn,
.jump-btn {
    width: 70px;
    height: 70px;
    font-size: 28px;
}

.jump-btn {
    background: linear-gradient(145deg, #00b894, #00a085);
    margin: 0 10px;
}

.jump-btn.pressed {
    background: linear-gradient(145deg, #55efc4, #00b894);
}

.attack-btn {
    width: 65px;
    height: 65px;
    font-size: 20px;
    background: linear-gradient(145deg, #e17055, #d63031);
    position: relative;
    line-height: 1;
}

.attack-btn.pressed {
    background: linear-gradient(145deg, #fd79a8, #e84393);
}

.attack-btn.attack1 {
    background: linear-gradient(145deg, #fd79a8, #e84393);
}

.attack-btn.attack2 {
    background: linear-gradient(145deg, #fdcb6e, #e17055);
}

.attack-btn.attack3 {
    background: linear-gradient(145deg, #a29bfe, #6c5ce7);
}

.attack-btn.cooldown {
    background: linear-gradient(145deg, #636e72, #2d3436);
    opacity: 0.6;
    cursor: not-allowed;
}

.attack-btn.disabled {
    background: linear-gradient(145deg, #636e72, #2d3436);
    opacity: 0.3;
    cursor: not-allowed;
}

.cooldown-text {
    font-size: 10px;
    font-weight: normal;
    opacity: 0.8;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .mobile-controls-container {
        padding: 15px;
    }
    
    .movement-controls.enhanced,
    .action-controls.enhanced {
        height: 75vh;
    }
    
    .move-btn,
    .jump-btn {
        width: 65px;
        height: 65px;
        font-size: 24px;
    }
    
    .attack-btn {
        width: 60px;
        height: 60px;
        font-size: 18px;
    }
    
    .dpad {
        padding: 12px;
        gap: 8px;
    }
    
    .action-controls {
        gap: 12px;
    }
    
    .attack-hint {
        font-size: 14px;
        margin: 10px 0;
        padding: 8px 12px;
    }
    
    .instruction-text {
        font-size: 12px;
        padding: 8px 15px;
    }
}

@media (max-width: 480px) {
    .mobile-controls-container {
        padding: 10px;
    }
    
    .movement-controls.enhanced,
    .action-controls.enhanced {
        height: 70vh;
    }
    
    .move-btn,
    .jump-btn {
        width: 60px;
        height: 60px;
        font-size: 22px;
    }
    
    .attack-btn {
        width: 55px;
        height: 55px;
        font-size: 16px;
    }
    
    .dpad {
        padding: 10px;
        gap: 6px;
    }
    
    .action-controls {
        gap: 10px;
    }
    
    .attack-hint {
        font-size: 13px;
        margin: 8px 0;
        padding: 6px 10px;
    }
    
    .instruction-text {
        font-size: 11px;
        padding: 6px 12px;
    }
    
    .movement-instructions {
        font-size: 14px;
    }
}

/* Landscape orientation adjustments */
@media (orientation: landscape) and (max-height: 600px) {
    .mobile-controls-container {
        padding: 10px 20px;
    }
    
    .movement-controls.enhanced,
    .action-controls.enhanced {
        height: 85vh;
        margin-bottom: 10px;
    }
    
    .movement-controls,
    .action-controls {
        margin-bottom: 20px;
    }
    
    .move-btn,
    .jump-btn {
        width: 55px;
        height: 55px;
        font-size: 20px;
    }
    
    .attack-btn {
        width: 50px;
        height: 50px;
        font-size: 16px;
    }
    
    .attack-hint {
        font-size: 12px;
        margin: 6px 0;
        padding: 5px 8px;
    }
    
    .instruction-text {
        font-size: 10px;
        padding: 5px 10px;
    }
}

/* Touch feedback animations */
@keyframes touchPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 20px rgba(116, 185, 255, 0.4);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    }
}

@keyframes attackFeedback {
    0% {
        transform: scale(1);
        background: rgba(0, 0, 0, 0.4);
    }
    50% {
        transform: scale(0.95);
        background: rgba(255, 100, 100, 0.6);
    }
    100% {
        transform: scale(1);
        background: rgba(0, 0, 0, 0.4);
    }
}

.mobile-control-btn:active {
    animation: touchPulse 0.2s ease;
}

.attack-area.attacking {
    animation: attackFeedback 0.3s ease;
}

/* Hide controls when not in battle */
.mobile-controls-container.hidden {
    display: none !important;
}

/* Ensure controls don't interfere with game UI */
.mobile-controls-container * {
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Force hardware acceleration for smooth animations */
.mobile-control-btn,
.movement-area,
.attack-area {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-perspective: 1000;
    perspective: 1000;
}

/* Mobile Controls Toggle Button */
.mobile-controls-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(145deg, #2d3436, #636e72);
    color: white;
    font-size: 20px;
    cursor: pointer;
    z-index: 10000;
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.3),
        inset 0 2px 4px rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
    opacity: 0.8;
}

.mobile-controls-toggle:hover {
    opacity: 1;
    transform: scale(1.1);
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.4),
        inset 0 2px 4px rgba(255, 255, 255, 0.1);
}

.mobile-controls-toggle.active {
    background: linear-gradient(145deg, #00b894, #00a085);
    opacity: 1;
    box-shadow: 
        0 4px 15px rgba(0, 184, 148, 0.3),
        inset 0 2px 4px rgba(255, 255, 255, 0.1);
}

.mobile-controls-toggle.active:hover {
    background: linear-gradient(145deg, #55efc4, #00b894);
    transform: scale(1.1);
    box-shadow: 
        0 6px 20px rgba(0, 184, 148, 0.4),
        inset 0 2px 4px rgba(255, 255, 255, 0.1);
}

/* Hide toggle on actual mobile devices, not just small screens */
@media (max-width: 768px) and (pointer: coarse) {
    .mobile-controls-toggle {
        display: none;
    }
}

/* Also hide on touch-only devices */
@media (hover: none) and (pointer: coarse) {
    .mobile-controls-toggle {
        display: none;
    }
}

/* Responsive adjustments for smaller screens */
@media (max-width: 480px) {
    .mobile-controls-toggle {
        bottom: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
}

/* Overlay for blocking background interactions when modals are displayed */
#overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    cursor: pointer;
}

/* Mobile Help Button */
.mobile-help-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(145deg, #2196F3, #1976D2);
    color: white;
    font-size: 24px;
    cursor: pointer;
    z-index: 10000;
    box-shadow: 
        0 4px 15px rgba(33, 150, 243, 0.4),
        inset 0 2px 4px rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
    opacity: 0.9;
}

.mobile-help-button:hover {
    opacity: 1;
    transform: scale(1.1);
    box-shadow: 
        0 6px 20px rgba(33, 150, 243, 0.5),
        inset 0 2px 4px rgba(255, 255, 255, 0.2);
    background: linear-gradient(145deg, #42A5F5, #2196F3);
}

.mobile-help-button:active {
    transform: scale(0.95);
    box-shadow: 
        0 2px 8px rgba(33, 150, 243, 0.6),
        inset 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Responsive adjustments for help button */
@media (max-width: 480px) {
    .mobile-help-button {
        bottom: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
}