:root {
    --primary: #2d3436;
    --accent: #00b894;
    --accent-light: #55efc4;
    --bg: #fdfdfd;
    --card-bg: rgba(255, 255, 255, 0.9);
    --text: #2d3436;
    --text-muted: #636e72;
    --border: #dfe6e9;
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.05);
    --shadow-bold: 0 20px 40px rgba(0, 0, 0, 0.1);
    --ad-bg: #f8f9fa;
}

[data-theme="dark"] {
    --primary: #dfe6e9;
    --accent: #00b894;
    --bg: #0d1117;
    --card-bg: rgba(22, 27, 34, 0.95);
    --text: #f0f6fc;
    --text-muted: #8b949e;
    --border: #30363d;
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.3);
    --ad-bg: #161b22;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', 'Noto Sans KR', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Navigation */
header {
    height: 80px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--card-bg);
}

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

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--accent);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.lang-selector {
    display: flex;
    background: var(--border);
    border-radius: 20px;
    padding: 2px;
}

.lang-selector button {
    border: none;
    background: none;
    padding: 4px 12px;
    border-radius: 18px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-muted);
}

.lang-selector button.active {
    background: var(--accent);
    color: white;
}

.icon-btn {
    background: none;
    border: 1px solid var(--border);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

/* Hero Section */
.hero-section {
    max-width: 1000px;
    margin: 5rem auto;
    text-align: center;
    padding: 0 2rem;
}

.hero-badge {
    display: inline-block;
    padding: 0.5rem 1.2rem;
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 700;
    border-radius: 30px;
    font-size: 0.8rem;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

.hero-title span {
    color: var(--accent);
    background: linear-gradient(120deg, var(--accent), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
}

/* Ads */
.premium-ad-container {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.ad-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.ad-mockup {
    height: 120px;
    background: var(--ad-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
}

/* Card Area */
.card-section {
    max-width: 800px;
    margin: 4rem auto;
    padding: 0 2rem;
}

.card-glass {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 3rem;
    box-shadow: var(--shadow-bold);
    backdrop-filter: blur(10px);
}

.card-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.card-header h2 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.card-header p {
    color: var(--text-muted);
}

.button-container {
    display: flex;
    justify-content: center;
    margin-bottom: 3rem;
}

.primary-btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 1.2rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 16px;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(0, 184, 148, 0.2);
}

.primary-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 30px rgba(0, 184, 148, 0.3);
}

/* Result Box */
.result-box {
    margin-top: 2rem;
    animation: slideUp 0.6s ease-out;
}

.image-wrapper {
    position: relative;
    width: 100%;
    height: 400px;
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-soft);
    background: var(--ad-bg); /* Background color while loading */
}

/* Loading Spinner (LDS Ring) */
.loader-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5;
    background: var(--card-bg);
}

.lds-ring {
    display: inline-block;
    position: relative;
    width: 64px;
    height: 64px;
}
.lds-ring div {
    box-sizing: border-box;
    display: block;
    position: absolute;
    width: 51px;
    height: 51px;
    margin: 6px;
    border: 6px solid var(--accent);
    border-radius: 50%;
    animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    border-color: var(--accent) transparent transparent transparent;
}
.lds-ring div:nth-child(1) { animation-delay: -0.45s; }
.lds-ring div:nth-child(2) { animation-delay: -0.3s; }
.lds-ring div:nth-child(3) { animation-delay: -0.15s; }

@keyframes lds-ring {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.main-food-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0; /* Hidden by default */
    transition: opacity 0.4s ease-in-out;
    z-index: 2;
}

.main-food-image.loaded {
    opacity: 1;
}

.image-wrapper:hover .main-food-image {
    transform: scale(1.05);
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, transparent 60%, rgba(0,0,0,0.5));
}

.title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

#food-name {
    font-size: 2.2rem;
    font-weight: 800;
}

.calorie-badge {
    background: var(--primary);
    color: var(--bg);
    padding: 0.4rem 1rem;
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.9rem;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.tag-list span {
    background: var(--border);
    color: var(--text-muted);
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.stat-item h4 {
    font-size: 1rem;
    margin-bottom: 0.8rem;
    color: var(--accent);
}

.stat-item p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.recipe-box {
    background: var(--ad-bg);
    padding: 1.5rem;
    border-radius: 16px;
    border-left: 4px solid var(--accent);
}

.recipe-box h4 {
    margin-bottom: 0.8rem;
}

.recipe-box p {
    color: var(--text-muted);
}

.hidden {
    display: none;
}

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

footer {
    padding: 4rem 2rem;
    text-align: center;
    border-top: 1px solid var(--border);
}

.footer-logo {
    font-weight: 800;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .hero-title { font-size: 2.5rem; }
    .hero-subtitle { font-size: 1rem; }
    .stats-grid { grid-template-columns: 1fr; }
    .card-glass { padding: 1.5rem; }
    #food-name { font-size: 1.6rem; }
}
