* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body, html {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background-color: #0d0d0d;
    color: #fff;
    font-family: monospace;
}

/* Master Layout: Flex Row Container */
#app-container {
    display: flex;
    flex-direction: row;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background-color: #0d0d0d;
}

/* Left Viewport (Fills remaining horizontal space) */
#game-viewport {
    position: relative;
    flex: 1;
    height: 100%;
    min-width: 0;
    overflow: hidden;
    background-color: #0d0d0d;
}

/* Canvas forcibly bound to parent */
#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    background-color: #0d0d0d;
}

/* Right Sidebar Locked to 320px */
#sidebar-container {
    width: 320px;
    height: 100%;
    background-color: #000;
    border-left: 2px solid #333;
    flex-shrink: 0;
    box-sizing: border-box;
}

/* HUD & UI Elements Overlaid on Viewport */
#hud {
    position: absolute;
    top: 10px;
    left: 10px;
    color: #00ff00;
    font-size: 14px;
    background: rgba(0, 0, 0, 0.7);
    padding: 4px 8px;
    border: 1px solid #333;
    pointer-events: none;
    z-index: 10;
}

#game-log {
    position: absolute;
    bottom: 50px;
    left: 10px;
    width: 320px;
    height: 120px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid #333;
    color: #ffb000;
    overflow-y: auto;
    font-size: 11px;
    padding: 6px;
    z-index: 10;
}

#chat-box {
    position: absolute;
    bottom: 10px;
    left: 10px;
    width: 320px;
    z-index: 10;
}

#chat-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid #333;
    color: #fff;
    padding: 4px;
    font-family: monospace;
}

/* Context Menu Master Container */
#context-menu {
    position: fixed;
    background: #16161a;
    border: 2px solid #3a3a48;
    box-shadow: 4px 4px 0px #000;
    z-index: 10000;
    min-width: 120px;
    padding: 4px 0;
    display: flex;
    flex-direction: column;
}

/* Context Menu Buttons */
#context-menu button {
    display: block;
    width: 100%;
    padding: 6px 12px;
    background: none;
    border: none;
    color: #c0c0c0;
    font-family: monospace;
    font-size: 13px;
    font-weight: bold;
    text-align: left;
    cursor: pointer;
    box-sizing: border-box;
}

#context-menu button:hover:not(:disabled) {
    background-color: #2e7d32;
    color: #ffffff;
}

#context-menu button:disabled {
    color: #555555;
    cursor: not-allowed;
}

#context-menu button:disabled:hover {
    background-color: transparent;
}

.hidden {
    display: none !important;
}

/* Retro Webkit Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: #000040;
}
::-webkit-scrollbar-thumb {
    background: #0000aa;
    border: 1px solid #0000ff;
}