/* NPC Notification History Modal Styles */
#npc-history-container {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10002;
    background: rgba(30, 30, 30, 0.98);
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
    width: 340px;
    max-height: 60vh;
    overflow: auto;
    padding: 18px 0 0 0;
}

#npc-history-container .npc-history-item {
    cursor: pointer;
    padding: 8px 0;
    border-bottom: 1px solid #444;
    color: #ccc;
    transition: background 0.15s, color 0.15s;
}

#npc-history-container .npc-history-item.unread {
    color: #fff;
    font-weight: bold;
    background: #2a2a2a;
}

#npc-history-container .npc-history-item:hover {
    background: #3a3a3a;
    color: #fff;
}

#npc-history-container #npc-history-list {
    list-style: none;
    padding: 0 18px 18px 18px;
    margin: 0;
    max-height: 48vh;
    overflow-y: auto;
}

#npc-history-container button,
#npc-notification button,
#npc-history-close-btn {
    background: #222;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 16px;
    margin-left: 8px;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

#npc-history-container button:hover,
#npc-notification button:hover {
    background: #444;
    color: #ffd700;
}

/* Toast/notification styles */
.toast {
    min-width: 180px;
    min-height: 36px;
    margin-bottom: 8px;
    text-align: center;
    pointer-events: none;
    opacity: 0.98;
    font-family: inherit;
}

.toast-info {
    background: #333;
    color: #fff;
}

.toast-error {
    background: #d32f2f;
    color: #fff;
}

.toast-success {
    background: #388e3c;
    color: #fff;
}

.toast-warning {
    background: #fbc02d;
    color: #333;
}

/* === NPC Notification Popup Styles === */
.npc-notification-popup {
    position: fixed;
    bottom: 100px;
    right: 50%;
    transform: translateX(50%);
    z-index: 10001;
    min-width: 220px;
    max-width: 320px;
    background: url('/assets/diplomap.jpg') center/cover no-repeat;
    border: 2px solid #bfa14a;
    border-radius: 22px;
    box-shadow: 0 8px 32px rgba(191, 161, 74, 0.5), 0 2px 8px rgba(0, 0, 0, 0.5);
    padding: 18px 18px 14px 18px;
    font-family: 'Segoe UI', Arial, sans-serif;
    color: #3a2c0f;
    text-align: center;
    animation: npc-ui-pop-in 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    display: none;
}

.npc-notification-message {
    font-size: 1.08em;
    color: #3a2c0f;
    margin-bottom: 16px;
    min-height: 36px;
    line-height: 1.5;
    word-break: break-word;
    min-width: 180px;
}

.npc-history-btn {
    margin-left: 12px;
}

#npc-history-btn,
#event-history-btn {
    font-size: 0.9em !important;
    padding: 6px 12px !important;
}

/* NPC History Container Styles */
.npc-history-container {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10002;
    background: rgba(30, 30, 30, 0.78);
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
    width: 340px;
    max-height: 60vh;
    overflow: auto;
    padding: 18px 0 0 0;
}

.npc-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 18px 8px 18px;
}

.npc-history-title {
    font-weight: bold;
    font-size: 1.1em;
    color: #fff;
}

.npc-history-list {
    list-style: none;
    padding: 0 18px 18px 18px;
    margin: 0;
    max-height: 48vh;
    overflow-y: auto;
}

/* Event History Item Styles */
.event-history-item {
    display: flex;
    align-items: center;
    padding: 10px 8px !important;
}

.event-category-badge {
    display: inline-block;
    padding: 3px 10px;
    margin-right: 10px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: bold;
    text-transform: uppercase;
}

.event-category-badge.category-NEWS {
    background: #4a90e2;
    color: white;
}

.event-category-badge.category-CONFLICT {
    background: #e74c3c;
    color: white;
}

.event-category-badge.category-DISASTER {
    background: #f39c12;
    color: white;
}

.event-category-badge.category-INTERNAL {
    background: #9b59b6;
    color: white;
}

.npc-notification-popup #npc-message {
    font-size: 1.08em;
    color: #3a2c0f;
    margin-bottom: 16px;
    min-height: 36px;
    line-height: 1.5;
    word-break: break-word;
}

.npc-notification-popup #npc-interact-btn,
.npc-notification-popup #npc-close-btn {
    background: linear-gradient(90deg, #f7e7b0 0%, #e6c97a 100%);
    border: none;
    border-radius: 8px;
    padding: 8px 18px;
    margin-right: 8px;
    font-size: 1em;
    color: #3a2c0f;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(191, 161, 74, 0.08);
    transition: background 0.2s, box-shadow 0.2s;
}

.npc-notification-popup #npc-interact-btn:hover,
.npc-notification-popup #npc-close-btn:hover {
    background-image: url('/assets/npc2.png');
    box-shadow: 0 4px 16px rgba(191, 161, 74, 0.18);
}

/* === NPC UI Styles === */
#npc-ui-container {
    position: fixed;
    bottom: 10px;
    right: 50%;
    z-index: 10000;
    max-width: 150px;
    min-width: 100px;
    min-height: 100px;
    font-family: 'Segoe UI', Arial, sans-serif;
    background-image: url('/assets/npc2.png');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    padding: 0 0 0 0;
    transition: box-shadow 0.3s, border 0.3s, background 0.3s;
    animation: npc-ui-pop-in 0.5s cubic-bezier(0.23, 1, 0.32, 1), spin 2s linear infinite;
    overflow: visible;
    cursor: pointer;
}

#npc-ui-container:hover {

    animation: npc-ui-pop-in 0.5s cubic-bezier(0.23, 1, 0.32, 1), spin 1s linear infinite;
}

@keyframes npc-ui-pop-in {
    0% {
        opacity: 0;
        transform: scale(0.85) translateY(40px);
    }

    60% {
        opacity: 1;
        transform: scale(1.05) translateY(-8px);
    }

    80% {
        transform: scale(0.98) translateY(2px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

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

    100% {
        transform: rotate(360deg);
    }
}

html {
    height: 100%;
    overflow: hidden;
    /* CSS Custom Properties for mobile viewport */
    --vh: 1vh;
    --ios-vh: 1vh;
}

body {
    margin: 0;
    padding: 0;
    height: 100dvh; /* Use dynamic viewport height for modern mobile browsers */
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    -webkit-overflow-scrolling: touch;
    /* Prevent iOS Safari bounce */
    overscroll-behavior: none;
}

.mapboxgl-popup {
    width: 200px;
    max-width: 200px !important;
    /* Ensure max-width is applied */
}

.custom-popup {
    border-radius: 20px;
    /* Style the popup itself */
    background-size: cover;
    /* Adjust as needed: cover, contain, etc. */
    background-position: center;
    padding: 10px;
    /* Add padding for the content */
    overflow: hidden;
    /* Add a background image for the custom popup */

    /* Adjust the path and image as needed */
}

.custom-popup .popup-image {
    border-radius: 20px;
    width: 100%;
    height: 100%;
    /* Adjust height as needed */
    background-size: cover;
    background-position: center;
}

.custom-popup .popup-text {
    padding: 5px;
    font-size: 10px;
    /* Other text styles */
}

.mapboxgl-popup-content {
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.5);
    border-radius: 20px;
    height: 200px;
    background-size: cover;
    /* Cover the entire popup */
    background-position: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: black;
    background-image: linear-gradient(rgba(123, 146, 160, 0.4), rgba(199, 191, 119, 0.2)), url('/assets/popup.jpg');
}

.mapboxgl-popup-content h1 {
    margin-bottom: 5px;
    font-size: 12px;
}

.mapboxgl-popup-content p {
    margin: 5px 0;
    font-size: 10px;
}

.mapboxgl-popup-content button {
    margin-top: 5px;
    padding: 5px;
    font-size: 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.mapboxgl-popup-content button.journey-button {
    background-color: #f0932b;
    color: white;
}

.mapboxgl-popup-content button.close-button {
    background-color: #333;
    color: white;
}

#map {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100dvh; /* Match body height for consistency */
}

#infobox {
    position: absolute;
    top: 10%;
    right: 0;
    width: 30%;
    height: 80%;
    border-radius: 20px;
    /* Use a fantasy panel background image from your assets */
    background-image: linear-gradient(rgba(123, 146, 160, 0.4), rgba(199, 191, 119, 0.2)), url('/assets/inventory.jpg');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    border: 1px solid #b08d57;
    /* gold-like border */
    box-shadow: 0 0 24px 6px rgba(0, 0, 0, 0.45), 0 0 0 8px rgba(176, 141, 87, 0.15);
    overflow-y: auto;
    text-align: center;
    /* Slight padding for content */
}

