/* =========================================================
   RESPONSIVE GLOBAL - COMPUTATIONAL THINKING GAMES
   ========================================================= */


/* ---------------------------------------------------------
   HELPER GLOBAL
   --------------------------------------------------------- */

.mobile-separator {
    display: none;
}

.header-inner,
.brand-wrap,
.header-status,
.status-pill,
.option-card,
.option-content,
.option-illustration {
    min-width: 0;
}

.option-card {
    overflow: hidden;
}


/* ---------------------------------------------------------
   PROTEKSI GAMBAR OPTION - ABSTRACTION
   Berlaku di semua ukuran supaya SVG/gambar tidak keluar kartu.
   --------------------------------------------------------- */

.options-area.image-mode {
    min-width: 0;
}

.options-area.image-mode .image-option {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.options-area.image-mode .option-illustration {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.options-area.image-mode .option-illustration svg,
.options-area.image-mode .option-illustration img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain;
}


/* =========================================================
   TABLET / HP
   Navbar TETAP SATU BARIS:
   [Logo + Judul] [Stage] [Kesulitan] [Home]
   ========================================================= */

@media (max-width: 640px) {

    /* ---------- HEADER ---------- */

    header {
        padding: 7px 8px !important;
    }

    .header-inner {
        width: 100%;
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 5px !important;
    }

    /* Logo + judul mengambil sisa ruang */
    .brand-wrap {
        flex: 1 1 auto;
        width: auto !important;
        justify-content: flex-start !important;
        gap: 5px !important;
        overflow: hidden;
    }

    header .brand-logo {
        height: 22px !important;
        width: auto !important;
        max-width: 72px !important;
        flex: 0 1 auto;
        object-fit: contain;
    }

    header h1 {
        min-width: 0;
        margin: 0 !important;
        font-size: clamp(11px, 3.35vw, 16px) !important;
        line-height: 1.05 !important;
        letter-spacing: 0 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis;
    }

    /* ---------- STATUS ---------- */

    .header-status {
        flex: 0 0 auto;
        width: auto !important;
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: flex-end !important;
        gap: 4px !important;
    }

    /*
       Teks Stage/Kesulitan disembunyikan.
       Yang terlihat: ICON : ANGKA
    */
    .status-pill .status-label {
        display: none !important;
    }

    .status-pill .mobile-separator {
        display: inline !important;
        margin: 0 1px;
        font-weight: 700;
    }

    .status-pill {
        flex: 0 0 auto;
        width: auto !important;
        min-width: 42px;
        height: 29px;
        padding: 4px 6px !important;
        border-radius: 999px !important;

        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;

        font-size: 10px !important;
        line-height: 1 !important;
        white-space: nowrap !important;
    }

    .status-pill i {
        margin: 0 1px 0 0 !important;
        font-size: 9px !important;
        flex: 0 0 auto;
    }

    /*
       Agar Stage tampil compact:
       icon : 1
       Total /6 disembunyikan pada HP.
    */
    .status-pill .stage-total {
        display: none !important;
    }

    .back-icon-btn {
        flex: 0 0 29px !important;
        width: 29px !important;
        height: 29px !important;
        font-size: 11px !important;
    }

    .header-progress {
        margin-top: 6px !important;
    }

    .progress-track {
        height: 5px !important;
    }


    /* ---------- AREA GAME UMUM ---------- */

    .game-main {
        padding: 8px !important;
    }

    .instruction-card {
        padding: 8px 10px !important;
        margin-bottom: 8px !important;
        border-radius: 10px !important;
    }

    .instruction-card > div {
        margin-bottom: 3px !important;
    }

    .instruction-card h2 {
        font-size: 12px !important;
    }

    .instruction-card .fa-info-circle {
        font-size: 13px !important;
    }

    .instruction-card p {
        font-size: 9px !important;
        line-height: 1.3 !important;
    }

    .play-card {
        padding: 9px !important;
        border-radius: 12px !important;
    }


    /* ---------- ABSTRACTION: JUDUL & PERTANYAAN ---------- */

    .question-badge {
        padding: 3px 7px !important;
        margin-bottom: 4px !important;
        font-size: 8px !important;
    }

    .question-head h2 {
        margin-bottom: 3px !important;
        font-size: 12px !important;
    }

    .question-text {
        font-size: 10px !important;
        line-height: 1.3 !important;
    }


    /* ---------- ABSTRACTION: OPTION TEKS ---------- */

    .options-area {
        min-width: 0 !important;
        margin-top: 8px !important;
        gap: 6px !important;
    }

    .options-area.text-mode {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        align-content: start !important;
    }

    .options-area.text-mode .option-card {
        width: 100% !important;
        min-width: 0 !important;
        min-height: 58px !important;
        padding: 7px !important;
    }

    .option-content {
        min-width: 0 !important;
        gap: 5px !important;
        font-size: 9px !important;
        line-height: 1.25 !important;
    }

    .option-content > span:last-child {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .option-letter {
        width: 22px !important;
        height: 22px !important;
        flex: 0 0 22px !important;
        font-size: 8px !important;
    }


    /* ---------- ABSTRACTION: OPTION GAMBAR ---------- */

    .options-area.image-mode {
        /*
           Tetap 2 kolom agar rapi dan tidak terlalu panjang.
           Setiap gambar terkunci di dalam kartunya.
        */
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        grid-template-rows: none !important;
        align-content: start !important;
        gap: 6px !important;
    }

    .options-area.image-mode .image-option {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;

        display: flex !important;
        flex-direction: column !important;

        padding: 5px !important;
        overflow: hidden !important;
    }

    .options-area.image-mode .option-illustration {
        flex: 0 0 auto !important;
        width: 100% !important;
        height: auto !important;

        /*
           Rasio ini menjaga gambar tetap besar tetapi
           tidak keluar dari option.
        */
        aspect-ratio: 16 / 9 !important;

        min-height: 0 !important;
        max-height: none !important;

        margin: 0 0 5px 0 !important;
        border-radius: 7px !important;
        overflow: hidden !important;
    }

    .options-area.image-mode .option-illustration svg,
    .options-area.image-mode .option-illustration img {
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
        object-fit: contain !important;
    }

    .options-area.image-mode .option-content {
        width: 100% !important;
        min-height: 26px !important;
        padding: 1px 2px !important;

        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-start !important;

        text-align: left !important;
        font-size: 8.5px !important;
    }


    /* ---------- POPUP ---------- */

    #feedback-modal {
        padding: 12px !important;
    }

    #feedback-modal > div {
        padding: 20px !important;
        max-width: 390px !important;
    }

    .result-icon {
        width: 56px !important;
        height: 56px !important;
        margin-bottom: 10px !important;
        font-size: 27px !important;
    }
}


