/* DAFTAR FONT */
/* Mengganti Negrito menjadi Chewy */
@font-face { font-family: 'Chewy'; src: url('assets/font/Chewy-Regular.ttf'); }
@font-face { font-family: 'InterBold'; src: url('assets/font/Inter_18pt-Bold.ttf'); }

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'InterBold', sans-serif;
    background: url('assets/images/bg-utama.png') no-repeat center center fixed;
    background-color: #fdf5e6;
    background-size: cover;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* PENGATURAN LAYAR UTAMA */
.screen { 
    width: 100vw; 
    height: 100vh; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
    position: absolute; 
    top: 0; 
    left: 0; 
}
.hidden { display: none !important; }

/* NAVBAR ATAS (LOGO & TIMER) */
.top-nav {
    position: absolute;
    top: 30px;
    width: 90%;
    display: flex;
    justify-content: space-between;
    align-items: center; 
    z-index: 10;
}

/* Top Nav khusus Homepage */
.top-nav-homepage {
    justify-content: space-between;
    width: 95%;
    padding: 0 20px;
}

.logo-homepage-left {
    width: 80px;
    object-fit: contain;
}

.logo-homepage-right {
    width: 180px;
    object-fit: contain;
}

.logo-kiri, .logo-kanan { width: 80px; object-fit: contain; }
.logo-kiri-kecil { width: 180px; object-fit: contain; }
.logo-tengah-kecil { width: 150px; object-fit: contain; }

/* KOTAK KONTEN UMUM */
.container-box {
    border: 6px solid #14532d;
    border-radius: 30px;
    background-color: rgba(255, 250, 240, 0.95);
    padding: 40px;
    text-align: center;
    width: 80%;
    max-width: 950px;
    position: relative;
    z-index: 5;
    margin-top: 50px;
    margin-bottom: 20px;
}

