@import url('https://fonts.googleapis.com/css2?family=Gowun+Dodum&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Gowun Dodum', sans-serif;
    background: #f5eaef;
    color: #333;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-user-drag: none;
}

.hidden {
    display: none !important;
}

/* ==================== 언어 토글 ==================== */
.lang-toggle {
    position: fixed;
    top: 20px;
    left: 50%;
    margin-left: 210px;
    z-index: 10000;
    background: rgba(255, 255, 255, 0.8);
    padding: 8px 15px;
    border-radius: 20px;
    box-shadow: 0 4px 10px rgba(255, 105, 180, 0.2);
    font-weight: bold;
    display: flex;
    gap: 10px;
    border: 2px solid #ffb6c1;
}

.lang-toggle a { text-decoration: none; color: #ffb6c1; transition: color 0.3s; }
.lang-toggle a.active { color: #ff1493; }
.lang-toggle span { color: #ccc; }

/* ==================== 씬 전환 오버레이 ==================== */
#scene-transition {
    position: fixed;
    top: 0; 
    left: 50%; transform: translateX(-50%);
    width: 100%; 
    max-width: 600px;
    height: 100%;
    background-color: #fff0f5;
    z-index: 15000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s ease-in-out;
}

#scene-transition.active {
    opacity: 1;
    pointer-events: auto;
}

/* ==================== 시작 화면 ==================== */
#start-screen {
    position: fixed;
    top: 0; 
    left: 50%; transform: translateX(-50%);
    width: 100%; 
    max-width: 600px;
    bottom: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #ffb6c1 0%, #ffc0cb 50%, #ffdab9 100%);
    overflow: hidden;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.1);
}

.gradient-bg {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.4) 0%, transparent 60%);
    animation: pulseBg 5s infinite alternate;
}

@keyframes pulseBg {
    from { transform: scale(1); opacity: 0.6; }
    to { transform: scale(1.2); opacity: 1; }
}

.start-content {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    animation: fadeInDown 1s ease;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.main-title {
    font-size: 56px;
    font-weight: bold;
    color: #ff69b4;
    text-shadow: 2px 2px 0px #fff, 4px 4px 10px rgba(255, 105, 180, 0.3);
    margin-bottom: 0;
    line-height: 1.2;
    text-align: center;
    animation: titleAnim 2.5s infinite ease-in-out;
}

@keyframes titleAnim {
    0%, 100% {
        transform: translateY(0) scale(1);
        text-shadow: 2px 2px 0px #fff, 4px 4px 10px rgba(255, 105, 180, 0.3);
    }
    50% {
        transform: translateY(-8px) scale(1.05);
        text-shadow: 2px 2px 0px #fff, 6px 6px 15px rgba(255, 105, 180, 0.6);
    }
}

.subtitle {
    font-size: 18px;
    color: #ff1493;
    margin-bottom: 10px;
    background: rgba(255,255,255,0.6);
    padding: 10px 20px;
    border-radius: 20px;
}

.start-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 15px 40px;
    background: #ff69b4;
    color: white;
    border: 3px solid #fff;
    border-radius: 50px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(255, 105, 180, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-15px); }
    60% { transform: translateY(-7px); }
}

.start-btn:hover { background: #ff1493; transform: scale(1.05) !important; animation: none; }
.start-btn:active { transform: scale(0.95) !important; }

/* ==================== 게임 컨테이너 ==================== */
#game-container {
    position: fixed;
    top: 0; 
    left: 50%; transform: translateX(-50%);
    width: 100%; 
    max-width: 600px;
    bottom: 100px;
    background: #fff0f5;
    overflow: hidden;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.1);
}

#bg-video, #bg-image {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    object-fit: cover;
}

#bg-video { opacity: 1; transition: opacity 1s ease; }
#bg-image { background-size: cover; background-position: center; opacity: 0; transition: opacity 1s ease; }
#bg-image.active { opacity: 1; }

#character-img {
    position: absolute;
    top: 0; 
    left: 50%;
    transform: translateX(-50%);
    width: 100%; 
    height: calc(100% - 180px);
    object-fit: contain;
    object-position: center bottom;
    opacity: 0;
    filter: drop-shadow(0 10px 20px rgba(255, 182, 193, 0.5));
    transition: opacity 1s ease-in-out;
    z-index: 5;
}

#character-img.visible {
    opacity: 1;
    animation: floatUpDown 3s ease-in-out infinite;
}

@keyframes floatUpDown {
    0%, 100% { transform: translate(-50%, 0); }
    50% { transform: translate(-50%, -10px); }
}

