/* 기본 리셋 및 폰트 설정 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    /* 색상 팔레트 */
    --color-bg: #faf8f5;
    --color-primary: #f4e8e0;
    --color-secondary: #e8d8d0;
    --color-accent: #0c3287;
    --color-text: #000000;
    --color-text-light: #4a4a4a;
    --color-white: #ffffff;
    
    /* 그라데이션 */
    --gradient-warm: linear-gradient(135deg, #0c3287 0%, #1a4a9f 100%);
    --gradient-cool: linear-gradient(135deg, #0c3287 0%, #2563b8 100%);
    --gradient-soft: linear-gradient(135deg, #faf8f5 0%, #f0e8e0 100%);
    
    /* 간격 */
    --spacing-xs: 8px;
    --spacing-sm: 16px;
    --spacing-md: 24px;
    --spacing-lg: 40px;
    --spacing-xl: 60px;
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 300;
    background: var(--color-bg);
    color: var(--color-text);
    overflow: hidden;
    height: 100vh;
    position: fixed;
    width: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 진행 상황 인디케이터 */
.progress-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--color-white);
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    font-size: 12px;
    font-weight: 500;
    color: var(--color-accent);
    transition: opacity 0.3s ease;
}

.progress-indicator.hidden {
    opacity: 0;
    pointer-events: none;
}

/* 페이지 컨테이너 */
.pages-container {
    width: 100%;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    overflow: hidden;
}

.page {
    width: 100%;
    height: 100vh;
    display: none;
    opacity: 0;
    padding: 60px 24px 100px;
    position: fixed;
    top: 0;
    left: 0;
    overflow: hidden;
    transition: opacity 0.5s ease;
}

.page.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    opacity: 1;
    animation: fadeIn 0.5s ease;
}

/* 랜딩 페이지 */
.landing-content {
    text-align: center;
    max-width: 400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
}

.main-title {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 36px;
    font-weight: 300;
    color: var(--color-text);
    margin-bottom: var(--spacing-sm);
    letter-spacing: 0px;
}

.main-title .title-my {
    color: #000000;
}

.main-title .title-underscore {
    color: #0c3287;
}

.subtitle {
    font-size: 14px;
    font-weight: 300;
    color: var(--color-text-light);
    letter-spacing: 1px;
    margin-bottom: var(--spacing-lg);
}

.decorative-line {
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--color-accent), transparent);
    margin: var(--spacing-md) auto;
}

.landing-description {
    font-size: 16px;
    line-height: 1.8;
    color: var(--color-text);
    margin: var(--spacing-lg) 0;
    font-weight: 300;
}

.start-btn {
    background: var(--gradient-warm);
    border: none;
    padding: 16px 48px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 500;
    color: var(--color-white);
    cursor: pointer;
    margin-top: var(--spacing-lg);
    box-shadow: 0 4px 15px rgba(12, 50, 135, 0.3);
    transition: all 0.3s ease;
}

.start-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 10px rgba(12, 50, 135, 0.3);
}

/* 페이지 콘텐츠 */
.page-content {
    max-width: 400px;
    margin: 0 auto;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px 0;
}

.page-number {
    font-family: 'Pretendard', sans-serif;
    font-size: 14px;
    font-weight: 300;
    color: var(--color-accent);
    margin-bottom: var(--spacing-xs);
    letter-spacing: 2px;
}

.page-title {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 28px;
    font-weight: 300;
    color: var(--color-accent);
    margin-bottom: var(--spacing-md);
    letter-spacing: 0px;
}

/* 참고 이미지 */
.reference-image {
    width: 100%;
    margin: var(--spacing-md) 0;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.reference-image img {
    width: 100%;
    height: auto;
    display: block;
}

.image-caption {
    text-align: center;
    font-size: 12px;
    color: var(--color-text-light);
    margin-top: var(--spacing-sm);
    font-weight: 300;
}

/* 설명 텍스트 */
.description {
    margin: var(--spacing-md) 0;
}

.main-text {
    font-size: 18px;
    line-height: 1.8;
    color: var(--color-text);
    margin-bottom: var(--spacing-md);
    font-weight: 300;
}

.sub-text {
    font-size: 14px;
    line-height: 1.8;
    color: var(--color-text-light);
    font-weight: 300;
}

/* 가이드 박스 */
.guide-box {
    background: var(--color-white);
    border-radius: 16px;
    padding: var(--spacing-md);
    margin-top: var(--spacing-lg);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.guide-box h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-accent);
    margin-bottom: var(--spacing-sm);
    letter-spacing: 0.5px;
}

