/* 전역 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #FF6B6B;
    --secondary-color: #FFD93D;
    --accent-color: #6BCF7F;
    --text-dark: #2D3436;
    --text-light: #636E72;
    --bg-light: #FFF9E6;
    --bg-card: #FFFFFF;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.15);
    --border-radius: 20px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Apple SD Gothic Neo', 
                 'Noto Sans KR', sans-serif;
    background: linear-gradient(135deg, #FFF9E6 0%, #FFE8CC 100%);
    min-height: 100vh;
    color: var(--text-dark);
    overflow-x: hidden;
}

/* 화면 전환 */
.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
    animation: fadeIn 0.5s ease-in-out;
}

.screen.active {
    display: block;
}

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

.container {
    max-width: 600px;
    margin: 0 auto;
}

/* 헤더 */
.header {
    text-align: center;
    margin-bottom: 40px;
    padding-top: 20px;
}

.title {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(255, 107, 107, 0.2);
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-light);
    font-weight: 500;
}

/* 업로드 섹션 */
.upload-section {
    margin-bottom: 30px;
}

.upload-box {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 60px 30px;
    box-shadow: var(--shadow);
    border: 3px dashed var(--secondary-color);
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-box:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.upload-content {
    text-align: center;
}

.upload-icon {
    font-size: 5rem;
    margin-bottom: 20px;
    animation: bounce 2s infinite;
}

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

.upload-text {
    font-size: 1.2rem;
    color: var(--text-dark);
    margin-bottom: 25px;
    line-height: 1.6;
    font-weight: 600;
}

/* 버튼 스타일 */
.btn-primary, .btn-secondary, .btn-share {
    width: 100%;
    padding: 18px 30px;
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #FF8E53);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: white;
    color: var(--text-dark);
    border: 2px solid var(--secondary-color);
    margin-top: 15px;
}

.btn-share {
    background: linear-gradient(135deg, var(--accent-color), #4ECDC4);
    color: white;
    font-size: 1.2rem;
    margin-bottom: 15px;
}

.btn-share span {
    font-size: 1.3rem;
    margin-right: 8px;
}

/* 이미지 프리뷰 */
.image-preview {
    text-align: center;
}

.image-preview.hidden {
    display: none;
}

.image-preview img {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    background: white;
}

/* 개인정보 보호 인라인 안내 */
.privacy-notice-inline {
    margin: 12px 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.privacy-text {
    font-size: 0.75rem;
    color: var(--text-dark);
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
    background: rgba(107, 207, 127, 0.12);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1.5px solid #6BCF7F;
    transition: all 0.3s ease;
}

.privacy-text:hover {
    background: rgba(107, 207, 127, 0.18);
    box-shadow: 0 2px 8px rgba(107, 207, 127, 0.2);
}

/* 체크박스 관련 스타일 제거 (더 이상 사용하지 않음) */
.privacy-checkbox {
    display: none;
}

.checkmark {
    display: none;
}

/* 정보 섹션 */
.info-section {
    text-align: center;
    margin-top: 30px;
    margin-bottom: 20px;
}

.info-text {
    font-size: 0.75rem;
    color: var(--text-light);
    margin: 6px 0;
    font-weight: 500;
}

/* 안내 섹션 */
.notice-section {
    margin-top: 20px;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.notice-box {
    background: var(--bg-card);
    border-radius: 10px;
    padding: 10px 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    display: flex;
    gap: 10px;
    align-items: center;
    border-left: 3px solid;
    transition: all 0.3s ease;
}

.notice-box:hover {
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
}

.notice-box.ai-info {
    border-left-color: #4ECDC4;
}

.notice-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    line-height: 1;
}

.notice-content {
    flex: 1;
}

.notice-text {
    font-size: 0.75rem;
    line-height: 1.4;
    color: var(--text-light);
    margin: 0;
}

.notice-text strong {
    color: var(--text-dark);
    font-weight: 600;
}

/* 광고 배너 */
.ad-banner {
    margin-top: 20px;
    margin-bottom: 20px;
    text-align: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 10px;
}

.ad-label {
    font-size: 0.65rem;
    color: #999;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ad-placeholder {
    background: linear-gradient(135deg, #f5f5f5, #e0e0e0);
    border: 1px dashed #ccc;
    border-radius: 8px;
    padding: 15px 10px;
    min-height: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.ad-placeholder p {
    margin: 0;
    font-size: 0.85rem;
    color: #999;
}

.ad-size {
    font-size: 0.7rem !important;
    color: #bbb !important;
}

/* 분석 중 화면 */
.analyzing-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
}

.scanning-animation {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin-bottom: 40px;
}

.scanning-animation img {
    width: 100%;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
}

.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--accent-color), transparent);
    animation: scan 2s linear infinite;
    z-index: 10;
}

@keyframes scan {
    0% {
        top: 0;
    }
    100% {
        top: 100%;
    }
}

.scan-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 3px solid var(--accent-color);
    border-radius: var(--border-radius);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
}

