/* Reset and Base Styles */
* {
    -moz-user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;
    cursor: default;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    -webkit-focus-ring-color: rgba(0, 0, 0, 0);
    font-family: Arial, sans-serif;
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    overflow: hidden;
    background-color: #008000;
}

/* Main container to hold everything */
.main-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* Top Menu Bar */
.menubar {
    position: relative;
    height: 30px;
    background-color: #f0f0f0;
    border-bottom: 1px solid #a0a0a0;
    z-index: 1000;
    display: flex;
    align-items: stretch;
    flex-shrink: 0;
}

.menu-item {
    padding: 5px 12px;
    color: #000;
    cursor: pointer;
    display: flex;
    align-items: center;
    font-size: 14px;
    position: relative;
}

.menu-item:hover {
    background-color: #c8d5e8;
}

.menu-item.active {
    background-color: #0078d7;
    color: white;
}

/* Dropdown Menus - Absolute positioned relative to menu bar */
.dropdown-menu {
    position: absolute;
    background-color: #f0f0f0;
    border: 1px solid #a0a0a0;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    min-width: 180px;
    display: none;
    z-index: 1001;
    top: 100%;
    left: 0;
}

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

.dropdown-item {
    padding: 6px 20px;
    cursor: pointer;
    color: #000;
    font-size: 13px;
    white-space: nowrap;
}

.dropdown-item:hover:not(.separator) {
    background-color: #c8d5e8;
}

.dropdown-item.separator {
    height: 1px;
    background-color: #a0a0a0;
    margin: 3px 0;
    padding: 0;
    cursor: default;
}

/* Game Content Area */
.game-content {
    position: relative;
    flex: 1 1 auto;
    overflow: hidden;
    width: 100%;
}

.gamelayer {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    background-color: #008000;
}

#gameScreen {
    width: 100%;
    height: 100%;
}

#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    background: transparent;
    z-index: 200;
}

#backPlate {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
}

#bottom-ad { min-height: 0; }
#bottom-ad.ready { min-height: 90px; } /* only once an ad is present */

/* Ad Container - Absolute positioned within game content */
.ad-container {
    position: absolute;
    bottom: 50px;
    right: 10px;
    width: 728px;
    height: 90px;
    z-index: 999;
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
}

/* Status Bar (Bottom) */
.statusbar {
    position: relative;
    height: 40px;
    background-color: #003333;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    flex-shrink: 0;
}

.statusbar-left {
    display: flex;
    gap: 8px;
    align-items: center;
}

.statusbar-right {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-left: auto;
}

.icon-button {
    width: 32px;
    height: 32px;
    background-color: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-button img {
    width: 24px;
    height: 24px;
}

.icon-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.icon-button:active {
    background-color: rgba(255, 255, 255, 0.2);
}

.status-label {
    color: white;
    font-size: 14px;
    font-family: Arial, sans-serif;
    white-space: nowrap;
}

/* Transform Helper */
.transformZero {
    position: absolute;
    -webkit-transform-origin: 0 0;
    -moz-transform-origin: 0 0;
    -ms-transform-origin: 0 0;
    -o-transform-origin: 0 0;
    transform-origin: 0 0;
}

/* Responsive adjustments */
@media screen and (max-width: 800px) {
    .ad-container {
        right: 5px;
        bottom: 45px;
        width: auto;
        max-width: calc(100% - 10px);
        padding: 10px;
    }
    
    .ad-container .adsbygoogle {
        width: 100%;
        max-width: 728px;
    }
}

@media screen and (max-width: 480px) {
    .menubar {
        height: 35px;
    }
    
    .menu-item {
        font-size: 13px;
        padding: 5px 8px;
    }
    
    .statusbar {
        height: 45px;
    }
    
    .status-label {
        font-size: 12px;
    }
}

/* Modal shell - Absolute positioned covering entire viewport */
.doc-modal {
    position: absolute;
    inset: 0;
    display: none;
    z-index: 9999;
}

/* Dimmed backdrop */
.doc-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
}

/* Panel with your requested styling */
.doc-modal__panel {
    position: absolute;
    max-width: 900px;
    width: min(92vw, 900px);
    height: min(85vh, 720px);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 8px;
}

/* Title bar */
.doc-modal__title {
    margin: 0;
    padding: 10px 44px 10px 14px;
    font: 600 16px/1.4 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    color: #333;
    border-bottom: 1px solid #ddd;
    background: #fafafa;
}

/* Close button */
.doc-modal__close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    font-size: 18px;
    line-height: 24px;
    cursor: pointer;
}

/* Iframe fills remaining space */
.doc-modal__iframe {
    border: 0;
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
}

/* Visible state */
.doc-modal.is-open { display: block; }

/* Optional: prevent page scroll when modal is open */
body.modal-open { overflow: hidden; }

/* Ad positioned absolutely within game content */
.adsbygoogle {
    position: absolute !important;
    bottom: 50px !important;
    right: 10px !important;
    width: 728px !important;
    height: 90px !important;
    z-index: 1000 !important;
}

/* Menu link styling - remove underlines and inherit menu item appearance */
.dropdown-item a {
    text-decoration: none;
    color: inherit;
    display: block;
    width: 100%;
    padding: 4px 8px;
    margin: 4px 8px; /* Compensate for parent padding if any */
}

.dropdown-item a:hover {
    text-decoration: none;
    color: inherit;
}

.dropdown-item a:visited {
    color: inherit;
}

.dropdown-item a:focus {
    outline: 2px solid rgba(0, 0, 0, 0.2);
    outline-offset: -2px;
}

/* Remove any default padding from dropdown-item when it contains a link */
.dropdown-item:has(a) {
    padding: 0;
}