/* Reset dan base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: -webkit-fill-available; /* iOS fix */
}

/* iOS viewport fix */
html {
    height: -webkit-fill-available;
}

.front-page {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: -webkit-fill-available; /* iOS fix */
    width: 100vw;
    text-align: center;
    background: url('MOCKUP3-06.jpg') no-repeat center center;
    background-size: cover;
    position: fixed; /* agar tidak tertutup body */
    top: 0;
    left: 0;
    z-index: 1;
}

.base-btn {
    width: 6rem;
    background-color: #a9a9ee;
    color: white;
    border: none;
    border-radius: 3rem;
    border-color: #beff86;
    border-style: solid;
    cursor: pointer;
    font-family: "KoHo", sans-serif;
    font-size: 1.2rem;
    font-weight: bold;
    transition: 0.3s ease;
    text-align: center;
    padding: 0.8rem 1rem;
}

.btn {
    position: absolute;
    bottom: 25vh; /* Perbaikan posisi tombol start */
    left: 60%;
    transform: translateX(-50%);
    padding: 1rem 3.2rem;
    background-color: #a9a9ee;
    color: white;
    border: none;
    border-radius: 3rem;
    border-color: #beff86;
    border-style: solid;
    cursor: pointer;
    font-family: "KoHo", sans-serif;
    font-size: 1.2rem;
    font-weight: bold;
    transition: 0.3s ease;
    text-align: center;
}

.btn:hover {
    background-color: #8784e7;
}

.popup-form {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    min-height: 100vh;
    min-height: -webkit-fill-available; /* iOS fix */
    background-image: url(MOCKUP1-07.jpg);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    flex-direction: column;
    justify-content: center; /* Center untuk positioning yang baik */
    align-items: center;
    padding: env(safe-area-inset-top, 2rem) 2rem env(safe-area-inset-bottom, 2rem) 2rem;
    z-index: 1000;
    display: none;
}

.popup-form .form-content {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    margin-top: -10rem;
    align-items: center;
    width: 100%;
    max-width: 400px;
}

.popup-form h1 {
    font-size: 15px;
    font-family: "KoHo", sans-serif;
    text-align: center;
    color: rgb(255, 255, 255);
    margin-bottom: 1.5rem;
    max-width: 500px;
}

#popup-form input::placeholder {
    color: white;
    font-style: italic;
}

.popup-form input {
    display: block;
    padding: 0.8rem 0; /* Increase padding for better touch target */
    width: 100%;
    max-width: 400px;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255);
    color: rgb(255, 255, 255);
    font-size: 1rem;
    outline: none;
    margin-bottom: 1.5rem; /* Increase spacing */
}

.popup-form .btn {
    font-size: 14px;
    padding: 0.8rem 2rem;
    width: 100%;
    max-width: 200px;
    background-color: #007688;
    border: 1px solid #007688;
    color: white;
    cursor: pointer;
    margin-top: 1.5rem; /* Spacing tombol kirim setelah input email */
    position: relative;
    transform: none;
    bottom: auto;
    left: auto;
}

.quiz-container {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    position: fixed;
    top: 15%; /* Posisi lebih ke atas */
    left: 50%;
    transform: translateX(-50%);
    width: 30rem;
    max-width: 85%;
    max-height: 70vh; /* untuk membatasi tinggi */
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    font-size: 10px;
    transition: .2s;
    overflow-y: auto;
}

.quiz-container .btn {
    font-size: 14px;
    position: relative;
    top: auto;
    left: auto;
    padding: 0.8rem 1rem;
    width: auto;
    min-width: 30%;
    justify-content: flex-start;
    border-color: #beff86;
    border-style: solid;
    margin-top: 10rem; /* untuk memberi jarak tombol setelah pilihan jawaban */
    transform: none;
    align-self: center; /* Center tombol */
}

#question-container {
    flex-direction: column;
    gap: 0.8rem;
}

#question {
    font-family: "KoHo", sans-serif;
    font-weight: 600;
    font-style: normal;
    font-size: 20px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 0.1rem;
}

#answer-buttons {
    font-family: "KoHo", sans-serif;
    font-weight: 500;
    font-size: 15px;
    font-style: normal;
    text-align: left;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.input-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: 44px; /* iOS minimum touch target */
}

input {
    width: fit-content;
}

.hide {
    display: none;
}

#result {
    position: fixed;
    bottom: env(safe-area-inset-bottom, 100px); /* iOS safe area */
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    font-family: "KoHo", sans-serif;
    font-weight: 400;
    font-size: 14px;
    font-style: normal;
    text-align: center;
    color: #fff;
    padding: 1rem;
    background-size: contain;
    z-index: 1001;
}

#more-info-link {
    font-size: 18px;
    font-weight: bold;
    color: #beff86;
    text-decoration: underline;
}

#share-btn {
    background-color: transparent;
    font-size: 14px;
    padding: 0.8rem 1rem; /* Increase touch target */
    cursor: pointer;
    transition: 0.3s;
    text-decoration: none;
    border: 1px solid #beff86;
    border-radius: 3rem;
    margin-right: 0.5rem;
}

#share-btn:hover {
    background-color: rgba(190, 255, 134, 0.1);
    color: #beff86;
}

#restart-btn {
    font-size: 14px;
    padding: 0.8rem 1rem;
    background-color: transparent;
    border: 1px solid #beff86; /* Perbaikan border declaration */
    border-radius: 3rem;
    margin-left: 0.5rem;
    color: #beff86; 
    cursor: pointer; 
    transition: 0.3s;
}

#restart-btn:hover {
    background-color: rgba(190, 255, 134, 0.1);
    color: #beff86;
}

/* Media queries untuk iOS devices */
@media (max-width: 430px) {
    .popup-form {
        padding: env(safe-area-inset-top, 1rem) 1.5rem env(safe-area-inset-bottom, 1rem) 1.5rem;
    }

    .popup-form .form-content {
        margin-top: -10rem; /* Kadang harus lebih kecil untuk mobile */
    }
    
    .quiz-container {
        width: 95%;
        padding: 15px;
        max-height: 65vh;
        top: 10%; /* Posisi lebih ke atas di mobile */
    }

    .quiz-container .btn {
        margin-top: 11rem; /* Penyesuaian proporsi untuk mobile */
    }
    
    #question {
        font-size: 18px;
    }
    
    #answer-buttons {
        font-size: 14px;
    }
    
    .btn {
        bottom: 20vh; /* Perbaikan posisi tombol start di mobile */
        padding: 0.8rem 2rem;
        font-size: 1rem;
    }
    
    #result {
        bottom: env(safe-area-inset-bottom, 10px);
        width: 95%;
        font-size: 13px;
    }
    
    #more-info-link {
        font-size: 16px;
    }
}

/* Media query khusus untuk iPhone dengan notch */
@media (max-width: 430px) and (orientation: portrait) {
    .front-page .btn {
        bottom: max(20vh, env(safe-area-inset-bottom, 0) + 8rem);
    }
}

/* Media query untuk landscape mode */
@media (max-width: 932px) and (orientation: landscape) {
    .popup-form {
        justify-content: flex-start;
        padding-top: max(2rem, env(safe-area-inset-top, 0) + 1rem);
    }

    .popup-form .form-content {
        margin-top: -5rem; /* Kurangi dari -10rem karena ruang landscape terbatas */
    }
    
    .quiz-container {
        max-height: 90vh;
        width: 80%;
    }
    
    #result {
        bottom: max(10px, env(safe-area-inset-bottom, 0) + 10px);
    }
}