/* Add more styles here as needed */
#infobox h3 {
    color: goldenrod;
    margin-top: 0;
    font-size: 1.3em;
    box-shadow: inset 0 0 10px black;
    /* Remove top margin from infobox headings */
}


#infobox li {
    margin-bottom: 5px;
}

/* Floating container for login and save progress buttons at top right over the map */
#login-save-btns-container {
    position: absolute;
    top: 10px;
    right: 48px;
    display: flex;
    flex-direction: row;
    gap: 8px;
    z-index: 1000;
    pointer-events: none;
    /* allow map interaction except on buttons */
}

#login-save-btns-container button {
    width: 45px;
    height: 30px;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 7px;
    margin: 0;
    box-sizing: border-box;
    text-align: center;
    display: block;
    background-color: #00a2ff;
    color: white;
    border: none;
    cursor: pointer;
    transition: background 0.18s;
    pointer-events: auto;
    /* allow click */
}

#login-save-btns-container button:hover {
    background-color: #0056b3;
}

#login-save-btns-container button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

/* Remove old infobox button styles for login/save */
#showLogin,
#saveProgress {
    position: static;
    margin: 0;
    min-width: 50px;
    height: 30px;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 7px;
    box-sizing: border-box;
    text-align: center;
    display: block;
    background-color: #00a2ff;
    color: white;
    border: none;
    cursor: pointer;
    transition: background 0.18s;
}

#showLogin:hover,
#saveProgress:hover {
    background-color: #0056b3;
}

#showLogin:disabled,
#saveProgress:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.story-window {

    width: 90%;
    /* Increase width */
    height: 90%;
    /*Adjust height to maintain 3:4 aspect ratio */
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.8);
    /* Add a semi-transparent background */
    border-radius: 15px;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    /* Ensure it's on top of other elements */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px;
}

@media (max-width: 900px) {
    .story-window {
        width: 100%;
        /* Adjust width for smaller screens */
        height: 100%;
        /* Maintain 3:4 ratio */
    }
}

.story-content {
    width: 100%;
    /* Match the width of the story-window */
    height: 100%;
    /* Match the height of the story-window */
    overflow: auto;
    /* Enable scrolling if content overflows */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.story-content h2 {
    font-size: 10px;
    /* Minimized font size */
    margin: 5px 0;
    /* Adjusted margin */
}

.close-story {
    background-color: #f44336;
    color: #fff;
    border: none;
    border-radius: 7px;
    font-size: 15px;
    font-weight: bold;
    padding: 8px 18px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: background 0.2s;
    position: absolute;
    top: 10px;
    right: 18px;
    z-index: 10;
    margin-top: 0;
}

.close-story:hover {
    background-color: #d32f2f;
}

.process-window {
    position: fixed;
    /* Stay in place on the page */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* Center the window */
    background-color: rgb(114, 75, 75);
    /*background-color: #7c1111; */
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    /* Ensure it's on top of other elements */
    max-width: 80%;
    /* Or a fixed width */

    /* Add other styles (width, max-height, etc.) as needed */
}

.process-content {
    max-height: 300px;
    /*set height for content*/
    overflow: auto;
}

/* Old login form CSS removed - replaced by modern auth modal system */

#player-info {
    border: 1px solid #b08d57;
    border-radius: 20px;
    margin: 10px;
    box-shadow: inset 0 0 10px black;
    opacity: 0.8;
    padding: 5px;
    /*background-color: #b08d57;*/
    background-image: linear-gradient(rgba(204, 160, 94, 0.4), rgba(63, 65, 54, 0.37)), url('/assets/jadeb.jpg');
    background-size: cover;
    background-position: center;
    color: #1eeb0c;
    font-size: 1.2em;
    text-align: center;
}

#player-info h4 {
    display: center;
    background-color: rgba(255, 255, 255, 0.6);
    padding: 5px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    margin: 5px;
    color: black;
    font-size: 0.8em;
    text-align: center;

}


#player-info li {
    margin: 5px 0;
    /* Keep spacing between li elements */

}

#player-info button {
    margin: 5px;
    /* Space out buttons*/
    padding: 5px 5px;
    /* Adjust button padding */
    border: none;
    border-radius: 10px;
    /* Green button */
    color: black;
    cursor: pointer;
    font-size: 0.8em;
}

#player-info button:disabled {
    background-color: #cccccc;
    /* light grey for disabled*/
    cursor: not-allowed;

}

#player-info button:hover {
    background-color: #45a049;
}

#player-info .text-box {
    background-color: rgba(255, 255, 255, 0.8);
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    margin-top: 10px;
    color: black;
    font-size: 1em;
    text-align: left;
}

.mini-game-window {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-20%, -50%);
    background-color: white;
    border: 1px solid #ccc;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    /* Ensure it's on top */
}

.mini-game-content {
    text-align: center;
}

.choice-container {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.choice-option {
    margin: 10px;
    cursor: pointer;
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 5px;
}

.choice-option img {
    max-width: 100px;
    max-height: 100px;
    display: block;
    margin: 0 auto 10px;
}

.minigame-window {
    width: 100%;
    /* Fit the width of the story-content */
    height: 100%;
    /* Fit the height of the story-content */
    border: none;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.3);
    /* Add shadow for better visibility */
    border-radius: 10px;
    /* Rounded corners */
    display: block;
}

#minigame-container {
    width: 100%;
    /* Fit the width of the story-content */
    height: 100%;
    /* Fit the height of the story-content */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    /* Ensure content doesn't overflow */
}

@media (max-width: 768px) {
    .minigame-window {
        width: 95%;
        /* Adjust width for smaller screens */
        height: calc(95% * 4 / 3);
        /* Maintain 3:4 ratio */
    }
}

/* Resource container styles */
#resource-container {
    position: absolute;
    height: 30px;
    top: 5px;
    left: 5px;
    display: flex;
    gap: 10px;
    opacity: 0.8;
    padding: 5px;
    border-radius: 15px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.6);
    align-items: center;
    justify-content: center;
    background-image: linear-gradient(rgba(123, 146, 160, 0.4), rgba(199, 191, 119, 0.2)), url('/assets/inventory.jpg');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
}

#resource-container img.w-7.h-7,
#resource-container .resource-icon {
    width: 2rem;
    /* 32px */
    height: 2rem;
    /* 32px */
    min-width: 2rem;
    min-height: 2rem;
    max-width: 2rem;
    max-height: 2rem;
    object-fit: contain;
    display: inline-block;
    vertical-align: middle;
    border-radius: 0.375rem;
    /* rounded */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

#force-type-container {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    padding: 5px;
    background-color: #e9eff9;
    opacity: 0.9;
    border-radius: 15px;
    background-image: linear-gradient(rgba(123, 146, 160, 0.2), rgba(199, 191, 119, 0.4)), url('/assets/inventory.jpg');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.6);
    font-size: 14px;
    color: #333;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 50px;
    /* Adjust as needed to position below the resource-container */
    left: 5px;
    /* Position on the left side of the window */
    /* width: 45%;  Set width to 50% */
    box-sizing: border-box;
}

.force-type {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: bold;
}

.force-icon {
    width: 45px;
    /* Adjust size as needed */
    height: 45px;
    object-fit: contain;
    border-radius: 5px;
    /* Optional: Add rounded corners */
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
    /* Optional: Add shadow */
}

.force-type span {
    font-size: 14px;
    color: #333;
}

#items-container {
    height: 250px;
    position: absolute;
    bottom: 10px;
    left: 10px;
    padding: 5px;
    border-radius: 10px;
    /* box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25); */
    min-width: 240px;
    /* Add background image for item container */
    background-image: url('/assets/itemcontainer.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    /* Animation for item container */
    animation: itemContainerAppear 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    color: gold;
}

