#toaB-game-wrapper {
    display: flex;
    font-family: Arial, sans-serif;
    
    /* 1. Kích thước chuẩn chỉnh */
    width: 100%;
    max-width: 1500px;
    height: 100%; /* Thêm chiều cao để game kéo dài xuống lấp đầy màn hình */
    
    /* 2. Bộ 4 dòng ma thuật giúp căn giữa TUYỆT ĐỐI trên mọi màn hình */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    
    background: #f4f7f6;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3); /* Làm bóng viền đậm hơn cho nổi bật */
    overflow: hidden;
}

/* Phần hiển thị thẻ bài (2/3) */
#board-section {
    flex: 3;
    padding: 20px 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    border-right: 2px solid #ddd;
    overflow-y: auto;
}

#grid-container {
    display: grid;
    gap: 12px;
    width: 100%;
    max-width: 1000px;
    margin-top: 15px;
    padding-bottom: 30px;
}

/* Cấu hình các loại thẻ */
.card {
    perspective: 1000px;
    cursor: pointer;
    min-height: 90px;
}

.card-inner {
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    position: relative;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    border-radius: 8px;
}

.card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    width: 100%;
    height: 100%;
    position: absolute;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    text-align: center;
    padding: 5px;
    box-sizing: border-box;
    font-size: 14px;
    font-weight: bold;
}

/* Front là mặt úp (lúc chơi) */
.card-front {
    background-color: #2b6cb0;
    color: white;
    font-size: 24px;
}

/* Back là mặt ngửa (chứa tên môn) */
.card-back {
    background-color: #fff;
    color: #333;
    transform: rotateY(180deg);
    border: 2px solid #2b6cb0;
    font-size: 14px;
    flex-direction: column;
    gap: 8px;
}

.subject-id {
    font-size: 16px;
    font-weight: bold;
}

.subject-name {
    font-size: 12px;
    font-weight: normal;
    line-height: 1.3;
}

.card.wrong .card-back {
    background-color: #feb2b2;
    border-color: #e53e3e;
}

.card.matched .card-back {
    background-color: #c6f6d5;
    border-color: #38a169;
    opacity: 0.7;
}

/* Phần hiển thị Wishlist và UI (1/3) */
#ui-section {
    flex: 1;
    padding: 20px;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    min-width: 250px; /* Đảm bảo wishlist không bị ép quá nhỏ trên màn hình */
    overflow-y: auto;
}

.status-bar {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px dashed #ccc;
}

.status-bar h2 {
    margin: 0 0 10px 0;
    font-size: 18px;
    color: #2d3748;
}

#toaB-game-wrapper .highlight {
    color: #e53e3e;
    font-weight: bold;
}

#wishlist-container {
    flex-grow: 1;
}

#wishlist-container h3 {
    margin-top: 0;
    color: #2b6cb0;
}

.wishlist-item {
    background: #edf2f7;
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 5px;
    font-size: 14px;
    border-left: 4px solid #2b6cb0;
    transition: all 0.3s;
}

.wishlist-item.found {
    text-decoration: line-through;
    color: #a0aec0;
    background: #f7fafc;
    border-left-color: #48bb78;
}

#msg-overlay {
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    color: #2b6cb0;
    margin-top: 15px;
    min-height: 25px;
}

/* --- BẢNG HƯỚNG DẪN TÒA B --- */
/* Màn hình nền mờ bao trùm */
#toa-b #instruction-screen-toa-b {
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background-color: rgba(244, 247, 246, 0.98);
    font-family: Arial, sans-serif;
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center;
    color: #333; 
    z-index: 105;
}

/* Hộp nội dung hướng dẫn */
#toa-b .instruction-box {
    background: #ffffff; /* Nền trắng sáng */
    padding: 30px 40px;
    border-radius: 12px;
    border: 2px solid #2b6cb0; /* Viền xanh chuẩn Tòa B */
    margin-bottom: 30px;
    text-align: left;
    width: 90%;
    max-width: 600px;
    max-height: 60vh; /* Giữ ở mức 60vh để chừa chỗ cho Nút bấm bên dưới */
    overflow-y: auto; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.05); /* Bóng đổ nhẹ nhàng */
}

/* Định dạng chữ bên trong hộp */
#toa-b .instruction-box p { 
    font-size: 1.2rem; 
    line-height: 1.6; 
    margin-bottom: 15px; 
    color: #2d3748;
}

#toa-b .instruction-box b { 
    color: #2b6cb0; /* Nhấn mạnh bằng màu Xanh dương */
}

#toa-b .instruction-box hr { 
    border: none;
    border-top: 1px dashed #cbd5e0; 
    margin: 20px 0;
}

/* Dòng cảnh báo trừ điểm */
#toa-b .instruction-box .text-danger { 
    color: #e53e3e !important; 
    font-weight: bold; 
}

/* Trang trí thêm thanh cuộn cho hợp tone Tòa B */
#toa-b .instruction-box::-webkit-scrollbar {
    width: 8px;
}
#toa-b .instruction-box::-webkit-scrollbar-thumb {
    background: #2b6cb0; 
    border-radius: 4px;
}