@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@400;600;800&display=swap');

:root {
    --primary-color: #8cc63f;
    --primary-dark: #6ba02a;
    --secondary-color: #f7931e;
    --secondary-dark: #cc7815;
    --bg-color: #d1ece6; /* Matched to the image background */
    --text-color: #393846; /* Dark grey from the image */
    --font-heading: 'Baloo 2', sans-serif;
    --font-body: 'Baloo 2', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background-color: #1a1a2e;
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.game-container {
    width: 100%;
    max-width: 480px;
    height: 100vh;
    max-height: 850px;
    background: var(--bg-color);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

/* --- TOMBOL UMUM --- */
.btn-game {
    border: none;
    padding: 15px 30px;
    border-radius: 30px;
    font-size: 1.2rem;
    font-family: var(--font-heading);
    font-weight: 800;
    color: white;
    cursor: pointer;
    text-transform: uppercase;
    transition: transform 0.1s;
}

.btn-primary {
    background-color: var(--primary-color);
    box-shadow: 0 8px 0 var(--primary-dark);
}
.btn-primary:active {
    transform: translateY(8px);
    box-shadow: 0 0 0 var(--primary-dark);
}

.btn-secondary {
    background-color: var(--secondary-color);
    box-shadow: 0 6px 0 var(--secondary-dark);
}
.btn-secondary:active {
    transform: translateY(6px);
    box-shadow: 0 0 0 var(--secondary-dark);
}

.w-100 { width: 100%; }

/* --- HOME VIEW (MATCHING IMAGE) --- */
.view-home {
    background: var(--bg-color);
    justify-content: space-between;
    align-items: center;
    padding: 60px 20px 40px 20px;
}

.header-titles {
    text-align: center;
}
.sub-title {
    font-size: 1.5rem;
    font-family: var(--font-heading);
    font-weight: 800;
    color: var(--text-color);
    letter-spacing: 2px;
    margin-bottom: -5px;
}
.main-title {
    font-size: 3.2rem;
    font-family: var(--font-heading);
    font-weight: 800;
    color: var(--text-color);
    letter-spacing: 1px;
}
.tagline {
    font-size: 1.1rem;
    color: var(--text-color);
}

.character-display {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 15px;
    position: relative;
    z-index: 2;
}
.speech-bubble {
    background: #fff;
    border-radius: 15px;
    padding: 10px 20px;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-color);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    position: relative;
    animation: floatBubble 2s ease-in-out infinite;
    border: 3px solid #eee;
}
.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 10px 10px 0;
    border-style: solid;
    border-color: #fff transparent transparent transparent;
    display: block;
    width: 0;
}
@keyframes floatBubble {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-5px); }
    100% { transform: translateY(0px); }
}
.mascots-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: -20px;
}
.mascot-img {
    width: 250px;
    height: 250px;
    object-fit: contain;
}
.mascot-img:nth-child(2) {
    margin-left: -50px;
}
.action-buttons-home {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}
.btn-massive {
    padding: 20px 30px;
    font-size: 1.3rem;
    border-radius: 40px;
}
.sub-actions {
    display: flex;
    gap: 15px;
    width: 100%;
}
.btn-ghost {
    flex: 1;
    background: rgba(255, 255, 255, 0.85);
    border: none;
    padding: 12px 20px;
    border-radius: 30px;
    font-size: 1.1rem;
    font-family: var(--font-heading);
    font-weight: 800;
    color: var(--text-color);
    box-shadow: 0 4px 0 rgba(0,0,0,0.1);
    cursor: pointer;
    text-transform: uppercase;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}
.btn-ghost:active {
    background: rgba(255, 255, 255, 1);
    transform: translateY(4px);
    box-shadow: 0 0 0 rgba(0,0,0,0.1);
}

