/* --- Global Styles & Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700&display=swap');

:root {
    --primary-color: #a264f2;
    --secondary-color: #7b2cbf;
    --accent-color: #f264d8;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --bg-dark: #120c18;
    --bg-glass: rgba(255, 255, 255, 0.05);
    --border-glass: rgba(255, 255, 255, 0.1);
    --shadow-light: rgba(162, 100, 242, 0.4);
    --shadow-dark: rgba(0, 0, 0, 0.5);
    --border-radius: 16px;
    --font-family: 'Noto Sans KR', sans-serif;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.7;
    overflow-x: hidden;
    position: relative;
}

/* --- Container & Layout --- */
.container {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

main {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

/* --- Header --- */
.header {
    text-align: center;
    padding: 2rem 0;
    animation: fadeInDown 1s ease-out;
}

.header h1 {
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #fff;
}

.title-glow {
    text-shadow: 0 0 8px var(--shadow-light), 0 0 20px var(--accent-color);
}

.header p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 300;
}

/* --- Navigation --- */
.nav {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--bg-glass);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border-glass);
    border-radius: var(--border-radius);
    box-shadow: 0 8px 32px 0 var(--shadow-dark);
    animation: fadeInDown 1s ease-out 0.2s;
    animation-fill-mode: both;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1.5rem;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
}

.nav-brand i { color: var(--accent-color); }

.nav-menu {
    display: flex;
    gap: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.nav-link:hover {
    color: #fff;
    background-color: var(--bg-glass);
}

.nav-link.active {
    color: #fff;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    box-shadow: 0 4px 15px -5px var(--shadow-light);
}

.nav-toggle { display: none; }

/* --- General Card Style --- */
.card {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-glass);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: 0 8px 32px 0 var(--shadow-dark);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: fadeInUp 1s ease-out 0.4s;
    animation-fill-mode: both;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px 0 rgba(0,0,0,0.6);
}

.card-title {
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 2rem;
    font-weight: 500;
    color: #fff;
}
.card-title i {
    color: var(--primary-color);
    margin-right: 0.7rem;
}

/* --- Upload Card --- */
.upload-area {
    border: 2px dashed var(--border-glass);
    border-radius: var(--border-radius);
    padding: 3rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.upload-area:hover, .upload-area.dragover {
    border-color: var(--accent-color);
    background-color: rgba(162, 100, 242, 0.1);
}

.upload-icon-wrapper {
    font-size: 3.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}
.upload-area:hover .upload-icon-wrapper {
    transform: scale(1.1) rotate(-5deg);
    color: var(--accent-color);
}

.upload-text { font-size: 1.2rem; font-weight: 500; margin-bottom: 0.5rem; }
.upload-hint { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 1.5rem; }

.privacy-notice {
    background: rgba(40, 30, 50, 0.5);
    border-radius: 10px;
    padding: 0.8rem 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.privacy-notice i { color: var(--accent-color); }

/* --- Image Preview & Analyze Button --- */
.image-preview-section {
    display: none;
    text-align: center;
    margin-top: 2rem;
    animation: fadeIn 0.5s ease;
}
#imagePreview {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--border-radius);
    border: 2px solid var(--border-glass);
    margin-bottom: 2rem;
    box-shadow: 0 8px 20px var(--shadow-dark);
}

/* --- Buttons --- */
.btn {
    padding: 0.8rem 2rem;
    border: none;
    border-radius: 10px;
    font-family: var(--font-family);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff;
    box-shadow: 0 4px 20px -5px var(--shadow-light);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 7px 25px -5px var(--shadow-light);
}

.btn-primary:disabled {
    background: #555;
    color: #999;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.btn-secondary {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
}
.btn-secondary:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

/* --- Analysis Result --- */
.analysis-result.active {
    display: block;
    animation: fadeInUp 1s ease-out;
}
.analysis-complete {
    padding: 2rem;
    text-align: center;
}

.result-illust {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 1.5rem auto;
    border: 4px solid var(--accent-color);
    box-shadow: 0 0 25px var(--accent-color);
    animation: popIn 0.8s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.result-title {
    font-size: 2.2rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 1rem;
    text-shadow: 0 2px 10px var(--shadow-dark);
    animation: fadeInDown 1s ease-out 0.2s;
    animation-fill-mode: both;
}

.result-description {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-primary);
    margin-bottom: 2.5rem;
    animation: fadeIn 1s ease-out 0.4s;
    animation-fill-mode: both;
}

/* Lucky Numbers */
.lucky-number {
    margin: 2rem 0;
    animation: fadeIn 1s ease-out 0.6s;
    animation-fill-mode: both;
}
.lucky-number h3 {
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 1rem;
    color: var(--accent-color);
}
.number {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
}
.lucky-number .number span {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff;
    width: 45px;
    height: 45px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    font-size: 1.2rem;
    font-weight: 700;
    box-shadow: 0 4px 15px -5px var(--shadow-light);
    transition: all 0.3s ease;
}
.lucky-number .number span:hover {
    transform: translateY(-5px) scale(1.1);
}

/* Share Section */
.share-section {
    margin-top: 2.5rem;
    animation: fadeInUp 1s ease-out 0.8s;
    animation-fill-mode: both;
}
.share-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
}
.btn-copy {
    background: #FEE500; /* Kakao color */
    color: #3C1E1E;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.2rem;
    padding: 0;
    box-shadow: 0 4px 10px rgba(254, 229, 0, 0.3);
}
.btn-copy:hover {
    box-shadow: 0 6px 15px rgba(254, 229, 0, 0.5);
}

