/* --- Global & Containers --- */
.page-id-264 header {
    display: none;
}
#ast-scroll-top {
    display: none !important;
}
body {
    background: #0f172a !important;
    padding-top: 50px;
    padding-bottom: 20px;
    font-family: sans-serif;
    overflow: hidden; /* Tambahkan ini agar tidak ada scroll global */
}

* {
    -webkit-user-select: none; /* Safari */
    -ms-user-select: none; /* IE 10 dan Edge */
    user-select: none; /* Standar (Chrome, Firefox, Opera) */
}

.container-2 {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    width: calc(100% - 40px);
    max-width: 400px;
    height: 5vh;
    padding: 0;
    align-items: center;
    box-sizing: border-box;
    background-color: #0f172a;
}

.container-1A {
    position: fixed;
    top: 2vh;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    width: calc(100% - 40px);
    max-width: 400px;
    height: 1.2vh;
    padding: 0;
    align-items: center;
    box-sizing: border-box;
    background-color: #334155; /* Changed to a dark slate for better contrast, or keep yellow if you prefer */
    border-radius: 10px;
    overflow: hidden;
}

.container-1B {
    width: 0%;
    height: 100%;
    background-color: #77c9f8;
    border-radius: 10px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-bar-segment {
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-stats {
    position: fixed;
    top: 3.5vh;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 40px);
    max-width: 400px;
    display: flex;
    justify-content: space-between;
    padding: 0 5px;
    color: #77c9f8;
    font-size: 12px;
    font-weight: bold;
    z-index: 10000;
    box-sizing: border-box;
}

.container0 {
    position: fixed;
    top: 6.5vh;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    justify-content: space-between;
    width: calc(100% - 40px);
    max-width: 400px;
    height: 11vmin;
    padding: 10px;
    border-radius: 8px 8px 0 0;
    align-items: center;
    background-color: #65799c;
    box-sizing: border-box;
}
.container0A {
    display: flex;
    flex-grow: 1;
}
.container0B {
    display: flex;
    gap: 3vmin;
}

.container1 {
    position: fixed; /* Ubah dari relative ke fixed */
    top: calc(6.5vh + 11vmin); /* Mulai di bawah container0 */
    bottom: 20vh; /* Berakhir di atas container2 */
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* Ubah dari center agar margin auto bisa bekerja */
    width: calc(100% - 40px);
    max-width: 400px;
    padding: 6vh 10px 9vh 10px;
    background-color: #20263b;
    border-radius: 0 0 15px 15px;
    box-sizing: border-box;
    overflow-y: auto; /* Akan dikontrol via JS (no-overflow) */
    overflow-x: hidden; /* Mencegah scroll horizontal */
    transition: background-color 0.5s ease, transform 0.5s ease;
    scrollbar-width: thin;
    scrollbar-color: #65799c transparent;
    z-index: 5;
    touch-action: pan-y;
}

.container1.no-overflow {
    overflow-y: hidden !important;
}

.container1.is-open {
    overflow-y: auto !important;
}

.container1::-webkit-scrollbar {
    width: 4px;
}

.container1::-webkit-scrollbar-thumb {
    background: #65799c;
    border-radius: 10px;
}

.containerA {
    display: flex;
    align-items: center;
}

/* --- Teks & Kartu --- */
.box1 {
    width: 100%;
    color: white;
    text-align: center;
    box-sizing: border-box;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    overflow-wrap: anywhere;
    word-break: break-all;
    flex-shrink: 0;
}

#front-text {
    font-size: 50px;
    min-height: auto;
    line-height: 1.2;
    justify-content: center;
    margin-top: auto; /* Pusatkan secara vertikal */
    margin-bottom: auto;
    transition: none; /* Pastikan tidak ada transisi saat menutup */
}

.box3 {
    justify-content: right;
    display: flex;
    flex-shrink: 0;
}

/* Penyesuaian Front-Text saat terbuka agar rapat ke atas */
.container1.is-open #front-text {
    min-height: 120px !important;
    justify-content: flex-end !important;
    padding-bottom: 20px;
    margin-top: 0;
    margin-bottom: 0;
    /* Transisi HANYA saat dibuka */
    transition: 
        margin 0.7s cubic-bezier(0.4, 0, 0.2, 1),
        padding 0.7s cubic-bezier(0.4, 0, 0.2, 1),
        min-height 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Elemen yang Beranimasi (Sliding) --- */