.guide-box ul {
    list-style: none;
}

.guide-box ul li {
    font-size: 14px;
    line-height: 1.8;
    color: var(--color-text);
    padding-left: 20px;
    position: relative;
    margin-bottom: 8px;
    font-weight: 300;
}

.guide-box ul li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--color-accent);
    font-weight: bold;
}

/* 감정 스펙트럼 */
.emotion-spectrum {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: var(--spacing-lg) 0;
    padding: var(--spacing-md);
    background: var(--color-white);
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.emoji {
    font-size: 32px;
    flex-shrink: 0;
    animation: float 3s ease-in-out infinite;
}

.emoji:nth-child(2) { animation-delay: 0.2s; }
.emoji:nth-child(4) { animation-delay: 0.4s; }
.emoji:nth-child(6) { animation-delay: 0.6s; }
.emoji:nth-child(8) { animation-delay: 0.8s; }
.emoji:nth-child(10) { animation-delay: 1s; }

.spectrum-line {
    flex: 1;
    height: 2px;
    background: linear-gradient(90deg, var(--color-secondary), var(--color-primary));
    margin: 0 4px;
}

/* 단어 클라우드 비주얼 */
.word-cloud-visual {
    position: relative;
    height: 200px;
    margin: var(--spacing-lg) 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
}

.floating-word {
    font-size: 18px;
    color: var(--color-accent);
    opacity: 0.6;
    font-weight: 400;
    animation: floatWord 4s ease-in-out infinite;
    animation-delay: var(--delay);
}

/* 메시지 예시 */
.message-example {
    margin: var(--spacing-lg) 0;
}

.message-bubble {
    background: var(--color-white);
    border-radius: 16px;
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.message-bubble p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--color-text);
    margin-bottom: var(--spacing-xs);
    font-weight: 300;
}

.hearts {
    font-size: 14px;
    color: #ff6b6b;
}

/* 흔적 옵션 */
.mark-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-sm);
    margin: var(--spacing-lg) 0;
}

.mark-option {
    background: var(--color-white);
    border-radius: 16px;
    padding: var(--spacing-md);
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: transform 0.2s ease;
}

.mark-option:active {
    transform: scale(0.95);
}

.mark-icon {
    font-size: 48px;
    margin-bottom: var(--spacing-xs);
}

.mark-option p {
    font-size: 14px;
    color: var(--color-text);
    font-weight: 400;
}

/* 마지막 페이지 */
.ending-content {
    text-align: center;
    max-width: 400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
}

.ending-title {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 32px;
    font-weight: 300;
    color: var(--color-accent);
    margin-bottom: var(--spacing-md);
    letter-spacing: 0px;
}

.ending-text {
    font-size: 18px;
    line-height: 1.8;
    color: var(--color-text);
    margin: var(--spacing-lg) 0;
    font-weight: 300;
}

.ending-subtext {
    font-size: 14px;
    line-height: 1.8;
    color: var(--color-text-light);
    margin-bottom: var(--spacing-lg);
    font-weight: 300;
}

.ending-quote {
    background: var(--gradient-soft);
    padding: var(--spacing-md);
    border-radius: 16px;
    margin: var(--spacing-lg) 0;
}

.ending-quote p {
    font-size: 16px;
    font-style: italic;
    color: var(--color-text);
    font-weight: 300;
}

.restart-btn {
    background: var(--gradient-cool);
    border: none;
    padding: 16px 40px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-white);
    cursor: pointer;
    margin-top: var(--spacing-lg);
    box-shadow: 0 4px 15px rgba(12, 50, 135, 0.3);
    transition: all 0.3s ease;
}

