:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --glass-bg: rgba(255, 255, 255, 0.04);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 500px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Glassmorphism Card */
.card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    padding: 40px 32px;
    width: 100%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
    animation: slideUp 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from { transform: translateY(40px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 8px;
    text-align: center;
    background: linear-gradient(to right, #818cf8, #c084fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 36px;
    font-size: 0.95rem;
}

/* Menu UI */
.menu-group {
    margin-bottom: 28px;
    width: 100%;
}

label {
    display: block;
    margin-bottom: 14px;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

/* Skins Grid */
.skin-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.skin-btn {
    height: 64px;
    border-radius: 16px;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.skin-btn.active {
    border-color: var(--primary);
    transform: scale(1.08);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.3);
}

.skin-green { background: linear-gradient(45deg, #779556 50%, #ebecd0 50%); }
.skin-blue { background: linear-gradient(45deg, #4b7399 50%, #dee3e6 50%); }
.skin-dark { background: linear-gradient(45deg, #262626 50%, #404040 50%); }

/* Slider Modernization */
.range-container {
    padding: 8px 0;
}

input[type="range"] {
    width: 100%;
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    appearance: none;
    accent-color: var(--primary);
}

.range-val {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 700;
}

.btn-primary {
    width: 100%;
    padding: 18px;
    background: var(--primary);
    border: none;
    border-radius: 20px;
    color: white;
    font-weight: 800;
    font-size: 1.15rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 8px;
}

.btn-primary:active {
    transform: scale(0.96);
}

/* Game Screen */
#game-screen {
    padding: 24px 16px;
}

#myBoard {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

#status {
    text-align: center;
    padding: 16px;
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    font-weight: 600;
    margin-top: 24px;
    font-size: 0.9rem;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 10px 20px;
    border-radius: 12px;
    cursor: pointer;
    margin-bottom: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
}

.back-btn:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

/* --- THEMES PERSISTENTES --- */
#myBoard.theme-green .white-1e1d7 { background-color: #ebecd0 !important; }
#myBoard.theme-green .black-3c85d { background-color: #779556 !important; }

#myBoard.theme-blue .white-1e1d7 { background-color: #dee3e6 !important; }
#myBoard.theme-blue .black-3c85d { background-color: #4b7399 !important; }

#myBoard.theme-dark .white-1e1d7 { background-color: #404040 !important; }
#myBoard.theme-dark .black-3c85d { background-color: #262626 !important; }

/* Highlight Moderno (Sem quebrar layout) */
.highlight-move {
    box-shadow: inset 0 0 12px 3px rgba(255, 255, 255, 0.4) !important;
    filter: brightness(1.15);
}

/* Mobile Adjustments */
@media (max-width: 480px) {
    .container {
        padding: 0;
        height: 100vh;
        justify-content: center;
    }
    
    .card {
        border-radius: 0;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        border: none;
        padding: 24px;
    }

    #game-screen {
        justify-content: flex-start;
        padding-top: 40px;
    }

    #myBoard {
        width: 100vw !important;
        margin-left: -24px; /* Compensar padding da card no mobile */
        border-radius: 0;
    }

    h1 { font-size: 1.8rem; }
}