@keyframes itemContainerAppear {
    0% {
        opacity: 0;
        transform: scale(0.85) translateY(40px);
    }

    60% {
        opacity: 1;
        transform: scale(1.05) translateY(-8px);
    }

    80% {
        transform: scale(0.98) translateY(2px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}



/* Diplomacy button styles */
#diplomacyButton {
    position: absolute;
    left: 10px;
    top: 40%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    background-color: transparent;
    /* Make the button background transparent */
    border: none;
    cursor: pointer;
    border-radius: 30%;
    /* Make it circular */
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

#diplomacyButton .button-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 30%;
    /* Ensure the icon fits the circular button */
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

/* Remove hover background color */
#diplomacyButton:hover {
    background-color: transparent;
}

/* Army build-up button styles */
#armyBuildUpButton {
    position: absolute;
    left: 10px;
    top: 60%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    background-color: transparent;
    /* Make the button background transparent */
    border: none;
    cursor: pointer;
    border-radius: 30%;
    /* Make it circular */
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

#armyBuildUpButton .button-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 30%;
    /* Ensure the icon fits the circular button */
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

/* Remove hover background color */
#armyBuildUpButton:hover {
    background-color: transparent;
}

/* ============================================
   STORY & TUTORIAL WINDOW
   ============================================ */

#storyTutorialButton {
  position: absolute;
  top: 6px;
  right: calc(48px + 45px + 45px + 30px);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background-color: #b08d57;
  border: 1px solid olive;
  cursor: pointer;
  z-index: 1000;
  transition: all 0.3s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

#storyTutorialButton:hover {
  background-color: rgba(160, 82, 45, 1);
  transform: scale(1.05);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

#storyTutorialButton img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.story-tutorial-window {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 800px;
  max-height: 80vh;
  background-image: url('/assets/inventory.jpg');
  border: 2px solid #161413;
  border-radius: 15px;
  padding: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  z-index: 99999;
  overflow-y: auto;
  font-family: "Times New Roman", Georgia, serif;
}

.story-tutorial-window .tab-container {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  border-bottom: 3px solid #8b4513;
  padding-bottom: 10px;
}

.story-tutorial-window .tab {
  flex: 1;
  padding: 12px 20px;
  background: rgba(139, 69, 19, 0.7);
  color: #f5e6d3;
  border: 2px solid #d4af37;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  text-align: center;
  font-size: 16px;
  font-weight: bold;
  transition: all 0.3s ease;
}

.story-tutorial-window .tab:hover {
  background: rgba(160, 82, 45, 0.9);
  transform: translateY(-2px);
}

.story-tutorial-window .tab.active {
  background: #d4af37;
  color: #3e2723;
  border-bottom: none;
}

.story-tutorial-window .content-container {
  display: flex;
  flex-direction: row;
  gap: 20px;
  margin-bottom: 20px;
}

.story-tutorial-window .image-slider-container {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 15px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.story-tutorial-window .story-tutorial-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.story-tutorial-window .slider-button {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(139, 69, 19, 0.8);
  color: #f5e6d3;
  border: 2px solid #d4af37;
  border-radius: 10%;
  width: 30px;
  height: 40px;
  font-size: 10px;
  cursor: pointer;
  z-index: 10;
  padding: 5px;
  transition: all 0.3s ease;
}

.story-tutorial-window .slider-button:hover {
  background: rgba(160, 82, 45, 1);
  transform: translateY(-50%) scale(1.1);
}

.story-tutorial-window .slider-button.prev {
  left: 0;
}

.story-tutorial-window .slider-button.next {
  right: 0;
}

.story-tutorial-window .description-container {
  background: rgba(255, 255, 255, 0.9);
  padding: 20px;
  border-radius: 15px;
  border: 2px solid #d4af37;
  max-height: 400px;
  overflow-y: auto;
}

.story-tutorial-window .story-tutorial-text {
  color: #3e2723;
  line-height: 1.8;
  font-size: 22px;
}

.story-tutorial-window .story-tutorial-text h3 {
  color: #8b4513;
  font-size: 22px;
  margin-top: 10px;
  margin-bottom: 15px;
  border-bottom: 2px solid #d4af37;
  padding-bottom: 8px;
}

.story-tutorial-window .story-tutorial-text h4 {
  color: #a0522d;
  font-size: 18px;
  margin-top: 20px;
  margin-bottom: 10px;
}

.story-tutorial-window .story-tutorial-text p {
  margin-bottom: 15px;
}

.story-tutorial-window .story-tutorial-text ul {
  margin-left: 20px;
  margin-bottom: 15px;
}

.story-tutorial-window .story-tutorial-text li {
  margin-bottom: 8px;
}

.story-tutorial-window .story-tutorial-text strong {
  color: #8b4513;
  font-weight: bold;
}

.story-tutorial-window .close-button {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  background-color: rgba(139, 69, 19, 0.9);
  color: #f5e6d3;
  border: 2px solid #d4af37;
  border-radius: 50%;
  font-size: 24px;
  line-height: 26px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
  padding: 0;
  margin: 0;
  z-index: 10;
}

.story-tutorial-window .close-button:hover {
  background-color: #a0522d;
  transform: scale(1.1);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .story-tutorial-window {
    width: 95%;
    max-height: 90vh;
    padding: 15px;
  }

  .story-tutorial-window .image-slider-container {
    height: 200px;
  }

  .story-tutorial-window .tab {
    font-size: 14px;
    padding: 10px 12px;
  }

  .story-tutorial-window .story-tutorial-text {
    font-size: 14px;
  }

  .story-tutorial-window .story-tutorial-text h3 {
    font-size: 18px;
  }

  .story-tutorial-window .story-tutorial-text h4 {
    font-size: 16px;
  }
}

/* Army build-up window styles */
#armyBuildUpWindow {
    max-height: 90%;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    border: 1px solid #252424;
    border-radius: 12px;
    box-shadow: 0 0 16px rgba(0, 0, 0, 0.7);
    padding: 10px 10px 10px 18px;
    z-index: 100000;
    display: none;
    background-image: url('/assets/armyhead.png');
    background-size: cover;
    background-position: center;
    background-color: rgba(255, 255, 255, 0.95);
    /* subtle overlay for readability */
    overflow: visible;
    box-shadow: inset 0 0 10px black;
}

#armyBuildUpWindow h3 {
    text-align: center;
    margin-top: 5px;
    color: #e2ded4;
    font-size: 0.8em;
    letter-spacing: 1px;
}

.army-tabs-container {
    display: flex;
    flex-direction: row;
    min-height: 80%;
    margin-bottom: 10px;
}

.army-tabs-list {
    display: flex;
    flex-direction: column;
    width: 18%;
    margin-right: 10px;

    max-height: 260px;
    overflow-y: auto;
    /* Add a subtle scrollbar for better UX */
    scrollbar-width: thin;
    scrollbar-color: #bdbdbd #f1f1f1;
}

.army-tabs-list::-webkit-scrollbar {
    width: 7px;
}

.army-tabs-list::-webkit-scrollbar-thumb {
    background: #bdbdbd;
    border-radius: 4px;
}

.army-tabs-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.army-tab {
    background: #e9eff9;
    color: #222;
    border: none;
    border-radius: 8px 0 0 8px;
    padding: 8px 8px;
    font-size: 0.8em;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s, color 0.2s;
    outline: none;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
}

.army-tab.active,
.army-tab:hover {
    background: #4CAF50;
    color: #fff;
    font-weight: bold;
}

.army-tab-content {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 10px;
    box-shadow: 0 0 8px rgba(121, 115, 115, 0.08);
    padding: 10px 10px;
    max-height: 75vh;
}

.army-image-container {
    width: 50%;
    text-align: center;
    display: flex;
    flex-direction: column;
    /* Stack image and buttons vertically */
    align-items: center;
    justify-content: center;
    /* Center content vertically */
    position: relative;
    height: 100%;
}

.army-image-container img {
    width: 85%;
    max-height: 100%;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.13);
    padding: 4px;
    margin-bottom: 5px;
    display: block;
    margin-left: 5px;
    margin-right: 5px;
}

/* Removed: army-buildup-buttons - close button now uses absolute positioning */

.army-desc-container {
    flex: 1;
    width: 150px;
    height: 100%;
    margin: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#army-force-label {
    font-size: 1em;
    font-weight: bold;
    margin: auto;
    color: #2d2d2d;
}

#army-force-desc {
    font-size: 1em;
    color: #444;
    margin: 6px;
}

#army-force-input {
    width: 50px;
    padding: 6px;
    border: 1px solid #bbb;
    border-radius: 6px;
    font-size: 1em;
    margin-left: 8px;
}

#armyBuildUpWindow label[for="army-force-input"] {
    font-weight: bold;
    margin-right: 4px;
    color: #333;
}

