:root {
    --bg-color: #0a0a0c;
    --text-color: #e2e8f0;
    --neon-active: #00ffcc;
    --neon-locked: #1e293b;
    --neon-error: #ef4444; /* Added for the locked hover effect */
    --cube-size: 130px;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Courier New', Courier, monospace;
    margin: 0;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    box-sizing: border-box;
}

header {
    text-align: center;
    margin-bottom: 50px;
}

header h1 {
    font-size: 2.6rem;
    letter-spacing: 4px;
    margin: 0 0 10px 0;
}

header h1 span {
    color: var(--neon-active);
    text-shadow: 0 0 12px rgba(0, 255, 204, 0.6);
}

header p {
    color: #475569;
    margin: 0;
    font-size: 1.05rem;
}

/* Matrix Grid Layout */
.matrix-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); 
    gap: 30px 25px;
    max-width: 1100px;
    width: 100%;
    perspective: 1000px; /* Enhanced depth perception */
    padding: 20px 0;
}

/* Base Cube Structure & Smooth Transitions */
.cube-card {
    position: relative;
    width: var(--cube-size);
    height: var(--cube-size);
    margin: 0 auto 55px auto;
    transform-style: preserve-3d;
    transform: rotateX(-15px) rotateY(20px);
    /* Smooth timing function for fluid 3D scaling and movement */
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    text-decoration: none;
    display: block;
}

/* Cube Faces Base Styling */
.cube-face {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    border: 2px solid;
    box-sizing: border-box;
    overflow: hidden;
    text-align: center;
    padding: 8px;
    /* Keeps face illumination synchronized with parent movement */
    transition: border-color 0.3s ease, box-shadow 0.3s ease, color 0.3s ease;
}

/* ========================================================
   ACTIVE CUBE STATE & HOVER (Illumination + Growth)
   ======================================================== */
.active .cube-face {
    background: rgba(0, 255, 204, 0.02);
    border-color: var(--neon-active);
    color: var(--neon-active);
    box-shadow: inset 0 0 12px rgba(0, 255, 204, 0.15);
}

.active .front { transform: translateZ(calc(var(--cube-size) / 2)); }
.active .top   { transform: rotateX(90deg) translateZ(calc(var(--cube-size) / 2)); background: rgba(0, 255, 204, 0.06); }
.active .right { transform: rotateY(90deg) translateZ(calc(var(--cube-size) / 2)); background: rgba(0, 255, 204, 0.04); }

/* Hover effects: Scales up (1.12), floats higher (-15px), and changes angles */
.cube-card.active:hover {
    transform: rotateX(-5px) rotateY(35px) translateY(-15px) scale(1.12);
}

/* Intense neon glow overlay on hover */
.cube-card.active:hover .cube-face {
    border-color: #ffffff; /* Sharp white hot edge highlight */
    box-shadow: 0 0 25px rgba(0, 255, 204, 0.6), inset 0 0 15px rgba(0, 255, 204, 0.3);
    color: #ffffff;
    text-shadow: 0 0 8px var(--neon-active);
}

/* ========================================================
   LOCKED CUBE STATE & HOVER (Access Denied / Subtle Error)
   ======================================================== */
.locked .cube-face {
    background: rgba(30, 41, 59, 0.02);
    border-color: var(--neon-locked);
    color: #334155;
}
.locked .front { transform: translateZ(calc(var(--cube-size) / 2)); }
.locked .top   { transform: rotateX(90deg) translateZ(calc(var(--cube-size) / 2)); }
.locked .right { transform: rotateY(90deg) translateZ(calc(var(--cube-size) / 2)); }

/* Slight visual response to prove the page is alive */
.cube-card.locked:hover {
    transform: rotateX(-10px) rotateY(25px) translateY(-4px) scale(1.03);
}

/* Crimson warning pulse when attempting to hover offline modules */
.cube-card.locked:hover .cube-face {
    border-color: var(--neon-error);
    color: var(--neon-error);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4), inset 0 0 8px rgba(239, 68, 68, 0.1);
}

/* ========================================================
   DETAILS & SUBTITLES
   ======================================================== */
.cube-details {
    position: absolute;
    top: calc(var(--cube-size) + 14px);
    width: 180px;
    left: 50%;
    transform: translateX(-50%) rotateY(-20px) rotateX(15px);
    text-align: center;
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Sync subtitle position shifts when the cubes move */
.cube-card.active:hover ~ .cube-details,
.cube-card.active:hover .cube-details {
    transform: translateX(-50%) rotateY(-35px) rotateX(5px) translateY(5px);
}

.cube-details h3 {
    margin: 0 0 4px 0;
    font-size: 1.05rem;
    color: #94a3b8;
    transition: color 0.3s ease;
}

.active .cube-details h3 {
    color: var(--neon-active);
}

.cube-card.active:hover .cube-details h3 {
    color: #ffffff;
    text-shadow: 0 0 8px var(--neon-active);
}

.cube-details p {
    margin: 0;
    font-size: 0.8rem;
    color: #334155;
}

.active .cube-details p {
    color: #6ee7b7;
}

.cube-card.locked:hover .cube-details h3 {
    color: var(--neon-error);
}