/* ==================== UI 레이어 ==================== */
#ui-layer {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 20px; padding-bottom: 20px;
    pointer-events: none;
}

#dialogue-box {
    background: rgba(255, 255, 255, 0.95);
    border: 3px solid #ffb6c1;
    border-radius: 25px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(255, 105, 180, 0.2);
    pointer-events: auto;
    cursor: pointer;
    transition: transform 0.1s ease;
    animation: popUp 0.3s ease-out;
    z-index: 10;
}

@keyframes popUp {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.character-header {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    background: #ffe4e1;
    border-bottom: 2px solid #ffb6c1;
}

.character-avatar {
    width: 45px; height: 45px;
    border-radius: 50%;
    background: #ff69b4;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; margin-right: 15px; color: white;
}

.character-info { flex: 1; }
.character-name { font-size: 18px; font-weight: bold; color: #ff1493; margin-bottom: 2px; }
.character-status { font-size: 14px; color: #ff69b4; font-weight: bold; }

.dialogue-content { padding: 25px 20px; min-height: 120px; position: relative; }
.dialogue-text { font-size: 19px; line-height: 1.6; color: #333; font-weight: bold; }

.dialogue-indicator {
    position: absolute;
    bottom: 15px; right: 20px;
    display: flex; align-items: center; gap: 8px;
    font-size: 14px; color: #ff69b4; font-weight: bold;
    opacity: 0; transition: opacity 0.3s ease;
}
.dialogue-indicator.visible { opacity: 1; }

.tap-hint {
    width: 0; height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 12px solid #ff69b4;
    animation: arrowBounce 1s infinite;
}

@keyframes arrowBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(5px); }
}

.dialogue-progress { height: 6px; background: #fff0f5; }
.progress-bar { height: 100%; width: 0%; background: linear-gradient(90deg, #ffb6c1 0%, #ff69b4 100%); transition: width 0.3s ease; }

/* ==================== 선택지 모달 (팝업창) ==================== */
#choice-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255, 228, 225, 0.6); 
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 15;
    pointer-events: auto;
    animation: fadeInOverlay 0.3s ease;
}

@keyframes fadeInOverlay {
    from { opacity: 0; }
    to { opacity: 1; }
}

#choice-box {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: calc(100% - 40px);
    max-width: 450px;
    display: flex; flex-direction: column;
    pointer-events: auto;
    z-index: 20;
    background: rgba(255, 255, 255, 0.95);
    padding: 25px 20px;
    border-radius: 30px;
    box-shadow: 0 15px 40px rgba(255, 105, 180, 0.3);
    border: 3px solid white;
}

.close-choice-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 28px;
    font-weight: bold;
    color: #ffb6c1;
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
    line-height: 1;
    z-index: 21;
}

.close-choice-btn:hover {
    color: #ff1493;
    transform: scale(1.2);
}

.choice-title {
    text-align: center;
    font-size: 22px;
    font-weight: bold;
    color: #ff1493;
    padding-bottom: 15px;
    margin-bottom: 15px;
    border-bottom: 2px dashed #ffb6c1;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) backwards;
}

#choice-buttons-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

.choice-btn {
    position: relative;
    padding: 16px 24px;
    background: #ffffff;
    border: 3px solid #ffb6c1;
    border-radius: 20px;
    color: #ff1493;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(255, 182, 193, 0.3);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) backwards;
}

.choice-btn:nth-child(1) { animation-delay: 0.1s; }
.choice-btn:nth-child(2) { animation-delay: 0.2s; }
.choice-btn:nth-child(3) { animation-delay: 0.3s; }

@keyframes popIn {
    from { opacity: 0; transform: scale(0.8) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.choice-btn:hover {
    transform: translateY(-3px) scale(1.02);
    background: #ffe4e1;
    border-color: #ff69b4;
    box-shadow: 0 10px 20px rgba(255, 105, 180, 0.4);
}

.choice-btn:active { transform: translateY(1px) scale(0.98); }

/* ==================== 다른 경험하기 버튼 ==================== */
.explore-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 13px 36px;
    background: rgba(255, 255, 255, 0.85);
    color: #ff69b4;
    border: 3px solid #ff69b4;
    border-radius: 50px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(255, 105, 180, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: none;
}

.explore-btn:hover {
    background: #ff69b4;
    color: white;
    transform: scale(1.05);
    box-shadow: 0 10px 20px rgba(255, 105, 180, 0.4);
}

.explore-btn:active { transform: scale(0.95); }

/* ==================== 다른 경험하기 페이지 ==================== */
#promo-page {
    position: fixed;
    top: 0;
    left: 50%; transform: translateX(-50%);
    width: 100%;
    max-width: 600px;
    bottom: 100px;
    background: linear-gradient(135deg, #fff0f5 0%, #ffe4e1 50%, #ffdab9 100%);
    overflow-y: auto;
    z-index: 9000;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.1);
    animation: fadeInDown 0.4s ease;
}

.promo-header {
    position: sticky;
    top: 0;
    background: linear-gradient(135deg, #ffb6c1 0%, #ff69b4 100%);
    padding: 20px 20px 25px;
    text-align: center;
    z-index: 10;
    box-shadow: 0 4px 15px rgba(255, 105, 180, 0.3);
}

.promo-back-btn {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid white;
    border-radius: 25px;
    padding: 8px 18px;
    font-size: 14px;
    font-weight: bold;
    color: #ff1493;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.promo-back-btn:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

.promo-back-btn:active { transform: translateY(1px); }

.promo-title {
    font-size: 28px;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.1);
    margin-top: 5px;
    margin-bottom: 5px;
}

.promo-subtitle {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: bold;
}

.promo-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 20px;
    padding-bottom: 30px;
}

.promo-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 18px 10px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #ffb6c1;
    border-radius: 20px;
    text-decoration: none;
    color: #333;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(255, 182, 193, 0.2);
    transition: all 0.2s ease;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) backwards;
}

.promo-card:nth-child(odd) { animation-delay: 0.05s; }
.promo-card:nth-child(even) { animation-delay: 0.1s; }

.promo-card:hover {
    transform: translateY(-4px) scale(1.03);
    border-color: #ff69b4;
    box-shadow: 0 8px 20px rgba(255, 105, 180, 0.3);
    background: white;
}

.promo-card:active { transform: scale(0.97); }

.promo-icon {
    font-size: 32px;
    line-height: 1;
}

.promo-text {
    font-size: 13px;
    text-align: center;
    color: #ff1493;
    line-height: 1.3;
    word-break: keep-all;
}

/* ==================== 엔딩 특별 버튼 스타일 ==================== */
.choice-btn-restart {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%) !important;
    border-color: #66bb6a !important;
    color: #2e7d32 !important;
}