#armyBuildUpWindow button {
    display: cover;
    margin: 8px 8px 0 0;
    padding: 10px 15px;
    font-size: 0.8em;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.09);
    transition: background 0.2s;
}

#armyBuildUpWindow button:hover {
    background-color: #388e3c;
}

#armyBuildUpWindow .close-icon-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    background-color: rgba(244, 67, 54, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    line-height: 28px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    padding: 0;
    z-index: 10;
}

#armyBuildUpWindow .close-icon-btn:hover {
    background-color: #d32f2f;
    transform: scale(1.1);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

/* Responsive for mobile */
@media (max-width: 700px) {
    #armyBuildUpWindow {
        width: 98vw;
        min-width: 0;
        padding: 8px 2vw;
        height: 90%;
    }

    .army-tabs-container {
        flex-direction: column;
        height: auto;
    }

    .army-tabs-list {
        flex-direction: row;
        width: 100%;
        margin-right: 0;
        gap: 4px;
        margin-bottom: 8px;
        max-height: none;
        overflow-y: visible;
        justify-content: flex-start;
    }

    .army-tab {
        border-radius: 8px 8px 0 0;
        padding: 8px 4px;
        font-size: 0.8em;
    }

    .army-tab-content {
        flex-direction: column;
        padding: 8px 2vw;
        min-height: 0;
    }

    .army-image-container {
        margin-bottom: 10px;
    }

    .army-desc-container {
        margin-left: 0;
    }

    #armyBuildUpWindow .close-icon-btn {
        width: 28px;
        height: 28px;
        font-size: 20px;
        line-height: 24px;
        top: 8px;
        right: 8px;
    }

    .army-tabs-list+#applyArmyBuildUp,
    .army-tabs-list+#closeArmyBuildUp {
        margin-top: 8px;
    }
}

/* POI list container styles */
.poi-list-container {
    position: absolute;
    left: 10px;
    top: 70%;
    transform: translateY(-50%);
    width: 200px;
    max-height: 300px;
    background-color: white;
    border: 1px solid #ccc;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    padding: 10px;
    overflow-y: auto;
    z-index: 1000;
}

/* Diplomacy window styles */
#diplomacyWindow {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 80vw;
    max-height: 80vh;
    background-image: linear-gradient(rgba(123, 146, 160, 0.5), rgba(199, 191, 119, 0.5)), url('/assets/diplomap2.png');
    background-size: cover;
    display: flex;
    flex-direction: row;
    font-size: 1em;
    align-content: stretch;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    border: 1px solid #ccc;
    border-radius: 15px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    padding: 20px;
    z-index: 10001;
}

/* Tab styles */
.tab-container {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;

}

.tab {
    padding: 10px 20px;
    cursor: pointer;
    background-image: url('/assets/jadeb.jpg');
    border: 1px solid #ad8619;
    margin-right: 5px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

/* Active tab styles */
.tab.active {
    background-color: #4CAF50;
    color: white;
}

/* Content container styles */
.content-container {
    display: flex;
    margin-top: 12px;
}

/* Description container styles */
.description-container {
    height: 50vh;
    width: 30vw;
    flex: 1 1 220px;
    margin-left: 18px;
    padding-left: 20px;
    padding-right: 10px;
    background-color: rgb(207, 204, 155);
    border-radius: 10px;
    font-size: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    word-wrap: break-word;
}

/* Mobile landscape (horizontal mode) responsive */
@media screen and (max-width: 896px) and (orientation: landscape) {
    .description-container {
        max-height: 50vh;
        font-size: 14px;
        margin-left: 12px;
        padding-left: 15px;
        padding-right: 8px;
    }
}

/* Small mobile landscape */
@media screen and (max-width: 667px) and (orientation: landscape) {
    .description-container {
        max-height: 45vh;
        font-size: 13px;
        margin-left: 10px;
        padding-left: 12px;
        padding-right: 6px;
    }
}

/* Very small mobile landscape */
@media screen and (max-width: 568px) and (orientation: landscape) {
    .description-container {
        max-height: 45vh;
        font-size: 12px;
        margin-left: 8px;
        padding-left: 10px;
        padding-right: 5px;
    }
}

/* Add to your CSS file */
.diplomacy-flex {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
}

.affiliated-clans-container {
    min-width: 100px;
    max-width: 150px;
    margin-right: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.affiliated-clan-tab {
    background: #eee;
    border-radius: 6px;
    padding: 6px 10px;
    margin-bottom: 4px;
    cursor: pointer;
    font-size: 13px;
    text-align: left;
}



/* Custom scrollbar styling for description-container */
.description-container::-webkit-scrollbar {
    width: 8px;
}

.description-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.description-container::-webkit-scrollbar-thumb {
    background: rgba(176, 141, 87, 0.6);
    border-radius: 4px;
}

.description-container::-webkit-scrollbar-thumb:hover {
    background: rgba(176, 141, 87, 0.8);
}

/* Image slider container styles */
.image-slider-container {
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    max-width: 45%;
    height: auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    position: relative;
    overflow: hidden;
    align-content: flex-end;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* Slider button styles */
.slider-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(171, 184, 100, 0.5);
    color: white;
    border: none;
    cursor: pointer;
    padding: 10px;
}

.slider-button.prev {
    left: 0;
}

.slider-button.next {
    right: 0;
}

/* Image styles within image-slider-container */
.image-slider-container img {
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
    border-radius: 15px;
    display: block;
    margin: 0 auto;
    box-shadow: 0 0 24px 6px rgba(0, 0, 0, 0.45), 0 0 0 8px rgba(176, 141, 87, 0.15) inset;
}

#diplomacyWindow .select-button {
    margin-top: 10px;
    padding: 10px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

#diplomacyWindow .select-button:disabled {
    background-color: #d81111;
    /* Light grey for disabled */
    cursor: not-allowed;
}

#diplomacyWindow .close-button {
    margin-top: 10px;
    padding: 10px 20px;
    background-color: #f1f1f1;
    color: black;
    border: 1px solid #ccc;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    margin-left: 10px;
}

#diplomacyWindow .close-icon-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    background-color: rgba(139, 69, 19, 0.9);
    color: #f5e6d3;
    border: 2px solid #d4af37;
    border-radius: 50%;
    font-size: 24px;
    line-height: 26px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    padding: 0;
    margin: 0;
    z-index: 10;
}

#diplomacyWindow .close-icon-btn:hover {
    background-color: #a0522d;
    transform: scale(1.1);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

/* === CLAN RELATIONS DISPLAY === */
.clan-relations-content {
    padding: 16px;
    color: #2c2416;
}

.clan-relations-content h2 {
    margin-top: 0;
    margin-bottom: 16px;
    font-size: 24px;
    text-align: center;
    color: #5a4a2a;
    border-bottom: 2px solid #8b7355;
    padding-bottom: 8px;
}

.clan-relations-content h3 {
    margin-top: 16px;
    margin-bottom: 12px;
    font-size: 18px;
    color: #5a4a2a;
}

.clan-status {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
    text-align: center;
    border: 1px solid #b89968;
}

.clan-status .clan-name {
    font-size: 22px;
    font-weight: bold;
    color: #3d2f1f;
    margin: 8px 0 0 0;
}

