*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at top, #111827 0, #020617 55%, #000 100%);
    color: #e5e7eb;
}

.layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    padding: 1rem 1.5rem;
    background: linear-gradient(to right, #020617, #111827);
    border-bottom: 1px solid rgba(148, 163, 184, 0.3);
    box-shadow: 0 10px 40px rgba(15, 23, 42, 0.8);
}

.header h1 {
    margin: 0;
    font-size: 1.4rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.header p {
    margin: 0.3rem 0 0;
    font-size: 0.9rem;
    color: #9ca3af;
}

.main {
    flex: 1;
    display: flex;
    padding: 1.5rem;
    gap: 1.5rem;
    align-items: flex-start;
    padding-right: 22rem; /* Platz für fixe Sidebar rechts */
}

.game-container {
    position: relative;
    flex: 0 0 auto;
}

#gameCanvas {
    display: block;
    border-radius: 12px;
    background: #020617;
    box-shadow:
        0 0 0 2px rgba(15, 23, 42, 0.9),
        0 20px 60px rgba(0, 0, 0, 0.9),
        0 0 40px rgba(34, 197, 94, 0.25);
    image-rendering: pixelated;
}

.hud {
    position: absolute;
    inset: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    font-size: 0.9rem;
    color: #e5e7eb;
    pointer-events: none;
}

.hud div {
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: linear-gradient(to right, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.6));
    border: 1px solid rgba(148, 163, 184, 0.5);
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.7);
}

.sidebar {
    position: fixed;
    top: 5.5rem;          /* unter dem Header */
    right: 1.5rem;
    bottom: 1.5rem;
    width: 22rem;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: rgba(15, 23, 42, 0.9);
    border-radius: 16px;
    border: 1px solid rgba(55, 65, 81, 0.7);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    padding: 1rem;
}

.sidebar h2 {
    margin: 0 0 0.6rem;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #e5e7eb;
}

.event-log {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    border-radius: 10px;
    background: radial-gradient(circle at top left, #0f172a, #020617);
    border: 1px solid rgba(31, 41, 55, 0.9);
    font-size: 0.85rem;
}

.event-entry {
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    margin-bottom: 0.3rem;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(55, 65, 81, 0.9);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.event-entry-type {
    font-weight: 600;
    color: #bef264;
}

.event-entry-meta {
    color: #9ca3af;
}

.event-controls {
    margin-top: 0.8rem;
    padding-top: 0.8rem;
    border-top: 1px solid rgba(31, 41, 55, 0.9);
}

.event-controls h3 {
    margin: 0 0 0.4rem;
    font-size: 0.9rem;
    color: #9ca3af;
}

.event-controls button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0.15rem 0.15rem 0 0;
    padding: 0.4rem 0.7rem;
    font-size: 0.8rem;
    border-radius: 999px;
    border: 1px solid rgba(55, 65, 81, 0.9);
    background: radial-gradient(circle at top left, #22c55e, #15803d);
    color: #ecfdf5;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.2s ease;
}

.event-controls button:nth-child(2) {
    background: radial-gradient(circle at top left, #38bdf8, #0369a1);
}

.event-controls button:nth-child(3) {
    background: radial-gradient(circle at top left, #f97316, #c2410c);
}

.event-controls button:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.9);
}

.event-controls button:active {
    transform: translateY(0);
    box-shadow: none;
}

.footer {
    padding: 0.7rem 1.5rem;
    font-size: 0.8rem;
    color: #6b7280;
    background: #020617;
    border-top: 1px solid rgba(31, 41, 55, 0.9);
}

.footer code {
    font-size: 0.8rem;
    color: #e5e7eb;
}

@media (max-width: 960px) {
    .main {
        flex-direction: column;
        align-items: center;
        padding-right: 1.5rem;
    }

    .sidebar {
        position: static;
        bottom: auto;
        right: auto;
        width: 100%;
        max-width: 100%;
    }
}

