:root {
    /* DEFAULT BEAST MODE (Red) */
    --primary: #ff003c;       
    --secondary: #00f3ff;     
    --bg-color: #050505;
    --font-main: 'Courier New', monospace;
    --card-bg: rgba(10, 0, 0, 0.85);
    --border-radius: 2px;
}

/* MAGIC MODE BASE (Purple/Gold) */
body.mode-magic {
    --primary: #FFD700;       
    --secondary: #ff00ff;     
    --bg-color: #0b0014;      
    --font-main: 'Verdana', sans-serif;
    --card-bg: rgba(40, 0, 80, 0.7);
    --border-radius: 25px;
}

/* NOEL MODE (Blue/Ice) */
body.mode-noel {
    --primary: #007bff;
    --secondary: #00ffff;
    --bg-color: #000a14;
    --card-bg: rgba(0, 20, 60, 0.8);
}

/* NOAH MODE (Green/Toxic) */
body.mode-noah {
    --primary: #28a745;
    --secondary: #b4ff00;
    --bg-color: #051405;
    --card-bg: rgba(0, 60, 10, 0.8);
}

/* --- GLOBAL RESET & VIEWPORT LOCK --- */
* { 
    margin: 0; padding: 0; box-sizing: border-box; 
    /* Disable default touch actions (prevents zoom/scroll) */
    touch-action: none; 
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%; height: 100%;
    overflow: hidden; /* No scrollbars */
    overscroll-behavior: none; /* No bounce on iOS */
    user-select: none;
    -webkit-user-select: none;
}

body {
    background-color: var(--bg-color);
    color: #fff;
    font-family: var(--font-main);
    /* SMOOTH TRANSITION FOR THEME SWITCHING */
    transition: background-color 1.5s cubic-bezier(0.4, 0, 0.2, 1), color 1s ease;
}

/* --- CRT & VINTAGE EFFECTS --- */
.scanlines {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0) 50%, rgba(0,0,0,0.2) 50%, rgba(0,0,0,0.2));
    background-size: 100% 4px;
    z-index: 900;
    pointer-events: none;
    opacity: 0.6;
}

/* --- CANVAS --- */
#coreCanvas { 
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; 
    z-index: 1; 
    filter: blur(0.5px) contrast(1.2);
}

/* --- UI --- */
.interface-container {
    position: relative; z-index: 10; padding: 2rem; height: 100%;
    display: flex; flex-direction: column; justify-content: space-between; align-items: center;
    pointer-events: none; text-align: center;
    transition: opacity 0.5s;
}
.interface-container > * { pointer-events: auto; }

h1 {
    font-size: 4rem;
    text-transform: uppercase;
    color: #fff;
    text-shadow: 4px 4px 0px var(--primary), -2px -2px 0px var(--secondary);
    letter-spacing: 5px;
    transition: text-shadow 1s ease, transform 0.3s;
}

body.mode-magic h1 {
    text-shadow: 0 0 20px var(--primary), 0 0 40px var(--secondary);
}

.card {
    background: var(--card-bg);
    border: 2px solid var(--primary);
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    border-radius: var(--border-radius);
    box-shadow: 0 0 30px var(--primary);
    backdrop-filter: blur(5px);
    display: flex; flex-direction: column; align-items: center;
    
    /* Smooth morphing for the card */
    transition: 
        background-color 1.5s ease,
        border-color 1s ease,
        box-shadow 1s ease,
        border-radius 1s ease,
        transform 0.5s;
}

/* --- BUTTONS --- */
button {
    background: rgba(0,0,0,0.5);
    border: 2px solid var(--primary);
    color: var(--primary);
    padding: 1rem 2rem;
    font-size: 1.2rem;
    font-weight: 900;
    cursor: pointer;
    text-transform: uppercase;
    box-shadow: 0 0 10px var(--primary);
    margin-top: 10px;
    
    /* Touch optimization */
    touch-action: manipulation; 
    
    transition: all 0.3s ease;
}
button:hover { background: var(--primary); color: #000; transform: scale(1.05); }
button:active { transform: scale(0.95); }

/* BROTHER BUTTONS */
#avatar-container {
    display: flex; gap: 20px; margin-bottom: 20px;
    transition: opacity 1s, transform 0.5s;
}
.hidden { display: none !important; opacity: 0; }

.brother-btn {
    border-radius: 50px;
    padding: 0.8rem 2rem;
    font-size: 1.2rem;
    border-width: 3px;
    background: rgba(0,0,0,0.8);
    transition: all 0.5s ease;
}

.blue-glow { border-color: #007bff; color: #007bff; box-shadow: 0 0 15px #007bff; }
.green-glow { border-color: #28a745; color: #28a745; box-shadow: 0 0 15px #28a745; }

/* Active states for brother buttons to give feedback */
body.mode-noel .brother-btn.blue-glow {
    background: rgba(0, 123, 255, 0.3);
    box-shadow: 0 0 30px #007bff;
    transform: scale(1.1);
}
body.mode-noah .brother-btn.green-glow {
    background: rgba(40, 167, 69, 0.3);
    box-shadow: 0 0 30px #28a745;
    transform: scale(1.1);
}

/* --- MOBILE CONTROLS (D-PAD) --- */
#mobile-controls {
    position: absolute;
    bottom: 30px; /* Bit higher */
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    pointer-events: auto;
    touch-action: none; /* Critical for D-Pad */
}

.d-pad {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.d-row {
    display: flex;
    gap: 60px; 
}

.d-btn {
    width: 65px; height: 65px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.4);
    color: white;
    font-size: 1.5rem;
    display: flex; justify-content: center; align-items: center;
    backdrop-filter: blur(4px);
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    margin: 0; padding: 0;
    
    /* Ensure no delay */
    touch-action: none;
}

.d-btn:active { background: rgba(255, 255, 255, 0.5); transform: scale(0.9); border-color: #fff; }

.d-exit {
    background: rgba(255, 0, 0, 0.4);
    border: 1px solid red;
    color: white;
    padding: 8px 30px;
    border-radius: 20px;
    font-size: 1rem;
    touch-action: manipulation;
}

/* --- OVERLAY STUFF --- */
#flash-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: white; z-index: 3000; opacity: 0; display: none; pointer-events: none;
}

#game-container {
    position: absolute; top: 15%; left: 50%; transform: translateX(-50%);
    width: 90%; z-index: 950; pointer-events: auto; text-align: center;
    color: white; text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

@media (max-width: 600px) {
    h1 { font-size: 2.5rem; }
    .card { padding: 1.5rem; }
}