.restart-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 10px rgba(12, 50, 135, 0.3);
}

/* 네비게이션 */
.navigation {
    position: fixed;
    bottom: 30px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 20px;
    z-index: 100;
    padding: 0 24px;
}

.nav-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: var(--color-white);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--color-accent);
    transition: all 0.3s ease;
}

.nav-btn:active {
    transform: scale(0.9);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.nav-btn.hidden {
    opacity: 0;
    pointer-events: none;
}

/* 애니메이션 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 애니메이션 완료 후 스타일 고정 */
[data-animated="true"] .fade-in,
[data-animated="true"] .fade-in-delay,
[data-animated="true"] .fade-in-delay-2,
[data-animated="true"] .fade-in-delay-3,
[data-animated="true"] .fade-in-delay-4,
[data-animated="true"] .fade-in-delay-5 {
    animation: none !important;
    opacity: 1 !important;
    transform: translateY(0) !important;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-8px);
    }
}

@keyframes floatWord {
    0%, 100% {
        transform: translateY(0px) scale(1);
        opacity: 0.6;
    }
    50% {
        transform: translateY(-15px) scale(1.1);
        opacity: 1;
    }
}

.fade-in {
    animation: fadeIn 0.8s ease forwards;
    animation-fill-mode: forwards;
}

.fade-in-delay {
    animation: fadeIn 0.8s ease 0.2s forwards;
    opacity: 0;
    animation-fill-mode: forwards;
}

.fade-in-delay-2 {
    animation: fadeIn 0.8s ease 0.4s forwards;
    opacity: 0;
    animation-fill-mode: forwards;
}

.fade-in-delay-3 {
    animation: fadeIn 0.8s ease 0.6s forwards;
    opacity: 0;
    animation-fill-mode: forwards;
}

.fade-in-delay-4 {
    animation: fadeIn 0.8s ease 0.8s forwards;
    opacity: 0;
    animation-fill-mode: forwards;
}

.fade-in-delay-5 {
    animation: fadeIn 0.8s ease 1s forwards;
    opacity: 0;
    animation-fill-mode: forwards;
}

/* 애니메이션 완료 후 고정 */
.fade-in,
.fade-in-delay,
.fade-in-delay-2,
.fade-in-delay-3,
.fade-in-delay-4,
.fade-in-delay-5 {
    will-change: auto;
}

/* 페이지 전환 애니메이션 */
.page.slide-out-left {
    animation: slideOutLeft 0.4s ease forwards;
}

.page.slide-in-right {
    animation: slideInRight 0.4s ease forwards;
}

.page.slide-out-right {
    animation: slideOutRight 0.4s ease forwards;
}

.page.slide-in-left {
    animation: slideInLeft 0.4s ease forwards;
}

@keyframes slideOutLeft {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(-100%);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 반응형 - 작은 화면 */
@media (max-width: 375px) {
    .main-title {
        font-size: 32px;
    }
    
    .page-title {
        font-size: 24px;
    }
    
    .main-text {
        font-size: 16px;
    }
    
    .emoji {
        font-size: 28px;
    }
    
    .mark-icon {
        font-size: 40px;
    }
}

/* 반응형 - 큰 화면 (태블릿) */
@media (min-width: 768px) {
    .page-content,
    .landing-content,
    .ending-content {
        max-width: 500px;
    }
    
    .reference-image {
        max-width: 450px;
        margin-left: auto;
        margin-right: auto;
    }
}

/* 터치 액션 - 가로 스와이프만 허용 */
.pages-container {
    touch-action: pan-x;
}

.page {
    touch-action: pan-x;
}

.page-content {
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
}

/* 스크롤바 숨기기 */
::-webkit-scrollbar {
    display: none;
}

body, html {
    -ms-overflow-style: none;
    scrollbar-width: none;
    overflow: hidden;
    height: 100vh;
    position: fixed;
    width: 100%;
}

.page-content::-webkit-scrollbar {
    display: none;
}