.allegiance-section {
    background: rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.allegiance-item {
    margin-bottom: 16px;
}

.allegiance-item:last-child {
    margin-bottom: 0;
}

.allegiance-label {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 16px;
}

.allegiance-icon-symbol {
    font-size: 28px;
    margin-right: 10px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.allegiance-bar-container {
    width: 100%;
    height: 32px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #8b7355;
    position: relative;
}

.allegiance-bar {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width 0.5s ease;
    position: relative;
    min-width: 50px;
}

.allegiance-value {
    color: white;
    font-weight: bold;
    font-size: 14px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
    z-index: 1;
}

.allegiance-info {
    background: rgba(255, 255, 255, 0.6);
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    line-height: 1.6;
    border: 1px solid #b89968;
}

.allegiance-info p {
    margin: 6px 0;
}

.allegiance-info strong {
    color: #5a4a2a;
    font-size: 15px;
}

/* Mobile landscape responsive design */
@media screen and (max-width: 896px) and (orientation: landscape) {
    #diplomacyWindow {
        width: 90vw;
        max-height: 85vh;
        padding: 12px;
    }

    .clan-relations-content h2 {
        font-size: 18px;
        margin-bottom: 10px;
    }

    .clan-relations-content h3 {
        font-size: 15px;
        margin-top: 10px;
        margin-bottom: 8px;
    }

    .clan-status {
        padding: 8px;
        margin-bottom: 10px;
    }

    .clan-status .clan-name {
        font-size: 18px;
    }

    .allegiance-section {
        padding: 10px;
        margin-bottom: 10px;
    }

    .allegiance-label {
        font-size: 14px;
        margin-bottom: 6px;
    }

    .allegiance-icon-symbol {
        font-size: 22px;
        margin-right: 8px;
    }

    .allegiance-bar-container {
        height: 26px;
    }

    .allegiance-value {
        font-size: 12px;
    }

    .allegiance-info {
        padding: 8px;
        font-size: 12px;
    }

    .allegiance-info strong {
        font-size: 13px;
    }

    .tab {
        padding: 8px 12px;
        font-size: 13px;
    }
}

/* Small mobile landscape */
@media screen and (max-width: 667px) and (orientation: landscape) {
    #diplomacyWindow {
        width: 95vw;
        max-height: 88vh;
        padding: 10px;
    }

    .clan-relations-content {
        padding: 10px;
    }

    .clan-relations-content h2 {
        font-size: 16px;
        margin-bottom: 8px;
    }

    .clan-relations-content h3 {
        font-size: 14px;
        margin-top: 8px;
        margin-bottom: 6px;
    }

    .clan-status .clan-name {
        font-size: 16px;
    }

    .allegiance-item {
        margin-bottom: 12px;
    }

    .allegiance-label {
        font-size: 13px;
    }

    .allegiance-icon-symbol {
        font-size: 20px;
        margin-right: 6px;
    }

    .allegiance-bar-container {
        height: 24px;
    }

    .allegiance-value {
        font-size: 11px;
    }

    .allegiance-info {
        font-size: 11px;
    }

    .tab {
        padding: 6px 10px;
        font-size: 12px;
        margin-right: 3px;
    }
}

/* Very small mobile landscape */
@media screen and (max-width: 568px) and (orientation: landscape) {
    #diplomacyWindow {
        width: 98vw;
        max-height: 90vh;
        padding: 8px;
    }

    .clan-relations-content {
        padding: 8px;
    }

    .clan-relations-content h2 {
        font-size: 15px;
        margin-bottom: 6px;
    }

    .clan-relations-content h3 {
        font-size: 13px;
        margin-top: 6px;
        margin-bottom: 4px;
    }

    .clan-status {
        padding: 6px;
        margin-bottom: 8px;
    }

    .clan-status .clan-name {
        font-size: 15px;
    }

    .allegiance-section {
        padding: 8px;
    }

    .allegiance-item {
        margin-bottom: 10px;
    }

    .allegiance-label {
        font-size: 12px;
    }

    .allegiance-icon-symbol {
        font-size: 18px;
        margin-right: 5px;
    }

    .allegiance-bar-container {
        height: 22px;
    }

    .allegiance-value {
        font-size: 10px;
    }

    .allegiance-info {
        padding: 6px;
        font-size: 10px;
    }

    .allegiance-info p {
        margin: 4px 0;
    }

    .tab {
        padding: 5px 8px;
        font-size: 11px;
        margin-right: 2px;
    }

    .tab-container {
        margin-bottom: 6px;
    }
}

/*.poi-list-container {
    flex: 1;
    padding-left: 20px;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid olive;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}
*/
#selected-clan-display {
    padding: 5px;
    background-color: rgba(127, 226, 60, 0.8);
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    margin-left: 10px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;

}

@keyframes markerBounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.marker-animation {
    animation: markerBounce 1.0s ease-in-out;
}

.custom-marker-animation {
    animation: markerBounce 1.0 ease-in-out;
}

#trackLocation {
    display: none;
    /* Hide the custom button as Mapbox's geolocation control is now used */
}

.unit-info {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 10px;
}

.unit-info span {
    font-size: 16px;
    font-weight: bold;
    margin-right: 5px;
}

.unit-info .unit-icon {
    width: 30px;
    height: 30px;
}

.affiliated-clan-window {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border: 2px solid #444;
    border-radius: 10px;
    padding: 24px 32px;
    z-index: 9999;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 260px;
}

.affiliated-clan-img {
    max-width: 220px;
    max-height: 180px;
    margin-bottom: 16px;
    border-radius: 8px;
}

.affiliated-clan-title {
    margin-bottom: 12px;
}

.affiliated-clan-btn-row {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.affiliated-clan-view-btn,
.affiliated-clan-close-btn {
    padding: 6px 16px;
    margin: 0 2px;
    border-radius: 6px;
    border: 1px solid #888;
    background: #f5f5f5;
    cursor: pointer;
    font-size: 15px;
    transition: background 0.2s;
}

.affiliated-clan-view-btn:hover,
.affiliated-clan-close-btn:hover {
    background: #e0e0e0;
}

/* Item images in collectible items and inventory */
#items-container img,
#usable-items img,
#exploration-items img {
    width: 150px;
    height: 100%;
    object-fit: contain;
    display: flex;
    margin: 0 auto;
    border-radius: 10px;
}

#usable-items,
#exploration-items {
    height: 150px;
    /* Set a max height for the list 
    overflow-y: auto;
    /* Enable vertical scrolling */
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 0;
}

/* Inventory slider navigation buttons: position side by side below the slider */
#usable-items .slider-container,
#exploration-items .slider-container {
    position: relative;
    padding-bottom: 0;
    /* Remove space for buttons below */
    padding-top: 15px;
    /* Add space for right button */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    /* Ensure enough height for image and buttons */

    object-fit: contain;
    margin: 0 auto;
    left: 0;
    z-index: 1;
}

#usable-items .slider-button,
#exploration-items .slider-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: #4CAF50;
    color: #fff;
    border-radius: 6px;
    font-size: 18px;
    padding: 6px 6px;
    /*box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);*/
    transition: background 0.2s;
    z-index: 2;
    /* Remove static/inline-block and margin */
}

#usable-items .slider-container .carousel-row .slider-button.prev,
#exploration-items .slider-container .carousel-row .slider-button.prev {
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    position: absolute;
}

#usable-items .slider-container .carousel-row .slider-button.next,
#exploration-items .slider-container .carousel-row .slider-button.next {
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    position: absolute;
}

/* Place prev/next buttons absolutely on left/right of the carousel row */
#items-container .slider-button.prev {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
}

#items-container .slider-button.next {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}

#items-container .carousel-row img {
    width: 120px;
    height: 120px;
    object-fit: contain;
    border-radius: 10px;
    border: none;
    margin: 0 auto;
    display: block;
    z-index: 1;
}

#items-container .slider-button {
    background-color: #4CAF50;
    color: #fff;
    border-radius: 6px;
    font-size: 12px;
    padding: 6px 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin: 2px;
    border: none;
    cursor: pointer;
    z-index: 2;
}

#items-container .slider-button:hover {
    background-color: #388e3c;
}

#items-container .collect-button {
    margin-top: 10px;
    padding: 8px 18px;
    background-color: #f0932b;
    color: #fff;
    border: none;
    border-radius: 7px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10);
    transition: background 0.2s;
    display: flex;
}

#items-container .collect-button:hover:enabled {
    background-color: #b86d1b;
}

#items-container #close-items-container-button {
    margin-top: 8px;
    padding: 7px 7px;
    background-color: #f44336;
    color: #fff;
    border: none;
    border-radius: 7px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10);
    transition: background 0.2s;
}

#items-container #close-items-container-button:hover {
    background-color: #d32f2f;
}

/* Inventory tabs row */
.inventory-tabs-row {
    display: flex;
    flex-direction: row;
    justify-content: center;
    margin-bottom: 8px;
    gap: 0;
}

/* Inventory tab buttons - minimized size */
.inventory-tab {
    padding: 2px 8px;
    border-radius: 6px 6px 0 0;
    border: 1px solid #b08d57;
    background: #f1f1f1;
    cursor: pointer;
    border-bottom: 1px solid #b08d57;
    outline: none;
    margin-right: 0;
    font-size: 10px;
    width: 110px;
    height: 50px;
    transition: background 0.2s, font-weight 0.2s, border-bottom 0.2s;
}

.inventory-tab:last-child {
    margin-right: 5px;
}

