@font-face {
    font-family: 'Superboys';
    src: url('./Text/SuperBoys-vmW67.ttf') format('truetype');
}

body {
    font-family: 'Superboys', sans-serif;
    background: url("./Assets/Background_Calakus.png") no-repeat center center fixed;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
    cursor: none;
    font-size: 20px;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
    /* Prevent text selection dan zoom gestures pada mobile */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

#mainMenu {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    text-shadow: 2px 2px 4px #000000;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.menu-buttons button {
    font-family: 'Superboys', sans-serif;
    font-size: 30px;
    padding: 15px 40px;
    margin: 10px;
    border-radius: 15px;
    border: 3px solid white;
    background-color: #ffc107;
    color: white;
    text-shadow: 2px 2px 4px #000000;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.3s;
    min-width: 200px;
}

.menu-buttons button:hover {
    background-color: #ffa000;
    transform: scale(1.05);
}

#currentPlayerTurn {
    font-size: 24px;
}

#pauseButton {
    font-family: 'Superboys', sans-serif;
    font-size: 25px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid white;
    background-color: #ff5722;
    color: white;
    text-shadow: 1px 1px 2px #000000;
    cursor: pointer;
    line-height: 45px; /* Vertically center the pause icon */
}

#backToMenuButton {
    font-family: 'Superboys', sans-serif;
    font-size: 20px;
    padding: 10px 20px;
    border-radius: 10px;
    border: 3px solid white;
    background-color: #f44336; /* Red color for back button */
    color: white;
    text-shadow: 1px 1px 2px #000000;
    cursor: pointer;
}

h1 {
    color: white;
    text-shadow: 2px 2px 4px #000000;
}

.status-bar-top-row {
    display: flex;
    align-items: center;
    gap: 15px; /* Jarak antara tombol kembali dan pause */
}

#board {
    width: 540px;
    height: 540px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    background: url("./Assets/soil.png");
    background-size: cover;
    border: 3px solid white;
    border-radius: 25px;
    box-shadow: 0 0 15px rgba(0,0,0,0.5);
}

#board div {
    width: 180px;
    height: 180px;
    background-image: url("./Assets/tanah.png");
    background-size: cover;
    /* Tambahkan interaktivitas untuk touch devices */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.cursor {
    height: 110px;
    width: 100px;
    position: absolute;
    top: 100px;
    left: 100px;
    background-image: url("./Assets/palu.png");
    background-size: 100% 100%;
    transform: translate(-20%, -20%);
    transition: transform .1s;
    pointer-events: none;
}

.cursor.active {
    transform: translate(-20%, -20%) rotate(-45deg);
}

#board div img {
    width: 100px;
    height: 100px;
    user-select: none;
    -moz-user-select: none;
    -webkit-user-drag: none;
    -webkit-user-select: none;
    -ms-user-select: none;
}

#gameStatus {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    flex-direction: column; /* Mengatur item secara vertikal */
    align-items: flex-start; /* Meratakan item ke kiri */
    gap: 15px; /* Menambah jarak antar elemen utama */
    color: white;
    text-shadow: 2px 2px 4px #000000;
}

#gameInfo {
    display: flex;
    flex-direction: column; /* Mengatur skor dan waktu secara vertikal */
    gap: 10px; /* Jarak antara skor dan waktu */
    align-items: flex-start; /* Meratakan teks ke kiri */
}

#gameContainer {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#startButton {
    /* This ID is no longer used for the main start button */
    display: none;
}

.popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
}

.popup-content {
    background-color: rgb(255, 251, 0);
    padding: 40px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    width: 300px;
    max-width: 80%; 
    font-size: 25px;
}

.popup-content input {
    display: block;
    margin: 10px auto;
    padding: 10px;
    width: 80%;
    border-radius: 5px;
    border: 2px solid #ccc;
    font-family: sans-serif;
}

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

.popup-buttons button {
    font-family: 'Superboys', sans-serif;
    font-size: 20px;
    padding: 10px 20px;
    border-radius: 8px;
    border: 2px solid white;
    cursor: pointer;
    text-shadow: 1px 1px 2px #000000;
}

#restartPopupButton {
    background-color: #f44336; /* Merah */
    color: white;
}

#retryButton {
    background-color: #4CAF50; /* Hijau */
    color: white;
}

#restartPopupButton:hover {
    background-color:#d32f2f;
}

#retryButton:hover {
    background-color: #388E3C;
}

/* Gaya untuk Popup Pause */
#pausePopup .popup-content {
    background-color: #03A9F4; /* Warna biru muda */
    color: white;
    border: 4px solid white;
}

