:root {
    --primary: #2c3e50;
    --accent: #3498db;
    --light: #ecf0f1;
    --success: #27ae60;
    --radius: 8px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    color: #333;
    margin: 0;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
}

header {
    text-align: center;
    border-bottom: 2px solid var(--light);
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.logo {
    font-size: 2.2em;
    font-weight: 800;
    color: var(--primary);
}

.logo span {
    color: var(--accent);
}

.credit-badge {
    margin-top: 10px;
    padding: 5px 15px;
    background: #eef2f3;
    display: inline-block;
    border-radius: 20px;
    border: 1px solid #ddd;
}

.credit-badge small {
    color: #555;
    font-weight: 600;
    font-size: 0.9em;
}

.credit-badge span {
    color: #2c3e50;
    font-weight: 800;
}

.guide-box {
    background: #eef7fd;
    border-left: 4px solid var(--accent);
    padding: 15px 20px;
    border-radius: 4px;
    margin-bottom: 30px;
}

.card {
    background: #fff;
    border: 1px solid #e1e4e8;
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

input,
select {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-family: monospace;
}

.input-group {
    display: flex;
    gap: 10px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* CSS BARU: GRID 3 KOLOM UNTUK 3D */
.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
}

.dynamic-row {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.btn-secondary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0 20px;
    border-radius: 4px;
    cursor: pointer;
    height: 38px;
}

.mode-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.mode-btn {
    padding: 12px 25px;
    background: white;
    border: 2px solid var(--accent);
    color: var(--accent);
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
}

.mode-btn:hover,
.mode-btn.active {
    background: var(--accent);
    color: white;
}

.btn-generate {
    width: 100%;
    padding: 15px;
    background-color: var(--success);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-generate:hover {
    background-color: #219150;
}

.hidden {
    display: none;
}

.hidden-section {
    background: #f8f9fa;
    padding: 15px;
    border-radius: var(--radius);
    border: 1px dashed #ccc;
}

#plot-area {
    width: 100%;
    height: 650px;
    margin-top: 30px;
    border: 1px solid #ddd;
    border-radius: var(--radius);
}

/* =========================================
   RESPONSIVE DESIGN
   ========================================= */

/* Tablet (max-width: 768px) */
@media (max-width: 768px) {
    .container {
        width: 95%;
        padding: 20px;
    }

    .grid-3 {
        grid-template-columns: 1fr 1fr;
        /* 3 kolom jadi 2 kolom di tablet */
    }

    .mode-buttons {
        flex-wrap: wrap;
    }

    .mode-btn {
        flex: 1;
        text-align: center;
    }
}

/* Mobile (max-width: 480px) */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .container {
        width: 100%;
        padding: 15px;
        border-radius: 0;
        box-shadow: none;
    }

    header {
        margin-bottom: 20px;
    }

    .logo {
        font-size: 1.8em;
    }

    /* Semua Grid jadi 1 kolom */
    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }

    .input-group {
        flex-direction: column;
    }

    .btn-secondary {
        width: 100%;
    }

    .dynamic-row {
        grid-template-columns: 1fr;
        /* Nama variabel di atas, fungsi di bawah */
        gap: 5px;
    }

    /* Tombol Generate & Download jadi stack vertikal */
    .card>div[style*="display: flex"] {
        flex-direction: column;
    }

    .btn-generate,
    .card>div[style*="display: flex"]>button {
        width: 100%;
        flex: none !important;
    }

    #plot-area {
        height: 400px;
        /* Perkecil plot di HP */
    }
}