body {
    background-color: #2c3e50;
    color: white;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    padding: 10px; /* Kisebb padding mobilon */
    box-sizing: border-box; /* Fontos a reszponzivitáshoz */
}

/* FŐ KONTÉNER */
#game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
    max-width: 1200px;
}

h1 { margin: 0; text-transform: uppercase; letter-spacing: 2px; text-align: center; }

/* ELRENDEZÉS (Desktop: 3 oszlop, Mobil: 1 oszlop) */
.game-layout {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start; /* Hogy felülre igazodjanak */
    gap: 20px;
    width: 100%;
}

.center-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    /* Alapból fix, de mobilon rugalmas lesz */
}

/* TÁBLA (Reszponzív) */
.board {
    display: grid;
    grid-template-columns: repeat(8, 1fr); /* % alapú szélesség */
    grid-template-rows: repeat(8, 1fr);
    border: 5px solid #4a3b2a;
    background-color: #4a3b2a;
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    
    /* Desktop méret */
    width: 480px; 
    height: 480px;
}

.square {
    /* Nem fix pixel, hanem kitölti a rácsot */
    width: 100%; 
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    /* Betűméret dinamikus */
    font-size: 2.5rem; 
    cursor: pointer;
    position: relative;
    user-select: none;
}

.white-square { background-color: #eeeed2; color: black; }
.black-square { background-color: #769656; color: white; }

/* RAKTÁRAK (Reszponzív) */
.reserve-area {
    background-color: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 8px;
    width: 100%; /* Kitölti a szülő konténert */
    max-width: 480px; /* De nem szélesebb a táblánál */
    text-align: center;
    box-sizing: border-box;
}

.piece-selector {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 5px;
}

.reserve-btn {
    background-color: #444;
    border: 1px solid #666;
    color: white;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 16px;
    border-radius: 4px;
    transition: all 0.2s;
    /* Mobilon jobb érintés */
    touch-action: manipulation;
}

.reserve-btn:hover { background-color: #555; }
.reserve-btn.selected { 
    background-color: #e67e22; 
    border-color: #d35400; 
    transform: scale(1.05);
}
.reserve-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* LEÜTÖTT BÁBUK (Oldalsávok) */
.captured-area {
    background-color: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: 8px;
    width: 200px;
    min-height: 100px; /* Mobilon ne legyen túl magas üresen */
    text-align: center;
}

.captured-pieces {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: center;
    font-size: 24px;
    margin-top: 10px;
}

#status {
    font-size: 18px;
    font-weight: bold;
    color: #f1c40f;
    min-height: 30px;
    text-shadow: 1px 1px 2px black;
    margin-top: 10px;
    text-align: center;
}

.piece {
    pointer-events: none;
    /* Mobilon is látható méret */
    font-size: 100%; 
    line-height: 1;
    filter: drop-shadow(1px 1px 1px rgba(0,0,0,0.5));
}

.rules-box {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
    margin-top: 20px;
    width: 100%;
    max-width: 800px;
    box-sizing: border-box;
}

/* --- MEDIA QUERIES (A Lényeg!) --- */

/* Tablet és Mobil (Kisebb mint 1024px) */
@media (max-width: 1024px) {
    .game-layout {
        /* Egymás alá kerüljenek az elemek */
        flex-direction: column; 
        align-items: center;
    }

    /* A leütött bábuk dobozai vízszintesen legyenek, ne függőlegesen */
    .captured-area {
        width: 90%;
        max-width: 480px;
        min-height: auto;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    .captured-pieces {
        margin-top: 0;
    }
    
    /* Sorrend: Felső Raktár -> Tábla -> Alsó Raktár -> Leütöttek */
    .center-area {
        order: 1; /* Ez legyen legfelül */
        width: 100%;
    }
    #captured-white { order: 2; }
    #captured-black { order: 3; }
}

/* Mobil (Kisebb mint 600px) */
@media (max-width: 600px) {
    .board {
        /* A tábla legyen akkora, mint a képernyő szélessége mínusz margó */
        width: 90vw; 
        height: 90vw; /* Négyzet alakú maradjon */
    }

    .square {
        font-size: 10vw; /* A bábuk mérete is skálázódjon a képernyőhöz */
    }

    .reserve-btn {
        padding: 5px 8px;
        font-size: 14px; /* Kisebb gombok, hogy elférjenek */
    }

    h1 { font-size: 24px; }
    #status { font-size: 16px; }
}
/* ... a fájl eleje marad változatlan ... */

/* --- MENÜ OVERLAY (EZ HIÁNYZOTT) --- */
#menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.menu-box {
    background-color: #34495e;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    border: 2px solid #f1c40f;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    width: 300px;
    color: white;
}

.menu-btn {
    background-color: #e67e22;
    color: white;
    border: none;
    padding: 10px 20px;
    margin: 10px 0;
    border-radius: 5px;
    font-size: 18px;
    cursor: pointer;
    width: 100%;
    transition: 0.2s;
}

.menu-btn:hover { background-color: #d35400; }

.join-section {
    margin-top: 15px;
    border-top: 1px solid #7f8c8d;
    padding-top: 15px;
}

#join-code-input {
    padding: 10px;
    width: 70%;
    border-radius: 5px;
    border: 1px solid #ccc;
    text-align: center;
    font-size: 16px;
    margin-bottom: 10px;
}

/* Játékos infó doboz stílusa */
#online-info {
    background: rgba(0,0,0,0.5);
    padding: 5px 10px;
    border-radius: 5px;
}