/* Gaya untuk Popup Multiplayer Setup */
#multiplayerSetupPopup .popup-content {
    background: linear-gradient(135deg, #2c2c2c 0%, #1a1a1a 50%, #000000 100%);
    color: white;
    border: 4px solid #444444;
    width: 450px;
    max-width: 85%;
    padding: 35px;
    border-radius: 15px;
    box-shadow: 0 0 25px rgba(0, 0, 0, 0.9);
}

#multiplayerSetupPopup h2 {
    margin-bottom: 25px;
    font-size: 28px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

#multiplayerSetupPopup input {
    display: block;
    margin: 15px auto;
    padding: 15px;
    width: 85%;
    border-radius: 8px;
    border: 2px solid #555555;
    font-family: 'Superboys', sans-serif;
    font-size: 18px;
    background: rgba(255, 255, 255, 0.9);
    color: #333333;
    transition: all 0.3s ease;
}

#multiplayerSetupPopup input:focus {
    outline: none;
    border-color: #ffc107;
    box-shadow: 0 0 10px rgba(255, 193, 7, 0.5);
    transform: scale(1.02);
}

#multiplayerSetupPopup input::placeholder {
    color: #666666;
    font-style: italic;
}

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

#backFromMultiplayerButton {
    font-family: 'Superboys', sans-serif;
    font-size: 22px;
    padding: 12px 28px;
    border-radius: 10px;
    border: 2px solid #666666;
    cursor: pointer;
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    color: white;
    text-shadow: 1px 1px 2px #000000;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
}

#backFromMultiplayerButton:hover {
    background: linear-gradient(135deg, #d32f2f 0%, #b71c1c 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

#startMultiplayerButton {
    font-family: 'Superboys', sans-serif;
    font-size: 22px;
    padding: 12px 28px;
    border-radius: 10px;
    border: 2px solid #666666;
    cursor: pointer;
    background: linear-gradient(135deg, #4CAF50 0%, #388E3C 100%);
    color: white;
    text-shadow: 1px 1px 2px #000000;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
}

#startMultiplayerButton:hover {
    background: linear-gradient(135deg, #388E3C 0%, #2E7D32 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

#resumeButton {
    font-family: 'Superboys', sans-serif;
    font-size: 25px;
    padding: 15px 35px;
    border-radius: 10px;
    border: 3px solid white;
    cursor: pointer;
    background-color: #8BC34A; /* Warna hijau */
    color: white;
    text-shadow: 1px 1px 2px #000000;
    margin-top: 20px;
    transition: background-color 0.3s, transform 0.3s;
}

#resumeButton:hover {
    background-color: #689F38; /* Warna hijau lebih gelap */
    transform: scale(1.05);
}

/* Gaya untuk Popup Panduan */
#guidePopup .popup-content {
    background: linear-gradient(135deg, #2c2c2c 0%, #1a1a1a 50%, #000000 100%);
    color: white;
    border: 4px solid #444444;
    width: 480px; /* Lebar popup ditambah */
    padding: 25px 30px; /* Padding disesuaikan untuk mengurangi tinggi */
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
}

.guide-text {
    text-align: left;
    margin: 20px 0;
    font-size: 20px; /* Sedikit disesuaikan agar pas */
    line-height: 1.5;
}

.guide-item {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.guide-item img {
    width: 80px; /* Ukuran gambar tikus */
    height: auto;
    margin-right: 15px;
}

.guide-timer-info {
    text-align: center;
    margin-top: 20px;
    font-weight: bold;
}

.guide-text p {
    margin: 10px 0;
}

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

#backFromGuideButton {
    font-family: 'Superboys', sans-serif;
    font-size: 22px;
    padding: 12px 25px;
    border-radius: 8px;
    border: 2px solid #666666;
    cursor: pointer;
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    color: white;
    text-shadow: 1px 1px 2px #000000;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

#backFromGuideButton:hover {
    background: linear-gradient(135deg, #d32f2f 0%, #b71c1c 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

#startGameFromGuideButton {
    font-family: 'Superboys', sans-serif;
    font-size: 22px;
    padding: 12px 25px;
    border-radius: 8px;
    border: 2px solid #666666;
    cursor: pointer;
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    color: white;
    text-shadow: 1px 1px 2px #000000;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

#startGameFromGuideButton:hover {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

/* Gaya untuk Popup Notifikasi Kustom */
#customAlertPopup .popup-content {
    background-color: #2196F3; /* Warna biru */
    color: white;
    border: 4px solid white;
}

#customAlertPopup button {
    background-color: #ffc107;
    color: white;
    padding: 10px 25px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 20px;
    font-family: 'Superboys', sans-serif;
    text-shadow: 1px 1px 2px #000000;
    margin-top: 15px;
}

