/* --- Global Styles --- */
html, body {
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #050608 url("/images/bg_generic.png") no-repeat center center fixed;
    background-size: cover;
    color: #e5e5e5;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

/* Center content vertically if needed (default behavior for Landing) */
body {
    justify-content: center; /* For landing page vertical centering */
}

.container {
    background: rgba(5, 6, 8, 0.9);
    padding: 40px;
    border-radius: 12px;
    border: 1px solid #222;
    box-shadow: 0 20px 40px rgba(0,0,0,0.6);
    text-align: center;
    max-width: 800px;
    width: 90%;
    margin: 40px 16px;
}

h1 { font-size: 2rem; margin: 0 0 1rem 0; color: #fff; }
h2 { color: #a0a0a0; border-bottom: 1px solid #333; padding-bottom: 10px; margin-top: 30px; font-size: 1.5rem; }
p { color: #a0a0a0; font-size: 1.1rem; line-height: 1.6; margin-bottom: 2rem; }

/* Styled Game Title Link */
.game-title-link {
    color: #e5e5e5;
    text-decoration: none;
    transition: color 0.3s ease, text-shadow 0.3s ease;
}
.game-title-link:hover {
    color: #fff;
    text-shadow: 0 0 10px rgba(192, 132, 252, 0.6); /* subtle purple glow matching theme */
}

/* --- Navigation & Links --- */
.back-link { display: inline-block; margin-bottom: 20px; color: #aaa; text-decoration: none; font-size: 0.95rem;}
.back-link:hover { color: #fff; }

.view-btn, .btn {
    display: inline-block;
    color: #818cf8;
    text-decoration: none;
    font-weight: 600;
}
.view-btn { margin-top: 6px; font-size: 0.9rem; }
.view-btn:hover { text-decoration: underline; color: #a5b4fc; }

/* Landing Page Buttons */
.btn {
    background: #4f46e5;
    color: white;
    padding: 12px 30px;
    font-size: 1.1rem;
    border-radius: 6px;
    transition: background 0.2s;
}
.btn:hover { background: #4338ca; color: white; text-decoration: none; }

/* --- History Lists --- */
ul { list-style: none; padding: 0; text-align: left; }
li { background: rgba(255,255,255,0.05); margin-bottom: 10px; padding: 15px; border-radius: 6px; border: 1px solid #333; transition: background 0.2s; }
li:hover { background: rgba(255,255,255,0.08); }
.empty-msg { color: #666; font-style: italic; margin-top: 10px; }

/* --- Meta Data --- */
.meta { color: #888; font-size: 0.85rem; margin-bottom: 4px; display: flex; justify-content: space-between;}
.meta-header { text-align: center; color: #888; margin-bottom: 1.5rem; font-size: 0.9rem; }
.archetype { color: #c084fc; font-weight: bold; }
.premise { color: #ccc; font-style: italic; margin-bottom: 8px; display: block; line-height: 1.4; }

/* --- Log Entries (Shared) --- */
.gm { color: #e5e5e5; background: #1f2933; padding: 15px; border-radius: 6px; margin: 10px 0; line-height: 1.6; border-left: 4px solid #c084fc; }
.player { color: #38bdf8; font-weight: bold; margin: 20px 0 10px 0; padding: 10px; text-align: right; border-right: 4px solid #38bdf8; background: rgba(56, 189, 248, 0.05); border-radius: 6px;}
.status-won { color: #4ade80; }
.status-lost { color: #f87171; }
hr { border: 0; border-top: 1px solid #333; margin: 20px 0; }

/* --- Landing Page Specific --- */
.load-container { margin-top: 2rem; border-top: 1px solid #333; padding-top: 1.5rem; }
.load-form { display: flex; gap: 8px; justify-content: center; align-items: center; }
.load-input { padding: 10px; border-radius: 6px; border: 1px solid #333; background: #111; color: #e5e5e5; font-size: 0.9rem; width: 180px; text-align: center; }
.btn-load { background: #1f2933; color: #e5e5e5; text-decoration: none; padding: 10px 20px; font-size: 0.9rem; font-weight: 600; border-radius: 6px; border: none; cursor: pointer; transition: background 0.2s; }
.btn-load:hover { background: #374151; }

/* --- Footer --- */
.footer { margin-top: 0.1rem; font-size: 0.85rem; color: #6b7280; }
.footer a { color: #818cf8; text-decoration: none; }
.footer a:hover { text-decoration: underline; }


/* =========================================
   GAME MODE SPECIFIC STYLES
   ========================================= */

/* Fix height and prevent scrolling for the game interface */
html.game-mode, body.game-mode {
    height: 100%;
    overflow: hidden;
}

.container.game-mode {
    height: 100vh;
    max-height: 100vh;
    padding: 16px;
    background: rgba(5, 6, 8, 0.85);
    border-radius: 0;
    border: none;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow: hidden;
    margin: 0; /* Override default margin */
    width: 100%;
    max-width: 800px;
}

@media (min-height: 800px) {
    .container.game-mode {
        height: calc(100vh - 40px);
        border-radius: 12px;
        border: 1px solid #222;
    }
}

/* Game Components */
.subtitle { font-size: 0.9rem; color: #a0a0a0; margin-bottom: 1rem; flex-shrink: 0; }

.log {
    background: #050608;
    border-radius: 8px;
    padding: 12px;
    flex: 1 1 auto;
    height: 0; /* Forces flex calculation */
    overflow-y: auto;
    margin-bottom: 12px;
    border: 1px solid #222;
    text-align: left;
}

.entry { margin-bottom: 0.8rem; white-space: pre-wrap; line-height: 1.4; }
.entry.gm::before { content: "GM: "; font-weight: 600; color: #c084fc; }
.entry.player::before { content: "You: "; font-weight: 600; color: #38bdf8; }

/* Game Input Form */
form#command-form { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px; flex-shrink: 0; }
.textarea-wrapper { position: relative; flex: 1; display: flex; }
textarea {
    width: 100%; min-height: 60px; resize: none;
    background: #050608; color: #e5e5e5;
    border-radius: 6px; border: 1px solid #333;
    padding: 8px; padding-bottom: 24px;
    font-family: inherit;
}

.word-counter { position: absolute; bottom: 6px; right: 10px; font-size: 0.75rem; color: #6b7280; pointer-events: none; user-select: none; transition: color 0.2s; }
.word-counter.limit-reached { color: #ef4444; }

button { padding: 8px 12px; border-radius: 6px; border: none; cursor: pointer; font-weight: 600; }
.btn-primary { background: #4f46e5; color: white; }
.btn-secondary { background: #1f2933; color: #e5e5e5; }

.input-error { margin-top: 4px; font-size: 0.8rem; color: #fca5a5; }

/* Heat Bar */
.heat-container { margin-bottom: 12px; background: rgba(15, 23, 42, 0.4); border: 1px solid #374151; border-radius: 8px; padding: 10px 12px; flex-shrink: 0; }
.heat-header { display: flex; justify-content: space-between; font-size: 0.8rem; font-weight: 600; color: #f87171; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.05em; }
.heat-track { background: #1f2933; height: 6px; border-radius: 3px; overflow: hidden; }
.heat-fill { background: linear-gradient(90deg, #f87171, #ef4444); height: 100%; transition: width 0.3s ease; }

/* Character Stats (Compact) */
.char-info-compact {
    margin-bottom: 12px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(30, 41, 59, 0.3);
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 8px 12px;
}
.archetype-section {
    margin-right: 12px;
}
.archetype-badge {
    display: inline-block;
    background: #312e81;
    color: #c7d2fe;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid #4338ca;
    white-space: nowrap;
}
.stats-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.mini-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 24px;
}
.mini-stat .stat-label {
    font-size: 0.6rem;
    color: #94a3b8;
    text-transform: uppercase;
    margin-bottom: 2px;
}
.mini-stat .stat-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: #f1f5f9;
    line-height: 1;
}

/* Loading Overlay */
.loading-overlay { position: fixed; inset: 0; background: rgba(5, 6, 8, 0.85); display: none; align-items: center; justify-content: center; flex-direction: column; z-index: 999; }
.spinner { width: 40px; height: 40px; border-radius: 999px; border: 3px solid rgba(148, 163, 184, 0.4); border-top-color: #e5e7eb; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { margin-top: 12px; font-size: 0.9rem; color: #cbd5f5; text-shadow: 0 0 8px rgba(59, 130, 246, 0.7); }