/* --- HUD (HEADS UP DISPLAY) --- */
.hud-top {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
}
.btn-hud-back {
    width: 50px;
    height: 50px;
    background: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    color: var(--primary-dark);
    font-size: 1.5rem;
    box-shadow: 0 5px 0 #ccc;
    border: 3px solid #ddd;
}
.btn-hud-back:active {
    transform: translateY(5px);
    box-shadow: 0 0 0 #ccc;
}
.hud-title {
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 20px;
    border-radius: 30px;
    font-weight: 900;
    font-size: 1.1rem;
    color: var(--primary-dark);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    border: 3px solid #eee;
    text-transform: uppercase;
    text-align: center;
}
.hud-score,
.points-reward {
    display: none !important;
}

/* --- OTHER PAGES (UNCHANGED BUT ADAPTED TO NEW BASE) --- */
.top-bar {
    background: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    border-bottom: 3px solid #ccc;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    z-index: 10;
}

/* --- GAME STYLE FORM CONTROLS --- */
.view-level input[type="text"],
.view-level textarea,
.view-level select {
    width: 100%;
    padding: 15px;
    border-radius: 12px;
    border: 3px solid #ccc;
    background-color: #fdfaf6;
    font-size: 1.1rem;
    font-family: var(--font-body);
    color: #444;
    box-shadow: inset 0 3px 6px rgba(0,0,0,0.05);
    margin-bottom: 15px;
    transition: all 0.2s;
}
.view-level input[type="text"]:focus,
.view-level textarea:focus,
.view-level select:focus {
    border-color: var(--primary-color);
    box-shadow: inset 0 3px 6px rgba(0,0,0,0.05), 0 0 0 4px rgba(140, 198, 63, 0.2);
    outline: none;
}

.btn-back {
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
    color: var(--text-color);
    font-size: 1.2rem;
    font-weight: bold;
}
.btn-back i {
    width: 40px; height: 40px;
    background: white;
    border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    box-shadow: 0 3px 5px rgba(0,0,0,0.1);
}
.level-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    padding: 90px 20px 30px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}
.level-content::-webkit-scrollbar {
    width: 6px;
}
.level-content::-webkit-scrollbar-track {
    background: transparent;
}
.level-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
}
.instruction-text {
    font-size: 1.3rem;
    text-align: center;
    font-weight: bold;
    margin-bottom: 20px;
    color: #444;
}
.bottom-action {
    padding: 20px;
    background: white;
    border-top: 3px solid #eee;
    text-align: center;
    flex-shrink: 0;
    position: relative;
    z-index: 50;
}
.points-reward {
    margin-top: 10px;
    color: var(--secondary-color);
    font-weight: bold;
}

