:root {
    --bg-color: #0b0d14;
    --text-color: #a0a8b6;
    --highlight-color: #00ff9d;
    --food-color: #ff0055;
    --hud-bg: rgba(20, 23, 35, 0.85);
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    font-family: 'Courier New', Courier, monospace;
    overflow: hidden;
    color: var(--text-color);
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.hud {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 250px;
    background: var(--hud-bg);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #333;
    backdrop-filter: blur(5px);
    pointer-events: none; /* Allows clicks to pass through to canvas */
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    z-index: 10;
}

.info-section {
    font-size: 0.75rem;
    line-height: 1.4;
    color: #888;
    margin-bottom: 15px;
    font-style: italic;
}

.legend {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #333;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: 0.8rem;
    color: #aaa;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 10px;
    display: inline-block;
}

.dot.herbivore-border { background-color: transparent; border: 2px solid #00ff9d; box-shadow: 0 0 5px #00ff9d; }
.dot.carnivore-border { background-color: transparent; border: 2px solid #ff4d4d; box-shadow: 0 0 5px #ff4d4d; }
.dot.food { background-color: #ffe100; box-shadow: 0 0 5px #ffe100; }

.box.oasis {
    width: 10px;
    height: 10px;
    background-color: rgba(0, 255, 100, 0.2);
    border: 1px solid rgba(0, 255, 100, 0.4);
    margin-right: 10px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}

.title-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

h1 {
    margin: 0;
    font-size: 1.2rem;
    letter-spacing: 2px;
}

.highlight {
    color: var(--highlight-color);
}


.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #ff3333;
    box-shadow: 0 0 5px #ff3333;
    transition: background-color 0.3s;
}

.status-indicator.connected {
    background-color: var(--highlight-color);
    box-shadow: 0 0 5px var(--highlight-color);
}


.stats-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

.value {
    color: #fff;
    font-weight: bold;
}

.github-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #888;
    text-decoration: none;
    font-size: 0.8rem;
    transition: color 0.2s;
    pointer-events: auto;
}

.github-link:hover {
    color: var(--highlight-color);
}

.github-link svg {
    fill: currentColor;
}

/* Mobile Adaptation */
@media (max-width: 768px) {
    .hud {
        top: auto;
        bottom: 0;
        left: 0;
        width: 100%;
        height: auto;
        border-radius: 0;
        border: none;
        border-top: 1px solid #333;
        padding: 10px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        gap: 5px;
    }

    .header {
        margin-bottom: 5px;
        padding-bottom: 5px;
    }
    
    h1 {
        font-size: 1rem;
    }

    .title-group {
        gap: 10px;
    }

    /* Hide verbose description on mobile */
    .info-section {
        display: none;
    }

    /* Make stats horizontal */
    .stats-panel {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 10px;
    }

    .stat-row {
        gap: 5px;
        font-size: 0.8rem;
    }

    /* Make legend horizontal and compact */
    .legend {
        margin-top: 5px;
        padding-top: 5px;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }
    
    .legend-item {
        font-size: 0.75rem;
    }
    
    /* Adjust canvas padding/margins if needed via JS renderer, 
       but CSS-wise just ensure canvas takes full height minus HUD?
       Actually, keep canvas full screen behind HUD is fine if HUD is translucent. 
    */
}