.choice-btn-restart:hover {
    background: linear-gradient(135deg, #c8e6c9 0%, #a5d6a7 100%) !important;
    border-color: #43a047 !important;
    box-shadow: 0 10px 20px rgba(76, 175, 80, 0.3) !important;
}

.choice-btn-share {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%) !important;
    border-color: #ffa726 !important;
    color: #e65100 !important;
}

.choice-btn-share:hover {
    background: linear-gradient(135deg, #ffe0b2 0%, #ffcc80 100%) !important;
    border-color: #fb8c00 !important;
    box-shadow: 0 10px 20px rgba(255, 152, 0, 0.3) !important;
}

/* ==================== 토스트 팝업 ==================== */
.toast {
    position: fixed;
    bottom: 130px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(51, 51, 51, 0.95);
    color: white;
    padding: 14px 28px;
    border-radius: 30px;
    font-size: 15px;
    font-weight: bold;
    z-index: 20000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ==================== 카카오 애드핏 (하단 100px 고정) ==================== */
#adfit-container {
    position: fixed;
    bottom: 0; 
    left: 50%; transform: translateX(-50%);
    width: 100%; 
    max-width: 600px;
    height: 100px;
    background: #fff;
    display: flex; justify-content: center; align-items: center;
    z-index: 10000;
    border-top: 2px solid #ffb6c1;
    box-shadow: 0 -4px 10px rgba(255, 182, 193, 0.3);
}

/* ==================== 모바일 최적화 ==================== */
@media (max-width: 600px) {
    .lang-toggle {
        left: auto;
        right: 20px;
        margin-left: 0;
    }
    .main-title { font-size: 44px; }
    .subtitle { font-size: 16px; padding: 8px 16px; }
    .start-btn { padding: 14px 30px; font-size: 18px; }
    .explore-btn { padding: 12px 28px; font-size: 16px; }
    #character-img { height: calc(100% - 170px); }
    .dialogue-text { font-size: 17px; }
    .choice-btn { padding: 14px 20px; font-size: 16px; }
    .choice-title { font-size: 20px; }
    .promo-title { font-size: 24px; }
    .promo-grid { gap: 10px; padding: 15px; }
    .promo-card { padding: 14px 8px; }
    .promo-icon { font-size: 28px; }
    .promo-text { font-size: 12px; }
}