:root {
    --bg-color: #0f172a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --primary: #8b5cf6;
    --primary-hover: #7c3aed;
    --secondary: #334155;
    --secondary-hover: #475569;
    --accent: #3b82f6;
    
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 8px;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Noto Sans KR', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow-x: hidden;
}

/* Background Effects */
.background-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
}

.glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.5;
    animation: float 10s infinite ease-in-out alternate;
}

.glow-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, rgba(139,92,246,0.3) 0%, rgba(15,23,42,0) 70%);
}

.glow-2 {
    bottom: -10%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, rgba(59,130,246,0.2) 0%, rgba(15,23,42,0) 70%);
    animation-delay: -5s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(5%, 5%) scale(1.1); }
}

/* Main Container */
.app-container {
    width: 100%;
    max-width: 480px;
    padding: 2rem;
    margin: 2rem auto;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
    z-index: 1;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo-icon {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
    background: -webkit-linear-gradient(45deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Sections */
section {
    display: none;
    animation: fadeIn 0.4s ease-out forwards;
}

section.active {
    display: block;
}

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

/* Upload Area */
.upload-area {
    border: 2px dashed var(--glass-border);
    border-radius: var(--radius-md);
    padding: 3rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.02);
}

.upload-area:hover, .upload-area.dragover {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.05);
}

.upload-content i {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.upload-content h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

/* Preview Section */
.image-wrapper {
    width: 100%;
    aspect-ratio: 1/1;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 1.5rem;
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

#image-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.action-buttons {
    display: flex;
    gap: 1rem;
}

/* Buttons */
.btn {
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
}

.btn.primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    flex: 2;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
    filter: brightness(1.1);
}

.btn.secondary {
    background: var(--secondary);
    color: var(--text-main);
    flex: 1;
}

.btn.secondary:hover {
    background: var(--secondary-hover);
}

.full-width {
    width: 100%;
    margin-top: 1.5rem;
}

/* Loading Section */
#loading-section {
    text-align: center;
    padding: 3rem 0;
}

.loader {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(139, 92, 246, 0.1);
    border-left-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    font-weight: 500;
    color: var(--text-main);
    animation: pulse 1.5s infinite;
}

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

/* Result Section */
.result-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.result-header h2 {
    color: var(--primary);
    font-size: 1.5rem;
}

.match-highlight {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 1.5rem;
}

.match-highlight .subtitle {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

#top-celeb-name {
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: 0.5rem;
    background: -webkit-linear-gradient(45deg, #f8fafc, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.fun-phrase {
    color: var(--accent);
    font-weight: 500;
    font-style: italic;
}

/* Progress Bars */
.chart-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.bar-row {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.bar-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 500;
}

.bar-bg {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 4px;
    width: 0%;
    transition: width 1s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Footer */
footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--glass-border);
}

footer p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

footer .disclaimer {
    margin-top: 0.3rem;
    font-size: 0.7rem;
    opacity: 0.7;
}

/* Responsive */
@media (max-width: 480px) {
    .app-container {
        margin: 0;
        min-height: 100vh;
        border-radius: 0;
        border: none;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
}
