/* ============================================================
   coupon_game.css — 쿠폰 카드 뽑기 게임 (모바일 우선 풀페이지)
   ============================================================ */

html, body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, 'Apple SD Gothic Neo', sans-serif;
}

.cgp-page {
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    box-sizing: border-box;
    background: radial-gradient(circle at center, #2c3e50, #1a1a1a);
    color: #fff;
    padding: 56px 20px 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    overflow-y: auto;
}

.cgp-inner {
    width: 100%;
    max-width: 720px;
    text-align: center;
    position: relative;
}

.cgp-back {
    position: absolute;
    top: 0;
    left: 0;
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    padding: 8px 16px;
    transition: background 0.2s;    
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* ── 히어로 ───────────────────────────────────────────── */
.cgp-hero {
    margin-bottom: 32px;
}

.cgp-title {
    font-size: 34px;
    font-weight: 800;
    margin: 0 0 14px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
    letter-spacing: -0.5px;
}

.cgp-subtitle {
    font-size: 16px;
    line-height: 1.65;
    color: #ecf0f1;
    margin: 0;
}

.cgp-subtitle strong {
    color: #ffd866;
    font-weight: 700;
}

/* ── 시작 화면 (intro) ────────────────────────────────── */
.cgp-intro {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
    padding: 16px 20px 16px;
}

.cgp-intro__video-wrap {
    width: 200px;
    height: 200px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cgp-intro-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.cgp-intro__text {
    margin: 0;
    font-size: 32px;
    font-weight: 800;
    line-height: 1.6;
    color: #D8E9A4;
}

.cgp-intro__text small {
    display: block;
    margin-top: 6px;
    font-size: 28px;
    font-weight: 600;
    color: #fff;
}

.cgp-start-btn {
    width: 100%;
    max-width: 360px;
    padding: 20px;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    background: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.15s, transform 0.1s;
    margin-top: 100px;
}


.cgp-start-btn:active { transform: translateY(1px); }
.cgp-start-btn i { font-size: 15px; }

/* ── 마케팅 수신 동의 체크박스 ──────────────────────────── */
.cgp-marketing-consent {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 8px;
    margin-top: 14px;
    max-width: 360px;
    width: 100%;
    cursor: pointer;
    font-size: 13px;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.5;
}
.cgp-marketing-consent input[type="checkbox"] {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin-top: 2px;
    accent-color: #192531;
    cursor: pointer;
}
.cgp-marketing-consent__link {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
}

/* ── 상태 텍스트 ─────────────────────────────────────── */
.cgp-status {    
    margin: 36px 0 66px;
    font-size: 24px;
    font-weight: 600;
    color: #fff;
}

.cgp-status.cgp-status--win { color: #ffd866; }
.cgp-status.cgp-status-done { display: none; }

/* ── 카드 영역 ────────────────────────────────────────── */
.cgp-card-board {
    display: flex;
    gap: 32px;
    justify-content: center;
    perspective: 1500px;
    flex-wrap: wrap;
    margin: 0 auto;
}

/* 2+3 그리드 모드 (모바일에서 JS가 .is-grid 추가) */
.cgp-card-board.is-grid {
    flex-direction: column;
    gap: 12px;
    align-items: center;
    perspective: 1500px;
}

.cgp-row {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.cgp-card {
    width: 118px;
    height: 178px;
    cursor: pointer;
    position: relative;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.5s;
    flex-shrink: 0;
    transform-style: preserve-3d;
    will-change: transform;
}

.cgp-card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
    will-change: transform;
}

.cgp-card.is-hidden .cgp-card-inner   { transform: rotateY(180deg); }
.cgp-card.is-selected .cgp-card-inner { transform: rotateY(360deg); }
.cgp-card.is-revealed .cgp-card-inner { transform: rotateY(360deg); }

/* 당첨 카드: 위로 팝업 + 최상단 레이어 (scale 제거로 겹침 방지) */
.cgp-card.is-selected { transform: translateY(-18px); z-index: 10; }

@keyframes cgpThump {
    0%   { transform: scale(1) rotate(0deg); }
    25%  { transform: scale(1.05) rotate(-2deg); }
    50%  { transform: scale(1.05) rotate(2deg); }
    75%  { transform: scale(1.05) rotate(-1deg); }
    100% { transform: scale(1.1) rotate(0deg); }
}

.cgp-card.is-shaking {
    animation: cgpThump 0.6s ease-in-out infinite alternate;
    z-index: 10;
}

.cgp-card-face {
    width: 100%;
    height: 100%;
    position: absolute;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55);
    padding: 8px;
    box-sizing: border-box;
    border: 2px solid transparent;
}

.cgp-card-front {
    background: #fff;
    color: #2c3e50;
    border-color: #e8e8e8;
}

.cgp-card-front--win {
    background: #F5FFD6;
    border-color: #177000;
    color: #fff;    
}
.cgp-card-front--win::before {
    content: '🎊';
    font-size: 26px;
    display: block;
    margin-bottom: 4px;
}
.cgp-card-front--win .cgp-card-amount { color: #177000; }
.cgp-card-front--win .cgp-card-name   { color: rgba(255, 255, 255, 0.88); }

.cgp-card-front .cgp-card-amount {
    font-size: 28px;
    font-weight: 800;
    line-height: 1.1;
}


.cgp-card-back {
    background: linear-gradient(135deg, #b8efc4 0%, #d6f5dd 50%, #a8e8b8 100%);
    color: #6dd684;
    transform: rotateY(180deg);
    border-color: #7ed991;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55), inset 0 0 0 1px #4ec474;
}

/* 카드 뒷면 안쪽 크림빛 패널 + 안쪽 보더 링 */
.cgp-card-back::before {
    content: '';
    position: absolute;
    inset: 8px;
    background: linear-gradient(135deg, #fdfff5 0%, #effbf2 100%);
    border-radius: 8px;
    box-shadow:
        inset 0 0 0 2px #b8e8c4,
        inset 0 0 0 3px rgba(255, 255, 255, 0.6);
}

.cgp-card-back__clover {
    position: relative;
    z-index: 1;
    font-size: 68px;
    color: #6dd684;
    text-shadow: 0 2px 3px rgba(109, 214, 132, 0.3);
}

/* 셔플 진행 중 — 트랜지션 단축으로 동작감 향상 */
.cgp-card.is-shuffling {
    transition: transform 0.36s cubic-bezier(0.45, 0.05, 0.25, 1);
}

/* 셔플 z-index 변동 (카드끼리 겹쳐 지나가는 느낌) */
.cgp-card.is-front { z-index: 12; }
.cgp-card.is-mid   { z-index: 8; }
.cgp-card.is-back  { z-index: 4; }

/* 카드 선택 미리보기 (confirm 전) */
.cgp-card.is-selected-preview { transform: translateY(-16px); z-index: 10; }
.cgp-card.is-selected-preview .cgp-card-back {
    border-color: #fff;
    box-shadow: 0 0 0 3px rgb(255 12 12 / 55%), 0 6px 18px rgb(207 0 0 / 55%);
}

/* ── 카드 결정 버튼 ──────────────────────────────────── */
.cgp-confirm-btn {
    width: 100%;
    max-width: 360px;
    padding: 20px;
    font-size: 18px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    transition: background 0.15s, color 0.15s, transform 0.1s;
}
.cgp-confirm-btn:disabled {
    background: rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.4);
    cursor: default;
}
.cgp-confirm-btn:not(:disabled) {
    background: #fff;
    color: #333;
}

.cgp-confirm-btn:not(:disabled):active { transform: translateY(1px); }

/* ── 결과 영역 ────────────────────────────────────────── */
.cgp-result {
    display: none;
    margin: 32px auto 0;
    padding: 28px 24px;
    border-radius: 18px;    
    backdrop-filter: blur(8px);
    max-width: 500px;
}

.cgp-result.show { display: block; animation: cgpFadeIn 0.4s ease-out; }

@keyframes cgpFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.cgp-result__amount {
    font-size: 38px;
    font-weight: 800;
    color: #ffd866;
    margin-bottom: 6px;
}

.cgp-result__name {
    font-size: 16px;
    color: #ecf0f1;
    margin-bottom: 18px;
}

.cgp-result__notice {
    font-size: 13px;
    color: #bdc3c7;
    margin: 0 0 18px;
    line-height: 1.6;
}

.cgp-result__notice-link {
    color: #bdc3c7;
    text-decoration: underline;
}

.cgp-result__actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cgp-result__btn {
    display: block;
    width: 100%;
    padding: 20px;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    border: none;
    text-decoration: none;
    box-sizing: border-box;
    transition: opacity 0.15s;
    line-height: 1;
}


.cgp-result__btn--default {
    background: #fff;
    color: #2c3e50;
}

.cgp-result__btn--share {
    background: #FEE500;
    color: #3C1E1E;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.cgp-result__btn--share-done {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.45);
    cursor: default;    
}

/* ── 안내(에러/기회없음/소진) ─────────────────────────── */
.cgp-message {
    display: none;
    padding: 20px 20px 0;
    text-align: center;
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
    box-sizing: border-box;
}

.cgp-message.show { display: block; }

/* 일반 에러 메시지용 */
.cgp-message__icon {
    font-size: 56px;
    color: #f39c12;
    margin-bottom: 16px;
}

.cgp-message__text {
    font-size: 16px;
    line-height: 1.6;
    color: #ecf0f1;
}

.cgp-message__text small {
    display: inline-block;
    margin-top: 8px;
    color: #95a5a6;
    font-size: 13px;
}

.cgp-message__cta {
    display: inline-block;
    margin-top: 20px;
    padding: 12px 24px;
    background: #462cc5;
    color: #fff;
    border-radius: 10px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}


/* 기회 없음 화면 전용 */
.cgp-msg-oops {
    font-size: 32px;
    font-weight: 800;
    color: #D8E9A4;
    margin-bottom: 14px;
}

.cgp-msg-heading {
    font-size: 28px;
    font-weight: 600;
    color: #fff;
    line-height: 1.55;
    margin-bottom: 32px;
}

.cgp-msg-mypage {
    display: inline-block;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    text-decoration: underline;
    text-underline-offset: 3px;
    margin-bottom: 28px;
}


.cgp-msg-divider {    
    background: rgba(255, 255, 255, 0.1);
    margin: 0 0 84px;
}

.cgp-msg-share-info {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.45);
    margin-bottom: 12px;
}

.cgp-msg-share-btn {
    width: 100%;
    padding: 18px;
    background: #FEE500;
    color: #3C1E1E;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.15s;
    box-sizing: border-box;
}

.cgp-msg-share-btn--done {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.45);
    cursor: default;
}

/* ── 모바일 (큼직하게) ────────────────────────────────── */
@media (max-width: 640px) {
    .cgp-page { padding: 60px 14px 60px; }    

    .cgp-title { font-size: 28px; }
    .cgp-subtitle { font-size: 15px; }
    
    .cgp-intro__video-wrap { width: 160px; height: 160px; }

    .cgp-confirm-btn { font-size: 15px; padding: 16px 22px; }

    .cgp-card { width: 102px; height: 152px; }
    .cgp-card-back::before { inset: 7px; }
    .cgp-card-back__clover { font-size: 44px; }
    .cgp-card-front { padding: 6px; }
    .cgp-card-front .cgp-card-amount { font-size: 24px; }
    .cgp-card-front .cgp-card-name { font-size: 10px; margin-top: 4px; }
    .cgp-card-board { gap: 10px; }
    .cgp-result__amount { font-size: 30px; }
    .cgp-result__name { font-size: 14px; }
    .cgp-result__cta { padding: 12px 22px; font-size: 14px; }

    .cgp-message__icon { font-size: 48px; }
    .cgp-message__text { font-size: 15px; }
}

/* 아주 작은 화면 (≤360px) */
@media (max-width: 360px) {
    .cgp-card { width: 78px; height: 117px; }
    .cgp-card-front .cgp-card-amount { font-size: 20px; }
    .cgp-card-back__clover { font-size: 36px; }
    .cgp-card-back::before { inset: 6px; }
}

/* ── 로그인 유도 모달 ──────────────────────────────────── */
.cgp-login-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.72);
    padding: 20px;
    box-sizing: border-box;
}

.cgp-login-overlay.show {
    display: flex;
    animation: cgpFadeIn 0.2s ease-out;
}

.cgp-login-modal {
    position: relative;
    width: 100%;
    max-width: 340px;
    background: #fff;
    border-radius: 18px;
    padding: 36px 24px 28px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    text-align: center;
    animation: cgpPopIn 0.25s ease-out;
}

@keyframes cgpPopIn {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.cgp-login-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #999;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.15s;
}

.cgp-login-modal__icon {
    font-size: 44px;
    color: #462cc5;
    margin-bottom: 14px;
}

.cgp-login-modal__title {
    font-size: 19px;
    font-weight: 700;
    color: #333;
    margin: 0 0 8px;
    line-height: 1.4;
}

.cgp-login-modal__desc {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin: 0 0 22px;
}

.cgp-login-modal__kakao {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 20px;
    background: #FEE500;
    color: #3C1E1E;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.15s;
    box-sizing: border-box;
}

/* ── 게임 중 로그인 만료 안내 ──────────────────────────── */
.cgp-msg-login__title {
    font-size: 32px;
    font-weight: 800;
    color: #D8E9A4;
    margin: 0 0 14px;
    line-height: 1.3;
}

.cgp-msg-login__desc {
    font-size: 24px;
    font-weight: 500;
    color: #fff;
    line-height: 1.3;
    margin: 0 0 200px;
}

.cgp-msg-login__kakao {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 320px;
    padding: 16px 24px;
    background: #FEE500;
    color: #3C1E1E;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    box-sizing: border-box;
}