/* Gaya untuk Popup Settings */
#settingsPopup .popup-content {
    background-color: #4CAF50; /* Warna hijau */
    color: white;
    border: 4px solid white;
    min-width: 400px;
}

.settings-content {
    text-align: left;
    margin: 20px 0;
}

.setting-item {
    display: flex;
    align-items: center;
    margin: 15px 0;
    gap: 15px;
}

.setting-item label {
    flex: 1;
    font-weight: bold;
}

#volumeSlider {
    flex: 2;
    margin-right: 10px;
}

#volumeValue {
    font-weight: bold;
    min-width: 40px;
}

#difficultySelect {
    flex: 2;
    padding: 5px;
    border-radius: 5px;
    border: 2px solid white;
    font-size: 16px;
}

#closeSettingsButton {
    background-color: #ffc107;
    color: white;
    padding: 10px 25px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 20px;
    font-family: 'Superboys', sans-serif;
    text-shadow: 1px 1px 2px #000000;
    margin-top: 15px;
}

/* Gaya untuk Popup About */
#aboutPopup .popup-content {
    background: linear-gradient(135deg, #2c2c2c 0%, #1a1a1a 50%, #000000 100%);
    color: white;
    border: 4px solid #444444;
    width: 650px;
    max-width: 85%;
    padding: 25px;
    height: auto;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
}

.about-content {
    text-align: left;
    margin: 12px 0;
}

.about-content p {
    margin: 6px 0;
    line-height: 1.2;
    font-size: 20px;
}

#closeAboutButton {
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    color: white;
    padding: 10px 28px;
    border: 2px solid #666666;
    border-radius: 8px;
    cursor: pointer;
    font-size: 20px;
    font-family: 'Superboys', sans-serif;
    text-shadow: 1px 1px 2px #000000;
    margin-top: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

#closeAboutButton:hover {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

#customAlertPopup button:hover {
    background-color: #ffa000;
}

/* ========== MEDIA QUERIES UNTUK RESPONSIVENESS ========== */

/* Tablet dan layar sedang (768px - 1024px) */
@media screen and (max-width: 1024px) {
    body {
        font-size: 18px;
    }
    
    #board {
        width: 450px;
        height: 450px;
    }
    
    #board div {
        width: 150px;
        height: 150px;
    }
    
    #board div img {
        width: 85px;
        height: 85px;
    }
    
    .cursor {
        height: 90px;
        width: 80px;
    }
    
    .menu-buttons button {
        font-size: 26px;
        padding: 12px 35px;
        min-width: 180px;
    }
    
    .popup-content {
        width: 280px;
        padding: 30px;
        font-size: 22px;
    }
    
    #multiplayerSetupPopup .popup-content {
        width: 400px;
        padding: 30px;
    }
    
    #aboutPopup .popup-content {
        width: 550px;
    }
    
    #guidePopup .popup-content {
        width: 420px;
        padding: 20px 25px;
    }
}

/* Smartphone landscape dan tablet kecil (481px - 767px) */
@media screen and (max-width: 767px) {
    body {
        font-size: 16px;
        padding: 10px;
    }
    
    h1 {
        font-size: 32px;
        margin: 10px 0;
    }
    
    #board {
        width: 360px;
        height: 360px;
        border-radius: 20px;
    }
    
    #board div {
        width: 120px;
        height: 120px;
    }
    
    #board div img {
        width: 70px;
        height: 70px;
    }
    
    .cursor {
        height: 70px;
        width: 60px;
    }
    
    .menu-buttons button {
        font-size: 22px;
        padding: 10px 30px;
        min-width: 160px;
        margin: 8px;
    }
    
    #gameStatus {
        top: 15px;
        left: 15px;
    }
    
    #gameInfo h2 {
        font-size: 18px;
    }
    
    #backToMenuButton {
        font-size: 16px;
        padding: 8px 16px;
    }
    
    #pauseButton {
        font-size: 20px;
        width: 45px;
        height: 45px;
        line-height: 40px;
    }
    
    .popup-content {
        width: 90%;
        max-width: 350px;
        padding: 25px;
        font-size: 20px;
    }
    
    #multiplayerSetupPopup .popup-content {
        width: 90%;
        max-width: 380px;
        padding: 25px;
    }
    
    #multiplayerSetupPopup h2 {
        font-size: 24px;
    }
    
    #multiplayerSetupPopup input {
        font-size: 16px;
        padding: 12px;
    }
    
    .multiplayer-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    #aboutPopup .popup-content {
        width: 90%;
        max-width: 400px;
        padding: 20px;
    }
    
    .about-content p {
        font-size: 18px;
    }
    
    #guidePopup .popup-content {
        width: 90%;
        max-width: 380px;
        padding: 20px;
    }
    
    .guide-item {
        flex-direction: column;
        text-align: center;
        margin-bottom: 20px;
    }
    
    .guide-item img {
        width: 60px;
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    .guide-text {
        font-size: 18px;
    }
    
    .guide-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .popup-buttons {
        flex-direction: column;
        gap: 10px;
    }
}