.analyzing-text {
    text-align: center;
}

.analyzing-text h2 {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.loading-dots {
    font-size: 2rem;
    color: var(--accent-color);
}

.loading-dots span {
    animation: blink 1.4s infinite;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes blink {
    0%, 100% {
        opacity: 0.2;
    }
    50% {
        opacity: 1;
    }
}

/* 결과 카드 */
.result-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 30px;
    position: relative;
    border: 4px solid var(--secondary-color);
    background-image: 
        linear-gradient(45deg, rgba(255, 217, 61, 0.05) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(255, 217, 61, 0.05) 25%, transparent 25%);
    background-size: 20px 20px;
}

.card-header {
    text-align: center;
    margin-bottom: 25px;
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 15px;
}

.card-title {
    font-size: 1.8rem;
    color: var(--primary-color);
    font-weight: 800;
}

.pet-image-container {
    text-align: center;
    margin-bottom: 30px;
}

.pet-image-container img {
    width: 100%;
    max-width: 300px;
    border-radius: 50%;
    border: 5px solid var(--secondary-color);
    box-shadow: var(--shadow);
}

.pet-type-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, var(--accent-color), #4ECDC4);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: var(--shadow);
}

/* 관상 내용 */
.fortune-content {
    margin-top: 20px;
}

.fortune-section {
    background: rgba(255, 255, 255, 0.7);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 15px;
    border-left: 5px solid var(--accent-color);
}

.fortune-section.total {
    background: linear-gradient(135deg, rgba(255, 217, 61, 0.2), rgba(255, 142, 83, 0.2));
    border-left: 5px solid var(--primary-color);
    border: 3px solid var(--primary-color);
}

.fortune-section h3 {
    font-size: 1.3rem;
    color: var(--text-dark);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.fortune-section p {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-dark);
}

/* 해시태그 */
.hashtags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
    justify-content: center;
}

.hashtag {
    background: var(--secondary-color);
    color: var(--text-dark);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

/* 액션 버튼 */
.action-buttons {
    margin-bottom: 30px;
}

/* 푸터 정보 */
.footer-info {
    text-align: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--border-radius);
}

.footer-info p {
    font-size: 0.95rem;
    color: var(--text-light);
    margin: 5px 0;
}

/* 로딩 오버레이 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.hidden {
    display: none;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-content p {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.loading-subtext {
    font-size: 0.9rem;
    opacity: 0.7;
}

/* 반응형 디자인 */
@media (max-width: 480px) {
    .title {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .upload-box {
        padding: 40px 20px;
    }

    .upload-icon {
        font-size: 4rem;
    }

    .btn-primary, .btn-secondary, .btn-share {
        padding: 15px 25px;
        font-size: 1rem;
    }

    .result-card {
        padding: 20px;
    }

    .card-title {
        font-size: 1.5rem;
    }

    .fortune-section h3 {
        font-size: 1.1rem;
    }

    .pet-type-badge {
        font-size: 0.8rem;
        padding: 6px 12px;
    }

    /* 개인정보 보호 안내 모바일 최적화 */
    .privacy-notice-inline {
        margin: 10px 0;
    }

    .privacy-text {
        font-size: 0.7rem;
        padding: 6px 12px;
        line-height: 1.3;
    }

    /* 정보 섹션 모바일 최적화 */
    .info-section {
        margin-top: 20px;
        margin-bottom: 15px;
    }

    .info-text {
        font-size: 0.7rem;
        margin: 5px 0;
    }

    /* 안내 박스 모바일 최적화 */
    .notice-section {
        margin-top: 15px;
        margin-bottom: 10px;
        gap: 6px;
    }

    .notice-box {
        padding: 8px 10px;
        gap: 8px;
        border-radius: 8px;
    }

    .notice-icon {
        font-size: 1rem;
    }

    .notice-text {
        font-size: 0.7rem;
        line-height: 1.3;
    }

    /* 광고 배너 모바일 최적화 */
    .ad-banner {
        margin-top: 15px;
        margin-bottom: 15px;
        padding: 8px;
    }

    .ad-placeholder {
        min-height: 50px;
        padding: 12px 8px;
    }

    .ad-placeholder p {
        font-size: 0.8rem;
    }
}

/* iOS Safe Area */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }
}
