/* ===========================================================
   CYBER ARCADE — shared neon theme & layout
   Used by every game in the portal. Keep it framework-agnostic.
   =========================================================== */
:root {
    --bg-color: #05050c;
    --panel-bg: rgba(13, 13, 29, 0.8);
    --neon-cyan: #00f0ff;
    --neon-magenta: #ff0055;
    --neon-amber: #ffaa00;
    --neon-green: #39ff14;
    --grid-color: rgba(0, 240, 255, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

body {
    background-color: var(--bg-color);
    background-image:
        linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%),
        linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    background-size: 100% 4px, 6px 100%;
    font-family: 'Courier New', Courier, monospace;
    color: #fff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 10px;
}

.game-container {
    display: flex;
    flex-direction: row;
    background: var(--panel-bg);
    border: 2px solid var(--neon-cyan);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.3), inset 0 0 15px rgba(0, 240, 255, 0.1);
    border-radius: 8px;
    padding: 15px;
    position: relative;
    max-width: 100%;
}

.header {
    position: absolute;
    top: -40px;
    left: 0;
    width: 100%;
    text-align: center;
    font-weight: bold;
    font-size: 20px;
    color: var(--neon-magenta);
    text-shadow: 0 0 8px var(--neon-magenta);
    letter-spacing: 2px;
}

#game-canvas, canvas.game-canvas {
    background: #000;
    border: 1px solid rgba(0, 240, 255, 0.3);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.1);
    max-width: 100%;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.sidebar {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    margin-left: 15px;
    width: 120px;
}

.panel {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--neon-magenta);
    box-shadow: 0 0 8px rgba(255, 0, 85, 0.2);
    padding: 8px;
    border-radius: 4px;
    text-align: center;
    margin-bottom: 10px;
}

.panel-title {
    font-size: 11px;
    color: var(--neon-cyan);
    text-transform: uppercase;
    margin-bottom: 4px;
    letter-spacing: 1px;
}

.panel-value {
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 5px #fff;
}

.mode-btn {
    background: transparent;
    border: 1px solid var(--neon-amber);
    color: var(--neon-amber);
    padding: 8px 0;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-family: inherit;
    font-size: 12px;
    text-shadow: 0 0 4px var(--neon-amber);
    box-shadow: 0 0 5px rgba(255, 170, 0, 0.2);
    transition: all 0.2s;
    width: 100%;
    margin-top: auto;
}

.mode-btn.auto-mode {
    border-color: var(--neon-green);
    color: var(--neon-green);
    text-shadow: 0 0 4px var(--neon-green);
    box-shadow: 0 0 5px rgba(57, 255, 20, 0.2);
}

/* ---------- Mobile / touch controller ---------- */
.mobile-controller {
    display: none;
    width: 100%;
    max-width: 360px;
    margin-top: 15px;
    background: rgba(15, 15, 35, 0.9);
    border: 1px solid rgba(255, 0, 85, 0.4);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 0 15px rgba(255, 0, 85, 0.1);
}

.controller-grid {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.d-pad {
    display: grid;
    grid-template-columns: repeat(3, 45px);
    grid-template-rows: repeat(3, 45px);
    gap: 3px;
}

.d-btn {
    background: rgba(20, 20, 45, 0.8);
    border: 1px solid var(--neon-cyan);
    color: var(--neon-cyan);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    box-shadow: 0 0 5px rgba(0, 240, 255, 0.2);
    touch-action: manipulation;
}
.d-btn:active { background: var(--neon-cyan); color: #000; }
.d-up { grid-column: 2; grid-row: 1; }
.d-left { grid-column: 1; grid-row: 2; }
.d-right { grid-column: 3; grid-row: 2; }
.d-down { grid-column: 2; grid-row: 3; }

.action-pad {
    display: flex;
    gap: 15px;
}

.action-btn {
    width: 55px;
    height: 55px;
    background: rgba(20, 20, 45, 0.8);
    border: 2px solid var(--neon-magenta);
    color: var(--neon-magenta);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    box-shadow: 0 0 8px rgba(255, 0, 85, 0.2);
    transform: translateY(-5px);
    touch-action: manipulation;
}
.action-btn:active { background: var(--neon-magenta); color: #000; }

.btn-back {
    position: absolute;
    top: -42px;
    left: 0;
    font-size: 12px;
    color: var(--neon-cyan);
    text-decoration: none;
    border: 1px solid var(--neon-cyan);
    padding: 3px 10px;
    border-radius: 4px;
    background: var(--panel-bg);
}

@media (max-width: 768px) {
    body { justify-content: flex-start; padding-top: 45px; }
    .mobile-controller { display: block; }
    .game-container { padding: 8px; }
    .sidebar { width: 90px; margin-left: 8px; }
    .panel-value { font-size: 14px; }
}
