/* --- CORE VARIABLES --- */
:root {
    --matrix-green: #0F0;
    --matrix-dark: #050505;
    --glass-bg: rgba(5, 5, 5, 0.85);
    --glass-border: rgba(0, 255, 0, 0.2);
    --blender-grey: #2b2b2b;
    --blender-orange: #ea7600;
}

/* --- RESET & BASE --- */
body {
    font-family: 'Source Code Pro', monospace;
    background-color: var(--matrix-dark);
    color: var(--matrix-green);
    overflow-x: hidden;
    margin: 0;
    height: 100vh;
}

/* --- MODULE: BACKGROUND --- */
#matrixCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.8;
    pointer-events: none;
}

/* --- MODULE: UI COMPONENTS --- */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.1);
}

.text-glow {
    text-shadow: 0 0 5px var(--matrix-green), 0 0 10px var(--matrix-green);
}

.box-glow:hover {
    box-shadow: 0 0 15px var(--matrix-green);
    border-color: var(--matrix-green);
}

/* --- MODULE: SCROLLBAR --- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #000; }
::-webkit-scrollbar-thumb { background: #003300; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #006600; }
.custom-scrollbar::-webkit-scrollbar { width: 6px; }
.custom-scrollbar::-webkit-scrollbar-track { background: rgba(0,0,0,0.5); }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #004400; border-radius: 3px; }

/* --- MODULE: ANIMATIONS --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in { animation: fadeIn 0.5s ease-out forwards; }

.glitch-hover:hover { animation: glitch 0.3s cubic-bezier(.25, .46, .45, .94) both infinite; color: #fff; }
@keyframes glitch {
    0% { transform: translate(0) }
    20% { transform: translate(-2px, 2px) }
    40% { transform: translate(-2px, -2px) }
    60% { transform: translate(2px, 2px) }
    80% { transform: translate(2px, -2px) }
    100% { transform: translate(0) }
}

/* --- MODULE: UTILITIES --- */
.section-content { display: none; }
.section-content.active { display: block; }

.video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
}
.video-wrapper iframe {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    border: none;
}

/* --- MODULE: 3D MODAL --- */
#model-modal {
    display: none;
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 50;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
#model-canvas-container {
    width: 90%; height: 80%;
    border: 1px solid var(--matrix-green);
    background: radial-gradient(circle, rgba(0,20,0,1) 0%, rgba(0,0,0,1) 100%);
    position: relative;
}
.loading-text {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem; color: var(--matrix-green);
    animation: pulse 1s infinite;
    pointer-events: none;
}
@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* --- MODULE: GAMES --- */
#snake-canvas, #flappy-canvas {
    background-color: rgba(0, 20, 0, 0.9);
    border: 1px solid var(--matrix-green);
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.1);
    image-rendering: pixelated;
}
.game-btn {
    width: 50px; height: 50px;
    border: 1px solid var(--matrix-green);
    background: rgba(0, 50, 0, 0.5);
    color: var(--matrix-green);
    border-radius: 8px;
    font-size: 1.2rem;
    display: flex; align-items: center; justify-content: center;
    user-select: none; transition: all 0.1s;
}
.game-btn:active { background: var(--matrix-green); color: black; transform: scale(0.95); }

/* --- MODULE: FORMS --- */
input[type="range"] {
    -webkit-appearance: none; width: 100%; height: 8px;
    background: #003300; outline: none; border-radius: 4px;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 20px; height: 20px;
    background: #0F0; cursor: pointer; border-radius: 50%;
}
input[type="checkbox"] {
    accent-color: #0F0; width: 16px; height: 16px; cursor: pointer;
}
/* Custom Select for Crypto Tool */
select.matrix-select {
    appearance: none;
    background-color: rgba(0, 20, 0, 0.8);
    border: 1px solid var(--matrix-green);
    color: var(--matrix-green);
    padding: 0.5rem 2rem 0.5rem 1rem;
    font-family: 'Source Code Pro', monospace;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2300ff41' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
}
select.matrix-select:focus { outline: none; box-shadow: 0 0 10px var(--matrix-green); }

/* --- MODULE: BLENDER TOOL --- */
#blender-canvas-container {
    position: relative;
    width: 100%; height: 500px;
    background-color: var(--blender-grey);
    overflow: hidden;
    border: 1px solid #444;
}
.blender-toolbar {
    background: #333;
    border-bottom: 1px solid #555;
    padding: 0.5rem;
    display: flex; gap: 0.5rem; flex-wrap: wrap;
    align-items: center;
}
.blender-btn {
    padding: 0.25rem 0.75rem;
    background: #444;
    border: 1px solid #555;
    border-radius: 4px;
    color: #ccc;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex; align-items: center; gap: 0.5rem;
}
.blender-btn:hover, .blender-btn.active {
    background: #555;
    color: white;
    border-color: var(--blender-orange);
}
.blender-input {
    background: #222;
    border: 1px solid #555;
    color: #ccc;
    padding: 0.1rem 0.5rem;
    border-radius: 4px;
    width: 60px;
    font-size: 0.8rem;
}

/* --- MODULE: POLLS --- */
.poll-bar-container {
    width: 100%;
    background-color: rgba(0, 20, 0, 0.5);
    border: 1px solid #003300;
    height: 30px;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}
.poll-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #003300, #00ff41);
    width: 0%;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    position: absolute;
    top: 0; left: 0;
    opacity: 0.7;
}
.poll-option-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: #333;
    color: #555;
}

/* --- MODULE: LEADERBOARD --- */
.leaderboard-container table {
    border-collapse: collapse;
}
.leaderboard-container tr:nth-child(even) {
    background-color: rgba(0, 255, 65, 0.05);
}
.leaderboard-container td {
    border-bottom: 1px solid rgba(0, 255, 65, 0.2);
}