:root {
    --bg-dark: #05070a;
    --panel-bg: rgba(15, 23, 42, 0.8);
    --border-color: rgba(56, 189, 248, 0.2);
    --text-primary: #f1f5f9;
    --text-muted: #64748b;
    --accent: #38bdf8;
    --accent-glow: rgba(56, 189, 248, 0.4);
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    overflow: hidden;
    height: 100vh;
}

/* CRT Effects */
.crt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 100%),
                rgba(18, 16, 16, 0.1);
    pointer-events: none;
    z-index: 1000;
}

.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, transparent 50%, rgba(0, 0, 0, 0.1) 51%);
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 1001;
    animation: scanline 20s linear infinite;
}

@keyframes scanline {
    from { background-position: 0 0; }
    to { background-position: 0 100%; }
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 1.5rem;
    position: relative;
    z-index: 10;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.logo {
    font-family: 'Fira Code', monospace;
    font-weight: 700;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    letter-spacing: 0.05em;
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 0.4; }
    50% { opacity: 1; }
    100% { opacity: 0.4; }
}

.header-meta {
    font-family: 'Fira Code', monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
}

main {
    display: grid;
    grid-template-columns: 280px 1fr 280px;
    gap: 1.5rem;
    flex-grow: 1;
    min-height: 0;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-height: 0;
}

.panel {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.panel h3 {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-muted);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Stats */
.stat-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
}

.stat-item.snake-row {
    padding: 0.5rem;
    border-radius: 0.25rem;
    background: rgba(255, 255, 255, 0.03);
}

.label { color: var(--text-muted); }
.value { font-family: 'Fira Code', monospace; font-weight: 700; }

/* Arena */
.arena-container {
    position: relative;
    background: #000;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: inset 0 0 50px rgba(56, 189, 248, 0.05);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

canvas {
    max-width: 100%;
    max-height: 100%;
    image-rendering: pixelated;
}

.arena-overlay {
    position: absolute;
    top: 1rem;
    left: 1rem;
    pointer-events: none;
}

.status-text {
    font-family: 'Fira Code', monospace;
    font-size: 0.75rem;
    color: var(--accent);
    background: rgba(0, 0, 0, 0.6);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

/* Logs */
.log-content {
    flex-grow: 1;
    font-family: 'Fira Code', monospace;
    font-size: 0.7rem;
    color: var(--text-muted);
    overflow-y: auto;
    display: flex;
    flex-direction: column-reverse;
    gap: 0.25rem;
}

.log-entry {
    padding: 0.125rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.log-entry .time { color: var(--accent); margin-right: 0.5rem; }

/* UI Elements */
.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem;
    border-radius: 0.25rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 1rem;
    width: 100%;
}

.btn-secondary:hover {
    background: var(--accent);
    color: var(--bg-dark);
}

.btn-back {
    display: block;
    text-align: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.75rem;
    margin-top: 1rem;
}

.btn-back:hover { color: var(--accent); }

@media (max-width: 1024px) {
    main {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }
    .sidebar { display: none; }
    .arena-container { aspect-ratio: 1; }
}