/* =========================================================
   HP KECIL
   Tetap SATU BARIS.
   ========================================================= */

@media (max-width: 420px) {

    header {
        padding-left: 6px !important;
        padding-right: 6px !important;
    }

    .header-inner {
        gap: 3px !important;
    }

    .brand-wrap {
        gap: 3px !important;
    }

    header .brand-logo {
        height: 19px !important;
        max-width: 54px !important;
    }

    header h1 {
        font-size: clamp(9.5px, 3vw, 12px) !important;
    }

    .header-status {
        gap: 3px !important;
    }

    .status-pill {
        min-width: 37px !important;
        height: 27px !important;
        padding: 3px 4px !important;
        font-size: 9px !important;
    }

    .status-pill i {
        font-size: 8px !important;
    }

    .back-icon-btn {
        flex-basis: 27px !important;
        width: 27px !important;
        height: 27px !important;
        font-size: 10px !important;
    }

    .options-area.image-mode .option-content {
        font-size: 8px !important;
    }
}


/* =========================================================
   HP SANGAT KECIL (sekitar 320–340 px)
   Judul boleh lebih kecil, tetapi tetap SATU BARIS.
   Semua status tetap terlihat.
   ========================================================= */

@media (max-width: 340px) {

    header {
        padding-left: 4px !important;
        padding-right: 4px !important;
    }

    header .brand-logo {
        height: 17px !important;
        max-width: 43px !important;
    }

    header h1 {
        font-size: 8.5px !important;
    }

    .status-pill {
        min-width: 34px !important;
        height: 25px !important;
        padding: 2px 3px !important;
        font-size: 8px !important;
    }

    .status-pill i {
        font-size: 7px !important;
    }

    .back-icon-btn {
        flex-basis: 25px !important;
        width: 25px !important;
        height: 25px !important;
        font-size: 9px !important;
    }

    .options-area.text-mode {
        gap: 4px !important;
    }

    .options-area.text-mode .option-card {
        padding: 5px !important;
    }
}


/* =========================================================
   LAYAR PENDEK / LANDSCAPE
   ========================================================= */

@media (max-height: 650px) {

    header {
        padding-top: 4px !important;
        padding-bottom: 4px !important;
    }

    .header-progress {
        margin-top: 3px !important;
    }

    .progress-track {
        height: 4px !important;
    }

    .game-main {
        padding-top: 5px !important;
        padding-bottom: 5px !important;
    }

    .instruction-card {
        display: none !important;
    }

    .play-card {
        padding-top: 6px !important;
        padding-bottom: 6px !important;
    }

    .options-area {
        margin-top: 5px !important;
    }

    /*
       Pada landscape, dua gambar tetap berdampingan
       dan dibatasi agar tidak mendorong teks keluar.
    */
    .options-area.image-mode .option-illustration {
        aspect-ratio: 2 / 1 !important;
    }
}
