:root {
    --primary-bg: #1a1a1a;
    --secondary-bg: #2b2b2b;
    --text-color: #e0e0e0;
    --accent-color: #a06d3b;
    --border-color: #444;
    --success-color: #4caf50;
    --failure-color: #f44336;
    --font-family: 'Georgia', serif;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: var(--primary-bg);
    color: var(--text-color);
    font-family: var(--font-family);
    font-size: 16px;
    overflow: hidden;
}

body {
    background-image: url('background.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

#app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.7); /* Dark overlay */
    box-sizing: border-box;
}

#status-bar {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    padding: 10px 20px;
    background-color: rgba(0, 0, 0, 0.5);
    border-bottom: 1px solid var(--border-color);
    font-weight: bold;
    flex-shrink: 0;
}

#story-log {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.story-entry {
    margin-bottom: 15px;
    padding: 15px;
    background-color: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeIn 0.5s forwards;
    max-width: 800px;
}

.story-entry.player {
    align-self: flex-end;
    background-color: #303a4b;
}

@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.story-entry .meta {
    font-size: 0.8em;
    color: #aaa;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 5px;
}

.story-entry .roll-success { color: var(--success-color); }
.story-entry .roll-failure { color: var(--failure-color); }
.story-entry p { margin: 0; }

#input-area {
    padding: 15px;
    background-color: rgba(0, 0, 0, 0.5);
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

#action-form {
    display: flex;
    max-width: 840px;
    margin: 0 auto;
}

#action-input {
    flex-grow: 1;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 5px 0 0 5px;
    background-color: var(--secondary-bg);
    color: var(--text-color);
    font-family: var(--font-family);
    font-size: 1em;
}

#action-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

#submit-button {
    padding: 12px 20px;
    border: 1px solid var(--accent-color);
    background-color: var(--accent-color);
    color: white;
    cursor: pointer;
    border-radius: 0 5px 5px 0;
    font-family: var(--font-family);
    font-size: 1em;
    transition: background-color 0.2s;
}

#submit-button:hover {
    background-color: #b88b5f;
}

#submit-button:disabled {
    background-color: #555;
    border-color: #555;
    cursor: not-allowed;
}

#loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

#loader.hidden {
    display: none;
}

.spinner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--accent-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

.game-over-message {
    text-align: center;
    font-size: 1.5em;
    font-weight: bold;
}
.game-over-message.win {
    color: var(--success-color);
}
.game-over-message.loss {
    color: var(--failure-color);
}

