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

body {
    font-family: 'Georgia', serif;
    background: #120904 url('https://www.transparenttextures.com/patterns/dark-wood.png');
    color: #f0e6d2;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 15px;
}

/* ==========================================
   LOBBY STYLING (index.php)
   ========================================== */

.lobby-card {
    background: linear-gradient(145deg, #42210b, #281205);
    border: 10px solid #1a0a03;
    border-radius: 16px;
    box-shadow:
        0 15px 35px rgba(0, 0, 0, 0.8),
        inset 0 2px 4px rgba(255, 255, 255, 0.15);
    padding: 30px;
    width: 100%;
    max-width: 440px;
    text-align: center;
}

.logo-title {
    color: #e5c158;
    font-size: 2.2rem;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.logo-title img, .logo-image {
    height: 50px;
    width: auto;
}

.error-msg {
    background: rgba(180, 40, 40, 0.85);
    color: #fff;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #ff4d4d;
    margin-bottom: 15px;
}

.lobby-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 15px 0;
}

.lobby-form h3 {
    color: #f3e5ab;
    text-align: left;
}

.lobby-form input[type="text"] {
    padding: 12px;
    border-radius: 6px;
    border: 2px solid #5a3318;
    background: #190a03;
    color: white;
    font-size: 1rem;
    outline: none;
}

.lobby-form input[type="text"]:focus {
    border-color: #e5c158;
}

.lobby-card hr {
    border: none;
    height: 1px;
    margin: 20px 0;
    background: linear-gradient(
        90deg,
        transparent,
        #5a3318,
        transparent
    );
}

/* Buttons */

.btn {
    padding: 12px;
    font-size: 1.05rem;
    font-weight: bold;
    font-family: 'Georgia', serif;
    border-radius: 6px;
    cursor: pointer;
    border: none;
    transition: all 0.15s ease;
}

.btn-submit {
    background: linear-gradient(
        180deg,
        #ddaa55 0%,
        #b88230 100%
    );
    color: #2a1405;
    border: 2px solid #6e4616;
    box-shadow: 0 4px 0 #4a2b0d;
}

.btn-submit:hover:not(:disabled) {
    transform: translateY(-2px);
}

.btn-join {
    background: linear-gradient(
        180deg,
        #4caf50 0%,
        #2e7d32 100%
    );
    color: white;
    border: 2px solid #1b5e20;
    box-shadow: 0 4px 0 #144917;
}

.btn-join:hover {
    transform: translateY(-2px);
}

/* ==========================================
   BOARD & GAMEPLAY
   ========================================== */

.wooden-box {
    background: linear-gradient(145deg, #42210b, #281205);
    border: 12px solid #1a0a03;
    border-radius: 18px;
    padding: 18px;
    width: 100%;
    max-width: 900px; /* Ruimer voor tablets */
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.8);
}

.game-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 7, 2, 0.6);
    padding: 10px 18px;
    border-radius: 8px;
    border: 1px solid #5a3318;
    color: #e5c158;
}

.round-badge {
    background: #c29b38;
    color: #1a0a03;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: bold;
}

.btn-leave {
    color: #ff6b6b;
    text-decoration: none;
    font-weight: bold;
}

.player-zone {
    background: rgba(0, 0, 0, 0.25);
    padding: 12px;
    border-radius: 10px;
}

.player-zone.active-turn {
    border: 2px solid #e5c158;
    box-shadow: 0 0 12px rgba(229, 193, 88, 0.4);
}

.player-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.player-info h2 {
    color: #f3e5ab;
    font-size: 1.2rem;
}

.score-container {
    display: flex;
    gap: 10px;
}

.score-board {
    background: #231207;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #4a270f;
    font-size: 0.95rem;
}

.score-board.total {
    border-color: #e5c158;
    color: gold;
}

/* Tegels Rack & Container */
.tiles-rack {
    background: #190a03;
    padding: 10px 8px;
    border-radius: 8px;
    width: 100%;
}

.tiles-container {
    display: flex;
    gap: 6px;
    justify-content: space-between;
    flex-wrap: nowrap; /* Garandeert 12 stenen op 1 rij */
    width: 100%;
}

/* Flexibele tegels die altijd schalen */
.tile {
    flex: 1;
    min-width: 0;
    max-width: 58px;
    height: 75px;
    background: linear-gradient(
        180deg,
        #ddaa55 0%,
        #b88230 100%
    );
    border: 2px solid #6e4616;
    border-radius: 6px;
    color: #2a1405;
    font-size: 1.3rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    user-select: none;
    transition: transform 0.1s ease, background 0.15s ease;
}

.tile:hover:not(.shut) {
    transform: translateY(-2px);
}

.tile.selected {
    background: linear-gradient(
        180deg,
        #ff9800 0%,
        #e65100 100%
    );
    color: white;
}

.tile.shut {
    background: #26160c;
    color: #553a27;
    cursor: not-allowed;
    border-color: #3d2212;
}

/* Vilt / Dobbel-zone */
.felt-area {
    background: radial-gradient(
        circle,
        #1a6b33 0%,
        #0d3b1b 100%
    );
    border: 6px solid #2d1608;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.turn-indicator {
    font-size: 1.1rem;
    font-weight: bold;
}

.selection-tracker {
    font-size: 0.95rem;
    color: #d2f8d2;
}

.felt-area .btn-submit:disabled {
    background: #4a5a4d;
    border-color: #333;
    color: #888;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* Highscore Box */
.highscore-box {
    margin-top: 10px;
    width: 100%;
}

.highscore-box h3 {
    color: #e5c158;
    text-align: center;
    margin-bottom: 6px;
    font-size: 1rem;
}

.highscore-top3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    width: 100%;
}

.highscore-card {
    background: rgba(0,0,0,.20);
    border: 1px solid #e5c158;
    border-radius: 8px;
    padding: 6px;
    text-align: center;
    min-height: 65px;
}

.highscore-rank {
    color: gold;
    font-size: 0.95rem;
    font-weight: bold;
}

.highscore-player {
    color: #f3e5ab;
    font-size: 0.85rem;
    margin-top: 2px;
}

.highscore-score {
    color: #d2f8d2;
    font-size: 0.95rem;
    font-weight: bold;
}

/* ==========================================
   TABLET & MOBILE RESPONSIVE MEDIA QUERIES
   ========================================== */

@media (max-width: 768px) {
    body {
        padding: 8px;
    }

    .wooden-box {
        border-width: 8px;
        padding: 12px;
        gap: 10px;
    }

    .tiles-container {
        gap: 3px; /* Smaller gat tussen tegels voor tablets */
    }

    .tile {
        height: 60px;
        font-size: 1.1rem;
        border-width: 1px;
    }

    .player-info h2 {
        font-size: 1rem;
    }

    .score-board {
        font-size: 0.85rem;
        padding: 3px 6px;
    }

    .felt-area {
        padding: 15px 10px;
    }
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: #2b1810;
    border: 3px solid #8b5a2b;
    border-radius: 12px;
    padding: 25px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    color: #f5e6d3;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.8);
}

.modal-content h3 {
    margin-top: 0;
    color: #e6b800;
}

.modal-buttons {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 15px;
}