* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

header {
    text-align: center;
    margin-bottom: 40px;
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f1ff 100%);
    padding: 30px 20px;
    border-radius: 15px 15px 0 0;
    margin-left: -40px;
    margin-right: -40px;
    margin-top: -40px;
    border-bottom: 2px solid #e8eaff;
}

header h1 {
    font-size: 2.5rem;
    color: #667eea;
    margin-bottom: 10px;
}

.subtitle {
    color: #667eea;
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 5px;
}

.subtitle-small {
    color: #999;
    font-size: 0.85rem;
    margin-top: 0;
}

.section {
    animation: fadeIn 0.3s ease-in;
}

#menu-section {
    margin-bottom: 40px;
}

.hidden {
    display: none !important;
}

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

/* 메뉴 그리드 */
.section-title {
    text-align: center;
    color: #667eea;
    font-size: 1.5rem;
    margin: 30px 0 20px 0;
    font-weight: 600;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-top: 30px;
}

@media (max-width: 1200px) {
    .menu-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.menu-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 15px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-align: center;
    text-decoration: none;
    display: block;
}

.menu-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.menu-card.dummy {
    cursor: default;
    opacity: 0.9;
    background: linear-gradient(135deg, #ff8c42 0%, #ff6b35 100%);
    position: relative;
    overflow: hidden;
}

.menu-card.dummy::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    animation: shimmer 2.5s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }
    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
    }
}

.menu-card.dummy:hover {
    transform: none;
    box-shadow: none;
}

.menu-card.external {
    background: linear-gradient(135deg, #7fc8a9 0%, #5cb85c 100%);
}

.menu-card.external:hover {
    background: linear-gradient(135deg, #6fb097 0%, #4fa84f 100%);
}

.menu-card.app-card {
    cursor: default;
    background: linear-gradient(135deg, #8fd4b3 0%, #6cc89a 100%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.menu-card.app-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.menu-card.app-card p {
    margin-bottom: 15px;
    flex-grow: 1;
}

.app-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: auto;
}

.app-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    backdrop-filter: blur(10px);
}

.app-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.app-btn span {
    font-size: 1.1rem;
}

.menu-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.menu-card h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
}

.menu-card p {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* 업로드 영역 */
.upload-area {
    margin: 30px 0;
}

.upload-label {
    display: block;
    cursor: pointer;
}

.preview-box {
    border: 3px dashed #667eea;
    border-radius: 15px;
    padding: 60px 20px;
    text-align: center;
    background: #f8f9ff;
    transition: all 0.3s;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-box.small {
    min-height: 200px;
    padding: 40px 20px;
}

.preview-box:hover {
    border-color: #764ba2;
    background: #f0f1ff;
}

.preview-box.dragging {
    border-color: #764ba2;
    background: #e8eaff;
    border-style: solid;
    transform: scale(1.02);
}

.preview-box img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 10px;
}

input[type="file"] {
    display: none;
}

/* 페이지 헤더 영역 (타이틀 + 돌아가기 버튼) */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.page-header h2 {
    margin: 0;
    flex: 1;
}

/* 버튼 */
.back-btn {
    background: #f0f0f0;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    margin-left: 20px;
}

.back-btn:hover {
    background: #e0e0e0;
}

.analyze-btn {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.3s;
    margin-top: 20px;
}

.analyze-btn:hover:not(:disabled) {
    opacity: 0.9;
}

.analyze-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.7;
}

.analyze-btn .btn-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

/* 로딩 */
.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 결과 카드 */
.result {
    margin-top: 30px;
    animation: fadeIn 0.5s ease-in;
}

.result-card {
    background: #f8f9ff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    border-left: 4px solid #667eea;
}

.result-card h3 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.result-card p {
    line-height: 1.6;
    color: #333;
}

.info-box {
    background: #e3f2fd;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.lucky-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.lucky-item {
    background: white;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
}

.ideal-image {
    margin-top: 20px;
    text-align: center;
}

.ideal-image img {
    max-width: 100%;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.compatibility-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

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

.upload-col h4 {
    margin-bottom: 10px;
    color: #667eea;
}

.score-display {
    text-align: center;
    padding: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px;
    margin-bottom: 20px;
}

.score-display h2 {
    font-size: 3rem;
    margin: 10px 0;
}

/* 쿠팡 파트너스 배너 스타일 */
.partner-banner-container {
    width: 100%;
    margin: 30px 0;
    background: transparent;
}

.partner-banner-wrapper {
    width: 100%;
    text-align: center;
}

.partner-banner-wrapper iframe,
.partner-banner-wrapper script {
    display: block;
    margin: 0 auto;
    width: 100%;
    height: auto;
}

.partner-banner-iframe {
    width: 100%;
    height: 140px;
}

/* Footer 스타일 */
.site-footer {
    margin-top: 40px;
    padding: 30px 20px;
    border-top: 2px solid #e8eaff;
    border-bottom: none;
    text-align: center;
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f1ff 100%);
    border-radius: 0 0 15px 15px;
    margin-left: -40px;
    margin-right: -40px;
    margin-bottom: -40px;
}