/* Active tab */
.inventory-tab.active {
    border-bottom: 2px solid #4CAF50;
    background: #fffde7;
    font-weight: bold;
    z-index: 1;
}

/* Highlight tab if items collected */
.inventory-tab.tab-has-items.usable-tab {
    background: #ffe082;
    font-weight: bold;
}

.inventory-tab.tab-has-items.exploration-tab {
    background: #b3e5fc;
    font-weight: bold;
}

/* Process result window styles */
#process-result-window {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-image: linear-gradient(rgba(123, 146, 160, 0.4), rgba(199, 191, 119, 0.2)), url('/assets/popup.jpg');
    border: 1px solid #d6ce9f;
    padding: 24px;
    z-index: 99999;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    min-width: 220px;
    max-width: 30vw;
    max-height: 80vh;
    display: flex;
    flex-direction: row;
    font-size: 1em;
    align-content: stretch;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

#process-result-window b {
    font-size: 1.1em;
}

#process-result-window button {
    margin-top: 8px;
    margin-left: 0;
    padding: 7px 16px;
    border-radius: 7px;
    border: none;
    background: #4CAF50;
    color: #fff;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.18s;
}

#process-result-window button#close-process-result-btn {
    background: #f44336;
    margin-left: 8px;
}

#process-result-window button:hover {
    background: #388e3c;
}

#process-result-window button#close-process-result-btn:hover {
    background: #d32f2f;
}

#process-result-window img {
    display: block;
    margin: 0 auto;
    max-width: 120px;
    max-height: 120px;
    border-radius: 10px;
}

.item-label {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    width: 100%;
    font-size: 1em;
    margin-top: 10px;
    padding: 0;
    font-family: 'Quintessential', cursive, serif;
    font-weight: bold;
    text-shadow: 1px 2px 6px #000, 0 0 2px #fff;
    color: goldenrod;
}

/* Display item label as a row element, vertically centered */
#usable-items .item-label,
#exploration-items .item-label {
    display: flex;
    align-items: center;
    height: 100%;
    margin: 0;
    position: static;
    width: auto;
    text-align: left;
    font-size: 0.8em;
    color: goldenrod;
    pointer-events: none;
    text-shadow: 1px 2px 6px #000, 0 0 2px #fff;
    /* Optional: background: rgba(0,0,0,0.15); */
}

#population-display {
    order: 1;
}

#food-display {
    order: 2;
}

#copper-display {
    order: 3;
}

#iron-display {
    order: 4;
}

#army-display {
    order: 5;
}

#army-power-display {
    order: 6;
}

#selected-clan-display {
    order: 7;
}



/* Army Build-up Loading Animation */
.loading-circle {
    border-color: #4b5563;
}

.loading-progress {
    transform-origin: center;
    transition: transform 1s linear;
    border-top-color: #3b82f6;
    border-right-color: transparent;
    border-bottom-color: transparent;
    border-left-color: transparent;
}

.loading-countdown {
    color: white;
    font-size: 1.25rem;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Button disabled state */
#applyArmyBuildUp:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Army Training Loading Window */
.army-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.army-loading-window {
    background-image: linear-gradient(rgba(123, 146, 160, 0.4), rgba(199, 191, 119, 0.2)), url('/assets/trainingground.jpg');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 10px;
    padding: 2rem;
    max-width: 320px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.army-loading-title {
    color: white;
    font-size: 1.125rem;
    font-weight: bold;
    margin: 0 0 1.5rem 0;
}

.army-loading-progress-container {
    position: relative;
    width: 96px;
    height: 96px;
    margin: 0 auto 1rem auto;
}

.army-loading-circle {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 4px solid #4a5568;
    border-radius: 50%;
}

.army-loading-progress {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 4px solid transparent;
    border-top-color: #3182ce;
    border-radius: 50%;
    transform-origin: center;
    transition: transform 1s linear;
}

.army-loading-countdown {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 1.25rem;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.army-loading-text {
    color: #a0aec0;
    font-size: 0.875rem;
    margin: 0;
}

/* Army Message Windows */
.army-message-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.army-message-window {
    background: #2d3748;
    color: white;
    border-radius: 8px;
    padding: 24px;
    max-width: 400px;
    margin: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    animation: messageSlideIn 0.3s ease-out;
}

.army-message-title {
    font-size: 1.125rem;
    font-weight: bold;
    margin-bottom: 16px;
    margin-top: 0;
}

.army-message-text {
    margin-bottom: 16px;
    line-height: 1.5;
    color: #e2e8f0;
}

.army-message-button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
}

.army-message-button.bg-blue-600 {
    background-color: #3182ce;
}

.army-message-button.bg-blue-600:hover {
    background-color: #2c5282;
}

.army-message-button.bg-red-600 {
    background-color: #e53e3e;
}

.army-message-button.bg-red-600:hover {
    background-color: #c53030;
}

.army-message-button:hover {
    opacity: 0.9;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ===== NPC "AN" 2-TAB PANEL STYLES (MVP TECH SPEC) ===== */

/* Main NPC Panel Container */
.npc-panel {
    height: 90%;
    position: fixed;
    top: 50%;
    right: 20px;
    max-width: 80%;
    transform: translateY(-50%);
    background: #dfdac2 url('/assets/dongsonboat.png') center/cover no-repeat;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
    z-index: 10002;
    display: flex;
    flex-direction: row;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    animation: panelSlideIn 0.3s ease-out;
}

.npc-panel.hidden {
    display: none !important;
}

@keyframes panelSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50%) translateX(100px);
    }

    to {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }
}

/* NPC Panel Header */
.npc-panel .npc-header {
    padding: 16px;
    border-bottom: 2px solid #e2e8f0;
    background: transparent;
    color: white;
    border-radius: 10px 10px 0 0;
    position: relative;
}

/* Tab Navigation */
.npc-tabs {
    display: flex;
    margin-bottom: 12px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 4px;
}

.tab-button {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.tab-button.active {
    background: rgb(120, 156, 73);
    color: #4a5568;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tab-button:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Close Button */
#npc-panel-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10003;
}

#npc-panel-close:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* Content Area */
.npc-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tab-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tab-content.hidden {
    display: none !important;
}

/* NPC Panel Layout */
.npc-panel-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 60%;
}

.npc-panel-right {
    width: 40%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
}

.npc-character-image {
    height: 100%;
    object-fit: cover;

}

.npc-panel-right h3 {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    color: #cbcfd4;
    font-size: 18px;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
    background: transparent;
    padding: 8px 16px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    max-width: 280px;
    text-align: center;
}

/* ===== CHAT TAB STYLES ===== */
#chat-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
}

#chat-messages {
    flex: 1;
    min-height: 400px;
    margin-bottom: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    background: #f8fafc;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.chat-message {
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    line-height: 1.4;
    word-wrap: break-word;
}

.chat-message.user {
    background: #b2ce8e;
    color: white;
    text-align: right;
    margin-left: 20%;
}

.chat-message.npc {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    margin-right: 20%;
}

.chat-message.error {
    background: #fed7d7;
    color: #c53030;
    border: 1px solid #feb2b2;
}

.chat-message.system {
    background: #edf2f7;
    color: #4a5568;
    font-style: italic;
    text-align: center;
    border: 1px dashed #cbd5e0;
}

.chat-input-area {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

#chat-input {
    flex: 1;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    resize: none;
    outline: none;
    transition: border-color 0.2s ease;
}

#chat-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#chat-send {
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
    z-index: 10003;
}

#chat-send:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

#chat-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===== EXPERIENCE LIST TAB STYLES ===== */
#experience-content {
    padding: 16px;
}

#experience-list {
    display: grid;
    gap: 16px;
    overflow-y: auto;
    padding-right: 4px;
}

.experience-card {
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.experience-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.experience-card.highlighted {
    animation: highlight-pulse 1s ease-in-out 3;
    border: 2px solid #28a745;
}

@keyframes highlight-pulse {
    0%, 100% {
        box-shadow: 0 0 0 rgba(40, 167, 69, 0);
    }
    50% {
        box-shadow: 0 0 20px rgba(40, 167, 69, 0.8);
    }
}

.experience-card img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 12px;
}

.experience-card h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: #2d3748;
    line-height: 1.3;
}

.experience-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.experience-status {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    text-transform: capitalize;
}

.experience-status.booked {
    background: #c6f6d5;
    color: #22543d;
}

.experience-status.info_provided {
    background: #fef5e7;
    color: #744210;
}

