:root {
    --bg-color: #0d0d0d;
    --text-color: #e0e0e0;
    --accent-color: #00ff41;
    --danger-color: #ff3333;
    --dim-color: #666;
    --font-mono: 'Consolas', 'Courier New', monospace;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-mono);
    margin: 0;
    padding: 20px;
    height: 100vh;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-container {
    width: 800px;
    height: 600px;
    border: 2px solid var(--accent-color);
    padding: 20px;
    display: flex;
    flex-direction: column;
    position: relative;
    background: #111;
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.1);
}

header {
    border-bottom: 1px solid var(--dim-color);
    padding-bottom: 10px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h1 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--accent-color);
    text-shadow: 0 0 5px var(--accent-color);
}

#status-bar span {
    margin-left: 20px;
    font-weight: bold;
}

#main-display {
    flex-grow: 1;
    overflow-y: auto;
    border: 1px solid var(--dim-color);
    padding: 10px;
    margin-bottom: 20px;
    background: black;
    font-size: 1.1rem;
    line-height: 1.4;
    white-space: pre-wrap;
}

#controls {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    min-height: 100px;
}

button {
    background: transparent;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: 10px;
    font-family: var(--font-mono);
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.2s;
}

button:hover {
    background: var(--accent-color);
    color: black;
}

button:disabled {
    border-color: var(--dim-color);
    color: var(--dim-color);
    cursor: not-allowed;
}

button.danger {
    border-color: var(--danger-color);
    color: var(--danger-color);
}

button.danger:hover {
    background: var(--danger-color);
    color: white;
}

button.info {
    border-color: #00ccff;
    /* Cyan */
    color: #00ccff;
}

button.info:hover {
    background: #00ccff;
    color: black;
}

.item {
    color: gold;
}

.highlight {
    color: #ffff00;
    text-decoration: underline;
}

.dim {
    color: var(--dim-color);
}

.danger {
    color: var(--danger-color);
}

.info {
    color: #00ccff;
}

/* Modals */
.modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #1a1a1a;
    border: 2px solid var(--accent-color);
    padding: 30px;
    width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    text-align: center;
}

ul {
    list-style: none;
    padding: 0;
}

li {
    margin-bottom: 10px;
}

li button {
    width: 100%;
    text-align: left;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #000;
}

::-webkit-scrollbar-thumb {
    background: var(--dim-color);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

/* --- MOBILE RESPONSIVENESS FIXES --- */
@media screen and (max-width: 768px) {
    body {
        padding: 0;
        overflow: hidden;
        /* Prevent body scroll */
    }

    #game-container {
        width: 100vw;
        height: 100dvh;
        /* Dynamic viewport height */
        border: none;
        padding: 10px;
        box-shadow: none;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
        margin-bottom: 5px;
    }

    h1 {
        font-size: 1.2rem;
    }

    #status-bar {
        font-size: 0.8rem;
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
    }

    #status-bar span {
        margin-left: 0;
        margin-right: 10px;
    }

    #main-display {
        font-size: 0.95rem;
        /* Slightly smaller text */
        padding: 8px;
        margin-bottom: 10px;
        flex-grow: 1;
        /* Ensure it takes available space */
    }

    #controls {
        display: grid;
        /* Mobile: 2 columns mostly, maybe 1 for very narrow */
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        max-height: 40vh;
        /* Don't let controls eat entire screen */
        overflow-y: auto;
        padding-bottom: 10px;
        min-height: auto;
        /* Allow shrinking */
    }

    button {
        padding: 12px 5px;
        /* Taller touch targets */
        font-size: 0.85rem;
        white-space: normal;
        /* Allow text wrapping */
        line-height: 1.2;
    }

    /* Make Wait and Map full width to be easier to hit */
    #controls button:last-child {
        grid-column: span 2;
    }

    /* Modal Adjustments */
    .modal-content {
        width: 95%;
        max-height: 90%;
        padding: 15px;
        margin: 0;
    }

    li button {
        padding: 15px;
        /* Larger hit area for contract list */
        font-size: 1rem;
    }
}