/* ========================================
   기본 설정
======================================== */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    width: 100%;
    min-height: 100%;
}

body {
    overflow-x: hidden;
    overflow-y: auto;

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Noto Sans KR",
        "Apple SD Gothic Neo",
        Arial,
        sans-serif;

    background: #079bd3;
}


/* ========================================
   배경 포스터
======================================== */

.background-page {
    position: relative;

    width: 100%;
    min-height: 100vh;

    background: #079bd3;

    overflow: hidden;
}


.background-image {
    display: block;

    width: 100%;
    height: auto;
}


/* ========================================
   코드 입력 팝업
   화면에 고정
======================================== */

.code-popup {
    position: fixed;

    top: 50%;
    left: 50%;

    transform: translate(-50%, -50%);

    z-index: 100;

    width: calc(100% - 40px);
    max-width: 480px;

    padding: 52px 36px;

    background: #ffffff;

    border-radius: 24px;

    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.25);

    display: flex;
    flex-direction: column;
    align-items: center;

    gap: 20px;
}


/* ========================================
   제목
======================================== */

.code-popup h1 {
    width: 100%;

    color: #222222;

    font-size: 26px;
    font-weight: 700;

    line-height: 1.4;

    text-align: center;

    margin-bottom: 10px;
}


/* ========================================
   입력창
======================================== */

#codeInput {
    width: 100%;
    height: 64px;

    padding: 0 20px;

    border: 1px solid #dddddd;
    border-radius: 12px;

    background: #ffffff;

    color: #222222;

    font-size: 20px;

    text-align: center;

    outline: none;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}


#codeInput:focus {
    border-color: #2f80ed;

    box-shadow:
        0 0 0 4px rgba(47, 128, 237, 0.12);
}


#codeInput::placeholder {
    color: #aaaaaa;

    font-size: 16px;
}


/* ========================================
   확인 버튼
======================================== */

#confirmButton {
    width: 100%;
    height: 64px;

    border: none;
    border-radius: 12px;

    background: #2f80ed;

    color: #ffffff;

    font-size: 20px;
    font-weight: 700;

    cursor: pointer;

    transition:
        background-color 0.2s ease,
        transform 0.1s ease;
}


#confirmButton:hover {
    background: #216fd4;
}


#confirmButton:active {
    transform: scale(0.98);
}


/* ========================================
   오답 메시지
======================================== */

.error-message {
    display: none;

    color: #e74c3c;

    font-size: 14px;
    font-weight: 500;
}


.error-message.show {
    display: block;
}


/* ========================================
   Mission Complete 팝업
======================================== */

.complete-popup {
    position: fixed;

    top: 50%;
    left: 50%;

    transform:
        translate(-50%, -50%)
        scale(0.7);

    z-index: 200;

    width: calc(100% - 40px);
    max-width: 480px;

    padding: 55px 30px;

    background: rgba(255, 255, 255, 0.97);

    border-radius: 28px;

    box-shadow:
        0 25px 70px rgba(0, 0, 0, 0.3);

    text-align: center;

    display: flex;
    flex-direction: column;
    align-items: center;

    opacity: 0;

    pointer-events: none;

    transition:
        opacity 0.4s ease,
        transform 0.5s cubic-bezier(
            0.175,
            0.885,
            0.32,
            1.275
        );
}


.complete-popup.show {
    opacity: 1;

    transform:
        translate(-50%, -50%)
        scale(1);

    pointer-events: auto;
}


/* ========================================
   A 로고
======================================== */

.complete-icon {
    width: 45px;
    height: 45px;

    margin-bottom: 18px;

    display: flex;
    align-items: center;
    justify-content: center;

    animation: logoMotion 1.8s ease-in-out infinite;
}


.complete-icon img {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: contain;
}


/* ========================================
   A 로고 모션
======================================== */

@keyframes logoMotion {

    0% {
        transform:
            scale(0.85)
            rotate(-8deg);

        opacity: 0.8;
    }

    25% {
        transform:
            scale(1.08)
            rotate(5deg);

        opacity: 1;
    }

    50% {
        transform:
            scale(0.95)
            rotate(-3deg);

        opacity: 1;
    }

    75% {
        transform:
            scale(1.05)
            rotate(3deg);

        opacity: 1;
    }

    100% {
        transform:
            scale(0.85)
            rotate(-8deg);

        opacity: 0.8;
    }
}


