* {
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

body {
    background-color: #f4f6f8;
    margin: 0;
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

.header {
    text-align: center;
    margin-bottom: 20px;
}

.header h1 {
    font-size: 28px;
    color: #1a237e;
    margin-bottom: 5px;
}

.header p {
    font-size: 18px;
    color: #455a64;
    font-style: italic;
    margin-top: 5px;
    margin-bottom: 10px;
}

.timer-display {
    font-size: 24px;
    font-weight: bold;
    color: #d84315;
    margin-top: 10px;
}

.game-container {
    display: flex;
    gap: 40px;
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    align-items: flex-start;
}

/* =======================================
   B?N Ð? (MAP)
   ======================================= */
.map-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.map-wrapper {
    position: relative;
    width: 360px;
    height: 560px;
    background-color: #e0f7fa;
    border: 2px dashed #00838f;
    border-radius: 10px;
    overflow: hidden;
}

#vn-map {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#cute-car {
    position: absolute;
    width: 55px;
    transition: top 1s ease-in-out, left 1s ease-in-out;
    z-index: 10;
    transform: translate(-50%, -50%);
}

.province-info h3 {
    font-size: 20px;
    margin-top: 15px;
    color: #d32f2f;
}

/* =======================================
   BÀN C? & ÐI?U KHI?N (BOARD)
   ======================================= */
.board-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-grow: 1;
}

/* Kích thu?c bàn c? to d?p trên máy tính */
.board-responsive, #board {
    width: 100% !important;
    max-width: 480px !important;
    min-width: 400px;
}

.controls {
    text-align: center;
    width: 100%;
}

.status-msg {
    font-size: 22px;
    font-weight: bold;
    color: #1565c0;
    margin-top: 20px;
    min-height: 30px;
}

#next-btn {
    padding: 12px 25px;
    font-size: 18px;
    background-color: #2e7d32;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

#next-btn:hover {
    background-color: #1b5e20;
}

/* =======================================
   VIDEO CÀY VIEW
   ======================================= */
.video-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #ffffff;
    padding: 10px;
    border: 2px solid #e0f7fa;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    z-index: 1000;
    text-align: center;
}

.video-widget p {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: #1565c0;
    font-weight: bold;
}

.video-widget iframe {
    width: 256px !important;
    height: 144px !important;
    border-radius: 8px;
}

/* =======================================
   B?NG VÀNG (LEADERBOARD)
   ======================================= */
.leaderboard-section {
    width: 250px;
    background: #fff9c4;
    border: 2px solid #fbc02d;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.leaderboard-section h3 {
    text-align: center;
    color: #c62828;
    margin-top: 0;
    font-size: 18px;
    border-bottom: 2px dashed #fbc02d;
    padding-bottom: 10px;
}

#leaderboard-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

#leaderboard-list li {
    padding: 8px 0;
    border-bottom: 1px solid #fff59d;
    font-size: 15px;
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    color: #37474f;
}

#leaderboard-list li span {
    color: #d84315;
}

#player-name {
    padding: 10px;
    font-size: 16px;
    border: 2px solid #90caf9;
    border-radius: 6px;
    outline: none;
    width: 200px;
}

#save-btn {
    padding: 10px 15px;
    font-size: 16px;
    background-color: #ff9800;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    margin-top: 10px;
}

#save-btn:hover {
    background-color: #f57c00;
}

/* =======================================
   RESPONSIVE (ÐI?N THO?I & TABLET)
   ======================================= */
@media (max-width: 1200px) {
    .game-container {
        gap: 20px;
        padding: 25px;
    }
    .map-wrapper {
        width: 300px;
        height: 480px;
    }
    #cute-car {
        width: 45px;
    }
    .leaderboard-section {
        width: 220px;
    }
}

@media (max-width: 900px) {
    body {
        padding: 10px;
    }
    .game-container {
        flex-direction: column;
        align-items: center;
        width: 100%;
        padding: 20px;
    }
    .leaderboard-section {
        width: 90%;
        max-width: 400px;
    }
    .map-wrapper {
        width: 90%;
        max-width: 360px;
        height: auto;
        aspect-ratio: 360 / 560;
    }
    #vn-map {
        height: 100%;
    }
    #cute-car {
        width: 40px;
    }
    .board-section {
        width: 100%;
    }
    .board-responsive, #board {
        width: 90% !important;
        max-width: 420px !important;
        min-width: unset; /* C?c k? quan tr?ng d? không b? tràn màn hình di?n tho?i */
    }
}

@media (max-width: 600px) {
    .header h1 {
        font-size: 22px;
    }
    .header p {
        font-size: 15px;
    }
    .status-msg {
        font-size: 18px;
    }
    #next-btn {
        font-size: 16px;
        padding: 10px 20px;
    }
    .video-widget {
        bottom: 15px;
        right: 15px;
        padding: 6px;
    }
    .video-widget iframe {
        width: 200px !important;
        height: 112px !important;
    }
}

@media (max-width: 400px) {
    .video-widget iframe {
        width: 170px !important;
        height: 96px !important;
    }
    .board-responsive, #board {
        width: 95% !important;
    }
    .leaderboard-section {
        width: 95%;
    }
}