.experience-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.experience-tag {
    background: #e1f5fe;
    color: #0277bd;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

/* ===== EXPERIENCE DETAIL MODAL ===== */
.experience-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10003;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    width: 100%;
    animation: modalSlideIn 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e2e8f0;
}

.modal-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: #2d3748;
}

.close-modal {
    background: #ef4444;
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close-modal:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.modal-body img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 20px;
}

.detail-field {
    margin-bottom: 16px;
}

.detail-field label {
    display: inline-block;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 4px;
}

.detail-field ul {
    margin: 8px 0;
    padding-left: 20px;
}

.detail-field ul li {
    margin-bottom: 4px;
    color: #2d3748;
}

.modal-footer {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.cta-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
    flex: 1;
    min-width: 140px;
}

.ask-npc-btn {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.ask-npc-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(72, 187, 120, 0.4);
}

.get-quote-btn {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
}

.get-quote-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(66, 153, 225, 0.4);
}

.partner-link-btn {
    background: linear-gradient(135deg, #a0aec0 0%, #718096 100%);
    color: white;
}

.partner-link-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(160, 174, 192, 0.4);
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #2d3748;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 10004;
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 400px;
    text-align: center;
    font-weight: 500;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.toast-success {
    background: #48bb78;
}

.toast.toast-error {
    background: #f56565;
}

.toast.toast-info {
    background: #4299e1;
}

/* ===== MOBILE RESPONSIVE DESIGN ===== */

/* Mobile Full-Screen Support */
@media only screen and (max-width: 768px) {
    html, body {
        height: 100%;
        height: -webkit-fill-available; /* iOS Safari */
        overflow: hidden;
    }
    
    #map {
        height: 100%;
        height: -webkit-fill-available; /* iOS Safari */
        height: calc(var(--vh, 1vh) * 100);
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    html, body {
        height: -webkit-fill-available;
    }
    
    #map {
        height: -webkit-fill-available;
    }
}

/* Android Chrome specific fixes */
@media screen and (max-width: 768px) {
    body {
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }
}

/* Tablet Styles */
@media (max-width: 768px) {
    .npc-panel {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        transform: none;
        border-radius: 0;
        border: none;
    }

    .npc-panel .npc-header {
        border-radius: 0;
        padding: 20px 16px 16px 16px;
    }

    .tab-button {
        padding: 12px 16px;
        font-size: 16px;
    }

    #chat-messages {
        min-height: 300px;
    }

    .experience-card {
        padding: 12px;
    }

    .experience-card img {
        height: 120px;
    }

    .modal-content {
        margin: 10px;
        padding: 20px;
        max-height: 90vh;
    }

    .modal-body img {
        height: 200px;
    }

    .modal-footer {
        flex-direction: column;
    }

    .cta-btn {
        flex: none;
        width: 100%;
        min-width: auto;
    }
}

/* Mobile Styles */
@media (max-width: 480px) {
    .npc-panel .npc-header {
        padding: 16px 12px 12px 12px;
    }

    .npc-panel .npc-header h3 {
        font-size: 16px;
    }

    .tab-button {
        padding: 10px 12px;
        font-size: 14px;
    }

    #chat-content,
    #experience-content {
        padding: 12px;
    }

    #chat-messages {
        min-height: 250px;
        padding: 8px;
    }

    .chat-message {
        padding: 8px 10px;
        font-size: 14px;
    }

    #chat-input {
        padding: 10px;
        font-size: 16px;
        /* Prevents zoom on iOS */
    }

    #chat-send {
        padding: 10px 16px;
        font-size: 14px;
    }

    #experience-list {
        gap: 12px;
    }

    .experience-card {
        padding: 10px;
    }

    .experience-card img {
        height: 100px;
    }

    .experience-card h4 {
        font-size: 14px;
    }

    .modal-content {
        margin: 5px;
        padding: 16px;
        border-radius: 12px;
    }

    .modal-header h2 {
        font-size: 20px;
    }

    .modal-body img {
        height: 150px;
    }

    .detail-field {
        margin-bottom: 12px;
    }

    .cta-btn {
        padding: 14px 16px;
        font-size: 16px;
        /* Better touch targets */
    }

    .toast {
        margin: 0 10px;
        max-width: calc(100% - 20px);
    }
}

/* Ultra-small screens */
@media (max-width: 320px) {
    .npc-panel .npc-header h3 {
        font-size: 14px;
    }

    .tab-button {
        padding: 8px 8px;
        font-size: 13px;
    }

    #chat-input {
        padding: 8px;
    }

    .experience-card h4 {
        font-size: 13px;
    }

    .modal-header h2 {
        font-size: 18px;
    }
}

/* Landscape Mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .npc-panel .npc-header {
        padding: 12px;
    }

    #chat-messages {
        min-height: 150px;
    }

    .modal-content {
        max-height: 95vh;
        padding: 16px;
    }

    .modal-body img {
        height: 120px;
    }
}

/* High DPI / Retina Displays */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
    .npc-panel {
        border-width: 1px;
    }

    .tab-button.active {
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {

    .npc-panel,
    .modal-content,
    .experience-card,
    .cta-btn,
    .toast {
        animation: none;
        transition: none;
    }

    .experience-card:hover,
    .cta-btn:hover {
        transform: none;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .npc-panel {
        background: #1a202c;
        border-color: #4a5568;
        color: #e2e8f0;
    }

    #chat-messages {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }

    .chat-message.npc {
        background: #4a5568;
        border-color: #718096;
        color: #e2e8f0;
    }

    .experience-card {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }

    .experience-card h4 {
        color: #e2e8f0;
    }

    .modal-content {
        background: #1a202c;
        color: #e2e8f0;
    }

    .modal-header {
        border-color: #4a5568;
    }

    .modal-header h2 {
        color: #e2e8f0;
    }

    .detail-field label {
        color: #a0aec0;
    }

    .modal-footer {
        border-color: #4a5568;
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    .npc-panel .npc-header {
        padding: 12px;
    }

    #chat-messages {
        min-height: 150px;
    }

    .modal-content {
        max-height: 95vh;
        padding: 16px;
    }

    .modal-body img {
        height: 120px;
    }
}

/* High DPI / Retina Displays */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
    .npc-panel {
        border-width: 1px;
    }

    .tab-button.active {
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {

    .npc-panel,
    .modal-content,
    .experience-card,
    .cta-btn,
    .toast {
        animation: none;
        transition: none;
    }

    .experience-card:hover,
    .cta-btn:hover {
        transform: none;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .npc-panel {
        background: #1a202c;
        border-color: #4a5568;
        color: #e2e8f0;
    }

    #chat-messages {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }

    .chat-message.npc {
        background: #4a5568;
        border-color: #718096;
        color: #e2e8f0;
    }

    .experience-card {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }

    .experience-card h4 {
        color: #e2e8f0;
    }

    .modal-content {
        background: #1a202c;
        color: #e2e8f0;
    }

    .modal-header {
        border-color: #4a5568;
    }

    .modal-header h2 {
        color: #e2e8f0;
    }

    .detail-field label {
        color: #a0aec0;
    }

    .modal-footer {
        border-color: #4a5568;
    }
}


/* Experience card styles */
.experience-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    transition: transform 0.2s;
}

.experience-card:hover {
    transform: scale(1.02);
}

.experience-image {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 8px;
}

.experience-title {
    margin: 0 0 5px 0;
    font-size: 14px;
}

.experience-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.status {
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
}

.status-booked {
    background: #c8e6c9;
}

.status-info_provided {
    background: #fff3e0;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
}

.tag {
    background: #e1f5fe;
    padding: 2px 4px;
    border-radius: 2px;
    font-size: 11px;
}

/* Lead form modal styles */
.lead-form-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 10004 !important;
}

.lead-form-content input,
.lead-form-content select,
.lead-form-content textarea {
    box-sizing: border-box;
}

.lead-form-content button:hover {
    opacity: 0.9;
}

/* Login Message Window Styles */
.login-message-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10005;
    animation: fadeIn 0.3s ease-out;
}

.login-message-window {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    color: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    margin: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    text-align: center;
    animation: messageSlideIn 0.3s ease-out;
}

.login-message-title {
    font-size: 1.25rem;
    font-weight: bold;
    margin-bottom: 16px;
    margin-top: 0;
    color: #ffd700;
}

.login-message-text {
    margin-bottom: 20px;
    line-height: 1.5;
    color: #e2e8f0;
}

.login-message-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.login-message-button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    min-width: 80px;
}