/* ========================================
   Mission Complete 글씨
======================================== */

.complete-popup h2 {
    color: #222222;

    font-size: 34px;
    font-weight: 800;

    margin-bottom: 12px;
}


.complete-popup p {
    color: #777777;

    font-size: 17px;
}


/* ========================================
   폭죽
======================================== */

.confetti-container {
    position: fixed;

    top: 0;
    left: 0;

    width: 100%;
    height: 100%;

    z-index: 300;

    pointer-events: none;

    overflow: hidden;
}


.confetti {
    position: absolute;

    top: -20px;

    width: 10px;
    height: 18px;

    opacity: 0;

    animation:
        confetti-fall 2.8s linear forwards;
}


@keyframes confetti-fall {

    0% {
        opacity: 1;

        transform:
            translate3d(0, -20px, 0)
            rotate(0deg);
    }

    100% {
        opacity: 0;

        transform:
            translate3d(var(--x), 110vh, 0)
            rotate(var(--rotation));
    }
}


/* ========================================
   모바일
======================================== */

@media (max-width: 600px) {

    /*
       포스터 확대
       --------------------------------
       기존:
       width: 100%

       변경:
       width: 110%

       가운데를 기준으로 확대해서
       포스터 아래 파란색 공간이
       최대한 보이지 않게 함
    */

    .background-page {
        width: 100%;
        min-height: 100vh;

        background: #079bd3;

        overflow: hidden;
    }


    .background-image {
        display: block;

        width: 110%;
        max-width: none;

        height: auto;

        /*
           가운데 기준으로 확대
        */
        margin-left: -5%;
    }


    /* ====================================
       코드 입력 팝업
       기존보다 확실히 작게
    ==================================== */

    .code-popup {

        /*
           기존 100% - 40px
           → 100% - 90px

           좌우 여백을 넓혀서
           팝업 자체를 작게 만듦
        */

        width: calc(100% - 90px);

        max-width: 360px;

        padding: 28px 20px 24px;

        border-radius: 22px;

        gap: 13px;
    }


    /* 제목 */

    .code-popup h1 {

        font-size: 20px;

        line-height: 1.35;

        margin-bottom: 3px;
    }


    /* 입력창 */

    #codeInput {

        width: 100%;

        height: 48px;

        padding: 0 12px;

        font-size: 17px;

        border-radius: 12px;
    }


    #codeInput::placeholder {

        font-size: 14px;
    }


    /* 확인 버튼 */

    #confirmButton {

        width: 100%;

        height: 48px;

        font-size: 17px;

        border-radius: 12px;
    }


    /* ====================================
       Mission Complete 팝업
    ==================================== */

    .complete-popup {

        width: calc(100% - 70px);

        max-width: 380px;

        padding: 38px 22px;

        border-radius: 24px;
    }


    .complete-popup h2 {

        font-size: 27px;

        margin-bottom: 10px;
    }


    .complete-popup p {

        font-size: 15px;
    }


    .complete-icon {

        width: 38px;
        height: 38px;

        margin-bottom: 13px;
    }
}


/* ========================================
   작은 모바일
======================================== */

@media (max-width: 360px) {

    .background-image {

        /*
           작은 화면에서는 조금 더 확대
        */

        width: 115%;

        margin-left: -7.5%;
    }


    .code-popup {

        width: calc(100% - 50px);

        padding: 26px 18px 22px;

        border-radius: 20px;

        gap: 11px;
    }


    .code-popup h1 {

        font-size: 18px;

        margin-bottom: 2px;
    }


    #codeInput {

        height: 46px;

        font-size: 16px;

        border-radius: 11px;
    }


    #confirmButton {

        height: 46px;

        font-size: 16px;

        border-radius: 11px;
    }


    .complete-popup {

        width: calc(100% - 50px);

        padding: 32px 18px;
    }


    .complete-popup h2 {

        font-size: 24px;
    }
}