:root {
    /* Light Theme (Default) */
    --primary-color: #03c75a;
    --primary-hover: #02b351;
    --text-black: #1e1e23;
    --text-gray: #666;
    --text-light: #999;
    --bg-main: #ffffff;
    --bg-gray: #f5f6f8;
    --border-color: #e3e5e8;
    --card-bg: #ffffff;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    --kakao-yellow: #fee500;
}

[data-theme="dark"] {
    /* Dark Theme Override */
    --text-black: #f5f6f8;
    --text-gray: #b0b0b0;
    --text-light: #888;
    --bg-main: #121212;
    --bg-gray: #1e1e1e;
    --border-color: #333;
    --card-bg: #1e1e1e;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-black);
    line-height: 1.6;
}

/* Header */
.app-header {
    border-bottom: 1px solid var(--border-color);
    padding: 0 20px;
    background: var(--bg-main);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 600px;
    margin: 0 auto;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
}

nav {
    display: flex;
    align-items: center;
}

nav a {
    text-decoration: none;
    color: var(--text-gray);
    margin-left: 20px;
    font-size: 0.95rem;
    font-weight: 500;
}

nav a.active {
    color: var(--primary-color);
    font-weight: 700;
}

/* Theme Toggle Button */
.theme-toggle-btn {
    background: none;
    border: none;
    color: var(--text-gray);
    cursor: pointer;
    margin-left: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
}

.theme-toggle-btn:hover {
    background: var(--bg-gray);
    color: var(--primary-color);
}

/* Main Container */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Hero Section */
.hero-section {
    text-align: center;
    margin-bottom: 40px;
}

.hero-section h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-black);
}

.subtitle {
    color: var(--text-gray);
    font-size: 1rem;
}

/* Upload Area */
.upload-area-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-bottom: 40px;
}

.upload-area {
    width: 100%;
    max-width: 400px;
    height: 300px;
    border: 2px dashed var(--border-color);
    border-radius: 20px;
    background-color: var(--bg-gray);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
    position: relative;
}

.upload-area:hover {
    border-color: var(--primary-color);
}

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

.upload-icon {
    width: 60px;
    height: 60px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 15px;
}

.upload-text {
    font-weight: 500;
    color: var(--text-black);
    margin-bottom: 5px;
}

.upload-hint {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* Image Preview */
.preview-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000;
}

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

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-main);
    opacity: 0.9;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--bg-gray);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

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

/* Buttons */
.secondary-btn {
    padding: 10px 20px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-gray);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

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

/* Result Section */
.result-section {
    width: 100%;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.result-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 30px 20px;
    box-shadow: var(--shadow);
    text-align: center;
}

.result-header .badge {
    background-color: var(--primary-color);
    color: white;
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 700;
    margin-bottom: 10px;
    display: inline-block;
}

.result-header h3 {
    font-size: 1.6rem;
    margin-bottom: 10px;
}

.result-description {
    color: var(--text-gray);
    margin-bottom: 30px;
    font-size: 1rem;
    line-height: 1.5;
}

/* Charts */
.chart-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
    padding: 0 10px;
}

.chart-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.label {
    width: 60px;
    text-align: left;
    font-weight: 500;
    font-size: 0.9rem;
}

.bar-bg {
    flex: 1;
    height: 10px;
    background-color: var(--bg-gray);
    border-radius: 5px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 5px;
    width: 0%;
    transition: width 1s ease-out;
}

.percentage {
    width: 40px;
    text-align: right;
    font-size: 0.85rem;
    color: var(--text-gray);
}

/* Social Share */
.share-area {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.share-btn {
    flex: 1;
    max-width: 140px;
    border: none;
    padding: 12px 0;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: opacity 0.2s;
}

.share-btn:hover {
    opacity: 0.9;
}

.share-btn.naver {
    background-color: #03c75a;
    color: white;
}

.share-btn.kakao {
    background-color: var(--kakao-yellow);
    color: #3b1e1e;
}

/* Ad Placeholder */
.ad-banner {
    margin-top: 40px;
    height: 100px;
    background: var(--bg-gray);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
}

.ad-placeholder {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-light);
    font-size: 0.8rem;
    background: var(--bg-gray);
    border-top: 1px solid var(--border-color);
}

.disclaimer {
    margin-top: 5px;
    font-size: 0.75rem;
}

/* Animations */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 480px) {
    .container {
        padding: 20px;
    }
    
    .logo {
        font-size: 1.1rem;
    }

    .result-card {
        padding: 20px 15px;
    }
}