.box2,
#back-text,
#btn-hide {
    opacity: 0;
    visibility: hidden;
    position: relative;
    max-height: 0;
    overflow: hidden;
    transform: translateY(150px);
    transition: none; /* Tidak ada transisi saat menutup */
}

/* Kondisi Aktif Sliding */
.container1.is-open .box2,
.container1.is-open #back-text,
.container1.is-open #btn-hide {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    max-height: 2000px;
    /* Transisi HANYA saat muncul (buka) */
    transition:
        transform 0.8s cubic-bezier(0.16, 1, 0.3, 1),
        opacity 0.5s ease,
        max-height 0.8s cubic-bezier(0.16, 1, 0.3, 1),
        visibility 0.8s,
        margin 0.8s ease;
}

#back-text {
    font-size: 30px;
    height: auto !important;
    display: block !important;
    min-height: 0 !important;
    padding: 0; /* Reset saat tertutup */
    justify-content: flex-start !important;
    line-height: 1.2;
}

.container1.is-open #back-text {
    padding: 10px;
}

#phonetic-back:empty {
    display: none !important;
}

.box2 {
    width: 90%;
    max-width: 360px;
    height: 2px !important;
    background-color: white;
    margin: 0 auto !important; /* Reset saat tertutup */
    display: block !important;
    flex-shrink: 0;
    line-height: 0;
}

.container1.is-open .box2 {
    margin: 10px auto !important;
}

/* --- Lain-lain --- */
.boxP {
    width: 8vmin;
    height: 8vmin;
    border: 2px solid white;
    border-radius: 50%;
    background-color: #20263b;
    color: white;
    font-size: 3vmin;
    display: flex;
    align-items: center;
    justify-content: center;
}

.container2 {
    position: fixed;
    bottom: 10vh;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: grid;
    grid-template-areas: "stack";
    width: 100%;
    max-width: 400px;
    height: 10vh;
    justify-content: center;
    align-items: center;
    background-color: #0f172a;
}
.containerA,
.containerB {
    grid-area: stack;
}
.containerB {
    width: 350px;
    display: none;
    gap: 25px;
}
.boxA {
    width: 100px;
    height: 6vh;
    background-color: #65799c;
    border-radius: 8px;
    text-align: center;
    align-content: center;
    font-weight: bold;
}
#btnBuka {
    width: 350px;
}
#btnLupa {
    background-color: #7d3339;
    color: white;
}
#btnLumayan {
    background-color: #d4de47;
}
#btnIngat {
    background-color: #59942c;
    color: white;
}

/* Overlay latar belakang gelap transparan */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6); /* Efek gelap di belakang */
    backdrop-filter: blur(13px);
    display: none; /* Sembunyi di awal */
    justify-content: center;
    align-items: center;
    z-index: 10000; /* Lebih tinggi dari container0 dan container2 */
    animation: fadeIn 0.3s ease-out;
}

/* Kotak di tengah */
.modal-content {
    background-color: rgba(15, 23, 42, 0.95);
    color: white;
    width: 90%;
    max-width: 350px;
    height: 70vh; /* Ukuran jendela tetap sesuai permintaan */
    padding: 20px;
    border-radius: 15px;
    position: relative;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    border: 2px solid #9dabb3;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    /*# animasi*/
    animation: zoomIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    transform: translateY(-10%);
}

/* Tombol X di pojok kanan */
.close-button {
    position: absolute;
    top: -10px;
    right: 5px;
    font-size: 36px;
    cursor: pointer;
    color: white;
    font-weight: bold;
    z-index: 10;
}

.close-button:hover {
    color: #ef4444; /* Berubah merah saat hover */
}

.modal-body {
    flex-grow: 1;
    overflow-y: auto; /* Aktifkan scroll vertikal */
    padding-right: 10px;
    margin-top: 10px;
    scrollbar-width: thin;
    scrollbar-color: #9dabb3 transparent;
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-thumb {
    background-color: #9dabb3;
    border-radius: 10px;
}

#btnHelpMemorize * {
    pointer-events: none;
}

/* Animasi memudar untuk latar (overlay) */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.container3 {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 40px);
    max-width: 400px;
    display: flex;
    justify-content: flex-end;
    z-index: 10000;
    pointer-events: none; /* Allow clicking through the container */
}

#btnNextShuffle {
    pointer-events: auto; /* Enable clicking on the button */
    align-items: center;
    justify-content: center;
}

#btnShuffle.active {
    background-color: #77c9f8;
    color: #0f172a;
}

/* Animasi muncul mengecil ke besar untuk kotak (content) */
@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-5%);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(-10%);
    }
}
