:root {
    --bg-color: #050505;
    --grid-bg: #111;
    --text-color: #ddd;
    --accent-color: #a00;
    --sanity-color: #0ab;
    --font-head: 'Creepster', cursive;
    --font-mono: 'Roboto Mono', monospace;
}

* {
    box-sizing: border-box;
    user-select: none;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-mono);
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* --- CRT & Atmos Effects --- */
#scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(to bottom,
            rgba(255, 255, 255, 0),
            rgba(255, 255, 255, 0) 50%,
            rgba(0, 0, 0, 0.2) 50%,
            rgba(0, 0, 0, 0.2));
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 100;
    opacity: 0.6;
}

#vignette {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle, transparent 40%, black 90%);
    pointer-events: none;
    z-index: 99;
}

/* --- Layout --- */
#game-container {
    width: 900px;
    height: 700px;
    border: 2px solid #333;
    background-color: #000;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
}

header {
    padding: 10px 20px;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #0a0a0a;
}

header h1 {
    font-family: var(--font-head);
    margin: 0;
    color: var(--accent-color);
    font-size: 1.8rem;
    text-shadow: 2px 2px 0px #000;
}

#status-bar {
    display: flex;
    gap: 20px;
    font-weight: bold;
}

#player-hp {
    color: var(--accent-color);
}

#player-sanity {
    color: var(--sanity-color);
}

#main-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#game-grid {
    flex: 2;
    background-color: var(--grid-bg);
    display: grid;
    /* Grid layout will be set by JS usually, but default here */
    grid-template-columns: repeat(20, 1fr);
    grid-template-rows: repeat(15, 1fr);
    padding: 20px;
    gap: 1px;
    justify-content: center;
    align-content: center;
    position: relative;
}

.cell {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    /* transition: all 0.1s; */
    /* Too slow for roguelikes? */
}

/* Entity Styles */

/* --- Biome Styles --- */
/* Standard (Varanasi) */
.tile-wall {
    color: #555;
    background: #222;
}

.tile-floor {
    color: #333;
}

/* Astral */
.tile-wall-astral {
    color: #88c;
    background: #112;
}

.tile-floor-astral {
    color: #446;
}

/* Hell */
.tile-wall-hell {
    color: #600;
    background: #200;
}

.tile-floor-hell {
    color: #400;
}

/* Cosmic */
.tile-wall-cosmic {
    color: #d0f;
    background: #203;
}

.tile-floor-cosmic {
    color: #909;
}

/* Memory/Fog */
.tile-fog {
    background: #000;
    color: transparent;
}

.tile-memory {
    opacity: 0.3;
    filter: grayscale(100%);
}

#log-panel {
    height: 150px;
    border-top: 1px solid #333;
    background: #080808;
    padding: 10px;
    overflow-y: auto;
    font-size: 0.9rem;
    color: #888;
}

#game-log {
    list-style: none;
    padding: 0;
    margin: 0;
}

#game-log li {
    margin-bottom: 5px;
}

.story-msg {
    color: #ccc;
    font-style: italic;
}

.combat-msg {
    color: #d00;
}

.system-msg {
    color: #00d;
}

footer {
    padding: 5px 20px;
    background: #0a0a0a;
    border-top: 1px solid #333;
    text-align: center;
    font-size: 0.8rem;
    color: #555;
}

/* --- Overlays --- */
.overlay {
    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: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s;
}

.overlay.active {
    opacity: 1;
    pointer-events: all;
}

.overlay .content {
    text-align: center;
    max-width: 600px;
    padding: 40px;
    border: 1px solid #444;
    background: #111;
    box-shadow: 0 0 30px #a002;
}

button {
    background: #300;
    color: #fff;
    border: 1px solid #600;
    padding: 15px 30px;
    font-family: var(--font-mono);
    font-size: 1.2rem;
    cursor: pointer;
    margin-top: 20px;
    transition: background 0.2s;
}

button:hover {
    background: #500;
}

.hidden {
    display: none;
}