/* --- Content Cards (관상정보) --- */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}
.info-block h3 {
    color: var(--accent-color);
    font-size: 1.2rem;
    margin-bottom: 1rem;
}
.info-block p, .info-block ul {
    color: var(--text-secondary);
    line-height: 1.8;
}
.fact-list {
    list-style: none;
    padding-left: 0;
}
.fact-list li {
    margin-bottom: 0.5rem;
}
.fact-list li::before {
    content: '✨';
    margin-right: 0.5rem;
}

/* --- Footer --- */
.footer {
    border-top: 1px solid var(--border-glass);
    margin-top: 2rem;
    padding: 3rem 0;
    text-align: center;
}
.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    max-width: 900px;
    margin: 0 auto 2rem auto;
    padding: 0 20px;
    text-align: left;
}
.footer-section h3, .footer-section h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}
.footer-section p, .footer-section ul li {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}
.footer-section ul { list-style: none; }
.footer-section a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
}
.footer-section a:hover { color: var(--accent-color); }
.footer-bottom {
    font-size: 0.9rem;
    color: #888;
}

/* --- Loading Modal --- */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background: rgba(18, 12, 24, 0.8);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
}
.modal-content {
    text-align: center;
    color: #fff;
}
.modal-content p {
    margin-top: 1.5rem;
    font-size: 1.2rem;
    font-weight: 500;
}
.galaxy-spinner {
    width: 100px;
    height: 100px;
    position: relative;
    animation: rotate-galaxy 2s linear infinite;
}
.star {
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: #fff;
    border-radius: 50%;
    box-shadow: 0 0 10px #fff, 0 0 20px var(--accent-color);
}
.star:nth-child(1) { top: 10px; left: 46px; }
.star:nth-child(2) { top: 25px; left: 80px; transform: scale(0.8); }
.star:nth-child(3) { top: 60px; left: 85px; transform: scale(0.6); }
.star:nth-child(4) { top: 85px; left: 46px; transform: scale(0.9); }
.star:nth-child(5) { top: 60px; left: 5px; transform: scale(0.7); }
.star:nth-child(6) { top: 25px; left: 10px; transform: scale(0.85); }

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

/* --- Animations --- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes popIn { from { opacity: 0; transform: scale(0.5); } to { opacity: 1; transform: scale(1); } }

/* --- Responsive Design --- */
@media (max-width: 768px) {
    .header h1 { font-size: 2.2rem; }
    .nav-toggle {
        display: flex;
        flex-direction: column;
        gap: 5px;
        cursor: pointer;
    }
    .nav-toggle span {
        width: 25px;
        height: 2px;
        background-color: #fff;
        transition: all 0.3s ease;
    }
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: #1a1420;
        flex-direction: column;
        padding: 1rem 0;
    }
    .nav-menu.active { display: flex; }
    .content-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .container, main { gap: 1.5rem; }
    .card { padding: 1.5rem; }
    .header h1 { font-size: 1.8rem; }
    .upload-area { padding: 2rem 1rem; }
    .result-illust { width: 150px; height: 150px; }
    .result-title { font-size: 1.8rem; }
    .footer-content { grid-template-columns: 1fr; text-align: center; }
}