.footer-note {
    color: #999;
    font-size: 0.85rem;
    margin: 0 0 20px 0;
}

.footer-info {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.footer-brand {
    font-size: 1rem;
    font-weight: 600;
    color: #667eea;
    margin: 0 0 10px 0;
}

.footer-details {
    font-size: 0.85rem;
    color: #666;
    margin: 0 0 8px 0;
    line-height: 1.5;
}

.footer-details-part {
    display: inline;
}

.footer-details-part::after {
    content: " | ";
}

.footer-details-part:last-child::after {
    content: "";
}

.footer-contact {
    font-size: 0.85rem;
    color: #666;
    margin: 0;
    line-height: 1.5;
}

.footer-contact-part {
    display: inline;
}

.footer-contact-part::after {
    content: " ｜ ";
}

.footer-contact-part:last-child::after {
    content: "";
}

/* 공유 버튼 스타일 */
.share-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
    flex-wrap: wrap;
}

.share-button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
}

.share-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.share-button.copy {
    background: #6366f1;
    color: white;
}

.share-button.copy:hover {
    background: #4f46e5;
}

.share-button.kakao {
    background: #fee500;
    color: #000;
}

.share-button.kakao:hover {
    background: #fdd835;
}

.share-button.instagram {
    background: linear-gradient(
        45deg,
        #f09433 0%,
        #e6683c 25%,
        #dc2743 50%,
        #cc2366 75%,
        #bc1888 100%
    );
    color: white;
}

.share-button.instagram:hover {
    background: linear-gradient(
        45deg,
        #e0852e 0%,
        #d55931 25%,
        #c72439 50%,
        #b71d5c 75%,
        #a7157a 100%
    );
}

/* 모바일 배너 */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .section-title {
        font-size: 1.2rem;
        margin: 20px 0 15px 0;
    }
    
    .menu-grid {
        grid-template-columns: 1fr;
    }
    
    .compatibility-grid {
        grid-template-columns: 1fr;
    }
    
    .partner-banner-container {
        margin: 20px 0;
    }
    
    .partner-banner-iframe {
        width: 100%;
        max-width: 100%;
        height: 66px; /* 680:140 비율 유지: (140/680) * 320 ≈ 66 */
    }
    
    header {
        margin-left: -20px;
        margin-right: -20px;
        margin-top: -20px;
        padding: 20px 15px;
    }
    
    .site-footer {
        margin-top: 30px;
        padding: 20px 15px;
        margin-left: -20px;
        margin-right: -20px;
        margin-bottom: -20px;
    }
    
    .footer-note {
        font-size: 0.8rem;
    }
    
    .footer-brand {
        font-size: 0.9rem;
    }
    
    .footer-details,
    .footer-contact {
        font-size: 0.75rem;
    }
    
    .footer-details-part {
        display: block;
    }
    
    .footer-details-part::after {
        content: "";
    }
    
    .footer-contact-part {
        display: block;
    }
    
    .footer-contact-part::after {
        content: "";
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .page-header h2 {
        margin-bottom: 10px;
    }
    
    .back-btn {
        margin-left: 0;
        width: 100%;
    }
    
    .share-buttons {
        flex-direction: column;
        margin-top: 20px;
        padding-top: 15px;
    }
    
    .share-button {
        padding: 10px 20px;
        font-size: 13px;
        width: 100%;
    }
}

/* 로딩 및 에러 컨테이너 */
.loading-container,
.error-container {
    text-align: center;
    padding: 40px 20px;
}

.loading-container p,
.error-container p {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 20px;
}

/* 광고 배너 섹션 */
.ads-section {
    margin-top: 60px;
    margin-bottom: 40px;
    padding: 30px 0;
    border-top: 2px solid #e8eaff;
}

/* 광고 배너 영역 */
.ads-banner-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.ads-container {
    width: 250px;
    height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

@media (max-width: 850px) {
    .ads-section {
        margin-top: 40px;
        padding: 20px 0;
    }
    
    .ads-banner-row {
        flex-direction: column;
        gap: 20px;
    }
}