/* LEVEL 1 */
.card-scene { width: 250px; height: 350px; perspective: 1000px; margin-bottom: 30px; }
.card-object { width: 100%; height: 100%; position: relative; transition: transform 0.6s; transform-style: preserve-3d; }
.card-object.mystery-card { width: 130px; height: 180px; } /* Fixed dimensions for 3-card layout */
.card-object.is-flipped { transform: rotateY(180deg); }
.card-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; border-radius: 20px; display: flex; flex-direction: column; justify-content: center; align-items: center; box-shadow: 0 10px 20px rgba(0,0,0,0.2); border: 5px solid white; }
.card-front { background: linear-gradient(135deg, var(--secondary-color), #ff5722); color: white; }
.card-front i { font-size: 5rem; opacity: 0.5; }
.card-back { background: white; transform: rotateY(180deg); padding: 20px; text-align: center; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.card-back i { font-size: 4rem; color: var(--primary-color); margin-bottom: 15px; }
.card-back h2 { color: #333; margin-bottom: 10px; }
.card-back p { color: #666; font-size: 0.9rem; }

/* CARD NAVIGATION */
.card-navigation {
    display: flex;
    gap: 30px;
    margin-top: 15px;
    margin-bottom: 20px;
    justify-content: center;
}
.nav-arrow {
    background: white;
    border: 3px solid #ccc;
    border-radius: 50%;
    width: 55px;
    height: 55px;
    font-size: 1.5rem;
    color: var(--secondary-color);
    box-shadow: 0 5px 0 #ccc;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.1s;
}
.nav-arrow:active {
    transform: translateY(5px);
    box-shadow: 0 0 0 #ccc;
}

/* MAP VIEW */
.map-container { flex: 1; position: relative; padding: 0; overflow-y: auto; overflow-x: hidden; }
.map-content { position: relative; z-index: 1; width: 100%; height: 1000px; }
.map-node {
    position: absolute; 
    width: 45px; height: 45px; 
    border-radius: 50%;
    border: 4px solid white;
    display: flex; justify-content: center; align-items: center; 
    z-index: 5;
    text-decoration: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    transition: transform 0.2s;
}
.map-node:active { transform: scale(0.9); }
.map-node.completed {
    background-color: #4bd765; /* Bright Green */
    color: white;
    font-size: 1.2rem;
}
.map-node.current {
    background-color: #00a8ff; /* Blue */
    animation: pulse-node 1.5s infinite;
}
.map-node.locked {
    background-color: #c7d5db; /* Light blue-grey */
    border-color: #f0f4f5;
}

/* Map Instruction Banner */
.map-instruction-banner {
    position: absolute;
    top: 80px;
    left: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 15px;
    font-weight: 800;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--primary-dark);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    border: 3px solid var(--primary-color);
    text-align: center;
    z-index: 90;
    animation: slideDown 0.5s ease-out;
}
.map-instruction-banner i {
    margin-right: 8px;
    font-size: 1.3rem;
}
@keyframes slideDown {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Play Pointer Tooltip */
.current-level-pointer {
    position: absolute;
    top: -55px;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: bouncePointer 1s infinite;
    color: #e51d45;
    font-size: 2.2rem;
    filter: drop-shadow(0 3px 5px rgba(0,0,0,0.3));
}
.current-level-pointer span {
    background: #e51d45;
    color: white;
    font-size: 0.8rem;
    font-weight: 900;
    padding: 3px 10px;
    border-radius: 10px;
    margin-top: -8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
@keyframes bouncePointer {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes pulse-node {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(0, 168, 255, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(0, 168, 255, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(0, 168, 255, 0); }
}

.node-data-label {
    position: absolute;
    top: 50px;
    width: max-content;
    max-width: 120px;
    background: rgba(255,255,255,0.95);
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 0.75rem;
    color: var(--primary-dark);
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    border: 1px solid #ddd;
    line-height: 1.2;
}
.view-level { background: linear-gradient(to bottom, #f0f8ff, #e6f2ff); }

/* LEVEL 2 & CHARACTERS */
.character-selection { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; margin-bottom: 18px; }
.char-card { background: #fff; border: 4px solid #ddd; border-radius: 20px; padding: 12px 10px; text-align: center; cursor: pointer; transition: all 0.2s; box-shadow: 0 4px 0 #ccc; user-select: none; -webkit-user-select: none; }
.char-card:active { transform: translateY(4px); box-shadow: 0 0 0 #ccc; }
.char-card.selected { border-color: var(--secondary-color); background: #fff9e6; }
.char-avatar-img { width: 75px; height: 75px; border-radius: 50%; object-fit: cover; margin-bottom: 5px; border: 3px solid #eee; box-shadow: 0 4px 6px rgba(0,0,0,0.1); pointer-events: none; }
.char-name-wrapper { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 5px; }
.char-name-label { margin: 0; font-size: 1.05rem; font-weight: 800; color: #1e293b; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-rename-char { background: #e0f2fe; border: 1.5px solid #7dd3fc; color: #0284c7; border-radius: 8px; width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s ease; padding: 0; font-size: 0.75rem; flex-shrink: 0; }
.btn-rename-char:hover { background: #0284c7; color: #ffffff; transform: scale(1.1); }
.selected-roles { display: flex; gap: 15px; width: 100%; }
.role-box { flex: 1; background: #fff; border: 3px dashed #bbb; border-radius: 15px; padding: 10px; text-align: center; }
.role-box.filled { border: 3px solid var(--secondary-color); background: #eafaf1; }
.role-title { font-size: 0.9rem; color: #777; font-weight: bold; display: block; margin-bottom: 5px; }
.role-slot { font-size: 1.3rem; font-weight: 800; color: var(--primary-color); }

/* INPUTS */
.game-input { width: 100%; padding: 15px; border: 3px solid #ccc; border-radius: 15px; font-size: 1.1rem; font-family: var(--font-body); transition: all 0.3s; box-shadow: inset 0 3px 5px rgba(0,0,0,0.05); }
.game-input:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 4px rgba(140, 198, 63, 0.3); }

/* SUMMARY */
.summary-card { background: #fff; border: 4px solid #ddd; border-radius: 15px; padding: 15px; display: flex; align-items: center; gap: 15px; margin-bottom: 15px; box-shadow: 0 5px 0 #ccc; width: 100%; transition: transform 0.2s; }
.summary-card:hover { transform: translateY(-2px); border-color: var(--primary-color); }
.summary-icon { background: var(--bg-color); color: var(--primary-color); width: 55px; height: 55px; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 1.6rem; border: 3px solid var(--primary-color); }
.summary-text { flex: 1; display: flex; flex-direction: column; }
.summary-label { font-size: 0.9rem; color: var(--secondary-color); font-weight: 800; font-family: var(--font-heading); }
.summary-val { font-size: 1.2rem; font-weight: bold; color: #444; }

/* --- SWEETALERT GAME UI OVERRIDES --- */
.swal2-popup {
    border: 5px solid #ddd !important;
    border-radius: 25px !important;
    box-shadow: 0 10px 0 #ccc, 0 15px 30px rgba(0,0,0,0.3) !important;
    background: #fff !important;
    padding: 10px 20px 30px 20px !important;
    font-family: 'Baloo 2', sans-serif !important;
}
.swal2-title {
    font-weight: 800 !important;
    font-size: 2rem !important;
    color: #393846 !important;
}
.swal2-html-container {
    font-size: 1.2rem !important;
    font-weight: 600 !important;
}
.swal2-actions .swal2-confirm {
    background-color: #8cc63f !important;
    box-shadow: 0 6px 0 #6ba02a !important;
    border-radius: 30px !important;
    padding: 15px 30px !important;
    font-family: 'Baloo 2', sans-serif !important;
    font-weight: 800 !important;
    font-size: 1.2rem !important;
    text-transform: uppercase !important;
    color: white !important;
    border: none !important;
    margin-top: 20px !important;
    transition: transform 0.1s !important;
}
.swal2-actions .swal2-confirm:active {
    transform: translateY(6px) !important;
    box-shadow: 0 0 0 #6ba02a !important;
}
.swal2-icon {
    border-width: 5px !important;
    margin-top: 30px !important;
}

/* --- RESPONSIVE MOBILE TWEAKS --- */
@media (max-width: 480px) {
    body {
        align-items: flex-start;
    }
    .game-container {
        height: 100vh;
        height: 100dvh;
        max-height: 100%;
        box-shadow: none;
    }
    .level-content {
        padding: 85px 15px 30px 15px;
    }
    .hud-top {
        top: 15px;
        left: 15px;
        right: 15px;
    }
    .hud-title {
        font-size: 0.95rem;
        padding: 6px 14px;
    }
    .btn-hud-back {
        width: 42px;
        height: 42px;
        font-size: 1.2rem;
    }
    .hud-score {
        padding: 8px 14px;
        font-size: 1rem;
    }
    .character-selection {
        gap: 10px;
        margin-bottom: 15px;
    }
    .char-card {
        padding: 10px 8px;
    }
    .char-avatar-img {
        width: 65px;
        height: 65px;
    }
    .char-card h4 {
        font-size: 1rem;
    }
    .bottom-action {
        padding: 15px;
    }
}

