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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e3a8a 0%, #0ea5e9 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    background: #f8fbff;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(2, 132, 199, 0.25);
    margin-bottom: 30px;
    text-align: center;
}

header h1 {
    color: #0b3b68;
    font-size: 2.5em;
    margin-bottom: 10px;
}

header p {
    color: #1e40af;
    font-size: 1.1em;
}

main {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 20px;
}

/* 제어 패널 */
.control-panel {
    background: #f8fbff;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 20px rgba(2, 132, 199, 0.15);
    height: fit-content;
}

.control-panel h2 {
    color: #0b3b68;
    margin-bottom: 20px;
    font-size: 1.5em;
    border-bottom: 3px solid #3b82f6;
    padding-bottom: 10px;
}

.control-group {
    margin-bottom: 25px;
}

.control-group h3 {
    color: #0b3b68;
    font-size: 1.1em;
    margin-bottom: 12px;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
    color: white;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-warning {
    background: #fb923c;
    color: white;
}

.btn-info {
    background: #38bdf8;
    color: white;
}

.btn-wind {
    background: #60a5fa;
    color: white;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.slider {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #ddd;
    outline: none;
    margin: 10px 0;
}

.slider::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
}

.env-display {
    background: #e0f2fe;
    padding: 15px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.env-display div {
    font-size: 1em;
    color: #0b3b68;
}

.env-display strong {
    color: #1e40af;
}

/* 농장 섹션 */
.farm-section {
    background: #f8fbff;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 20px rgba(2, 132, 199, 0.15);
    margin-bottom: 20px;
}

.farm-section h2 {
    color: #0b3b68;
    margin-bottom: 20px;
    font-size: 1.5em;
    border-bottom: 3px solid #0ea5e9;
    padding-bottom: 10px;
}

.farm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

/* 화분 스타일 */
.plant-pot {
    background: linear-gradient(to bottom, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 3px 10px rgba(2, 132, 199, 0.12);
    position: relative;
    transition: all 0.3s ease;
}

.plant-pot:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(2, 132, 199, 0.2);
}

.ai-label {
    position: absolute;
    top: 15px;
    left: 15px;
    background: #2563eb;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    z-index: 10;
}

.status-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    z-index: 10;
}

.status-healthy {
    background: #10b981;
    color: white;
}

.status-stressed {
    background: #60a5fa;
    color: white;
}

.status-critical {
    background: #ef4444;
    color: white;
}

.plant-container {
    width: 100%;
    height: 320px;
    position: relative;
    margin: 50px 0 20px 0;
    overflow: visible;
}

.plant-container svg {
    position: absolute;
    bottom: 35px;
    left: 0;
    right: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    overflow: visible;
}

.soil {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 45px;
    /* Solid fallback color */
    background-color: #3a2a17;
    border-radius: 0 0 10px 10px;
    /* Subtle top highlight and inner shadow for depth */
    box-shadow:
        inset 0 10px 14px rgba(255, 255, 255, 0.06),
        inset 0 -6px 12px rgba(0, 0, 0, 0.35),
        0 -6px 12px rgba(0, 0, 0, 0.15);
    z-index: 1;
    /* Fine grain texture using layered gradients + base brown gradient */
    background-image:
        radial-gradient(1px 1px at 10% 30%, rgba(0,0,0,0.15) 0, rgba(0,0,0,0) 70%),
        radial-gradient(1px 1px at 30% 60%, rgba(255,255,255,0.08) 0, rgba(255,255,255,0) 70%),
        radial-gradient(1px 1px at 60% 40%, rgba(0,0,0,0.18) 0, rgba(0,0,0,0) 70%),
        radial-gradient(1px 1px at 80% 70%, rgba(255,255,255,0.05) 0, rgba(255,255,255,0) 70%),
        linear-gradient(to bottom, #6b4f2a 0%, #4a341d 60%, #3a2a17 100%);
    /* Blend noise layers over the base gradient */
    background-blend-mode: multiply, screen, multiply, screen, normal;
}

.plant-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 15px;
}

.plant-info div {
    background: white;
    padding: 8px;
    border-radius: 8px;
    font-size: 0.9em;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* 로그 섹션 */
.log-section {
    background: #f8fbff;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 20px rgba(2, 132, 199, 0.15);
    grid-column: 1 / -1;
}

.log-section h2 {
    color: #0b3b68;
    margin-bottom: 15px;
    font-size: 1.5em;
    border-bottom: 3px solid #38bdf8;
    padding-bottom: 10px;
}

.log-container {
    max-height: 300px;
    overflow-y: auto;
    background: #e0f2fe;
    border-radius: 8px;
    padding: 15px;

    /* 줄기 길이 조절 섹션 */
    .length-controls-section {
        margin: 24px 0 48px;
        padding: 12px 16px;
        background: #f8fafb;
        border: 1px solid #e6eef2;
        border-radius: 8px;
    }
    .length-controls {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
        gap: 12px 16px;
    }
    .length-control-item label {
        display: block;
        font-size: 14px;
        margin-bottom: 6px;
    }
    .length-control-item .slider.small {
        width: 100%;
    }
    .muted {
        color: #6b7280;
        font-size: 13px;
        margin-top: -4px;
        margin-bottom: 12px;
    }
    .human-baseline {
        margin-top: 8px;
        font-size: 12px;
        color: #374151;
    }
}

.log-entry {
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 5px;
    display: flex;
    gap: 15px;
    font-size: 0.9em;
}

.log-time {
    font-weight: 600;
    min-width: 80px;
}

.log-message {
    flex: 1;
}

.log-info {
    background: #dbeafe;
    border-left: 4px solid #3b82f6;
}

.log-success {
    background: #dcfce7;
    border-left: 4px solid #10b981;
}

.log-warning {
    background: #ffedd5;
    border-left: 4px solid #fb923c;
}

.log-error {
    background: #fee2e2;
    border-left: 4px solid #ef4444;
}

/* 반응형 */
@media (max-width: 1024px) {
    main {
        grid-template-columns: 1fr;
    }
    
    .farm-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 1.8em;
    }
    
    .farm-grid {
        grid-template-columns: 1fr;
    }
}
