:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --accent-orange: #f59e0b;
    --accent-pink: #ec4899;
    --accent-green: #10b981;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
}

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

body {
    font-family: 'Nanum Gothic', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header & Navigation */
header {
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: 'Jua', sans-serif;
    font-size: 1.5rem;
    color: var(--primary-color);
    text-decoration: none;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 1.5rem;
}

nav ul li a {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 600;
    transition: color 0.2s;
}

nav ul li a:hover {
    color: var(--primary-color);
}

/* Main Content Area */
main {
    flex: 1;
    max-width: 1000px;
    margin: 2rem auto;
    padding: 0 2rem;
    width: 100%;
}

.container {
    background: var(--card-bg);
    padding: 3rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    text-align: center;
    margin-bottom: 2rem;
}

h1, h2, h3 {
    font-family: 'Jua', sans-serif;
    margin-bottom: 1.5rem;
}

h1 { font-size: 2.5rem; color: var(--primary-color); }
p { margin-bottom: 1rem; }

/* Buttons */
.btn {
    padding: 0.75rem 2rem;
    border-radius: 9999px;
    font-family: 'Jua', sans-serif;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: inline-block;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

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

/* Lotto Elements */
.lotto-container {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.ball {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.4rem;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
    box-shadow: inset -4px -4px 8px rgba(0,0,0,0.1), 4px 4px 8px rgba(0,0,0,0.1);
    animation: bounceIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes bounceIn {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.ball-1 { background-color: #facc15; } /* 1-10 Yellow */
.ball-2 { background-color: #60a5fa; } /* 11-20 Blue */
.ball-3 { background-color: #f87171; } /* 21-30 Red */
.ball-4 { background-color: #94a3b8; } /* 31-40 Gray */
.ball-5 { background-color: #4ade80; } /* 41-45 Green */

/* Animal Test Elements */
.upload-box {
    border: 3px dashed #e2e8f0;
    border-radius: var(--radius-lg);
    padding: 3rem;
    background: #f1f5f9;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 2rem;
}

.upload-box:hover {
    border-color: var(--primary-color);
    background: #eef2ff;
}

#face-image {
    max-width: 100%;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

/* Result Area */
.result-card {
    background: white;
    padding: 2rem;
    border-radius: var(--radius-lg);
    margin-top: 2rem;
    text-align: left;
}

.result-header {
    text-align: center;
    margin-bottom: 2rem;
}

.result-details {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .result-details { grid-template-columns: 1fr 1fr; }
}

.detail-section h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0.25rem;
}

/* Rich Content Sections */
.article-section {
    background: white;
    padding: 3rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    text-align: left;
    margin-top: 3rem;
}

.article-section h2 { color: var(--text-main); border-left: 5px solid var(--primary-color); padding-left: 1rem; }
.article-section p { color: var(--text-muted); font-size: 1.05rem; }

/* Ad Placeholder */
.ad-placeholder {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 1rem;
    text-align: center;
    margin: 2rem 0;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-style: italic;
    border-radius: 8px;
}

/* Footer */
footer {
    background: #1e293b;
    color: #f1f5f9;
    padding: 3rem 2rem;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
}

@media (min-width: 768px) {
    .footer-content { grid-template-columns: 1fr 1fr 1fr; text-align: left; }
}

.footer-links a {
    color: #cbd5e1;
    text-decoration: none;
    display: block;
    margin-bottom: 0.5rem;
}

.footer-links a:hover { color: white; }

.hidden { display: none !important; }

/* Spinner */
.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

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