/* ── Global reset ────────────────────────────────────────────────────── */

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

body {
    background: #000;
    color: #9fef00;
    font-family: 'Courier New', 'Consolas', 'Monaco', monospace;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}


/* ── Canvas ─────────────────────────────────────────────────────────── */

#glcanvas {
    display: block;
    width: 100vw;
    height: 100vh;
    touch-action: none;
}


/* ── HUD overlay ────────────────────────────────────────────────────── */

#hud {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 10;
    display: flex;
    flex-direction: column;
}

#hud > * {
    pointer-events: auto;
}


/* ── Top bar (model selector) ───────────────────────────────────────── */

#top-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.6);
    border-bottom: 1px solid rgba(159, 239, 0, 0.2);
    flex-shrink: 0;
}

#top-bar .label {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-right: 4px;
}

.model-btn {
    background: rgba(159, 239, 0, 0.08);
    border: 1px solid rgba(159, 239, 0, 0.25);
    color: #9fef00;
    font-family: inherit;
    font-size: 13px;
    padding: 4px 12px;
    cursor: pointer;
    transition: all 0.15s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.model-btn:hover {
    background: rgba(159, 239, 0, 0.15);
    border-color: rgba(159, 239, 0, 0.5);
}

.model-btn.active {
    background: rgba(159, 239, 0, 0.25);
    border-color: #9fef00;
    box-shadow: 0 0 8px rgba(159, 239, 0, 0.3);
}

.separator {
    width: 1px;
    height: 20px;
    background: rgba(159, 239, 0, 0.2);
    margin: 0 4px;
}

#mode-toggle {
    background: rgba(159, 239, 0, 0.08);
    border: 1px solid rgba(159, 239, 0, 0.25);
    color: #9fef00;
    font-family: inherit;
    font-size: 12px;
    padding: 4px 10px;
    cursor: pointer;
    transition: all 0.15s;
}

#mode-toggle:hover {
    background: rgba(159, 239, 0, 0.15);
}


/* ── Bottom bar (status) ────────────────────────────────────────────── */

#bottom-bar {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    background: rgba(0, 0, 0, 0.6);
    border-top: 1px solid rgba(159, 239, 0, 0.2);
    flex-shrink: 0;
    font-size: 13px;
}


/* ── Mode badge ─────────────────────────────────────────────────────── */

.mode-badge {
    display: inline-block;
    padding: 2px 10px;
    font-weight: bold;
    font-size: 12px;
    letter-spacing: 1px;
}

.mode-badge.spin {
    background: #9fef00;
    color: #000;
}

.mode-badge.move {
    background: #00bfff;
    color: #000;
}

.mode-badge.forest {
    background: #3c5a2d;
    color: #9fef00;
}


/* ── Controls help text ─────────────────────────────────────────────── */

#controls-help {
    color: #666;
    font-size: 12px;
}

#status-bar {
    color: #9fef00;
    font-size: 12px;
    margin-left: auto;
}


/* ── VEINROOT: Post-processing overlays ─────────────────────────────── */

/* Scanlines — horizontal lines, opacity driven by JS */
#veinroot-scanlines {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 998;
    opacity: 0;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 2px,
        rgba(0, 0, 0, 0.15) 2px,
        rgba(0, 0, 0, 0.15) 4px
    );
    mix-blend-mode: multiply;
}

/* Vignette — radial darkening at edges, opacity driven by JS */
#veinroot-vignette {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 997;
    opacity: 0;
    background: radial-gradient(
        ellipse at center,
        transparent 40%,
        rgba(0, 0, 0, 0.5) 80%,
        rgba(0, 0, 0, 0.9) 100%
    );
}

/* Static noise — animated pseudo-random dots, opacity driven by JS */
#veinroot-static {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 996;
    opacity: 0;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4'%3E%3Crect x='0' y='0' width='1' height='1' fill='%23ffffff' opacity='0.03'/%3E%3Crect x='2' y='1' width='1' height='1' fill='%23ffffff' opacity='0.05'/%3E%3Crect x='1' y='3' width='1' height='1' fill='%23ffffff' opacity='0.04'/%3E%3Crect x='3' y='2' width='1' height='1' fill='%23ffffff' opacity='0.03'/%3E%3C/svg%3E");
    background-size: 4px 4px;
    animation: veinroot-static-shift 0.1s steps(3) infinite;
}

@keyframes veinroot-static-shift {
    0%   { background-position: 0 0; }
    33%  { background-position: 2px 1px; }
    66%  { background-position: -1px 3px; }
    100% { background-position: 1px -2px; }
}


/* ── Touch controls ─────────────────────────────────────────────────── */

.touch-joystick-base {
    position: fixed;
    width: 120px;
    height: 120px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 1001;
    box-shadow: 0 0 12px rgba(159, 239, 0, 0.1);
}

.touch-joystick-thumb {
    position: fixed;
    width: 50px;
    height: 50px;
    background: rgba(159, 239, 0, 0.35);
    border: 1px solid rgba(159, 239, 0, 0.5);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 1002;
    box-shadow: 0 0 8px rgba(159, 239, 0, 0.2);
}

.touch-interact-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 2px solid rgba(255, 200, 0, 0.5);
    background: rgba(0, 0, 0, 0.55);
    color: #ffcc00;
    font-family: 'Courier New', 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 1px;
    text-align: center;
    line-height: 80px;
    z-index: 1001;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    cursor: pointer;
    transition: background 0.1s, border-color 0.1s;
}

.touch-interact-btn.active {
    background: rgba(255, 200, 0, 0.25);
    border-color: rgba(255, 200, 0, 0.8);
    box-shadow: 0 0 16px rgba(255, 200, 0, 0.3);
}


/* ── Responsive: hide non-essential on small screens ────────────────── */

@media (max-width: 600px) {
    #top-bar, #bottom-bar {
        padding: 6px 8px;
        gap: 4px;
    }

    .model-btn {
        padding: 3px 8px;
        font-size: 11px;
    }

    #controls-help {
        display: none;
    }
}