.login-message-button.primary {
    background: linear-gradient(135deg, #3182ce 0%, #2c5aa0 100%);
}

.login-message-button.primary:hover {
    background: linear-gradient(135deg, #2c5aa0 0%, #2a4d8d 100%);
    transform: translateY(-1px);
}

.login-message-button.secondary {
    background: #4a5568;
}

.login-message-button.secondary:hover {
    background: #2d3748;
    transform: translateY(-1px);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ===== MASTER CAO LO WINDOW STYLES ===== */
.master-cao-lo-window {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 80%;
    height: 90%;
    background-image: url('/assets/npcbackground.png');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    z-index: 10005;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
     border: 1px solid #2d3748;
     border-radius: 15px;
     box-shadow: #000 0px 4px 20px;
}

.master-cao-lo-content {
    background: transparent;
    border-radius: 12px;
    width: 100%;
    height: 100%;
    display: flex;
    overflow: hidden;
    position: relative;
}

.master-cao-lo-left {
    width: 40%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.master-cao-lo-image {
    height: 100%;
    object-fit: cover;
}

.master-cao-lo-right {
    margin: auto;
    background-image: url('/assets/npcscroll.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    height: 95%;
    width: 60%;
    padding: 5px;
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    align-content: stretch;
    justify-content: center;
    align-items: stretch;
}

.master-cao-lo-left h3 {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    color: #3a2c0f;
    font-size: 24px;
    font-weight: 600;
    text-align: center;
    padding: 8px 16px;
    border-radius: 8px;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.master-cao-lo-message {
    height: 65%;
    width: 65%;
    margin: 16%;
    font-size: 1.25rem;
    line-height: 1.6;
    color: #fff;
    overflow-y: auto;
    padding: 12px;
    border-radius: 8px;
    /* Hide scrollbar for all browsers */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* Internet Explorer and Edge */
}

.master-cao-lo-message::-webkit-scrollbar {
    display: none; /* Chrome, Safari, and Opera */
}

#master-cao-lo-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10006;
}

#master-cao-lo-close:hover {
    background: #dc2626;
    transform: scale(1.1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Mobile responsiveness for Master Cao Lo window */
@media (max-width: 768px) {
    .master-cao-lo-content {
        width: 95%;
        height: 80%;
        flex-direction: column;
    }

    .master-cao-lo-left {
        width: 100%;
        height: 40%;
    }

    .master-cao-lo-right {
        width: 100%;
        height: 60%;
        padding: 16px;
    }

    .master-cao-lo-right h3 {
        font-size: 20px;
        margin-bottom: 12px;
    }
}

/* ===== LANDSCAPE ORIENTATION ENFORCEMENT ===== */

/* Portrait orientation rotation prompt */
.rotate-prompt {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-family: 'Segoe UI', Arial, sans-serif;
}

.rotate-prompt.hidden {
    display: none;
}

.rotate-content {
    text-align: center;
    padding: 40px;
}

.phone-icon {
    font-size: 80px;
    margin-bottom: 20px;
    animation: rotate-hint 2s ease-in-out infinite;
}

@keyframes rotate-hint {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(90deg); }
}

.rotate-content p {
    font-size: 24px;
    margin: 10px 0;
    font-weight: bold;
}

.rotate-content .subtext {
    font-size: 16px;
    color: #ccc;
    font-weight: normal;
}

/* Auto-hide prompt in landscape */
@media (orientation: landscape) {
    .rotate-prompt {
        display: none !important;
    }
}

/* Optional: Force rotation if user ignores prompt (commented out by default) */
/*
@media (orientation: portrait) {
    html.force-rotate {
        transform: rotate(-90deg);
        transform-origin: left top;
        width: 100vh;
        height: 100vw;
        overflow-x: hidden;
        position: absolute;
        top: 100%;
        left: 0;
    }
    
    html.force-rotate body {
        width: 100vh;
        height: 100vw;
    }
}
*/

/* ===== MODERN AUTHENTICATION MODAL ===== */
.auth-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 100005;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    animation: authModalFadeIn 0.3s ease-out;
}

@keyframes authModalFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
        -webkit-backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }
}

.auth-modal-content {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 20px;
    padding: 0;
    max-width: 440px;
    width: 100%;
    max-height: 95vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25), 0 10px 30px rgba(0, 0, 0, 0.1);
    animation: authModalSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    margin: auto;
}

@keyframes authModalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(30px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.auth-modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 32px 32px 24px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.auth-modal-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="20" cy="20" r="2" fill="rgba(255,255,255,0.1)"/><circle cx="80" cy="30" r="1.5" fill="rgba(255,255,255,0.15)"/><circle cx="50" cy="60" r="1" fill="rgba(255,255,255,0.2)"/><circle cx="90" cy="70" r="1.5" fill="rgba(255,255,255,0.1)"/></svg>') repeat;
    opacity: 0.3;
}

.auth-title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1;
}

.auth-close-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
    z-index: 1;
}

.auth-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.auth-form-container {
    padding: 32px;
}

.auth-tabs {
    display: flex;
    margin-bottom: 32px;
    background: #f1f5f9;
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
}

.auth-tab {
    flex: 1;
    background: transparent;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #64748b;
}

.auth-tab.active {
    background: white;
    color: #334155;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.auth-tab:hover:not(.active) {
    background: rgba(255, 255, 255, 0.5);
    color: #475569;
}

.auth-input-group {
    margin-bottom: 20px;
}

.auth-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

.auth-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.2s ease;
    background: white;
    box-sizing: border-box;
    font-family: inherit;
}

.auth-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.auth-input.error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.auth-password-container {
    position: relative;
}

.auth-password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.2s ease;
}

.auth-password-toggle:hover {
    color: #374151;
}

.eye-icon {
    width: 20px;
    height: 20px;
}

.auth-error {
    display: block;
    color: #ef4444;
    font-size: 13px;
    margin-top: 6px;
    font-weight: 500;
    min-height: 16px;
}

.auth-password-strength {
    margin-top: 8px;
}

.strength-bar {
    width: 100%;
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
}

.strength-fill {
    height: 100%;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.strength-text {
    font-size: 12px;
    margin-top: 4px;
    font-weight: 500;
}

.auth-button-group {
    margin: 32px 0 24px 0;
}

.auth-btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.auth-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.auth-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.auth-btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.auth-btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.auth-btn.loading {
    pointer-events: none;
}

.auth-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: authSpin 1s linear infinite;
}

@keyframes authSpin {
    to {
        transform: rotate(360deg);
    }
}

.auth-divider {
    text-align: center;
    margin: 24px 0;
    position: relative;
    color: #6b7280;
    font-size: 14px;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e5e7eb;
    z-index: 1;
}

.auth-divider span {
    background: #f8fafc;
    padding: 0 16px;
    position: relative;
    z-index: 2;
}

.auth-switch {
    text-align: center;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.5;
}

/* Success notification animation */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Mobile optimizations */
@media (max-width: 480px) {
    .auth-modal-overlay {
        padding: 10px;
        align-items: flex-start;
    }
    
    .auth-modal-content {
        margin: 20px 0;
        max-width: none;
        border-radius: 16px;
        max-height: 90vh;
        width: calc(100vw - 20px);
    }
    
    .auth-modal-header {
        padding: 24px 20px 20px 20px;
    }
    
    .auth-title {
        font-size: 20px;
    }
    
    .auth-form-container {
        padding: 24px 20px;
    }
    
    .auth-input {
        padding: 12px 14px;
        font-size: 16px; /* Prevent zoom on iOS */
        border-width: 1px;
    }
    
    .auth-btn {
        padding: 14px;
        font-size: 16px;
        min-height: 48px; /* Touch target size */
    }
    
    .auth-close-btn {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .auth-modal-content {
        background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .auth-tabs {
        background: #374151;
    }
    
    .auth-tab {
        color: #9ca3af;
    }
    
    .auth-tab.active {
        background: #4b5563;
        color: #f3f4f6;
    }
    
    .auth-label {
        color: #f3f4f6;
    }
    
    .auth-input {
        background: #374151;
        border-color: #4b5563;
        color: #f3f4f6;
    }
    
    .auth-input:focus {
        border-color: #667eea;
    }
    
    .auth-divider span {
        background: #1f2937;
    }
    
    .auth-switch {
        color: #9ca3af;
    }
}

