:root {
    --primary: #4ade80;
    --primary-glow: rgba(74, 222, 128, 0.5);
    --secondary: #3b82f6;
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-dim: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Pretendard', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px;
}

.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    filter: blur(80px);
}

.blob {
    position: absolute;
    border-radius: 50%;
    opacity: 0.4;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: var(--primary);
    top: -100px;
    left: -100px;
}

.blob-2 {
    width: 300px;
    height: 300px;
    background: var(--secondary);
    bottom: -50px;
    right: -50px;
}

.blob-3 {
    width: 250px;
    height: 250px;
    background: #a855f7;
    top: 40%;
    left: 60%;
}

.layout-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 40px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.ad-sidebar {
    width: 160px;
    position: sticky;
    top: 40px;
    display: none; /* Hidden by default for small screens */
}

.ad-placeholder {
    width: 160px;
    height: 600px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed var(--glass-border);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-dim);
    font-size: 0.9rem;
    text-align: center;
    padding: 20px;
}

.ad-bottom {
    margin-top: 40px;
    width: 100%;
}

.ad-placeholder-horizontal {
    width: 100%;
    height: 100px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed var(--glass-border);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-dim);
    font-size: 0.9rem;
}

.container {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    animation: fadeIn 0.8s ease-out;
    flex-shrink: 0;
}

/* PC Screens (Sidebars visible) */
@media (min-width: 1024px) {
    .ad-sidebar {
        display: block;
    }
}

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

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

header h1 {
    font-size: 2.5rem;
    font-weight: 800;
}

header h1 span {
    color: var(--primary);
    text-shadow: 0 0 20px var(--primary-glow);
}

.subtitle {
    color: var(--text-dim);
    margin-top: 8px;
}

.card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.input-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-dim);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

input[type="number"] {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px;
    font-size: 1.25rem;
    color: white;
    outline: none;
    transition: 0.3s;
}

input[type="number"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
}

.unit {
    position: absolute;
    right: 16px;
    color: var(--text-dim);
    font-weight: 600;
}

button {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 18px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
}

button:active {
    transform: translateY(0);
}

.hidden {
    display: none;
}

.results-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    animation: slideUp 0.5s ease-out;
}

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

.main-calorie-card {
    text-align: center;
    border: 2px solid var(--primary);
}

.calorie-display {
    margin: 16px 0;
}

#target-calories {
    font-size: 3.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, #fff, var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.instruction-box {
    background: rgba(74, 222, 128, 0.1);
    padding: 16px;
    border-radius: 12px;
    border-left: 4px solid var(--primary);
    text-align: left;
    margin-top: 20px;
}

.range-bar-container {
    margin-top: 20px;
}

.range-labels, .range-values {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-bottom: 8px;
}

.range-values {
    margin-top: 8px;
    margin-bottom: 0;
    color: white;
    font-weight: 600;
}

.range-bar {
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    position: relative;
    overflow: hidden;
}

.indicator {
    position: absolute;
    top: 0;
    left: 40%; /* 1.6 position */
    width: 4px;
    height: 100%;
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.nutrition-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 20px;
}

.nutri-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 16px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    border: 1px solid var(--glass-border);
}

.nutri-item .label {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.nutri-item .value {
    font-size: 1.2rem;
    font-weight: 700;
}

.nutri-item .pct {
    font-size: 0.8rem;
    opacity: 0.7;
}

.protein { border-top: 3px solid #f87171; }
.fat { border-top: 3px solid #fbbf24; }
.carb { border-top: 3px solid #3b82f6; }

.fiber-info {
    margin-top: 20px;
    text-align: center;
    font-size: 0.95rem;
    color: var(--primary);
    font-weight: 500;
}

.ratio-adjust-container {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--glass-border);
}

.ratio-adjust-container h4 {
    margin-bottom: 20px;
    font-size: 1rem;
    color: var(--text-dim);
}

.sliders {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.slider-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.slider-group label {
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
}

input[type="range"] {
    width: 100%;
    accent-color: var(--primary);
}

.remaining-cal {
    font-size: 0.8rem;
    color: var(--text-dim);
    font-style: italic;
    margin-top: 8px;
}
