.kwgen-soft-wrapper {
    /* Biến CSS độc lập */
    --neo-border: 3px solid #111111;
    --neo-shadow: 5px 5px 0px #111111;
    
    --bg-main: #f0f4f8;
    --clr-yellow: #fee440;
    --clr-cyan: #00f5d4;
    --clr-red: #ff006e;
    --clr-white: #ffffff;
    --clr-green: #06d6a0;
    --clr-text: #111111;

    max-width: 950px; 
    margin: 0 auto;
    font-family: system-ui, -apple-system, sans-serif;
    color: var(--clr-text);
    background: var(--bg-main);
    padding: 20px;
    border: var(--neo-border);
    border-radius: 16px;
    box-shadow: 6px 6px 0px #111111;
}

.kwgen-soft-wrapper * { box-sizing: border-box; }

.kwgen-soft-header {
    background: #111; padding: 20px; color: #fff;
    border: var(--neo-border); border-radius: 12px;
    text-align: center; margin-bottom: 20px; box-shadow: var(--neo-shadow);
}
.kwgen-soft-header h2 { margin: 0 0 10px 0; font-size: 1.8rem; font-weight: 900; color: var(--clr-yellow); text-transform: uppercase;}
.kwgen-soft-header p { margin: 0; font-weight: 600; font-size: 0.95rem; color: #ccc;}

/* CẢNH BÁO BẢO MẬT (WARNING ALERT) */
.kwgen-alert-box {
    display: flex; align-items: center; gap: 15px; background: #ffe5ec; border: 2px dashed var(--clr-red); 
    border-radius: 10px; padding: 15px; margin-bottom: 20px; box-shadow: 3px 3px 0px rgba(255, 0, 110, 0.2);
}
.kwgen-alert-icon { font-size: 2rem; animation: kwgenBounce 1s infinite; }
@keyframes kwgenBounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.kwgen-alert-content { font-size: 0.9rem; font-weight: 600; color: #721c24; line-height: 1.5; }
.kwgen-alert-content strong { color: var(--clr-red); font-size: 1rem; display: block; margin-bottom: 3px;}

/* BỐ CỤC 2 CỘT */
.kwgen-main-layout { display: flex; flex-direction: column; gap: 20px; }
.kwgen-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 20px;}
@media (min-width: 768px) { .kwgen-main-layout { flex-direction: row; align-items: stretch; } }

/* CARDS */
.kwgen-card {
    padding: 20px; border: var(--neo-border); 
    border-radius: 12px; box-shadow: var(--neo-shadow); display: flex; flex-direction: column; height: 100%;
}
.kwgen-bg-yellow { background: var(--clr-yellow); }
.kwgen-bg-white { background: var(--clr-white); }
.kwgen-bg-cyan { background: var(--clr-cyan); }
.kwgen-card-title { margin: 0 0 15px 0; font-size: 1.2rem; font-weight: 900; border-bottom: 2px dashed #111; padding-bottom: 10px; }

/* INPUTS & RANGE */
.kwgen-group { display: flex; flex-direction: column; gap: 8px; margin-bottom: 15px; }
.kwgen-label { font-weight: 900; font-size: 0.95rem; }
.kwgen-flex-between { display: flex; justify-content: space-between; align-items: center; }

.kwgen-textarea {
    width: 100%; min-height: 120px; padding: 15px; font-family: monospace; font-size: 1rem;
    font-weight: bold; color: #111; background: #fff; border: 3px solid #111; 
    border-radius: 8px; box-shadow: inset 3px 3px 0px rgba(0,0,0,0.05); resize: vertical; outline: none;
}
.kwgen-textarea:focus { border-color: var(--clr-cyan); }
.kwgen-textarea-output { flex: 1; min-height: 250px; background: #fdfdfd; white-space: pre; }

.kwgen-num-input { width: 80px; padding: 8px; border: 2px solid #111; border-radius: 6px; font-weight: 900; font-size: 1rem; text-align: center; outline: none; box-shadow: 2px 2px 0px #111;}
.kwgen-range { -webkit-appearance: none; width: 100%; height: 10px; background: #fff; border: 2px solid #111; border-radius: 5px; outline: none; margin-top: 5px;}
.kwgen-range::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; background: #111; border-radius: 50%; cursor: pointer; }

.kwgen-divider { border: 0; border-top: 2px dashed #111; margin: 5px 0 15px 0; opacity: 0.3; }

/* BUTTONS MAIN */
.kwgen-actions { margin-top: auto; }
.kwgen-btn-main {
    width: 100%; padding: 15px; background: #111; color: var(--clr-cyan);
    border: 2px solid #111; border-radius: 8px; font-size: 1.2rem; font-weight: 900;
    cursor: pointer; box-shadow: 4px 4px 0px var(--clr-cyan); transition: 0.1s; text-transform: uppercase; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.kwgen-btn-main:active { transform: translate(4px, 4px); box-shadow: 0px 0px 0px var(--clr-cyan); }
.kwgen-btn-stop { background: var(--clr-red); color: #fff; box-shadow: 4px 4px 0px #111; }
.kwgen-btn-stop:active { box-shadow: 0px 0px 0px #111; }

/* OUTPUT & STATUS */
.kwgen-badge { background: #eee; padding: 4px 10px; border: 2px solid #111; border-radius: 6px; font-weight: 900; font-size: 0.85rem; box-shadow: 2px 2px 0px #111; }
.kwgen-badge.active { background: var(--clr-green); color: #111; animation: kwgenPulse 1s infinite; }
.kwgen-badge.error { background: var(--clr-red); color: #fff; }
@keyframes kwgenPulse { 0% { opacity: 1; } 50% { opacity: 0.6; } 100% { opacity: 1; } }

.kwgen-info-row { display: flex; justify-content: space-between; align-items: center; margin-top: 15px; flex-wrap: wrap; gap: 10px; }
.kwgen-count-box { font-weight: 800; font-size: 0.95rem; }
.kwgen-count-box b { color: var(--clr-red); font-size: 1.1rem; }

.kwgen-btn-small {
    padding: 8px 15px; background: #fff; border: 2px solid #111; border-radius: 6px;
    font-weight: 900; cursor: pointer; box-shadow: 2px 2px 0px #111; transition: 0.1s;
}
.kwgen-btn-small:active { transform: translate(2px, 2px); box-shadow: 0px 0px 0px #111; }

/* HIỆU ỨNG RUNG LẮC KHI KHÔNG CÓ KẾT QUẢ */
@keyframes kwgenShake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    50% { transform: translateX(6px); }
    75% { transform: translateX(-6px); }
    100% { transform: translateX(0); }
}