:root {
    --primary: oklch(0.75 0.18 145); /* 좀 더 밝고 포근한 그린 */
    --primary-dark: oklch(0.65 0.18 145);
    --secondary: oklch(0.82 0.12 60); /* 따뜻한 피치/오렌지 */
    --accent: oklch(0.85 0.08 90); /* 부드러운 베이지/옐로우 */
    --bg: oklch(0.99 0.01 100); /* 거의 화이트에 가까운 깨끗한 배경 */
    --card-white: #ffffff;
    --text: oklch(0.25 0.02 100);
    --text-light: oklch(0.5 0.02 100);
    --shadow-soft: 0 20px 40px rgba(0, 0, 0, 0.04);
    --shadow-warm: 0 15px 35px oklch(0.82 0.12 60 / 0.1);
    --radius-lg: 32px;
    --radius-md: 20px;
}

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

body {
    font-family: 'Pretendard', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* Background Texture */
.background-texture {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.02;
    pointer-events: none;
}

/* Navigation */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 40px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(15px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.2rem;
    font-weight: 800;
    text-decoration: none;
    color: var(--text);
}

.brand-logo {
    height: 36px;
    width: auto;
}

.lang-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 50px;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

/* Steps Transition */
.step {
    display: none !important;
}

.step.active {
    display: block !important;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

/* Main Layout */
#app {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
}

.hero-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

body.step-2 .hero-header,
body.step-3 .hero-header {
    display: none;
}

.hero-logo {
    height: 110px;
    width: auto;
    filter: drop-shadow(0 10px 25px rgba(0,0,0,0.08));
}

header h1 {
    font-size: 2.8rem;
    font-weight: 800;
    letter-spacing: -1.5px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.section-title {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 50px;
    text-align: center;
}

/* Cuisine Selector */
.cuisine-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(157px, 1fr));
    gap: 21px;
}

.cuisine-card {
    background: white;
    border-radius: var(--radius-md);
    padding: 20px 10px;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(0,0,0,0.03);
    transition: all 0.4s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.cuisine-card:hover {
    transform: translateY(-11px);
    border-color: var(--primary);
    box-shadow: 0 21px 43px rgba(0,0,0,0.08);
}

.cuisine-card .cuisine-image {
    width: 12.8rem;
    height: 12.8rem;
    object-fit: contain;
    margin-bottom: 12px;
    display: block;
}

.cuisine-card .label {
    font-size: 2.5rem;
    font-weight: 900;
    letter-spacing: -2px;
}

/* Ingredient Input */
.cozy-card {
    background: var(--card-white);
    padding: 50px 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    border: 1px solid oklch(0.95 0.01 100);
    margin-top: 20px;
}

.subtitle {
    text-align: center;
    margin-bottom: 30px;
    font-weight: 600;
    font-size: 1.2rem;
}

.input-group {
    display: flex;
    gap: 12px;
    background: oklch(0.98 0.01 100);
    padding: 10px;
    border-radius: 50px;
    border: 2px solid oklch(0.93 0.01 100);
    transition: all 0.3s;
    margin-bottom: 30px;
}

#ingredient-input {
    flex: 1;
    border: none;
    padding: 15px 25px;
    font-size: 1.1rem;
    font-weight: 500;
    outline: none;
    background: transparent;
}

.action-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 50px;
    width: 100%;
}

.primary-btn, .secondary-btn, .add-btn {
    border-radius: 50px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.add-btn {
    background: var(--primary);
    color: white;
    padding: 0 35px;
    font-size: 1rem;
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 20px 50px;
    font-size: 1.2rem;
    box-shadow: 0 10px 25px oklch(0.75 0.18 145 / 0.3);
}

.secondary-btn {
    background: oklch(0.96 0.01 100);
    color: var(--text);
    padding: 20px 40px;
    font-size: 1.1rem;
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-bottom: 40px;
}

.tag {
    background: oklch(0.96 0.02 145);
    color: var(--primary-dark);
    padding: 10px 22px;
    border-radius: 50px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid oklch(0.9 0.02 145);
}

/* Loading & Results - 정렬 및 크기 고정 절대 경로 적용 */
.loading-container {
    grid-column: 1 / -1 !important; /* 그리드 전체 너비 강제 */
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    width: 100% !important;
    min-height: 400px;
    margin: 0 auto !important;
}

.loading-video-wrapper {
    width: 250px !important;
    max-width: 250px !important;
    height: auto !important;
    margin: 0 auto 25px !important;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.12);
}

.loading-video {
    width: 100% !important;
    display: block !important;
}

/* 단순한 스피너 스타일 */
.loader {
    width: 48px;
    height: 48px;
    border: 5px solid var(--accent);
    border-bottom-color: var(--primary);
    border-radius: 50%;
    display: inline-block;
    animation: rotation 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* Recipe Card Styling */
.recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin: 30px auto;
    max-width: 900px;
    justify-content: center;
    align-items: start;
}

.recipe-card {
    background: white;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(0,0,0,0.03);
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.recipe-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.08);
}

.recipe-img {
    height: 160px;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.recipe-info {
    padding: 20px;
    flex: 1;
    text-align: center;
}

/* Search Action Buttons */
.search-actions a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px;
    border-radius: 16px;
    font-weight: 800;
    font-size: 1.05rem;
    transition: all 0.3s ease;
    width: 100%;
}

.youtube-btn { background: #FF0000; color: white; }
.google-btn { background: #4285F4; color: white; }
.coupang-btn { background: oklch(0.85 0.12 145); color: oklch(0.3 0.1 145); }

/* Modal */
#recipe-modal {
    border: none;
    border-radius: var(--radius-lg);
    padding: 0;
    max-width: 750px; /* 기존 550px에서 확장 */
    width: 95%;
    max-height: 85vh;
    margin: auto;
    box-shadow: 0 30px 60px rgba(0,0,0,0.25);
    overflow: hidden;
}

#modal-body {
    max-height: calc(85vh - 20px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

#modal-body::-webkit-scrollbar {
    width: 6px;
}

#modal-body::-webkit-scrollbar-thumb {
    background-color: var(--primary);
    border-radius: 10px;
}

.badge {
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

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

.badge.time {
    background: var(--accent);
    color: oklch(0.3 0.1 60);
}

#recipe-modal::backdrop {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
}

/* Footer */
footer {
    margin-top: 100px;
    padding: 60px 20px;
    text-align: center;
    background: white;
    border-top: 1px solid rgba(0,0,0,0.03);
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 10px;
}

/* Responsive */
@media (max-width: 600px) {
    .cuisine-grid { grid-template-columns: 1fr; }
    .recipe-grid { display: flex; flex-direction: column; gap: 20px; }
}
