:root {
    --bg-color: #0a0a0c;
    --panel-bg: rgba(255, 255, 255, 0.05);
    --panel-border: rgba(255, 255, 255, 0.1);
    --neon-blue: #00f2ff;
    --neon-purple: #bc13fe;
    --neon-pink: #ff00de;
    --text-color: #e0e0e0;
    --text-dim: #888;
    
    --color-i: #00f2ff;
    --color-j: #0044ff;
    --color-l: #ff9900;
    --color-o: #ffe600;
    --color-s: #00ff66;
    --color-t: #bc13fe;
    --color-z: #ff0055;
    
    --font-main: 'Outfit', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 900px;
    height: 100vh;
    padding: 20px;
}

.glass {
    background: var(--panel-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.37);
}

/* Layout */
.game-layout {
    display: flex;
    flex: 1;
    justify-content: center;
    gap: 20px;
    align-items: flex-start;
    padding-bottom: 20px;
}

.side-panel {
    width: 120px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.side-panel h2 {
    font-size: 0.8rem;
    font-weight: 300;
    letter-spacing: 0.1rem;
    text-align: center;
    color: var(--text-dim);
}

.preview-box {
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.preview-box.compact {
    height: 60px;
}

.board-area {
    flex: 0 0 auto;
}

.board-wrapper {
    position: relative;
    padding: 5px;
    border: 2px solid var(--panel-border);
}

#game-board {
    display: block;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
}

/* Stats */
.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 15px;
}

.stat-item .label {
    font-size: 0.7rem;
    color: var(--text-dim);
    letter-spacing: 0.05rem;
}

.stat-item span:not(.label) {
    font-size: 1.5rem;
    font-weight: 600;
}

/* Overlay */
#message-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    background: rgba(0, 0, 0, 0.6);
}

.message-content {
    padding: 30px;
    text-align: center;
    min-width: 200px;
}

.message-content h1 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--neon-blue);
    text-shadow: 0 0 10px var(--neon-blue);
}

button#start-btn {
    background: rgba(0, 242, 255, 0.05);
    border: 2px solid var(--neon-blue);
    color: var(--neon-blue);
    padding: 12px 28px;
    border-radius: 8px;
    font-family: var(--font-main);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
}

button#start-btn:hover {
    background: var(--neon-blue);
    color: #000;
    box-shadow: 0 0 20px var(--neon-blue);
    transform: scale(1.05);
}

button#start-btn:active {
    transform: scale(0.98);
}

/* Mobile Controls (Now Global On-Screen Controls) */
.mobile-controls {
    display: flex;
    flex-direction: column;
    padding: 10px 0;
    width: 100%;
    gap: 10px;
    align-items: center;
}

.control-row {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.control-row .ctrl-btn {
    flex: 1;
    min-width: 80px;
}

.control-grid {
    display: grid;
    grid-template-columns: repeat(3, 70px);
    gap: 8px;
    max-width: 250px;
}

.ctrl-btn {
    width: 70px;
    height: 70px;
    background: var(--panel-bg);
    border: 2px solid var(--panel-border);
    border-radius: 12px;
    color: var(--text-color);
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    touch-action: manipulation;
    transition: all 0.05s;
    user-select: none;
    -webkit-user-select: none;
    font-family: var(--font-main);
    flex-shrink: 0;
}

.ctrl-btn.large {
    width: 70px;
    height: 70px;
    font-size: 1.8rem;
}

.ctrl-btn:active {
    background: var(--neon-blue);
    color: #000;
    border-color: var(--neon-blue);
    transform: scale(0.92);
    box-shadow: 0 0 20px var(--neon-blue);
}

.ctrl-btn:hover {
    border-color: var(--neon-blue);
    background: rgba(0, 242, 255, 0.05);
}

.ctrl-btn.primary {
    background: rgba(0, 242, 255, 0.1);
    border-color: var(--neon-blue);
    color: var(--neon-blue);
}

.ctrl-btn.primary:hover {
    background: rgba(0, 242, 255, 0.15);
}

.ctrl-btn.secondary {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.05rem;
    width: auto;
    padding: 0 16px;
    height: 50px;
}

/* Responsive */
/* Mobile Hidden */
#message-overlay.hidden {
    display: none !important;
}

@media (max-width: 768px) {
    #game-container {
        padding: 5px;
    }

    .game-layout {
        gap: 10px;
    }

    .side-panel {
        width: 70px;
    }

    .side-panel h2 { font-size: 0.6rem; }

    .desktop-only {
        display: none;
    }

    .mobile-stats {
        display: flex;
        justify-content: space-around;
        padding: 10px 0;
    }

    .mobile-stats .stat-item {
        margin-bottom: 0;
    }

    .control-grid {
        grid-template-columns: repeat(3, 60px);
        gap: 6px;
    }

    .ctrl-btn {
        width: 60px;
        height: 60px;
        font-size: 1.3rem;
        border-radius: 8px;
    }

    .ctrl-btn.large {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }

    .ctrl-btn.secondary {
        height: 45px;
        font-size: 0.7rem;
        padding: 0 12px;
    }

    .control-row {
        gap: 8px;
    }

    .control-row .ctrl-btn {
        min-width: 70px;
    }
}
