 :root {
     --bg: #020205;
     --accent: #fbbc04;
     --p1: #fbbc04;
     --p2: #ffffff;
     --border: rgba(255, 255, 255, 0.08);
     --glass: rgba(255, 255, 255, 0.03);
     --header-h: 80px;
 }

 * {
     margin: 0;
     padding: 0;
     box-sizing: border-box;
     -webkit-tap-highlight-color: transparent;
 }

 body {
     background: var(--bg);
     background-image: radial-gradient(circle at 50% 50%, #0a0a1a 0%, #020205 100%);
     color: #fff;
     font-family: 'Inter', sans-serif;
     min-height: 100vh;
     display: flex;
     flex-direction: column;
     overflow-x: hidden;
 }

 /* --- NAVIGATION --- */
 header {
     height: var(--header-h);
     padding: 0 5%;
     display: flex;
     justify-content: space-between;
     align-items: center;
     background: rgba(2, 2, 5, 0.85);
     backdrop-filter: blur(20px);
     border-bottom: 1px solid var(--border);
     position: sticky;
     top: 0;
     z-index: 1000;
 }

 .logo {
     font-family: 'Orbitron';
     font-weight: 900;
     letter-spacing: 4px;
     font-size: 1.1rem;
 }

 .logo span {
     color: var(--accent);
 }

 .nav-desktop {
     display: flex;
     align-items: center;
     gap: 40px;
 }

 .nav-links {
     display: flex;
     gap: 25px;
     font-family: 'Orbitron';
     font-size: 10px;
     letter-spacing: 1px;
 }

 .nav-links a {
     color: #888;
     text-decoration: none;
     transition: 0.3s;
 }

 .nav-links a:hover {
     color: #fff;
 }

 .auth-zone {
     display: flex;
     gap: 15px;
     align-items: center;
     border-left: 1px solid var(--border);
     padding-left: 25px;
 }

 .btn-login {
     background: transparent;
     color: #fff;
     border: 1px solid transparent;
     font-family: 'Orbitron';
     font-size: 10px;
     cursor: pointer;
     padding: 8px 15px;
     transition: 0.3s;
 }

 .btn-reg {
     background: var(--accent);
     color: #000;
     border: none;
     padding: 8px 20px;
     font-family: 'Orbitron';
     font-size: 10px;
     font-weight: 900;
     cursor: pointer;
     border-radius: 2px;
 }

 .menu-trigger {
     display: none;
     flex-direction: column;
     gap: 6px;
     cursor: pointer;
     z-index: 3001;
 }

 .menu-trigger span {
     width: 28px;
     height: 2px;
     background: #fff;
     transition: 0.4s;
 }

 .nav-overlay {
     position: fixed;
     top: 0;
     right: -100%;
     width: 100%;
     height: 100%;
     background: rgba(2, 2, 5, 0.98);
     backdrop-filter: blur(25px);
     z-index: 3000;
     transition: 0.6s cubic-bezier(0.85, 0, 0.15, 1);
     display: flex;
     flex-direction: column;
     justify-content: center;
     padding: 60px;
 }

 .nav-overlay.active {
     right: 0;
 }

 .close-menu-btn {
     position: absolute;
     top: 30px;
     right: 5%;
     background: none;
     border: none;
     color: #fff;
     font-family: 'Orbitron';
     font-size: 2rem;
     cursor: pointer;
 }

 .m-link {
     font-family: 'Orbitron';
     font-size: 1.6rem;
     color: #fff;
     text-decoration: none;
     margin-bottom: 30px;
     font-weight: 900;
     transition: 0.3s;
 }

 /* --- MAIN LAYOUT --- */
 main {
     flex: 1;
     display: grid;
     grid-template-columns: 42% 58%;
     width: 100%;
     max-width: 1600px;
     margin: 0 auto;
 }

 .content-side {
     padding: 40px 80px;
     display: flex;
     flex-direction: column;
     justify-content: center;
 }

 .content-side h1 {
     font-family: 'Orbitron';
     font-size: 3.5rem;
     line-height: 0.95;
     margin-bottom: 25px;
 }

 .content-side p {
     color: #888;
     margin-bottom: 40px;
     font-size: 1.05rem;
     line-height: 1.7;
     max-width: 450px;
 }

 /* --- ARENA & GAME --- */
 .arena-side {
     display: flex;
     flex-direction: column;
     align-items: center;
     justify-content: center;
     padding: 20px;
     perspective: 1500px;
     position: relative;
 }

 .avatars-row {
     display: flex;
     justify-content: space-between;
     width: 100%;
     max-width: 480px;
     margin-bottom: 25px;
 }

 .avatar {
     display: flex;
     align-items: center;
     gap: 12px;
     opacity: 0.3;
     transition: 0.5s ease;
 }

 .avatar.active {
     opacity: 1;
     filter: drop-shadow(0 0 15px var(--accent));
 }

 .avatar img {
     width: 50px;
     height: 50px;
     border-radius: 50%;
     background: #111;
     border: 1px solid var(--border);
 }

 .avatar-info {
     font-family: 'Orbitron';
     font-size: 10px;
     line-height: 1.4;
 }

 .board-wrap {
     transform-style: preserve-3d;
     transition: transform 0.1s ease-out;
     touch-action: none;
 }

 .board {
     width: min(90vw, 480px);
     aspect-ratio: 1/1;
     display: grid;
     grid-template-columns: repeat(8, 1fr);
     background: #08080c;
     border: 10px solid #15151a;
     box-shadow: 0 50px 100px rgba(0, 0, 0, 0.9);
 }

 .sq {
     position: relative;
     display: flex;
     align-items: center;
     justify-content: center;
     transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
 }

 .sq.dark {
     background: #050508;
 }

 .sq.light {
     background: #0c0c16;
 }

 /* SQUISH EFFECT */
 .sq.valid-move {
     background: #0a0a1a;
     transform: translateZ(5px) scale(0.96);
     box-shadow: inset 0 0 15px rgba(251, 188, 4, 0.15);
     z-index: 5;
 }

 .sq.valid-move::after {
     content: '';
     width: 12px;
     height: 12px;
     background: var(--accent);
     border-radius: 50%;
     box-shadow: 0 0 20px var(--accent);
     animation: pulse 1.5s infinite;
     position: absolute;
     opacity: 0.8;
 }

 .piece {
     width: 80%;
     height: 80%;
     border-radius: 50%;
     transition: 0.4s;
     transform: translateZ(15px);
 }

 .piece.p1 {
     background: radial-gradient(circle at 30% 30%, var(--p1), #8a6500);
 }

 .piece.p2 {
     background: radial-gradient(circle at 30% 30%, #fff, #444);
 }

 .piece.selected {
     transform: translateZ(50px) scale(1.1);
     box-shadow: 0 30px 40px rgba(0, 0, 0, 0.7);
     border: 2px solid #fff;
 }

 /* --- GATE --- */
 /* --- UPDATED GATE CSS --- */
 #gate {
     position: absolute;
     inset: -10px;
     /* Slightly larger to cover the board borders */
     background: rgba(2, 2, 5, 0.9);
     backdrop-filter: blur(15px);
     display: none;
     flex-direction: column;
     align-items: center;
     justify-content: center;

     /* THE FIX: Push it forward in 3D space */
     transform: translateZ(100px);
     z-index: 9999;

     padding: 20px;
     animation: fadeIn 0.5s ease;
     border-radius: 8px;
 }

 /* Ensure the container doesn't clip the 3D pop-out */
 .board-wrap {
     transform-style: preserve-3d;
     position: relative;
     /* Remove overflow: hidden if any exists on parents */
 }

 .gate-card {
     background: #0a0a14;
     border: 1px solid var(--border);
     padding: 40px;
     max-width: 400px;
     text-align: center;
     border-radius: 8px;
     box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
 }

 .gate-card h2 {
     font-family: 'Orbitron';
     color: var(--accent);
     margin-bottom: 15px;
     font-size: 1.4rem;
     letter-spacing: 2px;
 }

 .gate-card p {
     color: #aaa;
     line-height: 1.6;
     margin-bottom: 30px;
     font-size: 0.95rem;
 }

 .gate-btns {
     display: flex;
     flex-direction: column;
     gap: 12px;
     width: 100%;
 }

 .btn-prime {
     background: var(--accent);
     color: #000;
     border: none;
     padding: 16px;
     font-family: 'Orbitron';
     font-weight: 900;
     font-size: 11px;
     cursor: pointer;
     transition: 0.3s;
 }

 .btn-ghost {
     background: transparent;
     color: #777;
     border: 1px solid var(--border);
     padding: 12px;
     font-family: 'Orbitron';
     font-size: 9px;
     cursor: pointer;
 }

 /* --- ANIMATIONS --- */
 @keyframes fadeIn {
     from {
         opacity: 0;
     }

     to {
         opacity: 1;
     }
 }

 @keyframes pulse {
     0% {
         opacity: 0.5;
         transform: scale(0.9);
     }

     50% {
         opacity: 1;
         transform: scale(1.15);
     }

     100% {
         opacity: 0.5;
         transform: scale(0.9);
     }
 }

 @media (max-width: 1100px) {
     main {
         grid-template-columns: 1fr;
     }

     .content-side {
         text-align: center;
         align-items: center;
         order: 2;
         padding: 60px 5%;
     }

     .arena-side {
         order: 1;
         padding-top: 50px;
     }

     .nav-desktop {
         display: none;
     }

     .menu-trigger {
         display: flex;
     }
 }
/* --- CRITICAL FIX FOR SMALL DEVICES (iPhone SE, etc.) --- */
@media (max-width: 375px) {
    :root {
        --header-h: 60px;
    }

    /* 1. Center the content and scale text */
    .content-side {
        padding: 30px 20px !important;
        text-align: center;
        align-items: center;
        display: flex;
        flex-direction: column;
    }

    .content-side h1 {
        font-size: 8.5vw !important; /* Dynamically scales with screen width */
        line-height: 1.1;
        margin-bottom: 15px;
        white-space: nowrap; /* Prevents awkward word breaking */
    }

    .content-side p {
        font-size: 13px;
        line-height: 1.5;
        margin-bottom: 25px;
        max-width: 280px;
    }

    /* 2. Board Centering & Size */
    .arena-side {
        padding: 10px !important;
        width: 100%;
        overflow: hidden;
    }

    .board-wrap {
        width: 100%;
        display: flex;
        justify-content: center;
        transform: rotateX(15deg) scale(0.95); /* Slight tilt & shrink to fit */
    }

    .board {
        width: 300px !important; /* Forced width for small screens */
        height: 300px !important;
        border-width: 6px !important;
    }

    /* 3. Avatar Row Cleanup */
    .avatars-row {
        width: 300px !important;
        margin-bottom: 15px;
    }

    .avatar img {
        width: 32px !important;
        height: 32px !important;
    }

    .avatar-info b {
        font-size: 9px;
    }

    /* 4. Gate / Success Message centering */
    .gate-card {
        width: 90%;
        padding: 20px;
        transform: scale(0.85); /* Scales the popup to fit the board */
    }
}

 footer {
     height: 60px;
     padding: 0 5%;
     display: flex;
     justify-content: space-between;
     align-items: center;
     font-family: 'Orbitron';
     font-size: 9px;
     color: #444;
 }