.login-box { background-color: #0d5c36; border: none; max-width: 600px; }

/* TYPOGRAPHY & GAMBAR TITLE */
.title-img { width: 300px; margin-top: -130px; margin-bottom: 10px; }

/* Font Chewy diterapkan di Header Text */
.header-text { font-family: 'InterBold'; color: #fbbf24; font-size: 2.5rem; letter-spacing: 2px; margin-bottom: 30px; font-weight: normal; }

.subtitle-game {
    font-family: 'InterBold', sans-serif;
    font-size: 1.5rem;
    color: #14532d;
    margin-bottom: 25px;
    letter-spacing: 1px;
}

/* MENU HOMEPAGE */
.menu-grid { display: flex; gap: 30px; justify-content: center; margin-bottom: 30px; }
.menu-item { 
    cursor: pointer; 
    transition: transform 0.3s ease; 
    width: 200px; 
    background: transparent;
    border: none;
}
.menu-item:hover { transform: scale(1.05); }
.menu-item img { width: 100%; display: block; border-radius: 20px; }

/* INPUT FORM LOGIN */
.input-form {
    width: 80%; padding: 15px; margin-bottom: 20px; border-radius: 30px; border: 3px solid #fbbf24;
    font-family: 'InterBold'; font-size: 1rem; text-align: center; outline: none;
}

/* BUTTONS */
.btn-group { display: flex; gap: 20px; justify-content: center; margin-top: 10px; }
.btn-primary { background: #fbbf24; color: #000; padding: 12px 40px; border-radius: 30px; border: none; font-size: 1.2rem; font-family: 'InterBold'; cursor: pointer; transition: 0.2s; box-shadow: 0 4px 6px rgba(0,0,0,0.2); }
.btn-secondary { background: #262626; color: #fbbf24; padding: 12px 40px; border-radius: 30px; border: none; font-size: 1.2rem; font-family: 'InterBold'; cursor: pointer; transition: 0.2s; box-shadow: 0 4px 6px rgba(0,0,0,0.2); }
.btn-primary:hover, .btn-secondary:hover { opacity: 0.8; transform: translateY(-2px); }
.mt-20 { margin-top: 20px; }

/* SCOREBOARD */
.score-container { display: flex; gap: 30px; width: 80%; max-width: 900px; z-index: 5; position: relative;}
.score-box { flex: 1; border: 6px solid #14532d; border-radius: 20px; background: white; padding: 20px; min-height: 300px; }

/* Font Chewy diterapkan di Judul Scoreboard */
.score-box h3 { font-family: 'Chewy'; margin-bottom: 20px; font-size: 1.8rem; text-align: center; font-weight: normal; }
.score-box ul { list-style-type: disc; padding-left: 20px; font-family: 'InterBold'; font-size: 0.9rem; line-height: 2; }

/* TIMER MEMORY GAME */
.timer-box {
    background: white;
    border: 3px solid #fbbf24;
    border-radius: 30px;
    padding: 8px 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.5rem;
    font-family: 'InterBold';
    color: #000;
}
.icon-waktu { width: 30px; height: 30px; object-fit: contain; }

/* LEVEL BOX */
.level-box {
    background: #fbbf24;
    border: 3px solid #14532d;
    border-radius: 20px;
    padding: 10px 20px;
    font-size: 1.3rem;
    font-family: 'InterBold';
    color: #14532d;
    font-weight: bold;
    letter-spacing: 1px;
}

/* Top Nav untuk Memory dan Puzzle Game */
.top-nav-memory,
.top-nav-puzzle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: absolute;
    top: 20px;
    width: 90%;
    z-index: 10;
    gap: 15px;
}

.puzzle-brand {
    display: flex;
    gap: 12px;
    align-items: center;
}

.puzzle-brand-logo {
    width: 50px;
    object-fit: contain;
}

.puzzle-brand-title {
    width: 100px;
    object-fit: contain;
}

.memory-title-logo {
    width: 150px;
    object-fit: contain;
}

/* MEMORY GAME GRID */
.memory-grid {
    display: grid;
    grid-template-columns: repeat(4, 130px); 
    gap: 15px;
    margin-top: 40px; 
    z-index: 5;
    justify-content: center;
}

.card { 
    width: 130px; 
    height: 130px; 
    position: relative; 
    cursor: pointer; 
    transform-style: preserve-3d; 
    transition: transform 0.4s; 
}
.card.flipped { transform: rotateY(180deg); }
.card-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; border-radius: 10px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
.card-back { background: url('assets/images/card-back.png') no-repeat center center; background-size: cover; background-color: #0d5c36; }
.card-front { transform: rotateY(180deg); background-color: white; display: flex; justify-content: center; align-items: center; border-radius: 10px; overflow: hidden; }

/* =========================================
   PUZZLE GAME LAYOUT
========================================= */
.puzzle-layout {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    width: 100%;
}

.puzzle-instruction {
    font-size: 1rem;
    color: #14532d;
    margin-bottom: 20px;
}

.puzzle-board-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.puzzle-answer-label {
    background: #14532d;
    color: #fbbf24;
    padding: 8px 18px;
    border-radius: 999px;
    font-size: 0.95rem;
    letter-spacing: 1px;
}

.puzzle-side {
    display: grid;
    grid-template-columns: repeat(2, 90px);
    gap: 10px;
    background: #fdf5e6; 
    padding: 10px;
    border-radius: 10px;
    min-height: 400px;
}

.puzzle-piece {
    width: 90px;
    height: 90px;
    cursor: grab;
    object-fit: cover;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    transition: transform 0.2s;
    border-radius: 4px;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}
.puzzle-piece:active {
    cursor: grabbing;
    transform: scale(1.1);
}
.puzzle-piece:hover {
    filter: brightness(1.1);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

.puzzle-board {
    display: grid;
    grid-template-columns: repeat(4, 100px); 
    grid-auto-rows: 100px;
    border: 5px solid #000;
    background-image: url('assets/images/puzzle-guide.png');
    background-size: cover;
    background-position: center;
    background-color: rgba(255,255,255,0.7); 
    background-blend-mode: lighten; 
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.puzzle-board.is-drop-target {
    transform: scale(1.02);
    border-color: #fbbf24;
    box-shadow: 0 0 0 8px rgba(251, 191, 36, 0.28);
}

.puzzle-cell {
    border: 1px solid rgba(0,0,0,0.5); 
    width: 100px;
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s ease, box-shadow 0.2s ease;
    cursor: crosshair;
    position: relative;
}

.puzzle-cell:hover {
    background-color: rgba(251, 191, 36, 0.1);
    box-shadow: inset 0 0 8px rgba(251, 191, 36, 0.3);
}

.puzzle-board.is-drop-target .puzzle-cell {
    background-color: rgba(251, 191, 36, 0.12);
}

.puzzle-cell.is-hover-target {
    background-color: rgba(251, 191, 36, 0.28);
    box-shadow: inset 0 0 0 3px rgba(20, 83, 45, 0.35);
}

.puzzle-cell.is-wrong-target {
    background-color: rgba(220, 38, 38, 0.22);
    box-shadow: inset 0 0 0 3px rgba(185, 28, 28, 0.45);
}

.puzzle-cell.is-correct-target {
    background-color: rgba(34, 197, 94, 0.2);
    box-shadow: inset 0 0 0 3px rgba(21, 128, 61, 0.35);
}

.puzzle-cell .puzzle-piece {
    width: 100%;
    height: 100%;
    box-shadow: none;
    cursor: default;
}

/* UPDATE DI BAGIAN PUZZLE BOARD (Tambahkan position: relative) */
.puzzle-board {
    position: relative; /* Wajib ditambahkan agar overlay preview pas di dalam kotak */
    display: grid;
    grid-template-columns: repeat(4, 100px); 
    grid-auto-rows: 100px;
    border: 5px solid #000;
    background-image: url('assets/images/puzzle-guide.png');
    background-size: cover;
    background-position: center;
    background-color: rgba(255,255,255,0.7); 
    background-blend-mode: lighten; 
}

/* TAMBAHAN BARU: OVERLAY PREVIEW PUZZLE */
.puzzle-preview-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: url('assets/images/gambar-puzzle.png');
    background-size: cover;
    background-position: center;
    z-index: 10;
    border-radius: 2px;
    transition: opacity 0.5s ease; /* Animasi memudar */
}

/* =========================================
   MEDIA QUERIES UNTUK RESPONSIVE LAYAR TAB
========================================= */

/* Homepage Responsive pada Tablet & Desktop */

/* Desktop & Large Tablet (> 1200px) */
@media screen and (min-width: 1200px) {
    .logo-homepage-left {
        width: 100px;
    }
    .logo-homepage-right {
        width: 220px;
    }
}

/* Tablet Landscape Large (1025px - 1200px) */
@media screen and (min-width: 1025px) and (max-width: 1200px) {
    .top-nav-homepage {
        top: 15px;
        width: 90%;
    }

    .logo-homepage-left {
        width: 90px;
    }
    .logo-homepage-right {
        width: 200px;
    }

    .container-box {
        width: 85%;
        padding: 30px;
    }

    .header-text { font-size: 2.2rem; }
    .subtitle-game { font-size: 1.2rem; }

    .memory-grid {
        grid-template-columns: repeat(4, 100px);
        gap: 10px;
        max-width: 680px;
    }
    .card {
        width: 100px;
        height: 100px;
    }

    .puzzle-layout {
        gap: 20px;
    }
    .puzzle-piece {
        width: 65px;
        height: 65px;
    }
    .puzzle-side {
        grid-template-columns: repeat(2, 65px);
    }
    .puzzle-board {
        grid-template-columns: repeat(4, 85px);
        grid-auto-rows: 85px;
    }
    .puzzle-cell {
        width: 85px;
        height: 85px;
    }
}
@media screen and (orientation: landscape) {
    #memory-game,
    #puzzle-game {
        padding-top: 80px;
        padding-bottom: 20px;
    }
}

/* 1c. Tablet Landscape Mode Besar (Landscape Orientation Tablet/iPad) */
@media screen and (orientation: landscape) and (min-height: 600px) and (max-height: 1024px) and (min-width: 900px) {
    .screen {
        padding-top: 80px;
        padding-bottom: 20px;
        overflow-y: auto;
    }

    .top-nav {
        top: 10px;
        width: 95%;
        gap: 8px;
    }

    .container-box {
        margin-top: 70px;
        margin-bottom: 20px;
        padding: 20px;
        width: 90%;
        max-width: 1100px;
    }

    .title-img {
        width: 180px;
        margin-top: -40px;
        margin-bottom: 8px;
    }

    .header-text {
        font-size: 1.6rem;
        margin-bottom: 15px;
    }

    .subtitle-game {
        font-size: 1.05rem;
        margin-bottom: 12px;
    }

    .logo-kiri, .logo-kanan {
        width: 60px;
    }
    .logo-kiri-kecil {
        width: 120px;
    }
    .logo-tengah-kecil {
        width: 140px;
    }

    /* Memory Game Landscape */
    .memory-grid {
        grid-template-columns: repeat(4, 85px);
        gap: 8px;
        margin-top: 25px;
        max-width: 600px;
    }
    .card {
        width: 85px;
        height: 85px;
    }

    /* Top Nav Memory Landscape */
    .top-nav-memory {
        width: 95%;
        gap: 8px;
        top: 10px;
    }

    .memory-title-logo {
        width: 120px !important;
    }

    /* Puzzle Game Landscape - Layout optimal */
    .puzzle-layout {
        flex-direction: row;
        gap: 15px;
        width: 95%;
        justify-content: center;
    }

    .puzzle-side {
        grid-template-columns: repeat(2, 60px);
        gap: 6px;
        padding: 10px;
        min-height: auto;
    }

    .puzzle-piece {
        width: 60px;
        height: 60px;
    }

    .puzzle-board {
        grid-template-columns: repeat(4, 75px);
        grid-auto-rows: 75px;
        border: 4px solid #000;
    }

    .puzzle-cell {
        width: 75px;
        height: 75px;
    }

    /* Top Nav Puzzle Landscape */
    .top-nav-puzzle {
        flex-wrap: wrap;
        gap: 10px;
        width: 95%;
        top: 10px;
    }

    .puzzle-brand {
        gap: 8px;
    }

    .puzzle-brand-logo {
        width: 40px;
    }

    .puzzle-brand-title {
        width: 85px;
    }

    .puzzle-stat-box,
    .puzzle-timer-box {
        font-size: 0.85rem;
        padding: 6px 12px;
    }

    .timer-box {
        font-size: 1rem;
        padding: 8px 15px;
    }

    .menu-grid {
        gap: 15px;
    }
    .menu-item {
        width: 140px;
    }

    .score-container {
        flex-direction: row;
        gap: 15px;
        max-width: 900px;
    }

    .score-box {
        flex: 1;
        padding: 20px;
    }

    .score-box h3 {
        font-size: 1.4rem;
    }

    .score-box ul {
        font-size: 0.9rem;
    }

    .btn-primary, .btn-secondary {
        padding: 10px 25px;
        font-size: 1rem;
    }

    .input-form {
        width: 85%;
        padding: 12px;
        font-size: 1rem;
    }
}

/* 1a. Untuk Tablet Landscape (769px - 1024px) */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    .top-nav-homepage {
        top: 15px;
        width: 92%;
    }

    .logo-homepage-left {
        width: 70px;
    }

    .logo-homepage-right {
        width: 140px;
    }

    body {
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
    }

    .screen {
        min-height: 100vh;
        overflow-y: auto;
        padding-bottom: 30px;
    }

    .container-box {
        width: 88%;
        padding: 25px;
        margin-top: 60px;
        margin-bottom: 30px;
    }
    
    .top-nav {
        top: 15px;
        width: 90%;
        flex-wrap: wrap;
        gap: 10px;
    }

    .logo-kiri-kecil { width: 120px; }
    .logo-kanan { width: 50px; }
    .logo-tengah-kecil { width: 150px; }
    
    .header-text { font-size: 1.8rem; }
    .subtitle-game { font-size: 1.1rem; }

    .title-img { width: 220px; }
    
    /* Memory Game */
    .memory-grid {
        grid-template-columns: repeat(4, 80px);
        gap: 8px;
        max-width: 550px;
    }
    .card {
        width: 80px;
        height: 80px;
    }

    /* Puzzle Game - Horizontal layout tetapi dengan ukuran lebih kecil */
    .puzzle-layout {
        gap: 15px;
        justify-content: center;
    }
    .puzzle-piece {
        width: 60px;
        height: 60px;
    }
    .puzzle-side {
        grid-template-columns: repeat(2, 60px);
        min-height: auto;
        padding: 10px;
    }
    .puzzle-board {
        grid-template-columns: repeat(4, 75px);
        grid-auto-rows: 75px;
    }
    .puzzle-cell {
        width: 75px;
        height: 75px;
    }

    .timer-box {
        font-size: 1rem;
        padding: 8px 15px;
    }

    .level-box {
        font-size: 1rem;
        padding: 6px 12px;
    }

    /* Top Nav untuk Puzzle Game agar tidak berantakan */
    .top-nav-puzzle {
        flex-wrap: wrap;
        gap: 10px;
        justify-content: space-around;
        width: 95%;
    }

    .puzzle-brand {
        display: flex;
        gap: 10px;
        align-items: center;
    }

    .puzzle-brand-logo {
        width: 40px;
    }

    .puzzle-brand-title {
        width: 80px;
    }
}

/* 1b. Tablet Landscape Kecil dengan Height Terbatas (Landscape Mode) */
@media screen and (orientation: landscape) and (min-height: 400px) and (max-height: 800px) and (min-width: 768px) {
    .screen {
        padding-top: 100px;
        padding-bottom: 20px;
        overflow-y: auto;
    }

    .top-nav {
        top: 8px;
        width: 95%;
        gap: 5px;
    }

    .container-box {
        margin-top: 80px;
        margin-bottom: 20px;
        padding: 15px;
        width: 90%;
        max-width: 1100px;
    }

    .title-img {
        width: 150px;
        margin-top: -30px;
        margin-bottom: 5px;
    }

    .header-text {
        font-size: 1.4rem;
        margin-bottom: 10px;
    }

    .subtitle-game {
        font-size: 0.95rem;
        margin-bottom: 10px;
    }

    .logo-kiri, .logo-kanan {
        width: 50px;
    }
    .logo-kiri-kecil {
        width: 100px;
    }
    .logo-tengah-kecil {
        width: 120px;
    }

    /* Memory Game Landscape */
    .memory-grid {
        grid-template-columns: repeat(4, 70px);
        gap: 6px;
        margin-top: 20px;
        max-width: 480px;
    }
    .card {
        width: 70px;
        height: 70px;
    }

    /* Top Nav Memory Landscape */
    .top-nav-memory {
        width: 95%;
        gap: 5px;
        top: 8px;
    }

    .memory-title-logo {
        width: 100px !important;
    }

    /* Puzzle Game Landscape - Layout VERTIKAL untuk pieces */
    .puzzle-layout {
        flex-direction: column;
        gap: 10px;
        width: 95%;
    }

    .puzzle-side {
        grid-template-columns: repeat(8, 40px);
        gap: 4px;
        padding: 8px;
        min-height: auto;
    }

    .puzzle-piece {
        width: 40px;
        height: 40px;
    }

    .puzzle-board {
        grid-template-columns: repeat(4, 60px);
        grid-auto-rows: 60px;
        border: 3px solid #000;
    }

    .puzzle-cell {
        width: 60px;
        height: 60px;
    }

    /* Top Nav Puzzle Landscape */
    .top-nav-puzzle {
        flex-wrap: wrap;
        gap: 8px;
        width: 95%;
        top: 8px;
    }

    .puzzle-brand {
        gap: 6px;
    }

    .puzzle-brand-logo {
        width: 35px;
    }

    .puzzle-brand-title {
        width: 70px;
    }

    .puzzle-stat-box,
    .puzzle-timer-box {
        font-size: 0.7rem;
        padding: 4px 8px;
    }

    .timer-box {
        font-size: 0.85rem;
        padding: 6px 12px;
    }

    .menu-grid {
        gap: 10px;
    }
    .menu-item {
        width: 120px;
    }

    .score-container {
        flex-direction: row;
        gap: 10px;
        max-width: 800px;
    }

    .score-box {
        flex: 1;
        padding: 15px;
    }

    .score-box h3 {
        font-size: 1.2rem;
    }

    .score-box ul {
        font-size: 0.8rem;
    }

    .btn-primary, .btn-secondary {
        padding: 8px 20px;
        font-size: 0.95rem;
    }

    .input-form {
        width: 80%;
        padding: 10px;
        font-size: 0.9rem;
    }
}

/* 2. Untuk Tablet Portrait (481px - 768px) */
@media screen and (min-width: 481px) and (max-width: 768px) {
    .top-nav-homepage {
        top: 12px;
        width: 95%;
    }

    .logo-homepage-left {
        width: 60px;
    }

    .logo-homepage-right {
        width: 120px;
    }

    body {
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
    }

    .screen {
        min-height: 100vh;
        overflow-y: auto;
        padding-bottom: 30px;
    }

    .top-nav {
        top: 12px;
        width: 95%;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
    }

    .container-box {
        width: 90%;
        padding: 20px;
        margin-top: 70px;
        margin-bottom: 30px;
        border-radius: 20px;
    }

    .title-img {
        width: 200px;
        margin-top: -50px;
        margin-bottom: 8px;
    }

    .menu-grid {
        gap: 12px;
        flex-wrap: wrap;
        justify-content: center;
    }
    .menu-item {
        width: 140px;
    }

    .header-text {
        font-size: 1.6rem;
        letter-spacing: 1px;
    }

    .subtitle-game {
        font-size: 1rem;
        margin-bottom: 15px;
    }

    .timer-box {
        font-size: 0.9rem;
        padding: 6px 12px;
        gap: 5px;
        border-radius: 20px;
    }
    
    .level-box {
        font-size: 1rem;
        padding: 8px 15px;
    }

    .icon-waktu {
        width: 22px;
        height: 22px;
    }
    
    /* Scoreboard - Tumpuk ke bawah */
    .score-container {
        flex-direction: column;
        gap: 12px;
        margin-top: 15px;
        width: 100%;
    }
    .score-box {
        min-height: auto;
    }

    .score-box h3 {
        font-size: 1.3rem;
        margin-bottom: 12px;
    }

    .score-box ul {
        font-size: 0.85rem;
        line-height: 1.8;
    }

    /* Memory Game - Responsive untuk tablet portrait */
    .memory-grid {
        grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
        gap: 8px;
        margin-top: 30px;
        max-width: 350px;
        margin-left: auto;
        margin-right: auto;
    }
    .card {
        width: 70px;
        height: 70px;
    }

    /* Top Nav untuk Memory Game */
    .top-nav-memory {
        width: 90%;
        justify-content: space-between;
        gap: 8px;
    }

    .memory-title-logo {
        width: 100px !important;
    }

    /* Puzzle Game - Vertical layout untuk tablet portrait */
    .puzzle-layout {
        flex-direction: column;
        gap: 12px;
        width: 95%;
    }

    .puzzle-side {
        grid-template-columns: repeat(4, 50px);
        min-height: auto;
        padding: 10px;
        gap: 6px;
    }

    .puzzle-piece {
        width: 50px;
        height: 50px;
    }

    .puzzle-board {
        grid-template-columns: repeat(4, 65px);
        grid-auto-rows: 65px;
        border: 4px solid #000;
    }

    .puzzle-cell {
        width: 65px;
        height: 65px;
        border: 1px solid rgba(0,0,0,0.3);
    }

    /* Top Nav untuk Puzzle Game */
    .top-nav-puzzle {
        flex-direction: column;
        gap: 8px;
        justify-content: center;
        width: 95%;
        align-items: center;
    }

    .puzzle-brand {
        display: flex;
        gap: 8px;
        align-items: center;
    }

    .puzzle-brand-logo {
        width: 35px;
    }

    .puzzle-brand-title {
        width: 70px;
    }

    .puzzle-stat-box {
        font-size: 0.75rem;
        padding: 5px 10px;
        min-width: 160px;
    }

    .puzzle-timer-box {
        font-size: 0.75rem;
        padding: 5px 10px;
        min-width: 120px;
    }

    .input-form {
        width: 90%;
        padding: 12px;
        font-size: 0.95rem;
        border: 2px solid #fbbf24;
    }

    .btn-primary, .btn-secondary {
        padding: 10px 25px;
        font-size: 0.95rem;
    }

    .btn-group {
        gap: 10px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .mt-20 {
        margin-top: 15px;
    }

    #volume-control {
        bottom: 15px;
        left: 15px;
    }

    #volume-control img {
        width: 35px;
    }
}

/* 3. Untuk Mobile Portrait (max-width 480px) */
@media screen and (max-width: 480px) {
    .top-nav-homepage {
        top: 10px;
        width: 95%;
    }

    .logo-homepage-left {
        width: 50px;
    }

    .logo-homepage-right {
        width: 90px;
    }

    body {
        background-size: cover;
        background-position: center;
    }

    .screen {
        padding-bottom: 20px;
    }

    .top-nav {
        top: 10px;
        width: 95%;
        gap: 8px;
        flex-wrap: wrap;
    }

    .container-box {
        width: 92%;
        padding: 15px;
        margin-top: 70px;
        margin-bottom: 20px;
        border: 3px solid #14532d;
        border-radius: 15px;
    }

    .logo-kiri {
        width: 45px;
    }
    .logo-kanan {
        width: 35px;
    }
    .logo-kiri-kecil {
        width: 90px;
    }
    .logo-tengah-kecil {
        width: 100px;
    }

    .title-img {
        width: 160px;
        margin-top: -30px;
        margin-bottom: 8px;
    }

    .header-text {
        font-size: 1.3rem;
        letter-spacing: 0;
        margin-bottom: 10px;
    }

    .subtitle-game {
        font-size: 0.9rem;
        margin-bottom: 10px;
    }

    .menu-grid {
        gap: 12px;
        margin-bottom: 15px;
    }
    .menu-item {
        width: 120px;
    }

    .timer-box {
        font-size: 0.8rem;
        padding: 5px 10px;
        gap: 4px;
        border-radius: 15px;
    }

    .icon-waktu {
        width: 20px;
        height: 20px;
    }

    .level-box {
        font-size: 0.9rem;
        padding: 6px 12px;
        border-radius: 15px;
    }

    /* Memory Game - Mobile */
    .memory-grid {
        grid-template-columns: repeat(auto-fit, minmax(55px, 1fr));
        gap: 6px;
        margin-top: 20px;
        max-width: 280px;
        margin-left: auto;
        margin-right: auto;
    }
    .card {
        width: 55px;
        height: 55px;
    }

    /* Top Nav Memory Game Mobile */
    .top-nav-memory {
        width: 90%;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
    }

    .memory-title-logo {
        width: 80px !important;
    }

    /* Puzzle Game - Mobile */
    .puzzle-layout {
        flex-direction: column;
        gap: 8px;
        width: 98%;
    }

    .puzzle-side {
        grid-template-columns: repeat(4, 45px);
        min-height: auto;
        padding: 8px;
        gap: 4px;
        background: #fdf5e6;
        border-radius: 8px;
    }

    .puzzle-piece {
        width: 45px;
        height: 45px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    }

    .puzzle-board {
        grid-template-columns: repeat(4, 55px);
        grid-auto-rows: 55px;
        border: 3px solid #000;
        background-size: cover;
    }

    .puzzle-cell {
        width: 55px;
        height: 55px;
        border: 0.5px solid rgba(0,0,0,0.3);
    }

    /* Top Nav Puzzle Game Mobile */
    .top-nav-puzzle {
        flex-direction: column;
        gap: 6px;
        width: 95%;
        align-items: center;
        justify-content: center;
    }

    .puzzle-brand {
        display: flex;
        gap: 6px;
        align-items: center;
    }

    .puzzle-brand-logo {
        width: 30px;
    }

    .puzzle-brand-title {
        width: 60px;
    }

    .puzzle-stat-box {
        font-size: 0.65rem;
        padding: 4px 8px;
        min-width: 140px;
        gap: 3px;
        border-radius: 15px;
    }

    .puzzle-timer-box {
        font-size: 0.65rem;
        padding: 4px 8px;
        min-width: 110px;
        gap: 3px;
        border-radius: 15px;
    }

    /* Scoreboard Mobile */
    .score-container {
        flex-direction: column;
        gap: 10px;
        margin-top: 10px;
    }

    .score-box h3 {
        font-size: 1.1rem;
        margin-bottom: 8px;
    }

    .score-box ul {
        font-size: 0.75rem;
        line-height: 1.6;
        padding-left: 15px;
    }

    /* Input Form Mobile */
    .input-form {
        width: 95%;
        padding: 10px;
        font-size: 0.85rem;
        border: 2px solid #fbbf24;
        margin-bottom: 12px;
    }

    .btn-primary, .btn-secondary {
        padding: 8px 20px;
        font-size: 0.85rem;
        border-radius: 20px;
        font-weight: normal;
    }

    .btn-group {
        gap: 8px;
        flex-wrap: wrap;
        justify-content: center;
        margin-top: 8px;
    }

    .mt-20 {
        margin-top: 12px;
    }

    #volume-control {
        bottom: 12px;
        left: 12px;
    }

    #volume-control img {
        width: 30px;
    }

    .login-box {
        max-width: 95%;
    }
}

/* Mengatur posisi icon volume di dalam container homepage */
.volume-home-style {
    position: absolute;
    bottom: 20px;   /* Jarak dari bawah garis hijau container */
    left: 20px;     /* Jarak dari kiri garis hijau container */
    cursor: pointer;
    z-index: 10;
    transition: transform 0.2s ease;
}

.volume-home-style:hover {
    transform: scale(1.1); /* Memberi efek sedikit membesar saat diarahkan mouse */
}

/* Menghilangkan margin otomatis jika ada pada logo tengah */
.top-nav img {
    margin: 0;
}

/* =========================================
   MEDIA QUERIES TAMBAHAN UNTUK BREAKPOINT HALUS
========================================= */

/* iPad Landscape (1025px - 1366px) */
@media screen and (min-width: 1025px) and (max-width: 1366px) and (orientation: landscape) {
    .container-box {
        width: 85%;
        max-width: 1000px;
        padding: 30px;
    }

    .memory-grid {
        grid-template-columns: repeat(4, 95px);
        gap: 10px;
    }
    .card {
        width: 95px;
        height: 95px;
    }

    .puzzle-piece {
        width: 70px;
        height: 70px;
    }

    .puzzle-side {
        grid-template-columns: repeat(2, 70px);
    }

    .puzzle-board {
        grid-template-columns: repeat(4, 90px);
        grid-auto-rows: 90px;
    }

    .puzzle-cell {
        width: 90px;
        height: 90px;
    }
}

/* Small Tablet (481px - 600px) */
@media screen and (min-width: 481px) and (max-width: 600px) {
    .container-box {
        padding: 18px;
        margin-top: 65px;
    }

    .header-text {
        font-size: 1.4rem;
    }

    .subtitle-game {
        font-size: 0.95rem;
    }

    .title-img {
        width: 180px;
        margin-top: -45px;
    }

    .menu-item {
        width: 120px;
    }

    .memory-grid {
        grid-template-columns: repeat(4, 60px);
        gap: 6px;
        max-width: 300px;
    }
    .card {
        width: 60px;
        height: 60px;
    }

    .puzzle-side {
        grid-template-columns: repeat(4, 45px);
        padding: 8px;
        gap: 5px;
    }

    .puzzle-piece {
        width: 45px;
        height: 45px;
    }

    .puzzle-board {
        grid-template-columns: repeat(4, 55px);
        grid-auto-rows: 55px;
    }

    .puzzle-cell {
        width: 55px;
        height: 55px;
    }

    .timer-box {
        font-size: 0.8rem;
        padding: 5px 10px;
    }

    .level-box {
        font-size: 0.95rem;
    }
}

/* Medium Tablet (601px - 768px) */
@media screen and (min-width: 601px) and (max-width: 768px) {
    .container-box {
        padding: 22px;
        margin-top: 65px;
    }

    .header-text {
        font-size: 1.5rem;
    }

    .subtitle-game {
        font-size: 1rem;
    }

    .title-img {
        width: 200px;
        margin-top: -48px;
    }

    .memory-grid {
        grid-template-columns: repeat(4, 70px);
        gap: 7px;
        max-width: 350px;
    }
    .card {
        width: 70px;
        height: 70px;
    }

    .puzzle-side {
        grid-template-columns: repeat(4, 52px);
        padding: 10px;
        gap: 6px;
    }

    .puzzle-piece {
        width: 52px;
        height: 52px;
    }

    .puzzle-board {
        grid-template-columns: repeat(4, 65px);
        grid-auto-rows: 65px;
    }

    .puzzle-cell {
        width: 65px;
        height: 65px;
    }

    .timer-box {
        font-size: 0.85rem;
        padding: 6px 12px;
    }

    .level-box {
        font-size: 1rem;
    }
}
