:root {
    --bg-color: #0b0c10;
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f0f0f5;
    --text-muted: #8a8b98;
    --neon-purple: #a855f7;
    --neon-green: #4CAF50;
    --grid-line: rgba(255, 255, 255, 0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: radial-gradient(circle at center, #1a1b26 0%, var(--bg-color) 100%);
    height: 100vh;
    overflow: hidden;
    color: var(--text-primary);
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* Główny kontener dzielący ekran */
.gra-wrapper {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* LEWY PANEL STATYSTYK */
.stats-panel {
    width: 300px;
    background: rgba(15, 16, 22, 0.7);
    border-right: 1px solid var(--card-border);
    backdrop-filter: blur(20px);
    padding: 40px 25px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    z-index: 10;
    box-shadow: 5px 0 25px rgba(0, 0, 0, 0.4);
}

.panel-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 2px solid var(--neon-purple);
    padding-bottom: 15px;
    margin-bottom: 10px;
}

.panel-header i {
    color: var(--neon-purple);
}

.stat-box {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 15px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-label i {
    margin-right: 5px;
    width: 15px;
}

.stat-value {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
}

.text-glow {
    color: var(--neon-purple);
    text-shadow: 0 0 10px rgba(168, 85, 247, 0.4);
}

/* Przyciski w panelu */
.panel-buttons {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#menu-btn, .reset-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

#menu-btn {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
}

#menu-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.reset-btn {
    background: linear-gradient(135deg, #6366f1 0%, var(--neon-purple) 100%);
    border: none;
    color: white;
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3);
}

.reset-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(168, 85, 247, 0.5);
}

/* PRAWY PANEL — PLANSZA */
.board-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.1);
}

table {
    border-collapse: separate;
    border-spacing: 6px; /* Odstępy między kafelkami nadają głębi */
    background: rgba(255, 255, 255, 0.01);
    padding: 12px;
    border-radius: 16px;
    border: 1px solid var(--card-border);
    box-shadow: 0 20px 50px rgba(0,0,0,0.4);
}

td {
    width: 58px;
    height: 58px;
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

/* Hover nieodkrytego kafelka */
td:not(.tileClicked):hover {
    background-color: rgba(168, 85, 247, 0.15);
    border-color: var(--neon-purple);
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.3);
    transform: scale(1.04);
}

/* Styl po odkryciu kafelka */
.tileClicked {
    background-color: rgba(76, 175, 80, 0.15) !important;
    border-color: var(--neon-green) !important;
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.2);
    cursor: default;
}

td img {
    display: block;
    margin: 0 auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 5px rgba(0,0,0,0.5));
    animation: flipIn 0.25s ease-out forwards;
}

@keyframes flipIn {
    from { transform: scale(0.6) rotateY(90deg); opacity: 0; }
    to { transform: scale(1) rotateY(0deg); opacity: 1; }
}

/* Responsywność dla małych ekranów */
@media (max-width: 900px) {
    .gra-wrapper {
        flex-direction: column;
        overflow-y: auto;
    }
    .stats-panel {
        width: 100%;
        height: auto;
        padding: 20px;
        border-right: none;
        border-bottom: 1px solid var(--card-border);
    }
    .panel-buttons {
        flex-direction: row;
    }
    table {
        transform: scale(0.9); /* Zmniejszenie siatki na mniejszych ekranach */
    }
}

@media (max-width: 600px) {
    table {
        transform: scale(0.75);
        margin-top: -50px;
    }
    .panel-buttons {
        width: 100%;
    }
}