* {
    box-sizing: border-box;
}

:root {
    --bg: #050b14;
    --surface: #0e1b2d;
    --surface-light: #13243a;

    --text: #f4f7fb;
    --muted: #8292a8;

    --gold: #ffc94a;
    --gold-dark: #f5a51d;

    --border: rgba(255, 255, 255, 0.08);
}

html {
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100vh;

    background: var(--bg);
    color: var(--text);

    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

button {
    font: inherit;
}

.app {
    width: 100%;
    max-width: 480px;
    min-height: 100vh;

    margin: 0 auto;

    background:
        linear-gradient(
            180deg,
            #081321 0%,
            #091625 55%,
            #07111e 100%
        );

    position: relative;
    overflow: hidden;

    padding-bottom: 28px;
}

.topbar {
    padding: 18px 18px 10px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    position: relative;
    z-index: 2;
}

.brand {
    font-size: 19px;
    font-weight: 900;
    letter-spacing: 0.3px;
}

.brand span {
    color: var(--gold);
}

.lang-switch {
    display: flex;
    gap: 3px;

    padding: 3px;

    background: #0b1828;

    border: 1px solid var(--border);
    border-radius: 11px;
}

.lang-btn {
    border: 0;
    background: transparent;

    color: #75869b;

    padding: 6px 9px;

    border-radius: 8px;

    font-size: 10px;
    font-weight: 900;

    cursor: pointer;

    transition: 0.2s ease;
}

.lang-btn.active {
    background: var(--gold);
    color: #241600;
}

main {
    padding: 0 16px;

    position: relative;
    z-index: 1;
}

.welcome {
    margin-top: 10px;
}

.eyebrow {
    font-size: 11px;
    color: var(--muted);

    margin-bottom: 5px;

    letter-spacing: 0.5px;
}

.welcome h1 {
    font-size: 27px;
    line-height: 1.08;

    margin: 0;

    font-weight: 850;

    letter-spacing: -0.7px;
}

.welcome p {
    font-size: 13px;
    color: var(--muted);

    margin: 8px 0 0;
}

.glow {
    position: absolute;

    width: 260px;
    height: 260px;

    border-radius: 50%;

    background: rgba(255, 191, 57, 0.08);

    filter: blur(45px);

    top: 120px;
    left: 50%;

    transform: translateX(-50%);

    pointer-events: none;
}

.chest-area {
    height: 300px;

    display: flex;
    align-items: center;
    justify-content: center;

    position: relative;
}

.ring {
    position: absolute;

    width: 230px;
    height: 230px;

    border: 1px solid rgba(255, 201, 74, 0.12);

    border-radius: 50%;

    box-shadow:
        0 0 70px rgba(255, 181, 35, 0.07);
}

.ring::before {
    content: "";

    position: absolute;

    inset: 18px;

    border:
        1px dashed
        rgba(255, 201, 74, 0.12);

    border-radius: 50%;

    animation:
        spin 18s linear infinite;
}

@keyframes spin {

    to {
        transform: rotate(360deg);
    }

}

.chest-wrap {
    text-align: center;

    position: relative;

    z-index: 2;
}

.chest {
    width: 152px;
    height: 132px;

    position: relative;

    margin: auto;

    filter:
        drop-shadow(
            0 22px 22px
            rgba(0, 0, 0, 0.4)
        );

    transition: 0.45s ease;
}

.chest-body {
    position: absolute;

    left: 8px;
    top: 54px;

    width: 136px;
    height: 70px;

    background:
        linear-gradient(
            135deg,
            #9a5416,
            #63320e
        );

    border:
        4px solid
        #d48a29;

    border-radius:
        8px 8px 18px 18px;
}

.chest-lid {
    position: absolute;

    left: 8px;
    top: 18px;

    width: 136px;
    height: 48px;

    background:
        linear-gradient(
            180deg,
            #b87320,
            #7c4313
        );

    border:
        4px solid
        #e09a32;

    border-bottom: 0;

    border-radius:
        72px 72px 12px 12px;

    z-index: 2;
}

.band {
    position: absolute;

    left: 64px;
    top: 17px;

    width: 24px;
    height: 108px;

    background:
        linear-gradient(
            90deg,
            #ffd96a,
            #b97919,
            #ffe27e
        );

    z-index: 3;

    border-radius: 5px;
}

.lock {
    position: absolute;

    z-index: 4;

    left: 57px;
    top: 51px;

    width: 38px;
    height: 45px;

    background:
        linear-gradient(
            135deg,
            #ffe27a,
            #d58b18
        );

    border:
        3px solid
        #fff0ad;

    border-radius: 7px;

    box-shadow:
        0 4px 12px
        rgba(0, 0, 0, 0.3);

    transition: 0.4s;
}

.lock::before {
    content: "";

    position: absolute;

    width: 17px;
    height: 17px;

    border:
        4px solid
        #8c5913;

    border-bottom: 0;

    border-radius:
        12px 12px 0 0;

    left: 7px;
    top: -18px;
}

.lock::after {
    content: "";

    position: absolute;

    width: 5px;
    height: 12px;

    background: #82520e;

    border-radius: 4px;

    left: 13px;
    top: 16px;
}

.chest-glow {
    position: absolute;

    left: 26px;
    top: 48px;

    width: 100px;
    height: 45px;

    background:
        rgba(255, 215, 91, 0.25);

    filter: blur(18px);

    opacity: 0;

    transition: 0.4s;
}

.spark {
    position: absolute;

    color: #ffd866;

    font-size: 17px;

    animation:
        float 2.8s ease-in-out infinite;
}

.s1 {
    top: 30px;
    left: 65px;
}

.s2 {
    top: 92px;
    right: 55px;

    font-size: 12px;

    animation-delay: 0.8s;
}

.s3 {
    bottom: 45px;
    left: 38px;

    font-size: 11px;

    animation-delay: 1.2s;
}

@keyframes float {

    50% {
        transform:
            translateY(-9px)
            scale(1.1);

        opacity: 0.65;
    }

}

.chest-label {
    margin-top: 15px;

    font-size: 13px;

    color: #bdc8d7;
}

.chest-label b {
    color: #ffd35d;
}

.progress-card {
    background:
        rgba(14, 27, 45, 0.9);

    border:
        1px solid
        var(--border);

    border-radius: 18px;

    padding: 15px;

    box-shadow:
        0 12px 35px
        rgba(0, 0, 0, 0.16);
}

.progress-head {
    display: flex;

    justify-content: space-between;

    align-items: center;

    margin-bottom: 10px;
}

.progress-head b {
    font-size: 14px;
}

.progress-head span {
    font-size: 12px;

    color: #ffd35d;

    font-weight: 800;
}

.bar {
    height: 9px;

    background: #07101d;

    border-radius: 99px;

    overflow: hidden;

    border:
        1px solid
        rgba(255, 255, 255, 0.04);
}

.fill {
    height: 100%;

    width: 25%;

    background:
        linear-gradient(
            90deg,
            #ff9f1c,
            #ffd45c
        );

    border-radius: 99px;

    box-shadow:
        0 0 13px
        rgba(255, 183, 50, 0.35);

    transition:
        width 0.35s ease;
}

.progress-note {
    font-size: 11px;

    color: var(--muted);

    margin-top: 9px;
}

.tasks {
    margin-top: 19px;
}

.section-title {
    display: flex;

    align-items: end;

    justify-content: space-between;

    margin-bottom: 10px;
}

.section-title h2 {
    font-size: 16px;

    margin: 0;
}

.section-title span {
    font-size: 11px;

    color: var(--muted);
}

.task {
    display: flex;

    align-items: center;

    gap: 12px;

    padding: 13px;

    background:
        rgba(14, 27, 45, 0.88);

    border:
        1px solid
        var(--border);

    border-radius: 16px;

    margin-bottom: 9px;

    transition:
        0.2s ease;
}

.task.done {
    opacity: 0.62;
}

.icon {
    width: 42px;
    height: 42px;

    border-radius: 12px;

    background: #17283d;

    display: grid;
    place-items: center;

    font-size: 20px;

    flex: none;
}

.task-info {
    min-width: 0;

    flex: 1;
}

.task-info b {
    font-size: 13px;

    display: block;
}

.task-info p {
    margin: 4px 0 0;

    color: var(--muted);

    font-size: 10.5px;

    line-height: 1.35;
}

.task-btn {
    border: 0;

    background:
        #f4b52e;

    color:
        #241600;

    font-weight: 850;

    font-size: 11px;

    padding: 9px 12px;

    border-radius: 10px;

    min-width: 67px;

    cursor: pointer;

    transition:
        0.15s ease;
}

.task.done .task-btn {
    background:
        #193b31;

    color:
        #65e2aa;
}

.task-btn:not(:disabled):active {
    transform:
        scale(0.96);
}

.task-btn:disabled {
    cursor: default;
}

.timer {
    margin-top: 15px;

    padding: 13px 15px;

    border-radius: 15px;

    background:
        linear-gradient(
            90deg,
            rgba(72, 213, 151, 0.08),
            rgba(255, 201, 74, 0.06)
        );

    border:
        1px solid
        rgba(72, 213, 151, 0.12);

    display: flex;

    align-items: center;

    justify-content: space-between;
}

.timer small {
    display: block;

    color: var(--muted);

    font-size: 10px;
}

.timer strong {
    display: block;

    font-size: 14px;

    color: #72e4b3;

    margin-top: 2px;
}

.timer > span {
    font-size: 21px;
}

.claim {
    width: 100%;

    border: 0;

    border-radius: 15px;

    padding: 15px;

    margin-top: 15px;

    font-weight: 900;

    font-size: 14px;

    background:
        linear-gradient(
            135deg,
            #ffd65d,
            #f5a51d
        );

    color: #2a1900;

    box-shadow:
        0 9px 25px
        rgba(255, 177, 38, 0.15);

    cursor: pointer;
}

.claim:disabled {
    opacity: 0.35;

    box-shadow: none;

    cursor: default;
}

.disclaimer {
    text-align: center;

    color: #52647a;

    font-size: 9px;

    margin: 12px 0 0;
}

.toast {
    position: fixed;

    left: 50%;
    bottom: 25px;

    transform:
        translate(-50%, 20px);

    background:
        #f3f6fb;

    color:
        #0a1420;

    padding:
        11px 15px;

    border-radius:
        12px;

    font-size:
        12px;

    font-weight:
        750;

    opacity:
        0;

    pointer-events:
        none;

    transition:
        0.25s;

    z-index:
        20;

    white-space:
        nowrap;
}

.toast.show {
    opacity: 1;

    transform:
        translate(-50%, 0);
}

.modal {
    position: fixed;

    inset: 0;

    background:
        rgba(0, 0, 0, 0.68);

    display: none;

    align-items: center;
    justify-content: center;

    padding: 24px;

    z-index: 10;
}

.modal.show {
    display: flex;
}

.modal-card {
    width: min(400px, 100%);

    background:
        #0e1b2d;

    border:
        1px solid
        rgba(255, 255, 255, 0.09);

    border-radius:
        22px;

    padding:
        22px;

    text-align:
        center;
}

.modal-icon {
    font-size: 48px;
}

.modal h3 {
    margin:
        8px 0 5px;

    font-size:
        20px;
}

.modal p {
    color:
        var(--muted);

    font-size:
        12px;

    line-height:
        1.6;
}

.modal button {
    width: 100%;

    padding: 13px;

    border: 0;

    border-radius: 12px;

    background:
        var(--gold);

    color:
        #241600;

    font-weight:
        850;

    margin-top:
        8px;

    cursor: pointer;
}

.chest.open {
    transform:
        translateY(-4px)
        scale(1.04);
}

.chest.open .lock {
    opacity: 0;

    transform:
        translateY(-10px);
}

.chest.open .chest-lid {
    transform:
        translateY(-12px)
        rotate(-2deg);

    transform-origin:
        left bottom;
}

.chest.open .chest-glow {
    opacity: 1;
}

/* =========================================================
   SUCCESS MODAL
   ========================================================= */

.success-modal {
    position: fixed;

    inset: 0;

    display: none;

    align-items: center;
    justify-content: center;

    padding: 20px;

    z-index: 100;

    overflow: hidden;
}

.success-modal.show {
    display: flex;
}


/* Background */

.success-overlay {
    position: absolute;

    inset: 0;

    background:
        rgba(1, 6, 15, 0.88);

    backdrop-filter:
        blur(8px);
}


/* Card */

.success-card {
    position: relative;

    width: min(645px, 100%);

    padding:
        42px 32px 38px;

    background:
        linear-gradient(
            180deg,
            #121a2d 0%,
            #0d1526 100%
        );

    border:
        1px solid
        rgba(255, 204, 82, 0.25);

    border-radius:
        28px;

    text-align:
        center;

    box-shadow:
        0 30px 90px
        rgba(0, 0, 0, 0.55),

        0 0 70px
        rgba(255, 193, 57, 0.08);

    animation:
        successPopup
        0.45s
        cubic-bezier(.2,.8,.2,1);
}


@keyframes successPopup {

    from {
        opacity: 0;

        transform:
            translateY(25px)
            scale(0.94);
    }

    to {
        opacity: 1;

        transform:
            translateY(0)
            scale(1);
    }

}


/* Mission Complete */

.success-label {
    display: flex;

    align-items: center;
    justify-content: center;

    gap: 7px;

    color:
        #f7d56d;

    font-size:
        11px;

    font-weight:
        900;

    letter-spacing:
        1.2px;

    margin-bottom:
        26px;
}


/* Gift */

.gift-icon {
    font-size:
        64px;

    line-height:
        1;

    margin-bottom:
        18px;

    filter:
        drop-shadow(
            0 0 22px
            rgba(255, 191, 45, 0.35)
        );

    animation:
        giftFloat
        2.2s
        ease-in-out
        infinite;
}


@keyframes giftFloat {

    50% {
        transform:
            translateY(-7px);
    }

}


/* Selamat */

.congrats {
    color:
        #f8d866;

    font-size:
        15px;

    font-weight:
        900;

    letter-spacing:
        1px;

    margin-bottom:
        12px;
}


/* Main heading */

.success-card h2 {
    margin:
        0;

    color:
        #f5f7fb;

    font-size:
        clamp(28px, 5vw, 43px);

    line-height:
        1.12;

    letter-spacing:
        -1.2px;

    font-weight:
        900;
}


/* Description */

.success-description {
    max-width:
        390px;

    margin:
        14px auto 0;

    color:
        #7f8da3;

    font-size:
        12px;

    line-height:
        1.5;
}


/* Reward */

.reward-label {
    margin-top:
        30px;

    color:
        #f5cf60;

    font-size:
        10px;

    font-weight:
        900;

    letter-spacing:
        1.3px;
}


.reward-value {
    margin-top:
        4px;

    color:
        #ffd85f;

    font-size:
        clamp(45px, 9vw, 68px);

    line-height:
        1;

    font-weight:
        950;

    letter-spacing:
        -2px;

    text-shadow:
        0 0 30px
        rgba(255, 202, 76, 0.28);
}


/* Buttons */

.success-actions {
    display:
        flex;

    justify-content:
        center;

    gap:
        9px;

    margin-top:
        28px;
}


.success-actions button {
    border:
        0;

    min-height:
        46px;

    padding:
        0 17px;

    border-radius:
        12px;

    font-size:
        11px;

    font-weight:
        900;

    cursor:
        pointer;

    transition:
        0.18s ease;
}


.success-actions button:active {
    transform:
        scale(0.96);
}


/* Main Lagi */

.play-again {
    background:
        linear-gradient(
            135deg,
            #ffd75d,
            #f3ae26
        );

    color:
        #251700;

    box-shadow:
        0 8px 22px
        rgba(255, 184, 43, 0.18);
}


/* Kembali */

.home-button {
    background:
        #151d2d;

    color:
        #dce3ed;

    border:
        1px solid
        rgba(255, 255, 255, 0.08) !important;
}


.success-actions button:hover {
    transform:
        translateY(-2px);
}

@media (max-width: 520px) {

    .success-modal {
        padding:
            14px;
    }


    .success-card {
        padding:
            30px 18px 25px;

        border-radius:
            23px;
    }


    .success-label {
        margin-bottom:
            20px;

        font-size:
            9px;
    }


    .gift-icon {
        font-size:
            55px;

        margin-bottom:
            15px;
    }


    .congrats {
        font-size:
            13px;
    }


    .success-card h2 {
        font-size:
            29px;

        letter-spacing:
            -0.8px;
    }


    .success-description {
        font-size:
            11px;

        max-width:
            300px;
    }


    .reward-label {
        margin-top:
            25px;
    }


    .reward-value {
        font-size:
            48px;
    }


    .success-actions {
        flex-direction:
            column;

        margin-top:
            23px;
    }


    .success-actions button {
        width:
            100%;
    }

}

/* =========================================================
   SUCCESS EFFECTS
   ========================================================= */

.success-modal.show .success-card {
    animation:
        successPopup
        0.45s
        cubic-bezier(.2, .8, .2, 1);
}


/* Floating stars */

.success-modal::before,
.success-modal::after {
    content: "✦";

    position: absolute;

    color: #f7d56d;

    font-size: 22px;

    opacity: 0.7;

    animation:
        floatingStar
        3s
        ease-in-out
        infinite;
}

.success-modal::before {
    top: 18%;
    left: 13%;
}

.success-modal::after {
    right: 13%;
    bottom: 18%;

    font-size: 17px;

    animation-delay:
        1s;
}


@keyframes floatingStar {

    0%,
    100% {
        transform:
            translateY(0)
            rotate(0deg);

        opacity:
            0.35;
    }

    50% {
        transform:
            translateY(-14px)
            rotate(25deg);

        opacity:
            0.9;
    }

}


/* Confetti container */

.confetti-container {
    position: absolute;

    inset: 0;

    overflow: hidden;

    pointer-events: none;

    z-index: 2;
}


/* Individual confetti */

.confetti {
    position: absolute;

    top: -20px;

    width: 7px;
    height: 12px;

    border-radius: 2px;

    animation:
        confettiFall
        var(--duration)
        linear
        forwards;

    animation-delay:
        var(--delay);

    transform:
        rotate(var(--rotation));
}


@keyframes confettiFall {

    0% {
        transform:
            translate3d(
                0,
                -20px,
                0
            )
            rotate(0deg);

        opacity:
            1;
    }

    100% {
        transform:
            translate3d(
                var(--drift),
                110vh,
                0
            )
            rotate(
                720deg
            );

        opacity:
            0;
    }

}


/* Gift stronger glow */

.success-modal.show .gift-icon {
    animation:
        giftFloat
        2.2s
        ease-in-out
        infinite,
        giftGlow
        1.5s
        ease-in-out
        infinite;
}


@keyframes giftGlow {

    0%,
    100% {
        filter:
            drop-shadow(
                0 0 15px
                rgba(255, 191, 45, 0.25)
            );
    }

    50% {
        filter:
            drop-shadow(
                0 0 32px
                rgba(255, 191, 45, 0.65)
            );
    }

}

.confetti-0 {
    background: #ffd45c;
}

.confetti-1 {
    background: #65e2aa;
}

.confetti-2 {
    background: #ff7b7b;
}

.confetti-3 {
    background: #79a8ff;
}

/* =========================================================
   MOBILE FIX
   ========================================================= */

html,
body {
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

body {
    min-height: 100vh;
}

.app {
    width: 100%;
    max-width: 480px;
    min-width: 0;
    margin: 0 auto;
}

/*
|--------------------------------------------------------------------------
| MOBILE WIDTH
|--------------------------------------------------------------------------
*/

@media (max-width: 480px) {

    .app {
        width: 100%;
        max-width: none;
        min-height: 100vh;
    }

    main {
        width: 100%;
        padding-left: 14px;
        padding-right: 14px;
    }

    .topbar {
        padding-left: 14px;
        padding-right: 14px;
    }

    .welcome h1 {
        font-size: clamp(23px, 7vw, 27px);
    }

    .welcome p {
        font-size: 12px;
    }

    .chest-area {
        height: 270px;
    }

    .ring {
        width: 215px;
        height: 215px;
    }

    .task {
        width: 100%;
        min-width: 0;
        gap: 10px;
        padding: 11px;
    }

    .task-info {
        min-width: 0;
        overflow: hidden;
    }

    .task-info b,
    .task-info p {
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .task-btn {
        flex: 0 0 auto;
    }

    .timer,
    .progress-card,
    .claim {
        width: 100%;
    }
}


/*
|--------------------------------------------------------------------------
| SUCCESS MODAL - ONLY BACK TO HOME
|--------------------------------------------------------------------------
*/

.play-again {
    display: none !important;
}

.success-actions {
    justify-content: center;
}

.home-button {
    width: 100%;
    max-width: 100%;
}