/* --- Base Layout --- */
html, body.khx-game-body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #000;
}

#khx-game-wrapper {
    position: relative;
    width: 100vw;
    height: 100vh;
    background-color: #000;
}

#khx-game-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* --- Helpers & Utilities --- */
.khx-hidden {
    display: none !important;
}

/* --- In-Game HUD Overlay --- */
.khx-ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: auto;
    pointer-events: none;
    padding: 20px 24px;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    font-family: 'Courier New', Courier, monospace;
    color: #e0e0e0;
    z-index: 100;
}

.khx-ui-left {
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: none;
}

.khx-ui-info {
    display: flex;
    flex-direction: column;
}

.khx-ui-right {
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: none;
}

/* Forlad Knap i venstre hjørne */
.khx-btn-quit {
    background: rgba(185, 28, 28, 0.85);
    color: #ffffff;
    border: 1px solid #ef4444;
    padding: 7px 14px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 1px;
    border-radius: 4px;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
    transition: background 0.2s ease, transform 0.1s ease;
}

.khx-btn-quit:hover {
    background: rgba(220, 38, 38, 1);
    transform: scale(1.04);
}

.khx-btn-quit:active {
    transform: scale(0.96);
}

.khx-badge {
    background: rgba(255, 0, 0, 0.2);
    border: 1px solid #ff3333;
    color: #ffaaaa;
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 4px;
    text-transform: uppercase;
    width: fit-content;
}

#khx-status-msg {
    font-size: 12px;
    color: #aaa;
    text-shadow: 1px 1px 2px #000;
}

.khx-stat {
    background: rgba(10, 14, 22, 0.85);
    padding: 6px 14px;
    border-radius: 4px;
    border: 1px solid rgba(255, 51, 51, 0.3);
    border-left: 3px solid #ff3333;
    font-size: 14px;
    font-weight: bold;
    color: #f1f5f9;
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.6);
}

/* --- Start Screen / Main Menu Overlay --- */
.khx-menu-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(5, 7, 10, 0.88);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    pointer-events: auto;
    color: #ffffff;
    font-family: 'Courier New', Courier, monospace;
    transition: opacity 0.6s ease, visibility 0.6s;
}

.khx-menu-content {
    text-align: center;
    max-width: 440px;
    width: 90%;
    pointer-events: auto;
}

.khx-title {
    font-size: 3rem;
    letter-spacing: 8px;
    color: #ff3333;
    text-shadow: 0 0 20px rgba(255, 51, 51, 0.7);
    margin: 0;
    font-weight: bold;
}

.khx-subtitle {
    font-size: 1.1rem;
    color: #888;
    margin-top: 6px;
    margin-bottom: 28px;
    letter-spacing: 2px;
}

.khx-menu-box {
    background: rgba(18, 18, 22, 0.9);
    border: 1px solid rgba(255, 51, 51, 0.3);
    padding: 24px;
    border-radius: 6px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.9);
    pointer-events: auto;
}

#khx-device-info {
    font-size: 12px;
    color: #aaa;
    margin-top: 0;
    margin-bottom: 16px;
}

.khx-difficulty-select {
    margin: 18px 0;
    text-align: left;
}

.khx-difficulty-select label {
    display: block;
    font-size: 12px;
    color: #888;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.khx-difficulty-select select {
    width: 100%;
    padding: 10px;
    background: #0a0a0d;
    border: 1px solid #333;
    color: #fff;
    font-family: inherit;
    border-radius: 4px;
    outline: none;
    cursor: pointer;
    pointer-events: auto;
}

.khx-difficulty-select select:focus {
    border-color: #ff3333;
}

.khx-btn-primary {
    width: 100%;
    padding: 14px;
    background: #cc0000;
    border: none;
    color: #fff;
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: bold;
    letter-spacing: 2px;
    cursor: pointer;
    pointer-events: auto;
    border-radius: 4px;
    box-shadow: 0 0 12px rgba(204, 0, 0, 0.4);
    transition: background 0.2s, transform 0.1s;
    margin-top: 10px;
}

.khx-btn-primary:hover {
    background: #ff0000;
    transform: scale(1.02);
}

.khx-btn-primary:disabled {
    background: #551111;
    cursor: not-allowed;
    transform: none;
    opacity: 0.7;
}

.khx-instructions {
    margin-top: 24px;
    font-size: 12px;
    color: #666;
    line-height: 1.5;
}