/* Smartphone portrait (320px - 480px) */
@media screen and (max-width: 480px) {
    body {
        font-size: 14px;
        padding: 5px;
    }
    
    h1 {
        font-size: 28px;
        margin: 5px 0;
    }
    
    #board {
        width: 300px;
        height: 300px;
        border-radius: 15px;
        border: 2px solid white;
    }
    
    #board div {
        width: 100px;
        height: 100px;
    }
    
    #board div img {
        width: 60px;
        height: 60px;
    }
    
    .cursor {
        height: 60px;
        width: 50px;
    }
    
    .menu-buttons {
        gap: 10px;
    }
    
    .menu-buttons button {
        font-size: 20px;
        padding: 8px 25px;
        min-width: 140px;
        margin: 5px;
        border-radius: 12px;
    }
    
    #gameStatus {
        top: 10px;
        left: 10px;
        gap: 10px;
    }
    
    .status-bar-top-row {
        gap: 10px;
    }
    
    #gameInfo h2 {
        font-size: 16px;
    }
    
    #backToMenuButton {
        font-size: 14px;
        padding: 6px 12px;
        border-radius: 8px;
    }
    
    #pauseButton {
        font-size: 18px;
        width: 40px;
        height: 40px;
        line-height: 35px;
    }
    
    .popup-content {
        width: 95%;
        max-width: 320px;
        padding: 20px;
        font-size: 18px;
        border-radius: 8px;
    }
    
    #multiplayerSetupPopup .popup-content {
        width: 95%;
        max-width: 320px;
        padding: 20px;
    }
    
    #multiplayerSetupPopup h2 {
        font-size: 22px;
        margin-bottom: 20px;
    }
    
    #multiplayerSetupPopup input {
        font-size: 14px;
        padding: 10px;
        width: 90%;
    }
    
    .multiplayer-buttons button {
        font-size: 18px;
        padding: 10px 20px;
    }
    
    #aboutPopup .popup-content {
        width: 95%;
        max-width: 320px;
        padding: 18px;
    }
    
    .about-content p {
        font-size: 16px;
        margin: 5px 0;
        line-height: 1.3;
    }
    
    #guidePopup .popup-content {
        width: 95%;
        max-width: 320px;
        padding: 18px;
    }
    
    .guide-text {
        font-size: 16px;
        margin: 15px 0;
    }
    
    .guide-item img {
        width: 50px;
    }
    
    .guide-buttons button,
    .multiplayer-buttons button,
    .popup-buttons button {
        font-size: 16px;
        padding: 8px 18px;
    }
    
    #settingsPopup .popup-content {
        width: 95%;
        max-width: 320px;
    }
    
    .setting-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        margin: 12px 0;
    }
    
    .setting-item label {
        font-size: 16px;
    }
    
    #volumeSlider {
        width: 100%;
        margin-right: 0;
    }
    
    #difficultySelect {
        width: 100%;
        padding: 8px;
        font-size: 14px;
    }
}

/* Device dengan layar sangat kecil (max 320px) */
@media screen and (max-width: 320px) {
    #board {
        width: 270px;
        height: 270px;
    }
    
    #board div {
        width: 90px;
        height: 90px;
    }
    
    #board div img {
        width: 50px;
        height: 50px;
    }
    
    .cursor {
        height: 50px;
        width: 45px;
    }
    
    h1 {
        font-size: 24px;
    }
    
    .menu-buttons button {
        font-size: 18px;
        padding: 6px 20px;
        min-width: 120px;
    }
    
    .popup-content {
        width: 98%;
        max-width: 300px;
        padding: 15px;
        font-size: 16px;
    }
}

/* Orientasi landscape untuk smartphone */
@media screen and (max-height: 500px) and (orientation: landscape) {
    body {
        overflow-y: auto;
    }
    
    #mainMenu {
        margin: 20px 0;
    }
    
    h1 {
        font-size: 24px;
        margin: 5px 0;
    }
    
    .menu-buttons {
        gap: 8px;
    }
    
    .menu-buttons button {
        font-size: 18px;
        padding: 6px 20px;
        margin: 3px;
    }
    
    #board {
        width: 280px;
        height: 280px;
    }
    
    #board div {
        width: 93px;
        height: 93px;
    }
    
    #gameStatus {
        top: 5px;
        left: 5px;
    }
    
    #gameInfo h2 {
        font-size: 14px;
    }
    
    .popup-content {
        max-height: 90vh;
        overflow-y: auto;
    }
}
